Refactor fix all.

Refactor fix all.

--- Gu.Roslyn.Asserts/AnalyzerAssert.FixAll.cs
+++ Gu.Roslyn.Asserts/AnalyzerAssert.FixAll.cs
@@ -32,7 +32,7 @@
             FixAllAsync(
                     analyzer,
                     new TCodeFix(),
-                    new[] { codeWithErrorsIndicated },
+                    DiagnosticsAndSources.CreateFromCodeWithErrorsIndicated(analyzer, new[] { codeWithErrorsIndicated }),
                     new[] { fixedCode },
                     CodeFactory.DefaultCompilationOptions(analyzer, SuppressedDiagnostics),
                     MetadataReferences,
@@ -61,7 +61,7 @@
             FixAllAsync(
                     analyzer,
                     new TCodeFix(),
-                    codeWithErrorsIndicated,
+                    DiagnosticsAndSources.CreateFromCodeWithErrorsIndicated(analyzer, codeWithErrorsIndicated),
                     MergeFixedCode(codeWithErrorsIndicated, fixedCode),
                     CodeFactory.DefaultCompilationOptions(analyzer, SuppressedDiagnostics),
                     MetadataReferences,
@@ -90,7 +90,7 @@
             FixAllAsync(
                     analyzer,
                     new TCodeFix(),
-                    codeWithErrorsIndicated,
+                    DiagnosticsAndSources.CreateFromCodeWithErrorsIndicated(analyzer, codeWithErrorsIndicated),
                     fixedCode,
                     CodeFactory.DefaultCompilationOptions(analyzer, SuppressedDiagnostics),
                     MetadataReferences,
@@ -118,7 +118,7 @@
             FixAllAsync(
                     analyzer,
                     new TCodeFix(),
-                    new[] { codeWithErrorsIndicated },
+                    DiagnosticsAndSources.CreateFromCodeWithErrorsIndicated(analyzer, new[] { codeWithErrorsIndicated }),
                     new[] { fixedCode },
                     CodeFactory.DefaultCompilationOptions(analyzer, SuppressedDiagnostics),
                     MetadataReferences,
@@ -146,7 +146,7 @@
             FixAllAsync(
                     analyzer,
                     new TCodeFix(),
-                    codeWithErrorsIndicated,
+                    DiagnosticsAndSources.CreateFromCodeWithErrorsIndicated(analyzer, codeWithErrorsIndicated),
                     MergeFixedCode(codeWithErrorsIndicated, fixedCode),
                     CodeFactory.DefaultCompilationOptions(analyzer, SuppressedDiagnostics),
                     MetadataReferences,
@@ -174,7 +174,7 @@
             FixAllAsync(
                     analyzer,
                     new TCodeFix(),
-                    codeWithErrorsIndicated,
+                    DiagnosticsAndSources.CreateFromCodeWithErrorsIndicated(analyzer, codeWithErrorsIndicated),
                     fixedCode,
                     CodeFactory.DefaultCompilationOptions(analyzer, SuppressedDiagnostics),
                     MetadataReferences,
@@ -201,7 +201,7 @@
             FixAllAsync(
                     analyzer,
                     codeFix,
-                    codeWithErrorsIndicated,
+                    DiagnosticsAndSources.CreateFromCodeWithErrorsIndicated(analyzer, codeWithErrorsIndicated),
                     fixedCode,
                     CodeFactory.DefaultCompilationOptions(analyzer, SuppressedDiagnostics),
                     metadataReference,
@@ -229,7 +229,7 @@
             return FixAllAsync(
                 analyzer,
                 codeFix,
-                codeWithErrorsIndicated,
+                DiagnosticsAndSources.CreateFromCodeWithErrorsIndicated(analyzer, codeWithErrorsIndicated),
                 fixedCode,
                 CodeFactory.DefaultCompilationOptions(analyzer, SuppressedDiagnostics),
                 metadataReference,
@@ -256,7 +256,7 @@
             var data = await CreateDiagnosticsMetadataAsync(
                 analyzer,
                 codeFix,
-                codeWithErrorsIndicated,
+               DiagnosticsAndSources.CreateFromCodeWithErrorsIndicated(analyzer, codeWithErrorsIndicated),
                 compilationOptions,
                 metadataReference);
             await FixAllOneByOneAsync(analyzer, codeFix, fixedCode, fixTitle, allowCompilationErrors, data).ConfigureAwait(false);
@@ -273,135 +273,169 @@

         /// <summary>
         /// Verifies that
-        /// 1. <paramref name="codeWithErrorsIndicated"/> produces the expected diagnostics
-        /// 2. The code fix fixes the code.
-        /// </summary>
-        /// <typeparam name="TAnalyzer">The type of the analyzer.</typeparam>
-        /// <typeparam name="TCodeFix">The type of the code fix.</typeparam>
-        /// <param name="codeWithErrorsIndicated">The code with error positions indicated.</param>
-        /// <param name="fixedCode">The expected code produced by the code fix.</param>
-        /// <param name="fixTitle">The title of the fix to apply if more than one.</param>
-        /// <param name="allowCompilationErrors">If compilation errors are accepted in the fixed code.</param>
-        public static void FixAllInDocument<TAnalyzer, TCodeFix>(string codeWithErrorsIndicated, string fixedCode, string fixTitle = null, AllowCompilationErrors allowCompilationErrors = AllowCompilationErrors.No)
-            where TAnalyzer : DiagnosticAnalyzer, new()
-            where TCodeFix : CodeFixProvider, new()
-        {
-            var analyzer = new TAnalyzer();
-            FixAllByScopeAsync(
-                    analyzer,
-                    new TCodeFix(),
-                    new[] { codeWithErrorsIndicated },
-                    new[] { fixedCode },
-                    MetadataReferences,
-                    fixTitle,
-                    allowCompilationErrors,
-                    FixAllScope.Document)
-                .GetAwaiter()
-                .GetResult();
-        }
-
-        /// <summary>
-        /// Verifies that
-        /// 1. <paramref name="codeWithErrorsIndicated"/> produces the expected diagnostics
-        /// 2. The code fix fixes the code.
-        /// </summary>
-        /// <typeparam name="TCodeFix">The type of the code fix.</typeparam>
-        /// <param name="id">The id of the expected diagnostic.</param>
-        /// <param name="codeWithErrorsIndicated">The code with error positions indicated.</param>
-        /// <param name="fixedCode">The expected code produced by the code fix.</param>
-        /// <param name="fixTitle">The title of the fix to apply if more than one.</param>
-        /// <param name="allowCompilationErrors">If compilation errors are accepted in the fixed code.</param>
-        public static void FixAllInDocument<TCodeFix>(string id, string codeWithErrorsIndicated, string fixedCode, string fixTitle = null, AllowCompilationErrors allowCompilationErrors = AllowCompilationErrors.No)
-            where TCodeFix : CodeFixProvider, new()
-        {
-            var analyzer = new PlaceholderAnalyzer(id);
-            FixAllByScopeAsync(
-                    analyzer,
-                    new TCodeFix(),
-                    new[] { codeWithErrorsIndicated },
-                    new[] { fixedCode },
-                    MetadataReferences,
-                    fixTitle,
-                    allowCompilationErrors,
-                    FixAllScope.Document)
-                .GetAwaiter()
-                .GetResult();
-        }
-
-        /// <summary>
-        /// Verifies that
-        /// 1. <paramref name="codeWithErrorsIndicated"/> produces the expected diagnostics
-        /// 2. The code fix fixes the code.
-        /// </summary>
-        /// <typeparam name="TAnalyzer">The type of the analyzer.</typeparam>
-        /// <typeparam name="TCodeFix">The type of the code fix.</typeparam>
-        /// <param name="codeWithErrorsIndicated">The code with error positions indicated.</param>
-        /// <param name="fixedCode">The expected code produced by the code fix.</param>
-        /// <param name="fixTitle">The title of the fix to apply if more than one.</param>
-        /// <param name="allowCompilationErrors">If compilation errors are accepted in the fixed code.</param>
-        public static void FixAllOneByOne<TAnalyzer, TCodeFix>(string codeWithErrorsIndicated, string fixedCode, string fixTitle = null, AllowCompilationErrors allowCompilationErrors = AllowCompilationErrors.No)
-            where TAnalyzer : DiagnosticAnalyzer, new()
-            where TCodeFix : CodeFixProvider, new()
-        {
-            var analyzer = new TAnalyzer();
-            FixAllOneByOneAsync(
-                    analyzer,
-                    new TCodeFix(),
-                    new[] { codeWithErrorsIndicated },
-                    new[] { fixedCode },
-                    MetadataReferences,
-                    fixTitle,
-                    allowCompilationErrors)
-                .GetAwaiter()
-                .GetResult();
-        }
-
-        /// <summary>
-        /// Verifies that
-        /// 1. <paramref name="codeWithErrorsIndicated"/> produces the expected diagnostics
-        /// 2. The code fix fixes the code.
-        /// </summary>
-        /// <typeparam name="TCodeFix">The type of the code fix.</typeparam>
-        /// <param name="id">The id of the expected diagnostic.</param>
-        /// <param name="codeWithErrorsIndicated">The code with error positions indicated.</param>
-        /// <param name="fixedCode">The expected code produced by the code fix.</param>
-        /// <param name="fixTitle">The title of the fix to apply if more than one.</param>
-        /// <param name="allowCompilationErrors">If compilation errors are accepted in the fixed code.</param>
-        public static void FixAllOneByOne<TCodeFix>(string id, string codeWithErrorsIndicated, string fixedCode, string fixTitle = null, AllowCompilationErrors allowCompilationErrors = AllowCompilationErrors.No)
-            where TCodeFix : CodeFixProvider, new()
-        {
-            var analyzer = new PlaceholderAnalyzer(id);
-            FixAllOneByOneAsync(
-                    analyzer,
-                    new TCodeFix(),
-                    new[] { codeWithErrorsIndicated },
-                    new[] { fixedCode },
-                    MetadataReferences,
-                    fixTitle,
-                    allowCompilationErrors)
-                .GetAwaiter()
-                .GetResult();
-        }
-
-        /// <summary>
-        /// Verifies that
-        /// 1. <paramref name="codeWithErrorsIndicated"/> produces the expected diagnostics
-        /// 2. The code fix fixes the code by applying it as long as there are fixable errors.
+        /// 1. <paramref name="diagnosticsAndSources"/> produces the expected diagnostics
+        /// 2. The code fix fixes the code.
         /// </summary>
         /// <param name="analyzer">The analyzer to run on the code..</param>
         /// <param name="codeFix">The code fix to apply.</param>
-        /// <param name="codeWithErrorsIndicated">The code with error positions indicated.</param>
-        /// <param name="fixedCode">The expected code produced by the code fix.</param>
+        /// <param name="diagnosticsAndSources">The code and expected diagnostics</param>
+        /// <param name="fixedCode">The expected code produced by the code fix.</param>
+        /// <param name="compilationOptions">The <see cref="CSharpCompilationOptions"/> to use.</param>
         /// <param name="metadataReference">The meta data metadataReference to add to the compilation.</param>
         /// <param name="fixTitle">The title of the fix to apply if more than one.</param>
         /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
         /// <param name="allowCompilationErrors">If compilation errors are accepted in the fixed code.</param>
-        public static async Task FixAllOneByOneAsync(DiagnosticAnalyzer analyzer, CodeFixProvider codeFix, IReadOnlyList<string> codeWithErrorsIndicated, IReadOnlyList<string> fixedCode, IReadOnlyList<MetadataReference> metadataReference, string fixTitle, AllowCompilationErrors allowCompilationErrors)
+        public static async Task FixAllAsync(DiagnosticAnalyzer analyzer, CodeFixProvider codeFix, DiagnosticsAndSources diagnosticsAndSources, IReadOnlyList<string> fixedCode, CSharpCompilationOptions compilationOptions, IReadOnlyList<MetadataReference> metadataReference, string fixTitle, AllowCompilationErrors allowCompilationErrors)
         {
             var data = await CreateDiagnosticsMetadataAsync(
                 analyzer,
                 codeFix,
-                codeWithErrorsIndicated,
+                diagnosticsAndSources,
+                compilationOptions,
+                metadataReference);
+            await FixAllOneByOneAsync(analyzer, codeFix, fixedCode, fixTitle, allowCompilationErrors, data).ConfigureAwait(false);
+
+            var fixAllProvider = codeFix.GetFixAllProvider();
+            if (fixAllProvider != null)
+            {
+                foreach (var scope in fixAllProvider.GetSupportedFixAllScopes())
+                {
+                    await FixAllByScopeAsync(analyzer, codeFix, fixedCode, fixTitle, allowCompilationErrors, data, scope);
+                }
+            }
+        }
+
+        /// <summary>
+        /// Verifies that
+        /// 1. <paramref name="codeWithErrorsIndicated"/> produces the expected diagnostics
+        /// 2. The code fix fixes the code.
+        /// </summary>
+        /// <typeparam name="TAnalyzer">The type of the analyzer.</typeparam>
+        /// <typeparam name="TCodeFix">The type of the code fix.</typeparam>
+        /// <param name="codeWithErrorsIndicated">The code with error positions indicated.</param>
+        /// <param name="fixedCode">The expected code produced by the code fix.</param>
+        /// <param name="fixTitle">The title of the fix to apply if more than one.</param>
+        /// <param name="allowCompilationErrors">If compilation errors are accepted in the fixed code.</param>
+        public static void FixAllInDocument<TAnalyzer, TCodeFix>(string codeWithErrorsIndicated, string fixedCode, string fixTitle = null, AllowCompilationErrors allowCompilationErrors = AllowCompilationErrors.No)
+            where TAnalyzer : DiagnosticAnalyzer, new()
+            where TCodeFix : CodeFixProvider, new()
+        {
+            var analyzer = new TAnalyzer();
+            FixAllByScopeAsync(
+                    analyzer,
+                    new TCodeFix(),
+                    new[] { codeWithErrorsIndicated },
+                    new[] { fixedCode },
+                    MetadataReferences,
+                    fixTitle,
+                    allowCompilationErrors,
+                    FixAllScope.Document)
+                .GetAwaiter()
+                .GetResult();
+        }
+
+        /// <summary>
+        /// Verifies that
+        /// 1. <paramref name="codeWithErrorsIndicated"/> produces the expected diagnostics
+        /// 2. The code fix fixes the code.
+        /// </summary>
+        /// <typeparam name="TCodeFix">The type of the code fix.</typeparam>
+        /// <param name="id">The id of the expected diagnostic.</param>
+        /// <param name="codeWithErrorsIndicated">The code with error positions indicated.</param>
+        /// <param name="fixedCode">The expected code produced by the code fix.</param>
+        /// <param name="fixTitle">The title of the fix to apply if more than one.</param>
+        /// <param name="allowCompilationErrors">If compilation errors are accepted in the fixed code.</param>
+        public static void FixAllInDocument<TCodeFix>(string id, string codeWithErrorsIndicated, string fixedCode, string fixTitle = null, AllowCompilationErrors allowCompilationErrors = AllowCompilationErrors.No)
+            where TCodeFix : CodeFixProvider, new()
+        {
+            var analyzer = new PlaceholderAnalyzer(id);
+            FixAllByScopeAsync(
+                    analyzer,
+                    new TCodeFix(),
+                    new[] { codeWithErrorsIndicated },
+                    new[] { fixedCode },
+                    MetadataReferences,
+                    fixTitle,
+                    allowCompilationErrors,
+                    FixAllScope.Document)
+                .GetAwaiter()
+                .GetResult();
+        }
+
+        /// <summary>
+        /// Verifies that
+        /// 1. <paramref name="codeWithErrorsIndicated"/> produces the expected diagnostics
+        /// 2. The code fix fixes the code.
+        /// </summary>
+        /// <typeparam name="TAnalyzer">The type of the analyzer.</typeparam>
+        /// <typeparam name="TCodeFix">The type of the code fix.</typeparam>
+        /// <param name="codeWithErrorsIndicated">The code with error positions indicated.</param>
+        /// <param name="fixedCode">The expected code produced by the code fix.</param>
+        /// <param name="fixTitle">The title of the fix to apply if more than one.</param>
+        /// <param name="allowCompilationErrors">If compilation errors are accepted in the fixed code.</param>
+        public static void FixAllOneByOne<TAnalyzer, TCodeFix>(string codeWithErrorsIndicated, string fixedCode, string fixTitle = null, AllowCompilationErrors allowCompilationErrors = AllowCompilationErrors.No)
+            where TAnalyzer : DiagnosticAnalyzer, new()
+            where TCodeFix : CodeFixProvider, new()
+        {
+            var analyzer = new TAnalyzer();
+            FixAllOneByOneAsync(
+                    analyzer,
+                    new TCodeFix(),
+                    new[] { codeWithErrorsIndicated },
+                    new[] { fixedCode },
+                    MetadataReferences,
+                    fixTitle,
+                    allowCompilationErrors)
+                .GetAwaiter()
+                .GetResult();
+        }
+
+        /// <summary>
+        /// Verifies that
+        /// 1. <paramref name="codeWithErrorsIndicated"/> produces the expected diagnostics
+        /// 2. The code fix fixes the code.
+        /// </summary>
+        /// <typeparam name="TCodeFix">The type of the code fix.</typeparam>
+        /// <param name="id">The id of the expected diagnostic.</param>
+        /// <param name="codeWithErrorsIndicated">The code with error positions indicated.</param>
+        /// <param name="fixedCode">The expected code produced by the code fix.</param>
+        /// <param name="fixTitle">The title of the fix to apply if more than one.</param>
+        /// <param name="allowCompilationErrors">If compilation errors are accepted in the fixed code.</param>
+        public static void FixAllOneByOne<TCodeFix>(string id, string codeWithErrorsIndicated, string fixedCode, string fixTitle = null, AllowCompilationErrors allowCompilationErrors = AllowCompilationErrors.No)
+            where TCodeFix : CodeFixProvider, new()
+        {
+            var analyzer = new PlaceholderAnalyzer(id);
+            FixAllOneByOneAsync(
+                    analyzer,
+                    new TCodeFix(),
+                    new[] { codeWithErrorsIndicated },
+                    new[] { fixedCode },
+                    MetadataReferences,
+                    fixTitle,
+                    allowCompilationErrors)
+                .GetAwaiter()
+                .GetResult();
+        }
+
+        /// <summary>
+        /// Verifies that
+        /// 1. <paramref name="codeWithErrorsIndicated"/> produces the expected diagnostics
+        /// 2. The code fix fixes the code by applying it as long as there are fixable errors.
+        /// </summary>
+        /// <param name="analyzer">The analyzer to run on the code..</param>
+        /// <param name="codeFix">The code fix to apply.</param>
+        /// <param name="codeWithErrorsIndicated">The code with error positions indicated.</param>
+        /// <param name="fixedCode">The expected code produced by the code fix.</param>
+        /// <param name="metadataReference">The meta data metadataReference to add to the compilation.</param>
+        /// <param name="fixTitle">The title of the fix to apply if more than one.</param>
+        /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
+        /// <param name="allowCompilationErrors">If compilation errors are accepted in the fixed code.</param>
+        public static async Task FixAllOneByOneAsync(DiagnosticAnalyzer analyzer, CodeFixProvider codeFix, IReadOnlyList<string> codeWithErrorsIndicated, IReadOnlyList<string> fixedCode, IReadOnlyList<MetadataReference> metadataReference, string fixTitle, AllowCompilationErrors allowCompilationErrors)
+        {
+            var data = await CreateDiagnosticsMetadataAsync(
+                analyzer,
+                codeFix,
+                DiagnosticsAndSources.CreateFromCodeWithErrorsIndicated(analyzer, codeWithErrorsIndicated),
                 CodeFactory.DefaultCompilationOptions(analyzer, SuppressedDiagnostics),
                 metadataReference);
             await FixAllOneByOneAsync(analyzer, codeFix, fixedCode, fixTitle, allowCompilationErrors, data);
@@ -426,7 +460,7 @@
             var data = await CreateDiagnosticsMetadataAsync(
                 analyzer,
                 codeFix,
-                codeWithErrorsIndicated,
+                DiagnosticsAndSources.CreateFromCodeWithErrorsIndicated(analyzer, codeWithErrorsIndicated),
                 CodeFactory.DefaultCompilationOptions(analyzer, SuppressedDiagnostics),
                 metadataReference);
             await FixAllByScopeAsync(analyzer, codeFix, fixedCode, fixTitle, allowCompilationErrors, data, scope);
@@ -452,7 +486,7 @@
             }
         }

-        private static async Task<DiagnosticsMetadata> CreateDiagnosticsMetadataAsync(DiagnosticAnalyzer analyzer, CodeFixProvider codeFix, IReadOnlyList<string> codeWithErrorsIndicated, CSharpCompilationOptions compilationOptions, IReadOnlyList<MetadataReference> metadataReference)
+        private static async Task<DiagnosticsMetadata> CreateDiagnosticsMetadataAsync(DiagnosticAnalyzer analyzer, CodeFixProvider codeFix, DiagnosticsAndSources diagnosticsAndSources, CSharpCompilationOptions compilationOptions, IReadOnlyList<MetadataReference> metadataReference)
         {
             if (analyzer.SupportedDiagnostics.Length != 1)
             {
@@ -463,7 +497,6 @@
             }

             AssertCodeFixCanFixDiagnosticsFromAnalyzer(analyzer, codeFix);
-            var diagnosticsAndSources = DiagnosticsAndSources.CreateFromCodeWithErrorsIndicated(analyzer, codeWithErrorsIndicated);
             var data = await DiagnosticsWithMetadataAsync(analyzer, diagnosticsAndSources, compilationOptions, metadataReference)
                 .ConfigureAwait(false);


923: just add last point when mouse up

923: just add last point when mouse up

--- a_mini/projects/Mini/3_Samples/21_HandPaint/SmoothBrush2.cs
+++ a_mini/projects/Mini/3_Samples/21_HandPaint/SmoothBrush2.cs
@@ -154,13 +154,9 @@
                         break;
                     case SmoothBrushMode.SolidBrush:
                         {
-                            //var firstPoint = contPoints[0];
-                            //contPoints.Add(firstPoint); //close
-
                             //create close point
-                            Vector2 startPoint = currentBrushPath.GetStartPoint();
-                            Vector2 endPoint = currentBrushPath.GetEndPoint();
-                            // currentBrushPath.MakeSmoothPath();
+                            currentBrushPath.AddPointAtLast(x, y);
+                            currentBrushPath.MakeSmoothPath();
                         }
                         break;
                 }


Use AppendLine() instead of Append().

Use AppendLine() instead of Append().

--- Irony/Parsing/Terminals/HeredocTerminal.cs
+++ Irony/Parsing/Terminals/HeredocTerminal.cs
@@ -167,8 +167,7 @@
                         }
                     }
                     if (!foundLine) {
-                        value.Append(line);
-                        value.Append('\n');
+                        value.AppendLine(line);
                         HereDocConsumedLine cline = new HereDocConsumedLine();
                         cline.offset = eolPos + 1;
                         cline.text = line;


Console application for tests

Console application for tests

--- Minesweeper/Minesweeper.Console/Program.cs
+++ Minesweeper/Minesweeper.Console/Program.cs
@@ -15,6 +15,7 @@
             var difficulty = ChooseDifficulty();
             game = new Game();
             game.ConfigureGameDifficulty(difficulty);
+            PrintField();
         }

         private static DifficultyLevelEnum ChooseDifficulty()
@@ -24,7 +25,7 @@
             {
                 try
                 {
-                   ConsoleHelper.PrintTexts(GetConfigurationMessages());
+                    ConsoleHelper.PrintTexts(GetConfigurationMessages());
                     var valueRead = Convert.ToInt32(System.Console.ReadLine());
                     return ConvertToDifficultityLevelEnum(valueRead);
                 }
@@ -60,12 +61,34 @@
             var rows = game.Field.FieldLevel.QuantityRows();
             var collumns = game.Field.FieldLevel.QuantityCollumns();

-            for(var row = 0; row < rows; row++)
+            for (var row = 0; row < rows; row++)
             {
-                for(var collumn = 0; collumn < collumns; collumn++)
+                for (var collumn = 0; collumn < collumns; collumn++)
                 {
+                    var text = string.Empty;
+                    var position = new Position(row, collumn);
+                    var cell = game.Field.GetCell(position);
+                    if (cell.HasBomb)
+                        text = "B";
+                    else
+                    {
+                        switch (cell.Status)
+                        {
+                            case StatusEnum.Untouched:
+                                text = "U";
+                                break;
+                            case StatusEnum.Revealed:
+                                text = "R";
+                                break;
+                            case StatusEnum.Flagged:
+                                text = "F";
+                                break;
+                        }
+                    }

+                    System.Console.Write(string.Format("{0} ", text));
                 }
+                System.Console.WriteLine();
             }
         }
     }


Use System.Convert instead of casting (casting doesn't work)

--- Mono.Debugging.Soft/SoftDebuggerAdaptor.cs
+++ Mono.Debugging.Soft/SoftDebuggerAdaptor.cs
@@ -351,35 +351,35 @@

 							try {
 								if (tt == typeof (bool))
-									res = (bool) val;
+									res = System.Convert.ToBoolean (val);
 								else if (tt == typeof (byte))
-									res = (byte) val;
+									res = System.Convert.ToByte (val);
 								else if (tt == typeof (sbyte))
-									res = (sbyte) val;
+									res = System.Convert.ToSByte (val);
 								else if (tt == typeof (char))
-									res = (char) val;
+									res = System.Convert.ToChar (val);
 								else if (tt == typeof (short))
-									res = (short) val;
+									res = System.Convert.ToInt16 (val);
 								else if (tt == typeof (ushort))
-									res = (ushort) val;
+									res = System.Convert.ToUInt16 (val);
 								else if (tt == typeof (int))
-									res = (int) val;
+									res = System.Convert.ToInt32 (val);
 								else if (tt == typeof (uint))
-									res = (uint) val;
+									res = System.Convert.ToUInt32 (val);
 								else if (tt == typeof (long))
-									res = (long) val;
+									res = System.Convert.ToInt64 (val);
 								else if (tt == typeof (ulong))
-									res = (ulong) val;
+									res = System.Convert.ToUInt64 (val);
 								else if (tt == typeof (float))
-									res = (float) val;
+									res = System.Convert.ToSingle (val);
 								else if (tt == typeof (double))
-									res = (double) val;
+									res = System.Convert.ToDouble (val);
 								else if (tt == typeof (decimal))
-									res = (decimal) val;
+									res = System.Convert.ToDecimal (val);
 								else if (tt == typeof (string))
-									res = (string) val;
+									res = System.Convert.ToString (val);
 								else if (tt == typeof (DateTime))
-									res = (DateTime) val;
+									res = System.Convert.ToDateTime (val);
 								else
 									res = val;
 							} catch {


Bug 21157 - IntPtr display when debugging 64bits applications

--- Mono.Debugging.Soft/SoftDebuggerAdaptor.cs
+++ Mono.Debugging.Soft/SoftDebuggerAdaptor.cs
@@ -1989,7 +1989,7 @@
 				if (sm.Type.IsPrimitive) {
 					// Boxed primitive
 					if (sm.Type.FullName == "System.IntPtr")
-						return new IntPtr ((long)((PrimitiveValue)sm.Fields[0]).Value);
+						return new Mono.Debugging.Backend.EvaluationResult ("0x" + ((long)((PrimitiveValue)sm.Fields [0]).Value).ToString ("x"));
 					if (sm.Fields.Length > 0 && (sm.Fields[0] is PrimitiveValue))
 						return ((PrimitiveValue)sm.Fields[0]).Value;
 				} else if (sm.Type.FullName == "System.Decimal") {


[Debugger] Don't crash if an exception is thrown while trying to continue

--- Mono.Debugging.Soft/SoftDebuggerSession.cs
+++ Mono.Debugging.Soft/SoftDebuggerSession.cs
@@ -485,10 +485,15 @@
 		protected override void OnContinue ()
 		{
 			ThreadPool.QueueUserWorkItem (delegate {
-				Adaptor.CancelAsyncOperations (); // This call can block, so it has to run in background thread to avoid keeping the main session lock
-				OnResumed ();
-				vm.Resume ();
-				DequeueEventsForFirstThread ();
+				try {
+					Adaptor.CancelAsyncOperations (); // This call can block, so it has to run in background thread to avoid keeping the main session lock
+					OnResumed ();
+					vm.Resume ();
+					DequeueEventsForFirstThread ();
+				} catch (Exception ex) {
+					if (!HandleException (ex))
+						OnDebuggerOutput (true, ex.ToString ());
+				}
 			});
 		}


[Debugger] Don't check for needing to redo a step request if no step is active

Fixes bug #3749.

--- Mono.Debugging.Soft/SoftDebuggerSession.cs
+++ Mono.Debugging.Soft/SoftDebuggerSession.cs
@@ -1192,7 +1192,9 @@
 						}

 						if (breakpoints.TryGetValue (be.Request, out binfo)) {
-							if (binfo.Location.ILOffset == currentAddress && e.Thread.Id == currentStepRequest.Thread.Id)
+							if (currentStepRequest != null &&
+							    binfo.Location.ILOffset == currentAddress &&
+							    e.Thread.Id == currentStepRequest.Thread.Id)
 								redoCurrentStep = true;

 							breakEvent = binfo.BreakEvent;


[Debugger] Fixed up FunctionBreakpoint resolved message strings.

--- Mono.Debugging.Soft/SoftDebuggerSession.cs
+++ Mono.Debugging.Soft/SoftDebuggerSession.cs
@@ -1500,8 +1500,9 @@

 							loc = GetLocFromMethod (method, bp.Line);
 							if (loc != null) {
-								OnDebuggerOutput (false, string.Format ("Resolved pending breakpoint for '{0}:{1}' to {2}:{3} [0x{4:x5}].\n",
-								                                        bp.FunctionName, bp.Line, loc.SourceFile, loc.LineNumber, loc.ILOffset));
+								string paramList = bp.ParamTypes != null ? "(" + string.Join (",", bp.ParamTypes) + ")" : "";
+								OnDebuggerOutput (false, string.Format ("Resolved pending breakpoint for '{0}{1}' to {2}:{3} [0x{4:x5}].\n",
+								                                        bp.FunctionName, paramList, loc.SourceFile, loc.LineNumber, loc.ILOffset));

 								if (bp.ParamTypes == null)
 									bp.ParamTypes = GetParamTypes (method);
@@ -1519,8 +1520,9 @@

 							loc = GetLocFromMethod (method, bp.Line);
 							if (loc != null) {
-								OnDebuggerOutput (false, string.Format ("Resolved pending breakpoint for '{0}:{1}' to {2}:{3} [0x{4:x5}].\n",
-								                                        bp.FunctionName, bp.Line, loc.SourceFile, loc.LineNumber, loc.ILOffset));
+								string paramList = bp.ParamTypes != null ? "(" + string.Join (",", bp.ParamTypes) + ")" : "";
+								OnDebuggerOutput (false, string.Format ("Resolved pending breakpoint for '{0}{1}' to {2}:{3} [0x{4:x5}].\n",
+								                                        bp.FunctionName, paramList, loc.SourceFile, loc.LineNumber, loc.ILOffset));

 								if (bp.ParamTypes == null)
 									bp.ParamTypes = GetParamTypes (method);


Allow the soft debugger retry logic code to be overriden.

[Debugger] Allow infinite retries if maxAttempts on the connection is <= 0. Fix bug where maxAttempts was being passed as the attemptNumber.

--- Mono.Debugging.Soft/SoftDebuggerSession.cs
+++ Mono.Debugging.Soft/SoftDebuggerSession.cs
@@ -142,6 +142,16 @@
 			});
 			ConnectionStarting (VirtualMachineManager.BeginListen (dbgEP, conEP, callback), dsi);
 		}
+
+		protected virtual bool ShouldRetryConnection (Exception ex, int attemptNumber)
+		{
+			var sx = ex as SocketException;
+			if (sx != null) {
+				if (sx.ErrorCode == 10061) //connection refused
+					return true;
+			}
+			return false;
+		}

 		/// <summary>Starts the debugger connecting to a remote IP</summary>
 		protected void StartConnecting (RemoteSoftDebuggerStartInfo dsi, int maxAttempts, int timeBetweenAttempts)
@@ -153,23 +163,18 @@
 			InitForRemoteSession (dsi, out dbgEP, out conEP);

 			AsyncCallback callback = null;
+			int attemptNumber = 0;
 			callback = delegate (IAsyncResult ar) {
 				try {
 					ConnectionStarted (VirtualMachineManager.EndConnect (ar));
 					return;
 				} catch (Exception ex) {
-					bool retry = false;
-					var sx = ex as SocketException;
-					if (sx != null)
-						retry = sx.ErrorCode == 10061; //connection refused
-
-					if (!retry || maxAttempts == 1 || Exited) {
+					attemptNumber++;
+					if (!ShouldRetryConnection(ex, attemptNumber) || attemptNumber == maxAttempts || Exited) {
 						OnConnectionError (ex);
 						return;
 					}
 				}
-				if (maxAttempts > 1)
-					maxAttempts--;
 				try {
 					if (timeBetweenAttempts > 0)
 						System.Threading.Thread.Sleep (timeBetweenAttempts);


Auto resize image button

Auto resize image button

--- MonoHaven.Client/UI/Widgets/ImageButton.cs
+++ MonoHaven.Client/UI/Widgets/ImageButton.cs
@@ -1,4 +1,5 @@
 using System;
+using System.Drawing;
 using MonoHaven.Graphics;
 using MonoHaven.Input;

@@ -7,6 +8,7 @@
 	public class ImageButton : Widget
 	{
 		private bool isPressed;
+		private Drawable image;

 		public ImageButton(Widget parent)
 			: base(parent)
@@ -24,8 +26,12 @@

 		public Drawable Image
 		{
-			get;
-			set;
+			get { return image; }
+			set
+			{
+				image = value;
+				UpdateSize();
+			}
 		}

 		public Drawable PressedImage
@@ -81,6 +87,12 @@

 			e.Handled = true;
 		}
+
+		private void UpdateSize()
+		{
+			var size = Image != null ? Image.Size : new Size(0, 0);
+			Resize(size);
+		}
 	}
 }


Fixed #11 Prevent UnhookWindowsHookEx calls during application exit.

--- MouseKeyHook/WinApi/HookProcedureHandle.cs
+++ MouseKeyHook/WinApi/HookProcedureHandle.cs
@@ -2,19 +2,31 @@
 // Copyright (c) 2015 George Mamaladze
 // See license.txt or http://opensource.org/licenses/mit-license.php

+using System;
+using System.Threading;
 using Microsoft.Win32.SafeHandles;

 namespace Gma.System.MouseKeyHook.WinApi
 {
     internal class HookProcedureHandle : SafeHandleZeroOrMinusOneIsInvalid
     {
+        private static bool _closing = false;
+
+        ~HookProcedureHandle()
+        {
+            AppDomain.CurrentDomain.ProcessExit += (sender, e) => {_closing = true;};
+        }
+
         public HookProcedureHandle()
             : base(true)
         {
+
         }

         protected override bool ReleaseHandle()
         {
+            //NOTE Calling Unhook during processexit causes deley
+            if (_closing) return true;
             return HookNativeMethods.UnhookWindowsHookEx(handle) != 0;
         }
     }


Allow users to override the generated data attributes with their own eg @Html.TextBoxFor(x => x.SimpleErrorMessage, true, htmlAttributes: new { data_rule_remote = "{\"url\":\"/Demo/RemoteSimple\",\"serializeSelector\":\"form\"}" })

--- jQuery.Validation.Unobtrusive.Native/Mapper.cs
+++ jQuery.Validation.Unobtrusive.Native/Mapper.cs
@@ -1,4 +1,5 @@
-using System.Linq;
+using System.Collections.Generic;
+using System.Linq;
 using System.Linq.Expressions;
 using System.Web.Routing;
 using Newtonsoft.Json;
@@ -28,7 +29,7 @@
             {
                 // if we have an error message for this rule then create a data-msg-/rulename/ attribute to store it
                 if (!string.IsNullOrEmpty(rule.ErrorMessage) && rule.ValidationType != "length") // length is the only exception to this standard rule
-                    attributes.Add("data-msg-" + rule.ValidationType, rule.ErrorMessage);
+                    attributes.AddIfNotPresent("data-msg-" + rule.ValidationType, rule.ErrorMessage);

                 switch (rule.ValidationType)
                 {
@@ -37,26 +38,26 @@
                     case "equalto":
                         // Convert equalto selector from "*.PasswordDemo" style to "#PasswordDemo" style
                         var equalToSelector = "#" + rule.ValidationParameters["other"].ToString().Substring(2);
-                        attributes.Add("data-rule-equalto", equalToSelector);
+                        attributes.AddIfNotPresent("data-rule-equalto", equalToSelector);
                         break;

                     case "length":
                         // length is mapped to minlength and maxlength
                         if (rule.ValidationParameters.ContainsKey("min"))
                         {
-                            attributes.Add("data-rule-minlength", rule.ValidationParameters["min"]);
-                            attributes.Add("data-msg-minlength", rule.ErrorMessage);
+                            attributes.AddIfNotPresent("data-rule-minlength", rule.ValidationParameters["min"]);
+                            attributes.AddIfNotPresent("data-msg-minlength", rule.ErrorMessage);
                         }

                         if (rule.ValidationParameters.ContainsKey("max"))
                         {
-                            attributes.Add("data-rule-maxlength", rule.ValidationParameters["max"]);
-                            attributes.Add("data-msg-maxlength", rule.ErrorMessage);
+                            attributes.AddIfNotPresent("data-rule-maxlength", rule.ValidationParameters["max"]);
+                            attributes.AddIfNotPresent("data-msg-maxlength", rule.ErrorMessage);
                         }
                         break;

                     case "range":
-                        attributes.Add("data-rule-range", string.Format("[{0},{1}]", rule.ValidationParameters["min"], rule.ValidationParameters["max"]));
+                        attributes.AddIfNotPresent("data-rule-range", string.Format("[{0},{1}]", rule.ValidationParameters["min"], rule.ValidationParameters["max"]));
                         break;

                     // Standard handling of rules
@@ -65,7 +66,7 @@

                         // if we have *no* validation parameters then create a data-rule-/rulename/ attribute with the value "true"
                         // if we have validation parameters then create a data-rule-/rulename/ attribute with the JSON'd ValidationParameters
-                        attributes.Add("data-rule-" + rule.ValidationType,
+                        attributes.AddIfNotPresent("data-rule-" + rule.ValidationType,
                             rule.ValidationParameters.Count == 0
                                 ? "true"
                                 : JsonConvert.SerializeObject(rule.ValidationParameters));
@@ -74,6 +75,12 @@
             }

             return attributes;
+        }
+
+        private static void AddIfNotPresent(this IDictionary<string, object> attributes, string attrKey, object attrValue)
+        {
+            if (!attributes.ContainsKey(attrKey))
+                attributes.Add(attrKey, attrValue);
         }

         public static IHtmlString GenerateHtmlWithoutMvcUnobtrusiveAttributes(Func<IHtmlString> generator)


mute test and link to thread about it

mute test and link to thread about it

--- Octokit.Tests.Integration/RedirectTests.cs
+++ Octokit.Tests.Integration/RedirectTests.cs
@@ -18,7 +18,7 @@
             Assert.Equal(AccountType.User, repository.Owner.Type);
         }

-        [IntegrationTest]
+        [IntegrationTest(Skip = "This test is super-unreliable right now - see https://github.com/octokit/octokit.net/issues/874 for discussion")]
         public async Task CanCreateIssueOnRedirectedRepository()
         {
             var client = Helper.GetAuthenticatedClient();


* Cleaned up some code from an earlier commit

--- OpenSim/Region/Environment/Scenes/Scene.cs
+++ OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1320,19 +1320,7 @@

             m_sceneGridService.Close();
         }
-        public void NewIncomingGridSetting(ulong regionHandle, string key, string gvalue)
-        {
-            if (key == "allow_forceful_banlines")
-            {
-                if (gvalue == "FALSE")
-                {
-                    MainLog.Instance.Verbose("INTERGRID", "Grid is disallowing forcefull banlines");
-                    //Ming, Do stuff here
-                }
-            }
-
-
-        }
+

         /// <summary>
         ///


adds link to test controller

adds link to test controller

--- OutboundConnection/Views/Home/Index.cshtml
+++ OutboundConnection/Views/Home/Index.cshtml
@@ -5,3 +5,4 @@

Index

+@Html.ActionLink("Go to test page", "index", "test")


Fix GetMax using inner query for limiting result

--- PaletteInsightAgent/Tableau/TableauRepo.cs
+++ PaletteInsightAgent/Tableau/TableauRepo.cs
@@ -151,7 +151,7 @@
         {
             // If server got restarted we get IOException for the first time and there is no
             // other way to detect this but sending the query. This is why we have the for loop
-            for (int i= 0; i < 2; i++)
+            for (int i = 0; i < 2; i++)
             {
                 if (!IsConnectionOpen())
                 {
@@ -178,7 +178,8 @@
         {
             lock (readLock)
             {
-                return (DataTable)queryWithReconnect(() => {
+                return (DataTable)queryWithReconnect(() =>
+                {
                     using (var adapter = new NpgsqlDataAdapter(query, connection))
                     {
                         DataTable table = new DataTable();
@@ -269,14 +270,20 @@

         private string GetMax(string tableName, string field, string filter)
         {
-            var query = String.Format("select max({0}) from {1}", field, tableName);
-            if (filter != null)
-            {
-                query = String.Format("{0} where {1}", query, filter);
-            }
+            var whereClause = filter != null ? $"where {filter}" : "";

             // Limit result to prevent System.OutOfMemoryException in Agent
-            query = String.Format("{0} order by {1} asc limit {2}", query, field, this.streamingTablesPollLimit);
+            var query = $@"
+                select max({field})
+                from
+                    (
+                    select {field}
+                    from {tableName}
+                    {whereClause}
+                    order by {field} asc
+                    limit {this.streamingTablesPollLimit}
+                    ) as iq
+                ;";

             var table = runQuery(query);
             // This query should return one field


Allow stats to be viewed anonymously

Allow stats to be viewed anonymously

--- PickemApp/Controllers/ProfileController.cs
+++ PickemApp/Controllers/ProfileController.cs
@@ -93,6 +93,7 @@
             return View("Index", new ProfileEdit { Name = user.Name, Email = user.Email, Username = user.Username });
         }

+        [AllowAnonymous]
         public ActionResult Stats(int id = 0)
         {
             Player user;


Do not add attribute if already updated

Do not add attribute if already updated

--- ProjectExcluder/ProjectExcluder/Program.cs
+++ ProjectExcluder/ProjectExcluder/Program.cs
@@ -9,104 +9,104 @@

 namespace ProjectExcluder
 {
-	class Program
-	{
-		private static List<string> _processedFiles = new List<string>();
+    class Program
+    {
+        private static int _processedFilesCount = 0;

-		static void Main(string[] args)
-		{
-			var mainProjectFilePath = string.Empty;
-#if DEBUG
-			mainProjectFilePath = @"C:\dvlp\Project\ASPNET4\Report2\Report2.Web\Report2.Web.csproj";
-#else
-			if (args.Count() != 1)
-				return;
+        static void Main(string[] args)
+        {
+            if (args.Count() != 1)
+                return;

-			mainProjectFilePath = args[0];
-#endif
-			if (!File.Exists(mainProjectFilePath))
-				throw new FileNotFoundException($"Not found: {mainProjectFilePath}");
+            var mainProjectFilePath = args[0];

-			FindChildProjects(mainProjectFilePath);
+            if (!File.Exists(mainProjectFilePath))
+                throw new FileNotFoundException($"Not found: {mainProjectFilePath}");

-			Console.WriteLine($"The End: {_processedFiles.Count} files have been processed");
-#if DEBUG
-			Console.Read();
-#endif
-		}
+            FindChildProjects(mainProjectFilePath);

-		private static void FindChildProjects(string filePath)
-		{
-			filePath = new DirectoryInfo(filePath).FullName;
+            Console.WriteLine($"The End: {_processedFilesCount} files have been processed");
+            Console.Read();
+        }

-			var baseDirectory = Path.GetDirectoryName(filePath);
-			var document = XDocument.Load(filePath);
-			var itemGroups = FindItemGroupElements(document);
+        private static void FindChildProjects(string filePath)
+        {
+            filePath = new DirectoryInfo(filePath).FullName;

-			//Console.WriteLine($"FindChildProjects from: {Path.GetFileName(filePath)}");
+            var baseDirectory = Path.GetDirectoryName(filePath);
+            var document = XDocument.Load(filePath);
+            var itemGroups = FindItemGroupElements(document);

-			foreach (var itemGroup in itemGroups)
-			{
-				var projectReferences = FindProjectReferenceElements(itemGroup);
-				if (projectReferences.Any())
-				{
-					//Console.WriteLine($"We have {referenceElements.Count()} Project reference included in {Path.GetFileName(filePath)}");
+            foreach (var itemGroup in itemGroups)
+            {
+                var projectReferences = FindProjectReferenceElements(itemGroup);
+                if (projectReferences.Any())
+                {
+                    foreach (var projectReference in projectReferences)
+                    {
+                        var childProjectPath = new DirectoryInfo(Path.Combine(baseDirectory, projectReference.Attribute("Include").Value)).FullName;

-					foreach (var projectReference in projectReferences)
-					{
-						var childProjectPath = new DirectoryInfo(Path.Combine(baseDirectory, projectReference.Attribute("Include").Value)).FullName;
+                        if (!File.Exists(childProjectPath))
+                            throw new FileNotFoundException($"Not found: {childProjectPath}");

-						if (!File.Exists(childProjectPath))
-							throw new FileNotFoundException($"Not found: {childProjectPath}");
+                        AddSonarQubeElement(childProjectPath);
+                        FindChildProjects(childProjectPath);
+                    }
+                }
+            }
+        }

-						AddSonarQubeElement(childProjectPath);
-						FindChildProjects(childProjectPath);
-					}
-				}
-			};
-		}
-
-		private static void AddSonarQubeElement(string filePath)
-		{
-			var fileName = Path.GetFileName(filePath);
+        private static void AddSonarQubeElement(string filePath)
+        {
+            var document = XDocument.Load(filePath);
+            var parentNameSpace = document.Root.Name.Namespace;
+            var propertyGroup = FindPropertyGroup(document);

-			if (!_processedFiles.Any(s => s == fileName))
-			{
-				var document = XDocument.Load(filePath);
-				var parentNameSpace = document.Root.Name.Namespace;
-				var propertyGroup = FindPropertyGroup(document);
-#if DEBUG
-				//Console.WriteLine($"Add SonarQubeExclude attribute to: {fileName}");
-#else
-				propertyGroup.Add(new XElement(parentNameSpace + "SonarQubeExclude", true));
-#endif
-				_processedFiles.Add(fileName);
-#if DEBUG
-				Console.WriteLine($"Save project file: {fileName}");
-#else
-				document.Save(filePath);
-#endif
-			}
-		}
-
-		private static IEnumerable<XElement> FindProjectReferenceElements(XElement itemGroup)
-		{
-			return itemGroup.Elements().Where(e =>
-							e.Name.LocalName == "ProjectReference" &&
-							e.HasAttributes &&
-							e.Attribute("Include") != null &&
-							e.Attribute("Include").Value.Contains(".csproj")
-			).ToList();
-		}
+            if (!IsFileAlreadyUpdated(propertyGroup))
+            {
+                propertyGroup.Add(new XElement(parentNameSpace + "SonarQubeExclude", true));
+                document.Save(filePath);

-		private static IEnumerable<XElement> FindItemGroupElements(XDocument document)
-		{
-			return document.Root.Elements().Where(e => e.Name.LocalName == "ItemGroup" && !e.HasAttributes && e.HasElements).ToList();
-		}
+                _processedFilesCount++;
+                Console.WriteLine($"Add SonarQubeExclude attribute to: {Path.GetFileName(filePath)}");
+            }
+        }

-		private static XElement FindPropertyGroup(XDocument document)
-		{
-			return document.Root.Elements().FirstOrDefault(e => e.Name.LocalName == "PropertyGroup" && !e.HasAttributes && e.HasElements);
-		}
-	}
+        private static bool IsFileAlreadyUpdated(XElement propertyGroup)
+        {
+            return propertyGroup.Elements()
+                                .Any(p => p.Name.LocalName == "SonarQubeExclude");
+        }
+
+        private static IEnumerable<XElement> FindProjectReferenceElements(XElement itemGroup)
+        {
+            return itemGroup.Elements()
+                            .Where(e =>
+                                e.Name.LocalName == "ProjectReference" &&
+                                e.HasAttributes &&
+                                e.Attribute("Include") != null &&
+                                e.Attribute("Include").Value.Contains(".csproj")
+            ).ToList();
+        }
+
+        private static IEnumerable<XElement> FindItemGroupElements(XDocument document)
+        {
+            return document.Root.Elements()
+                                .Where(e =>
+                                    e.Name.LocalName == "ItemGroup" &&
+                                    !e.HasAttributes &&
+                                    e.HasElements
+            ).ToList();
+        }
+
+        private static XElement FindPropertyGroup(XDocument document)
+        {
+            return document.Root.Elements()
+                                .FirstOrDefault(e =>
+                                    e.Name.LocalName == "PropertyGroup" &&
+                                    !e.HasAttributes &&
+                                    e.HasElements
+            );
+        }
+    }
 }


Geosurvey report fix.

Geosurvey report fix.

bleh.

--- Pulsar4X/Pulsar4X.UI/Handlers/Economics.cs
+++ Pulsar4X/Pulsar4X.UI/Handlers/Economics.cs
@@ -2077,11 +2077,11 @@
                     m_oSummaryPanel.SummaryDataGrid.Rows[12 + Adjust1].Cells[1].Value = "";
                     m_oSummaryPanel.SummaryDataGrid.Rows[13 + Adjust1].Cells[0].Value = "Tectonics";
                     m_oSummaryPanel.SummaryDataGrid.Rows[13 + Adjust1].Cells[1].Value = null; //CurrentPopulation.SystemBody.PlanetaryTectonics;
-                    //if (CurrentPopulation.SystemBody.GeoTeamSurvey)
+                    if (CurrentPopulation.Planet.GeoSurveyList.ContainsKey(CurrentFaction) == true)
                     {
                         Entry = "Completed";
                     }
-                    //else
+                    else
                     {
                         Entry = "No";
                     }


fix detection of MSVC version from qmake.conf

Reviewed-by: owolff

--- Qt4VS2003/Qt4VSAddin/AddQtVersionDialog.cs
+++ Qt4VS2003/Qt4VSAddin/AddQtVersionDialog.cs
@@ -266,12 +266,7 @@
                     string temporaryMscVersion = compilerDefines.Substring(index);
                     index = temporaryMscVersion.IndexOf('=');
                     if (index != -1)
-                    {
-                        temporaryMscVersion = temporaryMscVersion.Substring(index + 1);
-                        index = temporaryMscVersion.IndexOf(' ');
-                        if (index != -1)
-                            mscVersion = temporaryMscVersion.Remove(index);
-                    }
+                        mscVersion = temporaryMscVersion.Substring(index + 1).Trim();
                 }

 #if VS2005


Removed unnecessary attribute

Removed unnecessary attribute

--- Refit/Buffers/PooledBufferWriter.Stream.cs
+++ Refit/Buffers/PooledBufferWriter.Stream.cs
@@ -1,6 +1,5 @@
 using System;
 using System.Buffers;
-using System.Diagnostics.CodeAnalysis;
 using System.IO;
 using System.Threading;
 using System.Threading.Tasks;
@@ -102,7 +101,6 @@

             /// <inheritdoc/>
-            [SuppressMessage("Usage", "VSTHRD103", Justification = "Task is guaranteed to have run to completion")]
             public override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken)
             {
                 if (offset < 0) ThrowArgumentOutOfRangeExceptionForNegativeOffset();


Handle SSH_MSG_USERAUTH_BANNER prior establishing secure connection

--- Renci.SshClient/Renci.SshClient/Session.cs
+++ Renci.SshClient/Renci.SshClient/Session.cs
@@ -485,6 +485,8 @@
                     this.RegisterMessage("SSH_MSG_KEXINIT");
                     this.RegisterMessage("SSH_MSG_NEWKEYS");

+                    //  Some server implementations might sent this message first, prior establishing encryption algorithm
+                    this.RegisterMessage("SSH_MSG_USERAUTH_BANNER");

                     //  Start incoming request listener
                     this._messageListener = Task.Factory.StartNew(() => { this.MessageListener(); }, TaskCreationOptions.LongRunning);


PERFORMANCE: Lucene.Net.Util.AttributeSource: Eliminated unnecessary try catch and replaced ContainsKey with TryGetValue

--- src/Lucene.Net/Util/AttributeSource.cs
+++ src/Lucene.Net/Util/AttributeSource.cs
@@ -395,28 +395,19 @@
             where T : IAttribute
         {
             var attClass = typeof(T);
-            if (!attributes.ContainsKey(attClass))
+            // LUCENENET: Eliminated exception and used TryGetValue
+            if (!attributes.TryGetValue(attClass, out var result))
             {
                 if (!(attClass.IsInterface && typeof(IAttribute).IsAssignableFrom(attClass)))
                 {
                     throw new ArgumentException("AddAttribute() only accepts an interface that extends IAttribute, but " + attClass.FullName + " does not fulfil this contract.");
                 }

-                AddAttributeImpl(this.factory.CreateAttributeInstance<T>());
-            }
-
-            T returnAttr;
-            try
-            {
-                returnAttr = (T)(IAttribute)attributes[attClass];
-            }
-#pragma warning disable 168
-            catch (KeyNotFoundException knf)
-#pragma warning restore 168
-            {
-                return default(T);
-            }
-            return returnAttr;
+                result = this.factory.CreateAttributeInstance<T>();
+                AddAttributeImpl(result);
+            }
+
+            return (T)(IAttribute)result;
         }

         /// <summary>


Set FrmStartupManager minimum size

Set FrmStartupManager minimum size

--- Server/Forms/FrmStartupManager.Designer.cs
+++ Server/Forms/FrmStartupManager.Designer.cs
@@ -100,6 +100,7 @@
             this.Controls.Add(this.lstStartupItems);
             this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
             this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
+            this.MinimumSize = new System.Drawing.Size(650, 400);
             this.Name = "FrmStartupManager";
             this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
             this.Text = "Startup Manager []";


Fix on writing exceptions during ProgressForeach

--- Signum.Engine/Engine/ProgressExtensions.cs
+++ Signum.Engine/Engine/ProgressExtensions.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -35,7 +35,7 @@
                         }
                         catch (Exception e)
                         {
-                            writer(ConsoleColor.Red, "Error in {0}: {1}", elementID(item), e.Message);
+                            writer(ConsoleColor.Red, "{0:u} Error in {1}: {2}", DateTime.Now, elementID(item), e.Message);
                             writer(ConsoleColor.DarkRed, e.StackTrace.Indent(4));
                         }

@@ -71,7 +71,7 @@
                                 }
                                 catch (Exception e)
                                 {
-                                    writer(ConsoleColor.Red, "Error in {0}: {1}", elementID(item), e.Message);
+                                    writer(ConsoleColor.Red, "{0:u} Error in {1}: {2}", DateTime.Now, elementID(item), e.Message);
                                     writer(ConsoleColor.DarkRed, e.StackTrace.Indent(4));
                                 }
                             lock (SafeConsole.SyncKey)


Simplify ShareRecorder queue

Simplify ShareRecorder queue

--- src/Miningcore/Mining/ShareRecorder.cs
+++ src/Miningcore/Mining/ShareRecorder.cs
@@ -19,13 +19,12 @@
 */

 using System;
-using System.Collections.Concurrent;
 using System.Collections.Generic;
 using System.Data.Common;
 using System.IO;
 using System.Linq;
 using System.Net.Sockets;
-using System.Reactive.Concurrency;
+using System.Reactive.Concurrency;
 using System.Reactive.Linq;
 using System.Text;
 using System.Threading;
@@ -34,13 +33,11 @@
 using Miningcore.Configuration;
 using Miningcore.Extensions;
 using Miningcore.Messaging;
-using Miningcore.Notifications;
 using Miningcore.Notifications.Messages;
 using Miningcore.Persistence;
 using Miningcore.Persistence.Model;
 using Miningcore.Persistence.Repositories;
 using Miningcore.Time;
-using Miningcore.Util;
 using Newtonsoft.Json;
 using NLog;
 using Polly;
@@ -90,26 +87,23 @@
         private readonly IMessageBus messageBus;
         private ClusterConfig clusterConfig;
         private readonly IMapper mapper;
-        private readonly BlockingCollection<Share> queue = new BlockingCollection<Share>();
-
-        private readonly int QueueSizeWarningThreshold = 1024;
+
         private IAsyncPolicy faultPolicy;
         private bool hasLoggedPolicyFallbackFailure;
-        private bool hasWarnedAboutBacklogSize;
         private IDisposable queueSub;
         private string recoveryFilename;
         private const int RetryCount = 3;
         private const string PolicyContextKeyShares = "share";
         private bool notifiedAdminOnPolicyFallback = false;

-        private async Task PersistSharesFaulTolerantAsync(IList<Share> shares)
+        private async Task PersistSharesAsync(IList<Share> shares)
         {
             var context = new Dictionary<string, object> { { PolicyContextKeyShares, shares } };

-            await faultPolicy.ExecuteAsync(ctx => PersistSharesAsync((IList<Share>) ctx[PolicyContextKeyShares]), context);
-        }
-
-        private async Task PersistSharesAsync(IList<Share> shares)
+            await faultPolicy.ExecuteAsync(ctx => PersistSharesCoreAsync((IList<Share>) ctx[PolicyContextKeyShares]), context);
+        }
+
+        private async Task PersistSharesCoreAsync(IList<Share> shares)
         {
             await cf.RunTx(async (con, tx) =>
             {
@@ -229,7 +223,7 @@
                             {
                                 if (shares.Count == bufferSize)
                                 {
-                                    await PersistSharesAsync(shares);
+                                    await PersistSharesCoreAsync(shares);

                                     successCount += shares.Count;
                                     shares.Clear();
@@ -256,7 +250,7 @@
                         {
                             if (shares.Count > 0)
                             {
-                                await PersistSharesAsync(shares);
+                                await PersistSharesCoreAsync(shares);

                                 successCount += shares.Count;
                             }
@@ -302,7 +296,7 @@
             this.clusterConfig = clusterConfig;

             ConfigureRecovery();
-            InitializeQueue();
+            StartQueue();

             logger.Info(() => "Online");
         }
@@ -312,27 +306,24 @@
             logger.Info(() => "Stopping ..");

             queueSub?.Dispose();
-            queue?.Dispose();

             logger.Info(() => "Stopped");
         }

         #endregion // API-Surface

-        private void InitializeQueue()
-        {
-            messageBus.Listen<ClientShare>().Subscribe(x => queue.Add(x.Share));
-
-            queueSub = queue.GetConsumingEnumerable()
-                .ToObservable(TaskPoolScheduler.Default)
-                .Do(_ => CheckQueueBacklog())
+        private void StartQueue()
+        {
+            queueSub = messageBus.Listen<ClientShare>()
+                .ObserveOn(TaskPoolScheduler.Default)
+                .Select(x=> x.Share)
                 .Buffer(TimeSpan.FromSeconds(1), 100)
                 .Where(shares => shares.Any())
                 .Select(shares => Observable.FromAsync(async () =>
                 {
                     try
                     {
-                        await PersistSharesFaulTolerantAsync(shares);
+                        await PersistSharesAsync(shares);
                     }

                     catch (Exception ex)
@@ -341,7 +332,10 @@
                     }
                 }))
                 .Concat()
-                .Subscribe();
+                .Subscribe(
+                    _=> {},
+                    ex=> logger.Fatal(()=> $"{nameof(ShareRecorder)} queue terminated with {ex}"),
+                    ()=> logger.Info(()=> $"{nameof(ShareRecorder)} queue completed"));
         }

         private void ConfigureRecovery()
@@ -349,23 +343,6 @@
             recoveryFilename = !string.IsNullOrEmpty(clusterConfig.PaymentProcessing?.ShareRecoveryFile)
                 ? clusterConfig.PaymentProcessing.ShareRecoveryFile
                 : "recovered-shares.txt";
-        }
-
-        private void CheckQueueBacklog()
-        {
-            if (queue.Count > QueueSizeWarningThreshold)
-            {
-                if (!hasWarnedAboutBacklogSize)
-                {
-                    logger.Warn(() => $"Share persistence queue backlog has crossed {QueueSizeWarningThreshold}");
-                    hasWarnedAboutBacklogSize = true;
-                }
-            }
-
-            else if (hasWarnedAboutBacklogSize && queue.Count <= QueueSizeWarningThreshold / 2)
-            {
-                hasWarnedAboutBacklogSize = false;
-            }
         }

         private void BuildFaultHandlingPolicy()


SliceSettingsUI WIP: UserSettingOverlay only appears once the Enter Key is pressed. Also revert button kind of works.

--- SlicerConfiguration/SliceSettingsWidget.cs
+++ SlicerConfiguration/SliceSettingsWidget.cs
@@ -864,9 +864,11 @@
 								doubleEditWidget.ActuallNumberEdit.Value = currentValue;
 							}
 							doubleEditWidget.ActuallNumberEdit.InternalTextEditWidget.MarkAsStartingState();
-
-							doubleEditWidget.ActuallNumberEdit.EditComplete += (sender, e) =>
-							{
+
+							doubleEditWidget.ActuallNumberEdit.EnterPressed += (sender, e) =>
+							{
+								// Find the sibling TextWidget that represents the materialPresetLabel and hide it
+								var presetLabel = container.Children<TextWidget>().FirstOrDefault();
 								NumberEdit numberEdit = (NumberEdit)sender;
 								// If this setting sets other settings, then do that.
 								if (ChangesMultipleOtherSettings
@@ -878,21 +880,28 @@
 									}
 								}

-								if(ActiveSliceSettings.Instance.SettingExistsInLayer(settingData.SlicerConfigName, 3))
+								revertButton = textImageButtonFactory.Generate("Revert".ToUpper());
+								revertButton.HAnchor = HAnchor.ParentRight;
+								revertButton.VAnchor = VAnchor.ParentCenter;
+								revertButton.Margin = new BorderDouble(0, 0, 10, 0);
+								revertButton.Click += (x, y) =>
+								{
+									if(addMaterialOverlay)
+									{
+										container.BackgroundColor = materialOverlayColor;
+										revertVisible = false;
+										presetLabel.Visible = true;
+									}
+								};
+
+								if (ActiveSliceSettings.Instance.SettingExistsInLayer(settingData.SlicerConfigName, 3) || ActiveSliceSettings.Instance.SettingExistsInLayer(settingData.SlicerConfigName, 2))
 								{
 									revertVisible = true;
 									container.BackgroundColor = userSettingOverlayColor;
-									revertButton = textImageButtonFactory.Generate("Revert".ToUpper());
-									revertButton.HAnchor = HAnchor.ParentRight;
-									revertButton.VAnchor = VAnchor.ParentCenter;
-
 									materialPresetLabel.Visible = false;
-									materialPresetLabel.DebugShowBounds = true;
-
 									container.AddChild(revertButton);

-									// Find the sibling TextWidget that represents the materialPresetLabel and hide it
-									var presetLabel = container.Children<TextWidget>().FirstOrDefault();
+
 									if(presetLabel != null)
 									{
 										presetLabel.Visible = false;
@@ -1301,9 +1310,9 @@
 					qualityPresetLabel.Margin = new BorderDouble(10, 0, 0, 0);
 					qualityPresetLabel.PointSize = 8;
 					container.AddChild(qualityPresetLabel);
-
-
 					container.BackgroundColor = qualityOverlayColor;
+					//materialPresetLabel.Visible = !revertVisible;
+
 					overlay.OverlayColor = qualityOverlayColor;
 					clickToEdit.OverlayColor = qualityOverlayColor;
 					editButton.Click += (sender, e) =>
@@ -1368,8 +1377,6 @@
 					});
 				};

-				//container.AddChild(overlay);
-				//container.AddChild(clickToEdit);
 			}

 			return container;


Improved the Command Terminal display

Improved the Command Terminal display

--- Solitude/Assets/Scripts/CommandTerminal.cs
+++ Solitude/Assets/Scripts/CommandTerminal.cs
@@ -11,6 +11,7 @@

     List<string> console = new List<string>();
     public List<string> commands = new List<string>();
+    int LINES = 6;

     public override void interact() {
@@ -27,7 +28,7 @@
         t.text = "";

         //used to define a set of empty lines;
-        console = new List<string>(new string[20]);
+

         commands.Add("cd /navigation");
         commands.Add("service stop navigation");
@@ -39,13 +40,15 @@
         {
             addline(command);
         }
-
+        for (int i = commands.Count; i < LINES; i++) {
+            addline("");
+        }
     }

     //used to add a line to the console;
     private void addline(string line) {
         console.Add(line);
-        if (console.Count > 20) {
+        while (console.Count > LINES) {
             console.RemoveAt(0);
         }
     }


Added documentation, but still missing

Added documentation, but still missing

git-svn-id: bab0c2de90ee11a20376049c2cdee62584491f34@1105 73e77b4c-caa6-f847-a29a-24ab75ae54b6

--- MonoRail/Castle.MonoRail.TestSupport/AbstractMRTestCase.cs
+++ MonoRail/Castle.MonoRail.TestSupport/AbstractMRTestCase.cs
@@ -23,7 +23,10 @@

 	using NUnit.Framework;

-
+	/// <summary>
+	/// Base class for tests cases using the ASP.Net Runtime
+	/// to run the web project
+	/// </summary>
 	public abstract class AbstractMRTestCase
 	{
 		private static readonly String PhysicalWebDirConfigKey = "web.physical.dir";
@@ -70,6 +73,11 @@

 		#region Actions

+		/// <summary>
+		/// Performs a GET operation on
+		/// </summary>
+		/// <param name="path">The resource being request, for example <c>home/index.rails</c></param>
+		/// <param name="queryStringParams">A list of key/value pair, for example <c>name=johndoe</c></param>
 		public void DoGet(String path, params String[] queryStringParams)
 		{
 			if (queryStringParams.Length != 0) Request.QueryStringParams = queryStringParams;
@@ -81,8 +89,6 @@
 			StringWriter writer = new StringWriter(outputBuffer);

 			response = host.Process( Request, writer );
-
-			// Console.WriteLine( "Contents " + writer.GetStringBuilder().ToString() );
 		}

 		#endregion
@@ -103,17 +109,29 @@

 		#region Available Asserts

+		/// <summary>
+		/// Asserts the return status code is less than 400
+		/// </summary>
 		protected void AssertSuccess()
 		{
 			Assert.IsNotNull(response, "No requests performed with DoGet or DoPost (?)");
 			Assert.IsTrue(response.StatusCode < 400, "Status code different than > 400");
 		}

+		/// <summary>
+		/// Asserts that reply has exactly the samme
+		/// content of <c>expectedContents</c>
+		/// </summary>
+		/// <param name="expectedContents"></param>
 		protected void AssertReplyEqualsTo(String expectedContents)
 		{
 			Assert.AreEqual( expectedContents, outputBuffer.ToString() );
 		}

+		/// <summary>
+		/// Asserts that reply starts with
+		/// <c>expectedContents</c>
+		/// </summary>
 		protected void AssertReplyStartsWith(String contents)
 		{
 			String buffer = outputBuffer.ToString();
@@ -123,6 +141,10 @@
 					buffer.Substring(0, Math.Min(contents.Length, buffer.Length) ) );
 		}

+		/// <summary>
+		/// Asserts that reply ends with
+		/// <c>expectedContents</c>
+		/// </summary>
 		protected void AssertReplyEndsWith(String contents)
 		{
 			String buffer = outputBuffer.ToString();
@@ -132,18 +154,30 @@
 					buffer.Substring(0, Math.Min(contents.Length, buffer.Length) ) );
 		}

+		/// <summary>
+		/// Asserts that reply contains the specified
+		/// <c>expectedContents</c>
+		/// </summary>
 		protected void AssertReplyContains(String contents)
 		{
 			Assert.IsTrue( outputBuffer.ToString().IndexOf(contents) != -1,
 				"AssertReplyContains did not find the content '{0}'", contents );
 		}

+		/// <summary>
+		/// Asserts that reply does not contain
+		/// <c>expectedContents</c>
+		/// </summary>
 		protected void AssertReplyDoNotContain(String contents)
 		{
 			Assert.IsTrue( outputBuffer.ToString().IndexOf(contents) == -1,
 				"AssertReplyDoNotContain found the content '{0}'", contents );
 		}

+		/// <summary>
+		/// Asserts that the response was a redirect to the specified
+		/// <c>url</c>
+		/// </summary>
 		protected void AssertRedirectedTo(String url)
 		{
 			Assert.AreEqual(302, Response.StatusCode, "Redirect status not used");


fix FramesPerSecond component crash when no time passed at all

--- Nez.Portable/ECS/Components/Text/FramesPerSecondCounter.cs
+++ Nez.Portable/ECS/Components/Text/FramesPerSecondCounter.cs
@@ -121,6 +121,8 @@

 		public virtual void Update()
 		{
+			if (Time.UnscaledDeltaTime == 0.0f)
+				return;
 			CurrentFramesPerSecond = 1.0f / Time.UnscaledDeltaTime;
 			_sampleBuffer.Enqueue(CurrentFramesPerSecond);


Adds test for Previous

Adds test for Previous

--- src/NodaTime.Demo/DateAdjustersDemo.cs
+++ src/NodaTime.Demo/DateAdjustersDemo.cs
@@ -66,5 +66,16 @@

             Assert.AreEqual(end, adjuster(start));
         }
+
+        [Test]
+        public void Previous()
+        {
+            var start = new LocalDate(2014, 6, 27);
+            var end = new LocalDate(2014, 6, 26);
+
+            var adjuster = Snippet.For(DateAdjusters.Previous(IsoDayOfWeek.Thursday));
+
+            Assert.AreEqual(end, adjuster(start));
+        }
     }
 }


small bugfix for the Autocorrelate function

--- src/Numerics/Statistics/Correlation.cs
+++ src/Numerics/Statistics/Correlation.cs
@@ -129,14 +129,14 @@
             {
                 for (int ii = 0; ii < nFFT; ii++)
                 {
-                    if (!iex.MoveNext())
+
+                    if (ii < N)
                     {
-                        throw new ArgumentOutOfRangeException("x");
+                        if (!iex.MoveNext())
+                            throw new ArgumentOutOfRangeException("x");
+                        xArrNow = iex.Current;
+                        x_fft[ii] = new Complex(xArrNow - x_dash, 0.0);    // copy values in range and substract mean
                     }
-                    xArrNow = iex.Current;
-
-                    if (ii < N)
-                        x_fft[ii] = new Complex(xArrNow - x_dash, 0.0);    // copy values in range and substract mean
                     else
                         x_fft[ii] = new Complex(0.0, 0.0);      // pad all remaining points
                 }


CR comments

CR comments

--- src/Package/TestApp/InteractiveTest.cs
+++ src/Package/TestApp/InteractiveTest.cs
@@ -4,7 +4,7 @@

 namespace Microsoft.VisualStudio.R.Interactive.Test {
     public class InteractiveTest {
-        protected void DoIdle(int ms) {
+        public static void DoIdle(int ms) {
             UIThreadHelper.Instance.Invoke(() => {
                 int time = 0;
                 while (time < ms) {


(GH-199) Fixed incorrect argument being passed to octokit (#200)

(GH-199) Fixed incorrect argument being passed to octokit

--- Source/GitReleaseManager/GitHubProvider.cs
+++ Source/GitReleaseManager/GitHubProvider.cs
@@ -303,7 +303,7 @@

             if (_configuration.Close.IssueComments)
             {
-                await AddIssueCommentsAsync(owner, repository, milestoneTitle).ConfigureAwait(false);
+                await AddIssueCommentsAsync(owner, repository, milestone).ConfigureAwait(false);
             }
         }

@@ -411,11 +411,11 @@
             }
         }

-        private async Task AddIssueCommentsAsync(string owner, string repository, string milestone)
+        private async Task AddIssueCommentsAsync(string owner, string repository, Octokit.Milestone milestone)
         {
             const string detectionComment = "<!-- GitReleaseManager release comment -->";
-            var issueComment = detectionComment + "\n" + _configuration.Close.IssueCommentFormat.ReplaceTemplate(new { owner, repository, Milestone = milestone });
-            var issues = await GetIssuesFromMilestoneAsync(owner, repository, milestone).ConfigureAwait(false);
+            var issueComment = detectionComment + "\n" + _configuration.Close.IssueCommentFormat.ReplaceTemplate(new { owner, repository, Milestone = milestone.Title });
+            var issues = await GetIssuesFromMilestoneAsync(owner, repository, milestone.Number).ConfigureAwait(false);

             foreach (var issue in issues)
             {
@@ -472,12 +472,12 @@
             return _mapper.Map<Octokit.Release, Release>(release);
         }

-        private Task<IReadOnlyList<Octokit.Issue>> GetIssuesFromMilestoneAsync(string owner, string repository, string milestone, ItemStateFilter state = ItemStateFilter.Closed)
-        {
-            _logger.Verbose("Finding issues with milestone: '{Milestone}", milestone);
+        private Task<IReadOnlyList<Octokit.Issue>> GetIssuesFromMilestoneAsync(string owner, string repository, int milestoneNumber, ItemStateFilter state = ItemStateFilter.Closed)
+        {
+            _logger.Verbose("Finding issues with milestone: '{Milestone}", milestoneNumber);
             return _gitHubClient.Issue.GetAllForRepository(owner, repository, new RepositoryIssueRequest
             {
-                Milestone = milestone,
+                Milestone = milestoneNumber.ToString(),
                 State = state,
             });
         }


Async tweak

Async tweak


Ensure that maximize windo do not cover taskbar


Explicitly set the indent string

Explicitly set the indent string

--- src/PublicApiGenerator/ApiGenerator.cs
+++ src/PublicApiGenerator/ApiGenerator.cs
@@ -50,7 +50,8 @@
             {
                 BracingStyle = "C",
                 BlankLinesBetweenMembers = false,
-                VerbatimOrder = false
+                VerbatimOrder = false,
+                IndentString = "    "
             };

             using (var provider = new CSharpCodeProvider())


Don't force the theme to refresh when changing the settings

--- Mazui/Services/SettingsServices.cs
+++ Mazui/Services/SettingsServices.cs
@@ -159,9 +159,6 @@
             set
             {
                 _helper.Write(nameof(AppTheme), value.ToString());
-                (Window.Current.Content as FrameworkElement).RequestedTheme = value.ToElementTheme();
-                Views.Shell.HamburgerMenu.RefreshStyles(value, true);
-                if (ChangedAppThemeHandler != null) ChangedAppThemeHandler.Invoke();
             }
         }


fix broadcast sample program

fix broadcast sample program


Hash algorithm now replaceable

Hash algorithm now replaceable

--- projects/CaseTracker/AutoUpdater.cs
+++ projects/CaseTracker/AutoUpdater.cs
@@ -89,19 +89,22 @@
         private void VerifyMd5(string filename, string expectedHash)
         {
             Utils.Log.InfoFormat("Verifying downloaded setup MD5 {0}, {1}", filename, expectedHash);
-            MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider();
-
-            StringBuilder sb = new StringBuilder();
-            byte[] actualHash = md5.ComputeHash(new FileStream(filename, FileMode.Open, FileAccess.Read));
-            foreach (Byte b in actualHash)
-                sb.Append(String.Format("{0,2:X}", b));
-            string actualHashStr = sb.ToString();
+            string actualHashStr = ComputeFileHash(filename, new MD5CryptoServiceProvider());
             if (actualHashStr != expectedHash)
             {
                 Utils.Log.WarnFormat("Actual MD5 was: ", actualHashStr);
                 File.Delete(filename);
                 throw new Exception(String.Format("Bad hash of downloaded version.\nExpected: {0}\n  Actual: {1}", expectedHash, actualHashStr));
             }
+        }
+
+        private string ComputeFileHash(string filename, HashAlgorithm alg)
+        {
+            StringBuilder sb = new StringBuilder();
+            byte[] actualHash = alg.ComputeHash(new FileStream(filename, FileMode.Open, FileAccess.Read));
+            foreach (Byte b in actualHash)
+                sb.Append(String.Format("{0,2:X}", b));
+            return sb.ToString();
         }

         private string DownloadLatestVersion()


GPIOテストモード追加

GPIOテストモード追加


Fix absence of extension in snippet URL when no language type was specified on the code block

--- Modix/Utilities/FormatUtilities.cs
+++ Modix/Utilities/FormatUtilities.cs
@@ -33,7 +33,15 @@
         public static string GetCodeLanguage(string message)
         {
             var match = _buildContentRegex.Match(message);
-            return match.Success ? match.Groups[1].Value : null;
+            if (match.Success)
+            {
+                string codeLanguage = match.Groups[1].Value;
+                return string.IsNullOrEmpty(codeLanguage) ? null : codeLanguage;
+            }
+            else
+            {
+                return null;
+            }
         }

         /// <summary>


Assembly description

Assembly description


AnimationFrameItem now fills with Gradient brushes

--- Project-Aurora/Controls/Control_AnimationFrameItem.xaml.cs
+++ Project-Aurora/Controls/Control_AnimationFrameItem.xaml.cs
@@ -51,9 +51,23 @@

                 if(value != null)
                 {
-                    rectDisplay.Fill = new LinearGradientBrush(Utils.ColorUtils.DrawingColorToMediaColor(value.Color), Color.FromArgb(0, 0, 0, 0), new Point(0.5, 0), new Point(0.5, 1));
-                    grdSplitterLeft.Background = new SolidColorBrush(Utils.ColorUtils.DrawingColorToMediaColor(value.Color));
-                    grdSplitterRight.Background = new SolidColorBrush(Utils.ColorUtils.DrawingColorToMediaColor(value.Color));
+                    Brush bgBrush = new LinearGradientBrush(Utils.ColorUtils.DrawingColorToMediaColor(value.Color), Color.FromArgb(0, 0, 0, 0), new Point(0.5, 0), new Point(0.5, 1));
+                    Brush splitterBrush = new SolidColorBrush(Utils.ColorUtils.DrawingColorToMediaColor(value.Color));
+
+                    if (value is AnimationGradientCircle)
+                    {
+                        bgBrush = (value as AnimationGradientCircle).GradientBrush.GetMediaBrush();
+                        splitterBrush = (value as AnimationGradientCircle).GradientBrush.GetMediaBrush();
+                    }
+                    else if (value is AnimationFilledGradientRectangle)
+                    {
+                        bgBrush = (value as AnimationFilledGradientRectangle).GradientBrush.GetMediaBrush();
+                        splitterBrush = (value as AnimationFilledGradientRectangle).GradientBrush.GetMediaBrush();
+                    }
+
+                    rectDisplay.Fill = bgBrush;
+                    grdSplitterLeft.Background = splitterBrush;
+                    grdSplitterRight.Background = splitterBrush;
                 }

                 AnimationFrameItemUpdated?.Invoke(this, value);


Some formatting on datagrids

Some formatting on datagrids

--- Pulsar4X/Pulsar4X.WinForms/Controls/SystemGenAndDisplay.cs
+++ Pulsar4X/Pulsar4X.WinForms/Controls/SystemGenAndDisplay.cs
@@ -51,12 +51,14 @@
             {
                 col.DataPropertyName = "Mass";
                 col.HeaderText = "Mass";
+                col.DefaultCellStyle.Format = "N4";
                 StarsDataGridView.Columns.Add(col);
             }
             using (DataGridViewTextBoxColumn col = new DataGridViewTextBoxColumn())
             {
                 col.DataPropertyName = "Luminosity";
                 col.HeaderText = "Luminosity";
+                col.DefaultCellStyle.Format = "N4";
                 StarsDataGridView.Columns.Add(col);
             }
             StarsDataGridView.DataSource = VM.StarsSource;
@@ -84,18 +86,21 @@
             {
                 col.DataPropertyName = "MassInEarthMasses";
                 col.HeaderText = "Mass";
+                col.DefaultCellStyle.Format = "N4";
                 PlanetsDataGridView.Columns.Add(col);
             }
             using (DataGridViewTextBoxColumn col = new DataGridViewTextBoxColumn())
             {
                 col.DataPropertyName = "MassOfGasInEarthMasses";
                 col.HeaderText = "GasMass";
+                col.DefaultCellStyle.Format = "N4";
                 PlanetsDataGridView.Columns.Add(col);
             }
             using (DataGridViewTextBoxColumn col = new DataGridViewTextBoxColumn())
             {
                 col.DataPropertyName = "SurfaceGravity";
                 col.HeaderText = "Gravity";
+                col.DefaultCellStyle.Format = "N4";
                 PlanetsDataGridView.Columns.Add(col);
             }
             PlanetsDataGridView.DataSource = VM.PlanetSource;


Update TorrentClientFactory.cs

Update TorrentClientFactory.cs

--- Source/RatioMaster/TorrentClientFactory.cs
+++ Source/RatioMaster/TorrentClientFactory.cs
@@ -474,7 +474,7 @@
                         client.Key = GenerateIdString("hex", 8, false, true);
                         client.Headers = "User-Agent: Transmission/2.82\r\nHost: {host}\r\nAccept: */*\r\nAccept-Encoding: gzip;q=1.0, deflate, identity\r\n";
                         client.PeerID = "-TR2500-" + GenerateIdString("alphanumeric", 12, false, false);
-                        client.Query = "info_hash={infohash}&peer_id={peerid}&port={port}&uploaded={uploaded}&downloaded={downloaded}&left={left}&numwant={numwant}&key={key}&compact=1&supportcrypto=1{event}";
+                        client.Query = "info_hash={infohash}&peer_id={peerid}&port={port}&uploaded={uploaded}&downloaded={downloaded}&left={left}&numwant={numwant}&key={key}&compact=1&supportcrypto=1{event}";
                         client.DefNumWant = 80;
                         // client.Parse = true;
                         client.SearchString = "&peer_id=-TR2500-";
@@ -491,7 +491,7 @@
                         client.Key = GenerateIdString("hex", 8, false, true);
                         client.Headers = "User-Agent: Transmission/2.92\r\nHost: {host}\r\nAccept: */*\r\nAccept-Encoding: gzip;q=1.0, deflate, identity\r\n";
                         client.PeerID = "-TR2920-" + GenerateIdString("alphanumeric", 12, false, false);
-                        client.Query = "info_hash={infohash}&peer_id={peerid}&port={port}&uploaded={uploaded}&downloaded={downloaded}&left={left}&numwant={numwant}&key={key}&compact=1&supportcrypto=1{event}";
+                        client.Query = "info_hash={infohash}&peer_id={peerid}&port={port}&uploaded={uploaded}&downloaded={downloaded}&left={left}&numwant={numwant}&key={key}&compact=1&supportcrypto=1{event}";
                         client.DefNumWant = 80;
                         // client.Parse = true;
                         client.SearchString = "&peer_id=-TR2920-";


Comment FiberResult

Comment FiberResult

--- Source/SpicyPixel.Threading/FiberResult.cs
+++ Source/SpicyPixel.Threading/FiberResult.cs
@@ -2,14 +2,25 @@

 namespace SpicyPixel.Threading
 {
+    /// <summary>
+    /// An instruction to stop fiber execution and set a result on the fiber.
+    /// </summary>
     public sealed class FiberResult : FiberInstruction
     {
         object result;

+        /// <summary>
+        /// Gets the result of the fiber execution.
+        /// </summary>
+        /// <value>The result of the fiber execution.</value>
         public object Result {
             get { return result; }
         }

+        /// <summary>
+        /// Initializes a new instance of the <see cref="SpicyPixel.Threading.FiberResult"/> class.
+        /// </summary>
+        /// <param name="result">Result of the fiber execution.</param>
         public FiberResult(object result)
         {
             this.result = result;


Wrapped prime test tasks with WhenAll

Wrapped prime test tasks with WhenAll

--- RSASignature/KeyGeneration/Generation/RSAKeysGeneration.cs
+++ RSASignature/KeyGeneration/Generation/RSAKeysGeneration.cs
@@ -29,10 +29,12 @@

         private async Task Initialize(BigInteger p, BigInteger q, BigInteger exp)
         {
-            var pIsProbablyPrime = await Task.Factory.StartNew(() => p.IsProbablyPrime());
-            var qIsProbablyPrime = await Task.Factory.StartNew(() => q.IsProbablyPrime());

-            if (!pIsProbablyPrime || !qIsProbablyPrime)
+            var isPrime = await Task.WhenAll(Task.Run(() => p.IsProbablyPrime()),
+                                             Task.Run(() => q.IsProbablyPrime())
+                                            );
+
+            if (!isPrime[0] || !isPrime[1])
             {
                 throw new ArithmeticException("Число p или q не является простым.");
             }


everything just w o r k s

everything just w o r k s

--- RelhaxModpack/RelhaxModpack/Windows/ModpackToolbox.xaml.cs
+++ RelhaxModpack/RelhaxModpack/Windows/ModpackToolbox.xaml.cs
@@ -379,13 +379,11 @@
                     butt.IsEnabled = toggle;
             }
             SetProgress(JobProgressBar.Minimum);
-            UiUtils.AllowUIToUpdate();
         }

         private void SetProgress(double prog)
         {
             JobProgressBar.Value = prog;
-            UiUtils.AllowUIToUpdate();
         }

         private async Task<bool> LoadDatabase1V1FromBigmods(string lastWoTClientVersion, List<DatabasePackage> globalDependencies, List<Dependency> dependencies, List<Category> parsedCategoryList)
@@ -730,12 +728,10 @@

             //could be multiple branches on github database
             ReportProgress("Getting list of branches");
-            UiUtils.AllowUIToUpdate();

             List<string> branches = await CommonUtils.GetListOfGithubRepoBranchesAsync(ApplicationConstants.BetaDatabaseBranchesURL);

             ReportProgress(string.Join(",", branches));
-            UiUtils.AllowUIToUpdate();

             foreach (string branch in branches)
             {
@@ -745,7 +741,6 @@
             foreach(VersionInfos infos in specificVersions)
             {
                 ReportProgress("Adding zip files from WoTClientVersion " + infos.WoTClientVersion);
-                UiUtils.AllowUIToUpdate();

                 XmlDocument doc = new XmlDocument();
                 List<DatabasePackage> flatList = new List<DatabasePackage>();
@@ -779,18 +774,15 @@
                     string betaDatabaseOnlineFolderVersion = XmlUtils.GetXmlStringFromXPath(doc, ApplicationConstants.DatabaseOnlineFolderXpath);

                     ReportProgress(string.Format("GITHUB branch = {0}, online folder={1}, selected online folder to clean version={2}", branchName, betaDatabaseOnlineFolderVersion, selectedVersionInfos.WoTOnlineFolderVersion));
-                    UiUtils.AllowUIToUpdate();

                     if (!betaDatabaseOnlineFolderVersion.Equals(selectedVersionInfos.WoTOnlineFolderVersion))
                     {
                         ReportProgress("Skipping (online folders are not equal)");
-                        UiUtils.AllowUIToUpdate();
                         continue;
                     }
                     else
                     {
                         ReportProgress("Including (online folders are equal)");
-                        UiUtils.AllowUIToUpdate();

                         //parse beta database to lists
                         List<string> downloadURLs = new List<string>()
@@ -824,7 +816,6 @@
                 {
                     string modInfoxmlURL = ApplicationConstants.BigmodsDatabaseRootEscaped.Replace(@"{dbVersion}", infos.WoTClientVersion) + "modInfo.dat";
                     ReportProgress("Downloading database " + modInfoxmlURL);
-                    UiUtils.AllowUIToUpdate();

                     //download latest modInfo xml
                     byte[] zip;
@@ -1208,7 +1199,6 @@

             //update the crc values, also makes list of updated mods
             ReportProgress("Downloaded, comparing crc values for list of updated mods");
-            UiUtils.AllowUIToUpdate();
             foreach (DatabasePackage package in flatListCurrent)
             {
                 if (string.IsNullOrEmpty(package.ZipFile))
@@ -1250,7 +1240,6 @@
             //do list magic to get all added, removed, disabled, etc package lists
             //used for disabled, removed, added mods
             ReportProgress("Getting list of added and removed packages");
-            UiUtils.AllowUIToUpdate();
             PackageComparerByUID pc = new PackageComparerByUID();

             //if in before but not after = removed
@@ -1260,7 +1249,6 @@
             addedPackages = flatListCurrent.Except(flatListOld, pc).ToList();

             ReportProgress("Getting list of packages old and new minus removed and added");
-            UiUtils.AllowUIToUpdate();

             //first start by getting the list of all current packages, then filter out removed and added packages
             //make a copy of the current flat list
@@ -1281,7 +1269,6 @@
             //get the list of renamed packages
             //a renamed package will have the same internal name, but a different display name
             ReportProgress("Getting list of renamed packages");
-            UiUtils.AllowUIToUpdate();
             foreach (SelectablePackage selectablePackage in selectablePackagesNotRemovedOrAdded)
             {
                 SelectablePackage oldPackageWithMatchingUID = selectablePackagesOld.Find(pack => pack.UID.Equals(selectablePackage.UID));
@@ -1298,7 +1285,6 @@
             //list of moved packages
             //a moved package will have a different UIDPath (the UID's don't change, so any change detected would imply a structure level change)
             ReportProgress("Getting list of moved packages");
-            UiUtils.AllowUIToUpdate();
             foreach (SelectablePackage selectablePackage in selectablePackagesNotRemovedOrAdded)
             {
                 SelectablePackage oldPackageWithMatchingUID = selectablePackagesOld.Find(pack => pack.UID.Equals(selectablePackage.UID));
@@ -1316,7 +1302,6 @@

             //if a package was internally renamed, the packageName won't match
             ReportProgress("Getting list of internal renamed packages");
-            UiUtils.AllowUIToUpdate();
             foreach (SelectablePackage selectablePackage in selectablePackagesNotRemovedOrAdded)
             {
                 SelectablePackage oldPackageWithMatchingUID = selectablePackagesOld.Find(pack => pack.UID.Equals(selectablePackage.UID));
@@ -1665,7 +1650,6 @@
                 if(node == null)
                 {
                     ReportProgress(string.Format("Package '{0}' does not exist, adding to install stats",package.PackageName));
-                    UiUtils.AllowUIToUpdate();
                     XmlElement element = installStats.CreateElement("package");
                     XmlAttribute nameAttribute = installStats.CreateAttribute("name");
                     nameAttribute.Value = package.PackageName;
@@ -2256,6 +2240,10 @@
                                 CleanMediasCancel.Visibility = Visibility.Hidden;
                                 CleanMediasCancel.IsEnabled = false;
                                 ToggleUI((TabController.SelectedItem as TabItem), true);
+                                JobProgressBar.Minimum = 0;
+                                JobProgressBar.Value = JobProgressBar.Minimum;
+                                JobProgressBar.Maximum = 100;
+                                return;
                             }

                             ReportProgress("Download FAIL");


Apply action too far

Apply action too far

--- Src/WangTiles.Tests/MultiTilePlaneTests.cs
+++ Src/WangTiles.Tests/MultiTilePlaneTests.cs
@@ -133,6 +133,17 @@
         }

         [TestMethod]
+        public void ApplyActionTooFar()
+        {
+            var plane = new MultiTilePlane();
+
+            Assert.IsNull(plane.Apply(new MultiTileAction(4, Direction.West, -100, 0)));
+            Assert.IsNull(plane.Apply(new MultiTileAction(4, Direction.West, 100, 0)));
+            Assert.IsNull(plane.Apply(new MultiTileAction(4, Direction.West, 0, -100)));
+            Assert.IsNull(plane.Apply(new MultiTileAction(4, Direction.West, 0, 100)));
+        }
+
+        [TestMethod]
         public void ApplyActionToSouth()
         {
             Tile tile1 = new Tile(0, 1, 2, 3);


Make FeeParser throw if the fee parsed is not low, medium or high (previously defaulted to medium0

--- Stratis.Bitcoin/Features/Wallet/FeeType.cs
+++ Stratis.Bitcoin/Features/Wallet/FeeType.cs
@@ -3,7 +3,7 @@
 namespace Stratis.Bitcoin.Features.Wallet
 {
     /// <summary>
-    /// An indicator on how fast a transaction will be accepted in a block
+    /// An indicator of how fast a transaction will be accepted in a block.
     /// </summary>
     public enum FeeType
     {
@@ -27,10 +27,13 @@
     {
         public static FeeType Parse(string value)
         {
-            if (Enum.TryParse<FeeType>(value, true, out var ret))
-                return ret;
+            bool isParsed = Enum.TryParse<FeeType>(value, true, out var result);
+            if (!isParsed)
+            {
+                throw new FormatException($"FeeType {value} is not a valid FeeType");
+            }

-            return FeeType.Medium;
+            return result;
         }

         /// <summary>


version

version

--- NServiceBus.Mailer/AssemblyInfo.cs
+++ NServiceBus.Mailer/AssemblyInfo.cs
@@ -2,5 +2,5 @@

 [assembly: AssemblyTitle("NServiceBus.Mailer")]
 [assembly: AssemblyProduct("NServiceBus.Mailer")]
-[assembly: AssemblyVersion("0.2.3.0")]
-[assembly: AssemblyFileVersion("0.2.3.0")]
+[assembly: AssemblyVersion("0.2.4.0")]
+[assembly: AssemblyFileVersion("0.2.4.0")]


Small change in PMO parser.

Small change in PMO parser.

--- OpenKh.Engine/Parsers/PmoParser.cs
+++ OpenKh.Engine/Parsers/PmoParser.cs
@@ -76,30 +76,31 @@
                     mtx.M42 = boneData.Transform[13];
                     mtx.M43 = boneData.Transform[14];
                     mtx.M44 = boneData.Transform[15];
-                    mtx = Matrix4x4.Transpose(mtx);
-                    matrices.Add(mtx);

                     Vector3 loc;
                     Quaternion quat;
                     Vector3 scl;
+
+                    Matrix4x4.Decompose(mtx, out scl, out quat, out loc);

-                    Matrix4x4.Decompose(mtx, out scl, out quat, out loc);
+                    //mtx = Matrix4x4.Transpose(mtx);
+                    matrices.Add(mtx);

                     Mdlx.Bone otherBone = new Mdlx.Bone();
                     otherBone.Index = boneData.BoneIndex;
                     otherBone.Parent = (boneData.ParentBoneIndex == 0xFFFF) ? 0 : boneData.ParentBoneIndex;
-                    otherBone.TranslationX = loc.X;
-                    otherBone.TranslationY = loc.Y;
-                    otherBone.TranslationZ = loc.Z;
-                    otherBone.TranslationW = 0;
-                    otherBone.RotationX = quat.X;
-                    otherBone.RotationY = quat.Y;
-                    otherBone.RotationZ = quat.Z;
-                    otherBone.RotationW = quat.W;
-                    otherBone.ScaleX = scl.X;
-                    otherBone.ScaleY = scl.Y;
-                    otherBone.ScaleZ = scl.Z;
-                    otherBone.ScaleW = 1.0f;
+                    otherBone.TranslationX = mtx.M11;
+                    otherBone.TranslationY = mtx.M12;
+                    otherBone.TranslationZ = mtx.M13;
+                    otherBone.TranslationW = mtx.M14;
+                    otherBone.RotationX = mtx.M21;
+                    otherBone.RotationY = mtx.M22;
+                    otherBone.RotationZ = mtx.M23;
+                    otherBone.RotationW = mtx.M24;
+                    otherBone.ScaleX = mtx.M31;
+                    otherBone.ScaleY = mtx.M32;
+                    otherBone.ScaleZ = mtx.M33;
+                    otherBone.ScaleW = mtx.M34;

                     skeleton.Add(otherBone);
                 }


Committing Avination's memleak fix-a-thon, installment #2 Ensure items coming off the lockless queue are released. Also ensure this is done when the queue is cleared.

--- OpenSim/Framework/LocklessQueue.cs
+++ OpenSim/Framework/LocklessQueue.cs
@@ -99,8 +99,13 @@
                     }
                     else
                     {
-                        item = oldHeadNext.Item;
+                        item = oldHeadNext.Item;
                         haveAdvancedHead = CAS(ref head, oldHead, oldHeadNext);
+                        if (haveAdvancedHead)
+                        {
+                            oldHeadNext.Item = default(T);
+                            oldHead.Next = null;
+                        }
                     }
                 }
             }
@@ -111,6 +116,10 @@

         public void Clear()
         {
+            // ugly
+            T item;
+            while(count > 0)
+                Dequeue(out item);
             Init();
         }