Adds syntatic suggar to pick random numbers in IEnums

--- Figlotech.Core/Extensions/IEnumerableExtensions.cs
+++ Figlotech.Core/Extensions/IEnumerableExtensions.cs
@@ -12,6 +12,31 @@
 {
     public static class IEnumerableExtensions
     {
+        public static void SetAllTo<T>(this T[] me, T val) {
+            for(int i = 0; i < me.Length; i++) {
+                me[i] = val;
+            }
+        }
+
+        public static IEnumerable<T> PickRandom<T>(this IEnumerable<T> me, int count) {
+            var arr = me.ToArray();
+            var r = new Random();
+            var pickedNumbers = new int[Math.Min(arr.Length, count)];
+            pickedNumbers.SetAllTo(-1);
+            int cursor = 0;
+            for(int i = 0; i < count; i++) {
+                if (cursor >= pickedNumbers.Length) {
+                    pickedNumbers.SetAllTo(-1);
+                }
+                int pick = 0;
+                do {
+                    pick = r.Next(0, arr.Length);
+                } while (pickedNumbers.Contains(pick));
+                pickedNumbers[i % pickedNumbers.Length] = pick;
+                cursor++;
+                yield return arr[pickedNumbers[i]];
+            }
+        }

         public static DataTable ToDataTable<T>(this IEnumerable<T> me) {
             var dt = new DataTable();


Refactored: 改行位置の調整。

Refactored: 改行位置の調整。

--- Implem.Outputs/Libraries/Views/HtmlAggregations.cs
+++ Implem.Outputs/Libraries/Views/HtmlAggregations.cs
@@ -35,8 +35,7 @@
                     .Text(text: Displays.NoData()));
         }

-        private static HtmlBuilder Total(
-           this HtmlBuilder hb, Aggregations aggregations)
+        private static HtmlBuilder Total(this HtmlBuilder hb, Aggregations aggregations)
         {
             return hb
                 .Span(css: "label", action: () => hb
@@ -133,9 +132,7 @@
             }
         }

-        private static string Selector(
-            SiteSettings siteSettings,
-            string columnName)
+        private static string Selector(SiteSettings siteSettings, string columnName)
         {
             return "#DataViewFilters_" + siteSettings.ReferenceType + "_" + columnName;
         }


しがみつく車両をプレイヤから一番近いものだけを取得できるように変更

しがみつく車両をプレイヤから一番近いものだけを取得できるように変更

--- Inferno/InfernoScripts/Player/PlayerGripVehicle.cs
+++ Inferno/InfernoScripts/Player/PlayerGripVehicle.cs
@@ -52,21 +52,20 @@
         private void GripAction()
         {
             var gripAvailableVeles = CachedVehicles
-                            .Where(x => x.IsSafeExist() && x.IsInRangeOf(PlayerPed.Position, 10.0f));
-            foreach (var veh in gripAvailableVeles)
-            {
-                var isTouchingEntity = Function.Call<bool>(Hash.IS_ENTITY_TOUCHING_ENTITY, PlayerPed, veh);
-                if (!isTouchingEntity) continue;
-                _isGriped = true;
-                var playerRHandCoords = PlayerPed.GetBoneCoord(Bone.SKEL_R_Hand);
+                .Where(x => x.IsSafeExist() && x.IsInRangeOf(PlayerPed.Position, 10.0f))
+                .OrderBy(x => x.Position.DistanceTo(PlayerPed.Position))
+                .First();

-                var ofsetPosition = Function.Call<Vector3>(Hash.GET_OFFSET_FROM_ENTITY_GIVEN_WORLD_COORDS,
-                    veh,
-                    playerRHandCoords.X,
-                    playerRHandCoords.Y,
-                    playerRHandCoords.Z);
-                Grip(PlayerPed, veh, ofsetPosition);
-            }
+            if (!gripAvailableVeles.IsTouchingEntity(PlayerPed)) return;
+            _isGriped = true;
+            var playerRHandCoords = PlayerPed.GetBoneCoord(Bone.SKEL_R_Hand);
+
+            var ofsetPosition = Function.Call<Vector3>(Hash.GET_OFFSET_FROM_ENTITY_GIVEN_WORLD_COORDS,
+                gripAvailableVeles,
+                playerRHandCoords.X,
+                playerRHandCoords.Y,
+                playerRHandCoords.Z);
+            Grip(PlayerPed, gripAvailableVeles, ofsetPosition);
         }

         /// <summary>


Packet class improved

Packet class improved

--- EpServerEngine.cs/EpServerEngine.cs/General/Packet.cs
+++ EpServerEngine.cs/EpServerEngine.cs/General/Packet.cs
@@ -139,6 +139,20 @@
         {
             return m_packetSize;
         }
+
+        /// <summary>
+        /// Return the size of packet allocated in byte
+        /// </summary>
+        /// <returns>the size of packet allocated in byte</returns>
+        public int GetAllocatedByteSize()
+        {
+            if (m_packet != null)
+            {
+                return m_packet.Length;
+            }
+            return 0;
+        }
+
         /// <summary>
         /// Check the flag whether allocated memory or not
         /// </summary>
@@ -166,6 +180,15 @@
             {
                	if(m_isAllocated)
 	            {
+                    if (m_packet != null)
+                    {
+                        if (m_packet.Length >= packetByteSize)
+                        {
+                            Array.Copy(packet, m_packet, packetByteSize);
+                            m_packetSize = packetByteSize;
+                            return;
+                        }
+                    }
 		            m_packet=null;
 		            if(packetByteSize>0)
 		            {


Synchronize JsonUnknownSymbolSyntax with PgnIllegalCharacterSyntax.

--- Eutherion/Shared/Text/Json/JsonUnknownSymbolSyntax.cs
+++ Eutherion/Shared/Text/Json/JsonUnknownSymbolSyntax.cs
@@ -29,16 +29,32 @@
     /// </summary>
     public sealed class GreenJsonUnknownSymbolSyntax : JsonForegroundSymbol
     {
+        /// <summary>
+        /// Gets a friendly representation of the unknown symbol.
+        /// </summary>
         public string DisplayCharValue { get; }

         public override bool IsValueStartSymbol => true;

+        /// <summary>
+        /// Gets the length of the text span corresponding with this node.
+        /// </summary>
         public override int Length => JsonUnknownSymbolSyntax.UnknownSymbolLength;

         public override bool HasErrors => true;

-        public JsonErrorInfo GetError(int startPosition) => JsonUnknownSymbolSyntax.CreateError(DisplayCharValue, startPosition);
-
+        /// <summary>
+        /// Initializes a new instance of <see cref="GreenJsonUnknownSymbolSyntax"/>.
+        /// </summary>
+        /// <param name="displayCharValue">
+        /// A friendly representation of the unknown symbol.
+        /// </param>
+        /// <exception cref="ArgumentNullException">
+        /// <paramref name="displayCharValue"/> is null.
+        /// </exception>
+        /// <exception cref="ArgumentException">
+        /// <paramref name="displayCharValue"/> is empty.
+        /// </exception>
         public GreenJsonUnknownSymbolSyntax(string displayCharValue)
         {
             if (displayCharValue == null) throw new ArgumentNullException(nameof(displayCharValue));
@@ -46,6 +62,17 @@

             DisplayCharValue = displayCharValue;
         }
+
+        /// <summary>
+        /// Creates a <see cref="JsonErrorInfo"/> for this syntax node.
+        /// </summary>
+        /// <param name="startPosition">
+        /// The start position for which to create the error.
+        /// </param>
+        /// <returns>
+        /// The new <see cref="JsonErrorInfo"/>.
+        /// </returns>
+        public JsonErrorInfo GetError(int startPosition) => JsonUnknownSymbolSyntax.CreateError(DisplayCharValue, startPosition);

         public override IEnumerable<JsonErrorInfo> GetErrors(int startPosition) => new SingleElementEnumerable<JsonErrorInfo>(GetError(startPosition));

@@ -61,7 +88,16 @@
         /// <summary>
         /// Creates a <see cref="JsonErrorInfo"/> for unexpected symbol characters.
         /// </summary>
-        public static JsonErrorInfo CreateError(string displayCharValue, int position)
-            => new JsonErrorInfo(JsonErrorCode.UnexpectedSymbol, position, 1, new[] { displayCharValue });
+        /// <param name="displayCharValue">
+        /// A friendly representation of the unknown symbol.
+        /// </param>
+        /// <param name="startPosition">
+        /// The start position for which to create the error.
+        /// </param>
+        /// <returns>
+        /// The new <see cref="JsonErrorInfo"/>.
+        /// </returns>
+        public static JsonErrorInfo CreateError(string displayCharValue, int startPosition)
+            => new JsonErrorInfo(JsonErrorCode.UnexpectedSymbol, startPosition, UnknownSymbolLength, new[] { displayCharValue });
     }
 }


Fix API docs links

Fix API docs links

--- docs/tools/templates/template.cshtml
+++ docs/tools/templates/template.cshtml
@@ -45,7 +45,8 @@

Documentation

-
Core Documentation

+
Core Documentation

+
Internal API Docs


Forgot a file

Forgot a file

--- GameServer/Logic/Packets/PacketHandlers/PacketEnum.cs
+++ GameServer/Logic/Packets/PacketHandlers/PacketEnum.cs
@@ -67,6 +67,7 @@
         PKT_S2C_UpdateModel = 0x97,
         PKT_S2C_TurretSpawn = 0x9D,
         PKT_S2C_NPC_Hide = 0x9E, // (4.18) not sure what this became
+        PKT_S2C_SurrenderResult = 0xA5,
         PKT_S2C_SetHealth = 0xAE,
         PKT_S2C_SpellAnimation = 0xB0,
         PKT_S2C_CastSpellAns = 0xB5,


- clear the cache if there are more than 500 elements stored (could be improved)

--- HudsonTrayTracker/BusinessComponents/HudsonService.cs
+++ HudsonTrayTracker/BusinessComponents/HudsonService.cs
@@ -196,6 +196,10 @@
             {
                 lock (this)
                 {
+                    // clear the cache if there are too many elements (could be improved)
+                    if (cache.Count > 500)
+                        cache.Clear();
+                    // store in cache
                     cache[url] = res;
                 }
             }


Propagate a variable rename

Propagate a variable rename

Oversight on my part.

--- LINQToTTree/LINQToTTreeLib/Files/StatementFillTree.cs
+++ LINQToTTree/LINQToTTreeLib/Files/StatementFillTree.cs
@@ -85,7 +85,10 @@
         /// <param name="newName"></param>
         public void RenameVariable(string originalName, string newName)
         {
-            throw new NotImplementedException();
+            foreach (var variable in _columnValues)
+            {
+                variable.Item1.RenameRawValue(originalName, newName);
+            }
         }

         /// <summary>


Also include the logo in the data classes

--- Libraries/ModInstallation/Util/DataClassExtensions.cs
+++ Libraries/ModInstallation/Util/DataClassExtensions.cs
@@ -22,7 +22,8 @@
                 id = mod.Id,
                 packages = mod.Packages.Select(ToDataClass),
                 title = mod.Title,
-                version = mod.Version.ToString()
+                version = mod.Version.ToString(),
+                logo = mod.LogoUri == null ? null : mod.LogoUri.ToString()
             };
         }


ProcessLogic independent from Auth

ProcessLogic independent from Auth

--- Signum.Engine.Extensions/Processes/ProcessLogic.cs
+++ Signum.Engine.Extensions/Processes/ProcessLogic.cs
@@ -114,7 +114,6 @@
                 SymbolLogic<ProcessAlgorithmSymbol>.Start(sb, () => registeredProcesses.Keys.ToHashSet());

                 OperationLogic.AssertStarted(sb);
-                AuthLogic.AssertStarted(sb);
                 CacheLogic.AssertStarted(sb);

                 ProcessGraph.Register();


fix WordTemplateLogic

fix WordTemplateLogic

--- Signum.Engine.Extensions/Word/WordTemplateLogic.cs
+++ Signum.Engine.Extensions/Word/WordTemplateLogic.cs
@@ -214,7 +214,7 @@

         static SqlPreCommand Schema_Synchronize_Tokens(Replacements replacements)
         {
-            if (!Database.Query<WordTemplateEntity>().Any() || !SafeConsole.Ask("Synchronize WordTemplates?"))
+            if (!Database.Query<WordTemplateEntity>().Any() || !replacements.Interactive || !SafeConsole.Ask("Synchronize WordTemplates?"))
                 return null;

             StringDistance sd = new StringDistance();


dont Repeat operation in ForEachMultiple if the lite is the same

--- Signum.React/ApiControllers/OperationController.cs
+++ Signum.React/ApiControllers/OperationController.cs
@@ -185,7 +185,7 @@
         static Dictionary<string, string> ForeachMultiple(IEnumerable<Lite<Entity>> lites, Action<Lite<Entity>> action)
         {
             Dictionary<string, string> errors = new Dictionary<string, string>();
-            foreach (var lite in lites)
+            foreach (var lite in lites.Distinct())
             {
                 try
                 {


fix CSharpRenderer

fix CSharpRenderer

--- Signum.Utilities/ExpressionTrees/CSharpRenderer.cs
+++ Signum.Utilities/ExpressionTrees/CSharpRenderer.cs
@@ -115,7 +115,7 @@

         public static string TypeName(this Type type)
         {
-            List<Type> arguments = type.IsGenericType ? type.GetGenericArguments().ToList() : null;
+            List<Type> arguments = type.IsGenericType ? type.GetGenericArguments().ToList() : new List<Type>();

             StringBuilder sb = new StringBuilder();
             foreach (var item in type.Follow(a => a.IsNested ? a.DeclaringType : null).Reverse())


EntityDetails.EntityControl default to new DataBorder {AutoChild = true}

--- Signum.Windows/EntityControls/EntityDetail.xaml.cs
+++ Signum.Windows/EntityControls/EntityDetail.xaml.cs
@@ -59,6 +59,13 @@
         {
             InitializeComponent();
             this.AddHandler(Common.ChangeDataContextEvent, new ChangeDataContextHandler(ChangeEntity));
+            this.Loaded += new RoutedEventHandler(EntityDetail_Loaded);
+        }
+
+        void EntityDetail_Loaded(object sender, RoutedEventArgs e)
+        {
+            if (EntityControl == null)
+                EntityControl = new DataBorder { AutoChild = true };
         }

         void ChangeEntity(object sender, ChangeDataContextEventArgs e)


switched finalizer.cs to the new style references

--- src/runtime/finalizer.cs
+++ src/runtime/finalizer.cs
@@ -17,14 +17,18 @@

         public class ErrorArgs : EventArgs
         {
+            public ErrorArgs(Exception error)
+            {
+                Error = error ?? throw new ArgumentNullException(nameof(error));
+            }
             public bool Handled { get; set; }
-            public Exception Error { get; set; }
+            public Exception Error { get; }
         }

         public static readonly Finalizer Instance = new Finalizer();

-        public event EventHandler<CollectArgs> BeforeCollect;
-        public event EventHandler<ErrorArgs> ErrorHandler;
+        public event EventHandler<CollectArgs>? BeforeCollect;
+        public event EventHandler<ErrorArgs>? ErrorHandler;

         const int DefaultThreshold = 200;
         [DefaultValue(DefaultThreshold)]
@@ -47,29 +51,49 @@
         // Keep these declarations for compat even no FINALIZER_CHECK
         internal class IncorrectFinalizeArgs : EventArgs
         {
-            public IntPtr Handle { get; internal set; }
-            public ICollection<IntPtr> ImpactedObjects { get; internal set; }
+            public IncorrectFinalizeArgs(IntPtr handle, IReadOnlyCollection<IntPtr> imacted)
+            {
+                Handle = handle;
+                ImpactedObjects = imacted;
+            }
+            public IntPtr Handle { get; }
+            public IReadOnlyCollection<IntPtr> ImpactedObjects { get; }
         }

         internal class IncorrectRefCountException : Exception
         {
             public IntPtr PyPtr { get; internal set; }
-            private string _message;
-            public override string Message => _message;
+            string? message;
+            public override string Message
+            {
+                get
+                {
+                    if (message is not null) return message;
+                    var gil = PythonEngine.AcquireLock();
+                    try
+                    {
+                        using var pyname = Runtime.PyObject_Str(new BorrowedReference(PyPtr));
+                        string name = Runtime.GetManagedString(pyname.BorrowOrThrow()) ?? Util.BadStr;
+                        message = $"<{name}> may has a incorrect ref count";
+                    }
+                    finally
+                    {
+                        PythonEngine.ReleaseLock(gil);
+                    }
+                    return message;
+                }
+            }

             internal IncorrectRefCountException(IntPtr ptr)
             {
                 PyPtr = ptr;
-                IntPtr pyname = Runtime.PyObject_Str(PyPtr);
-                string name = Runtime.GetManagedString(pyname);
-                Runtime.XDecref(pyname);
-                _message = $"<{name}> may has a incorrect ref count";
+
             }
         }

         internal delegate bool IncorrectRefCntHandler(object sender, IncorrectFinalizeArgs e);
         #pragma warning disable 414
-        internal event IncorrectRefCntHandler IncorrectRefCntResolver = null;
+        internal event IncorrectRefCntHandler? IncorrectRefCntResolver = null;
         #pragma warning restore 414
         internal bool ThrowIfUnhandleIncorrectRefCount { get; set; } = true;

@@ -134,17 +158,15 @@
                         if (!_objQueue.TryDequeue(out obj))
                             continue;

-                        Runtime.XDecref(obj);
+                        IntPtr copyForException = obj;
+                        Runtime.XDecref(StolenReference.Take(ref obj));
                         try
                         {
                             Runtime.CheckExceptionOccurred();
                         }
                         catch (Exception e)
                         {
-                            var errorArgs = new ErrorArgs
-                            {
-                                Error = e,
-                            };
+                            var errorArgs = new ErrorArgs(e);

                             ErrorHandler?.Invoke(this, errorArgs);

@@ -152,7 +174,7 @@
                             {
                                 throw new FinalizationException(
                                     "Python object finalization failed",
-                                    disposable: obj, innerException: e);
+                                    disposable: copyForException, innerException: e);
                             }
                         }
                     }
@@ -251,7 +273,11 @@
         /// its reference count. This should only ever be called during debugging.
         /// When the result is disposed or finalized, the program will crash.
         /// </summary>
-        public PyObject DebugGetObject() => new(this.Handle);
+        public PyObject DebugGetObject()
+        {
+            IntPtr dangerousNoIncRefCopy = this.Handle;
+            return new(StolenReference.Take(ref dangerousNoIncRefCopy));
+        }

         public FinalizationException(string message, IntPtr disposable, Exception innerException)
             : base(message, innerException)


絵文字変換時の正規表現パターン文字列を修正 # 「.」は不要だったんですね・・・

--- Mastoom.Shared/Converters/String2EmojiConverter.cs
+++ Mastoom.Shared/Converters/String2EmojiConverter.cs
@@ -20,7 +20,7 @@
 					return text;
 				}

-                string strRegex = @":(.[a-zA-Z0-9_]+):";
+                string strRegex = @":([a-zA-Z0-9_]+):";
                 Regex myRegex = new Regex(strRegex, RegexOptions.None);
                 string strTargetString = text;


print fixed

print fixed

Former-commit-id: 0fea315730ff2974d1c8b810af83c3f50735338a

--- MeTLMeeting/SandRibbon/Utils/Connection/Printer.cs
+++ MeTLMeeting/SandRibbon/Utils/Connection/Printer.cs
@@ -48,14 +48,14 @@
                 var privateCanvas = new InkCanvas();
                 foreach (var stroke in ink)
                 {
-                    if((stroke.privacy == "public" || stroke.target=="presentationSpace") && (stroke.target != "quizAuthoring"))
+                    if((stroke.privacy == "public" || stroke.target=="presentationSpace"))
                         publicCanvas.Strokes.Add(stroke.stroke);
                     else if(stroke.target== "notepad")
                         privateCanvas.Strokes.Add(stroke.stroke);
                 }
                 foreach (var image in images)
                 {
-                    if ((image.Value.privacy == "public" || image.Value.target == "presentationSpace") && (image.Value.target != "quizAuthoring"))
+                    if (image.Value.privacy == "public" || image.Value.target == "presentationSpace")
                         publicCanvas.Children.Add(image.Value.image);
                     else if(image.Value.target== "notepad")
                         privateCanvas.Children.Add(image.Value.image);
@@ -66,7 +66,7 @@
                     textbox.BorderThickness = new Thickness(0);
                     textbox.BorderBrush = new SolidColorBrush(Colors.Transparent);
                     textbox.Background = new SolidColorBrush(Colors.Transparent);
-                    if ((box.Value.privacy == "public" || box.Value.target == "presentationSpace") && (box.Value.target != "quizAuthoring"))
+                    if (box.Value.privacy == "public" || box.Value.target == "presentationSpace")
                         publicCanvas.Children.Add(textbox);
                     else if(box.Value.target== "notepad")
                         privateCanvas.Children.Add(textbox);
@@ -110,7 +110,6 @@
         }
         public void PrintPrivate(string title, string user)
         {
-
             var printDocument = new Action<IEnumerable<PrintParser>>(ShowPrintDialogWithNotes);
             var conversation = ConversationDetailsProviderFactory.Provider.DetailsOf(title);
             targetPageCount = conversation.Slides.Where(s=>s.type == Slide.TYPE.SLIDE).Count();


Reorganized async code in ServiceHost.QueueTasks to use callbacks instead of blocking.

--- Source/Applications/openMIC/openMIC/ServiceHost.cs
+++ Source/Applications/openMIC/openMIC/ServiceHost.cs
@@ -506,27 +506,36 @@
             string actionURI = $"{targetUri}/api/Operations/QueueTasks?taskID={UrlEncode(taskID)}&priority={UrlEncode(priority.ToString())}&target={UrlEncode(acronym)}";
             HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, actionURI);

-            try
-            {
-                Task<HttpResponseMessage> task = s_http.SendAsync(request);
-                task.Wait();
-
-                HttpResponseMessage response = task.Result;
-
+            void Succeed(HttpResponseMessage response)
+            {
                 if (response.StatusCode == HttpStatusCode.OK)
                     LogStatusMessage($"REMOTE QUEUE: Successfully executed remote queue action \"{actionURI}\" for \"{acronym}\" task load at \"{priority}\" priority");
                 else
                     throw new Exception($"REMOTE QUEUE: Failed to execute remote queue action \"{actionURI}\" for \"{acronym}\", HTTP response = {response.StatusCode}: {response.ReasonPhrase}");
             }
-            catch (Exception ex)
+
+            void Fail(Exception ex)
             {
                 if (ex is AggregateException aggEx)
-                    LogException(new Exception($"REMOTE QUEUE: Failed to execute remote queue action \"{actionURI}\" for \"{acronym}\": {string.Join(", ", aggEx.InnerExceptions.Select(innerEx => innerEx.Message))}"));
+                    LogException(new Exception($"REMOTE QUEUE: Failed to execute remote queue action \"{actionURI}\" for \"{acronym}\": {string.Join(", ", aggEx.InnerExceptions.Select(innerEx => innerEx.Message))}", ex));
                 else
                     LogException(ex);

                 // Move on to next pool machine when remote queue fails
                 QueueTasks(acronym, taskID, priority);
+            }
+
+            try
+            {
+                s_http.SendAsync(request).ContinueWith(task =>
+                {
+                    try { Succeed(task.Result); }
+                    catch (Exception ex) { Fail(ex); }
+                });
+            }
+            catch (Exception ex)
+            {
+                Fail(ex);
             }
         }


Updated ServiceHost to use RollingFileAppender rather than FileAppender.

git-tfs-id: [https://tfs.codeplex.com/tfs/TFS07]$/openXDA/Main;C94369

--- Source/Applications/openXDA/openXDA/ServiceHost.cs
+++ Source/Applications/openXDA/openXDA/ServiceHost.cs
@@ -118,7 +118,7 @@
         private void ServiceHelper_ServiceStarted(object sender, EventArgs e)
         {
             ServiceHelperAppender serviceHelperAppender;
-            FileAppender fileAppender;
+            RollingFileAppender fileAppender;

             // Set current working directory to fix relative paths
             Directory.SetCurrentDirectory(FilePath.GetAbsolutePath(""));
@@ -126,12 +126,25 @@
             // Set up logging
             serviceHelperAppender = new ServiceHelperAppender(m_serviceHelper);

-            fileAppender = new FileAppender();
-            fileAppender.File = "openXDA.log";
+            fileAppender = new RollingFileAppender();
             fileAppender.AppendToFile = true;
+            fileAppender.MaxFileSize = 1048576L;
             fileAppender.Layout = new PatternLayout("%date [%thread] %-5level %logger - %message%newline");
+
+            try
+            {
+                if (!Directory.Exists("Debug"))
+                    Directory.CreateDirectory("Debug");
+
+                fileAppender.File = @"Debug\openXDA.log";
+            }
+            catch (Exception ex)
+            {
+                fileAppender.File = "openXDA.log";
+                m_serviceHelper.ErrorLogger.Log(ex);
+            }
+
             fileAppender.ActivateOptions();
-
             BasicConfigurator.Configure(serviceHelperAppender, fileAppender);

             // Set up heartbeat and client request handlers


Fixed Kursliste

Fixed Kursliste

--- Source/EventMaster/Course/ManageCourseViewModel.cs
+++ Source/EventMaster/Course/ManageCourseViewModel.cs
@@ -193,6 +193,7 @@
                     worksheet.SetValue(1, columnIndex++, "Adresse");
                     worksheet.SetValue(1, columnIndex++, "Ort");
                     worksheet.SetValue(1, columnIndex++, "Telefon");
+                    worksheet.SetValue(1, columnIndex++, "Email");

                     var rowIndex = 2;
                     foreach (var item in SelectedCourse.Participants)
@@ -200,11 +201,13 @@
                         columnIndex = 1;
                         var registration = Workspace.CurrentData.CourseParticipants.Find(x => x.Id == item.AnmeldungsId);
                         var participant = Workspace.CurrentData.Participants.Find(x => x.Id == registration.ParticipantId);
-                        worksheet.SetValue(1, columnIndex++, participant.Name);
-                        worksheet.SetValue(1, columnIndex++, participant.Firstname);
-                        worksheet.SetValue(1, columnIndex++, participant.Address);
-                        worksheet.SetValue(1, columnIndex++, participant.Town);
-                        worksheet.SetValue(1, columnIndex++, participant.Telefon);
+                        worksheet.SetValue(rowIndex, columnIndex++, participant.Name);
+                        worksheet.SetValue(rowIndex, columnIndex++, participant.Firstname);
+                        worksheet.SetValue(rowIndex, columnIndex++, participant.Address);
+                        worksheet.SetValue(rowIndex, columnIndex++, participant.Town);
+                        worksheet.SetValue(rowIndex, columnIndex++, participant.Telefon);
+                        worksheet.SetValue(rowIndex, columnIndex++, participant.Email);
+                        rowIndex++;
                     }

                     SaveFileDialog dialog = new SaveFileDialog();


Fixed a fatal error in GPS: Adding a target with a name that contains a space causes a crash

--- MarsRover/RoverOperator/ViewModel/GPSViewViewModel.cs
+++ MarsRover/RoverOperator/ViewModel/GPSViewViewModel.cs
@@ -341,11 +341,11 @@
                     counter++;
                     try
                     {
-                        targetPin.Name = targetTitleString;
+                        targetPin.Name = targetTitleString.Replace(" ", "");
                     }
                     catch
                     {
-                        targetPin.Name = targetTitleString + "_" + counter;
+                        targetPin.Name = targetTitleString.Replace(" ", "") +"_" + counter;
                     }
                 }

@@ -399,9 +399,10 @@
                             double targetLongitude = target.Location.Longitude;
                             double targetLatitude = target.Location.Latitude;

-                            string targetName = target.Name;
-                            string targetLongitudeString = targetLongitude.ToString();
-                            string targetLatitudeString = targetLatitude.ToString();
+                            ToolTip tt = (ToolTip)(target.ToolTip);
+                            string targetName = tt.Content.ToString();
+                            //string targetLongitudeString = targetLongitude.ToString();
+                            //string targetLatitudeString = targetLatitude.ToString();

                             double distance = getDistance(roverPin.Location, target.Location);

@@ -410,10 +411,10 @@
                             {
                                 detail += targetName + ", ";
                             }
-                            else //else show the coordinates to identify it
-                            {
-                                detail += "(" + targetLongitudeString + ", " + targetLatitudeString + "), ";
-                            }
+                            //else //else show the coordinates to identify it
+                            //{
+                            //    detail += "(" + targetLongitudeString + ", " + targetLatitudeString + "), ";
+                            //}

                             detail += "distance: " + distance +"km";
                             detail += "\n";
@@ -449,6 +450,7 @@
             double a = Math.Sin(lateralDistanceRadians / 2) * Math.Sin(lateralDistanceRadians / 2) + Math.Cos(degreesToRadians(latitude1)) * Math.Cos(degreesToRadians(latitude2)) * Math.Sin(longitudinalDistanceRadians / 2) * Math.Sin(longitudinalDistanceRadians / 2);
             double c = 2 * Math.Atan2(Math.Sqrt(a), Math.Sqrt(1 - a));
             double distance = radiusOfEarth * c;
+            distance = Math.Round(distance, 4);
             return distance;
         }


Implement IBaseClient

Implement IBaseClient

--- MiX.Integrate.API.Client/DeviceConfigurationClient.cs
+++ MiX.Integrate.API.Client/DeviceConfigurationClient.cs
@@ -7,7 +7,7 @@

 namespace MiX.Integrate.Api.Client
 {
-	public class DeviceConfigurationClient : BaseClient, IDeviceConfigurationClient
+	public class DeviceConfigurationClient : BaseClient, IDeviceConfigurationClient, IBaseClient
 	{
 		public DeviceConfigurationClient(string url, bool setTestRequestHeader = false) : base(url, setTestRequestHeader) { }
 		public DeviceConfigurationClient(string url, IdServerResourceOwnerClientSettings settings, bool setTestRequestHeader = false) : base(url, settings, setTestRequestHeader) { }


Change RaygunRequestMessage.Cookies to a list instead of dictionary Cookies from non-root and root domains can overlap, and we want both values to come through.

--- Mindscape.Raygun4Net/Messages/RaygunRequestMessage.cs
+++ Mindscape.Raygun4Net/Messages/RaygunRequestMessage.cs
@@ -1,8 +1,6 @@
-using System;
 using System.Collections;
 using System.Collections.Generic;
 using System.Collections.Specialized;
-using System.Diagnostics;
 using System.IO;
 using System.Linq;
 using System.Web;
@@ -51,19 +49,15 @@
       }
     }

-    private IDictionary GetCookies(HttpCookieCollection cookieCollection, IEnumerable<string> ignoredFormNames)
+    private IList GetCookies(HttpCookieCollection cookieCollection, IEnumerable<string> ignoredFormNames)
     {
       var ignored = ignoredFormNames.ToLookup(s => s);

-      var cookies = cookieCollection
-          .Cast<string>()
-          .Where(key => ignored.Contains(key) == false)
-// ReSharper disable PossibleNullReferenceException
-          // this can't be null, we got the key from the collection.
-          .ToDictionary(key => key, key => cookieCollection[key].Value);
-// ReSharper restore PossibleNullReferenceException
-
-      return cookies;
+      return Enumerable.Range(0, cookieCollection.Count)
+        .Select(i => cookieCollection[i])
+        .Where(c => !ignored.Contains(c.Name))
+        .Select(c => new Cookie(c.Name, c.Value))
+        .ToList();
     }

     private static IDictionary ToDictionary(NameValueCollection nameValueCollection, IEnumerable<string> ignoreFields, bool truncateValues = false)
@@ -125,6 +119,18 @@
       return dictionary;
     }

+    public class Cookie
+    {
+      public Cookie(string name, string value)
+      {
+        Name = name;
+        Value = value;
+      }
+
+      public string Name { get; set; }
+      public string Value { get; set; }
+    }
+
     public string HostName { get; set; }

     public string Url { get; set; }
@@ -135,7 +141,7 @@

     public IDictionary QueryString { get; set; }

-    public IDictionary Cookies { get; set; }
+    public IList Cookies { get; set; }

     public IDictionary Data { get; set; }


Removes whitespace at EOL from @param and @return jsDoc lines. [#490]

--- Compiler/Contract/XmlToJsDoc.cs
+++ Compiler/Contract/XmlToJsDoc.cs
@@ -1124,26 +1124,41 @@
                 comment.Append(exception.Item1 + newLine);
             }

+            int i = 0;
             foreach (JsDocParam param in this.Parameters)
             {
                 comment.Append(" * @param   {" + param.Type + "}");
+
                 comment.Append(new String(' ', typeColumnWidth - param.Type.Length));
                 comment.Append(param.Name);
-                comment.Append(new String(' ', nameColumnWidth - param.Name.Length));
+
+                // All but last parameter will pad whitespaces to the end
+                if (++i != this.Parameters.Count)
+                {
+                    comment.Append(new String(' ', nameColumnWidth - param.Name.Length));
+                }
+
                 comment.Append(param.Desc + newLine);
             }

+            i = 0;
             foreach (JsDocParam param in this.Returns)
             {
                 comment.Append(" * @return  {" + param.Type + "}");
-                comment.Append(new String(' ', typeColumnWidth - param.Type.Length));
-                comment.Append(new String(' ', nameColumnWidth));
+
+                // All but last argument will pad whitespaces to the end
+                if (++i != this.Returns.Count)
+                {
+                    comment.Append(new String(' ', typeColumnWidth - param.Type.Length));
+                    comment.Append(new String(' ', nameColumnWidth));
+                }
+
                 comment.Append(param.Desc + newLine);
             }

             foreach (var see in this.SeeAlso)
             {
-                comment.Append(" * @see {@link " + see + "}");
+                comment.Append(" * @see {@link " + see + "}" + newLine);
             }

             comment.Append(" */");


Make it possible to retrieve OpenDocument MetaData from PortalFile

--- Components/Uri/PortalFileUri.cs
+++ Components/Uri/PortalFileUri.cs
@@ -1,7 +1,9 @@
 using System;
+using System.ComponentModel;
 using DotNetNuke.Entities.Content.Common;
 using DotNetNuke.Entities.Modules.Definitions;
 using DotNetNuke.Services.FileSystem;
+using Newtonsoft.Json.Linq;
 using Satrabel.OpenContent.Components.Json;

 namespace Satrabel.OpenContent.Components.Uri
@@ -56,22 +58,61 @@
         /// <remarks>This is only available for files under the Dnn Portal Directory</remarks>
         protected IFileInfo FileInfo { get; set; }

-        public dynamic MetaData
+        private JObject _fileMetaData;
+
+        private JToken GetMetaData(string fieldname)
         {
-            get
+            if (_fileMetaData == null)
             {
-                dynamic retval = new object();
-                if (ModuleDefinitionController.GetModuleDefinitionByFriendlyName("OpenDocument") == null) return retval;
-                if (FileInfo.ContentItemID <= 0) return retval;
+                if (ModuleDefinitionController.GetModuleDefinitionByFriendlyName("OpenDocument") == null)
+                    _fileMetaData = JObject.Parse("{}");
+                else if (FileInfo.ContentItemID <= 0)
+                    _fileMetaData = JObject.Parse("{}");
+                else
+                {
+                    var item = Util.GetContentController().GetContentItem(FileInfo.ContentItemID);
+                    if (item != null && item.Content.IsJson())
+                    {
+                        _fileMetaData = JObject.Parse(item.Content);
+                    }
+                    else
+                    {
+                        _fileMetaData = JObject.Parse("{}");
+                    }
+                }
+            }

-                var item = Util.GetContentController().GetContentItem(FileInfo.ContentItemID);
-                if (item != null && item.Content.IsJson())
-                {
-                    retval = JsonUtils.JsonToDynamic(item.Content);
-                }
-                return retval;
-            }
+            return _fileMetaData == null ? null : _fileMetaData[fieldname];
         }

+        /// <summary>
+        /// Get a value from the OpenDocument Metadata attached to a PortalFile.
+        /// </summary>
+        /// <param name="fieldname">The fieldname.</param>
+        /// <param name="defaultValue">The default value.</param>
+        /// <returns></returns>
+        public string MetaData(string fieldname, string defaultValue)
+        {
+            string retval = defaultValue;
+            var value = GetMetaData(fieldname);
+            if (value != null)
+                retval = value.ToString();
+            return retval;
+        }
+
+        /// <summary>
+        /// Get a value from the OpenDocument Metadata attached to a PortalFile.
+        /// </summary>
+        /// <param name="fieldname">The fieldname.</param>
+        /// <param name="defaultValue">The default value.</param>
+        /// <returns></returns>
+        public int MetaData(string fieldname, int defaultValue)
+        {
+            int retval;
+            var value = GetMetaData(fieldname);
+            if (value == null || !int.TryParse(value.ToString(), out retval))
+                retval = defaultValue;
+            return retval;
+        }
     }
 }


MountPointGroup: Contains: Ignore null and destroyed locations.

The MountPointGroup.Contains(MountPoint) method should ignore null and
destroyed values.

--- Source/Lizitt/Plugins/Outfitter/MountPointGroup.cs
+++ Source/Lizitt/Plugins/Outfitter/MountPointGroup.cs
@@ -179,18 +179,68 @@
         }

         /// <summary>
+        /// The number of assigned items in the group.  (Non-null, non-destroyed)
+        /// </summary>
+        public int ItemCount
+        {
+            get
+            {
+                var count = 0;
+
+                for (int i = 0; i < m_Items.Length; i++)
+                {
+                    if (m_Items[i])
+                        count++;
+                }
+
+                return count;
+            }
+        }
+
+        /// <summary>
         /// True if the item is in the group.
         /// </summary>
+        /// <remarks>
+        /// <para>
+        /// a null or destoryed <paramref name="item"/> always returns false.
+        /// </para>
+        /// </remarks>
         /// <param name="item">The item to check. (Required)</param>
         /// <returns>True if the item is in the group.</returns>
-        public bool Contains(MountPoint location)
-        {
-            for (int i = 0; i < m_Items.Length; i++)
-            {
-                if (m_Items[i] == location)
-                    return true;
+        public bool Contains(MountPoint item)
+        {
+            if (item)
+            {
+                for (int i = 0; i < m_Items.Length; i++)
+                {
+                    if (m_Items[i] == item)
+                        return true;
+                }
             }
             return false;
+        }
+
+        /// <summary>
+        /// Removes all null and destroyed items from the group.
+        /// </summary>
+        public void Compress()
+        {
+            m_Items = m_Items.GetCompressed();
+        }
+
+        /// <summary>
+        /// Remove null and destroyed items from the group and add new, non-duplicate items.
+        /// </summary>
+        /// <param name="newItems">The potential new items to add.</param>
+        public void CompressAndAdd(params MountPoint[] newItems)
+        {
+            if (newItems == null || newItems.Length == 0)
+            {
+                m_Items = m_Items.GetCompressed();
+                return;
+            }
+
+            m_Items = m_Items.CompressAndAddDistinct(true, newItems);
         }
     }
 }


#142 - support new remote commands - minor changes

--- MediaBrowser.UI/EntryPoints/WebSocketEntryPoint.cs
+++ MediaBrowser.UI/EntryPoints/WebSocketEntryPoint.cs
@@ -179,8 +179,8 @@
         {
             try
             {
-                var index = (float)Convert.ToDouble(e.Command.Arguments.First());
-                _playbackManager.SetVolume(index);
+                var index = Convert.ToInt32(e.Command.Arguments.First());
+                _playbackManager.SetAudioStreamIndex(index);
             }
             catch (Exception)
             {
@@ -192,7 +192,7 @@
         {
             try
             {
-                var index = (float)Convert.ToDouble(e.Command.Arguments.First());
+                var index = Convert.ToInt32(e.Command.Arguments.First());
                 _playbackManager.SetSubtitleStreamIndex(index);
             }
             catch (Exception)


Use an ordinal comparer for the Ignored list

--- Mono.Debugging/Mono.Debugging.Client/Catchpoint.cs
+++ Mono.Debugging/Mono.Debugging.Client/Catchpoint.cs
@@ -85,7 +85,7 @@
 			set { includeSubclasses = value; }
 		}

-		public HashSet<string> Ignored { get; private set; } = new HashSet<string> ();
+		public HashSet<string> Ignored { get; private set; } = new HashSet<string> (StringComparer.Ordinal);

 		public bool ShouldIgnore(string type, string locationSignature)
 		{


dragging working but errors

dragging working but errors

--- MyMapOnCanvas/RectangesZoom3/RectangesZoom3/Map.cs
+++ MyMapOnCanvas/RectangesZoom3/RectangesZoom3/Map.cs
@@ -20,17 +20,32 @@
             var arr = Enumerable.Range(0, 15).Select(x => new ZoomItems((byte)x, this)).OrderBy(x => x.Zoom).ToArray();
             zoomLayers = new ZoomItemsCollection(2);

-            viewPort = new Rect(0, 0, ActualWidth, ActualHeight);
+

             foreach (var item in arr)
             {
                 zoomLayers.Add(item.Zoom, item);
             }
-            zoomLayers.Show();
+
         }

+        //public override void EndInit()
+        //{

-        private Rect viewPort;
+        //}
+
+
+        //protected override void OnInitialized(EventArgs e)
+        //{
+        //    base.OnInitialized(e);
+
+        //    viewPort = new Rect(0, 0, ActualWidth, ActualHeight);
+        //    zoomLayers.Show();
+        //}
+
+
+
+        private Rect viewPort = Rect.Empty;
         private byte zoomFactor = 2;
         protected override void OnZoom(Point mouse, byte currentZoom, byte newZoom)
         {
@@ -58,6 +73,10 @@

         protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo)
         {
+            if (viewPort.IsEmpty)
+            {
+                viewPort = new Rect(0,0,ActualWidth,ActualHeight);
+            }
             var oldvp = viewPort;
             var newvp = new Rect(oldvp.TopLeft, sizeInfo.NewSize);
             oldvp.Transform(new Matrix());


BasicResultError: instantiate with up to 3 arguments.

--- Sources/NET4.SrkToolkit.Domain/BasicResultError.cs
+++ Sources/NET4.SrkToolkit.Domain/BasicResultError.cs
@@ -44,6 +44,21 @@
             this.DisplayMessage = displayMessage;
         }

+        public BasicResultError(string code, string displayMessage)
+        {
+            this.code = code;
+            this.DisplayMessage = displayMessage;
+        }
+
+        public BasicResultError(string code, string displayMessage, string detail)
+        {
+            this.code = code;
+            this.DisplayMessage = displayMessage;
+            this.Detail = detail;
+        }
+
+        private string code;
+
         /// <summary>
         /// Gets or sets the display message.
         /// </summary>
@@ -59,7 +74,7 @@
         [DataMember(IsRequired = false, Order = 0)]
         string IResultError.Code
         {
-            get { return this.DisplayMessage; }
+            get { return this.code ?? this.DisplayMessage; }
         }
     }
 }


.net standard 2.0 support, followup #475

--- SpotifyAPI.Web/RetryHandlers/SimpleRetryHandler.cs
+++ SpotifyAPI.Web/RetryHandlers/SimpleRetryHandler.cs
@@ -58,8 +58,8 @@
         return null;
       }
       if (
-        int.TryParse(response.Headers.GetValueOrDefault("Retry-After"), out int secondsToWait)
-        || int.TryParse(response.Headers.GetValueOrDefault("retry-after"), out secondsToWait))
+        (response.Headers.ContainsKey("Retry-After") && int.TryParse(response.Headers["Retry-After"], out int secondsToWait))
+        || (response.Headers.ContainsKey("retry-after") && int.TryParse(response.Headers["retry-after"], out secondsToWait)))
       {
         return TimeSpan.FromSeconds(secondsToWait);
       }


chore: Fix expected argument ordering warnings.

--- Src/Support/IntegrationTests/AuthUriConstsTests.cs
+++ Src/Support/IntegrationTests/AuthUriConstsTests.cs
@@ -38,10 +38,14 @@
             }
             var wellKnown = JObject.Parse(wellKnownJson);

+            // Supressing the warning as in this case the expected values are not the constants, we are precisely
+            // checking that the constants have the expected values which come from the source of truth.
+#pragma warning disable xUnit2000 // Constants and literals should be the expected argument
             Assert.Equal(wellKnown["authorization_endpoint"].ToString(), GoogleAuthConsts.OidcAuthorizationUrl);
             Assert.Equal(wellKnown["token_endpoint"].ToString(), GoogleAuthConsts.OidcTokenUrl);
             Assert.Equal(wellKnown["revocation_endpoint"].ToString(), GoogleAuthConsts.RevokeTokenUrl);
             Assert.Equal(wellKnown["jwks_uri"].ToString(), GoogleAuthConsts.JsonWebKeySetUrl);
+#pragma warning restore xUnit2000 // Constants and literals should be the expected argument
         }
     }
 }


Add ToStringKeyObjectValue dictionary extension.

--- System.Contrib/Dictionary/IDictionaryExtensions.cs
+++ System.Contrib/Dictionary/IDictionaryExtensions.cs
@@ -103,5 +103,25 @@
 		}

 		#endregion
+
+		#region ToJson
+
+		/// <summary>
+		/// Converts to a dictionary with string key and object value.
+		/// This is compatible with the ASP.NET MVC Json() method.
+		/// </summary>
+		public static Dictionary<string, object> ToStringKeyObjectValue<TKey, TValue>(this Dictionary<TKey, TValue> input)
+		{
+			var output = new Dictionary<string, object>(input.Count);
+
+			foreach (var pair in input)
+			{
+				output.Add(pair.Key.ToString(), pair.Value);
+			}
+
+			return output;
+		}
+
+		#endregion
 	}
 }


Repair LuceneTests.

Repair LuceneTests.

--- Tests/CK.Glouton.Tests.NetFramework/LuceneTests.cs
+++ Tests/CK.Glouton.Tests.NetFramework/LuceneTests.cs
@@ -66,12 +66,11 @@
                         activityMonitor.Info( new Exception() );
                     }
                 }
+            Thread.Sleep( TestHelper.DefaultSleepTime * 5 );
             }

-            Thread.Sleep( TestHelper.DefaultSleepTime * 4 );
-
             var searcher = new LuceneSearcher( LuceneSearcherConfiguration, new[] { "LogLevel", "Text" } );
-            var topDocument = searcher.Search( "Hello world" );
+            var topDocument = searcher.Search( "Text:Hello world" );
             topDocument.Should().NotBeNull();

             LineViewModel log = null;
@@ -79,11 +78,18 @@
             {
                 var document = searcher.GetDocument( topDocument.ScoreDocs[ 0 ] );
                 log = LineViewModel.Get( searcher, document );
-                if( log.Text == "Hello world" )
-                    break;
             }
             log.Text.Should().Be( "Hello world" );
-            log.LogLevel.Should().Be( "Error" );
+            log.LogLevel.Should().Contain("Info");
+
+            topDocument = searcher.Search("Text:CriticalError");
+            foreach (var doc in topDocument.ScoreDocs)
+            {
+                var document = searcher.GetDocument(topDocument.ScoreDocs[0]);
+                log = LineViewModel.Get(searcher, document);
+            }
+            log.Text.Should().Be("CriticalError");
+            log.LogLevel.Should().Contain("Error");
         }
     }
 }


Bot will get the fees from the shop - no actual functionality is changed (90% to the seller, 10% to the bot)

--- NadekoBot.Core/Modules/Gambling/FlowerShopCommands.cs
+++ NadekoBot.Core/Modules/Gambling/FlowerShopCommands.cs
@@ -124,7 +124,9 @@
                             await ReplyErrorLocalized("shop_role_purchase_error").ConfigureAwait(false);
                             return;
                         }
-                        await _cs.AddAsync(entry.AuthorId, $"Shop sell item - {entry.Type}", GetProfitAmount(entry.Price));
+                        var profit = GetProfitAmount(entry.Price);
+                        await _cs.AddAsync(entry.AuthorId, $"Shop sell item - {entry.Type}", profit);
+                        await _cs.AddAsync(Context.Client.CurrentUser.Id, $"Shop sell item - cut", entry.Price - profit);
                         await ReplyConfirmLocalized("shop_role_purchase", Format.Bold(role.Name)).ConfigureAwait(false);
                         return;
                     }


Sanity check on the OSHttpRequest.Cookies getter

--- OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs
+++ OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs
@@ -77,10 +77,14 @@
         {
             get
             {
-                RequestCookies cookies = _request.Cookies;
+                if (_request.Cookies == null)
+                    return null;
+
                 HttpCookieCollection httpCookies = new HttpCookieCollection();
-                foreach (RequestCookie cookie in cookies)
+
+                foreach (RequestCookie cookie in _request.Cookies)
                     httpCookies.Add(new HttpCookie(cookie.Name, cookie.Value));
+
                 return httpCookies;
             }
         }


* Added support for "revert" and "bake" commands on terrain console * Implemented "IMG" load method for "terrain load" - supports PNG, BMP, TIFF, TGA and probably a handful of other formats.

--- OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs
+++ OpenSim/OpenSim.Terrain.BasicTerrain/TerrainEngine.cs
@@ -150,6 +150,24 @@
         }

         /// <summary>
+        /// Swaps the two heightmap buffers (the 'revert map' and the heightmap)
+        /// </summary>
+        public void swapRevertMaps()
+        {
+            Channel backup = heightmap.copy();
+            heightmap = revertmap;
+            revertmap = backup;
+        }
+
+        /// <summary>
+        /// Saves the current heightmap into the revertmap
+        /// </summary>
+        public void saveRevertMap()
+        {
+            revertmap = heightmap.copy();
+        }
+
+        /// <summary>
         /// Processes a terrain-specific command
         /// </summary>
         /// <param name="args">Commandline arguments (space seperated)</param>
@@ -175,7 +193,18 @@
                         resultText += "terrain erode aerobic <windspeed> <pickupmin> <dropmin> <carry> <rounds> <lowest>\n";
                         resultText += "terrain erode thermal <talus> <rounds> <carry>\n";
                         resultText += "terrain multiply <val> - multiplies a terrain by <val>\n";
+                        resultText += "terrain revert - reverts the terrain to the stored original";
+                        resultText += "terrain bake - saves the current terrain into the revert map";
                         return false;
+
+                    case "revert":
+                        swapRevertMaps();
+                        saveRevertMap();
+                        break;
+
+                    case "bake":
+                        saveRevertMap();
+                        break;

                     case "seed":
                         setSeed(Convert.ToInt32(args[1]));
@@ -222,7 +251,7 @@
                                 break;

                             case "img":
-                                resultText = "Error - IMG mode is presently unsupported.";
+                                heightmap.loadImage(args[2]);
                                 return false;

                             default:


BulletSim: fix exception when re-creating the terrain when loading an OAR file

--- OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs
+++ OpenSim/Region/Physics/BulletSPlugin/BSTerrainMesh.cs
@@ -142,6 +142,8 @@
             PhysicsScene.PE.RemoveObjectFromWorld(PhysicsScene.World, m_terrainBody);
             // Frees both the body and the shape.
             PhysicsScene.PE.DestroyObject(PhysicsScene.World, m_terrainBody);
+            m_terrainBody.Clear();
+            m_terrainShape.Clear();
         }
     }


error message

error message

--- NadekoBot/Modules/Searches/Commands/EvalCommand.cs
+++ NadekoBot/Modules/Searches/Commands/EvalCommand.cs
@@ -29,7 +29,6 @@
             string expression = e.GetArg("expression")?.Trim();
             if (string.IsNullOrWhiteSpace(expression))
             {
-                await e.Channel.SendMessage("Must give expression");
                 return;
             }
             string answer = Evaluate(expression);


Fixed NRE caused by players picking job during matrix-specific announce

--- UnityProject/Assets/Scripts/Managers/PlayerList.cs
+++ UnityProject/Assets/Scripts/Managers/PlayerList.cs
@@ -167,7 +167,7 @@
 	/// </summary>
 	public List<ConnectedPlayer> GetPlayersOnMatrix( MatrixInfo matrix )
 	{
-		return InGamePlayers.FindAll( p => p.Script.registerTile.Matrix.Id == matrix.Id );
+		return InGamePlayers.FindAll( p => (p.Script != null) && p.Script.registerTile.Matrix.Id == matrix.Id );
 	}

 	public List<ConnectedPlayer> GetAlivePlayers(List<ConnectedPlayer> players = null)


Remove fileStream used for debugging

Remove fileStream used for debugging

--- Core/Services/CSharpExecutor.cs
+++ Core/Services/CSharpExecutor.cs
@@ -22,7 +22,6 @@

             byte[] compiledAssembly;
             using (var stream = new MemoryStream())
-            using (var fileStream = new FileStream("C:\\output2.dll", FileMode.Truncate))
             {
                 var emitResult = compilation.Emit(stream);

@@ -30,8 +29,6 @@
                 {
                     return new ExecutionResult { Result = "[Compilation failed]" };
                 }
-
-                compilation.Emit(fileStream);

                 compiledAssembly = stream.ToArray();
             }


Added IsPrimitiveIntegerType

Added IsPrimitiveIntegerType

--- Core/Theraot/Core/TypeHelper.cs
+++ Core/Theraot/Core/TypeHelper.cs
@@ -310,6 +310,33 @@
             return false;
         }

+        public static bool IsPrimitiveIntegerType(this Type type)
+        {
+            if (type.IsPrimitive)
+            {
+                if
+                (
+                    type.Equals(typeof(bool))
+                    || type.Equals(typeof(char))
+                    || type.Equals(typeof(IntPtr))
+                    || type.Equals(typeof(UIntPtr))
+                    || type.Equals(typeof(double))
+                    || type.Equals(typeof(float))
+                )
+                {
+                    return false;
+                }
+                else
+                {
+                    return true;
+                }
+            }
+            else
+            {
+                return false;
+            }
+        }
+
         public static bool IsNullable(this Type type)
         {
             return !ReferenceEquals(Nullable.GetUnderlyingType(type), null);


temp work:  sounds simetric acording to materials, still 'window close' test sound. Included in coment full assimetric ( since seems we have files for it now ) case with some uuids

--- OpenSim/Region/Framework/Scenes/CollisionSounds.cs
+++ OpenSim/Region/Framework/Scenes/CollisionSounds.cs
@@ -42,34 +42,94 @@

     public static class CollisionSounds
     {
-
-
-
-    // defines for cases
-    // only know one UUID for now (woodflesh)
-
         private const int MaxMaterials = 7;
         // part part
+/*
+        private static UUID snd_StoneStone = new UUID("be7295c0-a158-11e1-b3dd-0800200c9a66");
+        private static UUID snd_StoneMetal = new UUID("be7295c0-a158-11e1-b3dd-0800201c9a66");
+        private static UUID snd_StoneGlass = new UUID("be7295c0-a158-11e1-b3dd-0800202c9a66");
+        private static UUID snd_StoneWood = new UUID("be7295c0-a158-11e1-b3dd-0800203c9a66");
+        private static UUID snd_StoneFlesh = new UUID("be7295c0-a158-11e1-b3dd-0800204c9a66");
+        private static UUID snd_StonePlastic = new UUID("be7295c0-a158-11e1-b3dd-0800205c9a66");
+        private static UUID snd_StoneRubber = new UUID("be7295c0-a158-11e1-b3dd-0800206c9a66");
+
+        private static UUID snd_MetalStone = new UUID("be7295c0-a158-11e1-b3dd-0801200c9a66");
+        private static UUID snd_MetalMetal = new UUID("be7295c0-a158-11e1-b3dd-0801201c9a66");
+        private static UUID snd_MetalGlass = new UUID("be7295c0-a158-11e1-b3dd-0801202c9a66");
+        private static UUID snd_MetalWood  = new UUID("be7295c0-a158-11e1-b3dd-0801203c9a66");
+        private static UUID snd_MetalFlesh = new UUID("be7295c0-a158-11e1-b3dd-0801204c9a66");
+        private static UUID snd_MetalPlastic = new UUID("be7295c0-a158-11e1-b3dd-0801205c9a66");
+        private static UUID snd_MetalRubber = new UUID("be7295c0-a158-11e1-b3dd-0801206c9a66");
+
+        private static UUID snd_GlassStone = new UUID("be7295c0-a158-11e1-b3dd-0802200c9a66");
+        private static UUID snd_GlassMetal = new UUID("be7295c0-a158-11e1-b3dd-0802201c9a66");
+        private static UUID snd_GlassGlass = new UUID("be7295c0-a158-11e1-b3dd-0802202c9a66");
+        private static UUID snd_GlassWood = new UUID("be7295c0-a158-11e1-b3dd-0802203c9a66");
+        private static UUID snd_GlassFlesh = new UUID("be7295c0-a158-11e1-b3dd-0802204c9a66");
+        private static UUID snd_GlassPlastic = new UUID("be7295c0-a158-11e1-b3dd-0802205c9a66");
+        private static UUID snd_GlassRubber = new UUID("be7295c0-a158-11e1-b3dd-0802206c9a66");
+
+        private static UUID snd_WoodStone = new UUID("be7295c0-a158-11e1-b3dd-0803200c9a66");
+        private static UUID snd_WoodMetal = new UUID("be7295c0-a158-11e1-b3dd-0803201c9a66");
+        private static UUID snd_WoodGlass = new UUID("be7295c0-a158-11e1-b3dd-0803202c9a66");
+        private static UUID snd_WoodWood = new UUID("be7295c0-a158-11e1-b3dd-0803203c9a66");
+        private static UUID snd_WoodFlesh = new UUID("be7295c0-a158-11e1-b3dd-0803204c9a66");
+        private static UUID snd_WoodPlastic = new UUID("be7295c0-a158-11e1-b3dd-0803205c9a66");
+        private static UUID snd_WoodRubber = new UUID("be7295c0-a158-11e1-b3dd-0803206c9a66");
+
+        private static UUID snd_FleshStone = new UUID("be7295c0-a158-11e1-b3dd-0804200c9a66");
+        private static UUID snd_FleshMetal = new UUID("be7295c0-a158-11e1-b3dd-0804201c9a66");
+        private static UUID snd_FleshGlass = new UUID("be7295c0-a158-11e1-b3dd-0804202c9a66");
+        private static UUID snd_FleshWood = new UUID("be7295c0-a158-11e1-b3dd-0804203c9a66");
+        private static UUID snd_FleshFlesh = new UUID("be7295c0-a158-11e1-b3dd-0804204c9a66");
+        private static UUID snd_FleshPlastic = new UUID("be7295c0-a158-11e1-b3dd-0804205c9a66");
+        private static UUID snd_FleshRubber = new UUID("be7295c0-a158-11e1-b3dd-0804206c9a66");
+
+        private static UUID snd_PlasticStone = new UUID("be7295c0-a158-11e1-b3dd-0805200c9a66");
+        private static UUID snd_PlasticMetal = new UUID("be7295c0-a158-11e1-b3dd-0805201c9a66");
+        private static UUID snd_PlasticGlass = new UUID("be7295c0-a158-11e1-b3dd-0805202c9a66");
+        private static UUID snd_PlasticWood = new UUID("be7295c0-a158-11e1-b3dd-0805203c9a66");
+        private static UUID snd_PlasticFlesh = new UUID("be7295c0-a158-11e1-b3dd-0805204c9a66");
+        private static UUID snd_PlasticPlastic = new UUID("be7295c0-a158-11e1-b3dd-0805205c9a66");
+        private static UUID snd_PlasticRubber = new UUID("be7295c0-a158-11e1-b3dd-0805206c9a66");
+
+        private static UUID snd_RubberStone = new UUID("be7295c0-a158-11e1-b3dd-0806200c9a66");
+        private static UUID snd_RubberMetal = new UUID("be7295c0-a158-11e1-b3dd-0806201c9a66");
+        private static UUID snd_RubberGlass = new UUID("be7295c0-a158-11e1-b3dd-0806202c9a66");
+        private static UUID snd_RubberWood = new UUID("be7295c0-a158-11e1-b3dd-0806203c9a66");
+        private static UUID snd_RubberFlesh = new UUID("be7295c0-a158-11e1-b3dd-0806204c9a66");
+        private static UUID snd_RubberPlastic = new UUID("be7295c0-a158-11e1-b3dd-0806205c9a66");
+        private static UUID snd_RubberRubber = new UUID("be7295c0-a158-11e1-b3dd-0806206c9a66");
+
+        // terrain part
+        private static UUID snd_TerrainStone = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66");
+        private static UUID snd_TerrainMetal = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66");
+        private static UUID snd_TerrainGlass = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66");
+        private static UUID snd_TerrainWood = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66");
+        private static UUID snd_TerrainFlesh = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66");
+        private static UUID snd_TerrainPlastic = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66");
+        private static UUID snd_TerrainRubber = new UUID("be7295c0-a158-11e1-b3dd-0807200c9a66");
+*/
         private static UUID snd_StoneStone = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
-        private static UUID  snd_StoneMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
-        private static UUID  snd_StoneGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
-        private static UUID  snd_StoneWood  = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
-        private static UUID  snd_StoneFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
-        private static UUID  snd_StonePlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
-        private static UUID  snd_StoneRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
+        private static UUID snd_StoneMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
+        private static UUID snd_StoneGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
+        private static UUID snd_StoneWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
+        private static UUID snd_StoneFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
+        private static UUID snd_StonePlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
+        private static UUID snd_StoneRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");

         private static UUID snd_MetalMetal = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
-        private static UUID  snd_MetalGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
-        private static UUID  snd_MetalWood  = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
-        private static UUID  snd_MetalFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
-        private static UUID  snd_MetalPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
-        private static UUID  snd_MetalRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
+        private static UUID snd_MetalGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
+        private static UUID snd_MetalWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
+        private static UUID snd_MetalFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
+        private static UUID snd_MetalPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
+        private static UUID snd_MetalRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");

         private static UUID snd_GlassGlass = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
-        private static UUID  snd_GlassWood  = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
-        private static UUID  snd_GlassFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
-        private static UUID  snd_GlassPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
-        private static UUID  snd_GlassRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
+        private static UUID snd_GlassWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
+        private static UUID snd_GlassFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
+        private static UUID snd_GlassPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
+        private static UUID snd_GlassRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");

         private static UUID snd_WoodWood = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
         private static UUID snd_WoodFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
@@ -77,11 +137,11 @@
         private static UUID snd_WoodRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");

         private static UUID snd_FleshFlesh = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
-        private static UUID  snd_FleshPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
-        private static UUID  snd_FleshRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
+        private static UUID snd_FleshPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
+        private static UUID snd_FleshRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");

         private static UUID snd_PlasticPlastic = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
-        private static UUID  snd_PlasticRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");
+        private static UUID snd_PlasticRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");

         private static UUID snd_RubberRubber = new UUID("c80260ba-41fd-8a46-768a-6bf236360e3a");

@@ -103,7 +163,19 @@
             snd_TerrainPlastic,
             snd_TerrainRubber
             };
-
+/*
+        //full assimetric sounds
+        public static UUID[] m_PartPart = {
+            snd_StoneStone, snd_StoneMetal, snd_StoneGlass, snd_StoneWood, snd_StoneFlesh, snd_StonePlastic, snd_StoneRubber,
+            snd_MetalStone, snd_MetalMetal, snd_MetalGlass, snd_MetalWood, snd_MetalFlesh, snd_MetalPlastic, snd_MetalRubber,
+            snd_GlassStone, snd_GlassMetal, snd_GlassGlass, snd_GlassWood, snd_GlassFlesh, snd_GlassPlastic, snd_GlassRubber,
+            snd_WoodStone, snd_WoodMetal, snd_WoodGlass, snd_WoodWood, snd_WoodFlesh, snd_WoodPlastic, snd_WoodRubber,
+            snd_FleshStone, snd_FleshMetal, snd_FleshGlass, snd_FleshWood, snd_FleshFlesh, snd_FleshPlastic, snd_FleshRubber,
+            snd_PlasticStone, snd_PlasticMetal, snd_PlasticGlass, snd_PlasticWood, snd_PlasticFlesh, snd_PlasticPlastic, snd_PlasticRubber,
+            snd_RubberStone, snd_RubberMetal, snd_RubberGlass, snd_RubberWood, snd_RubberFlesh, snd_RubberPlastic, snd_RubberRubber
+            };
+*/
+        // simetric sounds
         public static UUID[] m_PartPart = {
             snd_StoneStone, snd_StoneMetal, snd_StoneGlass, snd_StoneWood, snd_StoneFlesh, snd_StonePlastic, snd_StoneRubber,
             snd_StoneMetal, snd_MetalMetal, snd_MetalGlass, snd_MetalWood, snd_MetalFlesh, snd_MetalPlastic, snd_MetalRubber,
@@ -113,7 +185,7 @@
             snd_StonePlastic, snd_MetalPlastic, snd_GlassPlastic, snd_WoodPlastic, snd_FleshPlastic, snd_PlasticPlastic, snd_PlasticRubber,
             snd_StoneRubber, snd_MetalRubber, snd_GlassRubber, snd_WoodRubber, snd_FleshRubber, snd_PlasticRubber, snd_RubberRubber
             };
-
+
         public static void PartCollisionSound(SceneObjectPart part, List<CollisionForSoundInfo> collidersinfolist)
         {
             if (collidersinfolist.Count == 0 || part == null)
@@ -223,9 +295,6 @@

         public static void AvatarCollisionSound(ScenePresence av, List<CollisionForSoundInfo> collidersinfolist)
         {
-            // temporary mute sounds
-//            return;
-
             if (collidersinfolist.Count == 0 || av == null)
                 return;

@@ -291,6 +360,5 @@
  */
             }
         }
-
     }
 }