GH-87: Fix tests for networks module

GH-87: Fix tests for networks module

--- Source/Tests/TraktApiSharp.Tests/Modules/TraktNetworksModule/TraktNetworksModule_GetNetworks_Tests.cs
+++ Source/Tests/TraktApiSharp.Tests/Modules/TraktNetworksModule/TraktNetworksModule_GetNetworks_Tests.cs
@@ -15,15 +15,13 @@
     [Category("Modules.Networks")]
     public partial class TraktNetworksModule_Tests
     {
-        private const string GET_NETWORKS_URL = "networks";
+        private const string GET_NETWORKS_URI = "networks";

         [Fact]
-        public async Task Test_TraktNetworksModule_GetNetworksAsync()
+        public async Task Test_TraktNetworksModule_GetNetworks()
         {
-            TestUtility.SetupMockHttpClient();
-            TestUtility.SetupMockResponseWithoutOAuth(GET_NETWORKS_URL, GET_NETWORKS_JSON);
-
-            TraktListResponse<ITraktNetwork> response = await TestUtility.MOCK_TEST_CLIENT.Networks.GetNetworksAsync();
+            TraktClient client = TestUtility.GetMockClient(GET_NETWORKS_URI, GET_NETWORKS_JSON);
+            TraktListResponse<ITraktNetwork> response = await client.Networks.GetNetworksAsync();

             response.Should().NotBeNull();
             response.IsSuccess.Should().BeTrue();
@@ -39,168 +37,134 @@

             networks[1].Should().NotBeNull();
             networks[1].Network.Should().Be("The CW");
-
-            TestUtility.ResetMockHttpClient();
         }

         [Fact]
-        public void Test_TraktNetworksModule_GetNetworksAsync_Exceptions_NotFound()
+        public void Test_TraktNetworksModule_GetNetworks_Throws_NotFoundException()
         {
-            TestUtility.SetupMockHttpClient();
-            TestUtility.SetupMockResponseWithoutOAuth(GET_NETWORKS_URL, HttpStatusCode.NotFound);
-            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => TestUtility.MOCK_TEST_CLIENT.Networks.GetNetworksAsync();
+            TraktClient client = TestUtility.GetMockClient(GET_NETWORKS_URI, HttpStatusCode.NotFound);
+            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => client.Networks.GetNetworksAsync();
             act.Should().Throw<TraktNotFoundException>();
-            TestUtility.ResetMockHttpClient();
         }

         [Fact]
-        public void Test_TraktNetworksModule_GetNetworksAsync_Exceptions_Unauthorized()
+        public void Test_TraktNetworksModule_GetNetworks_Throws_AuthorizationException()
         {
-            TestUtility.SetupMockHttpClient();
-            TestUtility.SetupMockResponseWithoutOAuth(GET_NETWORKS_URL, HttpStatusCode.Unauthorized);
-            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => TestUtility.MOCK_TEST_CLIENT.Networks.GetNetworksAsync();
+            TraktClient client = TestUtility.GetMockClient(GET_NETWORKS_URI, HttpStatusCode.Unauthorized);
+            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => client.Networks.GetNetworksAsync();
             act.Should().Throw<TraktAuthorizationException>();
-            TestUtility.ResetMockHttpClient();
         }

         [Fact]
-        public void Test_TraktNetworksModule_GetNetworksAsync_Exceptions_BadRequest()
+        public void Test_TraktNetworksModule_GetNetworks_Throws_BadRequestException()
         {
-            TestUtility.SetupMockHttpClient();
-            TestUtility.SetupMockResponseWithoutOAuth(GET_NETWORKS_URL, HttpStatusCode.BadRequest);
-            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => TestUtility.MOCK_TEST_CLIENT.Networks.GetNetworksAsync();
+            TraktClient client = TestUtility.GetMockClient(GET_NETWORKS_URI, HttpStatusCode.BadRequest);
+            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => client.Networks.GetNetworksAsync();
             act.Should().Throw<TraktBadRequestException>();
-            TestUtility.ResetMockHttpClient();
         }

         [Fact]
-        public void Test_TraktNetworksModule_GetNetworksAsync_Exceptions_Forbidden()
+        public void Test_TraktNetworksModule_GetNetworks_Throws_ForbiddenException()
         {
-            TestUtility.SetupMockHttpClient();
-            TestUtility.SetupMockResponseWithoutOAuth(GET_NETWORKS_URL, HttpStatusCode.Forbidden);
-            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => TestUtility.MOCK_TEST_CLIENT.Networks.GetNetworksAsync();
+            TraktClient client = TestUtility.GetMockClient(GET_NETWORKS_URI, HttpStatusCode.Forbidden);
+            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => client.Networks.GetNetworksAsync();
             act.Should().Throw<TraktForbiddenException>();
-            TestUtility.ResetMockHttpClient();
         }

         [Fact]
-        public void Test_TraktNetworksModule_GetNetworksAsync_Exceptions_MethodNotAllowed()
+        public void Test_TraktNetworksModule_GetNetworks_Throws_MethodNotFoundException()
         {
-            TestUtility.SetupMockHttpClient();
-            TestUtility.SetupMockResponseWithoutOAuth(GET_NETWORKS_URL, HttpStatusCode.MethodNotAllowed);
-            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => TestUtility.MOCK_TEST_CLIENT.Networks.GetNetworksAsync();
+            TraktClient client = TestUtility.GetMockClient(GET_NETWORKS_URI, HttpStatusCode.MethodNotAllowed);
+            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => client.Networks.GetNetworksAsync();
             act.Should().Throw<TraktMethodNotFoundException>();
-            TestUtility.ResetMockHttpClient();
         }

         [Fact]
-        public void Test_TraktNetworksModule_GetNetworksAsync_Exceptions_Conflict()
+        public void Test_TraktNetworksModule_GetNetworks_Throws_ConflictException()
         {
-            TestUtility.SetupMockHttpClient();
-            TestUtility.SetupMockResponseWithoutOAuth(GET_NETWORKS_URL, HttpStatusCode.Conflict);
-            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => TestUtility.MOCK_TEST_CLIENT.Networks.GetNetworksAsync();
+            TraktClient client = TestUtility.GetMockClient(GET_NETWORKS_URI, HttpStatusCode.Conflict);
+            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => client.Networks.GetNetworksAsync();
             act.Should().Throw<TraktConflictException>();
-            TestUtility.ResetMockHttpClient();
         }

         [Fact]
-        public void Test_TraktNetworksModule_GetNetworksAsync_Exceptions_InternalServerError()
+        public void Test_TraktNetworksModule_GetNetworks_Throws_ServerException()
         {
-            TestUtility.SetupMockHttpClient();
-            TestUtility.SetupMockResponseWithoutOAuth(GET_NETWORKS_URL, HttpStatusCode.InternalServerError);
-            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => TestUtility.MOCK_TEST_CLIENT.Networks.GetNetworksAsync();
+            TraktClient client = TestUtility.GetMockClient(GET_NETWORKS_URI, HttpStatusCode.InternalServerError);
+            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => client.Networks.GetNetworksAsync();
             act.Should().Throw<TraktServerException>();
-            TestUtility.ResetMockHttpClient();
         }

         [Fact]
-        public void Test_TraktNetworksModule_GetNetworksAsync_Exceptions_BadGateway()
+        public void Test_TraktNetworksModule_GetNetworks_Throws_BadGatewayException()
         {
-            TestUtility.SetupMockHttpClient();
-            TestUtility.SetupMockResponseWithoutOAuth(GET_NETWORKS_URL, HttpStatusCode.BadGateway);
-            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => TestUtility.MOCK_TEST_CLIENT.Networks.GetNetworksAsync();
+            TraktClient client = TestUtility.GetMockClient(GET_NETWORKS_URI, HttpStatusCode.BadGateway);
+            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => client.Networks.GetNetworksAsync();
             act.Should().Throw<TraktBadGatewayException>();
-            TestUtility.ResetMockHttpClient();
         }

         [Fact]
-        public void Test_TraktNetworksModule_GetNetworksAsync_Exceptions_HttpStatusCode_412()
+        public void Test_TraktNetworksModule_GetNetworks_Throws_PreconditionFailedException()
         {
-            TestUtility.SetupMockHttpClient();
-            TestUtility.SetupMockResponseWithoutOAuth(GET_NETWORKS_URL, (HttpStatusCode)412);
-            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => TestUtility.MOCK_TEST_CLIENT.Networks.GetNetworksAsync();
+            TraktClient client = TestUtility.GetMockClient(GET_NETWORKS_URI, (HttpStatusCode)412);
+            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => client.Networks.GetNetworksAsync();
             act.Should().Throw<TraktPreconditionFailedException>();
-            TestUtility.ResetMockHttpClient();
         }

         [Fact]
-        public void Test_TraktNetworksModule_GetNetworksAsync_Exceptions_HttpStatusCode_422()
+        public void Test_TraktNetworksModule_GetNetworks_Throws_ValidationException()
         {
-            TestUtility.SetupMockHttpClient();
-            TestUtility.SetupMockResponseWithoutOAuth(GET_NETWORKS_URL, (HttpStatusCode)422);
-            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => TestUtility.MOCK_TEST_CLIENT.Networks.GetNetworksAsync();
+            TraktClient client = TestUtility.GetMockClient(GET_NETWORKS_URI, (HttpStatusCode)422);
+            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => client.Networks.GetNetworksAsync();
             act.Should().Throw<TraktValidationException>();
-            TestUtility.ResetMockHttpClient();
         }

         [Fact]
-        public void Test_TraktNetworksModule_GetNetworksAsync_Exceptions_HttpStatusCode_429()
+        public void Test_TraktNetworksModule_GetNetworks_Throws_RateLimitException()
         {
-            TestUtility.SetupMockHttpClient();
-            TestUtility.SetupMockResponseWithoutOAuth(GET_NETWORKS_URL, (HttpStatusCode)429);
-            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => TestUtility.MOCK_TEST_CLIENT.Networks.GetNetworksAsync();
+            TraktClient client = TestUtility.GetMockClient(GET_NETWORKS_URI, (HttpStatusCode)429);
+            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => client.Networks.GetNetworksAsync();
             act.Should().Throw<TraktRateLimitException>();
-            TestUtility.ResetMockHttpClient();
         }

         [Fact]
-        public void Test_TraktNetworksModule_GetNetworksAsync_Exceptions_HttpStatusCode_503()
+        public void Test_TraktNetworksModule_GetNetworks_Throws_ServerUnavailableException_503()
         {
-            TestUtility.SetupMockHttpClient();
-            TestUtility.SetupMockResponseWithoutOAuth(GET_NETWORKS_URL, (HttpStatusCode)503);
-            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => TestUtility.MOCK_TEST_CLIENT.Networks.GetNetworksAsync();
+            TraktClient client = TestUtility.GetMockClient(GET_NETWORKS_URI, (HttpStatusCode)503);
+            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => client.Networks.GetNetworksAsync();
             act.Should().Throw<TraktServerUnavailableException>();
-            TestUtility.ResetMockHttpClient();
         }

         [Fact]
-        public void Test_TraktNetworksModule_GetNetworksAsync_Exceptions_HttpStatusCode_504()
+        public void Test_TraktNetworksModule_GetNetworks_Throws_ServerUnavailableException_504()
         {
-            TestUtility.SetupMockHttpClient();
-            TestUtility.SetupMockResponseWithoutOAuth(GET_NETWORKS_URL, (HttpStatusCode)504);
-            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => TestUtility.MOCK_TEST_CLIENT.Networks.GetNetworksAsync();
+            TraktClient client = TestUtility.GetMockClient(GET_NETWORKS_URI, (HttpStatusCode)504);
+            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => client.Networks.GetNetworksAsync();
             act.Should().Throw<TraktServerUnavailableException>();
-            TestUtility.ResetMockHttpClient();
         }

         [Fact]
-        public void Test_TraktNetworksModule_GetNetworksAsync_Exceptions_HttpStatusCode_520()
+        public void Test_TraktNetworksModule_GetNetworks_Throws_ServerUnavailableException_520()
         {
-            TestUtility.SetupMockHttpClient();
-            TestUtility.SetupMockResponseWithoutOAuth(GET_NETWORKS_URL, (HttpStatusCode)520);
-            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => TestUtility.MOCK_TEST_CLIENT.Networks.GetNetworksAsync();
+            TraktClient client = TestUtility.GetMockClient(GET_NETWORKS_URI, (HttpStatusCode)520);
+            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => client.Networks.GetNetworksAsync();
             act.Should().Throw<TraktServerUnavailableException>();
-            TestUtility.ResetMockHttpClient();
         }

         [Fact]
-        public void Test_TraktNetworksModule_GetNetworksAsync_Exceptions_HttpStatusCode_521()
+        public void Test_TraktNetworksModule_GetNetworks_Throws_ServerUnavailableException_521()
         {
-            TestUtility.SetupMockHttpClient();
-            TestUtility.SetupMockResponseWithoutOAuth(GET_NETWORKS_URL, (HttpStatusCode)521);
-            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => TestUtility.MOCK_TEST_CLIENT.Networks.GetNetworksAsync();
+            TraktClient client = TestUtility.GetMockClient(GET_NETWORKS_URI, (HttpStatusCode)521);
+            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => client.Networks.GetNetworksAsync();
             act.Should().Throw<TraktServerUnavailableException>();
-            TestUtility.ResetMockHttpClient();
         }

         [Fact]
-        public void Test_TraktNetworksModule_GetNetworksAsync_Exceptions_HttpStatusCode_522()
+        public void Test_TraktNetworksModule_GetNetworks_Throws_ServerUnavailableException_522()
         {
-            TestUtility.SetupMockHttpClient();
-            TestUtility.SetupMockResponseWithoutOAuth(GET_NETWORKS_URL, (HttpStatusCode)522);
-            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => TestUtility.MOCK_TEST_CLIENT.Networks.GetNetworksAsync();
+            TraktClient client = TestUtility.GetMockClient(GET_NETWORKS_URI, (HttpStatusCode)522);
+            Func<Task<TraktListResponse<ITraktNetwork>>> act = () => client.Networks.GetNetworksAsync();
             act.Should().Throw<TraktServerUnavailableException>();
-            TestUtility.ResetMockHttpClient();
         }
     }
 }


add note to add team_id test later

add note to add team_id test later

--- Octokit.Tests.Integration/RepositoriesClientTests.cs
+++ Octokit.Tests.Integration/RepositoriesClientTests.cs
@@ -196,6 +196,8 @@
                 var repository = await github.Repository.Get(github.Credentials.Login, repoName);
                 Assert.Equal(repoName, repository.Name);
             }
+
+            // TODO: Add a test for the team_id param once an overload that takes an oranization is added
         }

         public class TheGetAsyncMethod


Fix a rare bug where updates would not appear

--- OpenKh.Tools.ModsManager/ViewModels/MainViewModel.cs
+++ OpenKh.Tools.ModsManager/ViewModels/MainViewModel.cs
@@ -403,6 +403,7 @@

         private async Task FetchUpdates()
         {
+            await Task.Delay(50); // fixes a bug where the UI wanted to refresh too soon
             await foreach (var modUpdate in ModsService.FetchUpdates())
             {
                 var mod = ModsList.FirstOrDefault(x => x.Source == modUpdate.Name);


Ensure that packet headers get parsed correctly

--- OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
+++ OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs
@@ -160,6 +160,8 @@

         public Socket Server { get { return null; } }

+        private int m_malformedCount = 0; // Guard against a spamming attack
+
         public LLUDPServer(IPAddress listenIP, ref uint port, int proxyPortOffsetParm, bool allow_alternate_port, IConfigSource configSource, AgentCircuitManager circuitManager)
             : base(listenIP, (int)port)
         {
@@ -612,6 +614,21 @@

             #region Decoding

+            if (buffer.DataLength < 7)
+                return; // Drop undersizd packet
+
+            int headerLen = 7;
+            if (buffer.Data[6] == 0xFF)
+            {
+                if (buffer.Data[7] == 0xFF)
+                    headerLen = 10;
+                else
+                    headerLen = 8;
+            }
+
+            if (buffer.DataLength < headerLen)
+                return; // Malformed header
+
             try
             {
                 packet = Packet.BuildPacket(buffer.Data, ref packetEnd,
@@ -620,6 +637,18 @@
             }
             catch (MalformedDataException)
             {
+            }
+            catch (IndexOutOfRangeException)
+            {
+                return; // Drop short packet
+            }
+            catch(Exception e)
+            {
+                if (m_malformedCount < 100)
+                    m_log.DebugFormat("[LLUDPSERVER]: Dropped malformed packet: " + e.ToString());
+                m_malformedCount++;
+                if ((m_malformedCount % 100000) == 0)
+                    m_log.DebugFormat("[LLUDPSERVER]: Received {0} malformed packets so far, probable network attack.", m_malformedCount);
             }

             // Fail-safe check


Add test coverage for auto-unbind of auto properties

--- osu.Framework.Tests/Bindables/BindableBindingTest.cs
+++ osu.Framework.Tests/Bindables/BindableBindingTest.cs
@@ -377,7 +377,7 @@
         }

         [Test]
-        public void TestUnbindOnDrawableDisposeProperty()
+        public void TestUnbindOnDrawableDoNotDisposeDelegatingProperty()
         {
             var bindable = new Bindable<int>();

@@ -397,6 +397,23 @@

             drawable.SetValue(3);
             Assert.IsTrue(valueChanged, "bound correctly");
+        }
+
+        [Test]
+        public void TestUnbindOnDrawableDisposeAutoProperty()
+        {
+            bool valueChanged = false;
+            var drawable = new TestDrawable3();
+            drawable.Bindable.ValueChanged += _ => valueChanged = true;
+
+            drawable.Bindable.Value = 1;
+            Assert.IsTrue(valueChanged, "bound correctly");
+
+            drawable.Dispose();
+            valueChanged = false;
+
+            drawable.Bindable.Value = 2;
+            Assert.IsFalse(valueChanged, "unbound correctly");
         }

         [Test]
@@ -501,5 +518,16 @@

             public void SetValue(int value) => bindable.Value = value;
         }
+
+        private class TestDrawable3 : Drawable
+        {
+            public Bindable<int> Bindable { get; } = new Bindable<int>();
+
+            public TestDrawable3()
+            {
+                // because we are run outside of a game instance but need the cached disposal methods.
+                Load(new FramedClock(), new DependencyContainer());
+            }
+        }
     }
 }


Fix shadow colour/shadow alpha not working

--- osu.Framework/Graphics/Sprites/SpriteTextDrawNode.cs
+++ osu.Framework/Graphics/Sprites/SpriteTextDrawNode.cs
@@ -3,6 +3,7 @@

 using System;
 using System.Collections.Generic;
+using osu.Framework.Graphics.Colour;
 using osu.Framework.Graphics.OpenGL;
 using osu.Framework.Graphics.OpenGL.Vertices;
 using osu.Framework.Graphics.Shaders;
@@ -16,7 +17,7 @@
         internal SpriteTextDrawNodeSharedData Shared;

         public bool Shadow;
-        public Color4 ShadowColour;
+        public ColourInfo ShadowColour;
         public Vector2 ShadowOffset;

         internal readonly List<ScreenSpaceCharacterPart> Parts = new List<ScreenSpaceCharacterPart>();
@@ -31,13 +32,18 @@

             shader.Bind();

+            var avgColour = (Color4)DrawInfo.Colour.AverageColour;
+            float shadowAlpha = (float)Math.Pow(Math.Max(Math.Max(avgColour.R, avgColour.G), avgColour.B), 2);
+
+            //adjust shadow alpha based on highest component intensity to avoid muddy display of darker text.
+            //squared result for quadratic fall-off seems to give the best result.
+            var shadowColour = DrawInfo.Colour;
+            shadowColour.ApplyChild(ShadowColour.MultiplyAlpha(shadowAlpha));
+
             for (int i = 0; i < Parts.Count; i++)
             {
                 if (Shadow)
                 {
-                    var shadowColour = DrawInfo.Colour;
-                    shadowColour.ApplyChild(ShadowColour);
-
                     var shadowQuad = Parts[i].DrawQuad;
                     shadowQuad.TopLeft += ShadowOffset;
                     shadowQuad.TopRight += ShadowOffset;


Temporarily removed test cases

Temporarily removed test cases

I did this to try to figure out what was failing on pull requests

--- osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs
+++ osu.Game.Tests/Visual/Online/TestSceneChatOverlay.cs
@@ -219,70 +219,6 @@
             AddStep("Release Shift", () => InputManager.ReleaseKey(Key.ShiftLeft));
         }

-        public void TestCtrlShiftTShortcut1()
-        {
-            AddStep("Join 2 channels", () =>
-            {
-                channelManager.JoinChannel(channel1);
-                channelManager.JoinChannel(channel2);
-            });
-
-            // Close channel 2
-            AddStep("Select channel 2", () => clickDrawable(chatOverlay.TabMap[channel2]));
-            AddStep("Click channel 2 close button", () => clickDrawable(((TestPrivateChannelTabItem)chatOverlay.TabMap[channel2]).CloseButton.Child));
-            AddAssert("channel 1 open", () => channelManager.JoinedChannels.Contains(channel1));
-            AddAssert("channel 2 closed", () => !channelManager.JoinedChannels.Contains(channel2));
-
-            pressControlShiftT();
-
-            // Channel 2 should now be open again
-            AddAssert("channel 1 open", () => channelManager.JoinedChannels.Contains(channel1));
-            AddAssert("channel 2 open", () => channelManager.JoinedChannels.Contains(channel2));
-        }
-
-        public void TestCtrlShiftTShortcut2()
-        {
-            AddStep("Join 2 channels", () =>
-            {
-                channelManager.JoinChannel(channel1);
-                channelManager.JoinChannel(channel2);
-            });
-
-            // Close channels 1 and channel 2
-            AddStep("Select channel 2", () => clickDrawable(chatOverlay.TabMap[channel2]));
-            AddStep("Click channel 2 close button", () => clickDrawable(((TestPrivateChannelTabItem)chatOverlay.TabMap[channel2]).CloseButton.Child));
-
-            AddStep("Select channel 1", () => clickDrawable(chatOverlay.TabMap[channel1]));
-            AddStep("Click channel 1 close button", () => clickDrawable(((TestPrivateChannelTabItem)chatOverlay.TabMap[channel1]).CloseButton.Child));
-
-            AddAssert("All channels closed", () => !channelManager.JoinedChannels.Any();
-
-            pressControlShiftT();
-            // Channel 1 should now be open again. Channel 2 should not
-            AddAssert("channel 1 open", () => channelManager.JoinedChannels.Contains(channel1));
-            AddAssert("channel 2 closed", () => !channelManager.JoinedChannels.Contains(channel2));
-
-            pressControlShiftT();
-
-            // Both Channel 1 and Channel 2 should be open
-            AddAssert("channel 1 open", () => channelManager.JoinedChannels.Contains(channel1));
-            AddAssert("channel 2 open", () => channelManager.JoinedChannels.Contains(channel2));
-
-            // Processing this again should have not effect
-            pressControlShiftT();
-            AddAssert("channel 1 open", () => channelManager.JoinedChannels.Contains(channel1));
-            AddAssert("channel 2 open", () => channelManager.JoinedChannels.Contains(channel2));
-
-            // Close channel 2 again
-            AddStep("Select channel 2", () => clickDrawable(chatOverlay.TabMap[channel2]));
-            AddStep("Click channel 2 close button", () => clickDrawable(((TestPrivateChannelTabItem)chatOverlay.TabMap[channel2]).CloseButton.Child));
-
-            // Both channel 1 and channel 2 should be open
-            pressControlShiftT();
-            AddAssert("channel 1 open", () => channelManager.JoinedChannels.Contains(channel1));
-            AddAssert("channel 2 open", () => channelManager.JoinedChannels.Contains(channel2));
-        }
-
         private void pressChannelHotkey(int number)
         {
             var channelKey = Key.Number0 + number;


Fix method return

Fix method return

--- osu.Framework.Tests/Input/KeyboardInputTest.cs
+++ osu.Framework.Tests/Input/KeyboardInputTest.cs
@@ -75,10 +75,10 @@
                 return KeyDown?.Invoke() ?? false;
             }

-            protected override bool OnKeyUp(KeyUpEvent e)
+            protected override void OnKeyUp(KeyUpEvent e)
             {
                 UpReceived = true;
-                return KeyUp?.Invoke() ?? false;
+                KeyUp?.Invoke();
             }
         }
     }


Use FadeColour in Button

Use FadeColour in Button

--- osu.Framework/Graphics/UserInterface/Button.cs
+++ osu.Framework/Graphics/UserInterface/Button.cs
@@ -24,7 +24,7 @@
         public Color4 BackgroundColour
         {
             get { return Background.Colour; }
-            set { Background.Colour = value; }
+            set { Background.FadeColour(value); }
         }

         protected override Container<Drawable> Content => content;


Use Interpolation.ValueAt instead of manually interpolating FL position.

--- osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs
+++ osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs
@@ -37,7 +37,6 @@
         private class OsuFlashlight : Flashlight, IRequireHighFrequencyMousePosition
         {
             private const double follow_delay = 120;
-            private double lastPositionUpdate;

             public OsuFlashlight()
             {
@@ -55,13 +54,8 @@
                 var position = FlashlightPosition;
                 var destination = e.MousePosition;

-                double frameTime = Clock.CurrentTime - lastPositionUpdate;
-                double interp = Interpolation.ApplyEasing(Easing.Out, MathHelper.Clamp(frameTime / follow_delay, 0, 1));
-                FlashlightPosition = new Vector2(
-                    (float)Interpolation.Lerp(position.X, destination.X, interp),
-                    (float)Interpolation.Lerp(position.Y, destination.Y, interp)
-                );
-                lastPositionUpdate = Clock.CurrentTime;
+                FlashlightPosition = Interpolation.ValueAt(MathHelper.Clamp(Clock.ElapsedFrameTime, 0, follow_delay), position, destination, 0, follow_delay, Easing.Out);
+
                 return base.OnMouseMove(e);
             }


Add follow delay setting to osu! flashlight mod

--- osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs
+++ osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs
@@ -9,10 +9,12 @@
 using osu.Framework.Input;
 using osu.Framework.Input.Events;
 using osu.Framework.Utils;
+using osu.Game.Configuration;
 using osu.Game.Rulesets.Mods;
 using osu.Game.Rulesets.Objects.Drawables;
 using osu.Game.Rulesets.Osu.Objects;
 using osu.Game.Rulesets.Osu.Objects.Drawables;
+using osu.Game.Rulesets.UI;
 using osuTK;

 namespace osu.Game.Rulesets.Osu.Mods
@@ -22,6 +24,8 @@
         public override double ScoreMultiplier => 1.12;

         private const float default_flashlight_size = 180;
+
+        private const double default_follow_delay = 120;

         private OsuFlashlight flashlight;

@@ -35,8 +39,25 @@
             }
         }

+        public override void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset)
+        {
+            base.ApplyToDrawableRuleset(drawableRuleset);
+
+            flashlight.FollowDelay = FollowDelay.Value;
+        }
+
+        [SettingSource("Follow delay", "Milliseconds until the flashlight reaches the cursor")]
+        public BindableNumber<double> FollowDelay { get; } = new BindableDouble(default_follow_delay)
+        {
+            MinValue = default_follow_delay,
+            MaxValue = default_follow_delay * 10,
+            Precision = default_follow_delay,
+        };
+
         private class OsuFlashlight : Flashlight, IRequireHighFrequencyMousePosition
         {
+            public double FollowDelay { private get; set; }
+
             public OsuFlashlight()
             {
                 FlashlightSize = new Vector2(0, getSizeFor(0));
@@ -50,13 +71,11 @@

             protected override bool OnMouseMove(MouseMoveEvent e)
             {
-                const double follow_delay = 120;
-
                 var position = FlashlightPosition;
                 var destination = e.MousePosition;

                 FlashlightPosition = Interpolation.ValueAt(
-                    Math.Min(Math.Abs(Clock.ElapsedFrameTime), follow_delay), position, destination, 0, follow_delay, Easing.Out);
+                    Math.Min(Math.Abs(Clock.ElapsedFrameTime), FollowDelay), position, destination, 0, FollowDelay, Easing.Out);

                 return base.OnMouseMove(e);
             }


Split magic values into named constants

Split magic values into named constants

--- osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs
+++ osu.Game.Rulesets.Taiko/Mods/TaikoModHidden.cs
@@ -18,6 +18,18 @@
         public override string Description => @"Beats fade out before you hit them!";
         public override double ScoreMultiplier => 1.06;

+        /// <summary>
+        /// How far away from the hit target should hitobjects start to fade out.
+        /// Range: [0, 1]
+        /// </summary>
+        private const float fade_out_start_time = 0.6f;
+
+        /// <summary>
+        /// How long hitobjects take to fade out, in terms of the scrolling length.
+        /// Range: [0, 1]
+        /// </summary>
+        private const float fade_out_duration = 0.3f;
+
         private DrawableTaikoRuleset drawableRuleset;

         public void ApplyToDrawableRuleset(DrawableRuleset<TaikoHitObject> drawableRuleset)
@@ -37,8 +49,8 @@
                 case DrawableDrumRollTick _:
                 case DrawableHit _:
                     double preempt = drawableRuleset.TimeRange.Value / drawableRuleset.ControlPointAt(hitObject.HitObject.StartTime).Multiplier;
-                    double start = hitObject.HitObject.StartTime - preempt * 0.6;
-                    double duration = preempt * 0.3;
+                    double start = hitObject.HitObject.StartTime - preempt * fade_out_start_time;
+                    double duration = preempt * fade_out_duration;

                     using (hitObject.BeginAbsoluteSequence(start))
                     {


Fix removing selected items in ListBoxPage.

Previously, would remove all items if `AlwaysSelected` enabled.

--- samples/ControlCatalog/ViewModels/ListBoxPageViewModel.cs
+++ samples/ControlCatalog/ViewModels/ListBoxPageViewModel.cs
@@ -38,9 +38,11 @@

             RemoveItemCommand = ReactiveCommand.Create(() =>
             {
-                while (Selection.Count > 0)
+                var items = Selection.SelectedItems.ToList();
+
+                foreach (var item in items)
                 {
-                    Items.Remove(Selection.SelectedItems.First());
+                    Items.Remove(item);
                 }
             });


Add missing schedule call

Add missing schedule call

--- osu.Game/Overlays/Toolbar/ToolbarUserButton.cs
+++ osu.Game/Overlays/Toolbar/ToolbarUserButton.cs
@@ -58,7 +58,7 @@
             StateContainer = login;
         }

-        private void onlineStateChanged(ValueChangedEvent<APIState> state)
+        private void onlineStateChanged(ValueChangedEvent<APIState> state) => Schedule(() =>
         {
             switch (state.NewValue)
             {
@@ -72,6 +72,6 @@
                     avatar.User = api.LocalUser.Value;
                     break;
             }
-        }
+        });
     }
 }


Fixed some stupid mistakes in algorithm.

--- src/Avalonia.Layout/LayoutManager.cs
+++ src/Avalonia.Layout/LayoutManager.cs
@@ -129,13 +129,13 @@
                 Measure(parent);
             }

-            if (!control.IsMeasureValid)
+            if (!control.IsMeasureValid && control.IsAttachedToVisualTree)
             {
                 if (control is ILayoutRoot root)
                 {
                     root.Measure(Size.Infinity);
                 }
-                else if (!control.IsMeasureValid && control.IsAttachedToVisualTree)
+                else
                 {
                     control.Measure(control.PreviousMeasure.Value);
                 }
@@ -151,13 +151,13 @@
                 Arrange(parent);
             }

-            if (!control.IsArrangeValid)
+            if (!control.IsArrangeValid && control.IsAttachedToVisualTree)
             {
                 if (control is ILayoutRoot root)
                 {
                     root.Arrange(new Rect(control.DesiredSize));
                 }
-                else if (!control.IsArrangeValid && control.IsAttachedToVisualTree)
+                else
                 {
                     control.Arrange(control.PreviousArrange.Value);
                 }


Get glyph's width via GlyphTypeface

Get glyph's width via GlyphTypeface

--- src/AvaloniaEdit/Text/TextLineRun.cs
+++ src/AvaloniaEdit/Text/TextLineRun.cs
@@ -112,7 +112,10 @@
                 return new TextLineRun(textRun.Length, textRun)
                 {
                     IsEmbedded = true,
-                    _glyphWidths = new GlyphWidths(stringRange, textRun.Properties.Typeface, textRun.Properties.FontSize),
+                    _glyphWidths = new GlyphWidths(
+                        stringRange,
+                        textRun.Properties.Typeface.GlyphTypeface,
+                        textRun.Properties.FontSize),
                     // Embedded objects must propagate their width to the container.
                     // Otherwise text runs after the embedded object are drawn at the same x position.
                     Width = width
@@ -165,7 +168,10 @@
                 Width = 40
             };

-            run._glyphWidths = new GlyphWidths(run.StringRange, run.Typeface, run.FontSize);
+            run._glyphWidths = new GlyphWidths(
+                run.StringRange,
+                run.Typeface.GlyphTypeface,
+                run.FontSize);

             return run;
         }
@@ -195,7 +201,10 @@

             run.Width = size.Width;

-            run._glyphWidths = new GlyphWidths(run.StringRange, run.Typeface, run.FontSize);
+            run._glyphWidths = new GlyphWidths(
+                run.StringRange,
+                run.Typeface.GlyphTypeface,
+                run.FontSize);

             return run;
         }
@@ -337,17 +346,17 @@
         {
             private const double NOT_CALCULATED_YET = -1;
             private double[] _glyphWidths;
-            private Typeface _typeFace;
-            private double _fontSize;
+            private GlyphTypeface _typeFace;
             private StringRange _range;
-
-            internal GlyphWidths(StringRange range, Typeface typeFace, double fontSize)
-            {
+            private double _scale;
+
+            internal GlyphWidths(StringRange range, GlyphTypeface typeFace, double fontSize)
+            {
+                _range = range;
                 _typeFace = typeFace;
-                _fontSize = fontSize;
-                _range = range;
-
-                _glyphWidths = InitGlyphWidths();
+                _scale = fontSize / _typeFace.DesignEmHeight;
+
+                InitGlyphWidths();
             }

             internal double GetAt(int index)
@@ -360,29 +369,26 @@

             double MeasureGlyphAt(int index)
             {
-                return new FormattedText
-                {
-                    Text = _range[index].ToString(),
-                    Typeface = _typeFace,
-                    FontSize = _fontSize,
-                }.Bounds.Width;
-            }
-
-            double[] InitGlyphWidths()
+                return _typeFace.GetGlyphAdvance(
+                    _typeFace.GetGlyph(_range[index])) * _scale;
+            }
+
+            void InitGlyphWidths()
             {
                 int capacity = _range.Length;

                 bool useCheapGlyphMeasurement =
                     capacity >= VisualLine.LENGTH_LIMIT &&
-                    _typeFace.GlyphTypeface.IsFixedPitch;
+                    _typeFace.IsFixedPitch;

                 if (useCheapGlyphMeasurement)
                 {
                     double size = MeasureGlyphAt(0);
-                    return Enumerable.Repeat<double>(size, capacity).ToArray();
-                }
-
-                return Enumerable.Repeat<double>(NOT_CALCULATED_YET, capacity).ToArray();
+                    _glyphWidths = Enumerable.Repeat<double>(size, capacity).ToArray();
+                    return;
+                }
+
+                _glyphWidths = Enumerable.Repeat<double>(NOT_CALCULATED_YET, capacity).ToArray();
             }
         }
     }


moved field.state to last place in CustomField constructor

--- ScriptLinkMaster.CustomEntities/CustomFieldObject.cs
+++ ScriptLinkMaster.CustomEntities/CustomFieldObject.cs
@@ -66,10 +66,10 @@
         public FieldState FieldState { get; set; }
         public CustomFieldObject()
         {
-            FieldState = FieldState.Unchanged;
             LockedStatus = LockedStatus.Unlocked;
             RequiredStatus = RequiredStatus.Unrequired;
             EnabledStatus = EnabledStatus.Enabled;
+            FieldState = FieldState.Unchanged;
         }
         protected virtual void UpdateFieldState()
         {


add key_type/value_type attribute in root element

--- SerializableDictionaryTest/SerializableDictionary.cs
+++ SerializableDictionaryTest/SerializableDictionary.cs
@@ -57,6 +57,12 @@
         }

         public void ReadXml(XmlReader reader) {
+            var keyTypeName = reader.GetAttribute(keyTypeAttributeName);
+            var valueTypeName = reader.GetAttribute(valueTypeAttributeName);
+            if (keyTypeName != typeof(TKey).Name || valueTypeName != typeof(TValue).Name) {
+                throw new XmlException("key_type/value_type mismatch");
+            }
+
             switch (SerializeType) {
                 case SerializeTypes.Element_Element:
                     read_Element_Element(reader);
@@ -74,6 +80,9 @@
         }

         public void WriteXml(XmlWriter writer) {
+            writer.WriteAttributeString(keyTypeAttributeName, typeof(TKey).Name);
+            writer.WriteAttributeString(valueTypeAttributeName, typeof(TValue).Name);
+
             switch (SerializeType) {
                 case SerializeTypes.Element_Element:
                     write_Element_Element(writer);


BL-1136 Leave update "toast" visible after update ready

It seems disabling a timer is not enough to prevent it ticking

--- src/BloomExe/MiscUI/ToastNotifier.cs
+++ src/BloomExe/MiscUI/ToastNotifier.cs
@@ -24,6 +24,7 @@
 		private Timer _pauseTimer;
 		private int startPosX;
 		private int startPosY;
+		private bool _stayUp;

 		/// <summary>
 		/// The user clicked on the toast popup
@@ -94,7 +95,8 @@
 			if (startPosY < Screen.PrimaryScreen.WorkingArea.Height - Height)
 			{
 				_goUpTimer.Stop();
-				_pauseTimer.Start();
+				if(!_stayUp)
+					_pauseTimer.Start();
 			}
 			else
 				SetDesktopLocation(startPosX, startPosY);
@@ -137,7 +139,7 @@
 			_callToAction.Text = callToAction;
 			if (seconds < 0)
 			{
-				_pauseTimer.Enabled = false; //just leave it up permanently
+				_stayUp = true; //just leave it up permanently
 			}
 			else
 			{


ajuste geraçae remessa 240

ajuste geraçae remessa 240

--- src/Boleto.Net/Banco/Banco_Brasil.cs
+++ src/Boleto.Net/Banco/Banco_Brasil.cs
@@ -1646,7 +1646,7 @@
                 _header += "0014";
                 _header += Utils.FitStringLength(cedente.Carteira.ToString(), 2, 2, '0', 0, true, true, true);  // Carteira
                 _header += "019";  // Variao da Carteira
-                _header += " ";
+                _header += "  ";
                 _header += Utils.FitStringLength(cedente.ContaBancaria.Agencia, 5, 5, '0', 0, true, true, true);
                 _header += Utils.FitStringLength(cedente.ContaBancaria.DigitoAgencia, 1, 1, ' ', 0, true, true, false);
                 _header += Utils.FitStringLength(cedente.ContaBancaria.Conta, 12, 12, '0', 0, true, true, true);
@@ -1671,7 +1671,7 @@
                 _header += _brancos20;
                 _header += _brancos10;
                 _header += "    ";
-                _header += "000  ";
+                _header += "     ";
                 _header += _brancos10;

                 _header = Utils.SubstituiCaracteresEspeciais(_header);


Add call v1.7. Close #71

Add call v1.7. Close #71

--- src/tarantool.client/Box.cs
+++ src/tarantool.client/Box.cs
@@ -82,11 +82,10 @@
             return new Schema(_logicalConnection);
         }

-        public async Task<DataResponse<TResponse[]>> Call_16<TResponse>(string functionName)
+        public Task<DataResponse<TResponse[]>> Call_16<TResponse>(string functionName)
             where TResponse : ITarantoolTuple
         {
-            var callRequest = new CallRequest<TarantoolTuple>(functionName, new TarantoolTuple(), false);
-            return await _logicalConnection.SendRequest<CallRequest<TarantoolTuple>, TResponse>(callRequest);
+            return Call_16<TarantoolTuple, TResponse>(functionName, new TarantoolTuple());
         }

         public async Task<DataResponse<TResponse[]>> Call_16<TTuple, TResponse>(string functionName, TTuple request)
@@ -94,6 +93,20 @@
             where TResponse : ITarantoolTuple
         {
             var callRequest = new CallRequest<TTuple>(functionName, request, false);
+            return await _logicalConnection.SendRequest<CallRequest<TTuple>, TResponse>(callRequest);
+        }
+
+        public Task<DataResponse<TResponse[]>> Call<TResponse>(string functionName)
+            where TResponse : ITarantoolTuple
+        {
+            return Call<TarantoolTuple, TResponse>(functionName, new TarantoolTuple());
+        }
+
+        public async Task<DataResponse<TResponse[]>> Call<TTuple, TResponse>(string functionName, TTuple request)
+            where TTuple : ITarantoolTuple
+            where TResponse : ITarantoolTuple
+        {
+            var callRequest = new CallRequest<TTuple>(functionName, request);
             return await _logicalConnection.SendRequest<CallRequest<TTuple>, TResponse>(callRequest);
         }


- Adding non-function Task-based methods for SemaphoreSlim.WaitAndRelease()

--- StreamingClient.Base/Util/SemaphoreSlimExtensions.cs
+++ StreamingClient.Base/Util/SemaphoreSlimExtensions.cs
@@ -9,6 +9,43 @@
     /// </summary>
     public static class SemaphoreSlimExtensions
     {
+        /// <summary>
+        /// Awaits on a semaphore, awaits the specified task, & then releases the semaphore.
+        /// </summary>
+        /// <param name="semaphore">The semaphore to await on</param>
+        /// <param name="task">The task to await</param>
+        /// <returns>An awaitable task</returns>
+        public static async Task WaitAndRelease(this SemaphoreSlim semaphore, Task task)
+        {
+            try
+            {
+                await semaphore.WaitAsync();
+
+                await task;
+            }
+            catch (Exception ex) { Logger.Log(ex); }
+            finally { semaphore.Release(); }
+        }
+
+        /// <summary>
+        /// Awaits on a semaphore, awaits the specified task, & then releases the semaphore.
+        /// </summary>
+        /// <param name="semaphore">The semaphore to await on</param>
+        /// <param name="task">The task to await</param>
+        /// <returns>An awaitable task of type T</returns>
+        public static async Task<T> WaitAndRelease<T>(this SemaphoreSlim semaphore, Task<T> task)
+        {
+            try
+            {
+                await semaphore.WaitAsync();
+
+                return await task;
+            }
+            catch (Exception ex) { Logger.Log(ex); }
+            finally { semaphore.Release(); }
+            return default(T);
+        }
+
         /// <summary>
         /// Awaits on a semaphore, runs the specified function, & then releases the semaphore.
         /// </summary>


removing pinch and zoom code

removing pinch and zoom code

--- lib/Appium/AppiumDriver.cs
+++ lib/Appium/AppiumDriver.cs
@@ -554,49 +554,6 @@

         #region Multi Actions

-//        #region Pinch
-//        /// <summary>
-//        /// Pinch at the specified region
-//        /// </summary>
-//        /// <param name="x">x screen location</param>
-//        /// <param name="y">y screen location</param>
-//        public void Pinch(int x, int y)
-//        {
-//            var touchAction1 = new TouchActions(this);
-//            touchAction1.Down(x, y - 100).Move(x, y).Up(x, y);
-//
-//            var touchAction2 = new TouchActions(this);
-//            touchAction2.Down(x, y + 100).Move(x, y).Up(x, y);
-//
-//            var multiTouchAction = new MultiTouchAction(this);
-//            multiTouchAction.Add(touchAction1);
-//            multiTouchAction.Add(touchAction2);
-//
-//            PerformMultiAction(multiTouchAction);
-//        }
-//        #endregion Pinch
-
-//        #region Zoom
-//        /// <summary>
-//        /// Zoom at the specified point
-//        /// </summary>
-//        /// <param name="x">x screen location</param>
-//        /// <param name="y">y screen location</param>
-//        public void Zoom(int x, int y)
-//        {
-//            var touchAction1 = new TouchActions(this);
-//            touchAction1.Down(x, y).Move(x, y - 100).Up(x, y - 100);
-//
-//            var touchAction2 = new TouchActions(this);
-//            touchAction2.Down(x, y).Move(x, y + 100).Up(x, y + 100);
-//
-//            var multiTouchAction = new MultiTouchAction(this);
-//            multiTouchAction.Add(touchAction1);
-//            multiTouchAction.Add(touchAction2);
-//            PerformMultiAction(multiTouchAction);
-//        }
-//        #endregion Zoom
-
         /// <summary>
         /// Perform the multi action
         /// </summary>


Changed score rate back to normal

Changed score rate back to normal

--- UnityProject/Assets/Scripts/GUI/ZMScoreController.cs
+++ UnityProject/Assets/Scripts/GUI/ZMScoreController.cs
@@ -8,7 +8,7 @@
 		public Slider scoreBar;
 		public GameObject zenTextEmitter;

-		private const float SCORE_RATE = 2;//0.5f;
+		private const float SCORE_RATE = 0.5f;
 		private const float MAX_SCORE = 1000.0f;

 		// Events


Prevent text measuring as NaN.

Prevent text measuring as NaN.

When text is right-aligned, WidthIncludingTrailingWhitespace seems to
return null. Worked around that but I think the layout code is wrong
now.

--- Windows/Perspex.Direct2D1/Media/FormattedTextImpl.cs
+++ Windows/Perspex.Direct2D1/Media/FormattedTextImpl.cs
@@ -120,9 +120,15 @@

         public Size Measure()
         {
-            return new Size(
-                this.TextLayout.Metrics.WidthIncludingTrailingWhitespace,
-                this.TextLayout.Metrics.Height);
+            var metrics = this.TextLayout.Metrics;
+            var width = metrics.WidthIncludingTrailingWhitespace;
+
+            if (float.IsNaN(width))
+            {
+                width = metrics.Width;
+            }
+
+            return new Size(width, this.TextLayout.Metrics.Height);
         }

         public void SetForegroundBrush(Brush brush, int startIndex, int count)


Update

Update

--- WorldStreetsRenderLayer/OsmWorldMapKitPointStyles.cs
+++ WorldStreetsRenderLayer/OsmWorldMapKitPointStyles.cs
@@ -10,7 +10,7 @@
 namespace ThinkGeo.MapSuite
 {
     public partial class OsmWorldMapKitLayer
-    {
+    {
         protected virtual PointStyle GetPowerPolePointStyle()
         {
             return new PointStyle()


code refactoring

code refactoring

--- isukces.code/Features/CsClasses/CsMethodParameter.cs
+++ isukces.code/Features/CsClasses/CsMethodParameter.cs
@@ -105,9 +105,8 @@
             // Fail-safe check return
             // see Albahari, Joseph; Ben Albahari (2010-01-20). C# 4.0 in a Nutshell: The Definitive Reference (p. 258).
             if (Equals(other)) return 0;
-            var _tmp_ = Name.CompareTo(other.Name);
-            if (_tmp_ != 0) return _tmp_;
-            return Type.CompareTo(other.Type);
+            var tmp = Name.CompareTo(other.Name);
+            return tmp != 0 ? tmp : Type.CompareTo(other.Type);
         }

@@ -138,10 +137,10 @@
         public override int GetHashCode()
         {
             // Good implementation suggested by Josh Bloch
-            var _hash_ = 17;
-            _hash_ = _hash_ * 31 + Name.GetHashCode();
-            _hash_ = _hash_ * 31 + Type.GetHashCode();
-            return _hash_;
+            var hash = 17;
+            hash = hash * 31 + Name.GetHashCode();
+            hash = hash * 31 + Type.GetHashCode();
+            return hash;
         }

         public override string ToString()
@@ -152,6 +151,12 @@
             return string.Format("{0} {1} {2}", Visibility.ToString().ToLower(), Type, Name);
         }

+        public CsMethodParameter WithDescription(string description)
+        {
+            Description = description;
+            return this;
+        }
+
         /// <summary>
         ///     Realizuje interfejs IComparable
         /// </summary>
@@ -171,12 +176,7 @@
         public string ConstValue
         {
             get { return _constValue; }
-            set
-            {
-                if (value != null)
-                    value = value.Trim();
-                _constValue = value;
-            }
+            set { _constValue = value?.Trim(); }
         }

         public bool IsConst { get; set; }
@@ -184,7 +184,7 @@
         /// <summary>
         ///     nazwa parametru; własność jest tylko do odczytu.
         /// </summary>
-        public string Name { get; } = string.Empty;
+        public string Name { get; }

         /// <summary>
         ///     typ parametru; własność jest tylko do odczytu.
@@ -214,11 +214,7 @@
         public IList<ICsAttribute> Attributes
         {
             get { return _attributes; }
-            set
-            {
-                if (value == null) value = new List<ICsAttribute>();
-                _attributes = value;
-            }
+            set { _attributes = value ?? new List<ICsAttribute>(); }
         }

         /// <summary>


Reorder lines to enable extract-method.

Reorder lines to enable extract-method.

--- src/Fixie/Internal/AssemblyRunner.cs
+++ src/Fixie/Internal/AssemblyRunner.cs
@@ -27,8 +27,8 @@

             try
             {
+                var candidateTypes = assembly.GetTypes();
                 var classDiscoverer = new ClassDiscoverer(discovery);
-                var candidateTypes = assembly.GetTypes();
                 var testClasses = classDiscoverer.TestClasses(candidateTypes);

                 var methodDiscoverer = new MethodDiscoverer(discovery);


Update

Update

--- App/KeepOnDroning/KeepOnDroning.iOS/AppDelegate.cs
+++ App/KeepOnDroning/KeepOnDroning.iOS/AppDelegate.cs
@@ -34,6 +34,4 @@
 			return true;
 		}
 	}
-}
-
-
+}


Stops Conversation Audio

Stops Conversation Audio

--- Assets/Fungus/Scripts/Utils/ConversationManager.cs
+++ Assets/Fungus/Scripts/Utils/ConversationManager.cs
@@ -380,7 +380,7 @@

                 if (!string.IsNullOrEmpty(item.Text)) {
                     exitSayWait = false;
-                    sayDialog.Say(item.Text, true, true, true, false, null, () => {
+                    sayDialog.Say(item.Text, true, true, true, true, null, () => {
                         exitSayWait = true;
                     });


Added the error log record for users to know the origin of the ancient problem.

--- yafsrc/YAF.Core/UsersRoles/CombinedUserDataHelper.cs
+++ yafsrc/YAF.Core/UsersRoles/CombinedUserDataHelper.cs
@@ -240,6 +240,16 @@
     {
       get
       {
+          if (this.Membership == null && !this.IsGuest)
+          {
+              LegacyDb.eventlog_create(this.UserID, this,
+                  "ATTENTION! The user with id {0} and name {1} is very possibly is not in your Membership \r\n ".FormatWith(this.UserID, this.UserName) +
+                  "data but it's still in you YAF user table. The situation should not normally happen. \r\n " +
+                  "You should create a Membership data for the user first and " +
+                  "then delete him from YAF user table or leave him.", EventLogTypes.Error);
+
+          }
+
           return this.IsGuest ? this.RowConvert.AsString("Email") : this.Membership.Email;
       }
     }


changed the namespace.

changed the namespace.

--- yafsrc/YAF.Tests/YAF.Tests/YAF.Classes.Utils.Test.cs
+++ yafsrc/YAF.Tests/YAF.Tests/YAF.Classes.Utils.Test.cs
@@ -22,7 +22,7 @@
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 using YAF.Classes.Utils;

-namespace YAF.Classes.Utils.Test
+namespace YAF.Tests
 {
 	[TestClass]
 	public class YafUtilsTest


Fix staticdata gridview columns

Fix staticdata gridview columns

--- Blueprint41.Modeller/ManageEntityStaticDataForm.cs
+++ Blueprint41.Modeller/ManageEntityStaticDataForm.cs
@@ -110,6 +110,19 @@
                 RecordPropertiesDataTable.Columns.Add(recordProperty.Key);
             }

+            // if we don't have anything to map, add the primitive mapping instead
+            if(recordProperties.Count == 0)
+            {
+                foreach(KeyValuePair<string, string> primiviteGuidName in primitiveGuidNameMapping)
+                {
+                    DataGridViewColumn column = new DataGridViewTextBoxColumn();
+                    column.DataPropertyName = primiviteGuidName.Key;
+                    column.Name = primiviteGuidName.Value;
+                    dataGridView.Columns.Add(column);
+                    RecordPropertiesDataTable.Columns.Add(primiviteGuidName.Key);
+                }
+            }
+
             //TODO: Review this part with Marko
             //Entity and Parent Relationship and Properties
             foreach (var relationship in Entity.GetRelationships(RelationshipDirection.In, true))


Resolves #54: Makes Tab events virtual

Resolves #54: Makes Tab events virtual

--- BottomBar.Droid/Renderers/BottomBarPageRenderer.cs
+++ BottomBar.Droid/Renderers/BottomBarPageRenderer.cs
@@ -48,7 +48,7 @@
 		}

 		#region IOnTabClickListener
-		public void OnTabSelected (int position)
+		public virtual void OnTabSelected (int position)
 		{
 			//Do we need this call? It's also done in OnElementPropertyChanged
 			SwitchContent(Element.Children [position]);
@@ -57,7 +57,7 @@
 			//bottomBarPage.RaiseCurrentPageChanged();
 		}

-		public void OnTabReSelected (int position)
+		public virtual void OnTabReSelected (int position)
 		{
 		}
 		#endregion


enum naming fixes

enum naming fixes

--- Branch.App/Areas/Halo4/Views/Shared/Sidebar.cshtml
+++ Branch.App/Areas/Halo4/Views/Shared/Sidebar.cshtml
@@ -7,7 +7,7 @@
 	var serviceRecord = @Model.ServiceRecord;
 	Enums.Pages currentPage = ViewBag.CurrentH4Page;
 	_343Enums.CommendationCategory? currentCommendationCategory = ViewBag.CurrentCommendationCategory;
-	_343Enums.Mode? currentHistoryMode = ViewBag.CurrentHistoryMode;
+	_343Enums.GameMode? currentHistoryMode = ViewBag.CurrentHistoryMode;
 }

@@ -27,7 +27,7 @@
 					@if (currentPage == Enums.Pages.GameHistory)
 					{

-							@foreach (var gameMode in (_343Enums.Mode[])Enum.GetValues(typeof(_343Enums.Mode)))
+							@foreach (var gameMode in (_343Enums.GameMode[])Enum.GetValues(typeof(_343Enums.GameMode)))
 							{

 									@Html.RouteLink(gameMode.ToString().MakeCamelCaseFriendly(), "Halo4_History", new { slug = gameMode.ToString(), gamertag = BranchHelpers.CheckGamertagPrivacy(serviceRecord.Gamertag) })


Fix cache name

Fix cache name

--- src/GitHub.App/Caches/SharedCache.cs
+++ src/GitHub.App/Caches/SharedCache.cs
@@ -20,7 +20,7 @@

         static SharedCache()
         {
-            BlobCache.ApplicationName = "GitHub Extension for Visual Studio";
+            BlobCache.ApplicationName = Info.ApplicationInfo.ApplicationDescription;
         }

         public SharedCache() : this(BlobCache.UserAccount, BlobCache.LocalMachine, null)


format

format


added an id to the edit item type (Updated by TFS to TFS Connector, server: http://1x:8080/, id 6043. )

git-tfs-id: [https://tfs.caes.ucdavis.edu:8088/tfs/DefaultCollection]$/CRP/Trunk/CRP;C896

--- CRP/Controllers/ApplicationManagementController.cs
+++ CRP/Controllers/ApplicationManagementController.cs
@@ -127,19 +127,29 @@
         /// PostCondition:
         ///     The item is updated
         /// </remarks>
+        /// <param name="id"></param>
         /// <param name="itemType"></param>
         /// <returns></returns>
         [AcceptPost]
-        public ActionResult EditItemType([Bind(Exclude="Id")]ItemType itemType)
+        public ActionResult EditItemType(int id, [Bind(Exclude="Id")]ItemType itemType)
         {
+            var it = Repository.OfType<ItemType>().GetNullableByID(id);
+            if (it == null)
+            {
+                return this.RedirectToAction(a => a.ListItemTypes());
+            }
+
+            it.Name = itemType.Name;
+            it.IsActive = itemType.IsActive;
+
             //TODO: Review. I think this needs to pass in the id, get it,
             //copy over the fields which are edited, then check and persist that.
             //As the name should not be duplicate, that check would need to be added.
-            MvcValidationAdapter.TransferValidationMessagesTo(ModelState, itemType.ValidationResults());
+            MvcValidationAdapter.TransferValidationMessagesTo(ModelState, it.ValidationResults());

             if (ModelState.IsValid)
             {
-                Repository.OfType<ItemType>().EnsurePersistent(itemType);
+                Repository.OfType<ItemType>().EnsurePersistent(it);
                 Message = NotificationMessages.STR_ObjectSaved.Replace(NotificationMessages.ObjectType, "Item Type");
                 return View(itemType);
             }


Add UserProjectNotifications to DbContext

--- src/Dangl.WebDocumentation/Models/ApplicationDbContext.cs
+++ src/Dangl.WebDocumentation/Models/ApplicationDbContext.cs
@@ -12,6 +12,7 @@
         public DbSet<ProjectVersionAssetFile> ProjectVersionAssetFiles { get; set; }

         public DbSet<UserProjectAccess> UserProjects { get; set; }
+        public DbSet<UserProjectNotification> UserProjectNotifications { get; set; }

         protected override void OnModelCreating(ModelBuilder builder)
         {


Lucene.Net.Facet.Taxonomy.WriterCache.CollisionMap.EntryIterator refactor: removed Remove() method, since .NET doesn't support it (and there is no implementation anyway)

--- src/Lucene.Net.Facet/Taxonomy/WriterCache/CollisionMap.cs
+++ src/Lucene.Net.Facet/Taxonomy/WriterCache/CollisionMap.cs
@@ -275,10 +275,11 @@
                 return e;
             }

-            public void Remove()
-            {
-                throw new System.NotSupportedException();
-            }
+            // LUCENENET specific - .NET doesn't support Remove() anyway, so we can nix this
+            //public void Remove()
+            //{
+            //    throw new System.NotSupportedException();
+            //}

             public void Dispose()
             {


CryptRand.FillBuffer shouldn't throw if the buffer is a zero-length array.

--- src/Microsoft.AspNet.Security.DataProtection/CryptRand.cs
+++ src/Microsoft.AspNet.Security.DataProtection/CryptRand.cs
@@ -16,9 +16,12 @@
             // the ArraySegment<> ctor performs bounds checking
             var unused = new ArraySegment<byte>(buffer.Array, buffer.Offset, buffer.Count);

-            fixed (byte* pBuffer = &buffer.Array[buffer.Offset])
+            if (buffer.Count != 0)
             {
-                BCryptUtil.GenRandom(pBuffer, buffer.Count);
+                fixed (byte* pBuffer = &buffer.Array[buffer.Offset])
+                {
+                    BCryptUtil.GenRandom(pBuffer, buffer.Count);
+                }
             }
         }
     }


Adds failing tests for binding to List<T> T[] and IEnumerable<T>. Plus some clean up.

--- src/Nancy.Tests/Unit/ModelBinding/DefaultBinderFixture.cs
+++ src/Nancy.Tests/Unit/ModelBinding/DefaultBinderFixture.cs
@@ -9,6 +9,7 @@
     using FakeItEasy;

     using Nancy.IO;
+    using Nancy.Json;
     using Nancy.ModelBinding;
     using Fakes;

@@ -23,6 +24,7 @@
     {
         private readonly IFieldNameConverter passthroughNameConverter;
         private readonly BindingDefaults emptyDefaults;
+        private readonly JavaScriptSerializer serializer;

         public DefaultBinderFixture()
         {
@@ -33,6 +35,9 @@
             this.emptyDefaults = A.Fake<BindingDefaults>();
             A.CallTo(() => this.emptyDefaults.DefaultBodyDeserializers).Returns(new IBodyDeserializer[] { });
             A.CallTo(() => this.emptyDefaults.DefaultTypeConverters).Returns(new ITypeConverter[] { });
+
+            this.serializer = new JavaScriptSerializer();
+            this.serializer.RegisterConverters(JsonSettings.Converters);
         }

         [Fact]
@@ -86,7 +91,7 @@
             var context = CreateContextWithHeader("Content-Type", new[] { "application/xml" });

             // When
-            binder.Bind(context, this.GetType(), null, new BindingConfig());
+            binder.Bind(context, this.GetType(), null, BindingConfig.Default);

             // Then
             A.CallTo(() => deserializer.Deserialize(null, null, null)).WithAnyArguments()
@@ -104,7 +109,7 @@
             var context = CreateContextWithHeader("Content-Type", new[] { "application/xml" });

             // When
-            binder.Bind(context, this.GetType(), null, new BindingConfig());
+            binder.Bind(context, this.GetType(), null, BindingConfig.Default);

             // Then
             A.CallTo(() => deserializer.Deserialize(null, null, null)).WithAnyArguments()
@@ -121,7 +126,7 @@
             var context = CreateContextWithHeader("Content-Type", new[] { "application/xml" });

             // When
-            binder.Bind(context, this.GetType(), null, new BindingConfig());
+            binder.Bind(context, this.GetType(), null, BindingConfig.Default);

             // Then
             A.CallTo(() => deserializer.CanDeserialize("application/xml"))
@@ -141,7 +146,7 @@
             var context = CreateContextWithHeader("Content-Type", new[] { "application/xml" });

             // When
-            var result = binder.Bind(context, typeof(TestModel), null, new BindingConfig());
+            var result = binder.Bind(context, typeof(TestModel), null, BindingConfig.Default);

             // Then
             result.ShouldBeOfType<TestModel>();
@@ -200,7 +205,7 @@
             context.Request.Form["IntProperty"] = "12";

             // When
-            binder.Bind(context, typeof(TestModel), null, new BindingConfig());
+            binder.Bind(context, typeof(TestModel), null, BindingConfig.Default);

             // Then
             A.CallTo(() => typeConverter.CanConvertTo(null, null)).WithAnyArguments()
@@ -219,7 +224,7 @@
             context.Request.Form["StringProperty"] = "Test";

             // When
-            binder.Bind(context, typeof(TestModel), null, new BindingConfig());
+            binder.Bind(context, typeof(TestModel), null, BindingConfig.Default);

             // Then
             A.CallTo(() => typeConverter.Convert(null, null, null)).WithAnyArguments()
@@ -237,7 +242,7 @@
             context.Request.Form["DateProperty"] = "Broken";

             // When
-            var result = (TestModel)binder.Bind(context, typeof(TestModel), null, new BindingConfig());
+            var result = (TestModel)binder.Bind(context, typeof(TestModel), null, BindingConfig.Default);

             // Then
             result.StringProperty.ShouldEqual("Test");
@@ -255,7 +260,7 @@
             context.Request.Form["AnotherIntProperty"] = "morebad";

             // Then
-            Assert.Throws<ModelBindingException>(() => binder.Bind(context, typeof(TestModel), null, new BindingConfig()))
+            Assert.Throws<ModelBindingException>(() => binder.Bind(context, typeof(TestModel), null, BindingConfig.Default))
                 .ShouldMatch(exception =>
                              exception.BoundType == typeof(TestModel)
                              && exception.PropertyBindingExceptions.Any(pe =>
@@ -288,7 +293,7 @@
             A.CallTo(() => this.emptyDefaults.DefaultBodyDeserializers).Returns(new[] { deserializer });

             // When
-            binder.Bind(context, typeof(TestModel), null, new BindingConfig());
+            binder.Bind(context, typeof(TestModel), null, BindingConfig.Default);

             // Then
             validProperties.ShouldEqual(7);
@@ -304,7 +309,7 @@
             context.Request.Form["IntProperty"] = "12";

             // When
-            binder.Bind(context, typeof(TestModel), null, new BindingConfig());
+            binder.Bind(context, typeof(TestModel), null, BindingConfig.Default);

             // Then
             A.CallTo(() => this.passthroughNameConverter.Convert(null)).WithAnyArguments()
@@ -321,7 +326,7 @@
             context.Request.Form["IntProperty"] = "12";

             // When
-            var result = (TestModel)binder.Bind(context, typeof(TestModel), null, new BindingConfig(), "IntProperty");
+            var result = (TestModel)binder.Bind(context, typeof(TestModel), null, BindingConfig.Default, "IntProperty");

             // Then
             result.StringProperty.ShouldEqual("Test");
@@ -363,7 +368,7 @@
             var context = CreateContextWithHeader("Content-Type", new[] { "application/xml" });

             // When
-            binder.Bind(context, this.GetType(), null, new BindingConfig());
+            binder.Bind(context, this.GetType(), null, BindingConfig.Default);

             // Then
             A.CallTo(() => deserializer.Deserialize(null, null, null)).WithAnyArguments()
@@ -383,7 +388,7 @@
             context.Request.Form["StringProperty"] = "Test";

             // When
-            binder.Bind(context, typeof(TestModel), null, new BindingConfig());
+            binder.Bind(context, typeof(TestModel), null, BindingConfig.Default);

             // Then
             A.CallTo(() => typeConverter.Convert(null, null, null)).WithAnyArguments()
@@ -406,7 +411,7 @@
             var context = CreateContextWithHeader("Content-Type", new[] { "application/xml" });

             // When
-            binder.Bind(context, this.GetType(), null, new BindingConfig());
+            binder.Bind(context, this.GetType(), null, BindingConfig.Default);

             // Then
             A.CallTo(() => userDeserializer.Deserialize(null, null, null)).WithAnyArguments()
@@ -431,7 +436,7 @@
             context.Request.Form["StringProperty"] = "Test";

             // When
-            binder.Bind(context, typeof(TestModel), null, new BindingConfig());
+            binder.Bind(context, typeof(TestModel), null, BindingConfig.Default);

             // Then
             A.CallTo(() => userTypeConverter.Convert(null, null, null)).WithAnyArguments()
@@ -452,7 +457,7 @@

             // When
-            var result = (TestModel)binder.Bind(context, typeof(TestModel), null, new BindingConfig());
+            var result = (TestModel)binder.Bind(context, typeof(TestModel), null, BindingConfig.Default);
             // Then
             result.StringProperty.ShouldEqual("Test");
             result.IntProperty.ShouldEqual(3);
@@ -469,7 +474,7 @@
             context.Parameters["IntProperty"] = "3";

             // When
-            var result = (TestModel)binder.Bind(context, typeof(TestModel), null, new BindingConfig());
+            var result = (TestModel)binder.Bind(context, typeof(TestModel), null, BindingConfig.Default);
             // Then
             result.StringProperty.ShouldEqual("Test");
             result.IntProperty.ShouldEqual(3);
@@ -487,7 +492,7 @@
             context.Request.Query["IntProperty"] = "1";

             // When
-            var result = (TestModel)binder.Bind(context, typeof(TestModel), null, new BindingConfig());
+            var result = (TestModel)binder.Bind(context, typeof(TestModel), null, BindingConfig.Default);
             // Then
             result.StringProperty.ShouldEqual("Test");
             result.IntProperty.ShouldEqual(3);
@@ -508,7 +513,7 @@
             context.Request.Form["IntProperty_2"] = "2";

             // When
-            var result = (List<TestModel>)binder.Bind(context, typeof(List<TestModel>), null, new BindingConfig());
+            var result = (List<TestModel>)binder.Bind(context, typeof(List<TestModel>), null, BindingConfig.Default);

             // Then
             result.First().StringProperty.ShouldEqual("Test");
@@ -529,7 +534,7 @@
             context.Request.Form["IntValues"] = "1,2,3,4";

             // When
-            var result = (TestModel)binder.Bind(context, typeof(TestModel), null, new BindingConfig());
+            var result = (TestModel)binder.Bind(context, typeof(TestModel), null, BindingConfig.Default);

             // Then
             result.IntValues.ShouldHaveCount(4);
@@ -547,7 +552,7 @@
             context.Request.Form["IntValues_2"] = "5,6,7,8";

             // When
-            var result = (List<TestModel>)binder.Bind(context, typeof(List<TestModel>), null, new BindingConfig());
+            var result = (List<TestModel>)binder.Bind(context, typeof(List<TestModel>), null, BindingConfig.Default);

             // Then
             result.First().IntValues.ShouldHaveCount(4);
@@ -570,7 +575,7 @@
             context.Parameters["IntProperty"] = "2";

             // When
-            var result = (TestModel)binder.Bind(context, typeof(TestModel), null, new BindingConfig());
+            var result = (TestModel)binder.Bind(context, typeof(TestModel), null, BindingConfig.Default);
             // Then
             result.StringProperty.ShouldEqual("Test");
             result.IntProperty.ShouldEqual(3);
@@ -590,7 +595,7 @@
             context.Parameters["IntProperty"] = "13";

             // When
-            var result = (TestModel)binder.Bind(context, typeof(TestModel), null, new BindingConfig());
+            var result = (TestModel)binder.Bind(context, typeof(TestModel), null, BindingConfig.Default);
             // Then
             result.StringProperty.ShouldEqual("Test");
             result.IntProperty.ShouldEqual(12);
@@ -607,7 +612,7 @@
             context.Request.Query["IntProperty"] = "12";

             // When
-            var result = (TestModel)binder.Bind(context, typeof(TestModel), null, new BindingConfig());
+            var result = (TestModel)binder.Bind(context, typeof(TestModel), null, BindingConfig.Default);

             // Then
             result.StringProperty.ShouldEqual("Test");
@@ -631,7 +636,7 @@
             context.Request.Form["DoubleProperty"] = "4,50";

             // When
-            var result = (TestModel)binder.Bind(context, typeof(TestModel), null, new BindingConfig());
+            var result = (TestModel)binder.Bind(context, typeof(TestModel), null, BindingConfig.Default);

             // Then
             result.DoubleProperty.ShouldEqual(expected);
@@ -656,7 +661,7 @@
             context.Request.Form["DateProperty"] = date;

             // When
-            var result = (TestModel)binder.Bind(context, typeof(TestModel), null, new BindingConfig());
+            var result = (TestModel)binder.Bind(context, typeof(TestModel), null, BindingConfig.Default);
             // Then
             result.DateProperty.Date.Month.ShouldEqual(month);
             result.DateProperty.Date.Day.ShouldEqual(day);
@@ -676,7 +681,7 @@
             context.Parameters["IntProperty"] = "12";

             // When
-            var result = (TestModel)binder.Bind(context, typeof(TestModel), null, new BindingConfig());
+            var result = (TestModel)binder.Bind(context, typeof(TestModel), null, BindingConfig.Default);

             // Then
             result.StringProperty.ShouldEqual("Test");
@@ -766,18 +771,78 @@
         [Fact]
         public void Should_bind_list_model_from_body()
         {
+            //Given
             var binder = this.GetBinder(null, new List<IBodyDeserializer> { new XmlBodyDeserializer() });
             var body = XmlBodyDeserializerFixture.ToXmlString(new List<TestModel>(new[] { new TestModel { StringProperty = "Test" }, new TestModel { StringProperty = "AnotherTest" } }));

             var context = CreateContextWithHeaderAndBody("Content-Type", new[] { "application/xml" }, body);

             // When
-            var result = (List<TestModel>)binder.Bind(context, typeof(List<TestModel>), null, new BindingConfig());
+            var result = (List<TestModel>)binder.Bind(context, typeof(List<TestModel>), null, BindingConfig.Default);
             // Then

             result.First().StringProperty.ShouldEqual("Test");
             result.Last().StringProperty.ShouldEqual("AnotherTest");
         }
+
+
+        [Fact]
+        public void Should_bind_array_model_from_body()
+        {
+            //Given
+            var binder = this.GetBinder(null, new List<IBodyDeserializer> { new XmlBodyDeserializer() });
+            var body = XmlBodyDeserializerFixture.ToXmlString(new List<TestModel>(new[] { new TestModel { StringProperty = "Test" }, new TestModel { StringProperty = "AnotherTest" } }));
+
+            var context = CreateContextWithHeaderAndBody("Content-Type", new[] { "application/xml" }, body);
+
+            // When
+            var result = (TestModel[])binder.Bind(context, typeof(TestModel[]), null, BindingConfig.Default);
+
+            // Then
+            result.First().StringProperty.ShouldEqual("Test");
+            result.Last().StringProperty.ShouldEqual("AnotherTest");
+        }
+
+        [Fact]
+        public void Should_bind_model_from_body_that_contains_an_array()
+        {
+            //Given
+            var binder = this.GetBinder(null, new List<IBodyDeserializer> { new XmlBodyDeserializer() });
+            var body = XmlBodyDeserializerFixture.ToXmlString(new TestModel {StringProperty = "Test", SomeStrings = new[] {"E", "A", "D", "G", "B", "E"}});
+
+            var context = CreateContextWithHeaderAndBody("Content-Type", new[] { "application/xml" }, body);
+
+            // When
+            var result = (TestModel)binder.Bind(context, typeof(TestModel[]), null, BindingConfig.Default);
+
+            // Then
+            result.SomeStrings.ShouldHaveCount(6);
+            result.SomeStrings.ShouldEqualSequence(new[] { "E", "A", "D", "G", "B", "E" });
+        }
+
+
+        [Fact]
+        public void Should_bind_array_model_from_body_that_contains_an_array()
+        {
+            //Given
+            var binder = this.GetBinder(null, new List<IBodyDeserializer> { new XmlBodyDeserializer() });
+            var body =
+                serializer.Serialize(new[]
+                {
+                    new TestModel {StringProperty = "Test", SomeStrings = new[] {"E", "A", "D", "G", "B", "E"}},
+                    new TestModel {StringProperty = "AnotherTest", SomeStrings = new[] {"E", "A", "D", "G", "B", "E"}}
+                });
+
+            var context = CreateContextWithHeaderAndBody("Content-Type", new[] { "application/js" }, body);
+
+            // When
+            var result = (TestModel[])binder.Bind(context, typeof(TestModel[]), null, BindingConfig.Default, "SomeStrings");
+
+            // Then
+            result.First().SomeStrings.ShouldBeNull();
+            result.Last().SomeStrings.ShouldBeNull();
+        }
+

         [Fact]
         public void Form_request_and_context_properties_should_take_precedence_over_body_properties()
@@ -795,7 +860,7 @@
             context.Parameters["AnotherStringProprety"] = "From context";

             // When
-            var result = (TestModel)binder.Bind(context, typeof(TestModel), null, new BindingConfig());
+            var result = (TestModel)binder.Bind(context, typeof(TestModel), null, BindingConfig.Default);

             // Then
             result.StringProperty.ShouldEqual("From form");
@@ -852,6 +917,7 @@
         [Fact]
         public void Should_be_able_to_bind_body_request_form_and_context_properties()
         {
+            //Given
             var binder = this.GetBinder(null, new List<IBodyDeserializer> { new XmlBodyDeserializer() });
             var body = XmlBodyDeserializerFixture.ToXmlString(new TestModel { DateProperty = new DateTime(2012, 8, 16) });

@@ -862,7 +928,7 @@
             context.Parameters["AnotherStringProprety"] = "From Context";

             // When
-            var result = (TestModel)binder.Bind(context, typeof(TestModel), null, new BindingConfig());
+            var result = (TestModel)binder.Bind(context, typeof(TestModel), null, BindingConfig.Default);

             // Then
             result.StringProperty.ShouldEqual("From Query");
@@ -874,12 +940,13 @@
         [Fact]
         public void Should_ignore_existing_instance_if_type_doesnt_match()
         {
+            //Given
             var binder = this.GetBinder();
             var existing = new object();
             var context = CreateContextWithHeader("Content-Type", new[] { "application/xml" });

             // When
-            var result = (TestModel)binder.Bind(context, typeof(TestModel), existing, new BindingConfig());
+            var result = (TestModel)binder.Bind(context, typeof(TestModel), existing, BindingConfig.Default);

             // Then
             result.ShouldNotBeSameAs(existing);
@@ -949,6 +1016,8 @@

             public IEnumerable<int> IntValues { get; set; }

+            public string[] SomeStrings { get; set; }
+
             public int this[int index]
             {
                 get { return 0; }


added: UpdateToDefault

added: UpdateToDefault

--- src/ImTools/ImTools.Experimental2.cs
+++ src/ImTools/ImTools.Experimental2.cs
@@ -711,6 +711,29 @@
                     : new ImMapBranch<V>(branch.Entry, new ImMapEntry<V>(key, value));

             return new ImMapEntry<V>(key, value);
+        }
+
+        ///<summary>Returns the new map with the value set to default, or the same map if the key was not found.</summary>
+        [MethodImpl((MethodImplOptions)256)]
+        public static ImMap<V> UpdateToDefault<V>(this ImMap<V> map, int key) =>
+            map.Contains(key) ? map.UpdateToDefaultImpl(key) : map;
+
+        internal static ImMap<V> UpdateToDefaultImpl<V>(this ImMap<V> map, int key)
+        {
+            if (map is ImMapTree<V> tree)
+                return key > tree.Entry.Key
+                    ? new ImMapTree<V>(tree.Entry, tree.Left, tree.Right.UpdateToDefaultImpl(key), tree.TreeHeight)
+                    : key < tree.Entry.Key
+                        ? new ImMapTree<V>(tree.Entry, tree.Left.UpdateToDefaultImpl(key), tree.Right, tree.TreeHeight)
+                        : new ImMapTree<V>(new ImMapEntry<V>(key), tree.Left, tree.Right, tree.TreeHeight);
+
+            // the key was found - so it should be either entry or right entry
+            if (map is ImMapBranch<V> branch)
+                return key == branch.Entry.Key
+                    ? new ImMapBranch<V>(new ImMapEntry<V>(key), branch.RightEntry)
+                    : new ImMapBranch<V>(branch.Entry, new ImMapEntry<V>(key));
+
+            return new ImMapEntry<V>(key);
         }

         /// <summary> Returns `true` if key is found or `false` otherwise. </summary>


PP9-5047, add SampleData client to CloudManager SDK.

--- src/Picturepark.SDK.V1.CloudManager/CloudManagerClient.cs
+++ src/Picturepark.SDK.V1.CloudManager/CloudManagerClient.cs
@@ -32,6 +32,8 @@

 		public UpdateClient Updates { get; private set; }

+		public SampleDataClient SampleData { get; private set; }
+
 		public void Dispose()
 		{
 			if (_httpClient != null)
@@ -46,6 +48,7 @@
 			Customers = new CustomerClient(settings, httpClient);
 			Services = new ServiceClient(settings, httpClient);
 			Updates = new UpdateClient(settings, httpClient);
+			SampleData = new SampleDataClient(settings, httpClient);
 		}
 	}
 }


为序列化成员注解增加一个序列化方向的属性。 :dizzy:

为序列化成员注解增加一个序列化方向的属性。 :dizzy:

--- src/Runtime/Serialization/SerializationMemberAttribute.cs
+++ src/Runtime/Serialization/SerializationMemberAttribute.cs
@@ -31,11 +31,6 @@
 	[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, Inherited = true)]
 	public class SerializationMemberAttribute : Attribute
 	{
-		#region 成员字段
-		private string _name;
-		private SerializationMemberBehavior _behavior;
-		#endregion
-
 		#region 构造函数
 		public SerializationMemberAttribute()
 		{
@@ -43,12 +38,12 @@

 		public SerializationMemberAttribute(string name)
 		{
-			_name = name == null ? string.Empty : name.Trim();
+			this.Name = name == null ? string.Empty : name.Trim();
 		}

 		public SerializationMemberAttribute(SerializationMemberBehavior behavior)
 		{
-			_behavior = behavior;
+			this.Behavior = behavior;
 		}
 		#endregion

@@ -58,14 +53,15 @@
 		/// </summary>
 		public string Name
 		{
-			get
-			{
-				return _name;
-			}
-			set
-			{
-				_name = value == null ? string.Empty : value.Trim();
-			}
+			get; set;
+		}
+
+		/// <summary>
+		/// 获取或设置成员序列化方向。
+		/// </summary>
+		public SerializationDirection Direction
+		{
+			get; set;
 		}

 		/// <summary>
@@ -73,14 +69,7 @@
 		/// </summary>
 		public SerializationMemberBehavior Behavior
 		{
-			get
-			{
-				return _behavior;
-			}
-			set
-			{
-				_behavior = value;
-			}
+			get; set;
 		}
 		#endregion
 	}


Rename imgWidth to imgSize

Rename imgWidth to imgSize

--- src/StreamDeckSharp/Internals/StreamDeckXlHardwareInfo.cs
+++ src/StreamDeckSharp/Internals/StreamDeckXlHardwareInfo.cs
@@ -9,7 +9,7 @@
     internal sealed class StreamDeckXlHardwareInfo
         : IHardwareInternalInfos
     {
-        private const int imgWidth = 96;
+        private const int imgSize = 96;

         public int HeaderSize => 8;

@@ -29,7 +29,7 @@

         static StreamDeckXlHardwareInfo()
         {
-            keyPositions = new GridKeyPositionCollection(8, 4, imgWidth, 25);
+            keyPositions = new GridKeyPositionCollection(8, 4, imgSize, 25);
         }

         public int ExtKeyIdToHardwareKeyId(int extKeyId)
@@ -37,7 +37,7 @@

         public byte[] GeneratePayload(KeyBitmap keyBitmap)
         {
-            var rawData = keyBitmap.GetScaledVersion(imgWidth, imgWidth);
+            var rawData = keyBitmap.GetScaledVersion(imgSize, imgSize);

             if (rawData is null)
                 return GetNullImage();
@@ -63,7 +63,7 @@
         {
             if (cachedNullImage is null)
             {
-                var rawNullImg = new KeyBitmap(1, 1, new byte[] { 0, 0, 0 }).GetScaledVersion(imgWidth, imgWidth);
+                var rawNullImg = new KeyBitmap(1, 1, new byte[] { 0, 0, 0 }).GetScaledVersion(imgSize, imgSize);
                 cachedNullImage = EncodeImageToJpg(rawNullImg);
             }

@@ -72,17 +72,17 @@

         private static byte[] EncodeImageToJpg(byte[] rgb24)
         {
-            int stride = imgWidth * 4;
-            var data = new byte[imgWidth * stride];
+            int stride = imgSize * 4;
+            var data = new byte[imgSize * stride];

-            for (int y = 0; y < imgWidth; y++)
-                for (int x = 0; x < imgWidth; x++)
+            for (int y = 0; y < imgSize; y++)
+                for (int x = 0; x < imgSize; x++)
                 {
-                    var x1 = imgWidth - 1 - x;
-                    var y1 = imgWidth - 1 - y;
+                    var x1 = imgSize - 1 - x;
+                    var y1 = imgSize - 1 - y;

-                    var pTarget = (y * imgWidth + x) * 4;
-                    var pSource = (y1 * imgWidth + x1) * 3;
+                    var pTarget = (y * imgSize + x) * 4;
+                    var pSource = (y1 * imgSize + x1) * 3;

                     data[pTarget + 0] = rgb24[pSource + 0];
                     data[pTarget + 1] = rgb24[pSource + 1];
@@ -90,7 +90,7 @@
                 }

             var enc = new JpegBitmapEncoder() { QualityLevel = 100 };
-            var f = BitmapSource.Create(imgWidth, imgWidth, 96, 96, PixelFormats.Bgr32, null, data, stride);
+            var f = BitmapSource.Create(imgSize, imgSize, 96, 96, PixelFormats.Bgr32, null, data, stride);
             enc.Frames.Add(BitmapFrame.Create(f));

             using (var ms = new MemoryStream())


TestChildProcessCleanupAfterDispose: increase timeout from 1s to 30s; sleep async (#27850)

* TestChildProcessCleanupTest, TestProcessWaitStateReferenceCount: increase timeout from 1s to 30s; sleep async

* PR feedback

--- src/System.Diagnostics.Process/tests/ProcessTests.Unix.cs
+++ src/System.Diagnostics.Process/tests/ProcessTests.Unix.cs
@@ -10,6 +10,7 @@
 using System.Reflection;
 using System.Runtime.InteropServices;
 using System.Threading;
+using System.Threading.Tasks;
 using System.Security;
 using Xunit;
 using Xunit.NetCore.Extensions;
@@ -415,12 +416,12 @@
         /// </summary>
         [Fact]
         [PlatformSpecific(TestPlatforms.Linux)] // Test uses Linux specific '/proc' filesystem
-        public void TestChildProcessCleanup()
+        public async Task TestChildProcessCleanup()
         {
             using (Process process = CreateShortProcess())
             {
                 process.Start();
-                bool processReaped = TryWaitProcessReaped(process.Id, timeout: 1000);
+                bool processReaped = await TryWaitProcessReapedAsync(process.Id, timeoutMs: 30000);
                 Assert.True(processReaped);
             }
         }
@@ -435,7 +436,7 @@
         [InlineData(true, false)]
         [InlineData(true, true)]
         [PlatformSpecific(TestPlatforms.Linux)] // Test uses Linux specific '/proc' filesystem
-        public void TestChildProcessCleanupAfterDispose(bool shortProcess, bool enableEvents)
+        public async Task TestChildProcessCleanupAfterDispose(bool shortProcess, bool enableEvents)
         {
             // We test using a long and short process. The long process will terminate after Dispose,
             // The short process will terminate at the same time, possibly revealing race conditions.
@@ -451,7 +452,7 @@
                     process.EnableRaisingEvents = true;
                 }
             }
-            bool processReaped = TryWaitProcessReaped(processId, timeout: 1000);
+            bool processReaped = await TryWaitProcessReapedAsync(processId, timeoutMs: 30000);
             Assert.True(processReaped);
         }

@@ -462,17 +463,17 @@
             return process;
         }

-        private static bool TryWaitProcessReaped(int pid, int timeout)
-        {
-            const int sleepTime = 50;
+        private static async Task<bool> TryWaitProcessReapedAsync(int pid, int timeoutMs)
+        {
+            const int SleepTimeMs = 50;
             // When the process is reaped, the '/proc/<pid>' directory to disappears.
             bool procPidExists = true;
-            for (int attempt = 0; attempt < (timeout / sleepTime); attempt++)
+            for (int attempt = 0; attempt < (timeoutMs / SleepTimeMs); attempt++)
             {
                 procPidExists = Directory.Exists("/proc/" + pid);
                 if (procPidExists)
                 {
-                    Thread.Sleep(sleepTime);
+                    await Task.Delay(SleepTimeMs);
                 }
                 else
                 {
@@ -487,7 +488,7 @@
         /// </summary>
         [Fact]
         [PlatformSpecific(TestPlatforms.AnyUnix)] // Test validates Unix implementation
-        public void TestProcessWaitStateReferenceCount()
+        public async Task TestProcessWaitStateReferenceCount()
         {
             using (var exitedEventSemaphore = new SemaphoreSlim(0, 1))
             {
@@ -513,7 +514,8 @@

                 // Child reaping holds a reference too
                 int referenceCount = -1;
-                for (int i = 0; i < 20; i++)
+                const int SleepTimeMs = 50;
+                for (int i = 0; i < (30000 / SleepTimeMs); i++)
                 {
                     referenceCount = GetWaitStateReferenceCount(waitState);
                     if (referenceCount == 0)
@@ -523,7 +525,7 @@
                     else
                     {
                         // Process was reaped but ProcessWaitState not unrefed yet
-                        Thread.Sleep(50);
+                        await Task.Delay(SleepTimeMs);
                     }
                 }
                 Assert.Equal(0, referenceCount);


Add bridge response loggin

Add bridge response loggin

--- src/Tgstation.Server.Host/Controllers/BridgeController.cs
+++ src/Tgstation.Server.Host/Controllers/BridgeController.cs
@@ -69,6 +69,7 @@
 				Forbid();

 			var responseJson = JsonConvert.SerializeObject(response, DMApiConstants.SerializerSettings);
+			logger.LogTrace("Bridge Response: {0}", responseJson);
 			return Content(responseJson, ApiHeaders.ApplicationJson);
 		}
 	}


Fix the merge

Fix the merge

--- src/Umbraco.Web/HealthCheck/Checks/Security/HttpsCheck.cs
+++ src/Umbraco.Web/HealthCheck/Checks/Security/HttpsCheck.cs
@@ -94,7 +94,7 @@
                 else
                 {
                     result = StatusResultType.Error;
-                    message = _textService.Localize("healthcheck/httpsCheckInvalidUrl", new[] { address, response.StatusDescription });
+                    message = _textService.Localize("healthcheck/httpsCheckInvalidUrl", new[] { url, response.StatusDescription });
                 }
             }
             catch (Exception ex)


TimezoneHelper tests

TimezoneHelper tests

--- test/Abp.Tests/Timing/TimezoneHelper_Tests.cs
+++ test/Abp.Tests/Timing/TimezoneHelper_Tests.cs
@@ -97,5 +97,52 @@
             TimezoneHelper.ConvertTimeFromUtcByIanaTimeZoneId(now, "Asia/Shanghai")
                 .ShouldBe(TimezoneHelper.ConvertFromUtc(now, "China Standard Time"));
         }
+
+        [Fact]
+        public void ConvertToDateTimeOffset_Date_With_America_NewYork_TimeZone_Should_Return_Correct_DateTimeOffset()
+        {
+            var testDate = new DateTime(1980,11,20);
+            var timeSpan = new TimeSpan(-5,0,0);
+
+            var dateTimeOffset = TimezoneHelper.ConvertToDateTimeOffset(testDate, "America/New_York");
+
+            dateTimeOffset.ShouldNotBeNull();
+            dateTimeOffset.Offset.ShouldBe(timeSpan);
+            dateTimeOffset.DateTime.ShouldBe(testDate);
+        }
+
+        [Fact]
+        public void ConvertToDateTimeOffset_Date_With_America_NewYork_TimeZone_Should_Return_Correct_DateTimeOffset_With_DaylightSavings()
+        {
+            var testDate = new DateTime(1980, 5, 20);
+            var timeSpan = new TimeSpan(-4, 0, 0);
+
+            var dateTimeOffset = TimezoneHelper.ConvertToDateTimeOffset(testDate, "America/New_York");
+
+            dateTimeOffset.ShouldNotBeNull();
+            dateTimeOffset.Offset.ShouldBe(timeSpan);
+            dateTimeOffset.DateTime.ShouldBe(testDate);
+        }
+
+        [Fact]
+        public void ConvertToDateTimeOffset_Dates_With_America_Phoenix_TimeZone_Should_Return_Correct_DateTimeOffsests_With_No_DaylightSavings()
+        {
+            var testDate = new DateTime(1980, 5, 20);
+            var timeSpan = new TimeSpan(-7, 0, 0);
+
+            var dateTimeOffset = TimezoneHelper.ConvertToDateTimeOffset(testDate, "America/Phoenix");
+
+            dateTimeOffset.ShouldNotBeNull();
+            dateTimeOffset.Offset.ShouldBe(timeSpan);
+            dateTimeOffset.DateTime.ShouldBe(testDate);
+
+            var testDate2 = new DateTime(1980, 11, 20);
+
+            var dateTimeOffset2 = TimezoneHelper.ConvertToDateTimeOffset(testDate2, "America/Phoenix");
+
+            dateTimeOffset2.ShouldNotBeNull();
+            dateTimeOffset2.Offset.ShouldBe(timeSpan); // should be the same timespan as previous date
+            dateTimeOffset2.DateTime.ShouldBe(testDate2);
+        }
     }
 }


Changed back MtClient variables from Protected to Private

--- src/MarginTrading.Client/MtClient.cs
+++ src/MarginTrading.Client/MtClient.cs
@@ -15,12 +15,12 @@
 {
     public class MtClient
     {
-        protected string _token;
-        protected string _notificationId;
-        protected string _serverAddress;
-        protected IWampRealmProxy _realmProxy;
-        protected IRpcMtFrontend _service;
-        protected IWampChannel _channel;
+        private string _token;
+        private string _notificationId;
+        private string _serverAddress;
+        private IWampRealmProxy _realmProxy;
+        private IRpcMtFrontend _service;
+        private IWampChannel _channel;

         public void Connect(ClientEnv env)
         {


Added missing locks

Added missing locks

	Added locks around 'connections' since it can be accessed/modified by
	multiple threads at the same time.
	Fixes bug #633474.

--- src/Mono.WebServer.FastCgi/Server.cs
+++ src/Mono.WebServer.FastCgi/Server.cs
@@ -265,7 +265,10 @@
 		///    open connections managed by the current instance.
 		/// </value>
 		public int ConnectionCount {
-			get {return connections.Count;}
+			get {
+				lock (connections)
+					return connections.Count;
+			}
 		}

 		/// <summary>
@@ -279,8 +282,10 @@
 		public int RequestCount {
 			get {
 				int requests = 0;
-				foreach (Connection c in connections)
-					requests += c.RequestCount;
+				lock (connections) {
+					foreach (Connection c in connections)
+						requests += c.RequestCount;
+				}

 				return requests;
 			}
@@ -342,8 +347,10 @@

 			started = false;
 			listen_socket.Close ();
-			foreach (Connection c in new List<Connection> (connections)) {
-				EndConnection (c);
+			lock (connections) {
+				foreach (Connection c in new List<Connection> (connections)) {
+					EndConnection (c);
+				}
 			}

 			runner.Abort ();
@@ -374,9 +381,11 @@
 				throw new ArgumentNullException ("connection");

 			connection.Stop ();
-
-			if (connections.Contains (connection))
-				connections.Remove (connection);
+
+			lock (connections) {
+				if (connections.Contains (connection))
+					connections.Remove (connection);
+			}

 			if (!accepting && CanAccept)
 				BeginAccept ();
@@ -611,7 +620,8 @@
 				try {
 					Socket accepted = listen_socket.EndAccept (ares);
 					connection = new Connection (accepted, this);
-					connections.Add (connection);
+					lock (connections)
+						connections.Add (connection);
 				} catch (System.Net.Sockets.SocketException e) {
 					Logger.Write (LogLevel.Error,
 						Strings.Server_AcceptFailed, e.Message);