Address review feedback

Address review feedback

--- src/Utilities/Compiler/WellKnownTypeProvider.cs
+++ src/Utilities/Compiler/WellKnownTypeProvider.cs
@@ -5,9 +5,11 @@
 using System.Collections.Generic;
 using System.Collections.Immutable;
 using System.Diagnostics.CodeAnalysis;
+using System.Globalization;
 using System.Linq;
 using System.Threading;
 using Analyzer.Utilities.Extensions;
+using Analyzer.Utilities.PooledObjects;
 using Microsoft.CodeAnalysis;

 namespace Analyzer.Utilities
@@ -73,8 +75,8 @@
         /// suggests the TypeNames collection can be checked to avoid expensive operations. But realizing TypeNames seems to be
         /// as memory intensive as unnecessary calls GetTypeByMetadataName() in some cases. So we'll go with namespace names.
         /// </remarks>
-        private static readonly ConcurrentDictionary<string, string[]> _fullTypeNameToNamespaceNames =
-            new ConcurrentDictionary<string, string[]>(StringComparer.Ordinal);
+        private static readonly ConcurrentDictionary<string, ImmutableArray<string>> _fullTypeNameToNamespaceNames =
+            new ConcurrentDictionary<string, ImmutableArray<string>>(StringComparer.Ordinal);
 #endif

         /// <summary>
@@ -99,7 +101,7 @@

                     INamedTypeSymbol? type = null;

-                    string[]? namespaceNames = null;
+                    ImmutableArray<string> namespaceNames;
 #if NETSTANDARD1_3 // Probably in 2.9.x branch; just don't cache.
                     namespaceNames = GetNamespaceNamesFromFullTypeName(fullTypeName);
 #else // Assuming we're on .NET Standard 2.0 or later, cache the type names that are probably compile time constants.
@@ -192,55 +194,101 @@
                 && typeArgumentPredicate(namedTypeSymbol.TypeArguments[0]);
         }

-        private static string[] GetNamespaceNamesFromFullTypeName(string fullTypeName)
-        {
-            int dotCount = 0;
-            int lastDotIndex = -1;
+        private static ImmutableArray<string> GetNamespaceNamesFromFullTypeName(string fullTypeName)
+        {
+            using ArrayBuilder<string> namespaceNamesBuilder = ArrayBuilder<string>.GetInstance();
+            RoslynDebug.Assert(namespaceNamesBuilder != null);
+
+            int prevStartIndex = 0;
             for (int i = 0; i < fullTypeName.Length; i++)
             {
-                switch (fullTypeName[i])
-                {
-                    case '.':
-                        lastDotIndex = i;
-                        dotCount++;
-                        break;
-
-                    // Dunno if Compilation.GetTypeByMetadataName() or IAssemblySymbol.GetTypeByMetadataName() will ever
-                    // support something like "System.Collections.Generic.List<System.String>", but if they do, we'll be ready.
-                    case '`':
-                    case '+':
-                    case '<':
-                    case '>':
-                    case '[':
-                    case ']':
-                    case '*':
-                    case ',':
-                        goto ExitLoop;
-                }
-            }
-
-            ExitLoop:
-            if (dotCount == 0)
-            {
-                return Array.Empty<string>();
-            }
-
-            string[] namespaceNames = new string[dotCount];
-            int namespaceIndex = 0;
-            int prevStartIndex = 0;
-            for (int i = 0; i <= lastDotIndex; i++)
-            {
                 if (fullTypeName[i] == '.')
                 {
-                    namespaceNames[namespaceIndex++] = fullTypeName[prevStartIndex..i];
+                    namespaceNamesBuilder.Add(fullTypeName[prevStartIndex..i]);
                     prevStartIndex = i + 1;
                 }
-            }
-
-            return namespaceNames;
-        }
-
-        private static bool IsSubsetOfCollection<T>(T[] set1, ICollection<T> set2)
+                else if (!IsIdentifierPartCharacter(fullTypeName[i]))
+                {
+                    break;
+                }
+            }
+
+            return namespaceNamesBuilder.ToImmutable();
+        }
+
+        /// <summary>
+        /// Returns true if the Unicode character can be a part of an identifier.
+        /// </summary>
+        /// <param name="ch">The Unicode character.</param>
+        private static bool IsIdentifierPartCharacter(char ch)
+        {
+            // identifier-part-character:
+            //   letter-character
+            //   decimal-digit-character
+            //   connecting-character
+            //   combining-character
+            //   formatting-character
+
+            if (ch < 'a') // '\u0061'
+            {
+                if (ch < 'A') // '\u0041'
+                {
+                    return ch >= '0'  // '\u0030'
+                        && ch <= '9'; // '\u0039'
+                }
+
+                return ch <= 'Z'  // '\u005A'
+                    || ch == '_'; // '\u005F'
+            }
+
+            if (ch <= 'z') // '\u007A'
+            {
+                return true;
+            }
+
+            if (ch <= '\u007F') // max ASCII
+            {
+                return false;
+            }
+
+            UnicodeCategory cat = CharUnicodeInfo.GetUnicodeCategory(ch);
+
+            ////return IsLetterChar(cat)
+            ////    || IsDecimalDigitChar(cat)
+            ////    || IsConnectingChar(cat)
+            ////    || IsCombiningChar(cat)
+            ////    || IsFormattingChar(cat);
+
+            switch (cat)
+            {
+                // Letter
+                case UnicodeCategory.UppercaseLetter:
+                case UnicodeCategory.LowercaseLetter:
+                case UnicodeCategory.TitlecaseLetter:
+                case UnicodeCategory.ModifierLetter:
+                case UnicodeCategory.OtherLetter:
+                case UnicodeCategory.LetterNumber:
+
+                // DecimalDigit
+                case UnicodeCategory.DecimalDigitNumber:
+
+                // ConnectingChar
+                case UnicodeCategory.ConnectorPunctuation:
+
+                // CombiningChar
+                case UnicodeCategory.NonSpacingMark:
+                case UnicodeCategory.SpacingCombiningMark:
+
+                // FormattingChar
+                case UnicodeCategory.Format:
+                    return true;
+
+                default:
+                    return false;
+            }
+        }
+
+        private static bool IsSubsetOfCollection<T>(ImmutableArray<T> set1, ICollection<T> set2)
         {
             if (set1.Length > set2.Count)
             {


Fix the build

Fix the build

--- src/Aggregates.NET.GetEventStore/Internal/StoreEvents.cs
+++ src/Aggregates.NET.GetEventStore/Internal/StoreEvents.cs
@@ -4,7 +4,6 @@
 using System.Threading;
 using System.Threading.Tasks;
 using Aggregates.Contracts;
-using Aggregates.Events;
 using Aggregates.Exceptions;
 using Aggregates.Extensions;
 using EventStore.ClientAPI;


Fix exceptions (now wrapped)

Fix exceptions (now wrapped)

but that's OK as this is new in 4.3 and the type is still the same.

--- tests/NLog.UnitTests/Targets/EventLogTargetTests.cs
+++ tests/NLog.UnitTests/Targets/EventLogTargetTests.cs
@@ -103,7 +103,7 @@
             </nlog>", maxMessageLength);

             NLogConfigurationException ex = Assert.Throws<NLogConfigurationException>(() => CreateConfigurationFromString(configrationText));
-            Assert.Equal("MaxMessageLength cannot be zero or negative.", ex.InnerException.Message);
+            Assert.Equal("MaxMessageLength cannot be zero or negative.", ex.InnerException.InnerException.Message);
         }

         [Theory]


fixed erroneous comment in AttributeRoute.

--- src/AttributeRouting.Web.Mvc/Framework/AttributeRoute.cs
+++ src/AttributeRouting.Web.Mvc/Framework/AttributeRoute.cs
@@ -1,6 +1,5 @@
 using System;
 using System.Collections.Generic;
-using System.Linq;
 using System.Web;
 using System.Web.Routing;
 using AttributeRouting.Framework;
@@ -9,7 +8,7 @@
 namespace AttributeRouting.Web.Mvc.Framework
 {
     /// <summary>
-    /// Route to use for ASP.NET Mvc or Web API web-hosted routes.
+    /// Route to use for ASP.NET MVC routes.
     /// </summary>
     public class AttributeRoute : Route, IAttributeRoute
     {


Line ending issue in XmlTransformationTests.

Fixes #351

--- src/Cake.Common.Tests/Unit/XML/XmlTransformationTests.cs
+++ src/Cake.Common.Tests/Unit/XML/XmlTransformationTests.cs
@@ -74,7 +74,7 @@
             public void Should_Throw_If_Xml_Not_Exists()
             {
                 // Given
-                var fixture = new XmlTransformationFixture(xmlExists:false)
+                var fixture = new XmlTransformationFixture(xmlExists: false)
                 {
                     XmlPath = "/Working/non_existsing.xml"
                 };
@@ -139,7 +139,7 @@
                         resultString = streamReader.ReadToEnd();
                     }
                 }
-                Assert.Equal(Resources.XmlTransformation_Htm, resultString);
+                Assert.Equal(Resources.XmlTransformation_Htm, resultString, ignoreLineEndingDifferences: true);
             }

             [Fact]
@@ -154,7 +154,7 @@
                 var result = XmlTransformation.Transform(xsl, xml);

                 // Then
-                Assert.Equal(htm, result);
+                Assert.Equal(htm, result, ignoreLineEndingDifferences: true);
             }

             [Fact]
@@ -173,7 +173,7 @@
                 var result = XmlTransformation.Transform(xsl, xml, settings);

                 // Then
-                Assert.Equal(htm, result);
+                Assert.Equal(htm, result, ignoreLineEndingDifferences: true);
             }

             [Fact]


Add a null check for empty comments.

Add a null check for empty comments.

--- src/CompetitionPlatform/Controllers/ProjectController.cs
+++ src/CompetitionPlatform/Controllers/ProjectController.cs
@@ -368,7 +368,10 @@

             foreach (var comment in comments)
             {
-                comment.Comment = Regex.Replace(comment.Comment, @"\r\n?|\n", "
");
+                if (!string.IsNullOrEmpty(comment.Comment))
+                {
+                    comment.Comment = Regex.Replace(comment.Comment, @"\r\n?|\n", "
");
+                }
             }

             var participants = await _participantsRepository.GetProjectParticipantsAsync(id);


Fix type name in XML doc (#9346)

Fix type name in XML doc (#9346)

--- src/Components/Components/src/Forms/ValidationMessage.cs
+++ src/Components/Components/src/Forms/ValidationMessage.cs
@@ -25,7 +25,7 @@
         [Parameter] public Expression<Func<T>> For { get; private set; }

         /// <summary>`
-        /// Constructs an instance of <see cref="ValidationSummary"/>.
+        /// Constructs an instance of <see cref="ValidationMessage{T}"/>.
         /// </summary>
         public ValidationMessage()
         {


Adding security attributes, more overloads and more documentation

--- src/ControlzEx/Microsoft.Windows.Shell/SystemCommands.cs
+++ src/ControlzEx/Microsoft.Windows.Shell/SystemCommands.cs
@@ -2,9 +2,12 @@
 namespace ControlzEx.Windows.Shell
 {
     using System;
+    using System.Security;
+    using System.Security.Permissions;
     using System.Windows;
     using System.Windows.Input;
     using System.Windows.Interop;
+    using System.Windows.Media;
     using ControlzEx.Native;
     using ControlzEx.Standard;

@@ -26,6 +29,7 @@
             ShowSystemMenuCommand = new RoutedCommand("ShowSystemMenu", typeof(SystemCommands));
         }

+        [SecurityCritical]
         private static void _PostSystemCommand(Window window, SC command)
         {
             var hwnd = new WindowInteropHelper(window).Handle;
@@ -37,24 +41,32 @@
             NativeMethods.PostMessage(hwnd, WM.SYSCOMMAND, new IntPtr((int)command), IntPtr.Zero);
         }

+        [SecuritySafeCritical]
+        [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
         public static void CloseWindow(Window window)
         {
             Verify.IsNotNull(window, "window");
             _PostSystemCommand(window, SC.CLOSE);
         }

+        [SecuritySafeCritical]
+        [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
         public static void MaximizeWindow(Window window)
         {
             Verify.IsNotNull(window, "window");
             _PostSystemCommand(window, SC.MAXIMIZE);
         }

+        [SecuritySafeCritical]
+        [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
         public static void MinimizeWindow(Window window)
         {
             Verify.IsNotNull(window, "window");
             _PostSystemCommand(window, SC.MINIMIZE);
         }

+        [SecuritySafeCritical]
+        [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
         public static void RestoreWindow(Window window)
         {
             Verify.IsNotNull(window, "window");
@@ -66,30 +78,80 @@
         ///
         /// <param name="window">The window for which the system menu should be shown.</param>
         /// <param name="e">The mouse event args.</param>
+        [SecuritySafeCritical]
+        [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
         public static void ShowSystemMenu(Window window, MouseButtonEventArgs e)
         {
             var mousePosition = e.GetPosition(window);
-            var physicalScreenLocation = window.PointToScreen(mousePosition);
+            var screenLocation = window.PointToScreen(mousePosition);
+            e.Handled = true;

-            ShowSystemMenu(window, physicalScreenLocation);
+            ShowSystemMenu(window, screenLocation);
         }

         /// Display the system menu at a specified location.
-        /// <param name="window">The MetroWindow</param>
+        /// <param name="visual">The visual for which the system menu should be displayed.</param>
+        /// <param name="elementPoint">The location to display the system menu, in logical screen coordinates.</param>
+        /// <remarks>
+        /// The dpi of <paramref name="visual"/> is used to calculate the final position.
+        /// </remarks>
+        [SecuritySafeCritical]
+        [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
+        public static void ShowSystemMenu(Visual visual, Point elementPoint)
+        {
+            Verify.IsNotNull(visual, "visual");
+
+            var screenLocation = visual.PointToScreen(elementPoint);
+            var dpi = visual.GetDpi();
+
+            ShowSystemMenuPhysicalCoordinates(visual, DpiHelper.LogicalPixelsToDevice(screenLocation, dpi.DpiScaleX, dpi.DpiScaleY));
+        }
+
+        /// Display the system menu at a specified location.
+        /// <param name="window">The window for which the system menu should be displayed.</param>
         /// <param name="screenLocation">The location to display the system menu, in logical screen coordinates.</param>
+        /// <remarks>
+        /// The dpi of <paramref name="window"/> is used to calculate the final position.
+        /// </remarks>
+        [SecuritySafeCritical]
+        [PermissionSet(SecurityAction.Demand, Name = "FullTrust")]
         public static void ShowSystemMenu(Window window, Point screenLocation)
         {
             Verify.IsNotNull(window, "window");

-            // Using fixed dpi scaling here because the menu gets placed way off otherwise
-            ShowSystemMenuPhysicalCoordinates(window, DpiHelper.LogicalPixelsToDevice(screenLocation, 1, 1));
+            var dpi = window.GetDpi();
+
+            ShowSystemMenuPhysicalCoordinates(window, DpiHelper.LogicalPixelsToDevice(screenLocation, dpi.DpiScaleX, dpi.DpiScaleY));
         }

-        internal static void ShowSystemMenuPhysicalCoordinates(Window window, Point physicalScreenLocation)
+        /// Display the system menu at a specified location.
+        /// <param name="visual">The visual for which the system menu should be displayed.</param>
+        /// <param name="physicalScreenLocation">The location to display the system menu, in physical screen coordinates.</param>
+        /// <remarks>
+        /// The dpi of <paramref name="visual"/> is NOT used to calculate the final coordinates.
+        /// So you have to pass the final coordinates.
+        /// </remarks>
+        [SecuritySafeCritical]
+        public static void ShowSystemMenuPhysicalCoordinates(Visual visual, Point physicalScreenLocation)
         {
-            Verify.IsNotNull(window, "window");
+            var hwndSource = (HwndSource)PresentationSource.FromVisual(visual);

-            var hwnd = new WindowInteropHelper(window).Handle;
+            ShowSystemMenuPhysicalCoordinates(hwndSource, physicalScreenLocation);
+        }
+
+        /// Display the system menu at a specified location.
+        /// <param name="source">The source/hwnd for which the system menu should be displayed.</param>
+        /// <param name="physicalScreenLocation">The location to display the system menu, in physical screen coordinates.</param>
+        /// <remarks>
+        /// The dpi of <paramref name="source"/> is NOT used to calculate the final coordinates.
+        /// So you have to pass the final coordinates.
+        /// </remarks>
+        [SecuritySafeCritical]
+        public static void ShowSystemMenuPhysicalCoordinates(HwndSource source, Point physicalScreenLocation)
+        {
+            Verify.IsNotNull(source, "source");
+
+            var hwnd = source.Handle;

             if (hwnd == IntPtr.Zero || !NativeMethods.IsWindow(hwnd))
             {
@@ -97,8 +159,8 @@
             }

             var hmenu = NativeMethods.GetSystemMenu(hwnd, false);
-
-            var cmd = NativeMethods.TrackPopupMenuEx(hmenu, Constants.TPM_LEFTBUTTON | Constants.TPM_RETURNCMD, (int)physicalScreenLocation.X, (int)physicalScreenLocation.Y, hwnd, IntPtr.Zero);
+            var flags = NativeMethods.GetSystemMetrics(SM.MENUDROPALIGNMENT);
+            var cmd = NativeMethods.TrackPopupMenuEx(hmenu, Constants.TPM_LEFTBUTTON | Constants.TPM_RETURNCMD | (uint)flags, (int)physicalScreenLocation.X, (int)physicalScreenLocation.Y, hwnd, IntPtr.Zero);
             if (0 != cmd)
             {
                 NativeMethods.PostMessage(hwnd, WM.SYSCOMMAND, new IntPtr(cmd), IntPtr.Zero);


Revert "fix: Properly rethrow exceptions in SocketGuild audio client"

This reverts commit adf4da19fc116759c4246c978143987712fa2116.

Someone hasn't written c# in a while

--- src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs
+++ src/Discord.Net.WebSocket/Entities/Guilds/SocketGuild.cs
@@ -549,10 +549,10 @@

                 await Discord.ApiClient.SendVoiceStateUpdateAsync(Id, channelId, selfDeaf, selfMute).ConfigureAwait(false);
             }
-            catch (Exception e)
+            catch (Exception)
             {
                 await DisconnectAudioInternalAsync().ConfigureAwait(false);
-                throw e;
+                throw;
             }
             finally
             {
@@ -566,10 +566,10 @@
                     throw new TimeoutException();
                 return await promise.Task.ConfigureAwait(false);
             }
-            catch (Exception e)
+            catch (Exception)
             {
                 await DisconnectAudioAsync().ConfigureAwait(false);
-                throw e;
+                throw;
             }
         }


simplified output fir the right assigned block

--- src/FastExpressionCompiler.LightExpression/Expression.cs
+++ src/FastExpressionCompiler.LightExpression/Expression.cs
@@ -2159,11 +2159,11 @@
         {
              if (Right is BlockExpression rightBlock) // it is valid to assign the block and it is used to my surprise
             {
-                sb.Append("/* The block result will be assigned to `")
+                sb.Append("//{ The block result will be assigned to `")
                     .Append(Left.ToCSharpString(new StringBuilder(), lineIdent, stripNamespace, printType, identSpaces))
-                    .Append("` {*/");
+                    .Append('`');
                 rightBlock.BlockToCSharpString(sb, lineIdent, stripNamespace, printType, identSpaces, false, blockResultAssignment: this);
-                return sb.NewLineIdent(lineIdent).Append("/*} end of block assignment */");
+                return sb.NewLineIdent(lineIdent).Append("//} end of block assignment");
             }

             Left.ToCSharpString(sb, lineIdent, stripNamespace, printType, identSpaces);


code fix for DVPL-3000:Jobs.Create() fails when there are a large number of jobs on the server.

--- SplunkSDK/JobCollection.cs
+++ SplunkSDK/JobCollection.cs
@@ -73,14 +73,14 @@
         /// <param name="query">The search query.</param>
         /// <param name="args">Additional arguments for this job.</param>
         /// <returns>The job.</returns>
-        public new Job Create(string query, Args args)
+        public new Job Create(string query, Args args)
         {
-            if (args != null && args.ContainsKey("exec_mode"))
+            if (args != null && args.ContainsKey("exec_mode"))
             {
-                if (args["exec_mode"].Equals("oneshot"))
+                if (args["exec_mode"].Equals("oneshot"))
                 {
                     throw new Exception(
-                      "Oneshot not allowed, use service oneshot search method");
+                        "Oneshot not allowed, use service oneshot search method");
                 }
             }
             args = Args.Create(args).Set("search", query);
@@ -90,14 +90,9 @@
             XmlDocument doc = new XmlDocument();
             doc.LoadXml(streamReader.ReadToEnd());
             string sid = doc.SelectSingleNode("/response/sid").InnerText;
-            this.Invalidate();
-            Job job = (Job)Get(sid);

-            // if job not yet scheduled, create an empty job object
-            if (job == null)
-            {
-                job = new Job(Service, "search/jobs/" + sid);
-            }
+            Job job = new Job(Service, "search/jobs/" + sid);
+            job.Refresh();

             return job;
         }


Added disabled tab to demo

Added disabled tab to demo

--- Cyotek.Windows.Forms.TabList.Demo/GeneralDemonstrationForm.Designer.cs
+++ Cyotek.Windows.Forms.TabList.Demo/GeneralDemonstrationForm.Designer.cs
@@ -58,6 +58,8 @@
       this.statusStrip1 = new System.Windows.Forms.StatusStrip();
       this.eventsSplitContainer = new System.Windows.Forms.SplitContainer();
       this.eventsListBox = new Cyotek.Windows.Forms.Demo.EventsListBox();
+      this.disabledTabListPage = new Cyotek.Windows.Forms.TabListPage();
+      this.disabledLabel = new System.Windows.Forms.Label();
       this.propertiesSplitContainer.Panel1.SuspendLayout();
       this.propertiesSplitContainer.Panel2.SuspendLayout();
       this.propertiesSplitContainer.SuspendLayout();
@@ -75,6 +77,7 @@
       this.eventsSplitContainer.Panel1.SuspendLayout();
       this.eventsSplitContainer.Panel2.SuspendLayout();
       this.eventsSplitContainer.SuspendLayout();
+      this.disabledTabListPage.SuspendLayout();
       this.SuspendLayout();
       //
       // propertiesSplitContainer
@@ -257,6 +260,7 @@
       this.tabList.Controls.Add(this.tabListPage1);
       this.tabList.Controls.Add(this.tabListPage2);
       this.tabList.Controls.Add(this.tabListPage3);
+      this.tabList.Controls.Add(this.disabledTabListPage);
       this.tabList.Dock = System.Windows.Forms.DockStyle.Fill;
       this.tabList.Location = new System.Drawing.Point(0, 0);
       this.tabList.Name = "tabList";
@@ -271,10 +275,8 @@
       // tabListPage1
       //
       this.tabListPage1.Controls.Add(this.fakeOptionPage11);
-      this.tabListPage1.Dock = System.Windows.Forms.DockStyle.Fill;
       this.tabListPage1.Name = "tabListPage1";
       this.tabListPage1.Size = new System.Drawing.Size(322, 407);
-      this.tabListPage1.TabIndex = 0;
       this.tabListPage1.Text = "Options";
       //
       // fakeOptionPage11
@@ -288,10 +290,8 @@
       // tabListPage2
       //
       this.tabListPage2.Controls.Add(this.fakeOptionPage21);
-      this.tabListPage2.Dock = System.Windows.Forms.DockStyle.Fill;
       this.tabListPage2.Name = "tabListPage2";
-      this.tabListPage2.Size = new System.Drawing.Size(42, 192);
-      this.tabListPage2.TabIndex = 1;
+      this.tabListPage2.Size = new System.Drawing.Size(322, 407);
       this.tabListPage2.Text = "More Options";
       //
       // fakeOptionPage21
@@ -299,16 +299,14 @@
       this.fakeOptionPage21.Dock = System.Windows.Forms.DockStyle.Fill;
       this.fakeOptionPage21.Location = new System.Drawing.Point(0, 0);
       this.fakeOptionPage21.Name = "fakeOptionPage21";
-      this.fakeOptionPage21.Size = new System.Drawing.Size(42, 192);
+      this.fakeOptionPage21.Size = new System.Drawing.Size(322, 407);
       this.fakeOptionPage21.TabIndex = 0;
       //
       // tabListPage3
       //
       this.tabListPage3.Controls.Add(this.fakeOptionPage31);
-      this.tabListPage3.Dock = System.Windows.Forms.DockStyle.Fill;
       this.tabListPage3.Name = "tabListPage3";
-      this.tabListPage3.Size = new System.Drawing.Size(42, 192);
-      this.tabListPage3.TabIndex = 2;
+      this.tabListPage3.Size = new System.Drawing.Size(322, 407);
       this.tabListPage3.Text = "Advanced Options";
       //
       // fakeOptionPage31
@@ -316,7 +314,7 @@
       this.fakeOptionPage31.Dock = System.Windows.Forms.DockStyle.Fill;
       this.fakeOptionPage31.Location = new System.Drawing.Point(0, 0);
       this.fakeOptionPage31.Name = "fakeOptionPage31";
-      this.fakeOptionPage31.Size = new System.Drawing.Size(42, 192);
+      this.fakeOptionPage31.Size = new System.Drawing.Size(322, 407);
       this.fakeOptionPage31.TabIndex = 0;
       //
       // menuStrip1
@@ -396,6 +394,28 @@
       this.eventsListBox.Name = "eventsListBox";
       this.eventsListBox.Size = new System.Drawing.Size(784, 95);
       this.eventsListBox.TabIndex = 0;
+      //
+      // disabledTabListPage
+      //
+      this.disabledTabListPage.Controls.Add(this.disabledLabel);
+      this.disabledTabListPage.Enabled = false;
+      this.disabledTabListPage.Name = "disabledTabListPage";
+      this.disabledTabListPage.Size = new System.Drawing.Size(322, 407);
+      this.disabledTabListPage.Text = "Disabled";
+      //
+      // disabledLabel
+      //
+      this.disabledLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+            | System.Windows.Forms.AnchorStyles.Left)
+            | System.Windows.Forms.AnchorStyles.Right)));
+      this.disabledLabel.Location = new System.Drawing.Point(32, 32);
+      this.disabledLabel.Margin = new System.Windows.Forms.Padding(32);
+      this.disabledLabel.Name = "disabledLabel";
+      this.disabledLabel.Size = new System.Drawing.Size(258, 348);
+      this.disabledLabel.TabIndex = 0;
+      this.disabledLabel.Text = "This TabListPage is disabled. Disabled pages cannot be automatically navigated in" +
+    "to.";
+      this.disabledLabel.TextAlign = System.Drawing.ContentAlignment.TopCenter;
       //
       // GeneralDemonstrationForm
       //
@@ -427,6 +447,7 @@
       this.eventsSplitContainer.Panel1.ResumeLayout(false);
       this.eventsSplitContainer.Panel2.ResumeLayout(false);
       this.eventsSplitContainer.ResumeLayout(false);
+      this.disabledTabListPage.ResumeLayout(false);
       this.ResumeLayout(false);
       this.PerformLayout();

@@ -464,6 +485,8 @@
     private GroupBox tabPagesGroupBox;
     private System.Windows.Forms.SplitContainer eventsSplitContainer;
     private EventsListBox eventsListBox;
+    private TabListPage disabledTabListPage;
+    private System.Windows.Forms.Label disabledLabel;
   }
 }


removed System.Linq usage from LightExpression; cleanup

--- src/FastExpressionCompiler.LightExpression/Expression.cs
+++ src/FastExpressionCompiler.LightExpression/Expression.cs
@@ -23,11 +23,10 @@
 */

 // ReSharper disable CoVariantArrayConversion
-//#if NET45 || NETSTANDARD1_3 || NETSTANDARD2_0
+//#if !NET35 && !NET40 && !NETSTANDARD1_0 && !NETSTANDARD1_1 && !NETSTANDARD1_2

 using System;
 using System.Collections.Generic;
-using System.Linq;
 using System.Linq.Expressions;
 using System.Reflection;
 using SysExpr = System.Linq.Expressions.Expression;
@@ -36,7 +35,6 @@
 {
 #pragma warning disable CS1591 // Missing XML comment for publicly visible type or member

-    // todo: To reduce allocations we may consider to introduce IExpression and made implementations a struct.
     /// <summary>Facade for constructing Expression.</summary>
     public abstract class Expression
     {
@@ -98,10 +96,6 @@

         public static NewExpression New(ConstructorInfo ctor) =>
             new NewExpression(ctor, Tools.Empty<Expression>());
-
-        // todo: Reduce allocations
-        //public static NewExpression New(ConstructorInfo ctor, Expression argument) =>
-        //    new NewExpression<Expression>(ctor, argument);

         public static NewExpression New(ConstructorInfo ctor, params Expression[] arguments) =>
             new NewExpression(ctor, arguments);
@@ -920,8 +914,8 @@
             return true;
         }

-        public static IReadOnlyList<T> AsReadOnlyList<T>(this IEnumerable<T> xs) =>
-            xs as IReadOnlyList<T> ?? xs.ToArray();
+        public static IReadOnlyList<T> AsReadOnlyList<T>(this IEnumerable<T> xs) =>
+            xs is IReadOnlyList<T> list ? list : xs == null ? null : new List<T>(xs);

         internal static bool IsImplicitlyNumericConvertibleTo(this Type source, Type target)
         {
@@ -1322,45 +1316,22 @@
     {
         public readonly IReadOnlyList<Expression> Arguments;

-        protected SysExpr[] ArgumentsToExpressions() => ToExpressions(Arguments);
-
         protected ArgumentsExpression(IReadOnlyList<Expression> arguments)
         {
             Arguments = arguments ?? Tools.Empty<Expression>();
         }
     }

-    // todo: The whole idea is to reduce allocations
-    public sealed class NewExpression<TArgs> : Expression
+    public sealed class NewExpression : ArgumentsExpression
     {
         public override ExpressionType NodeType => ExpressionType.New;
         public override Type Type => Constructor.DeclaringType;

         public readonly ConstructorInfo Constructor;
-        public readonly TArgs Arguments;
-
-        public override SysExpr ToExpression() =>
-            Arguments is Expression expr
-                ? SysExpr.New(Constructor, expr.ToExpression())
-                : SysExpr.New(Constructor, ToExpressions((IReadOnlyList<Expression>)Arguments));
-
-        internal NewExpression(ConstructorInfo constructor, TArgs arguments)
-        {
-            Constructor = constructor;
-            Arguments = arguments;
-        }
-    }
-
-    public sealed class NewExpression : ArgumentsExpression
-    {
-        public override ExpressionType NodeType => ExpressionType.New;
-        public override Type Type => Constructor.DeclaringType;
-
-        public readonly ConstructorInfo Constructor;

         public override SysExpr ToExpression() => ToNewExpression();

-        public System.Linq.Expressions.NewExpression ToNewExpression() => SysExpr.New(Constructor, ArgumentsToExpressions());
+        public System.Linq.Expressions.NewExpression ToNewExpression() => SysExpr.New(Constructor, ToExpressions(Arguments));

         internal NewExpression(ConstructorInfo constructor, IReadOnlyList<Expression> arguments) :
             base(arguments)
@@ -1379,9 +1350,9 @@

         public override SysExpr ToExpression() => NodeType == ExpressionType.NewArrayInit
             // ReSharper disable once AssignNullToNotNullAttribute
-            ? SysExpr.NewArrayInit(Type.GetElementType(), ArgumentsToExpressions())
+            ? SysExpr.NewArrayInit(Type.GetElementType(), ToExpressions(Arguments))
             // ReSharper disable once AssignNullToNotNullAttribute
-            : SysExpr.NewArrayBounds(Type.GetElementType(), ArgumentsToExpressions());
+            : SysExpr.NewArrayBounds(Type.GetElementType(), ToExpressions(Arguments));

         internal NewArrayExpression(ExpressionType expressionType, Type arrayType, IReadOnlyList<Expression> elements) : base(elements)
         {
@@ -1399,7 +1370,7 @@
         public readonly Expression Object;

         public override SysExpr ToExpression() =>
-            SysExpr.Call(Object?.ToExpression(), Method, ArgumentsToExpressions());
+            SysExpr.Call(Object?.ToExpression(), Method, ToExpressions(Arguments));

         internal MethodCallExpression(Expression @object, MethodInfo method, IReadOnlyList<Expression> arguments)
             : base(arguments)
@@ -1493,7 +1464,7 @@

         public readonly Expression Expression;

-        public override SysExpr ToExpression() => SysExpr.Invoke(Expression.ToExpression(), ArgumentsToExpressions());
+        public override SysExpr ToExpression() => SysExpr.Invoke(Expression.ToExpression(), ToExpressions(Arguments));

         internal InvocationExpression(Expression expression, IReadOnlyList<Expression> arguments, Type type) : base(arguments)
         {
@@ -1548,7 +1519,7 @@
         public readonly PropertyInfo Indexer;

         public override SysExpr ToExpression() =>
-            SysExpr.MakeIndex(Object.ToExpression(), Indexer, ArgumentsToExpressions());
+            SysExpr.MakeIndex(Object.ToExpression(), Indexer, ToExpressions(Arguments));

         internal IndexExpression(Expression @object, PropertyInfo indexer, IReadOnlyList<Expression> arguments)
             : base(arguments)
@@ -1701,7 +1672,7 @@
         public readonly Expression Body;

         public System.Linq.Expressions.SwitchCase ToSwitchCase() =>
-            SysExpr.SwitchCase(Body.ToExpression(), TestValues.Select(x => x.ToExpression()));
+            SysExpr.SwitchCase(Body.ToExpression(), Expression.ToExpressions(TestValues));

         public SwitchCase(Expression body, IEnumerable<Expression> testValues)
         {


Don't send hello world

Don't send hello world

--- SteamWebPipes/Bootstrap.cs
+++ SteamWebPipes/Bootstrap.cs
@@ -20,14 +20,15 @@
             {
                 socket.OnOpen = () =>
                 {
-                    Log("Open! {0}", socket.ConnectionInfo.ClientIpAddress);
                     ConnectedClients.Add(socket);
-                    socket.Send("hello world");
+
+                    Log("Client #{2} connected: {0}:{1}", socket.ConnectionInfo.ClientIpAddress, socket.ConnectionInfo.ClientPort, ConnectedClients.Count);
                 };
                 socket.OnClose = () =>
                 {
-                    Log("Close! {0}", socket.ConnectionInfo.ClientIpAddress);
                     ConnectedClients.Remove(socket);
+
+                    Log("Client #{2} disconnected: {0}:{1}", socket.ConnectionInfo.ClientIpAddress, socket.ConnectionInfo.ClientPort, ConnectedClients.Count);
                 };
             });

@@ -40,7 +41,7 @@

         public static void Broadcast(string message)
         {
-            foreach (var socket in ConnectedClients.ToList())
+            foreach (var socket in ConnectedClients)
             {
                 socket.Send(message);
             }


Implemented PostOrder.

Implemented PostOrder.

Need to implement GetResponse<T>(_orderRequest) next.

--- StockFighter/APIWrapper.cs
+++ StockFighter/APIWrapper.cs
@@ -112,6 +112,25 @@
             {
                 throw new ArgumentException("Stock \"" + stock + "\" in venue \""
                     + venue + "\" does not exist.");
+            }
+        }
+
+        public static OrderResponse PostOrder(OrderRequest order)
+        {
+            var orderRequest = new _orderRequest(order);
+
+            var orderResponse = GetResponse<_orderResponse>(orderRequest);
+
+            if(orderResponse != null)
+            {
+                var clientOrderResponse = new OrderResponse(orderResponse);
+
+                return clientOrderResponse;
+            }
+
+            else
+            {
+                throw new ArgumentException("Invalid OrderRequest.");
             }
         }


Fixed Saving Throws

Fixed Saving Throws

--- DnD_5e_CharacterSheet/ViewModels/MainWindowViewModel.CharacterSheet.cs
+++ DnD_5e_CharacterSheet/ViewModels/MainWindowViewModel.CharacterSheet.cs
@@ -503,6 +503,7 @@
                 {
                     model.StrengthSavingThrowEnabled = value;
                     OnPropertyChanged("StrengthSavingThrowEnabled");
+                    OnPropertyChanged("StrengthSavingThrow");
                 }
             }
         }
@@ -511,7 +512,7 @@
         {
             get
             {
-                return ProficiencyBonus + StrengthModifier;
+                return (StrengthSavingThrowEnabled ? ProficiencyBonus : 0) + StrengthModifier;
             }
         }

@@ -527,6 +528,7 @@
                 {
                     model.DexteritySavingThrowEnabled = value;
                     OnPropertyChanged("DexteritySavingThrowEnabled");
+                    OnPropertyChanged("DexteritySavingThrow");
                 }
             }
         }
@@ -535,7 +537,7 @@
         {
             get
             {
-                return ProficiencyBonus + DexterityModifier;
+                return (DexteritySavingThrowEnabled ? ProficiencyBonus : 0) + DexterityModifier;
             }
         }

@@ -551,6 +553,7 @@
                 {
                     model.ConstitutionSavingThrowEnabled = value;
                     OnPropertyChanged("ConstitutionSavingThrowEnabled");
+                    OnPropertyChanged("ConstitutionSavingThrow");
                 }
             }
         }
@@ -559,7 +562,7 @@
         {
             get
             {
-                return ProficiencyBonus + ConstitutionModifier;
+                return (ConstitutionSavingThrowEnabled ? ProficiencyBonus : 0) + ConstitutionModifier;
             }
         }

@@ -575,6 +578,7 @@
                 {
                     model.IntelligenceSavingThrowEnabled = value;
                     OnPropertyChanged("IntelligenceSavingThrowEnabled");
+                    OnPropertyChanged("IntelligenceSavingThrow");
                 }
             }
         }
@@ -583,7 +587,7 @@
         {
             get
             {
-                return ProficiencyBonus + IntelligenceModifier;
+                return (IntelligenceSavingThrowEnabled ? ProficiencyBonus : 0) + IntelligenceModifier;
             }
         }

@@ -599,6 +603,7 @@
                 {
                     model.WisdomSavingThrowEnabled = value;
                     OnPropertyChanged("WisdomSavingThrowEnabled");
+                    OnPropertyChanged("WisdomSavingThrow");
                 }
             }
         }
@@ -607,7 +612,7 @@
         {
             get
             {
-                return ProficiencyBonus + WisdomModifier;
+                return (WisdomSavingThrowEnabled ? ProficiencyBonus : 0) + WisdomModifier;
             }
         }

@@ -623,6 +628,7 @@
                 {
                     model.CharismaSavingThrowEnabled = value;
                     OnPropertyChanged("CharismaSavingThrowEnabled");
+                    OnPropertyChanged("CharismaSavingThrow");
                 }
             }
         }
@@ -631,7 +637,7 @@
         {
             get
             {
-                return ProficiencyBonus + CharismaModifier;
+                return (CharismaSavingThrowEnabled ? ProficiencyBonus : 0) + CharismaModifier;
             }
         }


Fixed aspect ratio not adjusting on zooming out. First pass, not bad.

--- Engines/FlatRedBallXNA/FlatRedBall/Entities/CameraControllingEntity.cs
+++ Engines/FlatRedBallXNA/FlatRedBall/Entities/CameraControllingEntity.cs
@@ -267,13 +267,12 @@
             if(currentSeparationDistance > noZoomDistance)
             {
                 Camera.Main.OrthogonalHeight = defaultOrthoHeight * currentSeparationDistance/noZoomDistance;
-
             }
             else
             {
                 Camera.Main.OrthogonalHeight = defaultOrthoHeight;
-                Camera.Main.FixAspectRatioYConstant();
-            }
+            }
+            Camera.Main.FixAspectRatioYConstant();
         }
     }
 }


Downgraded the optional router initialization errors to warnings.

--- src/Kephas.Messaging/Distributed/DefaultMessageBroker.cs
+++ src/Kephas.Messaging/Distributed/DefaultMessageBroker.cs
@@ -165,7 +165,7 @@
             }
             catch (Exception ex)
             {
-                this.Logger.Error(ex, $"Error while trying to create and initialize an instance of '{f.Metadata.AppServiceImplementationType}'.");
+                this.Logger.Warn(ex, $"Error while trying to create and initialize an instance of '{f.Metadata.AppServiceImplementationType}'.");
                 return null;
             }
         }


ASP.NET Core: set the profiler name

ASP.NET Core: set the profiler name

--- src/MiniProfiler.AspNetCore.Mvc/ProfilingActionFilter.cs
+++ src/MiniProfiler.AspNetCore.Mvc/ProfilingActionFilter.cs
@@ -3,6 +3,7 @@
 using Microsoft.AspNetCore.Mvc.Filters;
 using System;
 using System.Collections.Generic;
+using StackExchange.Profiling.Helpers;

 namespace StackExchange.Profiling.Mvc
 {
@@ -21,7 +22,7 @@
         {
             var mp = MiniProfiler.Current;
             if (mp != null)
-            {
+            {
                 var stack = filterContext.HttpContext.Items[StackKey] as Stack<IDisposable>;
                 if (stack == null)
                 {
@@ -36,9 +37,17 @@
                 switch (filterContext.ActionDescriptor)
                 {
                     case ControllerActionDescriptor cd:
+                        if (mp.Name.IsNullOrWhiteSpace())
+                        {
+                            mp.Name = $"{cd.ControllerName}/{cd.MethodInfo.Name}";
+                        }
                         stack.Push(mp.Step($"Controller: {area}{cd.ControllerName}.{cd.MethodInfo.Name}"));
                         break;
                     case ActionDescriptor ad:
+                        if (mp.Name.IsNullOrWhiteSpace())
+                        {
+                            mp.Name = ad.DisplayName;
+                        }
                         stack.Push(mp.Step($"Controller: {area}{ad.DisplayName}"));
                         break;
                 }


Wrong iteration count results in high probability of false negative

--- src/NUnitFramework/tests/Internal/RandomizerBiasTests.cs
+++ src/NUnitFramework/tests/Internal/RandomizerBiasTests.cs
@@ -58,7 +58,7 @@
             const decimal wholeRange = decimal.MaxValue * (2 / 3m);
             const decimal halfRange = wholeRange / 2;

-            const int totalCount = 10000;
+            const int totalCount = 100000;
             var countInTopHalf = 0;

             for (var i = 0; i < totalCount; i++)


rip +condition

rip +condition

--- kinect/BodyBasics-WPF/MainWindow.xaml.cs
+++ kinect/BodyBasics-WPF/MainWindow.xaml.cs
@@ -292,8 +292,8 @@
         public static int right_select = -1;

         public static void right_part(float angle)
-        {
-
+        {
+
             if(angle<=180&&angle>=120&&right_select!=0)
             {
                 Console.Out.WriteLine(" section " + 1 + " angle " + angle);
@@ -397,10 +397,8 @@

         public static void rip(Body body, JointType  ElbowLeft, JointType WristLeft, JointType WristRight,JointType ShoulderLeft)
       {
-          float angle = AngleBetweenJoints(body, JointType.ElbowRight, JointType.HandRight, JointType.ShoulderRight);
-
-
-            if ((angle<30)&&(body.Joints[ElbowLeft].Position.Y < body.Joints[WristLeft].Position.Y) && (body.Joints[ElbowLeft].Position.Y < body.Joints[ShoulderLeft].Position.Y))
+
+            if ((body.Joints[ElbowLeft].Position.Y < body.Joints[WristLeft].Position.Y) && (body.Joints[ElbowLeft].Position.Y < body.Joints[ShoulderLeft].Position.Y))
             {
               //  float valuerip = (body.Joints[WristRight].Position.Z) / Math.Abs(body.Joints[WristLeft].Position.Y - body.Joints[ElbowLeft].Position.Y);
               //// Console.Out.WriteLine("rip " + Math.Abs(pre_z - body.Joints[WristRight].Position.Z)*1000);
@@ -510,7 +508,12 @@
                                 else if (count == 2) { select = false; count = 1; }
                             }

-                            if (select && count == 2) { right_part(right_section); }
+                            if (select && count == 2) {
+   if ((body.Joints[JointType.ShoulderLeft].Position.Y < body.Joints[JointType.ElbowLeft].Position.Y) &&
+       (body.Joints[JointType.ElbowLeft].Position.Y < body.Joints[JointType.WristLeft].Position.Y))
+
+                                { right_part(right_section); }
+                            }

                             //=======================================================================================//
                             //find distance from z axis


#18242 Fix form validation (and small typo)

--HG--
branch : 1.x
extra : transplant_source : %D3I/%27Z%3C%E6%E3u%C8W%8C%406T%D0%12%E4%CE%7B

--- src/Orchard.Web/Modules/Orchard.Email/Rules/MailForms.cs
+++ src/Orchard.Web/Modules/Orchard.Email/Rules/MailForms.cs
@@ -48,11 +48,11 @@
         }
     }

-    public interface IFormHandler : IEventHandler {
+    public interface IFormEventHandler : IEventHandler {
         void Validating(dynamic context);
     }

-    public class MailFormsValitator : IFormHandler {
+    public class MailFormsValidator : IFormEventHandler {
         public Localizer T { get; set; }

         public void Validating(dynamic context) {


reversed the admin menus for twitter integration (TwitterConstants.Features.Twitter) and twitter signin (TwitterConstants.Features.Signin) (#8389)

Co-authored-by: Titus Anderson <17eea8129b98bbd080546cbc188bd83246a13e85@jefferson.kyschools.us>

--- src/OrchardCore.Modules/OrchardCore.Twitter/AdminMenu.cs
+++ src/OrchardCore.Modules/OrchardCore.Twitter/AdminMenu.cs
@@ -6,12 +6,12 @@

 namespace OrchardCore.Twitter
 {
-    [Feature(TwitterConstants.Features.Twitter)]
-    public class AdminMenu : INavigationProvider
+    [Feature(TwitterConstants.Features.Signin)]
+    public class AdminMenuSignin : INavigationProvider
     {
         private readonly IStringLocalizer S;

-        public AdminMenu(IStringLocalizer<AdminMenu> localizer)
+        public AdminMenuSignin(IStringLocalizer<AdminMenuSignin> localizer)
         {
             S = localizer;
         }
@@ -33,12 +33,12 @@
         }
     }

-    [Feature(TwitterConstants.Features.Signin)]
-    public class AdminMenuSignin : INavigationProvider
+    [Feature(TwitterConstants.Features.Twitter)]
+    public class AdminMenu : INavigationProvider
     {
         private readonly IStringLocalizer S;

-        public AdminMenuSignin(IStringLocalizer<AdminMenuSignin> localizer)
+        public AdminMenu(IStringLocalizer<AdminMenu> localizer)
         {
             S = localizer;
         }


unconditional

unconditional

--- ksp_plugin_adapter/ksp_plugin_adapter.cs
+++ ksp_plugin_adapter/ksp_plugin_adapter.cs
@@ -856,16 +856,14 @@
   }

   private void SetBodyFramesAndPrecalculateVessels() {
-    if (PluginRunning()) {
-      SetBodyFrames();
-      // Unfortunately there is no way to get scheduled between Planetarium and
-      // VesselPrecalculate, so we get scheduled after VesselPrecalculate, set
-      // the body frames for our weird tilt, and VesselPrecalculate manually.
-      // Sob.
-      foreach (var vessel in FlightGlobals.Vessels) {
-        vessel.precalc.enabled = true;
-        vessel.precalc.FixedUpdate();
-      }
+    SetBodyFrames();
+    // Unfortunately there is no way to get scheduled between Planetarium and
+    // VesselPrecalculate, so we get scheduled after VesselPrecalculate, set the
+    // body frames for our weird tilt, and VesselPrecalculate manually.
+    // Sob.
+    foreach (var vessel in FlightGlobals.Vessels) {
+      vessel.precalc.enabled = true;
+      vessel.precalc.FixedUpdate();
     }
   }


Use only 1 runspace in analysis service

Use only 1 runspace in analysis service

Having multiple runspaces crashed scriptanalyzer invocation because of the following two issues:
* PSCmdlet.WriteOutput being called from another thread than Begin/Process
* CompositionContainer.ComposeParts complaining that "...Only one batch can be composed at a time"

We used multiple runspaces in the first pace because PSSA was slow and having multiple instances sped things up. But having multiple runspaces is causing a lot of issues which are hard to debug. Also, PSSA has become significantly fast compared to the previous version and there having just one runspace should give a reasonable performance. And on the positive side we do not have to deal with the aforementioned crashes.

--- src/PowerShellEditorServices/Analysis/AnalysisService.cs
+++ src/PowerShellEditorServices/Analysis/AnalysisService.cs
@@ -24,7 +24,7 @@
     {
         #region Private Fields

-        private const int NumRunspaces = 2;
+        private const int NumRunspaces = 1;
         private RunspacePool analysisRunspacePool;
         private PSModuleInfo scriptAnalyzerModuleInfo;


Add tracking for PAYE not linked to credentials

Added a new check to see if the EmpRef was not found - if this is the
case we set a new value for the Title and PageId

--- src/SFA.DAS.EAS.Web/Views/EmployerAccount/Summary.cshtml
+++ src/SFA.DAS.EAS.Web/Views/EmployerAccount/Summary.cshtml
@@ -8,6 +8,11 @@
 {
     ViewBag.PageID = "page-onboard-paye-scheme-in-use";
     ViewBag.Title = "PAYE scheme already in use";
+}
+@if (Model.EmpRefNotFound)
+{
+    ViewBag.PageID = "page-onboard-paye-scheme-not-linked-to-credentials";
+    ViewBag.Title = "PAYE scheme not linked to credentials";
 }

 <div class="grid-row">


Corrected Example in documentation

Corrected Example in documentation

The example in the documentation was using a wrong name for the attribute. Corrected the usage in the example

--- src/Serilog/Core/MessageTemplateFormatMethodAttribute.cs
+++ src/Serilog/Core/MessageTemplateFormatMethodAttribute.cs
@@ -8,7 +8,7 @@
     /// </summary>
     /// <example>
     /// <code>
-    /// [LoggerMethod("messageTemplate")]
+    /// [MessageTemplateFormatMethod("messageTemplate")]
     /// public void Information(string messageTemplate, params object[] propertyValues)
     /// {
     ///     // Do something
@@ -38,4 +38,4 @@
         /// <value>The name of the message template parameter.</value>
         public string MessageTemplateParameterName { get; private set; }
     }
-}+}


Fix incorrect cleanup on logging test

Fix incorrect cleanup on logging test

--- osu.Framework.Tests/IO/TestLogging.cs
+++ osu.Framework.Tests/IO/TestLogging.cs
@@ -27,13 +27,20 @@
                 }
             }

-            Logger.Storage = new TemporaryNativeStorage()
-            Logger.Enabled = true;
-            Logger.NewEntry += logTest;
-            Logger.Error(new TestException(), "message");
-            Logger.NewEntry -= logTest;
-
-            Assert.IsNotNull(resolvedException, "exception wasn't forwarded by logger");
+            using (var storage = new TemporaryNativeStorage(nameof(TestExceptionLogging)))
+            {
+                Logger.Storage = storage;
+                Logger.Enabled = true;
+
+                Logger.NewEntry += logTest;
+                Logger.Error(new TestException(), "message");
+                Logger.NewEntry -= logTest;
+
+                Assert.IsNotNull(resolvedException, "exception wasn't forwarded by logger");
+
+                Logger.Enabled = false;
+                Logger.Flush();
+            }
         }

         [Test]


BUGFIX Cache: register hits for 1-N collections.

--- src/Sooda/ObjectMapper/SoodaObjectOneToManyCollection.cs
+++ src/Sooda/ObjectMapper/SoodaObjectOneToManyCollection.cs
@@ -176,6 +176,8 @@
             IEnumerable keysCollection = transaction.Cache.LoadCollection(cacheKey);
             if (keysCollection != null)
             {
+                SoodaStatistics.Global.RegisterCollectionCacheHit();
+                transaction.Statistics.RegisterCollectionCacheHit();
                 foreach (object o in keysCollection)
                 {
                     SoodaObject obj = factory.GetRef(transaction, o);


Optimise DependencyContainer lookups

Optimise DependencyContainer lookups

--- osu.Framework/Allocation/CacheInfo.cs
+++ osu.Framework/Allocation/CacheInfo.cs
@@ -6,7 +6,7 @@

 namespace osu.Framework.Allocation
 {
-    public readonly struct CacheInfo
+    public readonly struct CacheInfo : IEquatable<CacheInfo>
     {
         /// <summary>
         /// The name of the cached member.
@@ -38,5 +38,20 @@
         internal CacheInfo WithType(Type type) => new CacheInfo(type, Name, Parent);

         public override string ToString() => $"{nameof(Type)} = {Type?.ReadableName()}, {nameof(Name)} = {Name}, {nameof(Parent)} = {Parent?.ReadableName()}";
+
+        public override bool Equals(object obj) => obj is CacheInfo cacheInfo && Equals(cacheInfo);
+
+        public bool Equals(CacheInfo other) => Name == other.Name && Parent == other.Parent && Type == other.Type;
+
+        public override int GetHashCode()
+        {
+            unchecked
+            {
+                var hashCode = (Name != null ? Name.GetHashCode() : 0);
+                hashCode = (hashCode * 397) ^ (Parent != null ? Parent.GetHashCode() : 0);
+                hashCode = (hashCode * 397) ^ (Type != null ? Type.GetHashCode() : 0);
+                return hashCode;
+            }
+        }
     }
 }


Nicer error message

Nicer error message

--- src/SqlStreamStore.MsSql/MsSqlStreamStore.ListStreams.cs
+++ src/SqlStreamStore.MsSql/MsSqlStreamStore.ListStreams.cs
@@ -13,7 +13,7 @@
             ListNextStreamsPage listNextStreamsPage,
             CancellationToken cancellationToken)
         {
-            throw new System.NotImplementedException();
+            throw new System.NotImplementedException("ListStreams is only available in MsSqlStreamStoreV3 onwards.");
         }
     }
 }


Cleanup

Cleanup

--- osu.Game/Online/API/DummyAPIAccess.cs
+++ osu.Game/Online/API/DummyAPIAccess.cs
@@ -32,18 +32,12 @@
             get => state;
             private set
             {
-                APIState oldState = state;
-                APIState newState = value;
+                if (state == value)
+                    return;

                 state = value;

-                if (oldState != newState)
-                {
-                    Scheduler.Add(delegate
-                    {
-                        components.ForEach(c => c.APIStateChanged(this, newState));
-                    });
-                }
+                Scheduler.Add(() => components.ForEach(c => c.APIStateChanged(this, value)));
             }
         }


Cleaned ThreadLocalStorageLifecycle code; added public static RefreshCache that can be useful in some cases

--- src/StructureMap/Pipeline/ThreadLocalStorageLifecycle.cs
+++ src/StructureMap/Pipeline/ThreadLocalStorageLifecycle.cs
@@ -1,11 +1,10 @@
-using System;
+using System.Threading;

 namespace StructureMap.Pipeline
 {
     public class ThreadLocalStorageLifecycle : LifecycleBase
     {
-        [ThreadStatic] private static LifecycleObjectCache _cache;
-        private readonly object _locker = new object();
+        private static readonly ThreadLocal<IObjectCache> Cache = new ThreadLocal<IObjectCache>(() => new LifecycleObjectCache());

         public override void EjectAll(ILifecycleContext context)
         {
@@ -14,22 +13,12 @@

         public override IObjectCache FindCache(ILifecycleContext context)
         {
-            guaranteeHashExists();
-            return _cache;
+            return Cache.Value;
         }

-        private void guaranteeHashExists()
+        public static void RefreshCache()
         {
-            if (_cache == null)
-            {
-                lock (_locker)
-                {
-                    if (_cache == null)
-                    {
-                        _cache = new LifecycleObjectCache();
-                    }
-                }
-            }
+            Cache.Value.DisposeAndClear();
         }
     }
 }


Modify global index directly in the for loop

Moves the global index to a near break if not in a break yet

--- osu.Game/Screens/Play/BreakOverlay.cs
+++ osu.Game/Screens/Play/BreakOverlay.cs
@@ -158,25 +158,15 @@

             if (time > breaks[currentBreakIndex].EndTime)
             {
-                for (int i = currentBreakIndex; i < breaks.Count; i++)
-                {
-                    if (time <= breaks[i].EndTime)
-                    {
-                        currentBreakIndex = i;
+                for (; currentBreakIndex < breaks.Count; currentBreakIndex++)
+                    if (time <= breaks[currentBreakIndex].EndTime)
                         break;
-                    }
-                }
             }
             else if (time < breaks[currentBreakIndex].StartTime)
             {
-                for (int i = currentBreakIndex; i >= 0; i--)
-                {
-                    if (time >= breaks[i].StartTime)
-                    {
-                        currentBreakIndex = i;
+                for (; currentBreakIndex >= 0; currentBreakIndex--)
+                    if (time >= breaks[currentBreakIndex].StartTime)
                         break;
-                    }
-                }
             }

             // This ensures that IsBreakTime is generally consistent with the overlay's transforms during a break.


Do not change Margin for player settings groups on the PlayerLoader screen

--- osu.Game/Screens/Play/PlayerLoader.cs
+++ osu.Game/Screens/Play/PlayerLoader.cs
@@ -58,7 +58,7 @@
                 AutoSizeAxes = Axes.Both,
                 Direction = FillDirection.Vertical,
                 Spacing = new Vector2(0, 20),
-                Margin = new MarginPadding { Top = 100, Right = 10 },
+                Margin = new MarginPadding(25),
                 Children = new PlayerSettingsGroup[]
                 {
                     new VisualSettings(),


Check if SongSelect is current screen before playing selected song

--- osu.Game/Screens/Select/SongSelect.cs
+++ osu.Game/Screens/Select/SongSelect.cs
@@ -350,7 +350,7 @@
                     }
                 }

-                ensurePlayingSelected(preview);
+                if (IsCurrentScreen) ensurePlayingSelected(preview);
                 UpdateBeatmap(Beatmap.Value);
             }


clear

clear

--- CSharpGL/Utilities/Tuple.cs
+++ CSharpGL/Utilities/Tuple.cs
@@ -5,88 +5,6 @@

 namespace CSharpGL
 {
-
-    public static class Tuple
-    {
-
-        public static Tuple<T1> Create<T1>(T1 item1)
-        {
-            return new Tuple<T1>(item1);
-        }
-
-
-        public static Tuple<T1, T2> Create<T1, T2>(T1 item1, T2 item2)
-        {
-            return new Tuple<T1, T2>(item1, item2);
-        }
-
-
-        public static Tuple<T1, T2, T3> Create<T1, T2, T3>(T1 item1, T2 item2, T3 item3)
-        {
-            return new Tuple<T1, T2, T3>(item1, item2, item3);
-        }
-
-
-        public static Tuple<T1, T2, T3, T4> Create<T1, T2, T3, T4>(T1 item1, T2 item2, T3 item3, T4 item4)
-        {
-            return new Tuple<T1, T2, T3, T4>(item1, item2, item3, item4);
-        }
-
-
-        public static Tuple<T1, T2, T3, T4, T5> Create<T1, T2, T3, T4, T5>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5)
-        {
-            return new Tuple<T1, T2, T3, T4, T5>(item1, item2, item3, item4, item5);
-        }
-
-
-        public static Tuple<T1, T2, T3, T4, T5, T6> Create<T1, T2, T3, T4, T5, T6>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6)
-        {
-            return new Tuple<T1, T2, T3, T4, T5, T6>(item1, item2, item3, item4, item5, item6);
-        }
-
-
-        public static Tuple<T1, T2, T3, T4, T5, T6, T7> Create<T1, T2, T3, T4, T5, T6, T7>(T1 item1, T2 item2, T3 item3, T4 item4, T5 item5, T6 item6, T7 item7)
-        {
-            return new Tuple<T1, T2, T3, T4, T5, T6, T7>(item1, item2, item3, item4, item5, item6, item7);
-        }
-
-
-        internal static int CombineHashCodes(int h1, int h2)
-        {
-            return (h1 << 5) + h1 ^ h2;
-        }
-
-        internal static int CombineHashCodes(int h1, int h2, int h3)
-        {
-            return Tuple.CombineHashCodes(Tuple.CombineHashCodes(h1, h2), h3);
-        }
-
-        internal static int CombineHashCodes(int h1, int h2, int h3, int h4)
-        {
-            return Tuple.CombineHashCodes(Tuple.CombineHashCodes(h1, h2), Tuple.CombineHashCodes(h3, h4));
-        }
-
-        internal static int CombineHashCodes(int h1, int h2, int h3, int h4, int h5)
-        {
-            return Tuple.CombineHashCodes(Tuple.CombineHashCodes(h1, h2, h3, h4), h5);
-        }
-
-        internal static int CombineHashCodes(int h1, int h2, int h3, int h4, int h5, int h6)
-        {
-            return Tuple.CombineHashCodes(Tuple.CombineHashCodes(h1, h2, h3, h4), Tuple.CombineHashCodes(h5, h6));
-        }
-
-        internal static int CombineHashCodes(int h1, int h2, int h3, int h4, int h5, int h6, int h7)
-        {
-            return Tuple.CombineHashCodes(Tuple.CombineHashCodes(h1, h2, h3, h4), Tuple.CombineHashCodes(h5, h6, h7));
-        }
-
-        internal static int CombineHashCodes(int h1, int h2, int h3, int h4, int h5, int h6, int h7, int h8)
-        {
-            return Tuple.CombineHashCodes(Tuple.CombineHashCodes(h1, h2, h3, h4), Tuple.CombineHashCodes(h5, h6, h7, h8));
-        }
-    }
-

     public class Tuple<T1>
     {


MiniProfiler: lower default storage from 1 day to 20 minutes

This results in quite a bit of memory usage on high traffic sites.

--- App/StackExchange.DataExplorer/App_Start/MiniProfiler.cs
+++ App/StackExchange.DataExplorer/App_Start/MiniProfiler.cs
@@ -1,9 +1,11 @@
+using System;
 using System.Web;
 using System.Web.Mvc;
 using System.Linq;
 using StackExchange.DataExplorer.Controllers;
 using StackExchange.Profiling;
 using StackExchange.Profiling.Mvc;
+using StackExchange.Profiling.Storage;

 namespace StackExchange.DataExplorer
 {
@@ -21,11 +23,10 @@
         {
             WebRequestProfilerProvider.Settings.UserProvider = new ProxySafeUserProvider();
             MiniProfiler.Settings.SqlFormatter = new Profiling.SqlFormatters.SqlServerFormatter();
+            MiniProfiler.Settings.Storage = new HttpRuntimeCacheStorage(TimeSpan.FromMinutes(20));

             var ignored = MiniProfiler.Settings.IgnoredPaths.ToList();
-
             ignored.Add("/assets/");
-
             MiniProfiler.Settings.IgnoredPaths = ignored.ToArray();

             // Profile views


simplify code

simplify code

--- WalletWasabi.Gui/Config.cs
+++ WalletWasabi.Gui/Config.cs
@@ -330,32 +330,35 @@

 		private int CorrectMixUntilAnonymitySetValue()
 		{
-			if (int.TryParse(MixUntilAnonymitySet, out int mixUntilAnonymitySetValue))
-			{
-				if (mixUntilAnonymitySetValue <= PrivacyLevelSome)
-				{
-					MixUntilAnonymitySet = WalletWasabi.Models.MixUntilAnonymitySet.PrivacyLevelSome.ToString();
-					ToFile();
-					return PrivacyLevelSome;
-				}
-				else if (mixUntilAnonymitySetValue <= PrivacyLevelFine)
-				{
-					MixUntilAnonymitySet = WalletWasabi.Models.MixUntilAnonymitySet.PrivacyLevelFine.ToString();
-					ToFile();
-					return PrivacyLevelFine;
+			try
+			{
+				if (int.TryParse(MixUntilAnonymitySet, out int mixUntilAnonymitySetValue))
+				{
+					if (mixUntilAnonymitySetValue <= PrivacyLevelSome)
+					{
+						MixUntilAnonymitySet = WalletWasabi.Models.MixUntilAnonymitySet.PrivacyLevelSome.ToString();
+						return PrivacyLevelSome;
+					}
+					else if (mixUntilAnonymitySetValue <= PrivacyLevelFine)
+					{
+						MixUntilAnonymitySet = WalletWasabi.Models.MixUntilAnonymitySet.PrivacyLevelFine.ToString();
+						return PrivacyLevelFine;
+					}
+					else
+					{
+						MixUntilAnonymitySet = WalletWasabi.Models.MixUntilAnonymitySet.PrivacyLevelStrong.ToString();
+						return PrivacyLevelStrong;
+					}
 				}
 				else
 				{
 					MixUntilAnonymitySet = WalletWasabi.Models.MixUntilAnonymitySet.PrivacyLevelStrong.ToString();
-					ToFile();
 					return PrivacyLevelStrong;
 				}
 			}
-			else
-			{
-				MixUntilAnonymitySet = WalletWasabi.Models.MixUntilAnonymitySet.PrivacyLevelStrong.ToString();
+			finally
+			{
 				ToFile();
-				return PrivacyLevelStrong;
 			}
 		}


Ensure running.

Ensure running.

--- WalletWasabi.Gui/Global.cs
+++ WalletWasabi.Gui/Global.cs
@@ -178,7 +178,7 @@
 					using (BenchmarkLogger.Measure(operationName: "TorProcessManager.Start"))
 					{
 						TorManager = new TorProcessManager(TorSettings, Config.TorSocks5EndPoint);
-						await TorManager.StartAsync(ensureRunning: false).ConfigureAwait(false);
+						await TorManager.StartAsync(ensureRunning: true).ConfigureAwait(false);
 					}

 					var fallbackRequestTestUri = new Uri(Config.GetFallbackBackendUri(), "/api/software/versions");


Move CancelKeyPress handler to it own method for reuse

--- WalletWasabi.Gui/Global.cs
+++ WalletWasabi.Gui/Global.cs
@@ -13,7 +13,6 @@
 using System.Linq;
 using System.Net;
 using System.Net.Sockets;
-using System.Text;
 using System.Threading;
 using System.Threading.Tasks;
 using WalletWasabi.BitcoinCore;
@@ -27,7 +26,6 @@
 using WalletWasabi.CoinJoin.Client;
 using WalletWasabi.CoinJoin.Client.Clients;
 using WalletWasabi.CoinJoin.Client.Clients.Queuing;
-using WalletWasabi.CoinJoin.Client.Rounds;
 using WalletWasabi.Gui.Helpers;
 using WalletWasabi.Helpers;
 using WalletWasabi.Hwi.Models;
@@ -202,21 +200,10 @@
 				#region ProcessKillSubscription

 				AppDomain.CurrentDomain.ProcessExit += async (s, e) => await TryDesperateDequeueAllCoinsAsync();
-				Console.CancelKeyPress += async (s, e) =>
-				{
-					e.Cancel = true;
-					Logger.LogWarning("Process was signaled for killing.");
-
-					KillRequested = true;
-					await TryDesperateDequeueAllCoinsAsync();
-					Dispatcher.UIThread.PostLogException(() =>
-					{
-						var window = (Application.Current.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime).MainWindow;
-						window?.Close();
-					});
-					await DisposeAsync();
-
-					Logger.LogSoftwareStopped("Wasabi");
+				Console.CancelKeyPress += async (s, e) =>
+				{
+					e.Cancel = true;
+					await StopAndExitAsync();
 				};

 				#endregion ProcessKillSubscription
@@ -403,6 +390,22 @@
 			}
 		}

+		internal async Task StopAndExitAsync()
+		{
+			Logger.LogWarning("Process was signaled for killing.", nameof(Global));
+
+			KillRequested = true;
+			await TryDesperateDequeueAllCoinsAsync();
+			Dispatcher.UIThread.PostLogException(() =>
+			{
+				var window = (Application.Current.ApplicationLifetime as IClassicDesktopStyleApplicationLifetime).MainWindow;
+				window?.Close();
+			});
+			await DisposeAsync();
+
+			Logger.LogSoftwareStopped("Wasabi");
+		}
+
 		private async Task<AddressManagerBehavior> InitializeAddressManagerBehaviorAsync()
 		{
 			var needsToDiscoverPeers = true;


Use local variable

Use local variable

--- WalletWasabi.Gui/Global.cs
+++ WalletWasabi.Gui/Global.cs
@@ -321,7 +321,7 @@
 			Logger.LogInfo("Start connecting to nodes...");

 			var regTestMempoolServingNode = RegTestMempoolServingNode;
-			if (RegTestMempoolServingNode is { })
+			if (regTestMempoolServingNode is { })
 			{
 				regTestMempoolServingNode.VersionHandshake();
 				Logger.LogInfo("Start connecting to mempool serving regtest node...");


・Ver.1.2.00(Alpha-2)で追加された3つのインポート時の新オプションをfalseからtrue（チェック状態）に切り替えた

--- Assets/Editor/SpriteStudio/LibraryEditor_SpriteStudio.cs
+++ Assets/Editor/SpriteStudio/LibraryEditor_SpriteStudio.cs
@@ -142,9 +142,9 @@
 			EditorPrefs.SetBool(PrefsKeyFlagAttachControlGameObject, true);
 			EditorPrefs.SetBool(PrefsKeyFlagConfirmOverWrite, true);
 			EditorPrefs.SetBool(PrefsKeyFlagCreateProjectFolder, true);
-			EditorPrefs.SetBool(PrefsKeyFlagGetAnimationReferencedPartsRoot, false);
-			EditorPrefs.SetBool(PrefsKeyFlagGetMaterialPartsRoot, false);
-			EditorPrefs.SetBool(PrefsKeyFlagGetTextureMaterial, false);
+			EditorPrefs.SetBool(PrefsKeyFlagGetAnimationReferencedPartsRoot, true);
+			EditorPrefs.SetBool(PrefsKeyFlagGetMaterialPartsRoot, true);
+			EditorPrefs.SetBool(PrefsKeyFlagGetTextureMaterial, true);
 			EditorPrefs.SetString(PrefsKeyFolderNameImpoertLast, "");
 		}

@@ -156,9 +156,9 @@
 			DataSettingImport.FlagAttachControlGameObject = EditorPrefs.GetBool(PrefsKeyFlagAttachControlGameObject, true);
 			DataSettingImport.FlagConfirmOverWrite = EditorPrefs.GetBool(PrefsKeyFlagConfirmOverWrite, true);
 			DataSettingImport.FlagCreateProjectFolder = EditorPrefs.GetBool(PrefsKeyFlagCreateProjectFolder, true);
-			DataSettingImport.FlagGetAnimationReferencedPartsRoot = EditorPrefs.GetBool(PrefsKeyFlagGetAnimationReferencedPartsRoot, false);
-			DataSettingImport.FlagGetMaterialPartsRoot = EditorPrefs.GetBool(PrefsKeyFlagGetMaterialPartsRoot, false);
-			DataSettingImport.FlagGetTextureMaterial = EditorPrefs.GetBool(PrefsKeyFlagGetTextureMaterial, false);
+			DataSettingImport.FlagGetAnimationReferencedPartsRoot = EditorPrefs.GetBool(PrefsKeyFlagGetAnimationReferencedPartsRoot, true);
+			DataSettingImport.FlagGetMaterialPartsRoot = EditorPrefs.GetBool(PrefsKeyFlagGetMaterialPartsRoot, true);
+			DataSettingImport.FlagGetTextureMaterial = EditorPrefs.GetBool(PrefsKeyFlagGetTextureMaterial, true);
 		}
 		internal static void SettingSetImport(ref SettingImport DataSettingImport)
 		{


Fixed tile renaming, when the name wasn't changed

--- unity/Assets/Scripts/QuestEditor/EditorComponent.cs
+++ unity/Assets/Scripts/QuestEditor/EditorComponent.cs
@@ -242,14 +242,16 @@
     // Item renamed
     public void RenameFinished()
     {
-        // Trim non alpha numeric
+        // Remove all not allowed characters from name
         string newName = System.Text.RegularExpressions.Regex.Replace(rename.value, "[^A-Za-z0-9_]", "");
         // Must have a name
-        if (newName.Equals("")) return;
+        if (newName == string.Empty) return;
         // Add type
         string baseName = component.typeDynamic + newName;
         // Find first available unique name
         string name = baseName;
+        // If nothing has changed, skip renaming
+        if (component.sectionName.Equals(baseName, System.StringComparison.Ordinal)) return;
         Game game = Game.Get();
         int i = 0;
         while (game.quest.qd.components.ContainsKey(name))


#39 fixed

#39 fixed

--- Assets/Scripts/Scene/Entities/Player/PlayerController.cs
+++ Assets/Scripts/Scene/Entities/Player/PlayerController.cs
@@ -5,368 +5,432 @@

 public class PlayerController : MonoBehaviour, IPan
 {
-	private Transform player;
-	private SpriteRenderer spriteRenderer;
-	[SerializeField]
-	private GameObject ashes;
-	private Animator animator;
-
-	public enum PlayerAnimState
-	{
-		Idle = 0,
-		Walk = 1,
-		Push = 2,
-		Action = 3,
-		Wash = 4
-
-	}
-
-	private PlayerAnimState animState;
-
-	public PlayerAnimState AnimState { get { return animState; } set { animState = value; } }
-
-	private Timer actionTimer;
-	private const float PLAYER_SPEED = 0.4f;
-	private bool canSwitch;
-	private bool canMove;
-	private Vector2 lastSwitchDirection;
-	private HandController hands;
-	private Vector2 previousPosition;
-	public Vector2 movement;
-	private Vector2 nextMovement;
-
-	public Vector2 NextDirection { get { return nextMovement; } }
-
-	public bool playerMoving;
-	private Transform objectPushing;
-	private Vector2 previousPushablePosition;
-	private Timer timer;
-
-	private bool Moving { get { return timer.running; } }
-
-	public bool IsAlive { get; set; }
-
-	void Awake()
-	{
-		player = transform;
-
-		spriteRenderer = GetComponent<SpriteRenderer>();
-
-		hands = GetComponent<HandController>();
-
-		animator = GetComponent<Animator>();
-	}
-
-	void Start()
-	{
-		timer = new Timer(PLAYER_SPEED, CompleteMoving);
-		timer.repeating = true;
-
-		actionTimer = new Timer(PLAYER_SPEED, CompleteAction);
-
-		var detector = FindObjectOfType<HandyDetector>();
-		if (detector != null) {
-			detector.defaultObject = gameObject;
-		}
-
-		previousPosition = player.position;
-
-		animState = PlayerAnimState.Idle;
-
-		canSwitch = true;
-		canMove = true;
-
-		GroupManager.main.group["Running"].Add(this);
-		GroupManager.main.group["Running"].Add(this, new GroupDelegator(null, null, GoBackToIdle));
-
-		KeyboardController.Instance.KeyboardEventHandler = this;
-
-		IsAlive = true;
-	}
-
-	#region Gestures
-
-	public void OnGesturePan(PanArgs args)
-	{
-		if (timer == null)
-			timer = new Timer();
-
-		PlayerMoving(args);
-	}
-
-	public void PlayerMoving(PanArgs args)
-	{
-		//Debug.Log(args.state);
-		switch (args.state) {
-			case PanArgs.State.Move:
-				var x = args.delta.x;
-				var y = args.delta.y;
-
-				if (Math.Abs(x - y) >= 1f) {
-					nextMovement = Math.Abs(x) > Math.Abs(y) ? new Vector2(x < 0 ? 1 : -1, 0) : new Vector2(0, y < 0 ? 1 : -1);
-				}
-
-				if ((canMove || nextMovement != movement) && !Moving && CanMove()) {
-					timer.Reset();
-					canSwitch = true;
-					canMove = true;
-				}
-
-				playerMoving = true;
-				break;
-			case PanArgs.State.Hold:
-				playerMoving = true;
-				break;
-			case PanArgs.State.Interrupt:
-			case PanArgs.State.Up:
-				canSwitch = true;
-				canMove = true;
-				playerMoving = false;
-				break;
-			default:
-				playerMoving = false;
-				break;
-		}
-	}
-
-	#endregion
-
-	// Update is called once per frame
-	void Update()
-	{
-		// Tutorial [Manually coded for now] //
-		// TODO: Make it proper!
-
-		if (!GameWorld.dialogueOff) {
-			if (LevelManager.Instance.Level == 0) {
-				if (DialogueManager.CurrentDialogue == 2 && Vector2.Distance(player.position, new Vector2(3, 3)) <= 0.1) {
-					playerMoving = false;
-					canMove = false;
-
-					if (DialogueManager.CurrentDialogue == 2 && Vector2.Distance(player.position, new Vector2(3, 3)) == 0.0f) {
-						timer.Stop();
-
-						DialogueManager.DialogueComplete = GameWorld.GoBackToLevel;
-						GroupManager.main.activeGroup = GroupManager.main.group["Dialogue"];
-					}
-				} else if (DialogueManager.CurrentDialogue == 4 && hands.state == HandController.HandState.Clean) {
-					DialogueManager.DialogueComplete = GameWorld.GoBackToLevel;
-					GroupManager.main.activeGroup = GroupManager.main.group["Dialogue"];
-				}
-			} else if (LevelManager.Instance.Level == 4) {
-				if (DialogueManager.CurrentDialogue == 10 && Vector2.Distance(player.position, new Vector2(6, 1)) < 2.0f) {
-					playerMoving = false;
-					canMove = false;
-
-					if (DialogueManager.CurrentDialogue == 10 && (player.position == new Vector3(5, 2, 0) || Vector2.Distance(player.position, new Vector2(6, 1)) == 1.0f)) {
-						timer.Stop();
-
-						DialogueManager.DialogueComplete = GameWorld.GoBackToLevel;
-						GroupManager.main.activeGroup = GroupManager.main.group["Dialogue"];
-					}
-				}
-			}
-		}
-
-		spriteRenderer.sortingOrder = LevelLoader.PlaceDepth(player.position.y) + 1;//-Mathf.RoundToInt(4 * player.position.y) + 1;
-
-		if (hands.IsInfected()) {
-			animator.SetTrigger("Infect");
-
-			AudioManager.StopSFX("Heartbeat");
-			AudioManager.PlaySFX("Player Infected");
-
-			IsAlive = false;
-
-			GameWorld.levelOverReason = GameWorld.LevelOverReason.PlayerInfected;
-
-			return;
-		}
-
-		if (IsAlive) {
-			timer.Update();
-			actionTimer.Update();
-
-			if (Moving) {
-				var newPosition = previousPosition + timer.progress * movement;
-				if (objectPushing != null) {
-					objectPushing.position += newPosition.xy0() - player.position;
-					animState = PlayerAnimState.Push;
-				} else {
-					animState = PlayerAnimState.Walk;
-				}
-
-				player.position = newPosition;
-			} else {
-				if ((int)animState < 3) {
-					animState = PlayerAnimState.Idle;
-				}
-			}
-
-			SetAnimationState(Moving ? movement : nextMovement);
-			animator.SetInteger("State", (int)animState);
-
-			if (lastSwitchDirection != nextMovement) {
-				canSwitch = true;
-			}
-		}
-	}
-
-	private void SetAnimationState(Vector2 directionVector)
-	{
-		string direction = null;
-
-		if (directionVector == new Vector2(0, -1)) {
-			direction = "Down";
-		} else if (directionVector == new Vector2(0, 1)) {
-			direction = "Up";
-		} else if (directionVector == new Vector2(1, 0)) {
-			direction = "Right";
-		} else if (directionVector == new Vector2(-1, 0)) {
-			direction = "Left";
-		}
-
-		if (direction != null) {
-			animator.CrossFade(animState.ToString() + " " + direction, 0.0f);
-		}
-	}
-
-	private bool CanMove()
-	{
-		objectPushing = null;
-
-		movement = nextMovement;
-
-		// Get the next position
-		var nextPosition = previousPosition + nextMovement;
-
-		// Check collisions
-		var hit = Physics2D.Raycast(nextPosition, nextMovement, 0.0f);
-
-		if (hit.collider == null)
-			return true;
-
-		//Debug.Log("Collided with " + hit.collider.name + " [" + hit.collider.tag + "].");
-
-		switch (hit.collider.tag) {
-			case "Wall":
-				return false;
-
-			case "Pushable":
-				var pushable = hit.collider.GetComponent<Pushable>();
-				var canPush = pushable.Push(nextMovement);
-
-				if (canPush && hit.transform.name.StartsWith("Trolley")) {
-					StartAction();
-				}
-
-				canMove = canPush && pushable.MovingWithPlayer;
-				if (canMove) {
-					objectPushing = pushable.transform;
-					previousPushablePosition = objectPushing.position;
-				}
-
-				return canMove;
-
-			case "Collectible":
-				var collectible = hit.collider.GetComponent<Collectible>();
-				collectible.Collect();
-
-				return true;
-
-			case "Accessible":
-				var accessible = hit.collider.GetComponent<Accessible>();
-
-				if (accessible.name.StartsWith("Fountain")) {
-					if (!GameWorld.dialogueOff && LevelManager.Instance.Level == 0 && DialogueManager.CurrentDialogue == 3) {
-						DialogueManager.DialogueComplete = GameWorld.GoBackToLevel;
-						GroupManager.main.activeGroup = GroupManager.main.group["Dialogue"];
-
-						return false;
-					}
-				}
-
-				return accessible.Enter();
-
-			case "Switchable":
-				if (canSwitch) {
-					Switchable switchable = hit.collider.GetComponent<Switchable>();
-					switchable.Switch();
-
-					canSwitch = false;
-					lastSwitchDirection = nextMovement;
-
-					if (!switchable.name.StartsWith("Patient")) {
-						StartAction();
-					}
-				}
-				return false;
-
-			default:
-				return true;
-		}
-	}
-
-	private void CompleteMoving()
-	{
-		previousPosition += movement;
-		player.position = previousPosition;
-
-		if (objectPushing != null) {
-			previousPushablePosition += movement;
-			objectPushing.position = previousPushablePosition;
-		}
-
-		if (playerMoving && CanMove()) {
-			movement = nextMovement;
-		} else {
-			timer.Stop();
-
-			objectPushing = null;
-		}
-	}
-
-	private void StartAction()
-	{
-		animState = PlayerAnimState.Action;
-		actionTimer.Reset();
-	}
-
-	private void CompleteAction()
-	{
-		if (animState == PlayerAnimState.Action) {
-			animState = PlayerAnimState.Idle;
-		}
-	}
-
-	private void GoBackToIdle()
-	{
-		if (IsAlive) {
-			animState = PlayerAnimState.Idle;
-
-			SetAnimationState(nextMovement);
-			animator.SetInteger("State", (int)animState);
-		}
-		IsAlive = true;
-		this.collider2D.enabled = true;
-	}
-
-	public void Die(GameWorld.LevelOverReason reason = GameWorld.LevelOverReason.LaserKilledPlayer)
-	{
-		IsAlive = false;
-		this.collider2D.enabled = false;
-
-		if (reason == GameWorld.LevelOverReason.Squashed) {
-			renderer.enabled = false;
-			animator.enabled = false;
-			transform.localScale = new Vector3(
-				transform.localScale.x * 0.1f,
-				transform.localScale.y,
-				transform.localScale.z);
-		} else {
-			animator.SetTrigger("Die");
-			Entity.Replace(this.gameObject, ashes);
-		}
-		GameWorld.levelOverReason = reason;
-	}
+    private Transform player;
+    private SpriteRenderer spriteRenderer;
+    [SerializeField]
+    private GameObject ashes;
+    private Animator animator;
+
+    public enum PlayerAnimState
+    {
+        Idle = 0,
+        Walk = 1,
+        Push = 2,
+        Action = 3,
+        Wash = 4
+
+    }
+
+    private PlayerAnimState animState;
+
+    public PlayerAnimState AnimState { get { return animState; } set { animState = value; } }
+
+    private Timer actionTimer;
+    private const float PLAYER_SPEED = 0.4f;
+    private bool canSwitch;
+    private bool canMove;
+    private Vector2 lastSwitchDirection;
+    private HandController hands;
+    private Vector2 previousPosition;
+    public Vector2 movement;
+    private Vector2 nextMovement;
+
+    public Vector2 NextDirection { get { return nextMovement; } }
+
+    public bool playerMoving;
+    private Transform objectPushing;
+    private Vector2 previousPushablePosition;
+    private Timer timer;
+
+    private bool Moving { get { return timer.running; } }
+
+    public bool IsAlive { get; set; }
+
+    void Awake()
+    {
+        player = transform;
+
+        spriteRenderer = GetComponent<SpriteRenderer>();
+
+        hands = GetComponent<HandController>();
+
+        animator = GetComponent<Animator>();
+    }
+
+    void Start()
+    {
+        timer = new Timer(PLAYER_SPEED, CompleteMoving);
+        timer.repeating = true;
+
+        actionTimer = new Timer(PLAYER_SPEED, CompleteAction);
+
+        var detector = FindObjectOfType<HandyDetector>();
+        if (detector != null)
+        {
+            detector.defaultObject = gameObject;
+        }
+
+        previousPosition = player.position;
+
+        animState = PlayerAnimState.Idle;
+
+        canSwitch = true;
+        canMove = true;
+
+        GroupManager.main.group["Running"].Add(this);
+        GroupManager.main.group["To Level Over"].Add(this, new GroupDelegator(null, GoBackToIdle, null));
+
+        GroupManager.main.group["Dialogue"].Add(this, new GroupDelegator(null, GoBackToIdle, null));
+        //GroupManager.main.group["Dialogue"].Add(this, new GroupDelegator(null, PauseAnimation, UnpauseAnimation));
+
+        GroupManager.main.group["Paused"].Add(this, new GroupDelegator(null, PauseAnimation, UnpauseAnimation));
+
+        KeyboardController.Instance.KeyboardEventHandler = this;
+
+        IsAlive = true;
+    }
+
+    #region Gestures
+
+    public void OnGesturePan(PanArgs args)
+    {
+        if (timer == null)
+            timer = new Timer();
+
+        PlayerMoving(args);
+    }
+
+    public void PlayerMoving(PanArgs args)
+    {
+        //Debug.Log(args.state);
+        switch (args.state)
+        {
+            case PanArgs.State.Move:
+                var x = args.delta.x;
+                var y = args.delta.y;
+
+                if (Math.Abs(x - y) >= 1f)
+                {
+                    nextMovement = Math.Abs(x) > Math.Abs(y) ? new Vector2(x < 0 ? 1 : -1, 0) : new Vector2(0, y < 0 ? 1 : -1);
+                }
+
+                if ((canMove || nextMovement != movement) && !Moving && CanMove())
+                {
+                    timer.Reset();
+                    canSwitch = true;
+                    canMove = true;
+                }
+
+                playerMoving = true;
+                break;
+            case PanArgs.State.Hold:
+                playerMoving = true;
+                break;
+            case PanArgs.State.Interrupt:
+            case PanArgs.State.Up:
+                canSwitch = true;
+                canMove = true;
+                playerMoving = false;
+                break;
+            default:
+                playerMoving = false;
+                break;
+        }
+    }
+
+    #endregion
+
+    // Update is called once per frame
+    void Update()
+    {
+        // Tutorial [Manually coded for now] //
+        // TODO: Make it proper!
+
+        if (!GameWorld.dialogueOff)
+        {
+            if (LevelManager.Instance.Level == 0)
+            {
+                if (DialogueManager.CurrentDialogue == 2 && Vector2.Distance(player.position, new Vector2(3, 3)) <= 0.1)
+                {
+                    playerMoving = false;
+                    canMove = false;
+
+                    if (DialogueManager.CurrentDialogue == 2 && Vector2.Distance(player.position, new Vector2(3, 3)) == 0.0f)
+                    {
+                        timer.Stop();
+
+                        DialogueManager.DialogueComplete = GameWorld.GoBackToLevel;
+                        GroupManager.main.activeGroup = GroupManager.main.group["Dialogue"];
+                    }
+                }
+                else if (DialogueManager.CurrentDialogue == 4 && hands.state == HandController.HandState.Clean)
+                {
+                    DialogueManager.DialogueComplete = GameWorld.GoBackToLevel;
+                    GroupManager.main.activeGroup = GroupManager.main.group["Dialogue"];
+                }
+            }
+            else if (LevelManager.Instance.Level == 4)
+            {
+                if (DialogueManager.CurrentDialogue == 10 && Vector2.Distance(player.position, new Vector2(6, 1)) < 2.0f)
+                {
+                    playerMoving = false;
+                    canMove = false;
+
+                    if (DialogueManager.CurrentDialogue == 10 && (player.position == new Vector3(5, 2, 0) || Vector2.Distance(player.position, new Vector2(6, 1)) == 1.0f))
+                    {
+                        timer.Stop();
+
+                        DialogueManager.DialogueComplete = GameWorld.GoBackToLevel;
+                        GroupManager.main.activeGroup = GroupManager.main.group["Dialogue"];
+                    }
+                }
+            }
+        }
+
+        spriteRenderer.sortingOrder = LevelLoader.PlaceDepth(player.position.y) + 1;//-Mathf.RoundToInt(4 * player.position.y) + 1;
+
+        if (hands.IsInfected())
+        {
+            animator.SetTrigger("Infect");
+
+            AudioManager.StopSFX("Heartbeat");
+            AudioManager.PlaySFX("Player Infected");
+
+            IsAlive = false;
+
+            GameWorld.levelOverReason = GameWorld.LevelOverReason.PlayerInfected;
+
+            return;
+        }
+
+        if (IsAlive)
+        {
+            timer.Update();
+            actionTimer.Update();
+
+            if (Moving)
+            {
+                var newPosition = previousPosition + timer.progress * movement;
+                if (objectPushing != null)
+                {
+                    objectPushing.position += newPosition.xy0() - player.position;
+                    animState = PlayerAnimState.Push;
+                }
+                else
+                {
+                    animState = PlayerAnimState.Walk;
+                }
+
+                player.position = newPosition;
+            }
+            else
+            {
+                if ((int)animState < 3)
+                {
+                    animState = PlayerAnimState.Idle;
+                }
+            }
+
+            SetAnimationState(Moving ? movement : nextMovement);
+            animator.SetInteger("State", (int)animState);
+
+            if (lastSwitchDirection != nextMovement)
+            {
+                canSwitch = true;
+            }
+        }
+    }
+
+    private void SetAnimationState(Vector2 directionVector)
+    {
+        string direction = null;
+
+        if (directionVector == new Vector2(0, -1))
+        {
+            direction = "Down";
+        }
+        else if (directionVector == new Vector2(0, 1))
+        {
+            direction = "Up";
+        }
+        else if (directionVector == new Vector2(1, 0))
+        {
+            direction = "Right";
+        }
+        else if (directionVector == new Vector2(-1, 0))
+        {
+            direction = "Left";
+        }
+
+        if (direction != null)
+        {
+            animator.CrossFade(animState.ToString() + " " + direction, 0.0f);
+        }
+
+    }
+
+    private bool CanMove()
+    {
+        objectPushing = null;
+
+        movement = nextMovement;
+
+        // Get the next position
+        var nextPosition = previousPosition + nextMovement;
+
+        // Check collisions
+        var hit = Physics2D.Raycast(nextPosition, nextMovement, 0.0f);
+
+        if (hit.collider == null)
+            return true;
+
+        //Debug.Log("Collided with " + hit.collider.name + " [" + hit.collider.tag + "].");
+
+        switch (hit.collider.tag)
+        {
+            case "Wall":
+                return false;
+
+            case "Pushable":
+                var pushable = hit.collider.GetComponent<Pushable>();
+                var canPush = pushable.Push(nextMovement);
+
+                if (canPush && hit.transform.name.StartsWith("Trolley"))
+                {
+                    StartAction();
+                }
+
+                canMove = canPush && pushable.MovingWithPlayer;
+                if (canMove)
+                {
+                    objectPushing = pushable.transform;
+                    previousPushablePosition = objectPushing.position;
+                }
+
+                return canMove;
+
+            case "Collectible":
+                var collectible = hit.collider.GetComponent<Collectible>();
+                collectible.Collect();
+
+                return true;
+
+            case "Accessible":
+                var accessible = hit.collider.GetComponent<Accessible>();
+
+                if (accessible.name.StartsWith("Fountain"))
+                {
+                    if (!GameWorld.dialogueOff && LevelManager.Instance.Level == 0 && DialogueManager.CurrentDialogue == 3)
+                    {
+                        DialogueManager.DialogueComplete = GameWorld.GoBackToLevel;
+                        GroupManager.main.activeGroup = GroupManager.main.group["Dialogue"];
+
+                        return false;
+                    }
+                }
+
+                return accessible.Enter();
+
+            case "Switchable":
+                if (canSwitch)
+                {
+                    Switchable switchable = hit.collider.GetComponent<Switchable>();
+                    switchable.Switch();
+
+                    canSwitch = false;
+                    lastSwitchDirection = nextMovement;
+
+                    if (!switchable.name.StartsWith("Patient"))
+                    {
+                        StartAction();
+                    }
+                }
+                return false;
+
+            default:
+                return true;
+        }
+    }
+
+    private void CompleteMoving()
+    {
+        previousPosition += movement;
+        player.position = previousPosition;
+
+        if (objectPushing != null)
+        {
+            previousPushablePosition += movement;
+            objectPushing.position = previousPushablePosition;
+        }
+
+        if (playerMoving && CanMove())
+        {
+            movement = nextMovement;
+        }
+        else
+        {
+            timer.Stop();
+
+            objectPushing = null;
+        }
+    }
+
+    private void StartAction()
+    {
+        animState = PlayerAnimState.Action;
+        actionTimer.Reset();
+    }
+
+    private void CompleteAction()
+    {
+        if (animState == PlayerAnimState.Action)
+        {
+            animState = PlayerAnimState.Idle;
+        }
+    }
+
+    private void GoBackToIdle()
+    {
+        if (IsAlive)
+        {
+            animState = PlayerAnimState.Idle;
+
+            SetAnimationState(nextMovement);
+            animator.SetInteger("State", (int)animState);
+        }
+        IsAlive = true;
+        this.collider2D.enabled = true;
+    }
+
+    private void PauseAnimation()
+    {
+        animator.speed = 0.0f;
+    }
+
+    private void UnpauseAnimation()
+    {
+        animator.speed = 1.0f;
+    }
+
+    public void Die(GameWorld.LevelOverReason reason = GameWorld.LevelOverReason.LaserKilledPlayer)
+    {
+        IsAlive = false;
+        this.collider2D.enabled = false;
+
+        if (reason == GameWorld.LevelOverReason.Squashed)
+        {
+            renderer.enabled = false;
+            animator.enabled = false;
+            transform.localScale = new Vector3(
+                transform.localScale.x * 0.1f,
+                transform.localScale.y,
+                transform.localScale.z);
+        }
+        else
+        {
+            animator.SetTrigger("Die");
+            Entity.Replace(this.gameObject, ashes);
+        }
+        GameWorld.levelOverReason = reason;
+    }
 }