Update Assets/MRTK/Providers/WindowsMixedReality/Shared/WindowsMixedRealityHandMeshProvider.cs

Co-authored-by: Kurtis <601750f99a611216e3b3536e5835b26dc3c9b459@microsoft.com>

--- Assets/MRTK/Providers/WindowsMixedReality/Shared/WindowsMixedRealityHandMeshProvider.cs
+++ Assets/MRTK/Providers/WindowsMixedReality/Shared/WindowsMixedRealityHandMeshProvider.cs
@@ -220,7 +220,7 @@
                                 out System.Numerics.Quaternion rotation,
                                 out System.Numerics.Vector3 translation);

-                            for(int i = 0; i < handMeshObserver.VertexCount; i++)
+                            for (int i = 0; i < handMeshObserver.VertexCount; i++)
                             {
                                 vertexAndNormals[i].Position.ConvertToUnityVector3(ref handMeshVerticesUnity[i]);
                                 vertexAndNormals[i].Normal.ConvertToUnityVector3(ref handMeshNormalsUnity[i]);


use SerializationConfigurationType instead if Type

--- Conventions/VisualStudioProjectTemplates/Domain.Test/serializationconfigurationtypes.cs
+++ Conventions/VisualStudioProjectTemplates/Domain.Test/serializationconfigurationtypes.cs
@@ -20,8 +20,8 @@
     [GeneratedCode("[VISUAL_STUDIO_TEMPLATE_PACKAGE_ID]", "[VISUAL_STUDIO_TEMPLATE_PACKAGE_VERSION]")]
     public static class SerializationConfigurationTypes
     {
-        public static Type BsonConfigurationType => typeof([PROJECT_NAME_CLASSNAME_PREFIX]BsonSerializationConfiguration);
+        public static BsonSerializationConfigurationType BsonConfigurationType => typeof([PROJECT_NAME_CLASSNAME_PREFIX]BsonSerializationConfiguration).ToBsonSerializationConfigurationType();

-        public static Type JsonConfigurationType => typeof([PROJECT_NAME_CLASSNAME_PREFIX]JsonSerializationConfiguration);
+        public static JsonSerializationConfigurationType JsonConfigurationType => typeof([PROJECT_NAME_CLASSNAME_PREFIX]JsonSerializationConfiguration).ToJsonSerializationConfigurationType();
     }
 }


Fixed string formatting issue

Fixed string formatting issue

--- Commands/Base/AddStoredCredential.cs
+++ Commands/Base/AddStoredCredential.cs
@@ -15,7 +15,7 @@
         Category = CmdletHelpCategory.Base)]
 #else
     [CmdletHelp("Adds a credential to the Windows Credential Manager/MacOS KeyChain",
-        "Adds an entry to the Windows Credential Manager or the MacOS KeyChain. If you add an entry in the form of the URL of your tenant/server PnP PowerShell will check if that entry is available when you connect using Connect-PnPOnline. If it finds a matching URL it will use the associated credentials.
+        @"Adds an entry to the Windows Credential Manager or the MacOS KeyChain. If you add an entry in the form of the URL of your tenant/server PnP PowerShell will check if that entry is available when you connect using Connect-PnPOnline. If it finds a matching URL it will use the associated credentials.

 If you add a Credential with a name of ""https://yourtenant.sharepoint.com"" it will find a match when you connect to ""https://yourtenant.sharepoint.com"" but also when you connect to ""https://yourtenant.sharepoint.com/sites/demo1"". Of course you can specify more granular entries, allow you to automatically provide credentials for different URLs.",
         Category = CmdletHelpCategory.Base)]


Added initial top stack frame when newing BigBrother

--- src/DevOpsFlex.Telemetry/BigBrother.cs
+++ src/DevOpsFlex.Telemetry/BigBrother.cs
@@ -32,6 +32,8 @@
         /// </summary>
         internal static readonly Subject<BbEvent> InternalStream = new Subject<BbEvent>();

+        internal static string BirthPlace;
+
         /// <summary>
         /// Static initialization of static resources in <see cref="BigBrother"/> instances.
         /// </summary>
@@ -94,6 +96,9 @@
         public BigBrother([NotNull]string aiKey, [NotNull]string internalKey)
         {
             CorrelationReleaseTimer = new Timer(ReleaseCorrelationVectors, null, TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(5));
+
+            var trace = new StackTrace();
+            BirthPlace = trace.GetFrame(trace.FrameCount - 1).GetMethod().DeclaringType?.FullName;

             SetupTelemetryClient(aiKey, internalKey);
             SetupSubscriptions();


Make sure that remarks are added to the help file

Fix for issue #3
https://github.com/mndrake/ExcelDnaDoc/issues/3

--- src/ExcelDnaDoc/Utility/ModelHelper.cs
+++ src/ExcelDnaDoc/Utility/ModelHelper.cs
@@ -82,6 +82,7 @@
             {
                 if (excelFunctionSummary.Summary != null) { function.Summary = excelFunctionSummary.Summary; }
                 if (excelFunctionSummary.Returns != null) { function.Returns = excelFunctionSummary.Returns; }
+                if (excelFunctionSummary.Remarks != null) { function.Remarks = excelFunctionSummary.Remarks; }
             }

             // check if ExcelFunctionAttribute used


Fix Duplicated name on ShortBio for author "Luis Pujols" (#544)

* Fixed the duplicated name on the ShortBio for Author "Luis Pujols"

--- src/Firehose.Web/Authors/LuisPujols.cs
+++ src/Firehose.Web/Authors/LuisPujols.cs
@@ -12,7 +12,7 @@
         public string LastName => "Pujols";
         public string StateOrRegion => "United States";
         public string EmailAddress => "luispujolso@gmail.com";
-        public string ShortBioOrTagLine => "Luis Pujols is a Software Engineer with a passion for Mobile Development and Software Architecture. Co-organizer of the .NET Community in the Dominican Republic and a Xamarin Lover.";
+        public string ShortBioOrTagLine => "is a Software Engineer with a passion for Mobile Development and Software Architecture. Co-organizer of the .NET Community in the Dominican Republic and a Xamarin Lover.";
         public Uri WebSite => new Uri("https://www.pujolsluis.com/");
         public string TwitterHandle => "Pujolsluis1";
         public string GitHubHandle => "Pujolsluis";


Small optimization for computing error

Small optimization for computing error

--- ComputerAlgebra/Extensions/NSolve.cs
+++ ComputerAlgebra/Extensions/NSolve.cs
@@ -131,17 +131,16 @@
         // Use homotopy method with newton's method to find a solution for F(x) = 0.
         private static List<Arrow> NSolve(List<Expression> F, List<Arrow> x0, double Epsilon, int MaxIterations)
         {
-            List<Expression> F0 = F.Select(i => i.Evaluate(x0)).ToList();
-
-            List<Dictionary<Expression, Expression>> J = Jacobian(F, x0.Select(i => i.Left)).ToList();
-
             int M = F.Count;
             int N = x0.Count;

-            // Define a function to evaluate JxF(x0).
+            // Compute JxF, the Jacobian of F.
+            List<Dictionary<Expression, Expression>> JxF = Jacobian(F, x0.Select(i => i.Left)).ToList();
+
+            // Define a function to evaluate JxH(x), where H = F(x) - s*F(x0).
             CodeGen code = new CodeGen();

-            ParamExpr _J = code.Decl<double[,]>(Scope.Parameter, "J");
+            ParamExpr _JxH = code.Decl<double[,]>(Scope.Parameter, "JxH");
             ParamExpr _x0 = code.Decl<double[]>(Scope.Parameter, "x0");
             ParamExpr _s = code.Decl<double>(Scope.Parameter, "s");

@@ -151,16 +150,17 @@

             LinqExpr error = code.Decl<double>("error");

-            // Compile the expressions to assign J.
+            // Compile the expressions to assign JxH
             for (int i = 0; i < M; ++i)
             {
                 LinqExpr _i = LinqExpr.Constant(i);
                 for (int j = 0; j < N; ++j)
                     code.Add(LinqExpr.Assign(
-                        LinqExpr.ArrayAccess(_J, _i, LinqExpr.Constant(j)),
-                        code.Compile(J[i][x0[j].Left])));
-                LinqExpr e = LinqExpr.Subtract(code.Compile(F[i]), LinqExpr.Multiply(LinqExpr.Constant((double)F0[i]), _s));
-                code.Add(LinqExpr.Assign(LinqExpr.ArrayAccess(_J, _i, LinqExpr.Constant(N)), e));
+                        LinqExpr.ArrayAccess(_JxH, _i, LinqExpr.Constant(j)),
+                        code.Compile(JxF[i][x0[j].Left])));
+                // e = F(x) - s*F(x0)
+                LinqExpr e = code.DeclInit<double>("e", LinqExpr.Subtract(code.Compile(F[i]), LinqExpr.Multiply(LinqExpr.Constant((double)F[i].Evaluate(x0)), _s)));
+                code.Add(LinqExpr.Assign(LinqExpr.ArrayAccess(_JxH, _i, LinqExpr.Constant(N)), e));
                 // error += e * e
                 code.Add(LinqExpr.AddAssign(error, LinqExpr.Multiply(e, e)));
             }
@@ -168,7 +168,7 @@
             // return error
             code.Return<double>(error);

-            Func<double[,], double[], double, double> EvalJ = code.Build<Func<double[,], double[], double, double>>().Compile();
+            Func<double[,], double[], double, double> JxH = code.Build<Func<double[,], double[], double, double>>().Compile();

             double[] x = new double[N];

@@ -179,8 +179,8 @@
             {
                 try
                 {
-                    // H(F, s) = F + s*F0
-                    NewtonsMethod(M, N, EvalJ, s0, x, Epsilon, MaxIterations);
+                    // H(F, s) = F - s*F0
+                    NewtonsMethod(M, N, JxH, s0, x, Epsilon, MaxIterations);

                     // Success at this s!
                     s1 = s0;
@@ -203,7 +203,7 @@
             // Make sure the last solution is at F itself.
             if (s0 != 0.0)
             {
-                NewtonsMethod(M, N, EvalJ, 0.0, x, Epsilon, MaxIterations);
+                NewtonsMethod(M, N, JxH, 0.0, x, Epsilon, MaxIterations);
                 for (int i = 0; i < N; ++i)
                     x0[i] = Arrow.New(x0[i].Left, x[i]);
             }


Fixed escaping in TeamCity messages

Fixed escaping in TeamCity messages

--- ConDep.Dsl/Logging/TeamCityLogger.cs
+++ ConDep.Dsl/Logging/TeamCityLogger.cs
@@ -1,5 +1,4 @@
 using System;
-using System.Diagnostics;
 using System.Text;
 using log4net;
 using log4net.Core;
@@ -50,16 +49,7 @@
         private void TeamCityMessage(string message, Exception ex, TeamCityMessageStatus status, params object[] formatArgs)
         {
             var formattedMessage = (formatArgs != null && formatArgs.Length > 0) ? string.Format(message, formatArgs) : message;
-            var sb = new StringBuilder(formattedMessage);
-            sb.Replace("|", "||")
-                .Replace("'", "|'")
-                .Replace("\n", "|n")
-                .Replace("\r", "|r")
-                .Replace("\u0085", "|x")
-                .Replace("\u2028", "|l")
-                .Replace("\u2029", "|p")
-                .Replace("[", "|[")
-                .Replace("]", "|]");
+            formattedMessage = EscapeCharsForTeamCity(formattedMessage);

             var errorDetails = "";
             if (ex != null)
@@ -67,23 +57,38 @@
                 errorDetails = string.Format("Message: {0}\n\nStack Trace:\n{1}", ex.Message, ex.StackTrace);
             }

-            var tcMessage = string.Format("##teamcity[message text='{0}' errorDetails='{1}' status='{2}']", sb, errorDetails, status);
+            var tcMessage = string.Format("##teamcity[message text='{0}' errorDetails='{1}' status='{2}']", formattedMessage, errorDetails, status);
             _serviceMessageLogger.Logger.Log(typeof(Logger), Level.All, tcMessage, null);
+        }
+
+        private static string EscapeCharsForTeamCity(string formattedMessage)
+        {
+            var sb = new StringBuilder(formattedMessage);
+            sb.Replace("|", "||")
+              .Replace("'", "|'")
+              .Replace("\n", "|n")
+              .Replace("\r", "|r")
+              .Replace("\u0085", "|x")
+              .Replace("\u2028", "|l")
+              .Replace("\u2029", "|p")
+              .Replace("[", "|[")
+              .Replace("]", "|]");
+            return sb.ToString();
         }

         private void TeamCityBlockStart(string name)
         {
-            _serviceMessageLogger.Logger.Log(typeof(Logger), Level.All, string.Format("##teamcity[blockOpened name='{0}']", name), null);
+            _serviceMessageLogger.Logger.Log(typeof(Logger), Level.All, string.Format("##teamcity[blockOpened name='{0}']", EscapeCharsForTeamCity(name)), null);
         }

         private void TeamCityBlockEnd(string name)
         {
-            _serviceMessageLogger.Logger.Log(typeof(Logger), Level.All, string.Format("##teamcity[blockClosed name='{0}']", name), null);
+            _serviceMessageLogger.Logger.Log(typeof(Logger), Level.All, string.Format("##teamcity[blockClosed name='{0}']", EscapeCharsForTeamCity(name)), null);
         }

         private void TeamCityProgressMessage(string message)
         {
-            _serviceMessageLogger.Logger.Log(typeof(Logger), Level.All, string.Format("##teamcity[progressMessage '{0}']", message), null);
+            _serviceMessageLogger.Logger.Log(typeof(Logger), Level.All, string.Format("##teamcity[progressMessage '{0}']", EscapeCharsForTeamCity(message)), null);
         }
     }
 }


Fix writing 0x4 characteristics on iOS

Fix writing 0x4 characteristics on iOS

--- Source/Xamarin.Robotics/Xamarin.Robotics.Mobile.Core.iOS/Bluetooth/LE/Characteristic.cs
+++ Source/Xamarin.Robotics/Xamarin.Robotics.Mobile.Core.iOS/Bluetooth/LE/Characteristic.cs
@@ -112,10 +112,13 @@
 			var nsdata = NSData.FromArray (data);
 			var descriptor = (CBCharacteristic)_nativeCharacteristic;

-//			_parentDevice.WriteValue (nsdata, descriptor, CBCharacteristicWriteType.WithoutResponse);
-			_parentDevice.WriteValue (nsdata, descriptor, CBCharacteristicWriteType.WithResponse);
+			var t = (Properties & CharacteristicPropertyType.AppleWriteWithoutResponse) != 0 ?
+				CBCharacteristicWriteType.WithoutResponse :
+				CBCharacteristicWriteType.WithResponse;

-			Console.WriteLine ("** Characteristic.Write, Type = WithoutResponse, Data = " + data);
+			_parentDevice.WriteValue (nsdata, descriptor, t);
+
+//			Console.WriteLine ("** Characteristic.Write, Type = " + t + ", Data = " + string.Join (" ", data.Select (x => x.ToString ("X2"))));

 			return;
 		}


Make documentation fixes lazy

Make documentation fixes lazy

--- StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1642SA1643CodeFixProvider.cs
+++ StyleCop.Analyzers/StyleCop.Analyzers/DocumentationRules/SA1642SA1643CodeFixProvider.cs
@@ -1,5 +1,6 @@
 namespace StyleCop.Analyzers.DocumentationRules
 {
+    using System;
     using System.Collections.Immutable;
     using System.Composition;
     using System.Linq;
@@ -39,58 +40,66 @@
         /// <inheritdoc/>
         public override async Task RegisterCodeFixesAsync(CodeFixContext context)
         {
+            var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false);
+
             foreach (var diagnostic in context.Diagnostics)
             {
                 if (!FixableDiagnostics.Contains(diagnostic.Id))
                     continue;

-                var root = await context.Document.GetSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false);
                 var node = root.FindNode(diagnostic.Location.SourceSpan, findInsideTrivia: true) as XmlElementSyntax;
                 if (node == null)
                     continue;
-                var classDeclaration = node.FirstAncestorOrSelf<ClassDeclarationSyntax>();
-                var declarationSyntax = node.FirstAncestorOrSelf<BaseMethodDeclarationSyntax>();

-                ImmutableArray<string> standardText;
-                if (declarationSyntax is ConstructorDeclarationSyntax)
+                context.RegisterCodeFix(CodeAction.Create("Add standard text.", token => GetTransformedDocument(context, root, node)), diagnostic);
+            }
+        }
+
+        private static Task<Document> GetTransformedDocument(CodeFixContext context, SyntaxNode root, XmlElementSyntax node)
+        {
+            var classDeclaration = node.FirstAncestorOrSelf<ClassDeclarationSyntax>();
+            var declarationSyntax = node.FirstAncestorOrSelf<BaseMethodDeclarationSyntax>();
+
+            ImmutableArray<string> standardText;
+            if (declarationSyntax is ConstructorDeclarationSyntax)
+            {
+                if (declarationSyntax.Modifiers.Any(SyntaxKind.StaticKeyword))
                 {
-                    if (declarationSyntax.Modifiers.Any(SyntaxKind.StaticKeyword))
-                    {
-                        standardText = SA1642ConstructorSummaryDocumentationMustBeginWithStandardText.StaticConstructorStandardText;
-                    }
-                    else if (declarationSyntax.Modifiers.Any(SyntaxKind.PrivateKeyword))
-                    {
-                        // Prefer to insert the "non-private" wording, even though both are considered acceptable by the
-                        // diagnostic. https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/413
-                        standardText = SA1642ConstructorSummaryDocumentationMustBeginWithStandardText.NonPrivateConstructorStandardText;
-                    }
-                    else
-                    {
-                        standardText = SA1642ConstructorSummaryDocumentationMustBeginWithStandardText.NonPrivateConstructorStandardText;
-                    }
+                    standardText = SA1642ConstructorSummaryDocumentationMustBeginWithStandardText.StaticConstructorStandardText;
                 }
-                else if (declarationSyntax is DestructorDeclarationSyntax)
+                else if (declarationSyntax.Modifiers.Any(SyntaxKind.PrivateKeyword))
                 {
-                    standardText = SA1643DestructorSummaryDocumentationMustBeginWithStandardText.DestructorStandardText;
+                    // Prefer to insert the "non-private" wording, even though both are considered acceptable by the
+                    // diagnostic. https://github.com/DotNetAnalyzers/StyleCopAnalyzers/issues/413
+                    standardText = SA1642ConstructorSummaryDocumentationMustBeginWithStandardText.NonPrivateConstructorStandardText;
                 }
                 else
                 {
-                    return;
+                    standardText = SA1642ConstructorSummaryDocumentationMustBeginWithStandardText.NonPrivateConstructorStandardText;
                 }
+            }
+            else if (declarationSyntax is DestructorDeclarationSyntax)
+            {
+                standardText = SA1643DestructorSummaryDocumentationMustBeginWithStandardText.DestructorStandardText;
+            }
+            else
+            {
+                throw new InvalidOperationException("XmlElementSyntax has invalid method as its parent");
+            }

-                var list = this.BuildStandardText(classDeclaration.Identifier, classDeclaration.TypeParameterList, standardText[0], standardText[1]);
+            var list = BuildStandardText(classDeclaration.Identifier, classDeclaration.TypeParameterList, standardText[0], standardText[1]);

-                var newContent = node.Content.InsertRange(0, list);
-                var newNode = node.WithContent(newContent);
+            var newContent = node.Content.InsertRange(0, list);
+            var newNode = node.WithContent(newContent);

-                var newRoot = root.ReplaceNode(node, newNode);
+            var newRoot = root.ReplaceNode(node, newNode);

-                var newDocument = context.Document.WithSyntaxRoot(newRoot);
-                context.RegisterCodeFix(CodeAction.Create("Add standard text.", token => Task.FromResult(newDocument)), diagnostic);
-            }
+            var newDocument = context.Document.WithSyntaxRoot(newRoot);
+
+            return Task.FromResult(newDocument);
         }

-        private SyntaxList<XmlNodeSyntax> BuildStandardText(SyntaxToken identifier, TypeParameterListSyntax typeParameters, string preText, string postText)
+        private static SyntaxList<XmlNodeSyntax> BuildStandardText(SyntaxToken identifier, TypeParameterListSyntax typeParameters, string preText, string postText)
         {
             TypeSyntax identifierName;

@@ -101,14 +110,14 @@
             }
             else
             {
-                identifierName = SyntaxFactory.GenericName(identifier.WithoutTrivia(), this.ParameterToArgumentListSyntax(typeParameters));
+                identifierName = SyntaxFactory.GenericName(identifier.WithoutTrivia(), ParameterToArgumentListSyntax(typeParameters));
             }
             var list = new SyntaxList<XmlNodeSyntax>();

             list = list.Add(XmlNewLine());
-            list = list.Add(this.CreateTextSyntax(preText).WithLeadingTrivia(XmlLineStart()));
-            list = list.Add(this.CreateSeeSyntax(identifierName));
-            list = list.Add(this.CreateTextSyntax(postText.EndsWith(".") ? postText : (postText + ".")));
+            list = list.Add(CreateTextSyntax(preText).WithLeadingTrivia(XmlLineStart()));
+            list = list.Add(CreateSeeSyntax(identifierName));
+            list = list.Add(CreateTextSyntax(postText.EndsWith(".") ? postText : (postText + ".")));

             return list;
         }
@@ -128,7 +137,7 @@
             return SyntaxFactory.XmlText(tokenList);
         }

-        private TypeArgumentListSyntax ParameterToArgumentListSyntax(TypeParameterListSyntax typeParameters)
+        private static TypeArgumentListSyntax ParameterToArgumentListSyntax(TypeParameterListSyntax typeParameters)
         {
             var list = new SeparatedSyntaxList<TypeSyntax>();
             list = list.AddRange(typeParameters.Parameters.Select(p => SyntaxFactory.ParseName(p.ToString()).WithTriviaFrom(p)));
@@ -143,7 +152,7 @@
             return SyntaxFactory.TypeArgumentList(list);
         }

-        private XmlNodeSyntax CreateSeeSyntax(TypeSyntax identifier)
+        private static  XmlNodeSyntax CreateSeeSyntax(TypeSyntax identifier)
         {
             NameMemberCrefSyntax cref;

@@ -170,7 +179,7 @@
             return SyntaxFactory.XmlEmptyElement(SyntaxFactory.XmlName(XmlCommentHelper.SeeXmlTag).WithTrailingTrivia(SyntaxFactory.ElasticSpace), attributes);
         }

-        private XmlTextSyntax CreateTextSyntax(string text)
+        private static XmlTextSyntax CreateTextSyntax(string text)
         {
             var tokenList = new SyntaxTokenList();
             tokenList = tokenList.Add(XmlTextLiteral(text));


Amend.

Amend.

--- WpfAnalyzers.Test/WPF0006CoerceValueCallbackShouldMatchRegisteredNameTests/HappyPath.cs
+++ WpfAnalyzers.Test/WPF0006CoerceValueCallbackShouldMatchRegisteredNameTests/HappyPath.cs
@@ -9,23 +9,26 @@
         public void DependencyPropertyNoMetadata()
         {
             var testCode = @"
-using System.Windows;
-using System.Windows.Controls;
+namespace RoslynSandbox
+{
+    using System.Windows;
+    using System.Windows.Controls;

-using System.Windows;
-using System.Windows.Controls;
+    using System.Windows;
+    using System.Windows.Controls;

-public class FooControl : Control
-{
-    public static readonly DependencyProperty ValueProperty = DependencyProperty.Register(
-        nameof(Value),
-        typeof(double),
-        typeof(FooControl));
+    public class FooControl : Control
+    {
+        public static readonly DependencyProperty ValueProperty = DependencyProperty.Register(
+            nameof(Value),
+            typeof(double),
+            typeof(FooControl));

-    public double Value
-    {
-        get { return (double)this.GetValue(ValueProperty); }
-        set { this.SetValue(ValueProperty, value); }
+        public double Value
+        {
+            get { return (double)this.GetValue(ValueProperty); }
+            set { this.SetValue(ValueProperty, value); }
+        }
     }
 }";
             AnalyzerAssert.Valid<WPF0006CoerceValueCallbackShouldMatchRegisteredName>(testCode);
@@ -38,6 +41,8 @@
         public void DependencyWithPropertyMetadata(string metadata)
         {
             var testCode = @"
+namespace RoslynSandbox
+{
     using System.Windows;
     using System.Windows.Controls;

@@ -59,7 +64,8 @@
         {
             return baseValue;
         }
-    }";
+    }
+}";
             testCode = testCode.AssertReplace("new PropertyMetadata(default(int), null, CoerceBar)", metadata);
             AnalyzerAssert.Valid<WPF0006CoerceValueCallbackShouldMatchRegisteredName>(testCode);
         }
@@ -68,28 +74,31 @@
         public void ReadOnlyDependencyProperty()
         {
             var testCode = @"
-using System.Windows;
-using System.Windows.Controls;
+namespace RoslynSandbox
+{
+    using System.Windows;
+    using System.Windows.Controls;

-public class FooControl : Control
-{
-    private static readonly DependencyPropertyKey ValuePropertyKey = DependencyProperty.RegisterReadOnly(
-        nameof(Value),
-        typeof(double),
-        typeof(FooControl),
-        new PropertyMetadata(1.0, null, CoerceValue));
+    public class FooControl : Control
+    {
+        private static readonly DependencyPropertyKey ValuePropertyKey = DependencyProperty.RegisterReadOnly(
+            nameof(Value),
+            typeof(double),
+            typeof(FooControl),
+            new PropertyMetadata(1.0, null, CoerceValue));

-    public static readonly DependencyProperty ValueProperty = ValuePropertyKey.DependencyProperty;
+        public static readonly DependencyProperty ValueProperty = ValuePropertyKey.DependencyProperty;

-    public double Value
-    {
-        get { return (double)this.GetValue(ValueProperty); }
-        set { this.SetValue(ValuePropertyKey, value); }
-    }
+        public double Value
+        {
+            get { return (double)this.GetValue(ValueProperty); }
+            set { this.SetValue(ValuePropertyKey, value); }
+        }

-    private static object CoerceValue(DependencyObject d, object baseValue)
-    {
-        return baseValue;
+        private static object CoerceValue(DependencyObject d, object baseValue)
+        {
+            return baseValue;
+        }
     }
 }";
             AnalyzerAssert.Valid<WPF0006CoerceValueCallbackShouldMatchRegisteredName>(testCode);
@@ -99,23 +108,26 @@
         public void AttachedProperty()
         {
             var testCode = @"
-using System.Windows;
+namespace RoslynSandbox
+{
+    using System.Windows;

-public static class Foo
-{
-    public static readonly DependencyProperty BarProperty = DependencyProperty.RegisterAttached(
-        ""Bar"",
-        typeof(int),
-        typeof(Foo),
-        new PropertyMetadata(default(int), null, CoerceBar));
+    public static class Foo
+    {
+        public static readonly DependencyProperty BarProperty = DependencyProperty.RegisterAttached(
+            ""Bar"",
+            typeof(int),
+            typeof(Foo),
+            new PropertyMetadata(default(int), null, CoerceBar));

-    public static void SetBar(this FrameworkElement element, int value) => element.SetValue(BarProperty, value);
+        public static void SetBar(this FrameworkElement element, int value) => element.SetValue(BarProperty, value);

-    public static int GetBar(this FrameworkElement element) => (int)element.GetValue(BarProperty);
+        public static int GetBar(this FrameworkElement element) => (int)element.GetValue(BarProperty);

-    private static object CoerceBar(DependencyObject d, object baseValue)
-    {
-        return baseValue;
+        private static object CoerceBar(DependencyObject d, object baseValue)
+        {
+            return baseValue;
+        }
     }
 }";

@@ -126,30 +138,33 @@
         public void ReadOnlyAttachedProperty()
         {
             var testCode = @"
-using System.Windows;
+namespace RoslynSandbox
+{
+    using System.Windows;

-public static class Foo
-{
-    private static readonly DependencyPropertyKey BarPropertyKey = DependencyProperty.RegisterAttachedReadOnly(
-        ""Bar"",
-        typeof(int),
-        typeof(Foo),
-        new PropertyMetadata(default(int), OnBarChanged, CoerceBar));
+    public static class Foo
+    {
+        private static readonly DependencyPropertyKey BarPropertyKey = DependencyProperty.RegisterAttachedReadOnly(
+            ""Bar"",
+            typeof(int),
+            typeof(Foo),
+            new PropertyMetadata(default(int), OnBarChanged, CoerceBar));

-        public static readonly DependencyProperty BarProperty = BarPropertyKey.DependencyProperty;
+            public static readonly DependencyProperty BarProperty = BarPropertyKey.DependencyProperty;

-    public static void SetBar(this FrameworkElement element, int value) => element.SetValue(BarPropertyKey, value);
+        public static void SetBar(this FrameworkElement element, int value) => element.SetValue(BarPropertyKey, value);

-    public static int GetBar(this FrameworkElement element) => (int)element.GetValue(BarProperty);
+        public static int GetBar(this FrameworkElement element) => (int)element.GetValue(BarProperty);

-    private static void OnBarChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
-    {
-        // nop
-    }
+        private static void OnBarChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+        {
+            // nop
+        }

-    private static object CoerceBar(DependencyObject d, object baseValue)
-    {
-        return baseValue;
+        private static object CoerceBar(DependencyObject d, object baseValue)
+        {
+            return baseValue;
+        }
     }
 }";


Changing 'TokenLexer' to derive from 'RepetitionLexer'

--- src/Http.Grammar/Rfc7230/TokenLexer.cs
+++ src/Http.Grammar/Rfc7230/TokenLexer.cs
@@ -1,11 +1,10 @@
 namespace Http.Grammar.Rfc7230
 {
     using System.Collections.Generic;
-    using System.Collections.ObjectModel;
     using System.Diagnostics.Contracts;
     using SLANG;

-    public class TokenLexer : Lexer<Token>
+    public class TokenLexer : RepetitionLexer<Token, TokenCharacter>
     {
         private readonly ILexer<TokenCharacter> tokenCharacterLexer;

@@ -15,36 +14,20 @@
         }

         public TokenLexer(ILexer<TokenCharacter> tokenCharacterLexer)
-            : base("token")
+            : base("token", 1, int.MaxValue)
         {
             Contract.Requires(tokenCharacterLexer != null);
             this.tokenCharacterLexer = tokenCharacterLexer;
         }

-        public override bool TryRead(ITextScanner scanner, out Token token)
+        protected override Token CreateInstance(IList<TokenCharacter> elements, int lowerBound, int upperBound, ITextContext context)
         {
-            if (scanner.EndOfInput)
-            {
-                token = default(Token);
-                return false;
-            }
+            return new Token(elements, context);
+        }

-            var context = scanner.GetContext();
-            var elements = new List<TokenCharacter>();
-            TokenCharacter tokenCharacter;
-            while (this.tokenCharacterLexer.TryRead(scanner, out tokenCharacter))
-            {
-                elements.Add(tokenCharacter);
-            }
-
-            if (elements.Count == 0)
-            {
-                token = default(Token);
-                return false;
-            }
-
-            token = new Token(new ReadOnlyCollection<TokenCharacter>(elements), context);
-            return true;
+        protected override bool TryRead(ITextScanner scanner, int lowerBound, int upperBound, int current, out TokenCharacter element)
+        {
+            return this.tokenCharacterLexer.TryRead(scanner, out element);
         }

         [ContractInvariantMethod]


IPersistentObject should implement ICivilizedObject

--- src/IV/Interfaces/IPersistentObject.cs
+++ src/IV/Interfaces/IPersistentObject.cs
@@ -14,7 +14,8 @@
 namespace PPWCode.Vernacular.Persistence.IV
 {
     public interface IPersistentObject<T>
-        : IIdentity<T>
+        : IIdentity<T>,
+          ICivilizedObject
         where T : IEquatable<T>
     {
     }


Clarify summary for ValidateSecurityStamp (#22483)

--- src/Identity/Core/src/SignInManager.cs
+++ src/Identity/Core/src/SignInManager.cs
@@ -296,12 +296,12 @@
         }

         /// <summary>
-        /// Validates the security stamp for the specified <paramref name="user"/>. Will always return false
-        /// if the userManager does not support security stamps.
+        /// Validates the security stamp for the specified <paramref name="user"/>.  If no user is specified, or if the store
+        /// does not support security stamps, validation is considered successful.
         /// </summary>
         /// <param name="user">The user whose stamp should be validated.</param>
         /// <param name="securityStamp">The expected security stamp value.</param>
-        /// <returns>True if the stamp matches the persisted value, otherwise it will return false.</returns>
+        /// <returns>The result of the validation.</returns>
         public virtual async Task<bool> ValidateSecurityStampAsync(TUser user, string securityStamp)
             => user != null &&
             // Only validate the security stamp if the store supports it


Change consume icon

Change consume icon

--- src/InEngine.Core/CommandExtensions.cs
+++ src/InEngine.Core/CommandExtensions.cs
@@ -5,7 +5,7 @@
     {
         public static void WriteSummaryToConsole(this AbstractCommand command)
         {
-            Console.WriteLine($"- {command.Name} : {command.ScheduleId} | Try #{command.CommandLifeCycle.CurrentTry}");
+            Console.WriteLine($"⚡ {command.Name} : {command.ScheduleId} | Try #{command.CommandLifeCycle.CurrentTry}");
         }
     }
 }


Added tests for x-assignment #34

Added tests for x-assignment #34

--- src/Mages.Core.Tests/OperationTests.cs
+++ src/Mages.Core.Tests/OperationTests.cs
@@ -826,6 +826,48 @@
             Assert.AreEqual("String", result);
         }

+        [Test]
+        public void AssignmentAddWithNumberYieldsRightResult()
+        {
+            var result = Eval("x = 0; x += 2; x");
+            Assert.AreEqual(2.0, result);
+        }
+
+        [Test]
+        public void AssignmentSubtractWithNumberYieldsRightResult()
+        {
+            var result = Eval("x = 7; x -= 2; x");
+            Assert.AreEqual(5.0, result);
+        }
+
+        [Test]
+        public void AssignmentMultiplyWithNumberYieldsRightResult()
+        {
+            var result = Eval("x = 3; x *= 2; x");
+            Assert.AreEqual(6.0, result);
+        }
+
+        [Test]
+        public void AssignmentPowerWithNumberYieldsRightResult()
+        {
+            var result = Eval("x = 3; x ^= 2; x");
+            Assert.AreEqual(9.0, result);
+        }
+
+        [Test]
+        public void AssignmentDivideWithNumberYieldsRightResult()
+        {
+            var result = Eval("x = 10; x /= 2; x");
+            Assert.AreEqual(5.0, result);
+        }
+
+        [Test]
+        public void AssignmentPipeWithNumberYieldsRightResult()
+        {
+            var result = Eval("x = 4; x |= factorial; x");
+            Assert.AreEqual(24.0, result);
+        }
+
         private static Object Eval(String source)
         {
             var engine = new Engine();


Reconnect to share relay on receive timeout

--- src/MiningCore/Mining/ShareRecorder.cs
+++ src/MiningCore/Mining/ShareRecorder.cs
@@ -95,6 +95,7 @@
         private readonly BlockingCollection<Share> queue = new BlockingCollection<Share>();

         private readonly int QueueSizeWarningThreshold = 1024;
+        private readonly TimeSpan relayReceiveTimeout = TimeSpan.FromSeconds(15);
         private readonly IShareRepository shareRepo;
         private Policy faultPolicy;
         private bool hasLoggedPolicyFallbackFailure;
@@ -340,9 +341,16 @@

                                 logger.Info($"Monitoring external stratum {url}/[{string.Join(", ", topics)}]");

+                                var msg = (NetMQMessage) null;
+
                                 while (true)
                                 {
-                                    var msg = subSocket.ReceiveMultipartMessage(3);
+                                    if (!subSocket.TryReceiveMultipartMessage(relayReceiveTimeout, ref msg, 3))
+                                    {
+                                        logger.Warn(() => $"Timeout receiving message from {url}. Reconnecting ...");
+                                        break;
+                                    }
+
                                     var topic = msg.Pop().ConvertToString(Encoding.UTF8);
                                     var flags = msg.Pop().ConvertToInt32();
                                     var data = msg.Pop().ToByteArray();


Deletado namespaces não usado

Deletado namespaces não usado

--- src/MotorTributarioNet/Util/EnumExt.cs
+++ src/MotorTributarioNet/Util/EnumExt.cs
@@ -1,8 +1,5 @@
 using System;
-using System.Collections.Generic;
 using System.ComponentModel;
-using System.Linq;
-using System.Text;

 namespace MotorTributarioNet.Util
 {


Test from NH-3330.

Test from NH-3330.

--- src/NHibernate.Test/Linq/WhereTests.cs
+++ src/NHibernate.Test/Linq/WhereTests.cs
@@ -302,6 +302,26 @@
 			Assert.AreEqual(1, query.Count);
 		}

+
+		[Test]
+		public void UsersWithStringContainsAndNotNullNameComplicated()
+		{
+			// NH-3330
+			// Queries in this pattern are apparently generated by
+			// e.g. WCF DS query:
+			// http://.../Products()?$filter=substringof('123',Code)
+
+			// ReSharper disable SimplifyConditionalTernaryExpression
+			var query = db.Users
+						  .Where(user =>
+								 (user.Name == null ? null : (bool?)user.Name.Contains("123")) == null
+									 ? false
+									 : (user.Name == null ? null : (bool?)user.Name.Contains("123")).Value);
+			// ReSharper restore SimplifyConditionalTernaryExpression
+
+			query.ToList();
+		}
+
 		[Test]
 		public void UsersWithStringContainsAndNotNullName()
 		{
@@ -326,7 +346,7 @@
 		public void UsersWithArrayContains()
 		{
 			var names = new[] { "ayende", "rahien" };
-
+
 			var query = (from user in db.Users
 						 where names.Contains(user.Name)
 						 select user).ToList();


Simplified properties.

Simplified properties.

--- Rusty/Core/Common/KeyboardHook.cs
+++ Rusty/Core/Common/KeyboardHook.cs
@@ -391,31 +391,17 @@
             List<HotkeyDefinition> hotkeys;
             List<HotstringDefinition> hotstrings;
             Dictionary<Keys, bool> pressed;
-            string current, previous;
-            int currentTime, priorTime;

             StringBuilder history;
             const int retention = 1024;

-            public string CurrentHotkey
-            {
-                get { return current; }
-            }
-
-            public string PriorHotkey
-            {
-                get { return previous; }
-            }
-
-            public int CurrentHotkeyTime
-            {
-                get { return currentTime; }
-            }
-
-            public int PriorHotkeyTime
-            {
-                get { return priorTime; }
-            }
+            public string CurrentHotkey { get; set; }
+
+            public string PriorHotkey { get; set; }
+
+            public int CurrentHotkeyTime { get; set; }
+
+            public int PriorHotkeyTime { get; set; }

             public bool Block { get; set; }

@@ -536,10 +522,10 @@
                                {
                                    foreach (var hotkey in exec)
                                    {
-                                       priorTime = currentTime;
-                                       currentTime = Environment.TickCount;
-                                       previous = current;
-                                       current = hotkey.ToString();
+                                       PriorHotkeyTime = CurrentHotkeyTime;
+                                       CurrentHotkeyTime = Environment.TickCount;
+                                       PriorHotkey = CurrentHotkey;
+                                       CurrentHotkey = hotkey.ToString();

                                        if (hotkey.Condition())
                                            hotkey.Proc(new object[] { });
@@ -615,10 +601,10 @@

                     new Thread(delegate()
                                    {
-                                       priorTime = currentTime;
-                                       currentTime = Environment.TickCount;
-                                       previous = current;
-                                       current = hotstring.ToString();
+                                       PriorHotkeyTime = CurrentHotkeyTime;
+                                       CurrentHotkeyTime = Environment.TickCount;
+                                       PriorHotkey = CurrentHotkey;
+                                       CurrentHotkey = hotstring.ToString();
                                        int length = hotstring.Sequence.Length;
                                        bool auto = (hotstring.EnabledOptions & HotstringDefinition.Options.AutoTrigger) == HotstringDefinition.Options.AutoTrigger;


missed another file

missed another file

--- src/mindtouch.dream/plug/HttpPlugEndpoint.cs
+++ src/mindtouch.dream/plug/HttpPlugEndpoint.cs
@@ -43,7 +43,7 @@
         internal class ActivityState {

             //--- Fields ---
-            private readonly object _key;
+            private readonly IDreamActivityDescription _activity;
             private Queue<string> _messages = new Queue<string>();
             private readonly IDreamEnvironment _env;
             private readonly string _verb;
@@ -52,7 +52,7 @@
             //--- Constructors ---
             internal ActivityState(IDreamEnvironment env, string verb, string uri) {
                 _env = env;
-                _key = env.CreateActivityDescription();
+                _activity = env.CreateActivityDescription();
                 _verb = verb;
                 _uri = uri;
             }
@@ -66,11 +66,11 @@
                             if(_messages.Count > 10) {
                                 _messages.Dequeue();
                             }
-                            _env.AddActivityDescription(_key, string.Format("Outgoing: {0} {1} [{2}]", _verb, _uri, string.Join(" -> ", _messages.ToArray())));
+                            _activity.Description = string.Format("Outgoing: {0} {1} [{2}]", _verb, _uri, string.Join(" -> ", _messages.ToArray()));
                         }
                     } else {
                         _messages = null;
-                        _env.RemoveActivityDescription(_key);
+                        _activity.Dispose();
                     }
                 }
             }


version 1.81

version 1.81

--- Scripts/Properties/VersionInfo.cs
+++ Scripts/Properties/VersionInfo.cs
@@ -11,4 +11,4 @@
 //
 // Major, Minor, and Build should be set in VersionInfo.cs not VersionInfo - User.cs
 // Revision is set by pre-build.py
-[assembly: AssemblyVersion("1.80.2.0")]
+[assembly: AssemblyVersion("1.81.0.0")]


Added polyfill for flat for ie11.

Added polyfill for flat for ie11.

--- src/PQDashboard/Views/Main/Home.cshtml
+++ src/PQDashboard/Views/Main/Home.cshtml
@@ -396,6 +396,21 @@
 </div>

 <script>
+    if (!Array.prototype.flat) {
+          Array.prototype.flat = function(depth) {
+            var flattened = [];
+            (function flat(array, depth) {
+                for (var index = 0; index < array.length; index++) {
+                if (Array.isArray(array[index]) && depth > 0) {
+                  flat(array[index], depth - 1);
+                } else {
+                  flattened.push(array[index]);
+                }
+              }
+            })(this, Math.floor(depth) || 1);
+            return flattened;
+          };
+        }
     const DateTimeFormat = '@Model.Global.DateTimeFormat'
     //////////////////////////////////////////////////////////////////////////////////////////////////////////
     // The following function are for making button links to another page and opening another page


Allow user to type in Integrity Check error report (BL-2895)

Apparently, Linux/Mono allows even less text in a multiline TextBox than
Windows/.Net, or else its directories have longer names.

--- src/BloomExe/MiscUI/BloomIntegrityDialog.cs
+++ src/BloomExe/MiscUI/BloomIntegrityDialog.cs
@@ -98,8 +98,8 @@
 								  + "The following information is for Bloom developers to see just what is and isn't missing:"
 								  + Environment.NewLine + Environment.NewLine
 								  + errors.ToString()
-								  + Environment.NewLine + Environment.NewLine
 								  + GetDirectoryListing(FileLocator.DirectoryOfTheApplicationExecutable)
+								  + Environment.NewLine + Environment.NewLine
 								  + "Detected Antivirus Program(s): " + InstalledAntivirusPrograms();

 #if !__MonoCS__
@@ -150,7 +150,7 @@
 			{
 				foreach(var f in Directory.GetFiles(directory))
 				{
-					builder.AppendLine(f.Substring(rootDirectoryLength, f.Length - rootDirectoryLength));
+					builder.AppendLine(Path.GetFileName(f));
 				}
 			}
 			catch(Exception error)
@@ -159,16 +159,18 @@
 			}
 			try
 			{
-				//If we let this box get to full, the user can't type into it (BL-2575). So we clip the tree on some big directories:
+				//If we let this box get too full, the user can't type into it (BL-2575). So we clip the tree on some big directories:
+				// The problem reappeared on Linux (BL-2895), so we avoid redundant printing of subdirectory paths in the filenames.
 				string[] bigDirectoriesToSkip = new string[] { "pdf", "Mercurial", "BloomBrowserUI" };
 				foreach(var d in Directory.GetDirectories(directory))
 				{
 					if(bigDirectoriesToSkip.Contains(Path.GetFileName(d)))
 					{
-						builder.AppendLine(d.Substring(rootDirectoryLength, d.Length - rootDirectoryLength) + " (will not list contents)");
+						builder.AppendLine(d + " (will not list contents)");
 					}
 					else
 					{
+						builder.AppendLine(d + " contains these files:");
 						GetDirectoryListing(rootDirectoryLength, d, builder);
 					}
 				}


fix csc build

fix csc build

git-svn-id: fcce7d6ce0ac15bf24f68871b5145d46fc068279@3241 2c1201b4-01cd-e047-a400-b836ae1fbc61

--- src/Boo.Lang.Compiler/Ast/NodeCollection.cs
+++ src/Boo.Lang.Compiler/Ast/NodeCollection.cs
@@ -402,10 +402,7 @@
 			if (index < 0 || index > Count)
 				throw new ArgumentOutOfRangeException("index");

-			if (typeof(TNew) == typeof(T) || 0 == Count)
-				return this;
-
-			if (0 == (Count - index)) //no item to cast
+			if (0 == (Count - index)) //empty or no item to cast
 				return Empty<TNew>(ParentNode);

 			NodeCollection<TNew> nodes = new NodeCollection<TNew>(ParentNode);


update copyright year

update copyright year

--- src/ChromeLogger/Properties/AssemblyInfo.cs
+++ src/ChromeLogger/Properties/AssemblyInfo.cs
@@ -6,7 +6,7 @@
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany("")]
 [assembly: AssemblyProduct("ChromeLogger")]
-[assembly: AssemblyCopyright("Copyright © Chris Missal 2013")]
+[assembly: AssemblyCopyright("Copyright © Chris Missal 2013-2015")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
 [assembly: ComVisible(false)]


Changed the exception type in GridViewDataSet.LoadData() to InvalidOperationException as it accurately describes the situation.


version up

version up


Added extension method to return a new IXmlElementSyntax instance with the supplied string prefix.

--- src/Microsoft.Language.Xml/XmlExtensions.cs
+++ src/Microsoft.Language.Xml/XmlExtensions.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.Collections.Generic;

 namespace Microsoft.Language.Xml
@@ -18,6 +18,19 @@
             if (element.Content.Count == 1 && element.Content.First() is XmlCDataSectionSyntax cdata)
                 return cdata.TextTokens.ToFullString();
             return element.AsElement.Value;
+        }
+
+        /// <summary>
+        /// Return a new <see cref="IXmlElementSyntax"/> instance with
+        /// the supplied string prefix.
+        /// </summary>
+        public static IXmlElementSyntax WithPrefixName(this IXmlElementSyntax element, string prefixName)
+        {
+            var existingName = element.NameNode;
+            var existingPrefix = existingName.PrefixNode;
+            var newName = SyntaxFactory.XmlNameToken(prefixName, null, null);
+
+            return element.WithName(existingName.WithPrefix(existingPrefix.WithName(newName)));
         }

         /// <summary>


9.15 version bump

9.15 version bump

--- source/Playnite/Properties/AssemblyInfo.cs
+++ source/Playnite/Properties/AssemblyInfo.cs
@@ -35,7 +35,7 @@
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("9.14.0.*")]
+[assembly: AssemblyVersion("9.15.0.*")]
 [assembly: InternalsVisibleTo("Playnite.Tests")]
 [assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "Playnite")]
 [assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "Playnite.Controls")]


Default sorting settings are inverted

Default sorting settings are inverted

--- source/Playnite/Settings/ViewProperties.cs
+++ source/Playnite/Settings/ViewProperties.cs
@@ -153,7 +153,7 @@
             }
         }

-        private SortOrderDirection sortingOrderDirection = SortOrderDirection.Descending;
+        private SortOrderDirection sortingOrderDirection = SortOrderDirection.Ascending;
         public SortOrderDirection SortingOrderDirection
         {
             get


Update QRUtils.cs

Update QRUtils.cs

Fixed an issue where the link wouldn't read in FBI because the service wasn't providing the link directly

--- Shameless/QRGeneration/QRUtils.cs
+++ Shameless/QRGeneration/QRUtils.cs
@@ -30,15 +30,6 @@
 		public static string Shorten(string url)
 		{
 			string shortUrl;
-
-			using (var client = new WebClient())
-			{
-				var response = client.DownloadString($"http://hec.su/api?url={url}");
-				var json = (JObject)JsonConvert.DeserializeObject(response);
-
-				shortUrl = json["short"].Value<string>();
-			}
-
 			return shortUrl;
 		}
 	}


Fix a minor bug in the calculation of the normalisation constant for the corrected edm.

--- SharedCode/BlockTOFDemodulator.cs
+++ SharedCode/BlockTOFDemodulator.cs
@@ -169,7 +169,7 @@
                 + (c_dbrf2f * c_edb * c_edbrf2f) + (c_dbrf2f * c_edb * c_edbrf2f)
                 - c_db * (
                     (c_dbrf1f * c_dbrf1f) + (c_dbrf2f * c_dbrf2f) + (c_edb * c_edb)
-                        + (c_edbrf1f * c_edbrf1f) + (c_edbrf1f * c_edbrf1f)
+                        + (c_edbrf1f * c_edbrf1f) + (c_edbrf2f * c_edbrf2f)
                     );

             // it's important when working out the non-linear channel


Change RabbitMqSender namespace

Change RabbitMqSender namespace

--- src/Monik.Client.RabbitMQ/RabbitMqSender.cs
+++ src/Monik.Client.RabbitMQ/RabbitMqSender.cs
@@ -5,7 +5,7 @@
 using Google.Protobuf;
 using Monik.Common;

-namespace Monik.Client.RabbitMQ
+namespace Monik.Client
 {
     public class RabbitMqSender : IMonikSender
     {


Fix target framework parsing

Fix target framework parsing

--- src/PublicApiGenerator.Tool/Program.cs
+++ src/PublicApiGenerator.Tool/Program.cs
@@ -30,29 +30,30 @@
         /// <returns></returns>
         static int Main(string targetFrameworks, string? assembly = null, string? projectPath = null, string? package = null, string? packageVersion = null, string? generatorVersion = null, string? workingDirectory = null, string? outputDirectory = null, bool verbose = false, bool leaveArtifacts = false)
         {
-            var frameworks = targetFrameworks.Split(";");
-
-            if (string.IsNullOrEmpty(outputDirectory) && frameworks.Length > 1)
-            {
-                outputDirectory = Environment.CurrentDirectory;
-            }
-
-            if (string.IsNullOrEmpty(generatorVersion))
-            {
-                generatorVersion = $"{Assembly.GetEntryAssembly().GetName().Version.Major}.*";
-            }
-
-            var workingArea = !string.IsNullOrEmpty(workingDirectory) ?
-                Path.Combine(workingDirectory, Path.GetRandomFileName()) :
-                Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
-
             var logError = Console.Error;
             var logVerbose = verbose ? Console.Error : TextWriter.Null;
+
+            var workingArea = !string.IsNullOrEmpty(workingDirectory)
+                ? Path.Combine(workingDirectory, Path.GetRandomFileName())
+                : Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
+
             logVerbose.WriteLine($"Working area: {workingArea}");

             try
             {
                 AssertInputParameters(targetFrameworks, projectPath, package, packageVersion, workingArea, assembly);
+
+                var frameworks = targetFrameworks.Split(";");
+
+                if (string.IsNullOrEmpty(outputDirectory) && frameworks.Length > 1)
+                {
+                    outputDirectory = Environment.CurrentDirectory;
+                }
+
+                if (string.IsNullOrEmpty(generatorVersion))
+                {
+                    generatorVersion = $"{Assembly.GetEntryAssembly().GetName().Version.Major}.*";
+                }

                 var project = CreateProject(targetFrameworks, projectPath, package, packageVersion, generatorVersion!);

@@ -228,7 +229,7 @@
             {
                 throw new Exception($"Resource named \"{type.Namespace}.{name}\" not found.");
             }
-
+
             using var reader = encoding == null ? new StreamReader(stream)
                                                 : new StreamReader(stream, encoding);
             return reader.ReadToEnd();


Fixed big loading

Fixed big loading

--- Source/Core/Loaders/BigArchive.cs
+++ Source/Core/Loaders/BigArchive.cs
@@ -36,6 +36,8 @@
         {
             SortedDictionary<string, Stream> result = new SortedDictionary<string, Stream>();
             BinaryReader br = new BinaryReader(File.OpenRead(archive));
+            StringBuilder sb = new StringBuilder();
+
             var magic = new String(br.ReadChars(4));
             if (magic != "BIG4" && magic != "BIGF")
             {
@@ -47,17 +49,19 @@
             UInt32 offset = ReadUint32LE(br);

             for (var i = 0;i<numEntries;++i)
-            {
-
-                StringBuilder sb = new StringBuilder();
+            {
+                var entryOffset = ReadUint32LE(br);
+                var entrySize = ReadUint32LE(br);
+
                 char c = br.ReadChar();
                 while(c!=0)
                 {
                     sb.Append(c);
                     c = br.ReadChar();
                 }
-                var bs = new BigStream(br.BaseStream, ReadUint32LE(br), ReadUint32LE(br),sb.ToString());
+                var bs = new BigStream(br.BaseStream, entryOffset, entrySize, sb.ToString());
                 result.Add(sb.ToString(), bs);
+                sb.Clear();
             }

             return result;


Refactor sw deps loading into separate class SwPackageLoader. Load engine module using it.

--- Source/Polygon4/Polygon4.Build.cs
+++ Source/Polygon4/Polygon4.Build.cs
@@ -19,133 +19,124 @@
 using System;
 using System.IO;
 using System.Diagnostics;
+using System.Collections.Generic;

 using UnrealBuildTool;

-public class Polygon4 : ModuleRules
+public class SwPackageLoader
 {
-    private string ThirdPartyPath
-    {
-        get { return Path.GetFullPath(Path.Combine(ModuleDirectory, "../../ThirdParty/")); }
-    }
-
-    public Polygon4(ReadOnlyTargetRules Target)
-        : base(Target)
-    {
-        PrivatePCHHeaderFile = "Polygon4.h";
-        MinFilesUsingPrecompiledHeaderOverride = 1;
-        bUseUnity = false;
-        CppStandard = CppStandardVersion.Latest;
-
-        PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "Landscape", "AIModule" });
-        PrivateDependencyModuleNames.AddRange(new string[] { "PhysicsCore", "Slate", "SlateCore" });
-
-        GenerateVersion();
-        LoadEngine(Target);
-    }
-
-    void GenerateVersion()
-    {
-        bool has_git_dir = Directory.Exists(Path.Combine(ModuleDirectory, "../../.git/"));
-
-        Process process = new Process();
-        process.StartInfo.FileName = "git";
-        process.StartInfo.Arguments = "--version";
-        process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
-        process.StartInfo.WorkingDirectory = ModuleDirectory;
-        process.Start();
-        process.WaitForExit();
-        bool has_git = process.ExitCode == 0;
-
-        var dir = Path.Combine(ModuleDirectory, "Generated");
-        Directory.CreateDirectory(dir);
-
-        string version = "";
-        bool written = false;
-        if (has_git_dir && has_git)
-        {
-            string stdout = "";
-
-            process.StartInfo.RedirectStandardOutput = true;
-            process.StartInfo.UseShellExecute = false;
-
-            process.StartInfo.Arguments = "rev-parse --short HEAD";
-            process.Start();
-            process.WaitForExit();
-            written |= process.ExitCode == 0;
-
-            stdout = process.StandardOutput.ReadToEnd();
-            stdout = stdout.Substring(0, stdout.Length - 1);
-            version += stdout;
-
-            process.StartInfo.Arguments = "rev-parse --abbrev-ref HEAD";
-            process.Start();
-            process.WaitForExit();
-            written |= process.ExitCode == 0;
-
-            stdout = process.StandardOutput.ReadToEnd();
-            stdout = stdout.Substring(0, stdout.Length - 1);
-            version += "+" + stdout;
-        }
-        version = "\"" + version + "\"";
-        var p = Path.Combine(ModuleDirectory, "Generated/Version.h");
-        if (File.Exists(p))
-        {
-            var t = File.ReadAllText(p);
-            if (t != version)
-                File.WriteAllText(p, version);
-        }
-        else
-            File.WriteAllText(p, version);
-    }
-
-    public void LoadEngine(ReadOnlyTargetRules Target)
-    {
-        var BuildName = "rwdi";
-
-        var EnginePath = Path.Combine(ThirdPartyPath, "Engine");
-        var DotSwPath = Path.Combine(EnginePath, ".sw");
-        var JsonProgPath = Path.Combine(DotSwPath, "out", BuildName, "");
-        var JsonPath = Path.Combine(DotSwPath, "g", "swbdesc", BuildName + ".json");
-
-        var DefsFile = Path.Combine(DotSwPath, "defs.txt");
-        var IdirsFile = Path.Combine(DotSwPath, "idirs.txt");
-        var LibsFile = Path.Combine(DotSwPath, "libs.txt");
-
-        if (!File.Exists(DefsFile) ||
-            !File.Exists(IdirsFile) ||
+    string p4_project_root;
+    string engine_path;
+    string storage_dir;
+    string config_name = "rwdi";
+    string stdout;
+    List<string> defs = new List<string>();
+    List<string> idirs = new List<string>();
+    List<string> libs = new List<string>();
+
+    // load package
+    public SwPackageLoader(string p4_root)
+    {
+        p4_project_root = p4_root;
+        engine_path = Path.Combine(p4_project_root, "ThirdParty/Engine");
+    }
+
+    public void LoadPackage(string package)
+    {
+        var BuildName = package.GetHashCode().ToString();
+        Func<bool> f = delegate ()
+        {
+            return
+                RunSwCommand("sw", "-static -config " + config_name + " build " + package, engine_path) &&
+                RunSwCommand("sw", "-static -config " + config_name + " -build-name " + BuildName + " generate -g swbdesc " + package, engine_path) &&
+                RunSwCommand("sw", "run Polygon4.Engine.tools.prepare_sw_info-0.0.1" +
+                    " \"" + GetUe4SwPath(BuildName) + "\"" +
+                    " \"" + GetJsonPath(BuildName) + "\"" +
+                    " \"" + GetStorageDir() + "\"" +
+                    " " + package
+                    , engine_path)
+                ;
+        };
+        Load(BuildName, f);
+    }
+
+    public void LoadDirectory(string target_dir, string main_target)
+    {
+        var BuildName = (target_dir + main_target).GetHashCode().ToString();
+        Func<bool> f = delegate ()
+        {
+            return
+                RunSwCommand("sw", "-static -config " + config_name + " build", target_dir) &&
+                RunSwCommand("sw", "-static -config " + config_name + " -build-name " + BuildName + " generate -g swbdesc", target_dir) &&
+                RunSwCommand("sw", "run Polygon4.Engine.tools.prepare_sw_info-0.0.1" +
+                    " \"" + GetUe4SwPath(BuildName) + "\"" +
+                    " \"" + GetJsonPath(BuildName) + "\"" +
+                    " \"" + GetStorageDir() + "\"" +
+                    " " + main_target
+                    , engine_path)
+                ;
+        };
+        Load(BuildName, f);
+    }
+
+    public void AddBuildSettings(ModuleRules r)
+    {
+        foreach (var s in defs)
+            r.PublicDefinitions.Add(s);
+        foreach (var s in idirs)
+            r.PublicIncludePaths.Add(s);
+        foreach (var s in libs)
+            r.PublicSystemLibraries.Add(s);
+    }
+
+    void Load(string BuildName, Func<bool> build_function)
+    {
+        var p = GetUe4SwPath(BuildName);
+        var DefsFile = Path.Combine(p, "defs.txt");
+        var IdirsFile = Path.Combine(p, "idirs.txt");
+        var LibsFile = Path.Combine(p, "libs.txt");
+
+        if (!File.Exists(DefsFile)  ||
+            !File.Exists(IdirsFile) ||
             !File.Exists(LibsFile))
-        {
-            if (!RunSwCommand("sw", "get storage-dir", EnginePath))
-                throw new Exception("Engine build failed: cannot run sw");
-            var storage_dir = stdout;
-            if (storage_dir.Length == 0)
-                throw new Exception("Engine build failed: empty storage dir");
-            bool r =
-                RunSwCommand("sw", "-static -config rwdi build", EnginePath) &&
-                RunSwCommand("sw", "-static -config rwdi -build-name " + BuildName + " generate -g swbdesc", EnginePath) &&
-                RunSwCommand("sw", "run Polygon4.Engine.tools.prepare_sw_info-0.0.1" +
-                    " \"" + DotSwPath + "\"" +
-                    " \"" + JsonPath + "\"" +
-                    " \"" + storage_dir + "\"" +
-                    " " + "Polygon4.Engine-master"
-                    , EnginePath)
-            ;
-            if (!r)
-                throw new Exception("Engine build failed");
+        {
+            if (!build_function())
+                throw new Exception("Include sw package failed");
         }

-        PublicIncludePaths.Add(ModuleDirectory);
-
-        // read & set defs, idirs, libs
+        // read defs, idirs, libs
         foreach (var s in File.ReadLines(DefsFile))
-            PublicDefinitions.Add(s);
-
+            defs.Add(s);
         foreach (var s in File.ReadLines(IdirsFile))
-            PublicIncludePaths.Add(s);
-
+            idirs.Add(s);
         foreach (var s in File.ReadLines(LibsFile))
-            PublicSystemLibraries.Add(s);
+            libs.Add(s);
+    }
+
+    string GetStorageDir()
+    {
+        if (storage_dir != null)
+            return storage_dir;
+
+        // set storage dir
+        if (!RunSwCommand("sw", "get storage-dir", engine_path))
+            throw new Exception("Engine build failed: cannot run sw");
+
+        storage_dir = stdout;
+        if (storage_dir.Length == 0)
+            throw new Exception("Engine build failed: empty storage dir");
+
+        return storage_dir;
+    }
+
+    string GetUe4SwPath(string BuildName)
+    {
+        return Path.GetFullPath(Path.Combine(p4_project_root, "Intermediate/sw", BuildName));
+    }
+
+    string GetJsonPath(string BuildName)
+    {
+        return Path.Combine(engine_path, ".sw", "g", "swbdesc", BuildName + ".json");
     }

     bool RunSwCommand(string Program, string Args, string Wdir)
@@ -156,7 +147,7 @@
         }
         catch (System.Exception)
         {
-            return RunSwCommand1(Path.Combine(ModuleDirectory, "../../../BootstrapPrograms", Program), Args, Wdir);
+            return RunSwCommand1(Path.Combine(p4_project_root, "../BootstrapPrograms", Program), Args, Wdir);
         }
     }

@@ -183,10 +174,93 @@
         process.WaitForExit();
         return process.ExitCode == 0;
     }
-
-    string stdout;
+
     void process_DataReceived(object sender, DataReceivedEventArgs e)
     {
         stdout += e.Data;
-    }
+    }
 }
+
+public class Polygon4 : ModuleRules
+{
+    public Polygon4(ReadOnlyTargetRules Target)
+        : base(Target)
+    {
+        PrivatePCHHeaderFile = "Polygon4.h";
+        MinFilesUsingPrecompiledHeaderOverride = 1;
+        bUseUnity = false;
+        CppStandard = CppStandardVersion.Latest;
+
+        PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "Landscape", "AIModule" });
+        PrivateDependencyModuleNames.AddRange(new string[] { "PhysicsCore", "Slate", "SlateCore" });
+
+        GenerateVersion();
+        LoadEngine(Target);
+    }
+
+    void GenerateVersion()
+    {
+        bool has_git_dir = Directory.Exists(Path.Combine(ModuleDirectory, "../../.git/"));
+
+        Process process = new Process();
+        process.StartInfo.FileName = "git";
+        process.StartInfo.Arguments = "--version";
+        process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
+        process.StartInfo.WorkingDirectory = ModuleDirectory;
+        process.Start();
+        process.WaitForExit();
+        bool has_git = process.ExitCode == 0;
+
+        var dir = Path.Combine(ModuleDirectory, "Generated");
+        Directory.CreateDirectory(dir);
+
+        string version = "";
+        bool written = false;
+        if (has_git_dir && has_git)
+        {
+            string stdout = "";
+
+            process.StartInfo.RedirectStandardOutput = true;
+            process.StartInfo.UseShellExecute = false;
+
+            process.StartInfo.Arguments = "rev-parse --short HEAD";
+            process.Start();
+            process.WaitForExit();
+            written |= process.ExitCode == 0;
+
+            stdout = process.StandardOutput.ReadToEnd();
+            stdout = stdout.Substring(0, stdout.Length - 1);
+            version += stdout;
+
+            process.StartInfo.Arguments = "rev-parse --abbrev-ref HEAD";
+            process.Start();
+            process.WaitForExit();
+            written |= process.ExitCode == 0;
+
+            stdout = process.StandardOutput.ReadToEnd();
+            stdout = stdout.Substring(0, stdout.Length - 1);
+            version += "+" + stdout;
+        }
+        version = "\"" + version + "\"";
+        var p = Path.Combine(ModuleDirectory, "Generated/Version.h");
+        if (File.Exists(p))
+        {
+            var t = File.ReadAllText(p);
+            if (t != version)
+                File.WriteAllText(p, version);
+        }
+        else
+            File.WriteAllText(p, version);
+    }
+
+    void LoadEngine(ReadOnlyTargetRules Target)
+    {
+        PublicIncludePaths.Add(ModuleDirectory);
+
+        // sw pkgs
+        var P4Root = Path.GetFullPath(Path.Combine(ModuleDirectory, "../.."));
+        var loader = new SwPackageLoader(P4Root);
+        loader.LoadDirectory(Path.Combine(P4Root, "ThirdParty/Engine"), "Polygon4.Engine-master");
+        loader.AddBuildSettings(this);
+    }
+}


CI: updated AssemblyInfo version to 2.6.1014.1


Fix inconsistency between GetHasCode and Equals (#13513)

--- src/mscorlib/src/System/MulticastDelegate.cs
+++ src/mscorlib/src/System/MulticastDelegate.cs
@@ -452,6 +452,17 @@
             if (IsUnmanagedFunctionPtr())
                 return ValueType.GetHashCodeOfPtr(_methodPtr) ^ ValueType.GetHashCodeOfPtr(_methodPtrAux);

+            if (_invocationCount != (IntPtr)0)
+            {
+                var t = _invocationList as Delegate;
+
+                if (t != null)
+                {
+                    // this is a secure/wrapper delegate so we need to unwrap and check the inner one
+                    return t.GetHashCode();
+                }
+            }
+
             Object[] invocationList = _invocationList as Object[];
             if (invocationList == null)
             {


fix 64 bit mul

fix 64 bit mul

--- source2/IL2CPU/Cosmos.IL2CPU.X86/IL/Mul.cs
+++ source2/IL2CPU/Cosmos.IL2CPU.X86/IL/Mul.cs
@@ -48,7 +48,10 @@
 					new CPUx86.Or { DestinationReg = CPUx86.Registers.EAX, SourceReg = CPUx86.Registers.ESP, SourceIsIndirect = true, SourceDisplacement = 12 };
 					new CPUx86.ConditionalJump { Condition = CPUx86.ConditionalTestEnum.Zero, DestinationLabel = Simple32Multiply };
 					// Full 64 Multiply
-
+
+					// copy again, or could change EAX
+					//TODO is there an opcode that does OR without change EAX?
+					new CPUx86.Move { DestinationReg = CPUx86.Registers.EAX, SourceReg = CPUx86.Registers.ESP, SourceIsIndirect = true, SourceDisplacement = 4 };
 					// eax contains already RIGHT_HIGH
 					// multiply with LEFT_LOW
 					new CPUx86.Multiply { DestinationReg = CPUx86.Registers.ESP, DestinationIsIndirect = true, DestinationDisplacement = 8, Size = 32 };


[12874] Cropping of images is broken

[12874] Cropping of images is broken

git-svn-id: 98f681d7a2907ee2a41df434552134740bcc8829@85833 81fbe566-5dc4-48c1-bdea-7421811ca204

--- Source/lib/BaseLuminanceSource.cs
+++ Source/lib/BaseLuminanceSource.cs
@@ -148,11 +148,15 @@
             throw new ArgumentException("Crop rectangle does not fit within image data.");
          }
          var croppedLuminances = new byte[width * height];
-         for (int yold = top, ynew = 0; yold < height; yold++, ynew++)
-         {
-            for (int xold = left, xnew = 0; xold < width; xold++, xnew++)
+         var oldLuminances = Matrix;
+         var oldWidth = Width;
+         var oldRightBound = left + width;
+         var oldBottomBound = top + height;
+         for (int yold = top, ynew = 0; yold < oldBottomBound; yold++, ynew++)
+         {
+            for (int xold = left, xnew = 0; xold < oldRightBound; xold++, xnew++)
             {
-               croppedLuminances[ynew * width + xnew] = luminances[yold * Width + xold];
+               croppedLuminances[ynew * width + xnew] = oldLuminances[yold * oldWidth + xold];
             }
          }
          return CreateLuminanceSource(croppedLuminances, width, height);


Fixed some broken code, also added a bit of error-handling.

--- SpecsFor/Web/SpecsForMvcConfig.cs
+++ SpecsFor/Web/SpecsForMvcConfig.cs
@@ -12,7 +12,7 @@

 		protected void UseBrowser(BrowserDriver driver)
 		{
-			MvcWebApp.Driver = driver.CreateDriver;
+			MvcWebApp.Driver = driver;
 		}

 		protected void BuildRoutesUsing(Action<RouteCollection> configAction)
@@ -54,7 +54,14 @@
 			                   	? startInfo.EnvironmentVariables["programfiles(x86)"]
 			                   	: startInfo.EnvironmentVariables["programfiles"];

-			startInfo.FileName = programfiles + "\\IIS Express\\iisexpress.exe";
+			var iisExpress = programfiles + "\\IIS Express\\iisexpress.exe";
+
+			if (!File.Exists(iisExpress))
+			{
+				throw new FileNotFoundException(string.Format("Did not find iisexpress.exe at {0}. Ensure that IIS Express is installed to the default location.", iisExpress));
+			}
+
+			startInfo.FileName = iisExpress;

 			_iisProcess = new Process { StartInfo = startInfo };
 			_iisProcess.Start();


Added Player.PutInVehicle(Vehicle)

Added Player.PutInVehicle(Vehicle)

--- src/SampSharp.GameMode/World/Player.cs
+++ src/SampSharp.GameMode/World/Player.cs
@@ -1162,6 +1162,14 @@
                 throw new NullReferenceException("vehicle cannot be null");

             Native.PutPlayerInVehicle(Id, vehicle.Id, seatid);
+        }
+        /// <summary>
+        ///     Puts this Player in a vehicle as driver.
+        /// </summary>
+        /// <param name="vehicle">The vehicle for the player to be put in.</param>
+        public virtual void PutInVehicle(Vehicle vehicle)
+        {
+            PutInVehicle(vehicle, 0);
         }

         /// <summary>


Working on the REPL

Working on the REPL

--- REPL/Program.cs
+++ REPL/Program.cs
@@ -7,34 +7,24 @@

 namespace REPL {
     public class Program {
-        public enum Prompt { Commands, Repl, Help };
-        static Prompt _activePrompt;
         static string _languageName = "";

         public static void Main(string[] args) {
             while (true) {
-                REPLPrompt();
-                LanguagePrompt();
+                RunPrompt(Constants.ReplPromptName);
+                RunPrompt(_languageName);
             }
         }

-        static void REPLPrompt() {
-            RunPrompt(Constants.ReplPromptName, ConsoleKey.Escape);
-        }
-
-        static void LanguagePrompt() {
-            RunPrompt(_languageName, ConsoleKey.Escape);
-        }
-
-        static void RunPrompt(string promptName, Union<char, ConsoleKey> breakKey) {
+        static void RunPrompt(string promptName) {
             string currentText = "";
             ClearLine();
             Console.Write($"{promptName}>");
             while (true) {
                 var key = Console.ReadKey();
-                if (breakKey.Match<bool>(x => key.KeyChar == x, x => key.Key == x)) {
-                    break;
-                } else if (key.Key == ConsoleKey.Enter) {
+                if (key.Key == ConsoleKey.Escape) break;
+
+                if (key.Key == ConsoleKey.Enter) {
                     Console.Write($"\n{promptName}>");
                 } else {
                     currentText += key.KeyChar;


Disabled the removal button for parked vehicles

--- RemoveButton.cs
+++ RemoveButton.cs
@@ -65,6 +65,26 @@
             }
         }

+        private void Update()
+        {
+            if (!WorldInfoPanel.AnyWorldInfoPanelOpen()) return;
+
+            InstanceID id = WorldInfoPanel.GetCurrentInstanceID();
+
+            if (id.IsEmpty) return;
+
+            if (id.Vehicle == 0)
+            {
+                foreach (UIButton button in _buttons)
+                    button.Hide();
+            }
+            else
+            {
+                foreach (UIButton button in _buttons)
+                    button.Show();
+            }
+        }
+
         private void OnDestroy()
         {
             foreach (UIButton button in _buttons)


Don't check/flush queue on status update when interactive.

--- RenderEngine.cs
+++ RenderEngine.cs
@@ -303,7 +303,7 @@
 				StatusTextEvent(this, new StatusTextEventArgs(status, progress, RenderedSamples));
 			}

-			CheckFlushQueue();
+			if(!m_interactive) CheckFlushQueue();
 		}

 		/// <summary>


Squirrel hooks now have a deadline

Squirrel hooks now have a deadline

--- src/Squirrel/UpdateManager.ApplyReleases.cs
+++ src/Squirrel/UpdateManager.ApplyReleases.cs
@@ -10,6 +10,7 @@
 using System.Threading.Tasks;
 using NuGet;
 using Splat;
+using System.Threading;

 namespace Squirrel
 {
@@ -91,7 +92,12 @@
                         if (isAppFolderDead(currentRelease.FullName)) throw new Exception("App folder is dead, but we're trying to uninstall it?");

                         if (squirrelAwareApps.Count > 0) {
-                            await squirrelAwareApps.ForEachAsync(exe => Utility.InvokeProcessAsync(exe, String.Format("--squirrel-uninstall {0}", version)), 1);
+                            await squirrelAwareApps.ForEachAsync(exe => {
+                                var cts = new CancellationTokenSource();
+                                cts.CancelAfter(10 * 1000);
+
+                                return Utility.InvokeProcessAsync(exe, String.Format("--squirrel-uninstall {0}", version), cts.Token);
+                            }, 1 /*at a time*/);
                         } else {
                             var allApps = currentRelease.EnumerateFiles()
                                 .Where(x => x.Name.EndsWith(".exe", StringComparison.OrdinalIgnoreCase))
@@ -360,7 +366,12 @@
                 this.Log().Info("Squirrel Enabled Apps: [{0}]", String.Join(",", squirrelApps));

                 // For each app, run the install command in-order and wait
-                if (!firstRunOnly) await squirrelApps.ForEachAsync(exe => Utility.InvokeProcessAsync(exe, args), 1 /* at a time */);
+                if (!firstRunOnly) await squirrelApps.ForEachAsync(exe => {
+                    var cts = new CancellationTokenSource();
+                    cts.CancelAfter(15 * 1000);
+
+                    return Utility.InvokeProcessAsync(exe, args, cts.Token);
+                }, 1 /* at a time */);

                 // If this is the first run, we run the apps with first-run and
                 // *don't* wait for them, since they're probably the main EXE
@@ -514,7 +525,12 @@

                         if (squirrelApps.Count > 0) {
                             // For each app, run the install command in-order and wait
-                            await squirrelApps.ForEachAsync(exe => Utility.InvokeProcessAsync(exe, args), 1 /* at a time */);
+                            await squirrelApps.ForEachAsync(exe => {
+                                var cts = new CancellationTokenSource();
+                                cts.CancelAfter(10 * 1000);
+
+                                return Utility.InvokeProcessAsync(exe, args, cts.Token);
+                            }, 1 /* at a time */);
                         }
                     });
                 }


Remove AssemblyInfo

Remove AssemblyInfo

--- src/Telegram.Bot/Properties/AssemblyInfo.cs
+++ src/Telegram.Bot/Properties/AssemblyInfo.cs
@@ -1,3 +0,0 @@
-using System.Runtime.CompilerServices;
-
-[assembly: InternalsVisibleTo("Telegram.Bot.Tests.Integ")]


add alternate tag there

add alternate tag there

--- src/Tugberk.Web/Views/Shared/_Layout.cshtml
+++ src/Tugberk.Web/Views/Shared/_Layout.cshtml
@@ -11,6 +11,7 @@
 <head>
     <meta charset="utf-8">
     <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+    <link rel="alternate" type="application/rss+xml" title="Tugberk Ugurlu @@ the Heart of Software" href="/Feeds/Rss" />
     <link rel="stylesheet" href="/node_modules/bootstrap/dist/css/bootstrap.min.css">
     <link rel="stylesheet" href="/node_modules/font-awesome/css/font-awesome.min.css">
     <link rel="stylesheet" href="/styles/main.css">


Test failure

Test failure

--- src/UnitTests/BidirectionalRelationships.cs
+++ src/UnitTests/BidirectionalRelationships.cs
@@ -42,7 +42,7 @@
                 _dto.Children[1].Parent.ShouldBeSameAs(_dto);
             }

-            [Fact]
+            [Fact(Skip = "Intermitten failure")]
             public void Before_and_After_for_the_parent_should_be_called_once()
             {
                 _beforeMapCount.ShouldEqual(1);


Revert JSON exception in GET

Revert JSON exception in GET

--- src/Unosquare.Swan/Networking/JsonClient.cs
+++ src/Unosquare.Swan/Networking/JsonClient.cs
@@ -211,9 +211,9 @@
             string authorization = null,
             CancellationToken ct = default)
         {
-            var response = await GetResponse(uri, ct, authorization).ConfigureAwait(false);
-
-            return await response.Content.ReadAsStringAsync().ConfigureAwait(false);
+            var response = await GetHttpContent(uri, ct, authorization).ConfigureAwait(false);
+
+            return await response.ReadAsStringAsync().ConfigureAwait(false);
         }

         /// <summary>
@@ -252,9 +252,9 @@
             string authorization = null,
             CancellationToken ct = default)
         {
-            var response = await GetResponse(new Uri(url), ct, authorization).ConfigureAwait(false);
-
-            return await response.Content.ReadAsByteArrayAsync().ConfigureAwait(false);
+            var response = await GetHttpContent(new Uri(url), ct, authorization).ConfigureAwait(false);
+
+            return await response.ReadAsByteArrayAsync().ConfigureAwait(false);
         }

         /// <summary>
@@ -361,7 +361,7 @@

             using (var response = await GetResponse(new Uri(url), ct, authorization, null, payload, method).ConfigureAwait(false))
             {
-                if (response.IsSuccessStatusCode == false)
+                if (!response.IsSuccessStatusCode)
                 {
                     throw new JsonRequestException(
                         $"Error {method} JSON",
@@ -373,11 +373,25 @@
             }
         }

+        private static async Task<HttpContent> GetHttpContent(
+            Uri uri,
+            CancellationToken ct,
+            string authorization = null,
+            IDictionary<string, IEnumerable<string>> headers = null)
+        {
+            var response = await GetResponse(uri, ct, authorization, headers)
+                .ConfigureAwait(false);
+
+            return response.IsSuccessStatusCode
+                ? response.Content
+                : throw new JsonRequestException("Error GET", (int) response.StatusCode);
+        }
+
         private static async Task<HttpResponseMessage> GetResponse(
             Uri uri,
             CancellationToken ct,
-            string authorization = null,
-            IDictionary<string, IEnumerable<string>> headers = null,
+            string authorization,
+            IDictionary<string, IEnumerable<string>> headers,
             object payload = null,
             HttpMethod method = default)
         {


Updated use of SHA256

Updated use of SHA256

--- source/Core/Services/Default/DefaultTokenService.cs
+++ source/Core/Services/Default/DefaultTokenService.cs
@@ -109,13 +109,13 @@
             // add at_hash claim
             if (request.AccessTokenToHash.IsPresent())
             {
-                claims.Add(new Claim(Constants.ClaimTypes.AccessTokenHash, HashAdditionalToken(request.AccessTokenToHash)));
+                claims.Add(new Claim(Constants.ClaimTypes.AccessTokenHash, HashAdditionalData(request.AccessTokenToHash)));
             }

             // add c_hash claim
             if (request.AuthorizationCodeToHash.IsPresent())
             {
-                claims.Add(new Claim(Constants.ClaimTypes.AuthorizationCodeHash, HashAdditionalToken(request.AuthorizationCodeToHash)));
+                claims.Add(new Claim(Constants.ClaimTypes.AuthorizationCodeHash, HashAdditionalData(request.AuthorizationCodeToHash)));
             }

             claims.AddRange(await _claimsProvider.GetIdentityTokenClaimsAsync(
@@ -223,19 +223,21 @@
         }

         /// <summary>
-        /// Hashes an additional token.
+        /// Hashes an additional data (e.g. for c_hash or at_hash).
         /// </summary>
         /// <param name="tokenToHash">The token to hash.</param>
         /// <returns></returns>
-        protected virtual string HashAdditionalToken(string tokenToHash)
-        {
-            var algorithm = SHA256.Create();
-            var hash = algorithm.ComputeHash(Encoding.ASCII.GetBytes(tokenToHash));
-
-            var leftPart = new byte[16];
-            Array.Copy(hash, leftPart, 16);
-
-            return Base64Url.Encode(leftPart);
+        protected virtual string HashAdditionalData(string tokenToHash)
+        {
+            using (var sha = SHA256.Create())
+            {
+                var hash = sha.ComputeHash(Encoding.ASCII.GetBytes(tokenToHash));
+
+                var leftPart = new byte[16];
+                Array.Copy(hash, leftPart, 16);
+
+                return Base64Url.Encode(leftPart);
+            }
         }
     }
 }


Formatting

Formatting

--- src/SoapCore/SoapEndpointMiddleware.cs
+++ src/SoapCore/SoapEndpointMiddleware.cs
@@ -88,7 +88,7 @@
 					{
 						i++;
 					}
-					if(headerItem.Length - i < 6)
+					if (headerItem.Length - i < 6)
 					{
 						continue;
 					}
@@ -205,12 +205,12 @@
 						await responseTask;
 						responseObject = responseTask.GetType().GetProperty("Result").GetValue(responseTask);
 					}
-				  else if(responseObject is Task responseTask)
-				  {
-					  await responseTask;
-				  	// VoidTaskResult
-			  		responseObject = null;
-		  		}
+					else if (responseObject is Task responseTask)
+					{
+						await responseTask;
+						// VoidTaskResult
+						responseObject = null;
+					}
 					int i = arguments.Length;
 					var resultOutDictionary = new Dictionary<string, object>();
 					foreach (var outArg in outArgs)


Create docs for ProxyException

Create docs for ProxyException

--- src/SocksSharp/Proxy/ProxyException.cs
+++ src/SocksSharp/Proxy/ProxyException.cs
@@ -6,13 +6,17 @@

 namespace SocksSharp.Proxy
 {
+    /// <summary>
+    /// Represents errors that occur during proxy execution.
+    /// </summary>
     public class ProxyException : Exception
     {
         /// <summary>
-        /// Инициализирует новый экземпляр класса <see cref="ProxyException"/> заданным сообщением об ошибке.
+        /// Initializes a new instance of the <see cref="ProxyException"/> with a specified error message
+        /// and a reference to the inner exception that is the cause of this exception.
         /// </summary>
-        /// <param name="message">Сообщение об ошибке с объяснением причины исключения.</param>
-        /// <param name="innerException">Исключение, вызвавшее текущие исключение, или значение <see langword="null"/>.</param>
+        /// <param name="message">The error message that explains the reason for the exception.</param>
+        /// <param name="innerException">The exception that is the cause of the current exception, or a <see langword="null"/> reference.</param>
         public ProxyException(string message, Exception innerException = null)
             : base(message, innerException) { }


cleaning dead code out of PluginFamily

cleaning dead code out of PluginFamily

--- src/StructureMap/Graph/PluginFamily.cs
+++ src/StructureMap/Graph/PluginFamily.cs
@@ -42,6 +42,7 @@
             get { return _pluginType.IsGenericTypeDefinition || _pluginType.ContainsGenericParameters; }
         }

+        // TODO -- defensive check here to verify that the instance can be used against PluginType
         public Instance MissingInstance { get; set; }

         /// <summary>
@@ -52,12 +53,6 @@
             get { return _pluginType; }
         }

-        public PluginGraph Root
-        {
-            get { return Owner.Root; }
-        }
-
-
         void IDisposable.Dispose()
         {
             _instances.Each(x => x.SafeDispose());
@@ -75,6 +70,7 @@
             _instances[instance.Name] = instance;
         }

+        // TODO -- re-evaluate this
         public void SetDefault(Func<Instance> defaultInstance)
         {
             _defaultInstance = new Lazy<Instance>(defaultInstance);
@@ -122,11 +118,6 @@
             }

             return null;
-        }
-
-        public Instance FirstInstance()
-        {
-            return _instances.First;
         }

         public PluginFamily CreateTemplatedClone(Type[] templateTypes)
@@ -196,14 +187,10 @@
             }
         }

-        public void ForInstance(string name, Action<Instance> action)
-        {
-            _instances.WithValue(name, action);
-        }
-
         public void RemoveInstance(Instance instance)
         {
             _instances.Remove(instance.Name);
+            instance.Parent = null;
             if (instance == GetDefaultInstance())
             {
                 resetDefault();
@@ -215,20 +202,5 @@
             _instances.ClearAll();
             resetDefault();
         }
-
-        /// <summary>
-        ///     Primarily for TESTING
-        /// </summary>
-        /// <param name="defaultKey"></param>
-        public void SetDefaultKey(string defaultKey)
-        {
-            var instance = _instances.FirstOrDefault(x => x.Name == defaultKey);
-            if (instance == null)
-            {
-                throw new ArgumentOutOfRangeException("Could not find an instance with name " + defaultKey);
-            }
-
-            SetDefault(instance);
-        }
     }
 }


made code more dry

made code more dry

Former-commit-id: 1228d2d11d20fe5005e678a485157868f6588813

--- DataGen/Types/String/StringFilter.cs
+++ DataGen/Types/String/StringFilter.cs
@@ -17,8 +17,8 @@

         public StringFilter Contains(params string[] args)
             => args.Length == 1
-                ? new StringFilter(this.Where(s => s.IndexOf(args[0], StringComparison.OrdinalIgnoreCase) >= 0))
-                : new StringFilter(this.Where(s => args.Any(s.Contains)));
+                ? new StringFilter(this.Where(s => IndexOf(s, args[0]) >= 0))
+                : new StringFilter(this.Where(s => args.Any(arg => IndexOf(s, arg) >= 0)));

         public StringFilter ByLength(int length) {


Incremented build number

Incremented build number

--- DiskGazer/Properties/AssemblyInfo.cs
+++ DiskGazer/Properties/AssemblyInfo.cs
@@ -51,5 +51,5 @@
 // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
 // 既定値にすることができます:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.4.5.104")]
-[assembly: AssemblyFileVersion("0.4.5.104")]
+[assembly: AssemblyVersion("0.4.5.105")]
+[assembly: AssemblyFileVersion("0.4.5.105")]


Optimization

Optimization

--- Shared/UnPAK.cs
+++ Shared/UnPAK.cs
@@ -22,15 +22,15 @@

 		public byte[] GetEntry(int index)
 		{
-			stream.Position = (index + 1) * 4;
-			stream.Position = reader.ReadUInt32() + 4;
+			stream.Seek((index + 1) * 4, SeekOrigin.Begin);
+			stream.Seek(reader.ReadUInt32() + 4, SeekOrigin.Begin);

 			var compressedSize = reader.ReadUInt32();
 			var uncompressedSize = reader.ReadUInt32();
 			var flag = reader.ReadByte();
 			var info5 = reader.ReadByte();
 			var offset = reader.ReadUInt16();
-			stream.Position += offset;
+			stream.Seek(offset, SeekOrigin.Current);

 			var dest = new byte[uncompressedSize];

@@ -81,11 +81,11 @@

 		int GetEntryCount()
 		{
-			stream.Position = 4;
+			stream.Seek(4, SeekOrigin.Begin);
 			int offset = reader.ReadInt32();
 			int count = offset / 4 - 1;

-			stream.Position = offset - 4;
+			stream.Seek(offset - 4, SeekOrigin.Begin);
 			if(reader.ReadInt32() == 0) count--; //TIMEGATE

 			return count;


Change ObjectCreated and ObjectUpdated to DateTime

--- Shippo/Batch.cs
+++ Shippo/Batch.cs
@@ -9,10 +9,10 @@
         public string ObjectStatus { get; set; }

         [JsonProperty (PropertyName = "object_created")]
-        public string ObjectCreated { get; set; }
+        public DateTime ObjectCreated { get; set; }

         [JsonProperty (PropertyName = "object_updated")]
-        public string ObjectUpdated { get; set; }
+        public DateTime ObjectUpdated { get; set; }

         [JsonProperty (PropertyName = "object_owner")]
         public string ObjectOwner { get; set; }


bump version

bump version

--- SolutionInfo.cs
+++ SolutionInfo.cs
@@ -7,4 +7,4 @@
 [assembly: AssemblyCulture("")]

-[assembly: AssemblyVersion("1.1.0.15")]+[assembly: AssemblyVersion("1.1.0.16")]


Not needed

Not needed

--- Source/DMAPI.cs
+++ Source/DMAPI.cs
@@ -122,12 +122,6 @@
 				DMMod.gatherScienceData(silent);
 				return true;
 			}
-			else if (t == typeof(DMSIGINT))
-			{
-				DMSIGINT DMMod = (DMSIGINT)isc;
-				DMMod.gatherScienceData(silent);
-				return true;
-			}
 			else if (t.IsSubclassOf(typeof(DMModuleScienceAnimate)))
 			{
 				DMModuleScienceAnimate DMMod = (DMModuleScienceAnimate)isc;