LazyNeedle refactor

LazyNeedle refactor

Renamed and encapsulated _initializerThread as RunnerThread

--- Core/Theraot/Threading/Needles/LazyNeedle.cs
+++ Core/Theraot/Threading/Needles/LazyNeedle.cs
@@ -11,7 +11,7 @@
     public class LazyNeedle<T> : PromiseNeedle<T>, IEquatable<LazyNeedle<T>>
     {
         [NonSerialized]
-        private Thread _initializerThread;
+        private Thread _runnerThread;

         private Func<T> _valueFactory;

@@ -34,7 +34,7 @@
         }

         public LazyNeedle(Func<T> valueFactory, bool cacheExceptions)
-           : base(false)
+            : base(false)
         {
             _valueFactory = Check.NotNullArgument(valueFactory, "valueFactory");
             if (cacheExceptions)
@@ -68,6 +68,14 @@
             }
         }

+        protected Thread RunnerThread
+        {
+            get
+            {
+                return _runnerThread;
+            }
+        }
+
         public override bool Equals(object obj)
         {
             return !ReferenceEquals(null, obj as LazyNeedle<T>) && base.Equals(obj);
@@ -85,7 +93,7 @@

         public virtual void Initialize()
         {
-            if (_initializerThread == Thread.CurrentThread)
+            if (_runnerThread == Thread.CurrentThread)
             {
                 throw new InvalidOperationException();
             }
@@ -107,7 +115,7 @@

         public override void Wait()
         {
-            if (_initializerThread == Thread.CurrentThread)
+            if (_runnerThread == Thread.CurrentThread)
             {
                 throw new InvalidOperationException();
             }
@@ -116,7 +124,7 @@

         public override void Wait(CancellationToken cancellationToken)
         {
-            if (_initializerThread == Thread.CurrentThread)
+            if (_runnerThread == Thread.CurrentThread)
             {
                 throw new InvalidOperationException();
             }
@@ -125,7 +133,7 @@

         public override void Wait(int milliseconds)
         {
-            if (_initializerThread == Thread.CurrentThread)
+            if (_runnerThread == Thread.CurrentThread)
             {
                 throw new InvalidOperationException();
             }
@@ -134,7 +142,7 @@

         public override void Wait(TimeSpan timeout)
         {
-            if (_initializerThread == Thread.CurrentThread)
+            if (_runnerThread == Thread.CurrentThread)
             {
                 throw new InvalidOperationException();
             }
@@ -143,7 +151,7 @@

         public override void Wait(int milliseconds, CancellationToken cancellationToken)
         {
-            if (_initializerThread == Thread.CurrentThread)
+            if (_runnerThread == Thread.CurrentThread)
             {
                 throw new InvalidOperationException();
             }
@@ -152,7 +160,7 @@

         public override void Wait(TimeSpan timeout, CancellationToken cancellationToken)
         {
-            if (_initializerThread == Thread.CurrentThread)
+            if (_runnerThread == Thread.CurrentThread)
             {
                 throw new InvalidOperationException();
             }
@@ -165,7 +173,7 @@
             {
                 throw new ArgumentNullException("beforeInitialize");
             }
-            if (_initializerThread == Thread.CurrentThread)
+            if (_runnerThread == Thread.CurrentThread)
             {
                 throw new InvalidOperationException();
             }
@@ -189,7 +197,7 @@

         private void InitializeExtracted(Func<T> valueFactory)
         {
-            _initializerThread = Thread.CurrentThread;
+            _runnerThread = Thread.CurrentThread;
             try
             {
                 base.Value = valueFactory.Invoke();
@@ -202,7 +210,7 @@
             }
             finally
             {
-                _initializerThread = null;
+                _runnerThread = null;
             }
         }
     }


Making DIA interfaces thread safe

Making DIA interfaces thread safe

--- CsScriptManaged/SymbolProviders/DiaModule.cs
+++ CsScriptManaged/SymbolProviders/DiaModule.cs
@@ -5,7 +5,6 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
-using System.Runtime.InteropServices;

 namespace CsScriptManaged.SymbolProviders
 {
@@ -63,36 +62,42 @@
             typeFields = new DictionaryCache<uint, List<Tuple<string, uint, int>>>(GetTypeFields);
             basicTypes = SimpleCache.Create(() =>
             {
-                var types = new Dictionary<string, IDiaSymbol>();
-                var basicTypes = session.globalScope.GetChildren(SymTagEnum.SymTagBaseType);
-
-                foreach (var type in basicTypes)
-                {
-                    try
+                lock (this)
+                {
+                    var types = new Dictionary<string, IDiaSymbol>();
+                    var basicTypes = session.globalScope.GetChildren(SymTagEnum.SymTagBaseType);
+
+                    foreach (var type in basicTypes)
                     {
-                        string typeString = TypeToString.GetTypeString(type);
-
-                        if (!types.ContainsKey(typeString))
+                        try
                         {
-                            types.Add(typeString, type);
+                            string typeString = TypeToString.GetTypeString(type);
+
+                            if (!types.ContainsKey(typeString))
+                            {
+                                types.Add(typeString, type);
+                            }
+                        }
+                        catch (Exception)
+                        {
                         }
                     }
-                    catch (Exception)
-                    {
-                    }
-                }
-
-                return types;
+
+                    return types;
+                }
             });
             symbolNamesByAddress = new DictionaryCache<uint, Tuple<string, ulong>>((distance) =>
             {
-                IDiaSymbol symbol;
-                int displacement;
-                string name;
-
-                session.findSymbolByRVAEx(distance, SymTagEnum.SymTagNull, out symbol, out displacement);
-                symbol.get_undecoratedNameEx(0 | 0x8000 | 0x1000, out name);
-                return Tuple.Create(name, (ulong)displacement);
+                lock (this)
+                {
+                    IDiaSymbol symbol;
+                    int displacement;
+                    string name;
+
+                    session.findSymbolByRVAEx(distance, SymTagEnum.SymTagNull, out symbol, out displacement);
+                    symbol.get_undecoratedNameEx(0 | 0x8000 | 0x1000, out name);
+                    return Tuple.Create(name, (ulong)displacement);
+                }
             });

             session.loadAddress = moduleAddress;
@@ -116,11 +121,15 @@
         /// <param name="typeId">The type identifier.</param>
         private List<Tuple<string, uint, int>> GetTypeAllFields(uint typeId)
         {
-            var type = GetTypeFromId(typeId);
-            List<Tuple<string, uint, int>> fields = new List<Tuple<string, uint, int>>();
-
-            GetTypeAllFields(type, fields);
-            return fields;
+            lock (this)
+            {
+                var type = GetTypeFromId(typeId);
+                List<Tuple<string, uint, int>> fields = new List<Tuple<string, uint, int>>();
+
+                GetTypeAllFields(type, fields);
+
+                return fields;
+            }
         }

         /// <summary>
@@ -156,19 +165,22 @@
         /// <param name="typeId">The type identifier.</param>
         private List<Tuple<string, uint, int>> GetTypeFields(uint typeId)
         {
-            var type = GetTypeFromId(typeId);
-            List<Tuple<string, uint, int>> typeFields = new List<Tuple<string, uint, int>>();
-            var fields = type.GetChildren(SymTagEnum.SymTagData);
-
-            foreach (var field in fields)
-            {
-                if ((DataKind)field.dataKind == DataKind.StaticMember)
-                    continue;
-
-                typeFields.Add(Tuple.Create(field.name, field.typeId, field.offset));
-            }
-
-            return typeFields;
+            lock (this)
+            {
+                var type = GetTypeFromId(typeId);
+                List<Tuple<string, uint, int>> typeFields = new List<Tuple<string, uint, int>>();
+                var fields = type.GetChildren(SymTagEnum.SymTagData);
+
+                foreach (var field in fields)
+                {
+                    if ((DataKind)field.dataKind == DataKind.StaticMember)
+                        continue;
+
+                    typeFields.Add(Tuple.Create(field.name, field.typeId, field.offset));
+                }
+
+                return typeFields;
+            }
         }

         /// <summary>
@@ -177,10 +189,13 @@
         /// <param name="typeId">The type identifier.</param>
         private IDiaSymbol GetTypeFromId(uint typeId)
         {
-            IDiaSymbol type;
-
-            session.symbolById(typeId, out type);
-            return type;
+            lock (this)
+            {
+                IDiaSymbol type;
+
+                session.symbolById(typeId, out type);
+                return type;
+            }
         }

         /// <summary>
@@ -210,14 +225,17 @@
         /// <param name="typeName">Name of the type.</param>
         public uint GetTypeId(Module module, string typeName)
         {
-            IDiaSymbol type;
-
-            if (!BasicTypes.TryGetValue(typeName, out type))
-            {
-                type = session.globalScope.GetChild(typeName);
-            }
-
-            return GetTypeId(type);
+            lock (this)
+            {
+                IDiaSymbol type;
+
+                if (!BasicTypes.TryGetValue(typeName, out type))
+                {
+                    type = session.globalScope.GetChild(typeName);
+                }
+
+                return GetTypeId(type);
+            }
         }

         /// <summary>
@@ -236,7 +254,10 @@
         /// <param name="typeId">The type identifier.</param>
         public string GetTypeName(Module module, uint typeId)
         {
-            return TypeToString.GetTypeString(GetTypeFromId(typeId));
+            lock (this)
+            {
+                return TypeToString.GetTypeString(GetTypeFromId(typeId));
+            }
         }

         /// <summary>
@@ -256,15 +277,18 @@
         /// <param name="typeId">The type identifier.</param>
         public uint GetTypePointerToTypeId(Module module, uint typeId)
         {
-            var symbol = GetTypeFromId(typeId);
-            var pointer = symbol.objectPointerType;
-
-            if (pointer != null)
-            {
-                return pointer.symIndexId;
-            }
-
-            return GetTypeId(module, symbol.name + "*");
+            lock (this)
+            {
+                var symbol = GetTypeFromId(typeId);
+                var pointer = symbol.objectPointerType;
+
+                if (pointer != null)
+                {
+                    return pointer.symIndexId;
+                }
+
+                return GetTypeId(module, symbol.name + "*");
+            }
         }

         /// <summary>
@@ -274,7 +298,10 @@
         /// <param name="typeId">The type identifier.</param>
         public string[] GetTypeAllFieldNames(Module module, uint typeId)
         {
-            return GetTypeAllFieldNames(GetTypeFromId(typeId));
+            lock (this)
+            {
+                return GetTypeAllFieldNames(GetTypeFromId(typeId));
+            }
         }

         /// <summary>
@@ -299,7 +326,10 @@
         /// <param name="fieldName">Name of the field.</param>
         public Tuple<uint, int> GetTypeAllFieldTypeAndOffset(Module module, uint typeId, string fieldName)
         {
-            return GetTypeFieldTypeAndOffset(GetTypeFromId(typeId), fieldName);
+            lock (this)
+            {
+                return GetTypeFieldTypeAndOffset(GetTypeFromId(typeId), fieldName);
+            }
         }

         /// <summary>
@@ -338,23 +368,26 @@
         /// <exception cref="Exception">Address not found</exception>
         public void GetSourceFileNameAndLine(Process process, ulong processAddress, uint address, out string sourceFileName, out uint sourceFileLine, out ulong displacement)
         {
-            IDiaEnumLineNumbers lineNumbers;
-            IDiaSymbol function;
-
-            session.findSymbolByRVA(address, SymTagEnum.SymTagFunction, out function);
-            session.findLinesByRVA(address, (uint)function.length, out lineNumbers);
-            foreach (IDiaLineNumber lineNumber in lineNumbers)
-            {
-                if (address >= lineNumber.relativeVirtualAddress)
-                {
-                    sourceFileName = lineNumber.sourceFile.fileName;
-                    sourceFileLine = lineNumber.lineNumber;
-                    displacement = address - lineNumber.relativeVirtualAddress;
-                    return;
-                }
-            }
-
-            throw new Exception("Address not found");
+            lock (this)
+            {
+                IDiaEnumLineNumbers lineNumbers;
+                IDiaSymbol function;
+
+                session.findSymbolByRVA(address, SymTagEnum.SymTagFunction, out function);
+                session.findLinesByRVA(address, (uint)function.length, out lineNumbers);
+                foreach (IDiaLineNumber lineNumber in lineNumbers)
+                {
+                    if (address >= lineNumber.relativeVirtualAddress)
+                    {
+                        sourceFileName = lineNumber.sourceFile.fileName;
+                        sourceFileLine = lineNumber.lineNumber;
+                        displacement = address - lineNumber.relativeVirtualAddress;
+                        return;
+                    }
+                }
+
+                throw new Exception("Address not found");
+            }
         }

         /// <summary>
@@ -367,12 +400,15 @@
         /// <param name="displacement">The displacement.</param>
         public void GetFunctionNameAndDisplacement(Process process, ulong processAddress, uint address, out string functionName, out ulong displacement)
         {
-            int innerDisplacement;
-            IDiaSymbol function;
-
-            session.findSymbolByRVAEx(address, SymTagEnum.SymTagFunction, out function, out innerDisplacement);
-            displacement = (ulong)innerDisplacement;
-            functionName = function.name;
+            lock (this)
+            {
+                int innerDisplacement;
+                IDiaSymbol function;
+
+                session.findSymbolByRVAEx(address, SymTagEnum.SymTagFunction, out function, out innerDisplacement);
+                displacement = (ulong)innerDisplacement;
+                functionName = function.name;
+            }
         }

         /// <summary>
@@ -384,26 +420,29 @@
         /// <param name="arguments">if set to <c>true</c> only arguments will be returned.</param>
         public VariableCollection GetFrameLocals(StackFrame frame, Module module, uint relativeAddress, bool arguments)
         {
-            IDiaSymbol function;
-            int displacement;
-            List<Variable> variables = new List<Variable>();
-
-            session.findSymbolByRVAEx(relativeAddress, SymTagEnum.SymTagFunction, out function, out displacement);
-            foreach (var symbol in function.GetChildren(SymTagEnum.SymTagData))
-            {
-                if (arguments && (DataKind)symbol.dataKind != DataKind.Param)
-                {
-                    continue;
-                }
-
-                CodeType codeType = module.TypesById[symbol.typeId];
-                ulong address = ResolveAddress(symbol, frame.FrameContext);
-                var variableName = symbol.name;
-
-                variables.Add(Variable.CreateNoCast(codeType, address, variableName, variableName));
-            }
-
-            return new VariableCollection(variables.ToArray());
+            lock (this)
+            {
+                IDiaSymbol function;
+                int displacement;
+                List<Variable> variables = new List<Variable>();
+
+                session.findSymbolByRVAEx(relativeAddress, SymTagEnum.SymTagFunction, out function, out displacement);
+                foreach (var symbol in function.GetChildren(SymTagEnum.SymTagData))
+                {
+                    if (arguments && (DataKind)symbol.dataKind != DataKind.Param)
+                    {
+                        continue;
+                    }
+
+                    CodeType codeType = module.TypesById[symbol.typeId];
+                    ulong address = ResolveAddress(symbol, frame.FrameContext);
+                    var variableName = symbol.name;
+
+                    variables.Add(Variable.CreateNoCast(codeType, address, variableName, variableName));
+                }
+
+                return new VariableCollection(variables.ToArray());
+            }
         }

         /// <summary>
@@ -452,21 +491,24 @@
         /// <param name="address">The address.</param>
         public ulong ReadSimpleData(CodeType codeType, ulong address)
         {
-            byte[] buffer = Debugger.ReadMemory(codeType.Module.Process, address, codeType.Size);
-
-            // TODO: This doesn't work with bit fields
-            switch (codeType.Size)
-            {
-                case 1:
-                    return buffer[0];
-                case 2:
-                    return BitConverter.ToUInt16(buffer, 0);
-                case 4:
-                    return BitConverter.ToUInt32(buffer, 0);
-                case 8:
-                    return BitConverter.ToUInt64(buffer, 0);
-                default:
-                    throw new Exception("Unexpected data size " + codeType.Size);
+            lock (this)
+            {
+                byte[] buffer = Debugger.ReadMemory(codeType.Module.Process, address, codeType.Size);
+
+                // TODO: This doesn't work with bit fields
+                switch (codeType.Size)
+                {
+                    case 1:
+                        return buffer[0];
+                    case 2:
+                        return BitConverter.ToUInt16(buffer, 0);
+                    case 4:
+                        return BitConverter.ToUInt32(buffer, 0);
+                    case 8:
+                        return BitConverter.ToUInt64(buffer, 0);
+                    default:
+                        throw new Exception("Unexpected data size " + codeType.Size);
+                }
             }
         }

@@ -477,9 +519,12 @@
         /// <param name="globalVariableName">Name of the global variable.</param>
         public ulong GetGlobalVariableAddress(Module module, string globalVariableName)
         {
-            var globalVariable = GetGlobalVariable(globalVariableName);
-
-            return globalVariable.relativeVirtualAddress + module.Offset;
+            lock (this)
+            {
+                var globalVariable = GetGlobalVariable(globalVariableName);
+
+                return globalVariable.relativeVirtualAddress + module.Offset;
+            }
         }

         /// <summary>
@@ -489,9 +534,12 @@
         /// <param name="globalVariableName">Name of the global variable.</param>
         public uint GetGlobalVariableTypeId(Module module, string globalVariableName)
         {
-            var globalVariable = GetGlobalVariable(globalVariableName);
-
-            return GetTypeId(globalVariable.type);
+            lock (this)
+            {
+                var globalVariable = GetGlobalVariable(globalVariableName);
+
+                return GetTypeId(globalVariable.type);
+            }
         }

         /// <summary>
@@ -528,14 +576,17 @@
         /// <param name="typeId">The type identifier.</param>
         public string[] GetTypeFieldNames(Module module, uint typeId)
         {
-            var type = GetTypeFromId(typeId);
-
-            if ((SymTagEnum)type.symTag == SymTagEnum.SymTagPointerType)
-                type = type.type;
-
-            var fields = typeFields[type.symIndexId];
-
-            return fields.Select(t => t.Item1).ToArray();
+            lock (this)
+            {
+                var type = GetTypeFromId(typeId);
+
+                if ((SymTagEnum)type.symTag == SymTagEnum.SymTagPointerType)
+                    type = type.type;
+
+                var fields = typeFields[type.symIndexId];
+
+                return fields.Select(t => t.Item1).ToArray();
+            }
         }

         /// <summary>
@@ -546,22 +597,25 @@
         /// <param name="fieldName">Name of the field.</param>
         public Tuple<uint, int> GetTypeFieldTypeAndOffset(Module module, uint typeId, string fieldName)
         {
-            var type = GetTypeFromId(typeId);
-
-            if ((SymTagEnum)type.symTag == SymTagEnum.SymTagPointerType)
-                type = type.type;
-
-            var fields = typeFields[type.symIndexId];
-
-            foreach (var field in fields)
-            {
-                if (field.Item1 != fieldName)
-                    continue;
-
-                return Tuple.Create(field.Item2, field.Item3);
-            }
-
-            throw new Exception("Field not found");
+            lock (this)
+            {
+                var type = GetTypeFromId(typeId);
+
+                if ((SymTagEnum)type.symTag == SymTagEnum.SymTagPointerType)
+                    type = type.type;
+
+                var fields = typeFields[type.symIndexId];
+
+                foreach (var field in fields)
+                {
+                    if (field.Item1 != fieldName)
+                        continue;
+
+                    return Tuple.Create(field.Item2, field.Item3);
+                }
+
+                throw new Exception("Field not found");
+            }
         }

         /// <summary>
@@ -572,39 +626,42 @@
         /// <param name="className">Name of the class.</param>
         public Tuple<uint, int> GetTypeBaseClass(Module module, uint typeId, string className)
         {
-            var type = GetTypeFromId(typeId);
-
-            if ((SymTagEnum)type.symTag == SymTagEnum.SymTagPointerType)
-                type = type.type;
-
-            if (TypeNameMatches(type.name, className))
-            {
-                return Tuple.Create(type.symIndexId, 0);
-            }
-
-            Stack<Tuple<IDiaSymbol, int>> classes = new Stack<Tuple<IDiaSymbol, int>>();
-
-            classes.Push(Tuple.Create(type, 0));
-
-            while (classes.Count > 0)
-            {
-                var tuple = classes.Pop();
-                var bases = tuple.Item1.GetBaseClasses();
-
-                foreach (var b in bases.Reverse())
-                {
-                    int offset = tuple.Item2 + b.offset;
-
-                    if (TypeNameMatches(b.name, className))
+            lock (this)
+            {
+                var type = GetTypeFromId(typeId);
+
+                if ((SymTagEnum)type.symTag == SymTagEnum.SymTagPointerType)
+                    type = type.type;
+
+                if (TypeNameMatches(type.name, className))
+                {
+                    return Tuple.Create(type.symIndexId, 0);
+                }
+
+                Stack<Tuple<IDiaSymbol, int>> classes = new Stack<Tuple<IDiaSymbol, int>>();
+
+                classes.Push(Tuple.Create(type, 0));
+
+                while (classes.Count > 0)
+                {
+                    var tuple = classes.Pop();
+                    var bases = tuple.Item1.GetBaseClasses();
+
+                    foreach (var b in bases.Reverse())
                     {
-                        return Tuple.Create(GetTypeId(module, b.name), offset);
+                        int offset = tuple.Item2 + b.offset;
+
+                        if (TypeNameMatches(b.name, className))
+                        {
+                            return Tuple.Create(GetTypeId(module, b.name), offset);
+                        }
+
+                        classes.Push(Tuple.Create(b, offset));
                     }
-
-                    classes.Push(Tuple.Create(b, offset));
-                }
-            }
-
-            throw new Exception("Base class not found");
+                }
+
+                throw new Exception("Base class not found");
+            }
         }

         private static bool TypeNameMatches(string name, string className)
@@ -679,22 +736,25 @@
         /// <param name="typeId">The type identifier.</param>
         public Dictionary<string, Tuple<uint, int>> GetTypeDirectBaseClasses(Module module, uint typeId)
         {
-            var type = GetTypeFromId(typeId);
-
-            if ((SymTagEnum)type.symTag == SymTagEnum.SymTagPointerType)
-                type = type.type;
-
-            var bases = type.GetBaseClasses();
-            var result = new Dictionary<string, Tuple<uint, int>>();
-
-            foreach (var b in bases.Reverse())
-            {
-                int offset = b.offset;
-
-                result.Add(b.name, Tuple.Create(GetTypeId(module, b.name), offset));
-            }
-
-            return result;
+            lock (this)
+            {
+                var type = GetTypeFromId(typeId);
+
+                if ((SymTagEnum)type.symTag == SymTagEnum.SymTagPointerType)
+                    type = type.type;
+
+                var bases = type.GetBaseClasses();
+                var result = new Dictionary<string, Tuple<uint, int>>();
+
+                foreach (var b in bases.Reverse())
+                {
+                    int offset = b.offset;
+
+                    result.Add(b.name, Tuple.Create(GetTypeId(module, b.name), offset));
+                }
+
+                return result;
+            }
         }

         /// <summary>


Fixing another instance of the certificate thumbprint (#1522)

--- tests/Microsoft.Identity.Test.Common/TestConstants.cs
+++ tests/Microsoft.Identity.Test.Common/TestConstants.cs
@@ -28,7 +28,7 @@
         public static readonly string[] s_graphScopes = new[] { "user.read" };
         public const uint JwtToAadLifetimeInSeconds = 60 * 10; // Ten minutes
         public const string ClientCredentialAudience = "https://login.microsoftonline.com/72f988bf-86f1-41af-91ab-2d7cd011db47/v2.0";
-        public const string AutomationTestThumbprint = "79fbcbeb5cd28994e50daff8035bacf764b14306";
+        public const string AutomationTestThumbprint = "3051A5BE699BC4596EE47E9FEBBF48DBA85BE67B";
         public const string RSATestCertThumbprint = "9498C1B91CA4F2CFFEA10C53DCC8301F9A8D4BDE";

         public static readonly SortedSet<string> s_scopeForAnotherResource = new SortedSet<string>(new[] { "r2/scope1", "r2/scope2" });


All management commands require DiscordMessageContext

--- DiscordBotNew/Commands/ManagementCommands.cs
+++ DiscordBotNew/Commands/ManagementCommands.cs
@@ -14,7 +14,7 @@
     public static class ManagementCommands
     {
         [Command("username"), HelpText("Changes the bot's username"), Permissions(ownerOnly: true)]
-        public static async Task<ICommandResult> ChangeUsername(ICommandContext context, [JoinRemainingParameters] string username)
+        public static async Task<ICommandResult> ChangeUsername(DiscordMessageContext context, [JoinRemainingParameters] string username)
         {
             if (username.Length > 32)
             {
@@ -26,7 +26,7 @@
         }

         [Command("avatar"), HelpText("Changes the bot's avatar image"), Permissions(ownerOnly: true)]
-        public static async Task<ICommandResult> ChangeAvatar(ICommandContext context, [JoinRemainingParameters] string url)
+        public static async Task<ICommandResult> ChangeAvatar(DiscordMessageContext context, [JoinRemainingParameters] string url)
         {
             try
             {
@@ -62,6 +62,6 @@
         }

         [Command("kill"), HelpText("Kills the bot"), Permissions(ownerOnly: true)]
-        public static void Kill(ICommandContext context) => Environment.Exit(0);
+        public static void Kill(DiscordMessageContext context) => Environment.Exit(0);
     }
 }


Fix bad test asserts [TGSDeploy][DMDeploy]

--- tests/Tgstation.Server.Tests/Instance/WatchdogTest.cs
+++ tests/Tgstation.Server.Tests/Instance/WatchdogTest.cs
@@ -143,7 +143,7 @@

 			Assert.IsNotNull(newerCompileJob);
 			Assert.AreNotEqual(initialCompileJob.Id, newerCompileJob.Id);
-			Assert.AreEqual(DreamDaemonSecurity.Safe, newerCompileJob.MinimumSecurityLevel);
+			Assert.AreEqual(DreamDaemonSecurity.Trusted, newerCompileJob.MinimumSecurityLevel);
 			Assert.AreEqual(DMApiConstants.InteropVersion, daemonStatus.StagedCompileJob.DMApiVersion);
 			await instanceClient.DreamDaemon.Shutdown(cancellationToken);
 		}
@@ -163,7 +163,7 @@
 			Assert.IsNotNull(daemonStatus.ActiveCompileJob);
 			Assert.IsNull(daemonStatus.StagedCompileJob);
 			Assert.AreEqual(DMApiConstants.InteropVersion, daemonStatus.ActiveCompileJob.DMApiVersion);
-			Assert.AreEqual(DreamDaemonSecurity.Safe, daemonStatus.ActiveCompileJob.MinimumSecurityLevel);
+			Assert.AreEqual(DreamDaemonSecurity.Trusted, daemonStatus.ActiveCompileJob.MinimumSecurityLevel);

 			Job startJob;
 			if (new PlatformIdentifier().IsWindows) // Can't get address reuse to trigger on linux for some reason


Garantee last call to  DisposeAsync on IActorLifeCycle Stop

--- EasyActor/Proxy/ActorLifeCycleInterceptor.cs
+++ EasyActor/Proxy/ActorLifeCycleInterceptor.cs
@@ -35,24 +35,19 @@
                 return;
             }

+            invocation.ReturnValue = _Queue.SetCleanUp(() =>
+                (_IAsyncDisposable != null) ? _IAsyncDisposable.DisposeAsync() : TaskBuilder.GetCompleted());
+
             if (method == _Stop)
             {
-                invocation.ReturnValue = (_IAsyncDisposable != null) ?
-                    _Queue.Enqueue(() => { return _IAsyncDisposable.DisposeAsync(); }) : TaskBuilder.GetCompleted();
                 _Queue.Stop();
             }
             else if (method == _Abort)
             {
-                if (_IAsyncDisposable!=null)
-                    _Queue.SetCleanUp(() => _IAsyncDisposable.DisposeAsync());
-
-                invocation.ReturnValue =
-                  _Queue.SetCleanUp(() =>   (_IAsyncDisposable != null) ? _IAsyncDisposable.DisposeAsync() : TaskBuilder.GetCompleted() ) ;
-
                 _Queue.Dispose();
             }
         }
+    }

-    }
 }


Fix approval of a previous change.

Fix approval of a previous change.

--- ApprovalTests/ApprovalTests.Core.approved.cs
+++ ApprovalTests/ApprovalTests.Core.approved.cs
@@ -1537,6 +1537,7 @@
     public class VertexProperty<TValue> : ExRam.Gremlinq.Core.GraphElements.VertexProperty<TValue, System.Collections.Generic.IDictionary<string, object>>
     {
         public VertexProperty(TValue value) { }
+        public System.Collections.Generic.IDictionary<string, object> Properties { get; set; }
         public static ExRam.Gremlinq.Core.GraphElements.VertexProperty<TValue> op_Implicit(ExRam.Gremlinq.Core.GraphElements.VertexProperty<>[] value) { }
         public static ExRam.Gremlinq.Core.GraphElements.VertexProperty<TValue> op_Implicit(TValue value) { }
         public static ExRam.Gremlinq.Core.GraphElements.VertexProperty<TValue> op_Implicit(TValue[] value) { }


cosmetic change

cosmetic change

ソース整理

--- Assets/Common/Utility/Orbit/OrbitMaterial.cs
+++ Assets/Common/Utility/Orbit/OrbitMaterial.cs
@@ -11,7 +11,6 @@
 				public Material			m_Material;
 	[EnumMask]	public Flag				m_Flag;
 	private Stack<int>	m_UnusedOrbitIndices;
-	private Vector3[]	m_VerticesCache;
 	private Vector4[]	m_TangentsCache;
 	private int[]		m_IndicesCache;

@@ -73,7 +72,6 @@
 		for (int i = m_OrbitObjects.Length - 1, i_min = 0; i_min <= i; --i) {
 			m_UnusedOrbitIndices.Push(i);
 		}
-		m_VerticesCache = new Vector3[0];
 	}

 	/// <summary>


Added null variable check

Added null variable check

--- Assets/Fungus/Flowchart/Scripts/Flowchart.cs
+++ Assets/Fungus/Flowchart/Scripts/Flowchart.cs
@@ -623,7 +623,7 @@
 		{
 			foreach (Variable v in variables)
 			{
-				if (v.key == key)
+				if (v != null && v.key == key)
 				{
 					BooleanVariable variable = v as BooleanVariable;
 					if (variable != null)


Stub unit tests for #57699

Stub unit tests for #57699

--- testcases/ooxml/XSSF/UserModel/TestXSSFBugs.cs
+++ testcases/ooxml/XSSF/UserModel/TestXSSFBugs.cs
@@ -2454,6 +2454,18 @@
                 wb.Close();
             }
         }
+        /**
+     * OOXML-Strict files
+     */
+        [Test]
+        [Ignore]
+        public void Test57699()
+        {
+            IWorkbook wb = XSSFTestDataSamples.OpenSampleWorkbook("sample.strict.xlsx");
+            Assert.AreEqual(3, wb.NumberOfSheets);
+
+            // TODO Check the rest
+        }

     }


Added base shape test fact

Added base shape test fact

--- tests/Core2D.UnitTests/Shape/BaseShapeTests.cs
+++ tests/Core2D.UnitTests/Shape/BaseShapeTests.cs
@@ -46,6 +46,14 @@
             Assert.NotNull(target.Data);
         }

+        [Fact]
+        [Trait("Core2D.Shape", "Shape")]
+        public void Transform_Not_Null()
+        {
+            var target = new Class1();
+            Assert.NotNull(target.Transform);
+        }
+
         private class Class1 : BaseShape
         {
             public override void Draw(object dc, ShapeRenderer renderer, double dx, double dy, object db, object r)


git-svn-id: https://gorgonlib.googlecode.com/svn/branches/2.x@1245 a61f9e97-bd4c-0410-8c65-85b29eaa70ff

--- Dorian/Gorgon/Gorgon.Graphics/IO/GorgonGDIImageConverter.cs
+++ Dorian/Gorgon/Gorgon.Graphics/IO/GorgonGDIImageConverter.cs
@@ -715,18 +715,15 @@
 					throw new ArgumentOutOfRangeException("images", "The mip level count and the depth slice count exceed the length of the array.");
 				}

-                //if (mipLevel < 2)
+                for (int depth = 0; depth < depthMip; depth++)
                 {
-                    for (int depth = 0; depth < depthMip; depth++)
+                    var image = images[imageIndex + depth];
+
+                    // Using the image, convert to a WIC bitmap object.
+                    using (var bitmap = wic.CreateWICImageFromImage(image))
                     {
-                        var image = images[imageIndex + depth];
-
-                        // Using the image, convert to a WIC bitmap object.
-                        using (var bitmap = wic.CreateWICImageFromImage(image))
-                        {
-                            var buffer = data[0, mipLevel, depth];
-                            wic.AddWICBitmapToImageData(bitmap, options.Filter, options.Dither, buffer, options.UseClipping);
-                        }
+                        var buffer = data[0, mipLevel, depth];
+                        wic.AddWICBitmapToImageData(bitmap, options.Filter, options.Dither, buffer, options.UseClipping);
                     }
                 }


Update RecreateDatabaseHandler.cs

Update RecreateDatabaseHandler.cs

Fixed a typo in an error message

--- Duplicati/Library/Main/Operation/RecreateDatabaseHandler.cs
+++ Duplicati/Library/Main/Operation/RecreateDatabaseHandler.cs
@@ -130,7 +130,7 @@
                     select n;

                 if (filelists.Count() <= 0)
-                    throw new Exception(string.Format("No filelists found on the remote destinatio"));
+                    throw new Exception(string.Format("No filelists found on the remote destination"));

                 if (filelistfilter != null)
                     filelists = filelistfilter(filelists).Select(x => x.Value).ToArray();


Updated activity goals test page's titles

--- Fitbit.Portable.DebugSite/Views/Fitbit/ActivityGoals.cshtml
+++ Fitbit.Portable.DebugSite/Views/Fitbit/ActivityGoals.cshtml
@@ -9,12 +9,12 @@

-
Current Weekly Goals

+
Current Daily Goals

     @Html.DisplayForModel()

-
Update Weekly Goals

+
Update Daily Goals

     @using (Html.BeginForm("ActivityGoals", "Fitbit"))
     {
         @Html.EditorForModel()


Featured queries make a comeback

Featured queries make a comeback

--- App/StackExchange.DataExplorer/Controllers/SavedQueryController.cs
+++ App/StackExchange.DataExplorer/Controllers/SavedQueryController.cs
@@ -237,7 +237,42 @@

             IEnumerable<QueryExecutionViewData> queries;

-            if (order_by == "recent")
+            if (order_by == "featured")
+            {
+                queries = Current.DB.Query<Metadata, Query, User, QueryExecutionViewData>(@"
+                    SELECT
+                        *
+                    FROM
+                        Metadata metadata
+                    JOIN
+                        Queries query
+                    ON
+                        query.Id = metadata.LastQueryId
+                    LEFT OUTER JOIN
+                        Users [user]
+                    ON
+                        metadata.OwnerId = [user].Id
+                    ORDER BY
+                        metadata.LastActivity DESC",
+                    (metadata, query, user) =>
+                    {
+                        return new QueryExecutionViewData
+                        {
+                            Id = metadata.RevisionId,
+                            Name = metadata.Title,
+                            DefaultName = query.AsTitle(),
+                            Description = metadata.Description,
+                            FavoriteCount = metadata.Votes,
+                            Views = metadata.Views,
+                            LastRun = metadata.LastActivity,
+                            Creator = user,
+                            SiteName = Site.Name.ToLower(),
+                            UseLatestLink = true
+                        };
+                    }
+                );
+            }
+            else if (order_by == "recent")
             {
                 queries = Current.DB.Query<Metadata, Query, User, QueryExecutionViewData>(@"
                     SELECT


More BucketCore refactors

More BucketCore refactors

--- Framework.Core/Theraot/Collections/ThreadSafe/BucketCore.cs
+++ Framework.Core/Theraot/Collections/ThreadSafe/BucketCore.cs
@@ -17,13 +17,13 @@
         private const int _capacityLog2 = 5;
         private const int _capacity = 1 << _capacityLog2;
         private const int _mask = _capacity - 1;
-        private const long _lvl1 = _capacity;
-        private const long _lvl2 = _lvl1 * _capacity;
-        private const long _lvl3 = _lvl2 * _capacity;
-        private const long _lvl4 = _lvl3 * _capacity;
-        private const long _lvl5 = _lvl4 * _capacity;
-        private const long _lvl6 = _lvl5 * _capacity;
-        private const long _lvl7 = _lvl6 * _capacity;
+        private const long _lvl1 = 1L << (_capacityLog2 * 1);
+        private const long _lvl2 = 1L << (_capacityLog2 * 2);
+        private const long _lvl3 = 1L << (_capacityLog2 * 3);
+        private const long _lvl4 = 1L << (_capacityLog2 * 4);
+        private const long _lvl5 = 1L << (_capacityLog2 * 5);
+        private const long _lvl6 = 1L << (_capacityLog2 * 6);
+        private const long _lvl7 = 1L << (_capacityLog2 * 7);
         private readonly int _level;
         private object[] _arrayFirst;
         private object[] _arraySecond;
@@ -444,7 +444,8 @@

         private int SubIndex(int index)
         {
-            return (index >> (_capacityLog2 * (_level - 1))) & _mask;
+            var uIndex = unchecked((uint)index);
+            return (int)((uIndex >> (_capacityLog2 * (_level - 1))) & _mask);
         }
     }
 }


GTMillStateGenerator implement third phase

--- GTMillGameLogic/GTMillGameLogic/GTMillGameStateGenerator.cs
+++ GTMillGameLogic/GTMillGameLogic/GTMillGameStateGenerator.cs
@@ -31,15 +31,26 @@
 			Task<TaskReturnType> task = Task<TaskReturnType>.Factory.StartNew (() => {
 				TaskReturnType states = new TaskReturnType ();

-				List<GTMillGameStep> steps = new List<GTMillGameStep> ();
 				for (int x = 0; x < 3; ++x) {
 					for (int y = 0; y < 3; ++y) {
 						for (int z = 0; z < 3; ++z) {
 							GTMillPosition p = new GTMillPosition(x, y ,z);
 							if (!state.hasElementAt(p)) {
+
 								int id = player.id * player.figuresLost + 1;
 								GTMillGameElement element = new GTMillGameElement(id, 1, player.id);
-								steps.Add(new GTMillGameStep(element, GTMillPosition.Nowhere(), p));
+								GTMillGameStep step = new GTMillGameStep(element, GTMillPosition.Nowhere(), p);
+								GTMillGameSpace newState = state.stateWithStep (step) as GTMillGameSpace;
+								if (GTMillGameMillDetector.detectMillOnPositionWithStateForUser(step.to, newState, player.id))
+								{
+									foreach (GTMillGameStep removeStep in removeOppenentFigureSteps(newState, player.id)) {
+										states.Add(newState.stateWithStep(removeStep));
+									}
+								}
+								else
+								{
+									states.Add (newState);
+								}
 							}
 						}
 					}
@@ -87,6 +98,37 @@
 		{
 			Task<TaskReturnType> task = Task<TaskReturnType>.Factory.StartNew (() => {
 				TaskReturnType states = new TaskReturnType ();
+
+				foreach (KeyValuePair<GTMillPosition, GTMillGameElement> kv in state) {
+					if (kv.Value.owner == player.id) {
+
+						for (int x = 0; x < 3; ++x) {
+							for (int y = 0; y < 3; ++y) {
+								for (int z = 0; z < 3; ++z) {
+
+									GTMillPosition p = new GTMillPosition(x, y ,z);
+									if (!state.hasElementAt(p)) {
+
+										GTMillGameElement element = kv.Value;
+										GTMillGameStep step = new GTMillGameStep(element, kv.Key, p);
+										GTMillGameSpace newState = state.stateWithStep (step) as GTMillGameSpace;
+										if (GTMillGameMillDetector.detectMillOnPositionWithStateForUser(step.to, newState, player.id))
+										{
+											foreach (GTMillGameStep removeStep in removeOppenentFigureSteps(newState, player.id)) {
+												states.Add(newState.stateWithStep(removeStep));
+											}
+										}
+										else
+										{
+											states.Add (newState);
+										}
+									}
+								}
+							}
+						}
+					}
+				}
+
 				return states;
 			});
 			return task;


More repro code

More repro code

--- Gu.Reactive.Demo/UiTestWindows/ConditionControlViewModel.cs
+++ Gu.Reactive.Demo/UiTestWindows/ConditionControlViewModel.cs
@@ -12,7 +12,9 @@

         public ConditionControlViewModel()
         {
-            this.Condition = new DynamicCondition(this.Values.AsReadOnlyFilteredView(x => true), x => new IsEvenGretarThanTwo(x));
+            this.Condition = new OrCondition(
+                new DynamicCondition(this.Values.AsReadOnlyFilteredView(x => true), x => new IsEvenGretarThanTwo(x)),
+                new DynamicCondition(this.Values.AsReadOnlyFilteredView(x => true), x => new IsLessThanFive(x)));
             this.ClearCommand = new RelayCommand(() => this.Values.Clear());
         }

@@ -115,6 +117,16 @@
             }
         }

+        private sealed class IsLessThanFive : Condition
+        {
+            internal IsLessThanFive(WithInt withInt)
+                : base(
+                    withInt.ObservePropertyChangedSlim(x => x.Value),
+                    () => withInt.Value < 5)
+            {
+            }
+        }
+
         private class DynamicCondition : OrCondition
         {
             internal DynamicCondition(IReadOnlyView<WithInt> xs, Func<WithInt, ICondition> map)


fix test case name

fix test case name

--- HearthStone/HearthStone.Library.Test/CardManagerUnitTest.cs
+++ HearthStone/HearthStone.Library.Test/CardManagerUnitTest.cs
@@ -12,7 +12,7 @@
     {

         [TestMethod]
-        public void StaticInstanceTestMethod1()
+        public void CardManagerInstanceTestMethod1()
         {
             CardManager instance = CardManager.Instance;
             Assert.IsNotNull(instance);


Add RemoveReport Test with AdminController [#136389281]

--- revashare-svc-webapi/revashare-svc-webapi.Tests/FlagTests.cs
+++ revashare-svc-webapi/revashare-svc-webapi.Tests/FlagTests.cs
@@ -1,13 +1,20 @@
-using revashare_svc_webapi.Logic;
+using Moq;
+using NSubstitute;
+using revashare_svc_webapi.Client.Controllers;
+using revashare_svc_webapi.Logic;
 using revashare_svc_webapi.Logic.AdminLogic;
+using revashare_svc_webapi.Logic.Interfaces;
 using revashare_svc_webapi.Logic.Models;
 using revashare_svc_webapi.Logic.RevaShareServiceReference;
 using revashare_svc_webapi.Logic.ServiceClient;
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Net;
+using System.Net.Http;
 using System.Text;
 using System.Threading.Tasks;
+using System.Web.Http;
 using Xunit;

 namespace revashare_svc_webapi.Tests
@@ -40,21 +47,21 @@
     }

-    //[Fact]
-    //public void test_RemoveReport_AdminLogic()
-    //{
-    //  ServiceClient sc = new ServiceClient();
-    //  AdminLogic admLogic = new AdminLogic(sc);
-    //  FlagDTO reportNumber = new FlagDTO { FlagId = 22 };
+    [Fact]
+    public void test_RemoveReport_AdminController()
+    {
+      var mock = new Mock<IAdmin>();
+      mock.Setup(a => a.RemoveReport(new FlagDTO())).Returns(true);
+      var ctrl = new AdminController(mock.Object);

-    //  bool actual = admLogic.RemoveReport(reportNumber);
+      ctrl.Request = Substitute.For<HttpRequestMessage>();
+      ctrl.Configuration = Substitute.For<HttpConfiguration>();
+      HttpResponseMessage res = ctrl.RemoveReport(new FlagDTO());
+
+      Assert.Equal(res.StatusCode, HttpStatusCode.OK);
+
+      }

-    //  Assert.True(actual);
-
-
-    //}
-
-
+    }
   }
-}


Overload ReadData() with string fileName

--- C#Development/BashSoft/BashSoft/Repositories/StudentsRepository.cs
+++ C#Development/BashSoft/BashSoft/Repositories/StudentsRepository.cs
@@ -5,6 +5,8 @@
     using System;
     using System.Collections.Generic;
     using System.Linq;
+    using System.IO;
+    using System.Text.RegularExpressions;

     public static class StudentsRepository
     {
@@ -12,13 +14,13 @@

         private static Dictionary<string, Dictionary<string, List<int>>> studentsByCourse;

-        public static void InitializeData()
+        public static void InitializeData(string fileName)
         {
             if (!isDataInitialized)
             {
                 OutputWriter.WriteMessageOnNewLine("Reading data...");
                 studentsByCourse = new Dictionary<string, Dictionary<string, List<int>>>();
-                ReadData();
+                ReadData(fileName);
             }
             else
             {
@@ -61,6 +63,48 @@

             isDataInitialized = true;
             OutputWriter.WriteMessageOnNewLine("Data read!");
+        }
+
+        private static void ReadData(string fileName)
+        {
+            var path = SessionData.currentPath + "\\" + fileName;
+
+            if (File.Exists(path))
+            {
+                var pattern = @"([A-Z][a-zA-Z#+]*_[A-Z][a-z]{2}_\d{4})\s+([A-Z][a-z]{0,3}\d{2}_\d{2,4})\s+(\d+)";
+                var rgx = new Regex(pattern);
+                var allInputLines = File.ReadAllLines(path);
+
+                for (int line = 0; line < allInputLines.Length; line++)
+                {
+                    if (!string.IsNullOrEmpty(allInputLines[line]) && rgx.IsMatch(allInputLines[line]))
+                    {
+                        var currentMatch = rgx.Match(allInputLines[line]);
+                        var courseName = currentMatch.Groups[1].Value;
+                        var username = currentMatch.Groups[2].Value;
+                        bool hasParsedScore = int.TryParse(currentMatch.Groups[3].Value, out int studentScoreOnTask);
+
+                        if (hasParsedScore && studentScoreOnTask >= 0 && studentScoreOnTask <= 100)
+                        {
+                            if (!studentsByCourse.ContainsKey(courseName))
+                            {
+                                studentsByCourse.Add(courseName, new Dictionary<string, List<int>>());
+                            }
+
+                            if (!studentsByCourse[courseName].ContainsKey(username))
+                            {
+                                studentsByCourse[courseName].Add(username, new List<int>());
+                            }
+
+                            studentsByCourse[courseName][username].Add(studentScoreOnTask);
+                        }
+                    }
+                }
+
+                isDataInitialized = true;
+
+                OutputWriter.WriteMessageOnNewLine("Data read!");
+            }
         }

         private static bool IsQueryForCoursePossible(string courseName)


Fixed excessive "asset not found" reports. AssetNotFound is also called from the WHIP client.

All new assets (or CF assets!) would produce this report that I added to
help track later reports of missing asset IDs. Sigh. Yanked.

--- InWorldz/InWorldz.Data.Assets.Stratus/StratusAssetClient.cs
+++ InWorldz/InWorldz.Data.Assets.Stratus/StratusAssetClient.cs
@@ -283,7 +283,6 @@
         //see IAssetReceiver
         public void AssetNotFound(OpenMetaverse.UUID assetID, AssetRequestInfo data)
         {
-            m_log.WarnFormat("[InWorldz.Stratus]: Asset not found {0}", assetID);
             this.HandleAssetCallback(assetID, data, null);
         }


added a small heading

added a small heading

--- FlightGates/Views/Template/gatedetail.cshtml
+++ FlightGates/Views/Template/gatedetail.cshtml
@@ -8,7 +8,7 @@

-            Gate
+            Gate  Schedule for today

         Gate has no flights scheduled.

 0">


Prevent area-effect-reactions in space. (#7455)

--- Content.Server/Chemistry/Components/SolutionAreaEffectComponent.cs
+++ Content.Server/Chemistry/Components/SolutionAreaEffectComponent.cs
@@ -13,6 +13,7 @@
 using Robust.Shared.Map;
 using Robust.Shared.Maths;
 using Robust.Shared.Prototypes;
+using Robust.Shared.Utility;

 namespace Content.Server.Chemistry.Components
 {
@@ -27,6 +28,7 @@
         [Dependency] protected readonly IMapManager MapManager = default!;
         [Dependency] protected readonly IPrototypeManager PrototypeManager = default!;
         [Dependency] private readonly IEntityManager _entities = default!;
+        [Dependency] private readonly IEntitySystemManager _systems = default!;

         public int Amount { get; set; }
         public SolutionAreaEffectInceptionComponent? Inception { get; set; }
@@ -64,30 +66,43 @@
         /// </summary>
         public void Spread()
         {
-            if (_entities.GetComponent<MetaDataComponent>(Owner).EntityPrototype == null)
+            var meta = _entities.GetComponent<MetaDataComponent>(Owner);
+            if (meta.EntityPrototype == null)
             {
                 Logger.Error("AreaEffectComponent needs its owner to be spawned by a prototype.");
                 return;
             }

+            var xform = _entities.GetComponent<TransformComponent>(Owner);
+            var solSys = _systems.GetEntitySystem<SolutionContainerSystem>();
+            var grid = MapManager.GetGrid(xform.GridID);
+            var origin = grid.TileIndicesFor(xform.Coordinates);
+
+            DebugTools.Assert(xform.Anchored, "Area effect entity prototypes must be anchored.");
+
             void SpreadToDir(Direction dir)
             {
-                var grid = MapManager.GetGrid(_entities.GetComponent<TransformComponent>(Owner).GridID);
-                var coords = _entities.GetComponent<TransformComponent>(Owner).Coordinates;
-                foreach (var neighbor in grid.GetInDir(coords, dir))
+                // Currently no support for spreading off or across grids.
+                var index = origin + dir.ToIntVec();
+                if (!grid.TryGetTileRef(index, out var tile) || tile.Tile.IsEmpty)
+                    return;
+
+                foreach (var neighbor in grid.GetAnchoredEntities(index))
                 {
                     if (_entities.TryGetComponent(neighbor,
                         out SolutionAreaEffectComponent? comp) && comp.Inception == Inception)
                         return;

+                    // TODO for thindows and the like, need to check the directions that are being blocked.
+                    // --> would then also mean you need to check for blockers on the origin tile.
                     if (_entities.TryGetComponent(neighbor,
                         out AirtightComponent? airtight) && airtight.AirBlocked)
                         return;
                 }

                 var newEffect = _entities.SpawnEntity(
-                    _entities.GetComponent<MetaDataComponent>(Owner).EntityPrototype?.ID,
-                    grid.DirectionToGrid(coords, dir));
+                    meta.EntityPrototype.ID,
+                    grid.GridTileToLocal(index));

                 if (!_entities.TryGetComponent(newEffect, out SolutionAreaEffectComponent? effectComponent))
                 {
@@ -95,7 +110,7 @@
                     return;
                 }

-                if (EntitySystem.Get<SolutionContainerSystem>().TryGetSolution(Owner, SolutionName, out var solution))
+                if (solSys.TryGetSolution(Owner, SolutionName, out var solution))
                 {
                     effectComponent.TryAddSolution(solution.Clone());
                 }


Set the vessel position always if unpacked

--- LmpClient/Systems/VesselPositionSys/VesselPositionUpdate.cs
+++ LmpClient/Systems/VesselPositionSys/VesselPositionUpdate.cs
@@ -157,9 +157,10 @@
                 InitializeOrbits();
             }

-            if (Target == null || InterpolationFinished) return;
+            if (Target == null || InterpolationFinished && !Vessel.packed) return;
             try
             {
+                //ALWAYS set the position if the vessel is UNPACKED even if we don't have anything in the queue. Otherwise its position will shake
                 Vessel.SetVesselPosition(this, Target, LerpPercentage);
             }
             catch (Exception e)


Fixes #61.

Fixes #61.

--- DancingGoat/ContentLinkUrlResolver/CustomContentLinkUrlResolver.cs
+++ DancingGoat/ContentLinkUrlResolver/CustomContentLinkUrlResolver.cs
@@ -17,11 +17,11 @@
                 case "article":
                     return $"/{CurrentCulture}/articles/{link.UrlSlug}";
                 case "brewer":
-                    return $"/{CurrentCulture}/products/{link.UrlSlug}";
+                    return $"/{CurrentCulture}/product/detail/{link.UrlSlug}";
                 case "cafe":
                     return $"/{CurrentCulture}/cafes";
                 case "coffee":
-                    return $"/{CurrentCulture}/products/{link.UrlSlug}";
+                    return $"/{CurrentCulture}/product/detail/{link.UrlSlug}";
                 case "home":
                     return $"/{CurrentCulture}/";
                 default:


fix gamefield for online game

fix gamefield for online game

--- GUIImplementation/AbstractGUIControl.xaml.cs
+++ GUIImplementation/AbstractGUIControl.xaml.cs
@@ -54,64 +54,76 @@
         {
             int row = field.GetLength(0);
             int col = field.GetLength(1);
-            int height = (int)Height / row;
-            int width = (int)Width / col;
-            for (int i = 0; i < row; ++i)
-            {
-                for (int j = 0; j < col; ++j)
-                {
-                    ExtendedImage label = (ExtendedImage)this.field[i][j];
-                    label.Stretch = Stretch.Fill;
-                    label.StretchDirection = StretchDirection.Both;
-                    label.Height = height;
-                    label.Width = width;
-                    label.Source = new BitmapImage(GetImageURI(false,field[i,j]));
-                    Canvas.SetTop(label, i * height);
-                    Canvas.SetLeft(label, j * width);
-                }
-            }
+
+            Dispatcher.Invoke(() =>
+            {
+                int height = (int) Height/row;
+                int width = (int) Width/col;
+                for (int i = 0; i < row; ++i)
+                {
+                    for (int j = 0; j < col; ++j)
+                    {
+                        ExtendedImage label = (ExtendedImage) this.field[i][j];
+                        label.Stretch = Stretch.Fill;
+                        label.StretchDirection = StretchDirection.Both;
+                        label.Height = height;
+                        label.Width = width;
+                        label.Source = new BitmapImage(GetImageURI(false, field[i, j]));
+                        Canvas.SetTop(label, i*height);
+                        Canvas.SetLeft(label, j*width);
+                    }
+                }
+            });
         }

         private void DeleteField()
         {
-            for (int i = 0; i < field.Count; ++i)
-            {
-                for (int j = 0; j < field[i].Count; ++j)
-                {
-
-                    this.RemoveVisualChild(field[i][j]);
-                    field[i][j] = null;
-                }
-                field[i] = null;
-            }
-            field = null;
+            Dispatcher.Invoke(() =>
+            {
+                for (int i = 0; i < field.Count; ++i)
+                {
+                    for (int j = 0; j < field[i].Count; ++j)
+                    {
+
+                        this.RemoveVisualChild(field[i][j]);
+                        field[i][j] = null;
+                    }
+                    field[i] = null;
+                }
+                field = null;
+            });
         }

         private void CreateField(byte[,] field)
         {
             int row = field.GetLength(0);
             int col = field.GetLength(1);
-            int height = (int)Height / row;
-            int width = (int)Width / col;
-            this.field = new List<List<Image>>(row);
-            for (int i = 0; i < row; ++i)
-            {
-                List<Image> rowList = new List<Image>(col);
-                this.field.Add(rowList);
-                for (int j = 0; j < col; ++j)
-                {
-                    ExtendedImage label = new ExtendedImage();
-                    rowList.Add(label);
-                    label.Row = i;
-                    label.Column = j;
-                    grid.Children.Add(label);
-                    label.MouseLeftButtonUp += new MouseButtonEventHandler(delegate(Object o, MouseButtonEventArgs a)
-                    {
-                        ExtendedImage img = (ExtendedImage)a.Source;
-                        FieldClicked(this, img.Row, img.Column);
-                    });
-                }
-            }
+
+            Dispatcher.Invoke(() =>
+            {
+                int height = (int) Height/row;
+                int width = (int) Width/col;
+                this.field = new List<List<Image>>(row);
+                for (int i = 0; i < row; ++i)
+                {
+                    List<Image> rowList = new List<Image>(col);
+                    this.field.Add(rowList);
+                    for (int j = 0; j < col; ++j)
+                    {
+                        ExtendedImage label = new ExtendedImage();
+                        rowList.Add(label);
+                        label.Row = i;
+                        label.Column = j;
+                        grid.Children.Add(label);
+                        label.MouseLeftButtonUp +=
+                            new MouseButtonEventHandler(delegate(Object o, MouseButtonEventArgs a)
+                            {
+                                ExtendedImage img = (ExtendedImage) a.Source;
+                                FieldClicked(this, img.Row, img.Column);
+                            });
+                    }
+                }
+            });
         }

         void label_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
@@ -122,82 +134,96 @@

         public void SetFieldBackground(byte[,] field)
         {
-            if (field != null && this.field != null)
-            {
-                if (field.GetLength(0) == this.background.Count() && field.GetLength(1) == this.background.Count())
-                {
-
+            Dispatcher.Invoke(() =>
+            {
+                if (field != null && this.field != null)
+                {
+                    if (field.GetLength(0) == this.background.Count() && field.GetLength(1) == this.background.Count())
+                    {
+
+                    }
+                    else
+                    {
+                        DeleteBackground();
+                        CreateBackGround(field);
+                    }
                 }
                 else
                 {
-                    DeleteBackground();
                     CreateBackGround(field);
                 }
-            }
-            else
-            {
-                CreateBackGround(field);
-            }
-            RefreshBackGround(field);
+                RefreshBackGround(field);
+            });
         }

         public virtual string GuiName { get { throw new NotImplementedException(); } }

         private void DeleteBackground()
         {
-            for (int i = 0; i < background.Count; ++i)
-            {
-                for (int j = 0; j < background[i].Count; ++j)
-                {
-
-                    this.RemoveVisualChild(background[i][j]);
-                    background[i][j] = null;
-                }
-                background[i] = null;
-            }
-            background = null;
+            Dispatcher.Invoke(() =>
+            {
+                for (int i = 0; i < background.Count; ++i)
+                {
+                    for (int j = 0; j < background[i].Count; ++j)
+                    {
+
+                        this.RemoveVisualChild(background[i][j]);
+                        background[i][j] = null;
+                    }
+                    background[i] = null;
+                }
+                background = null;
+            });
         }

         private void CreateBackGround(byte[,] field)
         {
             int row = field.GetLength(0);
             int col = field.GetLength(1);
-            int height = (int)Height / row;
-            int width  = (int)Width / col;
-            this.background = new List<List<Image>>(row);
-            for (int i = 0; i < row; ++i)
-            {
-                List<Image> rowList = new List<Image>(col);
-                this.background.Add(rowList);
-                for (int j = 0; j < col; ++j)
-                {
-                    System.Windows.Controls.Image label = new System.Windows.Controls.Image();
-                    rowList.Add(label);
-                    grid.Children.Add(label);
-                }
-            }
+
+            Dispatcher.Invoke(() =>
+            {
+                int height = (int)Height / row;
+                int width = (int)Width / col;
+                this.background = new List<List<Image>>(row);
+                for (int i = 0; i < row; ++i)
+                {
+                    List<Image> rowList = new List<Image>(col);
+                    this.background.Add(rowList);
+                    for (int j = 0; j < col; ++j)
+                    {
+                        System.Windows.Controls.Image label = new System.Windows.Controls.Image();
+                        rowList.Add(label);
+                        grid.Children.Add(label);
+                    }
+                }
+            });
         }

         private void RefreshBackGround(byte[,] field)
         {
             int row = field.GetLength(0);
             int col = field.GetLength(1);
-            int height = (int)Height / row;
-            int width = (int)Width / col;
-            for (int i = 0; i < row; ++i)
-            {
-                for (int j = 0; j < col; ++j)
-                {
-                    System.Windows.Controls.Image label = this.background[i][j];
-                    label.Stretch = Stretch.Fill;
-                    label.StretchDirection = StretchDirection.Both;
-                    label.Height = height;
-                    label.Width = width;
-                    label.Source = new BitmapImage(GetImageURI(true,field[i,j]));
-                    Canvas.SetTop(label, i * height);
-                    Canvas.SetLeft(label, j * width);
-                }
-            }
+
+            Dispatcher.Invoke(() =>
+            {
+                int height = (int) Height/row;
+                int width = (int) Width/col;
+                for (int i = 0; i < row; ++i)
+                {
+                    for (int j = 0; j < col; ++j)
+                    {
+                        System.Windows.Controls.Image label = this.background[i][j];
+                        label.Stretch = Stretch.Fill;
+                        label.StretchDirection = StretchDirection.Both;
+                        label.Height = height;
+                        label.Width = width;
+                        label.Source = new BitmapImage(GetImageURI(true, field[i, j]));
+                        Canvas.SetTop(label, i*height);
+                        Canvas.SetLeft(label, j*width);
+                    }
+                }
+            });
         }
     }
 }


Do not rely on existence of '.exe'

Do not rely on existence of '.exe'

--- source/xcite.clip/Parser.cs
+++ source/xcite.clip/Parser.cs
@@ -44,13 +44,20 @@
             // See explanation at property
             if (MarvelMode) {
                 string originalCl = Environment.CommandLine;
-                bool quoted = originalCl[0] == dblQuoteTk; // Note, the CLI must NOT start with a double quote character
-                const string execToken = ".exe";
-                int exeIdx = originalCl.IndexOf(execToken, StringComparison.InvariantCultureIgnoreCase);
-                if (exeIdx == -1) return PrintUsageWithError("Unexpected argument format.", optionTypes, null);
-
-                int arglineStart = exeIdx + execToken.Length + (quoted ? 1 : 0);
-                int k = arglineStart;
+
+                // The first part is always the way the programm has been started, for instance
+                //   (i) "c:\program.exe" ...
+                //  (ii) program.exe ...
+                // (iii) program ...
+                // The first non-whitespace character separates the first part from the rest
+                int k = 0;
+                bool escapeMode = false;
+                char d;
+                while (k != originalCl.Length && ((d = originalCl[k++]) != whitespaceTk || escapeMode)) {
+                    if (d == dblQuoteTk) {
+                        escapeMode = !escapeMode;
+                    }
+                }

                 // Find the first non-whitespace character
                 while (k != originalCl.Length && originalCl[k++] == whitespaceTk) {


Add support for the "payments" and “profile”  properties in the "_links" object of the SubscriptionResponseLinks class

--- Mollie.Api/Models/Subscription/SubscriptionResponseLinks.cs
+++ Mollie.Api/Models/Subscription/SubscriptionResponseLinks.cs
@@ -1,4 +1,7 @@
 using Mollie.Api.Models.Customer;
+using Mollie.Api.Models.List;
+using Mollie.Api.Models.Payment.Response;
+using Mollie.Api.Models.Profile.Response;
 using Mollie.Api.Models.Url;

 namespace Mollie.Api.Models.Subscription {
@@ -14,6 +17,17 @@
         public UrlObjectLink<CustomerResponse> Customer { get; set; }

         /// <summary>
+        /// The API resource URL of the payments that are created by this subscription. Not present
+        /// if no payments yet created.
+        /// </summary>
+        public UrlObjectLink<ListResponse<PaymentResponse>> Payments { get; set; }
+
+        /// <summary>
+        /// The API resource URL of the website profile on which this subscription was created.
+        /// </summary>
+        public UrlObjectLink<ProfileResponse> Profile { get; set; }
+
+        /// <summary>
         /// The URL to the subscription retrieval endpoint documentation.
         /// </summary>
         public UrlLink Documentation { get; set; }


update loader to correctly load genes instead of nets

--- NeuralNetwork.GeneticAlgorithm/Utils/NeuralNetworkLoader.cs
+++ NeuralNetwork.GeneticAlgorithm/Utils/NeuralNetworkLoader.cs
@@ -1,6 +1,8 @@
 using ArtificialNeuralNetwork;
 using Newtonsoft.Json;
 using System.IO;
+using ArtificialNeuralNetwork.Factories;
+using ArtificialNeuralNetwork.Genes;

 namespace NeuralNetwork.GeneticAlgorithm.Utils
 {
@@ -15,8 +17,9 @@

         public INeuralNetwork LoadNeuralNetwork(string filename)
         {
-            var jsonNet = File.ReadAllText(_directory + filename);
-            INeuralNetwork network = JsonConvert.DeserializeObject<INeuralNetwork>(jsonNet);
+            var jsonGenes = File.ReadAllText(_directory + filename);
+            var networkGene = JsonConvert.DeserializeObject<NeuralNetworkGene>(jsonGenes);
+            var network = NeuralNetworkFactory.GetInstance().Create(networkGene);
             return network;
         }
     }


Added cache for user information.

Added cache for user information.

--- NtObjectManager/Cmdlets/Accessible/GetAccessibleDsObject.cs
+++ NtObjectManager/Cmdlets/Accessible/GetAccessibleDsObject.cs
@@ -229,6 +229,8 @@

         private static readonly ConcurrentDictionary<string, DsObjectInformation> _cached_info
             = new ConcurrentDictionary<string, DsObjectInformation>(StringComparer.OrdinalIgnoreCase);
+        private static readonly ConcurrentDictionary<Tuple<string, Sid>, List<Sid>> _cached_user_groups
+            = new ConcurrentDictionary<Tuple<string, Sid>, List<Sid>>();

         private static T[] GetPropertyValues<T>(SearchResult result, string name)
         {
@@ -464,6 +466,44 @@
             return DistinguishedName.Select(dn => new DirectoryEntry(ConstructLdapUrl(Domain, dn, false))).ToList();
         }

+        private static List<Sid> GetUserDomainSids(string domain, Sid user_sid)
+        {
+            List<Sid> ret = new List<Sid>();
+            ret.Add(KnownSids.World);
+            ret.Add(KnownSids.AuthenticatedUsers);
+            ret.AddRange(DirectoryServiceUtils.FindTokenGroupsForSid(user_sid, false));
+            HashSet<DirectoryServiceSecurityPrincipal> members = new HashSet<DirectoryServiceSecurityPrincipal>();
+            foreach (var next_sid in ret)
+            {
+                var principal_name = NtSecurity.IsDomainSid(next_sid) ? DirectoryServiceUtils.FindObjectFromSid(null, next_sid)
+                    : DirectoryServiceUtils.FindObjectFromSid(domain, next_sid);
+                if (principal_name?.DistinguishedName == null)
+                    continue;
+                members.Add(principal_name);
+            }
+
+            var user_name = DirectoryServiceUtils.FindObjectFromSid(null, user_sid);
+            if (user_name?.DistinguishedName != null)
+            {
+                members.Add(user_name);
+            }
+
+            Queue<string> remaining_checks = new Queue<string>(members.Select(m => m.DistinguishedName));
+            while (remaining_checks.Count > 0)
+            {
+                string dn = remaining_checks.Dequeue();
+                foreach (var local_group in DirectoryServiceUtils.FindDomainLocalGroupForMember(domain, dn))
+                {
+                    if (members.Add(local_group))
+                    {
+                        ret.Add(local_group.Sid);
+                        remaining_checks.Enqueue(local_group.DistinguishedName);
+                    }
+                }
+            }
+            return ret;
+        }
+
         private void BuildAuthZContext()
         {
             _resource_manager = string.IsNullOrWhiteSpace(Server) ? AuthZResourceManager.Create(GetType().Name,
@@ -504,38 +544,7 @@

                     WriteProgress($"Building context for {sid.Name}");
                     var context = _context.AddResource(_resource_manager.CreateContext(sid, AuthZContextInitializeSidFlags.SkipTokenGroups));
-                    context.AddSid(KnownSids.World);
-                    context.AddSid(KnownSids.AuthenticatedUsers);
-                    context.AddSids(DirectoryServiceUtils.FindTokenGroupsForSid(sid, false));
-                    HashSet<DirectoryServiceSecurityPrincipal> members = new HashSet<DirectoryServiceSecurityPrincipal>();
-                    foreach (var next_sid in context.Groups.Select(g => g.Sid))
-                    {
-                        var principal_name = NtSecurity.IsDomainSid(next_sid) ? DirectoryServiceUtils.FindObjectFromSid(null, next_sid)
-                            : DirectoryServiceUtils.FindObjectFromSid(Domain, next_sid);
-                        if (principal_name?.DistinguishedName == null)
-                            continue;
-                        members.Add(principal_name);
-                    }
-
-                    var user_name = DirectoryServiceUtils.FindObjectFromSid(null, sid);
-                    if (user_name?.DistinguishedName != null)
-                    {
-                        members.Add(user_name);
-                    }
-
-                    Queue<string> remaining_checks = new Queue<string>(members.Select(m => m.DistinguishedName));
-                    while (remaining_checks.Count > 0)
-                    {
-                        string dn = remaining_checks.Dequeue();
-                        foreach (var local_group in DirectoryServiceUtils.FindDomainLocalGroupForMember(Domain, dn))
-                        {
-                            if (members.Add(local_group))
-                            {
-                                context.AddSid(local_group.Sid);
-                                remaining_checks.Enqueue(local_group.DistinguishedName);
-                            }
-                        }
-                    }
+                    context.AddSids(_cached_user_groups.GetOrAdd(Tuple.Create(Domain, sid), _ => GetUserDomainSids(Domain, sid)));
                 }
             }


preselect option when creating dropdown from string list of values

--- FormFactory/Views/Shared/FormFactory/Property.System.String.cshtml
+++ FormFactory/Views/Shared/FormFactory/Property.System.String.cshtml
@@ -11,7 +11,7 @@
     <select name="@Model.Name" id="@Model.Id" class="@(Model.IsWritable ? "" : "disabled")" @(Model.IsWritable ? "" : "disabled=disabled")>
         @foreach (var option in choices)
         {
-            <option value="@option.Item2">@option.Item1</option>
+            <option value="@option.Item2" @(option.Item2 == Model.Value.ToString() ? "selected=selected" : "")>@option.Item1</option>
         }
     </select>
 }


Added onSuccess parameter to DownloadTo

Added onSuccess parameter to DownloadTo

--- JumpKick.HttpLib/JumpKick.HttpLib/Builder/RequestBuilder.Action.cs
+++ JumpKick.HttpLib/JumpKick.HttpLib/Builder/RequestBuilder.Action.cs
@@ -65,6 +65,27 @@
         }

+        public RequestBuilder DownloadTo(String filePath,Action<WebHeaderCollection> onSuccess)
+        {
+#if NETFX_CORE
+            test
+#else
+
+
+            this.success = (headers, result) =>
+            {
+
+
+                FileStream fs = new FileStream(filePath, FileMode.OpenOrCreate);
+                result.CopyTo(fs);
+                fs.Close();
+
+                onSuccess(headers);
+            };
+            return this;
+#endif
+        }
+
         public RequestBuilder AppendTo(String filePath)
         {
             this.success = (headers, result) =>


Some log fixing for the LoadRegionsPlugin

--- OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
+++ OpenSim/ApplicationPlugins/LoadRegions/LoadRegionsPlugin.cs
@@ -49,17 +49,17 @@
     {
         public void Initialise(OpenSimMain openSim)
         {
-            System.Console.WriteLine("Load Regions addin being initialised");
+            MainLog.Instance.Notice("LOADREGIONS", "Load Regions addin being initialised");

             IRegionLoader regionLoader;
             if (openSim.ConfigSource.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem")
             {
-                MainLog.Instance.Notice("Loading Region Info from filesystem");
+                MainLog.Instance.Notice("LOADREGIONS", "Loading Region Info from filesystem");
                 regionLoader = new RegionLoaderFileSystem();
             }
             else
             {
-                MainLog.Instance.Notice("Loading Region Info from web");
+                MainLog.Instance.Notice("LOADREGIONSPLUGIN", "Loading Region Info from web");
                 regionLoader = new RegionLoaderWebServer();
             }

@@ -70,7 +70,7 @@

             for (int i = 0; i < regionsToLoad.Length; i++)
             {
-                MainLog.Instance.Debug("Creating Region: " + regionsToLoad[i].RegionName);
+                MainLog.Instance.Debug("LOADREGIONS", "Creating Region: " + regionsToLoad[i].RegionName);
                 openSim.CreateRegion(regionsToLoad[i]);
             }

@@ -79,17 +79,17 @@
         }
         public void LoadRegionFromConfig(OpenSimMain openSim, ulong regionhandle)
         {
-            System.Console.WriteLine("Load Regions addin being initialised");
+            MainLog.Instance.Notice("LOADREGIONS", "Load Regions addin being initialised");

             IRegionLoader regionLoader;
             if (openSim.ConfigSource.Configs["Startup"].GetString("region_info_source", "filesystem") == "filesystem")
             {
-                MainLog.Instance.Notice("Loading Region Info from filesystem");
+                MainLog.Instance.Notice("LOADREGIONS", "Loading Region Info from filesystem");
                 regionLoader = new RegionLoaderFileSystem();
             }
             else
             {
-                MainLog.Instance.Notice("Loading Region Info from web");
+                MainLog.Instance.Notice("LOADREGIONS", "Loading Region Info from web");
                 regionLoader = new RegionLoaderWebServer();
             }

@@ -99,7 +99,7 @@
             {
                 if (regionhandle == regionsToLoad[i].RegionHandle)
                 {
-                    MainLog.Instance.Debug("Creating Region: " + regionsToLoad[i].RegionName);
+                    MainLog.Instance.Debug("LOADREGIONS", "Creating Region: " + regionsToLoad[i].RegionName);
                     openSim.CreateRegion(regionsToLoad[i]);
                 }
             }


added ability to disable requests to other sims regarding MapItemsRequest via DisableMapItemsRequest = true in [Map]

--- OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
+++ OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs
@@ -80,6 +80,7 @@
         private ThreadedClasses.RwLockedDictionary<ulong, string> m_cachedRegionMapItemsAddress = new ThreadedClasses.RwLockedDictionary<ulong, string>();
         private ThreadedClasses.RwLockedList<UUID> m_rootAgents = new ThreadedClasses.RwLockedList<UUID>();
         private volatile bool threadrunning = false;
+        protected bool m_DisableMapItemsRequest = false;

         private IServiceThrottleModule m_ServiceThrottle;

@@ -96,6 +97,8 @@

             blacklistTimeout
                 = Util.GetConfigVarFromSections<int>(config, "BlacklistTimeout", configSections, 10 * 60) * 1000;
+
+            m_DisableMapItemsRequest = Util.GetConfigVarFromSections<bool>(config, "DisableMapItemsRequest", configSections, false);
         }

         public virtual void AddRegion (Scene scene)
@@ -768,7 +771,7 @@

             blacklisted = m_blacklistedregions.ContainsKey(regionhandle);

-            if (blacklisted)
+            if (blacklisted || m_DisableMapItemsRequest)
                 return new OSDMap();

             UUID requestID = UUID.Random();


Fix prim rezzing from inventory.

Fix prim rezzing from inventory.

--- OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -79,8 +79,8 @@
             set
             {
                 //Set the parent as well so that backup will occur
-                if(value)
-                    m_part.ParentGroup.HasGroupChanged = true;
+                if (value && m_part.ParentGroup != null)
+                     m_part.ParentGroup.HasGroupChanged = true;
                 m_HasInventoryChanged = value;
             }
         }


Remove debugging MenuItem functions.

Remove debugging MenuItem functions.

--- Modules/Build/OverridePlayerSettings/IgorOverridePlayerSettings.cs
+++ Modules/Build/OverridePlayerSettings/IgorOverridePlayerSettings.cs
@@ -171,18 +171,6 @@
             AssetDatabase.Refresh(ImportAssetOptions.ForceSynchronousImport);
 	    }

-	    [MenuItem("Window/ForceSetSteam")]
-	    public static void SetSteam()
-	    {
-	        PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, "STEAM");
-	    }
-
-        [MenuItem("Window/ForceSetEmpty")]
-	    public static void SetEmpty()
-	    {
-	        PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, string.Empty);
-	    }
-
 	    public virtual bool OverridePlayerSettings()
 	    {
 	        string TargetDirectory = IgorJobConfig.GetStringParam(OverridePlayerSettingsFlagFilenameFlag);


Support multiple __thiscall this-ret-args orders

--- MonoMod.RuntimeDetour/Platforms/Runtime/DetourRuntimeILPlatform.cs
+++ MonoMod.RuntimeDetour/Platforms/Runtime/DetourRuntimeILPlatform.cs
@@ -14,20 +14,39 @@
         // Prevent the GC from collecting those.
         protected Dictionary<MethodBase, MethodPin> PinnedMethods = new Dictionary<MethodBase, MethodPin>();

-        private bool GlueThiscallStructRetPtr;
+        private GlueThiscallStructRetPtrOrder GlueThiscallStructRetPtr;

         public DetourRuntimeILPlatform() {
             // Perform a selftest if this runtime requires special handling for instance methods returning structs.
-            // This is documented behavior for coreclr, but can implicitly affect all other runtimes (including mono!) as well.
+            // This is documented behavior for coreclr, but affects other runtimes (i.e. mono) as well!
             // Specifically, this should affect all __thiscalls

-            MethodInfo selftest = typeof(DetourRuntimeILPlatform).GetMethod("_SelftestGetStruct", BindingFlags.NonPublic | BindingFlags.Instance);
-            Pin(selftest);
-            MethodInfo selftestHook = typeof(DetourRuntimeILPlatform).GetMethod("_SelftestGetStructHook", BindingFlags.NonPublic | BindingFlags.Static);
-            Pin(selftestHook);
+            // Use reflection to make sure that the selftest isn't optimized away.
+            // Delegates are quite reliable for this job.
+
+            MethodInfo selftestGetRefPtr = typeof(DetourRuntimeILPlatform).GetMethod("_SelftestGetRefPtr", BindingFlags.NonPublic | BindingFlags.Instance);
+            MethodInfo selftestGetRefPtrHook = typeof(DetourRuntimeILPlatform).GetMethod("_SelftestGetRefPtrHook", BindingFlags.NonPublic | BindingFlags.Static);
+            _HookSelftest(selftestGetRefPtr, selftestGetRefPtrHook);
+
+            IntPtr selfPtr = ((Func<IntPtr>) selftestGetRefPtr.CreateDelegate<Func<IntPtr>>(this))();
+
+            MethodInfo selftestGetStruct = typeof(DetourRuntimeILPlatform).GetMethod("_SelftestGetStruct", BindingFlags.NonPublic | BindingFlags.Instance);
+            MethodInfo selftestGetStructHook = typeof(DetourRuntimeILPlatform).GetMethod("_SelftestGetStructHook", BindingFlags.NonPublic | BindingFlags.Static);
+            _HookSelftest(selftestGetStruct, selftestGetStructHook);
+
+            unsafe {
+                fixed (GlueThiscallStructRetPtrOrder* orderPtr = &GlueThiscallStructRetPtr) {
+                    ((Func<IntPtr, IntPtr, IntPtr, _SelftestStruct>) selftestGetStruct.CreateDelegate<Func<IntPtr, IntPtr, IntPtr, _SelftestStruct>>(this))((IntPtr) orderPtr, (IntPtr) orderPtr, selfPtr);
+                }
+            }
+        }
+
+        private void _HookSelftest(MethodInfo from, MethodInfo to) {
+            Pin(from);
+            Pin(to);
             NativeDetourData detour = DetourHelper.Native.Create(
-                GetNativeStart(selftest),
-                GetNativeStart(selftestHook),
+                GetNativeStart(from),
+                GetNativeStart(to),
                 null
             );
             DetourHelper.Native.MakeWritable(detour);
@@ -36,11 +55,24 @@
             DetourHelper.Native.FlushICache(detour);
             DetourHelper.Native.Free(detour);
             // No need to undo the detour.
-
-            // Use reflection to make sure that the selftest isn't optimized away.
-            // Delegates are quite reliable for this job.
-            ((Func<IntPtr, IntPtr, _SelftestStruct>) selftest.CreateDelegate<Func<IntPtr, IntPtr, _SelftestStruct>>(this))(IntPtr.Zero, IntPtr.Zero);
-        }
+        }
+
+        #region Selftests
+
+        #region Selftest: Get reference ptr
+
+        [MethodImpl(MethodImplOptions.NoInlining)]
+        private IntPtr _SelftestGetRefPtr() {
+            Console.Error.WriteLine("If you're reading this, the MonoMod.RuntimeDetour selftest failed.");
+            throw new Exception("This method should've been detoured!");
+        }
+
+        private static unsafe IntPtr _SelftestGetRefPtrHook(IntPtr self) {
+            // This is only needed to obtain a raw IntPtr to a reference object.
+            return self;
+        }
+
+        #endregion

         #region Selftest: Struct

@@ -50,19 +82,32 @@
         }

         [MethodImpl(MethodImplOptions.NoInlining)]
-        private _SelftestStruct _SelftestGetStruct(IntPtr x, IntPtr y) {
+        private _SelftestStruct _SelftestGetStruct(IntPtr x, IntPtr y, IntPtr thisPtr) {
             Console.Error.WriteLine("If you're reading this, the MonoMod.RuntimeDetour selftest failed.");
             throw new Exception("This method should've been detoured!");
         }

-        private static unsafe void _SelftestGetStructHook(DetourRuntimeILPlatform self, IntPtr a, IntPtr b, IntPtr c) {
-            // Normally, self = this, a = x, b = y
-            // For coreclr x64 __thiscall, self = this, a = __ret, b = x, c = y
-
-            // For the selftest, x must be equal to y.
-            // If a != b, a is probably pointing to the return buffer.
-            self.GlueThiscallStructRetPtr = a != b;
-        }
+        private static unsafe void _SelftestGetStructHook(IntPtr a, IntPtr b, IntPtr c, IntPtr d, IntPtr e) {
+            // Normally, a = this, b = x, c = y, d = thisPtr, e = garbage
+
+            // For the general selftest, x must be equal to y.
+            // If b != c, b is probably pointing to the return buffer or this.
+            if (b == c) {
+                // Original order.
+                *((GlueThiscallStructRetPtrOrder*) b) = GlueThiscallStructRetPtrOrder.Original;
+
+            } else if (b == e) {
+                // For mono in Unity 5.6.X, a = __ret, b = this, c = x, d = y, e = thisPtr
+                *((GlueThiscallStructRetPtrOrder*) c) = GlueThiscallStructRetPtrOrder.RetThisArgs;
+
+            } else {
+                // For coreclr x64 __thiscall, a = this, b = __ret, c = x, d = y, e = thisPtr
+                *((GlueThiscallStructRetPtrOrder*) c) = GlueThiscallStructRetPtrOrder.ThisRetArgs;
+
+            }
+        }
+
+        #endregion

         #endregion

@@ -148,7 +193,7 @@

             MethodInfo dm = null;

-            if (GlueThiscallStructRetPtr &&
+            if (GlueThiscallStructRetPtr != GlueThiscallStructRetPtrOrder.Original &&
                 fromInfo != null && !from.IsStatic &&
                 toInfo != null && to.IsStatic &&
                 fromInfo.ReturnType == toInfo.ReturnType &&
@@ -156,10 +201,22 @@

                 int size = fromInfo.ReturnType.GetManagedSize();
                 if (size == 3 || size == 5 || size == 6 || size == 7 || size >= 9) {
+                    Type thisType = from.GetThisParamType();
+                    Type retType = fromInfo.ReturnType.MakeByRefType(); // Refs are shiny pointers.
+
+                    int thisPos = 0;
+                    int retPos = 1;
+
+                    if (GlueThiscallStructRetPtr == GlueThiscallStructRetPtrOrder.RetThisArgs) {
+                        thisPos = 1;
+                        retPos = 0;
+                    }
+
                     List<Type> argTypes = new List<Type> {
-                        from.GetThisParamType(), // this
-                        fromInfo.ReturnType.MakeByRefType() // __ret - Refs are shiny pointers.
+                        thisType
                     };
+                    argTypes.Insert(retPos, retType);
+
                     argTypes.AddRange(from.GetParameters().Select(p => p.ParameterType));

                     using (DynamicMethodDefinition dmd = new DynamicMethodDefinition(
@@ -169,11 +226,11 @@
                         ILProcessor il = dmd.GetILProcessor();

                         // Load the return buffer address.
-                        il.Emit(OpCodes.Ldarg, 1);
+                        il.Emit(OpCodes.Ldarg, retPos);

                         // Invoke the target method with all remaining arguments.
                         {
-                            il.Emit(OpCodes.Ldarg, 0);
+                            il.Emit(OpCodes.Ldarg, thisPos);
                             for (int i = 2; i < argTypes.Count; i++)
                                 il.Emit(OpCodes.Ldarg, i);
                             il.Emit(OpCodes.Call, (MethodInfo) to);
@@ -195,5 +252,11 @@
             public int Count;
             public RuntimeMethodHandle Handle;
         }
+
+        private enum GlueThiscallStructRetPtrOrder {
+            Original,
+            ThisRetArgs,
+            RetThisArgs
+        }
     }
 }


Fixed long standing problem with reading in meshes created with latest Ogre exporters, was missing the read of one new attribute which threw off reading additional submeshes.

git-svn-id: 53f2a8ff3606f182ef4420064c1f4a5cdcbe6bb1@166 bb9bf1cf-960d-0410-9a3a-baeba60cf407

--- Axiom/Engine/Serialization/OgreMeshReader.cs
+++ Axiom/Engine/Serialization/OgreMeshReader.cs
@@ -241,6 +241,11 @@

             // add the assignment to the mesh
             subMesh.AddBoneAssignment(ref assignment);
+        }
+
+        public void ReadSubMeshOperation(SubMesh subMesh) {
+            short op = ReadInt16();
+            subMesh.operationType = (RenderMode)op;
         }

         public void ReadSubMesh() {
@@ -318,10 +323,15 @@
             chunkID = ReadChunk();

             // walk through all the bone assignments for this submesh
-            while(chunkID == MeshChunkID.SubMeshBoneAssignment) {
+            while(chunkID == MeshChunkID.SubMeshBoneAssignment ||
+                      chunkID == MeshChunkID.SubMeshOperation) {
                 switch(chunkID) {
                     case MeshChunkID.SubMeshBoneAssignment:
                         ReadSubMeshBoneAssignment(subMesh);
+                        break;
+
+                    case MeshChunkID.SubMeshOperation:
+                        ReadSubMeshOperation(subMesh);
                         break;
                 }

@@ -674,7 +684,8 @@
     public enum MeshChunkID : ushort {
         Header                                    = 0x1000,
         Mesh                                       = 0x3000,
-        SubMesh                                = 0x4000,
+        SubMesh                                = 0x4000,
+        SubMeshOperation               = 0x4010,
         SubMeshBoneAssignment    = 0x4100,
         Geometry                                = 0x5000,
         GeometryNormals                  = 0x5100,    //(Optional)


add payjoin tooltip

add payjoin tooltip

--- BTCPayServer/Views/Stores/UpdateStore.cshtml
+++ BTCPayServer/Views/Stores/UpdateStore.cshtml
@@ -85,6 +85,7 @@

                     <input asp-for="PayJoinEnabled" type="checkbox" class="form-check-input"/>

+


Adjust labels in Custom Fonts ExampleGallery demo.

--- tests/ExampleGallery/Shared/CustomFonts.xaml.cs
+++ tests/ExampleGallery/Shared/CustomFonts.xaml.cs
@@ -161,7 +161,7 @@
         {
             new Entry(0xE018, "Scrollbar arrow"),
             new Entry(0xE019, "Scrollbar arrow"),
-            new Entry(0xE081, "Check box component"),
+            new Entry(0xE081, "Check box"),
             new Entry(0xE082, "Ratings star"),
             new Entry(0xE094, "Magnifier"),
             new Entry(0xE0B8, "Used by magnifier tool"),
@@ -218,7 +218,7 @@
             new Entry(0xE114, "Camera"),
             new Entry(0xE182, "Options"),
             new Entry(0xE115, "Settings"),
-            new Entry(0xE183, "SkyDrive"),
+            new Entry(0xE183, "Upload"),
             new Entry(0xE116, "Video"),
             new Entry(0xE184, "Calendar"),
             new Entry(0xE117, "Sync"),


Displaying quest image.

Displaying quest image.

--- unity/Assets/Scripts/UI/Screens/QuestDetailsScreen.cs
+++ unity/Assets/Scripts/UI/Screens/QuestDetailsScreen.cs
@@ -1,6 +1,7 @@
 using UnityEngine;
 using System.Collections.Generic;
 using Assets.Scripts.Content;
+using System.IO;

 namespace Assets.Scripts.UI.Screens
 {
@@ -22,22 +23,37 @@
             db.textObj.GetComponent<UnityEngine.UI.Text>().fontSize = UIScaler.GetLargeFont();
             db.SetFont(game.gameType.GetHeaderFont());

+            // Draw Image
+            if (q.image.Length > 0)
+            {
+                Texture2D tex = ContentData.FileToTexture(Path.Combine(q.path, q.image));
+                Sprite sprite = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), Vector2.zero, 1);
+
+                db = new DialogBox(new Vector2(UIScaler.GetHCenter(-20), 4),
+                    new Vector2(8, 8),
+                    StringKey.NULL,
+                    Color.white,
+                    Color.white);
+                db.background.GetComponent<UnityEngine.UI.Image>().sprite = sprite;
+                db.AddBorder();
+            }
+
             // Draw Description
-            db = new DialogBox(Vector2.zero, new Vector2(33, 30), q.description);
+            db = new DialogBox(Vector2.zero, new Vector2(30, 30), q.description);
             float height = (db.textObj.GetComponent<UnityEngine.UI.Text>().preferredHeight / UIScaler.GetPixelsPerUnit()) + 1;
             db.Destroy();
             if (height > 25) height = 25;

-            db = new DialogBox(new Vector2(UIScaler.GetHCenter(-23), 15 - (height / 2)), new Vector2(33, height), q.description);
+            db = new DialogBox(new Vector2(UIScaler.GetHCenter(-7), 15 - (height / 2)), new Vector2(30, height), q.description);
             db.AddBorder();

             // Draw authors
-            db = new DialogBox(Vector2.zero, new Vector2(12, 30), q.authors);
+            db = new DialogBox(Vector2.zero, new Vector2(14, 30), q.authors);
             height = (db.textObj.GetComponent<UnityEngine.UI.Text>().preferredHeight / UIScaler.GetPixelsPerUnit()) + 1;
             db.Destroy();
             if (height > 25) height = 25;

-            db = new DialogBox(new Vector2(UIScaler.GetHCenter(11), 15 - (height / 2)), new Vector2(12, height), q.authors);
+            db = new DialogBox(new Vector2(UIScaler.GetHCenter(-23), 18.5f - (height / 2)), new Vector2(14, height), q.authors);
             db.AddBorder();

             // Difficulty


unity: fix null pointer exception

unity: fix null pointer exception

--- unity/library/UtyMap.Unity/Maps/Data/MapDataLoader.cs
+++ unity/library/UtyMap.Unity/Maps/Data/MapDataLoader.cs
@@ -32,7 +32,7 @@
     /// <summary> Default implementation of tile loader. </summary>
     internal class MapDataLoader : IMapDataLoader, IDisposable, IConfigurable
     {
-        private readonly object _lockGuard;
+        private readonly object _lockGuard = new object();

         private const string TraceCategory = "mapdata.loader";


Use existing file encoding if provided override is invalid

--- source/Calamari/Integration/Substitutions/FileSubstituter.cs
+++ source/Calamari/Integration/Substitutions/FileSubstituter.cs
@@ -43,7 +43,7 @@
             }
             catch (ArgumentException)
             {
-                return Encoding.GetEncoding(sourceFile);
+                return fileSystem.GetFileEncoding(sourceFile);
             }

         }


Work around for EF 3 not allowing client side eval

--- Battery-Commander.Web/Queries/GetSoldiers.cs
+++ Battery-Commander.Web/Queries/GetSoldiers.cs
@@ -90,29 +90,29 @@

                 if (query.ABCP.HasValue)
                 {
-                    soldiers = soldiers.Where(_ => _.AbcpStatus == query.ABCP);
+                    soldiers = soldiers.AsEnumerable().Where(_ => _.AbcpStatus == query.ABCP).AsQueryable();
                 }

                 if (query.APFT.HasValue)
                 {
-                    soldiers = soldiers.Where(_ => _.ApftStatus == query.APFT);
+                    soldiers = soldiers.AsEnumerable().Where(_ => _.ApftStatus == query.APFT).AsQueryable();
                 }

                 if (query.SSD.HasValue)
                 {
                     if (query.SSD == true)
                     {
-                        soldiers = soldiers.Where(_ => _.SSDStatus.CurrentProgress >= Decimal.One);
+                        soldiers = soldiers.AsEnumerable().Where(_ => _.SSDStatus.CurrentProgress >= Decimal.One).AsQueryable();
                     }
                     else
                     {
-                        soldiers = soldiers.Where(_ => _.SSDStatus.CurrentProgress < Decimal.One);
+                        soldiers = soldiers.AsEnumerable().Where(_ => _.SSDStatus.CurrentProgress < Decimal.One).AsQueryable();
                     }
                 }

                 if (query.DSCA.HasValue)
                 {
-                    soldiers = soldiers.Where(_ => _.DscaQualified == query.DSCA);
+                    soldiers = soldiers.AsEnumerable().Where(_ => _.DscaQualified == query.DSCA).AsQueryable();
                 }

                 if (query.Gender.HasValue)
@@ -122,17 +122,17 @@

                 if (query.IWQ.HasValue)
                 {
-                    soldiers = soldiers.Where(_ => _.IwqQualified == query.IWQ);
+                    soldiers = soldiers.AsEnumerable().Where(_ => _.IwqQualified == query.IWQ).AsQueryable();
                 }

                 if (query.EducationComplete.HasValue)
                 {
-                    soldiers = soldiers.Where(_ => _.IsEducationComplete == query.EducationComplete);
+                    soldiers = soldiers.AsEnumerable().Where(_ => _.IsEducationComplete == query.EducationComplete).AsQueryable();
                 }

                 if (query.CLS.HasValue)
                 {
-                    soldiers = soldiers.Where(_ => _.ClsQualified == query.CLS);
+                    soldiers = soldiers.AsEnumerable().Where(_ => _.ClsQualified == query.CLS).AsQueryable();
                 }

                 if (query.Status.HasValue)
@@ -145,7 +145,7 @@
                     soldiers = soldiers.Where(soldier => soldier.CivilianEmail.ToUpper() == query.Email.ToUpper() || soldier.MilitaryEmail.ToUpper() == query.Email.ToUpper());
                 }

-                return soldiers;
+                return soldiers.ToList();
             }
         }
     }