a small correction related to that reference counting stuff

--- OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs
+++ OpenSim/Region/Physics/BulletSPlugin/BSShapes.cs
@@ -40,7 +40,7 @@
 {
     private static string LogHeader = "[BULLETSIM SHAPE]";

-    public int referenceCount { get; set; }
+    public int referenceCount;
     public DateTime lastReferenced { get; set; }
     public BulletShape physShapeInfo { get; set; }

@@ -52,7 +52,7 @@
     }
     public BSShape(BulletShape pShape)
     {
-        referenceCount = 1;
+        Interlocked.Increment(ref referenceCount);
         lastReferenced = DateTime.Now;
         physShapeInfo = pShape;
     }
@@ -65,14 +65,14 @@
     //       the shape.
     protected virtual void IncrementReference()
     {
-        referenceCount++;
+        Interlocked.Increment(ref referenceCount);
         lastReferenced = DateTime.Now;
     }

     // Called when this shape is done being used.
     protected virtual void DecrementReference()
     {
-        referenceCount--;
+        Interlocked.Decrement(ref referenceCount);
         lastReferenced = DateTime.Now;
     }

@@ -394,22 +394,22 @@

                 // Check to see if mesh was created (might require an asset).
                 newShape = VerifyMeshCreated(physicsScene, newShape, prim);
-                if (!newShape.isNativeShape
-                            || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedMeshing
-                            || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedAssetFetch)
-                {
-                    // If a mesh was what was created, remember the built shape for later sharing.
-                    // Also note that if meshing failed we put it in the mesh list as there is nothing else to do about the mesh.
-                    Meshes.Add(newMeshKey, retMesh);
-                }
-
-                retMesh.physShapeInfo = newShape;
-            }
-        }
-        finally
-        {
+                        if (!newShape.isNativeShape
+                                    || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedMeshing
+                                    || prim.PrimAssetState == BSPhysObject.PrimAssetCondition.FailedAssetFetch)
+                        {
+                            // If a mesh was what was created, remember the built shape for later sharing.
+                            // Also note that if meshing failed we put it in the mesh list as there is nothing else to do about the mesh.
+                            Meshes.Add(newMeshKey, retMesh);
+                        }
+
+                        retMesh.physShapeInfo = newShape;
+                    }
+                }
+                finally
+                {
             MeshesRwLock.ReleaseWriterLock();
-        }
+                }
         physicsScene.DetailLog("{0},BSShapeMesh,getReference,mesh={1},size={2},lod={3}", prim.LocalID, retMesh, prim.Size, lod);
         return retMesh;
     }


* Added Avatar minimum size in the ODEPlugin and a stern warning about setting the capsule size too low in OpenSim.ini

--- OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -419,8 +419,23 @@
         // place that is safe to call this routine AvatarGeomAndBodyCreation.
         private void AvatarGeomAndBodyCreation(float npositionX, float npositionY, float npositionZ, float tensor)
         {
+            //CAPSULE_LENGTH = -5;
+            //CAPSULE_RADIUS = -5;
             int dAMotorEuler = 1;
             _parent_scene.waitForSpaceUnlock(_parent_scene.space);
+            if (CAPSULE_LENGTH <= 0)
+            {
+                m_log.Warn("[PHYSICS]: The capsule size you specified in opensim.ini is invalid!  Setting it to the smallest possible size!");
+                CAPSULE_LENGTH = 0.01f;
+
+            }
+
+            if (CAPSULE_RADIUS <= 0)
+            {
+                m_log.Warn("[PHYSICS]: The capsule size you specified in opensim.ini is invalid!  Setting it to the smallest possible size!");
+                CAPSULE_RADIUS = 0.01f;
+
+            }
             Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH);

             d.GeomSetCategoryBits(Shell, (int)m_collisionCategories);


Add legacy mapping support

Add legacy mapping support

--- OpenUtau.Plugin.Builtin/KoreanCVCCVPhonemizer.cs
+++ OpenUtau.Plugin.Builtin/KoreanCVCCVPhonemizer.cs
@@ -199,6 +199,9 @@
         private USinger singer;
         public override void SetSinger(USinger singer) => this.singer = singer;

+        // Legacy mapping. Might adjust later to new mapping style.
+		public override bool LegacyMapping => true;
+
         public override Result Process(Note[] notes, Note? prev, Note? next, Note? prevNeighbour, Note? nextNeighbour, Note[] prevs) {
             var prevLyric = prevNeighbour?.lyric;
             var nextLyric = nextNeighbour?.lyric;


Add comments

Add comments

--- PA.Utilities.InnoSetupTask/PreprocessFileList.cs
+++ PA.Utilities.InnoSetupTask/PreprocessFileList.cs
@@ -33,7 +33,7 @@
             }
             catch (Exception exception)
             {
-                logger.LogError("Error occurred: " + exception);
+                logger.LogError("Error occurred: " + exception +" at line " + exception.Source );
                 return false;
             }
             finally


Reordered #define constants to match the C++ headers

--- Plugins/Steamworks.NET/autogen/SteamConstants.cs
+++ Plugins/Steamworks.NET/autogen/SteamConstants.cs
@@ -170,42 +170,39 @@
 		public const uint k_uPhysicalItemIdInvalid = 0x0;
 		public const uint k_uCellIDInvalid = 0xFFFFFFFF;
 		public const uint k_uPartnerIdInvalid = 0;
-		public const short MASTERSERVERUPDATERPORT_USEGAMESOCKETSHARE = -1;
+		public const int MAX_STEAM_CONTROLLERS = 16;
+		public const int STEAM_RIGHT_TRIGGER_MASK            = 0x0000001;
+		public const int STEAM_LEFT_TRIGGER_MASK             = 0x0000002;
+		public const int STEAM_RIGHT_BUMPER_MASK             = 0x0000004;
+		public const int STEAM_LEFT_BUMPER_MASK              = 0x0000008;
+		public const int STEAM_BUTTON_0_MASK                 = 0x0000010;
+		public const int STEAM_BUTTON_1_MASK                 = 0x0000020;
+		public const int STEAM_BUTTON_2_MASK                 = 0x0000040;
+		public const int STEAM_BUTTON_3_MASK                 = 0x0000080;
+		public const int STEAM_TOUCH_0_MASK                  = 0x0000100;
+		public const int STEAM_TOUCH_1_MASK                  = 0x0000200;
+		public const int STEAM_TOUCH_2_MASK                  = 0x0000400;
+		public const int STEAM_TOUCH_3_MASK                  = 0x0000800;
+		public const int STEAM_BUTTON_MENU_MASK              = 0x0001000;
+		public const int STEAM_BUTTON_STEAM_MASK             = 0x0002000;
+		public const int STEAM_BUTTON_ESCAPE_MASK            = 0x0004000;
+		public const int STEAM_BUTTON_BACK_LEFT_MASK         = 0x0008000;
+		public const int STEAM_BUTTON_BACK_RIGHT_MASK        = 0x0010000;
+		public const int STEAM_BUTTON_LEFTPAD_CLICKED_MASK   = 0x0020000;
+		public const int STEAM_BUTTON_RIGHTPAD_CLICKED_MASK  = 0x0040000;
+		public const int STEAM_LEFTPAD_FINGERDOWN_MASK       = 0x0080000;
+		public const int STEAM_RIGHTPAD_FINGERDOWN_MASK      = 0x0100000;
+		public const int STEAM_JOYSTICK_BUTTON_MASK			= 0x0400000;
+		public const short MASTERSERVERUPDATERPORT_USEGAMESOCKETSHARE	= -1;
 		public const byte INVALID_HTTPREQUEST_HANDLE = 0;
-
 		// maximum number of characters a lobby metadata key can be
 		public const byte k_nMaxLobbyKeyLength = 255;
-
 		public const int k_SteamMusicNameMaxLength = 255;
 		public const int k_SteamMusicPNGMaxLength = 65535;
-
 		//-----------------------------------------------------------------------------
 		// Constants used for query ports.
 		//-----------------------------------------------------------------------------
-		public const int QUERY_PORT_NOT_INITIALIZED =   0xFFFF;  // We haven't asked the GS for this query port's actual value yet.
-		public const int QUERY_PORT_ERROR =             0xFFFE;  // We were unable to get the query port for this server.
-
-		public const int STEAM_RIGHT_TRIGGER_MASK           = 0x0000001;
-		public const int STEAM_LEFT_TRIGGER_MASK            = 0x0000002;
-		public const int STEAM_RIGHT_BUMPER_MASK            = 0x0000004;
-		public const int STEAM_LEFT_BUMPER_MASK             = 0x0000008;
-		public const int STEAM_BUTTON_0_MASK                = 0x0000010;
-		public const int STEAM_BUTTON_1_MASK                = 0x0000020;
-		public const int STEAM_BUTTON_2_MASK                = 0x0000040;
-		public const int STEAM_BUTTON_3_MASK                = 0x0000080;
-		public const int STEAM_TOUCH_0_MASK                 = 0x0000100;
-		public const int STEAM_TOUCH_1_MASK                 = 0x0000200;
-		public const int STEAM_TOUCH_2_MASK                 = 0x0000400;
-		public const int STEAM_TOUCH_3_MASK                 = 0x0000800;
-		public const int STEAM_BUTTON_MENU_MASK             = 0x0001000;
-		public const int STEAM_BUTTON_STEAM_MASK            = 0x0002000;
-		public const int STEAM_BUTTON_ESCAPE_MASK           = 0x0004000;
-		public const int STEAM_BUTTON_BACK_LEFT_MASK        = 0x0008000;
-		public const int STEAM_BUTTON_BACK_RIGHT_MASK       = 0x0010000;
-		public const int STEAM_BUTTON_LEFTPAD_CLICKED_MASK  = 0x0020000;
-		public const int STEAM_BUTTON_RIGHTPAD_CLICKED_MASK = 0x0040000;
-		public const int STEAM_LEFTPAD_FINGERDOWN_MASK      = 0x0080000;
-		public const int STEAM_RIGHTPAD_FINGERDOWN_MASK     = 0x0100000;
-		public const int STEAM_JOYSTICK_BUTTON_MASK         = 0x0400000;
+		public const int QUERY_PORT_NOT_INITIALIZED		= 0xFFFF; // We haven't asked the GS for this query port's actual value yet.
+		public const int QUERY_PORT_ERROR				= 0xFFFE; // We were unable to get the query port for this server.
 	}
 }


Fixes #2639 Too many requests to pypi.org Stops making parallel requests for the same package Stops making repeated requests for package info when it likely has not changed

--- Python/Product/VSInterpreters/PipPackageCache.cs
+++ Python/Product/VSInterpreters/PipPackageCache.cs
@@ -43,6 +43,11 @@
         protected readonly Dictionary<string, PackageSpec> _cache;
         protected DateTime _cacheAge;

+        // The live cache contains names of package specs that are fully up to date
+        // in the cache.
+        protected readonly HashSet<string> _liveCache;
+        protected DateTime _liveCacheAge;
+
         protected int _userCount; // protected by _knownCachesLock
         private long _writeVersion;

@@ -54,9 +59,8 @@
             TimeSpan.FromSeconds(1.0)
         );

-        // When files return 404 from PyPI, we put them in here to avoid trying
-        // to request them again.
-        private static HashSet<string> NotOnPyPI = new HashSet<string>();
+        // Don't make multiple requests for the same package
+        private readonly Dictionary<string, TaskCompletionSource<PackageSpec>> _activeRequests = new Dictionary<string, TaskCompletionSource<PackageSpec>>();

         // These constants are substituted where necessary, but are not stored
         // in instance variables so we can differentiate between set and unset.
@@ -65,6 +69,9 @@
         private const string DefaultIndexName = "PyPI";

         private const string UserAgent = "PythonToolsForVisualStudio/" + AssemblyVersionInfo.Version;
+
+        private static readonly TimeSpan CacheAgeLimit = TimeSpan.FromHours(6);
+        private static readonly TimeSpan LiveCacheAgeLimit = TimeSpan.FromHours(1);

         protected PipPackageCache(
             Uri index,
@@ -75,6 +82,8 @@
             _indexName = indexName;
             _cachePath = cachePath;
             _cache = new Dictionary<string, PackageSpec>();
+            _liveCacheAge = DateTime.UtcNow;
+            _liveCache = new HashSet<string>();
         }

         public static PipPackageCache GetCache(Uri index = null, string indexName = null) {
@@ -143,8 +152,12 @@
                         _cacheAge = DateTime.MinValue;
                     }
                 }
-                if (_cacheAge.AddHours(6) < DateTime.Now) {
+                if (_cacheAge + CacheAgeLimit < DateTime.UtcNow) {
                     await RefreshCacheAsync(cancel).ConfigureAwait(false);
+                    lock (_liveCache) {
+                        _liveCache.Clear();
+                        _liveCacheAge = DateTime.UtcNow;
+                    }
                 }

                 return _cache.Values.Select(p => p.Clone()).ToList();
@@ -177,102 +190,155 @@
             return false;
         }

+        private bool IsInLiveCache(string name) {
+            lock (_liveCache) {
+                if (_liveCacheAge + LiveCacheAgeLimit < DateTime.UtcNow) {
+                    _liveCache.Clear();
+                    _liveCacheAge = DateTime.UtcNow;
+                    return false;
+                } else {
+                    return _liveCache.Contains(name);
+                }
+            }
+        }
+
+        private void AddToLiveCache(string name) {
+            lock (_liveCache) {
+                if (_liveCacheAge + LiveCacheAgeLimit < DateTime.UtcNow) {
+                    _liveCache.Clear();
+                    _liveCacheAge = DateTime.UtcNow;
+                }
+                _liveCache.Add(name);
+            }
+        }
+
         public async Task<PackageSpec> GetPackageInfoAsync(PackageSpec entry, CancellationToken cancel) {
             string description = null;
             List<string> versions = null;

-            lock (NotOnPyPI) {
-                if (NotOnPyPI.Contains(entry.Name)) {
-                    return new PackageSpec();
-                }
-            }
-
-            using (var client = new WebClient()) {
-                Stream data;
-                client.Headers[HttpRequestHeader.UserAgent] = UserAgent;
-                try {
-                    data = await client.OpenReadTaskAsync(new Uri(Index, entry.Name + "/json"))
-                        .ConfigureAwait(false);
-                } catch (WebException ex) {
-                    if ((ex.Response as HttpWebResponse)?.StatusCode == HttpStatusCode.NotFound) {
-                        lock (NotOnPyPI) {
-                            NotOnPyPI.Add(entry.Name);
+            bool useCache = IsInLiveCache(entry.Name);
+
+            if (useCache) {
+                using (await _cacheLock.LockAsync(cancel)) {
+                    PackageSpec result;
+                    if (_cache.TryGetValue(entry.Name, out result)) {
+                        return result.Clone();
+                    } else {
+                        return new PackageSpec();
+                    }
+                }
+            }
+
+            TaskCompletionSource<PackageSpec> tcs = null;
+            Task<PackageSpec> t = null;
+            lock (_activeRequests) {
+                if (_activeRequests.TryGetValue(entry.Name, out tcs)) {
+                    t = tcs.Task;
+                } else {
+                    _activeRequests[entry.Name] = tcs = new TaskCompletionSource<PackageSpec>();
+                }
+            }
+
+            if (t != null) {
+                return (await t).Clone();
+            }
+
+            try {
+                using (var client = new WebClient()) {
+                    Stream data;
+                    client.Headers[HttpRequestHeader.UserAgent] = UserAgent;
+                    try {
+                        data = await client.OpenReadTaskAsync(new Uri(Index, entry.Name + "/json"))
+                            .ConfigureAwait(false);
+                    } catch (WebException) {
+                        // No net access or no such package
+                        AddToLiveCache(entry.Name);
+                        return new PackageSpec();
+                    }
+
+                    try {
+                        using (var reader = JsonReaderWriterFactory.CreateJsonReader(data, new XmlDictionaryReaderQuotas())) {
+                            var doc = XDocument.Load(reader);
+
+                            // TODO: Get package URL
+                            //url = (string)doc.Document
+                            //    .Elements("root")
+                            //    .Elements("info")
+                            //    .Elements("package_url")
+                            //    .FirstOrDefault();
+
+                            description = (string)doc.Document
+                                .Elements("root")
+                                .Elements("info")
+                                .Elements("description")
+                                .FirstOrDefault();
+
+                            versions = doc.Document
+                                .Elements("root")
+                                .Elements("releases")
+                                .Elements()
+                                .Attributes("item")
+                                .Select(a => a.Value)
+                                .ToList();
                         }
-                    }
-
-                    // No net access or no such package
-                    return new PackageSpec();
-                }
-
-                try {
-                    using (var reader = JsonReaderWriterFactory.CreateJsonReader(data, new XmlDictionaryReaderQuotas())) {
-                        var doc = XDocument.Load(reader);
-
-                        // TODO: Get package URL
-                        //url = (string)doc.Document
-                        //    .Elements("root")
-                        //    .Elements("info")
-                        //    .Elements("package_url")
-                        //    .FirstOrDefault();
-
-                        description = (string)doc.Document
-                            .Elements("root")
-                            .Elements("info")
-                            .Elements("description")
+                    } catch (InvalidOperationException) {
+                    }
+                }
+
+                bool changed = false;
+                PackageSpec result;
+
+                using (await _cacheLock.LockAsync(cancel)) {
+                    if (!_cache.TryGetValue(entry.Name, out result)) {
+                        result = _cache[entry.Name] = new PackageSpec(entry.Name);
+                    }
+
+                    if (!string.IsNullOrEmpty(description)) {
+                        var lines = description.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
+                        var firstLine = string.Join(
+                            " ",
+                            lines.TakeWhile(s => !IsSeparatorLine(s)).Select(s => s.Trim())
+                        );
+                        if (firstLine.Length > 500) {
+                            firstLine = firstLine.Substring(0, 497) + "...";
+                        }
+                        if (firstLine == "UNKNOWN") {
+                            firstLine = string.Empty;
+                        }
+
+                        result.Description = firstLine;
+                        changed = true;
+                    }
+
+                    if (versions != null) {
+                        var updateVersion = PackageVersion.TryParseAll(versions)
+                            .Where(v => v.IsFinalRelease)
+                            .OrderByDescending(v => v)
                             .FirstOrDefault();
-
-                        versions = doc.Document
-                            .Elements("root")
-                            .Elements("releases")
-                            .Elements()
-                            .Attributes("item")
-                            .Select(a => a.Value)
-                            .ToList();
-                    }
-                } catch (InvalidOperationException) {
-                }
-            }
-
-            bool changed = false;
-            PackageSpec result;
-
-            using (await _cacheLock.LockAsync(cancel)) {
-                if (!_cache.TryGetValue(entry.Name, out result)) {
-                    result = _cache[entry.Name] = new PackageSpec(entry.Name);
-                }
-
-                if (!string.IsNullOrEmpty(description)) {
-                    var lines = description.Split(new[] { "\r\n", "\r", "\n" }, StringSplitOptions.None);
-                    var firstLine = string.Join(
-                        " ",
-                        lines.TakeWhile(s => !IsSeparatorLine(s)).Select(s => s.Trim())
-                    );
-                    if (firstLine.Length > 500) {
-                        firstLine = firstLine.Substring(0, 497) + "...";
-                    }
-                    if (firstLine == "UNKNOWN") {
-                        firstLine = string.Empty;
-                    }
-
-                    result.Description = firstLine;
-                    changed = true;
-                }
-
-                if (versions != null) {
-                    var updateVersion = PackageVersion.TryParseAll(versions)
-                        .Where(v => v.IsFinalRelease)
-                        .OrderByDescending(v => v)
-                        .FirstOrDefault();
-                    result.ExactVersion = updateVersion;
-                    changed = true;
-                }
-            }
-
-            if (changed) {
-                TriggerWriteCacheToDisk();
-            }
-
-            return result.Clone();
+                        result.ExactVersion = updateVersion;
+                        changed = true;
+                    }
+                }
+
+                if (changed) {
+                    TriggerWriteCacheToDisk();
+                    AddToLiveCache(entry.Name);
+                }
+
+                var r = result.Clone();
+
+                // Inform other waiters that we have completed
+                tcs.TrySetResult(r);
+
+                return r;
+            } catch (Exception ex) {
+                tcs.TrySetException(ex);
+                throw;
+            } finally {
+                lock (_activeRequests) {
+                    _activeRequests.Remove(entry.Name);
+                }
+            }
         }

         #region Cache File Management
@@ -352,7 +418,7 @@
                 TriggerWriteCacheToDisk();
             }

-            _cacheAge = DateTime.Now;
+            _cacheAge = DateTime.UtcNow;
         }

         private async void TriggerWriteCacheToDisk() {
@@ -404,7 +470,7 @@
         protected async Task ReadCacheFromDiskAsync(CancellationToken cancel) {
             Debug.Assert(_cacheLock.CurrentCount == 0, "Cache must be locked before calling ReadCacheFromDiskAsync");

-            var newCacheAge = DateTime.Now;
+            var newCacheAge = DateTime.UtcNow;
             var newCache = new Dictionary<string, PackageSpec>();
             using (await LockFile(_cachePath + ".lock", cancel).ConfigureAwait(false))
             using (var file = new StreamReader(_cachePath, Encoding.UTF8)) {


More tests need modification

More tests need modification

You would think I would check these things.

--- RandomTestValues.Tests/RandomValueObjectTests.cs
+++ RandomTestValues.Tests/RandomValueObjectTests.cs
@@ -161,23 +161,23 @@
             result.RecursiveProperty2.RecursiveProperty2.Int.ShouldNotBeDefault();
         }

-        //[TestMethod]
-        //public void RandomObjectWithRecursiveListWillGenerateChildObjectsToTheSpecifiedDepth()
-        //{
-        //    var result = RandomValue.Object<ObjectWithRecursiveCollections>(recursiveDepth: 2);
-
-        //    // 1 level depth
-        //    result.RecursiveList.ShouldNotBeDefault();
-        //    result.Int.ShouldNotBeDefault();
-
-        //    // 2 level depth
-        //    result.RecursiveList[0].RecursiveList.ShouldNotBeDefault();
-        //    result.RecursiveList[0].Int.ShouldNotBeDefault();
-
-        //    // 3 level depth (should now be null as recursiveDepth:2)
-        //    result.RecursiveList[0].RecursiveList[0].RecursiveList.ShouldEqual(null);
-        //    result.RecursiveList[0].RecursiveList[0].Int.ShouldNotBeDefault();
-        //}
+        [TestMethod]
+        public void RandomObjectWithRecursiveListWillGenerateChildObjectsToTheSpecifiedDepth()
+        {
+            var result = RandomValue.Object<ObjectWithRecursiveCollections>(recursiveDepth: 2);
+
+            // 1 level depth
+            result.RecursiveList.ShouldNotBeDefault();
+            result.Int.ShouldNotBeDefault();
+
+            // 2 level depth
+            result.RecursiveList[0].RecursiveList.ShouldNotBeDefault();
+            result.RecursiveList[0].Int.ShouldNotBeDefault();
+
+            // 3 level depth (should now be null as recursiveDepth:2)
+            result.RecursiveList[0].RecursiveList[0].RecursiveList.ShouldEqual(null);
+            result.RecursiveList[0].RecursiveList[0].Int.ShouldNotBeDefault();
+        }

         [TestMethod]
         public void RandomObjectWithRecursivePropertyWillGenerateChildObjectsToTheSpecifiedDepthWithSettings()
@@ -199,23 +199,23 @@
             result.RecursiveProperty2.RecursiveProperty2.Int.ShouldNotBeDefault();
         }

-        //[TestMethod]
-        //public void RandomObjectWithRecursiveListWillGenerateChildObjectsToTheSpecifiedDepthWithSettings()
-        //{
-        //    var result = RandomValue.Object<ObjectWithRecursiveCollections>(new RandomValueSettings { RecursiveDepth = 2 });
-
-        //    // 1 level depth
-        //    result.RecursiveList.ShouldNotBeDefault();
-        //    result.Int.ShouldNotBeDefault();
-
-        //    // 2 level depth
-        //    result.RecursiveList[0].RecursiveList.ShouldNotBeDefault();
-        //    result.RecursiveList[0].Int.ShouldNotBeDefault();
-
-        //    // 3 level depth (should now be null as recursiveDepth:2)
-        //    result.RecursiveList[0].RecursiveList[0].RecursiveList.ShouldEqual(null);
-        //    result.RecursiveList[0].RecursiveList[0].Int.ShouldNotBeDefault();
-        //}
+        [TestMethod]
+        public void RandomObjectWithRecursiveListWillGenerateChildObjectsToTheSpecifiedDepthWithSettings()
+        {
+            var result = RandomValue.Object<ObjectWithRecursiveCollections>(new RandomValueSettings { RecursiveDepth = 2 });
+
+            // 1 level depth
+            result.RecursiveList.ShouldNotBeDefault();
+            result.Int.ShouldNotBeDefault();
+
+            // 2 level depth
+            result.RecursiveList[0].RecursiveList.ShouldNotBeDefault();
+            result.RecursiveList[0].Int.ShouldNotBeDefault();
+
+            // 3 level depth (should now be null as recursiveDepth:2)
+            result.RecursiveList[0].RecursiveList[0].RecursiveList.ShouldEqual(null);
+            result.RecursiveList[0].RecursiveList[0].Int.ShouldNotBeDefault();
+        }

         [TestMethod]
         public void NullableValuesWillSometimesBePopulatedWithNullWhenAllowingNulls()


this should be kept stable for publishing

--- RelhaxModpack/RelhaxModpack/Settings/Settings.cs
+++ RelhaxModpack/RelhaxModpack/Settings/Settings.cs
@@ -425,7 +425,7 @@
         /// The current distribution version of the application.
         /// Alpha should NEVER be built for public distribution unless direct testing!
         /// </summary>
-        public const ApplicationVersions ApplicationVersion = ApplicationVersions.Stable;
+        public const ApplicationVersions ApplicationVersion = ApplicationVersions.Alpha;

         /// <summary>
         /// Flag to determine if the user running is intentionally using the alpha version (or if an Alpha version was accidentally distributed)


Single Instance Application

Single Instance Application

--- ReportsOrganizer/ReportsOrganizer.UI/App.xaml.cs
+++ ReportsOrganizer/ReportsOrganizer.UI/App.xaml.cs
@@ -3,6 +3,7 @@
 using System.Configuration;
 using System.Data;
 using System.Linq;
+using System.Threading;
 using System.Windows;

 namespace ReportsOrganizer.UI
@@ -12,5 +13,14 @@
     /// </summary>
     public partial class App : Application
     {
+        private static Mutex mutex = new Mutex(true, "{CA13A683-04A7-41E5-BFB1-43D22BADADB7}");
+
+        public App()
+        {
+            if (!mutex.WaitOne(TimeSpan.Zero, true))
+            {
+                Current.Shutdown();
+            }
+        }
     }
 }


[Implement] GH11

[Implement] GH11

Summary: [Refactor] serialization of the "IS-SIMPLIFIED" proprty of the  AttributeValueXHTML class

Test Plan: run unit tests

Reviewers: naron.phou

Subscribers: avorobiev

Differential Revision: http://phabricator.rheagroup.com/D1473

--- ReqIFSharp/AttributeValue/AttributeValueXHTML.cs
+++ ReqIFSharp/AttributeValue/AttributeValueXHTML.cs
@@ -139,10 +139,10 @@
         /// </param>
         public override void ReadXml(XmlReader reader)
         {
-            var isimplified = reader["IS-SIMPLIFIED"];
-            if (!string.IsNullOrEmpty(isimplified))
-            {
-                this.IsSimplified = XmlConvert.ToBoolean(isimplified);
+            var isSimplified = reader["IS-SIMPLIFIED"];
+            if (!string.IsNullOrEmpty(isSimplified))
+            {
+                this.IsSimplified = XmlConvert.ToBoolean(isSimplified);
             }

             using (var subtree = reader.ReadSubtree())
@@ -182,8 +182,8 @@
             {
                 throw new SerializationException("The Definition property of an AttributeValueXHTML may not be null");
             }
-
-            writer.WriteAttributeString("IS-SIMPLIFIED", XmlConvert.ToString(this.IsSimplified));
+
+            writer.WriteAttributeString("IS-SIMPLIFIED", this.IsSimplified ? "true" : "false");

             writer.WriteStartElement("DEFINITION");
             writer.WriteElementString("ATTRIBUTE-DEFINITION-XHTML-REF", this.Definition.Identifier);


Much more functional version of the new update. Added back in proper grab and cleaned up collision logic


fix comment

fix comment

--- Asterisk.2013/Asterisk.NET/Manager/Event/MusicOnHoldEvent.cs
+++ Asterisk.2013/Asterisk.NET/Manager/Event/MusicOnHoldEvent.cs
@@ -33,7 +33,7 @@
 		}

 		/// <summary>
-		/// Get or set state
+		///     Get or set state
 		/// </summary>
 		public MusicOnHoldStates State { get; set; }
 	}


Default the count of published messages to 1.

--- examples/Publish/publish.cs
+++ examples/Publish/publish.cs
@@ -25,7 +25,7 @@
     {
         Dictionary<string, string> parsedArgs = new Dictionary<string, string>();

-        int count = 2000000;
+        int count = 1;
         string url = Defaults.Url;
         string subject = "foo";
         byte[] payload = null;


Fix AssemblyNameReference created with full name as name

--- MonoMod/MonoModder.cs
+++ MonoMod/MonoModder.cs
@@ -444,7 +444,7 @@
             // Try to use the AssemblyResolver with the full name (or even partial name).
             if (path == null) {
                 try {
-                    dep = AssemblyResolver.Resolve(new AssemblyNameReference(fullName ?? name, new Version(0, 0, 0, 0)))?.MainModule;
+                    dep = AssemblyResolver.Resolve(AssemblyNameReference.Parse(fullName ?? name))?.MainModule;
                 } catch { }
                 if (dep != null)
 #if !CECIL0_9


naming

naming

--- Assets/JumpCommand/JumpCommandGUI.cs
+++ Assets/JumpCommand/JumpCommandGUI.cs
@@ -16,12 +16,12 @@
     int    historyIndex = -1; // -1 means current input
     int    cursorPos    = -1;
     bool   pressBackspace = false;
-    string prompt       = "";
+    string promptInfo       = "";
     [HideInInspector]
     GUIStyle style = new GUIStyle();  // popup list style
-    bool   enablePopupList = false;
+    bool   isPopupListOpen = false;
     string[] popupListContent;
-    int    popupListSelected = 0;
+    int    popupListSelPos = 0;
     Vector2 popupListScrollPos = Vector2.zero;

     event  Action<string> OnReceiveDownAndUpEvent;
@@ -72,7 +72,7 @@

     private void HandleSubmitPopupList() {
         TextEditor te = (TextEditor)GUIUtility.GetStateObject(typeof(TextEditor), GUIUtility.keyboardControl);
-        input = popupListContent[popupListSelected].Split(new char[1]{' '})[0];
+        input = popupListContent[popupListSelPos].Split(new char[1]{' '})[0];
         te.pos = input.Length;
         te.selectPos = te.pos;
         ClosePopupList();
@@ -135,13 +135,13 @@
     // update callee name that will invoke the command
     private void UpdatePrompt() {
         if(JumpCommand.Callee == null) {
-            prompt = ">";
+            promptInfo = ">";
         }
         else if(JumpCommand.Callee is GameObject){
-            prompt = GetGameObjectFullName(JumpCommand.Callee as GameObject) + ">";
+            promptInfo = GetGameObjectFullName(JumpCommand.Callee as GameObject) + ">";
         }
         else {  // if Callee is not type of GameObject, let it empty now.
-            prompt = ">";
+            promptInfo = ">";
         }
     }

@@ -176,7 +176,7 @@
             step = 1;
         }

-        popupListSelected = Mathf.Clamp(popupListSelected + step, 0, popupListContent.Length-1);
+        popupListSelPos = Mathf.Clamp(popupListSelPos + step, 0, popupListContent.Length-1);
     }

     private void HandleUpOrDownInput(string key) {
@@ -238,8 +238,8 @@
     private void HandleTab()
     {
         TextEditor te = (TextEditor)GUIUtility.GetStateObject(typeof(TextEditor), GUIUtility.keyboardControl);
-        if(KeyDown("tab") && enablePopupList) {
-            input = popupListContent[popupListSelected].Split(new char[1]{' '})[0];
+        if(KeyDown("tab") && isPopupListOpen) {
+            input = popupListContent[popupListSelPos].Split(new char[1]{' '})[0];
             te.pos = input.Length;
             te.selectPos = te.pos;
             ClosePopupList();
@@ -264,12 +264,12 @@
         List<string> autoCompletions = JumpCommand.GetAutoCompletionCommands(input);
         if(autoCompletions.Count > 0 ) {
             popupListContent = autoCompletions.ToArray();
-            if(!enablePopupList) {
+            if(!isPopupListOpen) {
                 OpenPopupList();
             }
         }
         else {
-            if(enablePopupList) {
+            if(isPopupListOpen) {
                 ClosePopupList();
             }
         }
@@ -378,7 +378,7 @@
         historyIndex = -1;
         UpdatePrompt();
         lastSelection = null;
-        enablePopupList = false;
+        isPopupListOpen = false;
         OnReceiveDownAndUpEvent += HandleUpOrDownInput;
         OnReceiveEnterEvent     += HandleSubmitInput;
         OnReceiveEscapeEvent    += HandleEscapeInput;
@@ -386,7 +386,7 @@
     }

     void OpenPopupList() {
-        enablePopupList = true;
+        isPopupListOpen = true;
         OnReceiveDownAndUpEvent -= HandleUpOrDownInput;
         OnReceiveEscapeEvent    -= HandleEscapeInput;
         OnReceiveBackQuotaEvent -= HandleBackQuotaInput;
@@ -395,11 +395,11 @@
         OnReceiveEscapeEvent    += HandleEscapePopupList;
         OnReceiveBackQuotaEvent += HandleBackQuotaPopupList;
         OnReceiveEnterEvent     += HandleSubmitPopupList;
-        popupListSelected = 0;
+        popupListSelPos = 0;
     }

     void ClosePopupList() {
-        enablePopupList = false;
+        isPopupListOpen = false;
         OnReceiveDownAndUpEvent += HandleUpOrDownInput;
         OnReceiveEscapeEvent    += HandleEscapeInput;
         OnReceiveBackQuotaEvent += HandleBackQuotaInput;
@@ -421,12 +421,12 @@

         GUILayout.BeginArea(new Rect(0, (Screen.height - 50)*yPos, Screen.width, Screen.height));

-        GUILayout.Label(prompt);
+        GUILayout.Label(promptInfo);
         String lastInput = input;
         input = GUILayout.TextField(input,GUILayout.Width(Screen.width));
-        if(enablePopupList) {
+        if(isPopupListOpen) {
             popupListScrollPos = GUILayout.BeginScrollView(popupListScrollPos, false, false, GUILayout.MaxHeight(250));
-            popupListSelected = GUILayout.SelectionGrid(popupListSelected, popupListContent, 1, style, GUILayout.Width(Screen.width));
+            popupListSelPos = GUILayout.SelectionGrid(popupListSelPos, popupListContent, 1, style, GUILayout.Width(Screen.width));
             GUILayout.EndScrollView();
         }
         GUILayout.Label("Parameter Num " + InputStatParameterCount.ToString());


#64 Monster events with no text pass correctly.

--- Assets/Scripts/Quest/EventManager.cs
+++ Assets/Scripts/Quest/EventManager.cs
@@ -172,7 +172,7 @@
             }

             // Display the location(s)
-            if (qe.qEvent.locationSpecified)
+            if (qe.qEvent.locationSpecified && e.GetText().Length > 0)
             {
                 game.tokenBoard.AddMonster(qe);
             }


update known windows versions

update known windows versions


Update to Problem 7. Sort 3 Numbers with Nested Ifs


Fixed review

Fixed review

--- Core.DomainServices/Notifications/UserNotificationService.cs
+++ Core.DomainServices/Notifications/UserNotificationService.cs
@@ -127,14 +127,7 @@
                     return systemUsageExists != null;
                 case RelatedEntityType.dataProcessingRegistration:
                     var dataProcessingRegistrationExists = _dataProcessingRepository.GetById(relatedEntityId);
-                    if (dataProcessingRegistrationExists.HasValue)
-                    {
-                        return true;
-                    }
-                    else
-                    {
-                        return false;
-                    }
+                    return dataProcessingRegistrationExists.HasValue;
                 default:
                     return false;
             }


Removed not reachable code

Removed not reachable code

--- Core/System/Linq/Expressions/Compiler/CompilerScope.net30.cs
+++ Core/System/Linq/Expressions/Compiler/CompilerScope.net30.cs
@@ -492,7 +492,6 @@
                 return block.Variables;
             }
             return new[] { ((CatchBlock)scope).Variable };
-            return new ParameterExpression[0];
         }

         private string CurrentLambdaName


Nullable age

Nullable age

--- Battery-Commander.Web/Models/APFT.cs
+++ Battery-Commander.Web/Models/APFT.cs
@@ -28,7 +28,7 @@
         {
             get
             {
-                int Age = Soldier.AgeAsOf(Date);
+                int? Age = Soldier?.AgeAsOf(Date);

                 if (Age <= 21) return AgeGroup.Group_17_to_21;
                 if (Age <= 26) return AgeGroup.Group_22_to_26;


Suppport both versions of CNMT Setting Code List [JOJI]

--- BrawlManagerLib/GCT/ReadOnly/CNMT.cs
+++ BrawlManagerLib/GCT/ReadOnly/CNMT.cs
@@ -18,8 +18,9 @@
                     | data[lineskip + 2] << 8
                     | data[lineskip + 3];

-                int songId = (id - 4031616) / 144;
-                if (songId < 0x286C || songId > 0x2BBD) continue;
+                int songId1 = (id - 4031616) / 144;
+                if (songId1 < 0x286C || songId1 > 0x2BBD) continue;
+                int songId2 = songId1 + 0xBC94;

                 if (data[lineskip + 4] != 0x00) continue;
                 if (data[lineskip + 5] != 0x00) continue;
@@ -33,10 +34,11 @@
                     .Take(bytes)
                     .Select(b => (char)b)
                     .ToArray();
-                if (Map.TryGetValue((ushort)songId, out string existing)) {
-                    Console.Error.WriteLine($"Replacing already read song title \"{existing}\" for {songId.ToString("X4")} with new song title \"{new string(charArray)}\"");
+                if (Map.TryGetValue((ushort)songId1, out string existing)) {
+                    Console.Error.WriteLine($"Replacing already read song title \"{existing}\" for {songId1.ToString("X4")}/{songId2.ToString("X4")} with new song title \"{new string(charArray)}\"");
                 }
-                Map[(ushort)songId] = new string(charArray);
+                Map[(ushort)songId1] = new string(charArray);
+                Map[(ushort)songId2] = new string(charArray);
             }
         }
     }


Fixed TestNativeFSLockFactory() test case

git-svn-id: 6c68d65edd5507bf6b37474e0d155329cbeeff2a@568808 13f79535-47bb-0310-9956-ffa450edef68

--- C#/src/Test/Store/TestLockFactory.cs
+++ C#/src/Test/Store/TestLockFactory.cs
@@ -220,10 +220,9 @@
 		{
             Assert.Fail("TestLockClassProperty() needs conversion to C#");

-			/*
             System.String indexDirName = "index.TestLockFactory3";

-			System_Renamed.setProperty("Lucene.Net.Store.FSDirectoryLockFactoryClass", "Lucene.Net.Store.NoLockFactory");
+			//System.Configuration.ConfigurationSettings.AppSettings.Set("Lucene.Net.Store.FSDirectoryLockFactoryClass", "Lucene.Net.Store.NoLockFactory");

 			IndexWriter writer = new IndexWriter(indexDirName, new WhitespaceAnalyzer(), true);

@@ -231,12 +230,11 @@

 			// Put back to the correct default for subsequent tests:
 			// System.clearProperty("Lucene.Net.Store.FSDirectoryLockFactoryClass");
-			System_Renamed.setProperty("Lucene.Net.Store.FSDirectoryLockFactoryClass", "");
+			//System.Configuration.ConfigurationSettings.AppSettings.Set("Lucene.Net.Store.FSDirectoryLockFactoryClass", "");

 			writer.Close();
 			// Cleanup
 			RmDir(indexDirName);
-            */
 		}

 		// Verify: setDisableLocks works
@@ -369,11 +367,11 @@
         [Test]
 		public virtual void  TestNativeFSLockFactory()
 		{
-            Assert.Fail("TestLockClassProperty() needs conversion to C#");
+            System.String altTempDir = System.IO.Path.GetTempPath();

-			NativeFSLockFactory f = new NativeFSLockFactory(SupportClass.AppSettings.Get("tempDir", ""));
-
-			NativeFSLockFactory f2 = new NativeFSLockFactory(SupportClass.AppSettings.Get("tempDir", ""));
+			NativeFSLockFactory f = new NativeFSLockFactory(SupportClass.AppSettings.Get("tempDir", altTempDir));
+
+			NativeFSLockFactory f2 = new NativeFSLockFactory(SupportClass.AppSettings.Get("tempDir", altTempDir));

 			f.SetLockPrefix("test");
 			Lock l = f.MakeLock("commit");


If a group has just a few child commands, show them in the help list

--- src/Yaclops/Commands/HelpCommand.cs
+++ src/Yaclops/Commands/HelpCommand.cs
@@ -109,24 +109,85 @@
                 Tabs = new[] { 22 }
             };

-            foreach (var node in group.Nodes.OrderBy(x => x.Verb))
-            {
-                // TODO - add option to show ALL commands/groups
-                if (node.Hidden)
+            // TODO - add option to show ALL commands/groups
+            const bool showHidden = false;
+
+            var commands = GetExpandedCommandNodes(group, showHidden)
+                .Select(x => new { x.Node, x.Depth, Verb = VerbPath(x.Node, x.Depth - 1) });
+
+            foreach (var entry in commands.OrderBy(x => x.Verb))
+            {
+                if (entry.Node.Hidden)
                 {
                     continue;
                 }

                 var para = doc.AddParagraph(new Paragraph(style));

-                para.AddSpan(new Span(node.Verb));      // TODO - highlight the command?
+                // TODO - highlight the command by setting span style?
+                para.AddSpan(new Span(entry.Verb));
                 para.AddTab();

-                if (!string.IsNullOrEmpty(node.Summary))
-                {
-                    para.AddSpan(new Span(node.Summary));
-                }
-            }
+                if (!string.IsNullOrEmpty(entry.Node.Summary))
+                {
+                    para.AddSpan(new Span(entry.Node.Summary));
+                }
+            }
+        }
+
+
+
+        private IEnumerable<CommandChildEntry> GetExpandedCommandNodes(CommandGroup group, bool showHidden)
+        {
+            // Can't use recursion here, as that prevents yielding the results, so use a stack...
+            Stack<CommandChildEntry> stack = new Stack<CommandChildEntry>(new[] { new CommandChildEntry(group, 0) });
+
+            while (stack.Count > 0)
+            {
+                var entry = stack.Pop();
+
+                var command = entry.Node as Command;
+                if ((command != null) && (showHidden || !command.Hidden))
+                {
+                    yield return entry;
+                }
+
+                var childGroup = entry.Node as CommandGroup;
+                // TODO - the '3' is arbitrary - make it configurable! (Determines when to show children)
+                if ((childGroup != null) && ((entry.Depth == 0) || (CountChildCommands(childGroup, showHidden) <= 3)))
+                {
+                    foreach (var child in childGroup.Nodes)
+                    {
+                        if (showHidden || !child.Hidden)
+                        {
+                            stack.Push(new CommandChildEntry(child, entry.Depth + 1));
+                        }
+                    }
+                }
+            }
+        }
+
+
+
+        private int CountChildCommands(CommandNode node, bool includeHidden)
+        {
+            int count = 0;
+
+            Command command = node as Command;
+            if (command != null)
+            {
+                count += 1;
+            }
+            else
+            {
+                CommandGroup group = node as CommandGroup;
+                if ((group != null) && (includeHidden || !group.Hidden))
+                {
+                    count += group.Nodes.Sum(child => CountChildCommands(child, includeHidden));
+                }
+            }
+
+            return count;
         }

@@ -202,13 +263,13 @@

         // TODO - include options of ancestor groups?
-        private string VerbPath(CommandNode node)
+        private string VerbPath(CommandNode node, int maxDepth = int.MaxValue)
         {
             StringBuilder builder = new StringBuilder();

-            if (node.Parent != null)
-            {
-                builder.Append(VerbPath(node.Parent));
+            if ((node.Parent != null) && (maxDepth > 0))
+            {
+                builder.Append(VerbPath(node.Parent, maxDepth - 1));
             }

             if (builder.Length > 0)
@@ -219,6 +280,20 @@
             builder.Append(node.HelpVerb);

             return builder.ToString();
+        }
+
+
+
+        private class CommandChildEntry
+        {
+            public CommandChildEntry(CommandNode node, int depth)
+            {
+                Node = node;
+                Depth = depth;
+            }
+
+            public CommandNode Node { get; private set; }
+            public int Depth { get; private set; }
         }
     }
 }


git-svn-id: https://jumony.svn.codeplex.com/svn/trunk@63967 2327b42d-5241-43d6-9e2a-de5ac946f064

--- Ivony.Html/ElementExtensions.cs
+++ Ivony.Html/ElementExtensions.cs
@@ -20,7 +20,7 @@
     /// </summary>
     /// <param name="node">要获取子元素的容器</param>
     /// <returns>容器的所有子元素</returns>
-    public static IEnumerable<IHtmlElement> Elements( this IHtmlContainer node )
+    public static IEnumerable<IHtmlElement> Elements( this IHtmlNodeContainer node )
     {
       return node.Nodes().OfType<IHtmlElement>();
     }
@@ -32,7 +32,7 @@
     /// <param name="node">要获取子元素的容器</param>
     /// <param name="selector">用来筛选子元素的元素选择器</param>
     /// <returns>符合条件的子元素</returns>
-    public static IEnumerable<IHtmlElement> Elements( this IHtmlContainer node, string selector )
+    public static IEnumerable<IHtmlElement> Elements( this IHtmlNodeContainer node, string selector )
     {
       return HtmlCssSelector.CreateElementSelector( selector ).Search( Elements( node ) );
     }
@@ -265,7 +265,7 @@
     /// <param name="container">要搜索子代元素的容器</param>
     /// <param name="expression">CSS选择器</param>
     /// <returns>搜索到的符合要求的元素</returns>
-    public static IEnumerable<IHtmlElement> Find( this IHtmlContainer container, string expression )
+    public static IEnumerable<IHtmlElement> Find( this IHtmlNodeContainer container, string expression )
     {
       var selector = HtmlCssSelector.Create( expression );
       return selector.Search( container, true );
@@ -278,7 +278,7 @@
     /// <param name="container">要搜索子代元素的容器</param>
     /// <param name="expression">CSS选择器</param>
     /// <returns>搜索到的符合要求的唯一元素</returns>
-    public static IHtmlElement FindSingle( this IHtmlContainer container, string expression )
+    public static IHtmlElement FindSingle( this IHtmlNodeContainer container, string expression )
     {
       return Find( container, expression ).Single();
     }


Change inactivity to 15 mins.

Change inactivity to 15 mins.

--- JabbR/App_Start/Bootstrapper.cs
+++ JabbR/App_Start/Bootstrapper.cs
@@ -175,7 +175,7 @@
                     user.IsAfk = true;
                 }

-                if (elapsed.TotalMinutes > 5)
+                if (elapsed.TotalMinutes > 15)
                 {
                     user.Status = (int)UserStatus.Inactive;
                     inactiveUsers.Add(user);


LiPTT

LiPTT

--- LiPTT/Compoments/Collections.cs
+++ LiPTT/Compoments/Collections.cs
@@ -474,7 +474,7 @@
                             {
                                 string text = LiPTT.GetString(RawLines[row], index, i - index);

-                                /****
+                                /***
                                 InlineUIContainer container = new InlineUIContainer
                                 {
                                     Child = new Border()
@@ -491,6 +491,7 @@
                                     }
                                 };
                                 /***/
+                                //***
                                 Run container = new Run()
                                 {
                                     Text = text.Replace('\0', ' '),
@@ -498,10 +499,9 @@
                                     FontFamily = ArticleFontFamily,
                                     Foreground = GetForegroundBrush(RawLines[row][index]),
                                 };
+                                /***/

                                 paragraph.Inlines.Add(container);
-
-

                                 index = i;
                                 color = b.ForegroundColor;


Fixed a bit in the .Net 3.5 version of the test app ...

--- DieFledermaus.Tests/Program.cs
+++ DieFledermaus.Tests/Program.cs
@@ -153,7 +153,7 @@

         private static string GetString(byte[] hash)
         {
-            return string.Concat(hash.Select(i => i.ToString("x2", System.Globalization.NumberFormatInfo.InvariantInfo)));
+            return string.Concat(hash.Select(i => i.ToString("x2", System.Globalization.NumberFormatInfo.InvariantInfo)).ToArray());
         }
     }
 }


Documentation

Documentation

--- Cascara/Src/Interpreter/Statement.cs
+++ Cascara/Src/Interpreter/Statement.cs
@@ -128,7 +128,11 @@
             get { return _nestedStatements; }
         }

-        internal bool IsStructDefinition
+        /// <summary>
+        /// Gets a value indicating whether this <see cref="Statement"/>
+        /// defines a structure object.
+        /// </summary>
+        internal bool IsStructureDefinition
         {
             get
             {
@@ -238,16 +242,19 @@
         /// </remarks>
         protected abstract void ExtractInfo();

+        /// <summary>
+        /// Analyzes the statement for syntax errors.
+        /// </summary>
         private void Validate()
         {
             // Check that nested statements occur where they should
-            if (HasNestedStatements && !(IsStructDefinition || StatementType == StatementType.TypeDefinition))
+            if (HasNestedStatements && !(IsStructureDefinition || StatementType == StatementType.TypeDefinition))
             {
                 string msg = Resources.SyntaxExceptionUnexpectedNestedStatement;
                 Statement nested = NestedStatements.ElementAt(0);
                 throw LayoutException.Create<SyntaxException>(null, nested, msg);
             }
-            else if (!HasNestedStatements && IsStructDefinition)
+            else if (!HasNestedStatements && IsStructureDefinition)
             {
                 string msg = Resources.SyntaxExceptionEmptyStructure;
                 throw LayoutException.Create<SyntaxException>(null, this, msg);


Updated the sessionrecord to have unique xsrf tokens and better documentation

--- Ceen.Security/Login/SessionRecord.cs
+++ Ceen.Security/Login/SessionRecord.cs
@@ -3,10 +3,10 @@

 namespace Ceen.Security.Login
 {
-	/// <summary>
-	/// Helper class to
-	/// </summary>
-	public static partial class Utility
+    /// <summary>
+    /// Helper class for static methods on records
+    /// </summary>
+    public static partial class Utility
 	{
 		/// <summary>
 		/// Gets a value indicating if the session is valid
@@ -33,10 +33,11 @@
 		/// </summary>
         [Unique]
 		public string Cookie { get; set; }
-		/// <summary>
-		/// Gets or sets the XSRF Token.
-		/// </summary>
-		public string XSRFToken { get; set; }
+        /// <summary>
+        /// Gets or sets the XSRF Token.
+        /// </summary>
+        [Unique]
+        public string XSRFToken { get; set; }
 		/// <summary>
 		/// Gets or sets the expiration time.
 		/// </summary>


Add extra constraint on LoadValueTypeOntoStack*

--- ObjectManipulation.cs
+++ ObjectManipulation.cs
@@ -96,7 +96,8 @@
         }

         [PublicAPI]
-        public static void LoadValueTypeOntoStack<T>(this ILGenerator generator) => generator.LoadValueTypeOntoStack(typeof (T));
+        public static void LoadValueTypeOntoStack<T>(this ILGenerator generator) where T : struct
+            => generator.LoadValueTypeOntoStack(typeof (T));

         [PublicAPI]
         public static void LoadValueTypeOntoStackVolatile(this ILGenerator generator, Type type)
@@ -111,7 +112,8 @@
         }

         [PublicAPI]
-        public static void LoadValueTypeOntoStackVolatile<T>(this ILGenerator generator) => generator.LoadValueTypeOntoStackVolatile(typeof(T));
+        public static void LoadValueTypeOntoStackVolatile<T>(this ILGenerator generator) where T : struct
+            => generator.LoadValueTypeOntoStackVolatile(typeof(T));

         [PublicAPI]
         public static void StoreValueTypeFromStack(this ILGenerator generator, Type type)


case insensitive validation

case insensitive validation

--- src/modeler/AutoRest.Swagger/Validation/UniqueResourcePaths.cs
+++ src/modeler/AutoRest.Swagger/Validation/UniqueResourcePaths.cs
@@ -23,7 +23,7 @@
         /// <param name="paths"></param>
         /// <returns></returns>
         public override bool IsValid(Dictionary<string, Dictionary<string, Operation>> paths)
-            => paths.Keys.Select(path => { return apiRegExp.Match(path).Success ? apiRegExp.Match(path).Groups?[0]?.Value : null; }).Except(new List<string> { null }).Distinct().Count() <= 1;
+            => paths.Keys.Select(path => { return apiRegExp.Match(path).Success ? apiRegExp.Match(path).Groups?[0]?.Value.ToString().ToLowerInvariant() : null; }).Except(new List<string> { null }).Distinct().Count() <= 1;

         /// <summary>
         /// The template message for this Rule.


Fix to request MTU sample

Fix to request MTU sample

--- Samples/Samples/ViewModels/Le/DeviceViewModel.cs
+++ Samples/Samples/ViewModels/Le/DeviceViewModel.cs
@@ -76,8 +76,19 @@
                             .SetInputMode(InputType.Number)
                             .SetOnTextChanged(args =>
                             {
-                                var value = Int32.Parse(args.Value);
-                                args.IsValid = value >= 20 && value <= 512;
+                                var len = args.Value?.Length ?? 0;
+                                if (len > 0)
+                                {
+                                    if (len > 3)
+                                    {
+                                        args.Value = args.Value.Substring(0, 3);
+                                    }
+                                    else
+                                    {
+                                        var value = Int32.Parse(args.Value);
+                                        args.IsValid = value >= 20 && value <= 512;
+                                    }
+                                }
                             })
                         );
                         if (result.Ok)


add inactivityTimeout and sort sendStart options

--- Scripts/Services/SpeechToText/v1/SpeechToText.cs
+++ Scripts/Services/SpeechToText/v1/SpeechToText.cs
@@ -573,16 +573,17 @@
             Dictionary<string, object> start = new Dictionary<string, object>();
             start["action"] = "start";
             start["content-type"] = "audio/l16;rate=" + _recordingHZ.ToString() + ";channels=1;";
-            start["max_alternatives"] = _maxAlternatives;
+            start["inactivity_timeout"] = InactivityTimeout;
             start["interim_results"] = EnableInterimResults;
-            start["word_confidence"] = _wordConfidence;
+            start["keywords"] = Keywords;
+            start["keywords_threshold"] = KeywordsThreshold;
+            start["max_alternatives"] = MaxAlternatives;
+            start["profanity_filter"] = ProfanityFilter;
+            start["smart_formatting"] = SmartFormatting;
+            start["speaker_labels"] = SpeakerLabels;
             start["timestamps"] = _timestamps;
-            start["speaker_labels"] = SpeakerLabels;
-            start["smart_formatting"] = SmartFormatting;
-            start["profanity_filter"] = ProfanityFilter;
             start["word_alternatives_threshold"] = WordAlternativesThreshold;
-            start["keywords_threshold"] = KeywordsThreshold;
-            start["keywords"] = Keywords;
+            start["word_confidence"] = EnableWordConfidence;

             _listenSocket.Send(new WSConnector.TextMessage(Json.Serialize(start)));
             _lastStartSent = DateTime.Now;


change classify score from string to double

--- Scripts/Services/VisualRecognition/DataModels.cs
+++ Scripts/Services/VisualRecognition/DataModels.cs
@@ -101,7 +101,7 @@
 		/// <summary>
 		/// The score.
 		/// </summary>
-        public string score { get; set; }
+        public double score { get; set; }
 		/// <summary>
 		/// The type hierarchy.
 		/// </summary>


Don't consider dimensions of non-existing cells

--- osu.Framework/Graphics/Containers/GridContainer.cs
+++ osu.Framework/Graphics/Containers/GridContainer.cs
@@ -148,6 +148,9 @@
             {
                 foreach (var d in columnDimensions)
                 {
+                    if (d.Index >= cells.GetLength(1))
+                        continue;
+
                     for (int r = 0; r < cells.GetLength(0); r++)
                     {
                         cells[r, d.Index].IsWidthDefined = true;
@@ -168,6 +171,9 @@
             {
                 foreach (var d in rowDimensions)
                 {
+                    if (d.Index >= cells.GetLength(0))
+                        continue;
+
                     for (int c = 0; c < cells.GetLength(1); c++)
                     {
                         cells[d.Index, c].IsHeightDefined = true;


Removed unused setter

Removed unused setter

Co-authored-by: Bartłomiej Dach <809709723693c4e7ecc6f5379a3099c830279741@gmail.com>


Fix hit explosions not being cleaned up correctly when rewinding

--- osu.Game.Rulesets.Mania/UI/PoolableHitExplosion.cs
+++ osu.Game.Rulesets.Mania/UI/PoolableHitExplosion.cs
@@ -42,6 +42,8 @@
         {
             base.PrepareForUse();

+            LifetimeStart = Time.Current;
+
             (skinnableExplosion?.Drawable as IHitExplosion)?.Animate(Result);

             this.Delay(DURATION).Then().Expire();


Fix invalid flashlight size calculation

Fix invalid flashlight size calculation

This regressed in #20714. One usage of `getSizeFor(0)` was replaced by
`adjustSize(GetSize())`, but another usage of `getSizeFor(Combo.Value)`
was replaced by `adjustSize(Combo.Value)`, which is not correct, since
`adjustSize()` is expecting to receive a combo-based size, rather than a
combo value directly.

--- osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs
+++ osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs
@@ -75,7 +75,7 @@
                     FlashlightPosition = ToLocalSpace(taikoPlayfield.HitTarget.ScreenSpaceDrawQuad.Centre);

                     ClearTransforms(targetMember: nameof(FlashlightSize));
-                    FlashlightSize = adjustSize(Combo.Value);
+                    FlashlightSize = adjustSize(GetSize());

                     flashlightProperties.Validate();
                 }


Write full type namespace

Write full type namespace

--- osu.Framework/Allocation/RecursiveLoadException.cs
+++ osu.Framework/Allocation/RecursiveLoadException.cs
@@ -35,7 +35,7 @@
             traceBuilder = inner is RecursiveLoadException recursiveException ? recursiveException.traceBuilder : new StringBuilder();

             if (!blacklist.Contains(loaderMethod.DeclaringType))
-                traceBuilder.AppendLine($"  at {loaderMethod.DeclaringType?.ReadableName() ?? string.Empty}.{loaderMethod.Name} ()");
+                traceBuilder.AppendLine($"  at {loaderMethod.DeclaringType}.{loaderMethod.Name} ()");
         }

         public override string ToString()


.Zero

.Zero

--- osu.Framework/Graphics/Containers/FlowContainer.cs
+++ osu.Framework/Graphics/Containers/FlowContainer.cs
@@ -97,7 +97,7 @@

                     if (Children.FirstOrDefault() == null) return Vector2.Zero;

-                    Vector2 current = new Vector2(0, 0);
+                    Vector2 current = Vector2.Zero;

                     Vector2 max = maximumSize;
                     if (direction == FlowDirection.Full && maximumSize == Vector2.Zero)


Cleanup.

Cleanup.

--- osu.Game/Screens/Multi/Components/RoomInspector.cs
+++ osu.Game/Screens/Multi/Components/RoomInspector.cs
@@ -5,7 +5,6 @@
 using osu.Framework.Allocation;
 using osu.Framework.Configuration;
 using osu.Framework.Extensions.Color4Extensions;
-using osu.Framework.Extensions.IEnumerableExtensions;
 using osu.Framework.Graphics;
 using osu.Framework.Graphics.Colour;
 using osu.Framework.Graphics.Containers;
@@ -75,10 +74,6 @@

                 updateState();
             }
-        }
-
-        public RoomInspector()
-        {
         }

         [BackgroundDependencyLoader]
@@ -363,23 +358,31 @@
         {
             status.Text = s.Message;

-            foreach (Drawable d in new Drawable[] { statusStrip, status })
-                d.FadeColour(s.GetAppropriateColour(colours), transition_duration);
+            Color4 c = s.GetAppropriateColour(colours);
+            statusStrip.FadeColour(c, transition_duration);
+            status.FadeColour(c, transition_duration);
         }

         private void updateState()
         {
             if (Room == null)
             {
-                foreach (Drawable d in new Drawable[] { coverContainer, participantsFlow, participantNumbersFlow, infoPanelFlow, name, participantInfo })
-                    d.FadeOut(transition_duration);
+                coverContainer.FadeOut(transition_duration);
+                participantsFlow.FadeOut(transition_duration);
+                participantNumbersFlow.FadeOut(transition_duration);
+                infoPanelFlow.FadeOut(transition_duration);
+                name.FadeOut(transition_duration);
+                participantInfo.FadeOut(transition_duration);

                 displayStatus(new RoomStatusNoneSelected());
             }
             else
             {
-                foreach (Drawable d in new Drawable[] { participantsFlow, participantNumbersFlow, infoPanelFlow, name, participantInfo })
-                    d.FadeIn(transition_duration);
+                participantsFlow.FadeIn(transition_duration);
+                participantNumbersFlow.FadeIn(transition_duration);
+                infoPanelFlow.FadeIn(transition_duration);
+                name.FadeIn(transition_duration);
+                participantInfo.FadeIn(transition_duration);

                 statusBind.TriggerChange();
                 beatmapBind.TriggerChange();


Remove now unnecessary Contains override in TabControl

--- osu.Framework/Graphics/UserInterface/TabControl.cs
+++ osu.Framework/Graphics/UserInterface/TabControl.cs
@@ -33,11 +33,6 @@
         /// </summary>
         public bool AutoSort { set; get; }

-        /// <summary>
-        /// We need a special case here to allow for the dropdown "overflowing" our own bounds.
-        /// </summary>
-        public override bool Contains(Vector2 screenSpacePos) => base.Contains(screenSpacePos) || (Dropdown?.Contains(screenSpacePos) ?? false);
-
         protected Dropdown<T> Dropdown;

         protected TabFillFlowContainer<TabItem<T>> TabContainer;


Remove unused variable.

Remove unused variable.

--- osu.Game/Modes/Judgements/DrawableJudgementInfo.cs
+++ osu.Game/Modes/Judgements/DrawableJudgementInfo.cs
@@ -24,8 +24,6 @@
         protected readonly TJudgement Judgement;

         protected readonly SpriteText JudgementText;
-
-        protected double HitVisibleLength => 600;

         /// <summary>
         /// Creates a drawable which visualises a <see cref="JudgementInfo"/>.


Propagate `SourceChanged` events from `SkinManager` down in the ruleset skin container

--- osu.Game/Skinning/RulesetSkinProvidingContainer.cs
+++ osu.Game/Skinning/RulesetSkinProvidingContainer.cs
@@ -50,7 +50,13 @@
         private void load()
         {
             UpdateSkins();
-            skinManager.SourceChanged += UpdateSkins;
+            skinManager.SourceChanged += OnSourceChanged;
+        }
+
+        protected override void OnSourceChanged()
+        {
+            UpdateSkins();
+            base.OnSourceChanged();
         }

         protected virtual void UpdateSkins()


Add back actually needed change

Add back actually needed change

*no comment*

--- osu.Game/Tests/Visual/LegacySkinPlayerTestScene.cs
+++ osu.Game/Tests/Visual/LegacySkinPlayerTestScene.cs
@@ -12,6 +12,8 @@
     [TestFixture]
     public abstract class LegacySkinPlayerTestScene : PlayerTestScene
     {
+        protected LegacySkin LegacySkin { get; private set; }
+
         private ISkinSource legacySkinSource;

         protected override TestPlayer CreatePlayer(Ruleset ruleset) => new SkinProvidingPlayer(legacySkinSource);
@@ -19,8 +21,8 @@
         [BackgroundDependencyLoader]
         private void load(OsuGameBase game, SkinManager skins)
         {
-            var legacySkin = new DefaultLegacySkin(new NamespacedResourceStore<byte[]>(game.Resources, "Skins/Legacy"), skins);
-            legacySkinSource = new SkinProvidingContainer(legacySkin);
+            LegacySkin = new DefaultLegacySkin(new NamespacedResourceStore<byte[]>(game.Resources, "Skins/Legacy"), skins);
+            legacySkinSource = new SkinProvidingContainer(LegacySkin);
         }

         public class SkinProvidingPlayer : TestPlayer


Run startup downloads in separate thread to not block UI

--- EDDiscovery/EDDiscoveryForm.cs
+++ EDDiscovery/EDDiscoveryForm.cs
@@ -120,21 +120,39 @@
             {
                 travelHistoryControl1.Enabled = false;

-                Application.DoEvents();
-                GetRedWizzardFiles();
-                Application.DoEvents();
-                GetEDSCSystems();
-                Application.DoEvents();
+                var redWizzardThread = new Thread(GetRedWizzardFiles);
+                redWizzardThread.Name = "Downloading Red Wizzard Files";
+                var edscThread = new Thread(GetEDSCSystems);
+                edscThread.Name = "Downloading EDSC Systems";
+
+                redWizzardThread.Start();
+                edscThread.Start();
+
+                while (redWizzardThread.IsAlive || edscThread.IsAlive)
+                {
+                    Thread.Sleep(50);
+                    Application.DoEvents();
+                }
+
+                redWizzardThread.Join();
+                edscThread.Join();
+
+                //Application.DoEvents();
+                //GetRedWizzardFiles();
+                //Application.DoEvents();
+                //GetEDSCSystems();
+
+
+                //Application.DoEvents();
                 GetEDSCDistancesAsync();
-                Application.DoEvents();
+                //Application.DoEvents();
                 GetEDDBAsync();

+
                 if (SystemData.SystemList.Count == 0)
                 {
                     //sdata.ReadData();
                 }
-
-

@@ -174,7 +192,7 @@

             try
             {
-                TravelHistoryControl.LogText("Checking for new EDDiscovery data" + Environment.NewLine);
+                LogText("Checking for new EDDiscovery data" + Environment.NewLine);
                 string webstr =  web.DownloadString("http://robert.astronet.se/Elite/ed-systems/eddisc.php");

                 string[] filesizes = webstr.Split(' ');
@@ -186,12 +204,12 @@
             }
             catch (Exception ex)
             {
-                TravelHistoryControl.LogText("GetRedWizzardFiles exception:" + ex.Message + Environment.NewLine);
+                LogText("GetRedWizzardFiles exception:" + ex.Message + Environment.NewLine);
                 return;
             }
         }

-        private static void GetNewRedWizzardFile(string remotetgcsystemslen, string filename, string url)
+        private void GetNewRedWizzardFile(string remotetgcsystemslen, string filename, string url)
         {
             bool downloadfile = false;
             if (File.Exists(filename))
@@ -207,7 +225,8 @@
             {
                 WebClient webclient = new WebClient();

-                TravelHistoryControl.LogText("Downloading " + filename + " " +  (Convert.ToInt32(remotetgcsystemslen)/1000000.0).ToString("0.0") + "MB" + Environment.NewLine);
+                LogText("Downloading " + filename + " " +  (Convert.ToInt32(remotetgcsystemslen)/1000000.0).ToString("0.0") + "MB" + Environment.NewLine);
+
                 webclient.DownloadFile(url, filename + ".tmp");

                 if (File.Exists(filename))
@@ -231,7 +250,9 @@
                 string rwsysfiletime = "";

                 CommanderName = db.GetSettingString("CommanderName", "");
-                travelHistoryControl1.textBoxCmdrName.Text = CommanderName;
+                Invoke((MethodInvoker) delegate {
+                    travelHistoryControl1.textBoxCmdrName.Text = CommanderName;
+                });

                 json = LoadJsonArray(filetgcSystems);
@@ -244,7 +265,9 @@

                     db.PutSettingString("RWLastSystems", rwsysfiletime);
                     db.PutSettingString("EDSCLastSystems", rwsysfiletime);
-                    TravelHistoryControl.LogText("Adding data from tgcsystems.json " + Environment.NewLine);
+                    Invoke((MethodInvoker) delegate {
+                        TravelHistoryControl.LogText("Adding data from tgcsystems.json " + Environment.NewLine);
+                    });
                     SystemClass.Store(systems);
                 }

@@ -263,7 +286,9 @@
             }
             catch (Exception ex)
             {
-                TravelHistoryControl.LogText("GetEDSCSystems exception:" + ex.Message + Environment.NewLine);
+                Invoke((MethodInvoker) delegate {
+                    TravelHistoryControl.LogText("GetEDSCSystems exception:" + ex.Message + Environment.NewLine);
+                });
             }

         }


Lock screen rotation in QrCodePage

Lock screen rotation in QrCodePage

--- Locana/Pages/QrCodePage.xaml.cs
+++ Locana/Pages/QrCodePage.xaml.cs
@@ -51,7 +51,6 @@

         // Receive notifications about rotation of the UI and apply any necessary rotation to the preview stream
         private readonly DisplayInformation _displayInformation = DisplayInformation.GetForCurrentView();
-        private DisplayOrientations _displayOrientation = DisplayOrientations.Portrait;

         // Rotation metadata to apply to the preview stream (MF_MT_VIDEO_ROTATION)
         // Reference: http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh868174.aspx
@@ -73,9 +72,8 @@

         protected override async void OnNavigatedTo(NavigationEventArgs e)
         {
-            // Populate orientation variables with the current state and register for future changes
-            _displayOrientation = _displayInformation.CurrentOrientation;
-            _displayInformation.OrientationChanged += _displayInformation_OrientationChanged;
+            DisplayInformation.AutoRotationPreferences =
+                AnalyticsInfo.VersionInfo.DeviceFamily == DEVICE_FAMILY_MOBILE ? DisplayOrientations.Portrait : DisplayOrientations.Landscape;

             await InitializeCameraAsync();

@@ -109,26 +107,19 @@
             await SetPreviewRotationAsync();
         }

-        private async void _displayInformation_OrientationChanged(DisplayInformation sender, object args)
-        {
-            await SetPreviewRotationAsync();
-        }
-
-        private const string WINDOWS_DESKTOP = "Windows.Desktop";
+        private const string DEVCIE_FAMILY_DESKTOP = "Windows.Desktop";
+        private const string DEVICE_FAMILY_MOBILE = "Windows.Mobile";

         private async Task SetPreviewRotationAsync()
         {
-            // Populate orientation variables with the current state
-            _displayOrientation = _displayInformation.CurrentOrientation;
-
             // Calculate which way and how far to rotate the preview
-            int rotationDegrees = ConvertDisplayOrientationToDegrees(_displayOrientation);
+            int rotationDegrees = ConvertDisplayOrientationToDegrees(_displayInformation.CurrentOrientation);

             var props = _mediaCapture.VideoDeviceController.GetMediaStreamProperties(MediaStreamType.VideoPreview);
             props.Properties.Add(RotationKey, rotationDegrees);

             // On Desktop, this setting may stop some of webcams.
-            if (AnalyticsInfo.VersionInfo.DeviceFamily != WINDOWS_DESKTOP)
+            if (AnalyticsInfo.VersionInfo.DeviceFamily != DEVCIE_FAMILY_DESKTOP)
             {
                 await _mediaCapture.SetEncodingPropertiesAsync(MediaStreamType.VideoPreview, props, null);
             }
@@ -168,7 +159,7 @@

         protected override async void OnNavigatingFrom(NavigatingCancelEventArgs e)
         {
-            _displayInformation.OrientationChanged -= _displayInformation_OrientationChanged;
+            DisplayInformation.AutoRotationPreferences = DisplayOrientations.None;

             CaptureTimer?.Stop();
             FocusTimer?.Stop();
@@ -218,7 +209,6 @@
             Debug.WriteLine("MediaCapture_Failed: (0x{0:X}) {1}", errorEventArgs.Code, errorEventArgs.Message);

             await CleanupCameraAsync();
-
         }


Extended example documentation.

Extended example documentation.

--- Examples/CSharp/RunExamples.cs
+++ Examples/CSharp/RunExamples.cs
@@ -240,7 +240,6 @@

             // RescheduleProjectFromFinishDate.Run();
             // RescheduleProjectFromStartDate.Run();
-            // RescheduleProjectStartOrFinishDate.Run();
             // UpdateProjectAndRescheduleUncompletedWork.Run();

             // Working with Extended Attributes
@@ -275,7 +274,6 @@
             // =====================================================

             // ConfigureGanttChart.Run();
-            // ConfigureTheGanttChartViewShowSelectedColumnFields.Run();
             // CustomizeTimescaleTierLabels.Run();
             // ReadSpecificGanttChartViewData.Run();
             // SetTimeScaleCount.Run();


utökar ForumThread med ReplyId

utökar ForumThread med ReplyId

--- Flashback.Model/ForumThread.cs
+++ Flashback.Model/ForumThread.cs
@@ -9,6 +9,7 @@
         public int MaxPages { get; set; }
         public string PagenumberText => string.Format("{0}/{1}", CurrentPage, MaxPages);
         public string ParentId { get; set; }
-        public string Html { get; set; }
+        public string Html { get; set; }
+        public string ReplyId { get; set; }
     }
 }


fix SelectedItemChanged #2010

fix SelectedItemChanged #2010

--- MahApps.Metro/Controls/Pivot.cs
+++ MahApps.Metro/Controls/Pivot.cs
@@ -47,7 +47,9 @@
         public void GoToItem(PivotItem item)
         {
             if (item == null || item == selectedItem)
+            {
                 return;
+            }

             var widthToScroll = 0.0;
             int index;
@@ -70,10 +72,9 @@
             sb.Begin();

             RaiseEvent(new RoutedEventArgs(SelectionChangedEvent));
-
         }

-        void sb_Completed(object sender, EventArgs e)
+        private void sb_Completed(object sender, EventArgs e)
         {
             SelectedIndex = internalIndex;
         }
@@ -96,23 +97,25 @@
                 scroller.PreviewMouseWheel += scroller_MouseWheel;
             }
             if (headers != null)
+            {
                 headers.SelectionChanged += headers_SelectionChanged;
+            }
         }

-        void scroller_MouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e)
+        private void scroller_MouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e)
         {
             scroller.ScrollToHorizontalOffset(scroller.HorizontalOffset + -e.Delta);
         }

-        void headers_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        private void headers_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
             GoToItem((PivotItem)headers.SelectedItem);
         }

-        void scroller_ScrollChanged(object sender, ScrollChangedEventArgs e)
+        private void scroller_ScrollChanged(object sender, ScrollChangedEventArgs e)
         {
             var position = 0.0;
-            for (int i = 0; i < Items.Count; i++)
+            for (var i = 0; i < Items.Count; i++)
             {
                 var pivotItem = ((PivotItem)Items[i]);
                 var widthOfItem = pivotItem.ActualWidth;
@@ -133,14 +136,20 @@
             }
         }

-        private static void SelectedItemChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs)
+        private static void SelectedItemChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
         {
-            var p = (Pivot)dependencyObject;
-            if (p == null)
-                return;
-
-            if (p.internalIndex != p.SelectedIndex)
-                p.GoToItem((PivotItem)p.Items[(int)dependencyPropertyChangedEventArgs.NewValue]);
+            if (e.NewValue != e.OldValue)
+            {
+                var pivot = (Pivot)dependencyObject;
+                var newSelectedIndex = (int)e.NewValue;
+                if (pivot.internalIndex != pivot.SelectedIndex && newSelectedIndex >= 0 && newSelectedIndex < pivot.Items.Count)
+                {
+                    var pivotItem = (PivotItem)pivot.Items[newSelectedIndex];
+                    // set headers selected item too
+                    pivot.headers.SelectedItem = pivotItem;
+                    pivot.GoToItem(pivotItem);
+                }
+            }
         }
     }
-}
+}


Modified AttachmentCollection to implement IList instead of ICollection

--- MimeKit/AttachmentCollection.cs
+++ MimeKit/AttachmentCollection.cs
@@ -39,7 +39,7 @@
 	/// <remarks>
 	/// The <see cref="AttachmentCollection"/> is only used when building a message body with a <see cref="BodyBuilder"/>.
 	/// </remarks>
-	public class AttachmentCollection : ICollection<MimeEntity>
+	public class AttachmentCollection : IList<MimeEntity>
 	{
 		readonly List<MimeEntity> attachments;
 		readonly bool linked;
@@ -69,7 +69,7 @@
 		{
 		}

-		#region ICollection implementation
+		#region IList implementation

 		/// <summary>
 		/// Gets the number of attachments currently in the collection.
@@ -91,6 +91,38 @@
 		/// <value><c>true</c> if the collection is read only; otherwise, <c>false</c>.</value>
 		public bool IsReadOnly {
 			get { return false; }
+		}
+
+		/// <summary>
+		/// Gets or sets the <see cref="MimeKit.MimeEntity"/> at the specified index.
+		/// </summary>
+		/// <remarks>
+		/// Gets or sets the <see cref="MimeKit.MimeEntity"/> at the specified index.
+		/// </remarks>
+		/// <value>The attachment at the specified index.</value>
+		/// <param name="index">The index.</param>
+		/// <exception cref="System.ArgumentNullException">
+		/// <paramref name="value"/> is <c>null</c>.
+		/// </exception>
+		/// <exception cref="System.ArgumentOutOfRangeException">
+		/// <paramref name="index"/> is out of range.
+		/// </exception>
+		public MimeEntity this [int index] {
+			get {
+				if (index < 0 || index > Count)
+					throw new ArgumentOutOfRangeException ("index");
+
+				return attachments[index];
+			}
+			set {
+				if (index < 0 || index > Count)
+					throw new ArgumentOutOfRangeException ("index");
+
+				if (value == null)
+					throw new ArgumentNullException ("value");
+
+				attachments[index] = value;
+			}
 		}

 		void LoadContent (MimePart attachment, string fileName, Stream stream)
@@ -499,6 +531,50 @@
 		}

 		/// <summary>
+		/// Gets the index of the requested attachment, if it exists.
+		/// </summary>
+		/// <remarks>
+		/// Finds the index of the specified attachment, if it exists.
+		/// </remarks>
+		/// <returns>The index of the requested attachment; otherwise <value>-1</value>.</returns>
+		/// <param name="attachment">The attachment.</param>
+		/// <exception cref="System.ArgumentNullException">
+		/// <paramref name="attachment"/> is <c>null</c>.
+		/// </exception>
+		public int IndexOf (MimeEntity attachment)
+		{
+			if (attachment == null)
+				throw new ArgumentNullException ("attachment");
+
+			return attachments.IndexOf (attachment);
+		}
+
+		/// <summary>
+		/// Inserts the specified attachment at the given index.
+		/// </summary>
+		/// <remarks>
+		/// Inserts the attachment at the specified index.
+		/// </remarks>
+		/// <param name="index">The index to insert the attachment.</param>
+		/// <param name="attachment">The attachment.</param>
+		/// <exception cref="System.ArgumentNullException">
+		/// <paramref name="attachment"/> is <c>null</c>.
+		/// </exception>
+		/// <exception cref="System.ArgumentOutOfRangeException">
+		/// <paramref name="index"/> is out of range.
+		/// </exception>
+		public void Insert (int index, MimeEntity attachment)
+		{
+			if (index < 0 || index > Count)
+				throw new ArgumentOutOfRangeException ("index");
+
+			if (attachment == null)
+				throw new ArgumentNullException ("attachment");
+
+			attachments.Insert (index, attachment);
+		}
+
+		/// <summary>
 		/// Removes the specified attachment.
 		/// </summary>
 		/// <remarks>
@@ -515,6 +591,24 @@
 				throw new ArgumentNullException ("attachment");

 			return attachments.Remove (attachment);
+		}
+
+		/// <summary>
+		/// Removes the attachment at the specified index.
+		/// </summary>
+		/// <remarks>
+		/// Removes the attachment at the specified index.
+		/// </remarks>
+		/// <param name="index">The index.</param>
+		/// <exception cref="System.ArgumentOutOfRangeException">
+		/// <paramref name="index"/> is out of range.
+		/// </exception>
+		public void RemoveAt (int index)
+		{
+			if (index < 0 || index > Count)
+				throw new ArgumentOutOfRangeException ("index");
+
+			attachments.RemoveAt (index);
 		}

 		#endregion


Changed to v0.1.3.0.

Changed to v0.1.3.0.

--- Mini/Properties/AssemblyInfo.cs
+++ Mini/Properties/AssemblyInfo.cs
@@ -36,7 +36,7 @@
 // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
 // If the build and revision are set to '*' they will be updated automatically.

-[assembly: AssemblyVersion("0.1.2.0")]
+[assembly: AssemblyVersion("0.1.3.0")]

 // The following attributes are used to specify the signing key for the
 // assembly, if desired. See the Mono documentation for more information about


Fix setting text

Fix setting text

--- Server/Settings/Definition/SettingsDefinition.cs
+++ Server/Settings/Definition/SettingsDefinition.cs
@@ -21,7 +21,7 @@
         [XmlComment(Value = "Password for the server. Leave it empty if you want to make a public server. Max 30 chars")]
         public string Password { get; set; } = "";

-        [XmlComment(Value = "AdminPassword for the server. Leave it empty if you want to allow administration client side. Max 30 chars")]
+        [XmlComment(Value = "Admin password for the server. Leave it empty if you want to allow administration client side. Max 30 chars")]
         public string AdminPassword { get; set; } = "";

         [XmlComment(Value = "Specify the server's MOTD (message of the day). 255 chars max")]


fix high-pass filter parameters

fix high-pass filter parameters

--- Moria.UltraFXR/BfxrGenerator.cs
+++ Moria.UltraFXR/BfxrGenerator.cs
@@ -171,7 +171,7 @@

 			this.hpFilterPos = 0.0;
 			this.hpFilterCutoff = 0.1 * p.HPFilterCutoff * p.HPFilterCutoff;
-			this.hpFilterDeltaCutoff = 1.0 + 0.003 * p.HPFilterCutoffSweep;
+			this.hpFilterDeltaCutoff = 1.0 + 0.0003 * p.HPFilterCutoffSweep;

 			this.vibratoPhase = 0;
 			this.vibratoSpeed = 0.01 * p.VibratoSpeed * p.VibratoSpeed;


made analysis of project dependencies cancelable

--- Solutionizer/ViewModels/FileScanningViewModel.cs
+++ Solutionizer/ViewModels/FileScanningViewModel.cs
@@ -109,12 +109,20 @@
             ProgressText = "Analyzing project dependencies";

             // load project details asynchronously
-            Parallel.ForEach(_projects.Values, project => {
-                project.Load();
-                project.BrokenProjectReferences.AddRange(project.ProjectReferences.Where(path => !_projects.ContainsKey(path)));
-            });
-
-            return projectFolder;
+            var options = new ParallelOptions { CancellationToken = _cancellationToken };
+            try {
+                Parallel.ForEach(_projects.Values, options, project => {
+                    project.Load();
+                    project.BrokenProjectReferences.AddRange(project.ProjectReferences.Where(path => !_projects.ContainsKey(path)));
+                });
+            } catch (OperationCanceledException) {
+            }
+
+            if (_cancellationToken.IsCancellationRequested) {
+                return null;
+            } else {
+                return projectFolder;
+            }
         }

         private ProjectFolder CreateProjectFolder(string path, ProjectFolder parent) {


adding Surge of Regeneration tick messages (#2127)

--- Source/ACE.Server/Managers/EnchantmentManager.cs
+++ Source/ACE.Server/Managers/EnchantmentManager.cs
@@ -1291,6 +1291,9 @@
             // do healing
             var healAmount = creature.UpdateVitalDelta(creature.Health, (int)Math.Round(tickAmountTotal));
             creature.DamageHistory.OnHeal((uint)healAmount);
+
+            if (creature is Player player)
+                player.Session.Network.EnqueueSend(new GameMessageSystemChat($"You receive {healAmount} points of periodic healing.", ChatMessageType.Combat));
         }

         /// <summary>


Minor changes.

Minor changes.

--- Source/Main/NProxy.Core/Internal/Common/Cache.cs
+++ Source/Main/NProxy.Core/Internal/Common/Cache.cs
@@ -1,4 +1,4 @@
-//
+//
 // NProxy is a library for the .NET framework to create lightweight dynamic proxies.
 // Copyright © Martin Tamme
 //
@@ -53,12 +53,12 @@
         public TValue GetOrAdd(TKey key, Func<TKey, TValue> valueFactory)
         {
             TValue value;
-
+
             using (_lock.UpgradeableRead())
             {
                 if (_values.TryGetValue(key, out value))
                     return value;
-
+
                 using (_lock.Write())
                 {
                     if (_values.TryGetValue(key, out value))


TEST: Enable RosettaCode tests using Where-Object

--- Source/ReferenceTests/Integration/RosettaCode.cs
+++ Source/ReferenceTests/Integration/RosettaCode.cs
@@ -154,7 +154,7 @@
             Assert.AreEqual(expected, actual);
         }

-        [Test, Explicit("Where-Object not implemented")]
+        [Test, Explicit("Value '2008' can't be converted or casted to 'System.DateTime'")]
         // Taken from http://rosettacode.org/wiki/Day_of_the_week#PowerShell
         public void DayOfWeek()
         {
@@ -266,7 +266,7 @@
             Assert.AreEqual(expected, actual);
         }

-        [Test, Explicit("Where-Object not implemented")]
+        [Test]
         // Adapted from http://rosettacode.org/wiki/Factors_of_an_integer#PowerShell
         public void FactorsOfAnInteger1()
         {
@@ -280,7 +280,7 @@
             Assert.AreEqual(expected, actual);
         }

-        [Test, Explicit("Where-Object not implemented")]
+        [Test]
         // Adapted from http://rosettacode.org/wiki/Factors_of_an_integer#PowerShell
         public void FactorsOfAnInteger2()
         {
@@ -1001,7 +1001,7 @@
             Assert.AreEqual(expected, actual);
         }

-        [Test, Explicit("Where-Object not yet implemented")]
+        [Test]
         // Taken from http://rosettacode.org/wiki/Primality_by_trial_division#PowerShell
         public void PrimalityByTrialDivision()
         {
@@ -1198,7 +1198,7 @@
             Assert.AreEqual(expected, actual);
         }

-        [Test, Explicit("Where-Object not yet implemented")]
+        [Test]
         // Taken from http://rosettacode.org/wiki/Select_from_Array#PowerShell
         public void SelectFromArray()
         {


Added nice logo. More error handeling stuff.

--- Source/SharpBattleNet.BattleNetServer/Program.cs
+++ Source/SharpBattleNet.BattleNetServer/Program.cs
@@ -15,18 +15,36 @@
     using Ninject;
     using SharpBattleNet.Framework.Networking;
     using SharpBattleNet.Server.BattleNetServer;
+    using System.Diagnostics;

     internal static class Program
     {
         private static IKernel _injectionKernel = null;

+        private static void PrintHeader(Assembly currentAssembly)
+        {
+            Console.WriteLine(@"    _  _   ____        _   _   _         _   _      _    ");
+            Console.WriteLine(@"  _| || |_| __ )  __ _| |_| |_| | ___   | \ | | ___| |_  ");
+            Console.WriteLine(@" |_  .. _ |  _ \ / _` | __| __| |/ _ \  |  \| |/ _ \ __| ");
+            Console.WriteLine(@" |_      _| |_) | (_| | |_| |_| |  __/ _| |\  |  __/ |_  ");
+            Console.WriteLine(@"   |_||_| |____/ \__,_|\__|\__|_|\___(_)_ | \_|\___|\__| ");
+
+            Console.WriteLine();
+            Console.WriteLine("{0} - {1}", currentAssembly.GetAssemblyTitle(), currentAssembly.GetAssemblyFileVersion());
+            Console.WriteLine();
+
+            return;
+        }
+
         private static void Start(string[] commandArguments)
         {
             var currentAssembly = Assembly.GetExecutingAssembly();

-            Console.Title = String.Format("{0} - {1}", currentAssembly.GetAssemblyTitle(), currentAssembly.GetAssemblyFileVersion());
+            Console.Title = String.Format("{ 0} - {1}", currentAssembly.GetAssemblyTitle(), currentAssembly.GetAssemblyFileVersion());
             Console.WindowWidth = 120;
             Console.WindowHeight = 40;
+
+            PrintHeader(currentAssembly);

             _injectionKernel = new StandardKernel(new FrameworkModule("BattleNetServer"), new NetworkModule(), new BattleNetServerModule());

@@ -47,12 +65,12 @@

             Console.WriteLine("Press ENTER to continue...");

-            while(false == enterPressed)
+            while (false == enterPressed)
             {
-                if(true == Console.KeyAvailable)
+                if (true == Console.KeyAvailable)
                 {
                     lastKey = Console.ReadKey(true);
-                    if(lastKey.Key == ConsoleKey.Enter)
+                    if (lastKey.Key == ConsoleKey.Enter)
                     {
                         enterPressed = true;
                     }
@@ -62,11 +80,44 @@
             return;
         }

-        private static void Main(string[] args)
+        [Conditional("DEBUG")]
+        private static void DebugMain(string[] args)
         {
             Start(args);
             Pause();
             Stop();
+
+            return;
+        }
+
+        [Conditional("RELEASE")]
+        private static void ReleaseMain(string[] args)
+        {
+            try
+            {
+                Start(args);
+                Pause();
+                Stop();
+            }
+            catch (Exception ex)
+            {
+                Console.WriteLine("Internal server error:");
+                Console.WriteLine(" - {0}", ex.Message);
+
+                if (null != ex.InnerException)
+                {
+                    Console.WriteLine(" - {0}", ex.InnerException.Message);
+                }
+            }
+
+            return;
+        }
+
+        private static void Main(string[] args)
+        {
+            DebugMain(args);
+            ReleaseMain(args);
+
             return;
         }
     }


Modify handling of exception from DisplayMonitor

--- Source/UniversalSupplement/DisplayInformation.cs
+++ Source/UniversalSupplement/DisplayInformation.cs
@@ -58,6 +58,14 @@

 		#endregion

+		// System error code: 0x80070057 = 0x57 = ERROR_INVALID_PARAMETER
+		// Error message: The parameter is incorrect.
+		private const uint ERROR_INVALID_PARAMETER = 0x80070057;
+
+		// System error code: 0x8007001F = 0x1F = ERROR_GEN_FAILURE
+		// Error message: A device attached to the system is not functioning.
+		private const uint ERROR_GEN_FAILURE = 0x8007001F;
+
 		/// <summary>
 		/// Gets display monitor information.
 		/// </summary>
@@ -66,34 +74,44 @@
 		{
 			const string deviceInstanceIdKey = "System.Devices.DeviceInstanceId";

-			var devices = await DeviceInformation.FindAllAsync(DisplayMonitor.GetDeviceSelector(), new[] { deviceInstanceIdKey });
-			if (devices == null)
-				return Array.Empty<DisplayItem>();
+			try
+			{
+				var devices = await DeviceInformation.FindAllAsync(DisplayMonitor.GetDeviceSelector(), new[] { deviceInstanceIdKey });
+				if (devices?.Any() == true)
+				{
+					var items = new List<DisplayItem>(devices.Count);
+					foreach (var device in devices)
+					{
+						if (!device.Properties.TryGetValue(deviceInstanceIdKey, out object value))
+							continue;

-			var items = new List<DisplayItem>(devices.Count);
-			foreach (var device in devices)
+						var deviceInstanceId = value as string;
+						if (string.IsNullOrWhiteSpace(deviceInstanceId))
+							continue;
+
+						var displayMonitor = await DisplayMonitor.FromInterfaceIdAsync(device.Id);
+						//var displayMonitor = await DisplayMonitor.FromIdAsync(deviceInstanceId);
+
+						//Debug.WriteLine($"DeviceInstanceId: {deviceInstanceId}");
+						//Debug.WriteLine($"DeviceName: {device.Name}");
+						//Debug.WriteLine($"DisplayName: {displayMonitor.DisplayName}");
+						//Debug.WriteLine($"ConnectionKind: {displayMonitor.ConnectionKind}");
+
+						items.Add(new DisplayItem(
+							deviceInstanceId: deviceInstanceId,
+							displayName: displayMonitor.DisplayName,
+							isInternal: (displayMonitor.ConnectionKind == DisplayMonitorConnectionKind.Internal)));
+					}
+					return items.ToArray();
+				}
+			}
+			catch (ArgumentException ax) when ((uint)ax.HResult == ERROR_INVALID_PARAMETER)
 			{
-				if (!device.Properties.TryGetValue(deviceInstanceIdKey, out object value))
-					continue;
-
-				var deviceInstanceId = value as string;
-				if (string.IsNullOrWhiteSpace(deviceInstanceId))
-					continue;
-
-				var displayMonitor = await DisplayMonitor.FromInterfaceIdAsync(device.Id);
-				//var displayMonitor = await DisplayMonitor.FromIdAsync(deviceInstanceId);
-
-				//Debug.WriteLine($"DeviceInstanceId: {deviceInstanceId}");
-				//Debug.WriteLine($"DeviceName: {device.Name}");
-				//Debug.WriteLine($"DisplayName: {displayMonitor.DisplayName}");
-				//Debug.WriteLine($"ConnectionKind: {displayMonitor.ConnectionKind}");
-
-				items.Add(new DisplayItem(
-					deviceInstanceId: deviceInstanceId,
-					displayName: displayMonitor.DisplayName,
-					isInternal: (displayMonitor.ConnectionKind == DisplayMonitorConnectionKind.Internal)));
 			}
-			return items.ToArray();
+			catch (Exception ex) when ((uint)ex.HResult == ERROR_GEN_FAILURE)
+			{
+			}
+			return Array.Empty<DisplayItem>();
 		}
 	}
 }


Filter by the entire endpoint (#298)

Filter by the entire endpoint (#298)

I suspect this is a bug, if not please close this PR.

--- NBitcoin/Protocol/NodesGroup.cs
+++ NBitcoin/Protocol/NodesGroup.cs
@@ -50,7 +50,7 @@
 					var result = new byte[bytes.Length + port.Length];
 					Array.Copy(bytes, result, bytes.Length);
 					Array.Copy(port, 0, result, bytes.Length, port.Length);
-					return bytes;
+					return result;
 				});
 			}
 		}
@@ -289,4 +289,4 @@
 		#endregion
 	}
 }
-#endif+#endif