Add linear/srgb colour tests (#2391)

Add linear/srgb colour tests (#2391)

Add linear/srgb colour tests

--- osu.Framework.Tests/Visual/Drawables/TestCaseColourGradient.cs
+++ osu.Framework.Tests/Visual/Drawables/TestCaseColourGradient.cs
@@ -1,6 +1,7 @@
 // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
 // See the LICENCE file in the repository root for full licence text.

+using osu.Framework.Extensions.Color4Extensions;
 using osu.Framework.Graphics;
 using osu.Framework.Graphics.Colour;
 using osu.Framework.Graphics.Shapes;
@@ -14,7 +15,7 @@
     public class TestCaseColourGradient : GridTestCase
     {
         public TestCaseColourGradient()
-            : base(2, 2)
+            : base(4, 2)
         {
             Color4 transparentBlack = new Color4(0, 0, 0, 0);

@@ -22,10 +23,24 @@
             {
                 new ColourInfo
                 {
-                    TopLeft = Color4.White,
-                    BottomLeft = Color4.Blue,
-                    TopRight = Color4.Red,
-                    BottomRight = Color4.Green,
+                    TopLeft = Color4.Pink.ToLinear(),
+                    BottomLeft = Color4.Pink.ToLinear(),
+                    TopRight = Color4.SkyBlue.ToLinear(),
+                    BottomRight = Color4.SkyBlue.ToLinear(),
+                },
+                new ColourInfo
+                {
+                    TopLeft = Color4.Pink,
+                    BottomLeft = Color4.Pink,
+                    TopRight = Color4.SkyBlue,
+                    BottomRight = Color4.SkyBlue,
+                },
+                new ColourInfo
+                {
+                    TopLeft = Color4.White.ToLinear(),
+                    BottomLeft = Color4.White.ToLinear(),
+                    TopRight = Color4.Black.ToLinear(),
+                    BottomRight = Color4.Black.ToLinear(),
                 },
                 new ColourInfo
                 {
@@ -36,10 +51,24 @@
                 },
                 new ColourInfo
                 {
+                    TopLeft = Color4.White.ToLinear(),
+                    BottomLeft = Color4.White.ToLinear(),
+                    TopRight = Color4.Transparent.ToLinear(),
+                    BottomRight = Color4.Transparent.ToLinear(),
+                },
+                new ColourInfo
+                {
                     TopLeft = Color4.White,
                     BottomLeft = Color4.White,
                     TopRight = Color4.Transparent,
                     BottomRight = Color4.Transparent,
+                },
+                new ColourInfo
+                {
+                    TopLeft = Color4.White.ToLinear(),
+                    BottomLeft = Color4.White.ToLinear(),
+                    TopRight = transparentBlack.ToLinear(),
+                    BottomRight = transparentBlack.ToLinear(),
                 },
                 new ColourInfo
                 {
@@ -52,10 +81,14 @@

             string[] labels =
             {
-                "Colours",
-                "White to black (linear brightness gradient)",
+                "Colours (Linear)",
+                "Colours (sRGB)",
+                "White to black (Linear brightness gradient)",
+                "White to black (sRGB brightness gradient)",
+                "White to transparent white (Linear brightness gradient)",
                 "White to transparent white (sRGB brightness gradient)",
-                "White to transparent black (mixed brightness gradient)",
+                "White to transparent black (Linear brightness gradient)",
+                "White to transparent black (sRGB brightness gradient)",
             };

             for (int i = 0; i < Rows * Cols; ++i)
@@ -66,9 +99,8 @@
                     {
                         Text = labels[i],
                         Font = new FontUsage(size: 20),
-                        Colour = colours[0],
                     },
-                    boxes[i] = new Box
+                    new Box
                     {
                         RelativeSizeAxes = Axes.Both,
                         Anchor = Anchor.Centre,
@@ -79,15 +111,5 @@
                 });
             }
         }
-
-        private readonly Box[] boxes = new Box[4];
-
-        protected override void Update()
-        {
-            base.Update();
-
-            foreach (Box box in boxes)
-                box.Rotation += 0.01f;
-        }
     }
 }


Revert unintended change

Revert unintended change

--- osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/PlayerArea.cs
+++ osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/PlayerArea.cs
@@ -102,12 +102,9 @@
             stack.Push(new MultiSpectatorPlayerLoader(Score, () =>
             {
                 var player = new MultiSpectatorPlayer(Score, SpectatorPlayerClock);
+                player.OnGameplayStarted += () => OnGameplayStarted?.Invoke();

-                player.OnGameplayStarted += () =>
-                {
-                    clockAdjustmentsFromMods.BindAdjustments(player.ClockAdjustmentsFromMods);
-                    OnGameplayStarted?.Invoke();
-                };
+                clockAdjustmentsFromMods.BindAdjustments(player.ClockAdjustmentsFromMods);

                 return player;
             }));


Replace using statement with declaration in Move

--- MoreLinq/Move.cs
+++ MoreLinq/Move.cs
@@ -66,26 +66,25 @@
                 bool hasMore = true;
                 bool MoveNext(IEnumerator<T> e) => hasMore && (hasMore = e.MoveNext());

-                using (var e = source.GetEnumerator())
-                {
-                    for (var i = 0; i < bufferStartIndex && MoveNext(e); i++)
-                        yield return e.Current;
+                using var e = source.GetEnumerator();

-                    var buffer = new T[bufferSize];
-                    var length = 0;
+                for (var i = 0; i < bufferStartIndex && MoveNext(e); i++)
+                    yield return e.Current;

-                    for (; length < bufferSize && MoveNext(e); length++)
-                        buffer[length] = e.Current;
+                var buffer = new T[bufferSize];
+                var length = 0;

-                    for (var i = 0; i < bufferYieldIndex && MoveNext(e); i++)
-                        yield return e.Current;
+                for (; length < bufferSize && MoveNext(e); length++)
+                    buffer[length] = e.Current;

-                    for (var i = 0; i < length; i++)
-                        yield return buffer[i];
+                for (var i = 0; i < bufferYieldIndex && MoveNext(e); i++)
+                    yield return e.Current;

-                    while (MoveNext(e))
-                        yield return e.Current;
-                }
+                for (var i = 0; i < length; i++)
+                    yield return buffer[i];
+
+                while (MoveNext(e))
+                    yield return e.Current;
             }
         }
     }


Cleanup ListBlockParser

Cleanup ListBlockParser

--- src/Markdig/Parsers/ListBlockParser.cs
+++ src/Markdig/Parsers/ListBlockParser.cs
@@ -101,9 +101,8 @@
             // TODO: Check with specs, it is not clear that list marker or bullet marker must be followed by at least 1 space

             // If we have already a ListItemBlock, we are going to try to append to it
-            var listItem = block as ListItemBlock;
             result = BlockState.None;
-            if (listItem != null)
+            if (block is ListItemBlock listItem)
             {
                 result = TryContinueListItem(processor, listItem);
             }
@@ -123,12 +122,9 @@
             // Allow all blanks lines if the last block is a fenced code block
             // Allow 1 blank line inside a list
             // If > 1 blank line, terminate this list
-            var isBlankLine = state.IsBlankLine;
-
-            var isCurrentBlockBreakable = state.CurrentBlock != null && state.CurrentBlock.IsBreakable;
-            if (isBlankLine)
-            {
-                if (isCurrentBlockBreakable)
+            if (state.IsBlankLine)
+            {
+                if (state.CurrentBlock != null && state.CurrentBlock.IsBreakable)
                 {
                     if (!(state.NextContinue is ListBlock))
                     {
@@ -195,20 +191,20 @@

             var c = state.CurrentChar;
             var itemParser = mapItemParsers[c];
-            bool isOrdered = itemParser is OrderedListItemParser;
             if (itemParser == null)
             {
                 return BlockState.None;
             }

             // Try to parse the list item
-            ListInfo listInfo;
-            if (!itemParser.TryParse(state, currentParent?.BulletType ?? '\0', out listInfo))
+            if (!itemParser.TryParse(state, currentParent?.BulletType ?? '\0', out ListInfo listInfo))
             {
                 // Reset to an a start position
                 state.GoToColumn(initColumn);
                 return BlockState.None;
             }
+
+            bool isOrdered = itemParser is OrderedListItemParser;

             // Gets the current character after a successful parsing of the list information
             c = state.CurrentChar;
@@ -251,11 +247,10 @@
             // Starts/continue the list unless:
             // - an empty list item follows a paragraph
             // - an ordered list is not starting by '1'
-            var isPreviousParagraph = (block ?? state.LastBlock) is ParagraphBlock;
-            if (isPreviousParagraph)
-            {
-                var isOpen = state.IsOpen(block ?? state.LastBlock);
-                if (state.IsBlankLine || (isOpen && listInfo.BulletType == '1' && listInfo.OrderedStart != "1"))
+            if ((block ?? state.LastBlock) is ParagraphBlock previousParagraph)
+            {
+                if (state.IsBlankLine ||
+                    state.IsOpen(previousParagraph) && listInfo.BulletType == '1' && listInfo.OrderedStart != "1")
                 {
                     state.GoToColumn(initColumn);
                     return BlockState.None;
@@ -310,64 +305,47 @@

         public override bool Close(BlockProcessor processor, Block blockToClose)
         {
-            var listBlock = blockToClose as ListBlock;
-
             // Process only if we have blank lines
-            if (listBlock == null || listBlock.CountAllBlankLines <= 0)
-            {
-                return true;
-            }
-
-            // TODO: This code is UGLY and WAY TOO LONG, simplify!
-            bool isLastListItem = true;
-            for (int listIndex = listBlock.Count - 1; listIndex >= 0; listIndex--)
-            {
-                var block = listBlock[listIndex];
-                var listItem = (ListItemBlock) block;
-                bool isLastElement = true;
-                for (int i = listItem.Count - 1; i >= 0; i--)
-                {
-                    var item = listItem[i];
-                    if (item is BlankLineBlock)
+            if (blockToClose is ListBlock listBlock && listBlock.CountAllBlankLines > 0)
+            {
+                if (listBlock.Parent is ListItemBlock parentListItemBlock &&
+                    listBlock.LastChild is ListItemBlock lastListItem &&
+                    lastListItem.LastChild is BlankLineBlock)
+                {
+                    // Inform the outer list that we have a blank line
+                    var parentList = (ListBlock)parentListItemBlock.Parent;
+
+                    parentList.CountAllBlankLines++;
+                    parentListItemBlock.Add(new BlankLineBlock());
+                }
+
+                for (int listIndex = listBlock.Count - 1; listIndex >= 0; listIndex--)
+                {
+                    var listItem = (ListItemBlock)listBlock[listIndex];
+
+                    for (int i = listItem.Count - 1; i >= 0; i--)
                     {
-                        if ((isLastElement &&  listIndex < listBlock.Count - 1) || (listItem.Count > 2 && (i > 0 && i < (listItem.Count - 1))))
+                        if (listItem[i] is BlankLineBlock)
                         {
-                            listBlock.IsLoose = true;
-                        }
-
-                        if (isLastElement && isLastListItem)
-                        {
-                            // Inform the outer list that we have a blank line
-                            var parentListItemBlock = listBlock.Parent as ListItemBlock;
-                            if (parentListItemBlock != null)
+                            if (i == listItem.Count - 1 ? listIndex < listBlock.Count - 1 : i > 0)
                             {
-                                var parentList = (ListBlock) parentListItemBlock.Parent;
-
-                                parentList.CountAllBlankLines++;
-                                parentListItemBlock.Add(new BlankLineBlock());
+                                listBlock.IsLoose = true;
+                            }
+
+                            listItem.RemoveAt(i);
+
+                            // If we have removed all blank lines, we can exit
+                            listBlock.CountAllBlankLines--;
+                            if (listBlock.CountAllBlankLines == 0)
+                            {
+                                goto done;
                             }
                         }
-
-                        listItem.RemoveAt(i);
-
-                        // If we have remove all blank lines, we can exit
-                        listBlock.CountAllBlankLines--;
-                        if (listBlock.CountAllBlankLines == 0)
-                        {
-                            break;
-                        }
                     }
-                    isLastElement = false;
-                }
-                isLastListItem = false;
-            }
-
-            //// Update end-position for the list
-            //if (listBlock.Count > 0)
-            //{
-            //    listBlock.Span.End = listBlock[listBlock.Count - 1].Span.End;
-            //}
-
+                }
+            }
+
+        done:
             return true;
         }
     }


- Engine is now in the Mdl namespace
- removed the Mdl namespace qualifier, since it's implicit now

svn path=/trunk/gtkglarea-sharp/; revision=61855

--- examples/MdlLoader/Engine.cs
+++ examples/MdlLoader/Engine.cs
@@ -1,13 +1,13 @@
 using GtkGL;

-namespace GladeExample {
+namespace Mdl {
     using System;

     public class Engine {
 		public static int Main (string[] args)
 		{
-			Mdl.MdlLoader loader = new Mdl.MdlLoader();
-			Mdl.Mdl myMdl = loader.Load("/home/cjcollier/id/models/armor.mdl");
+			MdlLoader loader = new MdlLoader();
+			Mdl myMdl = loader.Load("/home/cjcollier/id/models/armor.mdl");

 			Gtk.Application.Init ();


Return DisposableAction.Noop for the null profiler instead of creating new objects for every step.

--- Kudu.Core/Performance/NullProfiler.cs
+++ Kudu.Core/Performance/NullProfiler.cs
@@ -14,7 +14,7 @@

         public IDisposable Step(string value)
         {
-            return new DisposableAction(() => { });
+            return DisposableAction.Noop;
         }
     }
 }


Added more XML comments to options class

--- source/AccessTokenValidation/IdentityServerBearerTokenAuthenticationOptions.cs
+++ source/AccessTokenValidation/IdentityServerBearerTokenAuthenticationOptions.cs
@@ -157,6 +157,7 @@

         /// <summary>
         /// Gets or sets the client id for accessing the introspection endpoint.
+        /// In IdentityServer that would be the name of an authorized scope
         /// </summary>
         /// <value>
         /// The client id.
@@ -165,6 +166,7 @@

         /// <summary>
         /// Gets or sets the client secret for accessing the introspection endpoint.
+        /// In IdentityServer that is the secret associated with the authorized scope.
         /// </summary>
         /// <value>
         /// The client secret.


VsHost.FormatLine in the edition of XAML files will select the line automaticly, unselect it

--- NVimVS/VsHost.cs
+++ NVimVS/VsHost.cs
@@ -731,6 +731,7 @@
         public override void FormatLine()
         {
             this.SafeExecuteCommand("Edit.FormatSelection");
+            _editorOperations.ResetSelection();
         }

         public override void FormatLineRange(VimSpan span)


AddSelf / SubtractSelf tweaks

AddSelf / SubtractSelf tweaks

--- NeinMath/Calc.cs
+++ NeinMath/Calc.cs
@@ -235,25 +235,46 @@
         }

         public static void AddSelf(uint[] left, int leftLength,
+                                   uint[] right, int rightLength)
+        {
+            var carry = 0L;
+
+            // adds the bits
+            for (var i = 0; i < rightLength; i++)
+            {
+                var digit = (left[i] + carry) + right[i];
+                left[i] = (uint)digit;
+                carry = digit >> 32;
+            }
+            for (var i = rightLength; carry != 0 && i < leftLength; i++)
+            {
+                var digit = left[i] + carry;
+                left[i] = (uint)digit;
+                carry = digit >> 32;
+            }
+        }
+
+        public static void AddSelf(uint[] left, int leftLength,
                                    uint[] right, int rightLength,
                                    int rightOffset)
         {
-            var fullRightLength = rightOffset + rightLength;
-            if (fullRightLength > leftLength)
-                fullRightLength = leftLength;
+            var bound = rightOffset + rightLength;
+            if (bound > leftLength)
+                bound = leftLength;
             var carry = 0L;

             // adds the bits
-            for (var i = rightOffset; i < fullRightLength; i++)
+            for (var i = rightOffset; i < bound; i++)
             {
                 var digit = (left[i] + carry) + right[i - rightOffset];
                 left[i] = (uint)digit;
                 carry = digit >> 32;
             }
-            if (fullRightLength < leftLength)
-            {
-                var digit = left[fullRightLength] + carry;
-                left[fullRightLength] = (uint)digit;
+            for (var i = bound; carry != 0 && i < leftLength; i++)
+            {
+                var digit = left[i] + carry;
+                left[i] = (uint)digit;
+                carry = digit >> 32;
             }
         }

@@ -316,7 +337,7 @@
                 left[i] = (uint)digit;
                 carry = digit >> 32;
             }
-            for (var i = rightLength; i < leftLength; i++)
+            for (var i = rightLength; carry != 0 && i < leftLength; i++)
             {
                 var digit = left[i] + carry;
                 left[i] = (uint)digit;
@@ -328,16 +349,19 @@
                                         uint[] right, int rightLength,
                                         int rightOffset)
         {
+            var bound = rightOffset + rightLength;
+            if (bound > leftLength)
+                bound = leftLength;
             var carry = 0L;

             // substract the bits
-            for (var i = rightOffset; i < rightLength + rightOffset; i++)
+            for (var i = rightOffset; i < bound; i++)
             {
                 var digit = (left[i] + carry) - right[i - rightOffset];
                 left[i] = (uint)digit;
                 carry = digit >> 32;
             }
-            for (var i = rightLength + rightOffset; i < leftLength; i++)
+            for (var i = bound; carry != 0 && i < leftLength; i++)
             {
                 var digit = left[i] + carry;
                 left[i] = (uint)digit;
@@ -405,7 +429,7 @@
                 SubtractSelf(p3, p3.Length, p2, p2.Length);

                 // merge the result
-                AddSelf(bits, bits.Length, p2, p2.Length, 0);
+                AddSelf(bits, bits.Length, p2, p2.Length);
                 AddSelf(bits, bits.Length, p3, p3.Length, n);
                 AddSelf(bits, bits.Length, p1, p1.Length, n * 2);
             }
@@ -475,7 +499,7 @@
             else
             {
                 // divide & conquer
-                var n = (((leftLength > rightLength)
+                var n = ((leftLength > rightLength
                     ? leftLength : rightLength) + 1) / 2;

                 var leftLowOffset = leftOffset;
@@ -501,7 +525,7 @@
                 SubtractSelf(p3, p3.Length, p2, p2.Length);

                 // merge the result
-                AddSelf(bits, bits.Length, p2, p2.Length, 0);
+                AddSelf(bits, bits.Length, p2, p2.Length);
                 AddSelf(bits, bits.Length, p3, p3.Length, n);
                 AddSelf(bits, bits.Length, p1, p1.Length, n * 2);
             }


Fix "guessing pre-guessed letter adds error" issue and a few other things

--- NadekoBot.Core/Modules/Games/Common/Hangman/Hangman.cs
+++ NadekoBot.Core/Modules/Games/Common/Hangman/Hangman.cs
@@ -66,8 +66,7 @@

         private void AddError()
         {
-            Errors++;
-            if (Errors > MaxErrors)
+            if (++Errors > MaxErrors)
             {
                 var _ = OnGameEnded(this, null);
                 CurrentPhase = Phase.Ended;
@@ -110,16 +109,15 @@

                 var ch = input[0];

-                if (!(char.IsLetterOrDigit(ch)))
+                if (!char.IsLetterOrDigit(ch))
                     return;

                 if (!_recentUsers.Add(userId)) // don't let a single user spam guesses
                     return;

-                if (!_previousGuesses.Add(ch)) // that latter was already guessed
+                if (!_previousGuesses.Add(ch)) // that letter was already guessed
                 {
                     var _ = OnLetterAlreadyUsed?.Invoke(this, userName, ch);
-                    AddError();
                 }
                 else if (!Term.Word.Contains(ch)) // guessed letter doesn't exist
                 {
@@ -127,12 +125,12 @@
                     AddError();
                 }
                 else if (Term.Word.All(x => _previousGuesses.IsSupersetOf(Term.Word.ToLowerInvariant()
-                                                                            .Where(c => char.IsLetterOrDigit(c)))))
+                                                                            .Where(char.IsLetterOrDigit))))
                 {
-                    var _ = OnGameEnded.Invoke(this, userName); //if all letters are guessed
+                    var _ = OnGameEnded.Invoke(this, userName); // if all letters are guessed
                     CurrentPhase = Phase.Ended;
                 }
-                else //guessed but not last letter
+                else // guessed but not last letter
                 {
                     var _ = OnGuessSucceeded?.Invoke(this, userName, ch);
                     _recentUsers.Remove(userId); // he can guess again right away


RedTeam: Task 2: input checking adjusted

--- src/Algorithms/Algorithms101/RedTeam/Task-2-Rotate-Matrix-Counter-Clockwise.cs
+++ src/Algorithms/Algorithms101/RedTeam/Task-2-Rotate-Matrix-Counter-Clockwise.cs
@@ -131,9 +131,9 @@
         private static void CheckInput(int[,] input, int rotate)
         {
             if (input.Rank != 2
-                || input.GetLength(0) < MinLength
+                || Math.Min(input.GetLength(0), input.GetLength(1)) < MinLength
+                || Math.Min(input.GetLength(0), input.GetLength(1)) % 2 != 0
                 || input.GetLength(0) > MaxLength
-                || input.GetLength(1) < MinLength
                 || input.GetLength(1) > MaxLength)
             {
                 throw new ArgumentOutOfRangeException(nameof(input));


Failing test for preserving parens around conditional expression

--- src/Analyzers/CSharp/Tests/SimplifyInterpolation/SimplifyInterpolationTests.cs
+++ src/Analyzers/CSharp/Tests/SimplifyInterpolation/SimplifyInterpolationTests.cs
@@ -1002,5 +1002,25 @@
     }
 }");
         }
-    }
-}
+
+        [Fact, WorkItem(49647, "https://github.com/dotnet/roslyn/issues/49647")]
+        public async Task ConditionalExpressionMustRemainParenthesized()
+        {
+            await TestInRegularAndScript1Async(
+@"class C
+{
+    void M(bool cond)
+    {
+        _ = $""{(cond ? 1 : 2){|Unnecessary:[||].ToString()|}}"";
+    }
+}",
+@"class C
+{
+    void M(bool cond)
+    {
+        _ = $""{(cond ? 1 : 2)}"";
+    }
+}");
+        }
+    }
+}


update

update

--- OpenGLviaCSharp/fuluDd00_LayeredEngrave/PeelingNode.cs
+++ OpenGLviaCSharp/fuluDd00_LayeredEngrave/PeelingNode.cs
@@ -109,10 +109,6 @@
             }

             int currentStep = 0, totalStep = this.RenderStep;
-            this.resources.blenderFBO.Bind();
-            GL.Instance.Clear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
-            this.resources.blenderFBO.Unbind();
-            Texture targetTexture = this.resources.blenderColorTexture;

             // remember clear color.
             var clearColor = new float[4];
@@ -121,7 +117,7 @@
             GL.Instance.Viewport(0, 0, vWidth, vHeight);

             var bitmapList = new List<Bitmap>();
-
+            Texture targetTexture;
             // init.
             if (currentStep <= totalStep)
             {


Ah, the nullable annotation habit!

Ah, the nullable annotation habit!

--- src/EditorFeatures/TestUtilities/Completion/AbstractCompletionProviderTests.cs
+++ src/EditorFeatures/TestUtilities/Completion/AbstractCompletionProviderTests.cs
@@ -438,7 +438,7 @@
             return workspace.CurrentSolution.GetDocument(document.Id);
         }

-        private Document WithChangedOption(Document document, OptionKey optionKey, object? value)
+        private Document WithChangedOption(Document document, OptionKey optionKey, object value)
         {
             var workspace = document.Project.Solution.Workspace;
             var newOptions = workspace.Options.WithChangedOption(optionKey, value);


Use OnOpen and OnSave functions from new FileDialog class

--- OpenKh.Tools.Kh2TextEditor/ViewModels/MainViewModel.cs
+++ OpenKh.Tools.Kh2TextEditor/ViewModels/MainViewModel.cs
@@ -47,6 +47,16 @@
             .AddExtensions("fontinfo.bar", "bar")
             .AddExtensions("All files", "*");

+        private static readonly List<FileDialogFilter> ExportFilters = FileDialogFilterComposer
+            .Compose()
+            .Concat(TextExporters.GetAll().Select(x => FileDialogFilter.ByExtensions(x.Filter().Item1, x.Filter().Item2)))
+            .ToList();
+
+        private static readonly List<FileDialogFilter> ImportFilters = FileDialogFilterComposer
+            .Compose()
+            .Concat(TextImporters.GetAll().Select(x => FileDialogFilter.ByExtensions(x.Filter().Item1, x.Filter().Item2)))
+            .ToList();
+
         public string Title => $"{_barEntryName ?? DefaultName} | {FileName ?? "untitled"} | {ApplicationName}";

         private string FileName
@@ -134,44 +144,36 @@

             ExportMessageAsCommand = new RelayCommand(x =>
             {
-                var fd = FileDialog.Factory(Window, FileDialog.Behavior.Save,
-                    TextExporters.GetAll().Select(exporter => exporter.Filter())
-                );
-
-                if (fd.ShowDialog() == true)
-                {
-                    var selectedExtension = $"{Path.GetExtension(fd.FileName).TrimStart('.')}";
+                FileDialog.OnSave(fileName =>
+                {
+                    var selectedExtension = $"{Path.GetExtension(fileName).TrimStart('.')}";

                     ExportMessageAsFile(
-                        fileName: fd.FileName,
-                        textExporter: TextExporters.FindFromFile(fd.FileName)
-                    );
-                }
+                        fileName: fileName,
+                        textExporter: TextExporters.FindFromFile(fileName)
+                    );
+                }, ExportFilters);
             }, x => true);

             ImportMessageFromCommand = new RelayCommand(x =>
             {
-                var fd = FileDialog.Factory(Window, FileDialog.Behavior.Open,
-                    TextImporters.GetAll().Select(importer => importer.Filter())
-                );
-
-                if (fd.ShowDialog() == true)
-                {
-                    var selectedExtension = $"{Path.GetExtension(fd.FileName).TrimStart('.')}";
-
-                    var textImporter = TextImporters.FindFromFile(fd.FileName);
+                FileDialog.OnOpen(fileName =>
+                {
+                    var selectedExtension = $"{Path.GetExtension(fileName).TrimStart('.')}";
+
+                    var textImporter = TextImporters.FindFromFile(fileName);
                     if (textImporter != null)
                     {
                         ImportMessageFromFile(
-                            fileName: fd.FileName,
+                            fileName: fileName,
                             textImporter
                         );
                     }
                     else
                     {
-                        MessageBox.Show($"Failed to match text decoder for your file:\n{fd.FileName}");
-                    }
-                }
+                        MessageBox.Show($"Failed to match text decoder for your file:\n{fileName}");
+                    }
+                }, ImportFilters);
             }, x => true);

             ExitCommand = new RelayCommand(x =>


It is ok to create a keyspace from multiple threads

--- src/Elders.Cronus.Projections.Cassandra/Config/CassandraProjectionsSettings.cs
+++ src/Elders.Cronus.Projections.Cassandra/Config/CassandraProjectionsSettings.cs
@@ -282,14 +282,15 @@
             var serializer = builder.Container.Resolve<ISerializer>();
             var publisher = builder.Container.Resolve<ITransport>(builder.Name).GetPublisher<ICommand>(serializer);

-            var session = cluster.Connect(settings.Keyspace);
+            var session = cluster.Connect();
+            session.CreateKeyspace(settings.ReplicationStrategy, settings.Keyspace); // it is ok to create a keyspace from multiple threads
+
             CassandraProjectionStoreSchema projectionStoreSchema = null;
             CassandraSnapshotStoreSchema snapshotStoreSchema = null;

             if (settings.CanChangeSchema)
             {
                 DataStaxCassandra.ISession schemaSession = GetLiveSchemaSession(cluster, settings);
-                schemaSession.CreateKeyspace(settings.ReplicationStrategy, settings.Keyspace);
                 projectionStoreSchema = new CassandraProjectionStoreSchema(schemaSession);
                 snapshotStoreSchema = new CassandraSnapshotStoreSchema(schemaSession);
             }


1921: enable stopwatch profiling

1921: enable stopwatch profiling

--- src/PixelFarm/PaintLab.Platforms.WinForms/2_GLES2/3_MyTopWindowBridgeOpenGL.cs
+++ src/PixelFarm/PaintLab.Platforms.WinForms/2_GLES2/3_MyTopWindowBridgeOpenGL.cs
@@ -7,7 +7,7 @@
 using LayoutFarm.UI.InputBridge;
 namespace LayoutFarm.UI.OpenGL
 {
-
+
     class MyTopWindowBridgeOpenGL : TopWindowBridgeWinForm
     {

@@ -34,7 +34,7 @@
         }
         public override void BindWindowControl(Control windowControl)
         {
-            this.BindGLControl((GpuOpenGLSurfaceView)windowControl);
+            this.BindGLControl((GpuOpenGLSurfaceView)windowControl);
         }

         /// <summary>
@@ -113,9 +113,9 @@
                     break;
             }
         }
-#if DEBUG
-        System.Diagnostics.Stopwatch dbugStopWatch = new System.Diagnostics.Stopwatch();
-#endif
+        //#if DEBUG
+        System.Diagnostics.Stopwatch _stopWatch = new System.Diagnostics.Stopwatch();
+        //#endif
         public override void PaintToOutputWindow()
         {
             if (!_isInitGLControl)
@@ -127,19 +127,19 @@
             //dbugCount++;
             //System.Diagnostics.Debug.WriteLine(">" + innumber);

-#if DEBUG
-            //dbugStopWatch.Reset();
-            //dbugStopWatch.Start();
-#endif
+            //#if DEBUG
+            _stopWatch.Reset();
+            _stopWatch.Start();
+            //#endif
             _windowControl.MakeCurrent();
             _openGLViewport.PaintMe();
             _windowControl.SwapBuffers();
-#if DEBUG
-            //dbugStopWatch.Stop();
-            //long millisec_per_frame = dbugStopWatch.ElapsedMilliseconds;
-            //int fps = (int)(1000.0f / millisec_per_frame);
-            //System.Diagnostics.Debug.WriteLine(fps);
-#endif
+            //#if DEBUG
+            _stopWatch.Stop();
+            long millisec_per_frame = _stopWatch.ElapsedMilliseconds;
+            int fps = (int)(1000.0f / millisec_per_frame);
+            System.Diagnostics.Debug.WriteLine("fps:" + fps);
+            //#endif
             //System.Diagnostics.Debug.WriteLine("<" + innumber);
         }
         public override void CopyOutputPixelBuffer(int x, int y, int w, int h, IntPtr outputBuffer)


fix stackoverflow

fix stackoverflow

--- src/Remote.Linq.EntityFramework/ExpressionVisitors/SystemExpressionReWriter.cs
+++ src/Remote.Linq.EntityFramework/ExpressionVisitors/SystemExpressionReWriter.cs
@@ -48,7 +48,7 @@
                         Expression.Bind(type.GetProperty(nameof(VariableQueryArgument<object>.Value)), argument));
                 }

-                return VisitNew(node);
+                return base.VisitNew(node);
             }
         }
     }


change SubBuild to int (from uint?, which won't pass aot)

--- src/Smellyriver.TankInspector.Core/TankInspector.Pro/Repository/GameVersion.cs
+++ src/Smellyriver.TankInspector.Core/TankInspector.Pro/Repository/GameVersion.cs
@@ -21,11 +21,16 @@
             return uint.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out result);
         }

+        private static bool TryParseInt(string value, out int result)
+        {
+            return int.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out result);
+        }
+
         public static GameVersion Parse(string versionString)
         {
             var match = Regex.Match(versionString, @"^\s*v\.(?<major>\d+)\.(?<minor>\d+)\.(?<build>\d+)(\.(?<subbuild>\d+))* (?<ct>Common Test )?\#(?<revision>\d+)\s*$");
             uint major, minor, build, revision;
-            uint? subbuild = null;
+            var subbuild = -1;
             bool isCommonTest;
             if (match.Success)
             {
@@ -35,8 +40,8 @@
                         {
                             if (match.Groups["subbuild"] != null)
                             {
-                                uint subbuildValue;
-                                if (GameVersion.TryParseUInt(match.Groups["subbuild"].Value, out subbuildValue))
+                                int subbuildValue;
+                                if (GameVersion.TryParseInt(match.Groups["subbuild"].Value, out subbuildValue))
                                     subbuild = subbuildValue;
                             }

@@ -68,7 +73,7 @@
         {
             get
             {
-                if (this.SubBuild == null)
+                if (this.SubBuild < 0)
                     return string.Format("{0}.{1}.{2}.{3}{4}",
                                          this.Major,
                                          this.Minor,
@@ -105,7 +110,7 @@
         [DataMember]
         public uint Build { get; set; }
         [DataMember]
-        public uint? SubBuild { get; set; }
+        public int SubBuild { get; set; }
         [DataMember]
         public uint Revision { get; set; }
         [DataMember]
@@ -144,15 +149,15 @@
             if (result != 0) return result;
             result = this.Build.CompareTo(other.Build);
             if (result != 0) return result;
-            if (this.SubBuild != null && other.SubBuild == null)
+            if (this.SubBuild >= 0 && other.SubBuild < 0)
                 return 1;

-            if (this.SubBuild == null && other.SubBuild != null)
+            if (this.SubBuild < 0 && other.SubBuild >= 0)
                 return -1;

-            if (this.SubBuild != null && other.SubBuild != null)
+            if (this.SubBuild >= 0 && other.SubBuild >= 0)
             {
-                result = this.SubBuild.Value.CompareTo(other.SubBuild.Value);
+                result = this.SubBuild.CompareTo(other.SubBuild);
                 if (result != 0) return result;
             }
             return this.Revision.CompareTo(other.Revision);


Bug fixed: フォームから送信された数値リストで空文字が使用される問題を解消。

--- Implem.Pleasanter/Libraries/Requests/Forms.cs
+++ Implem.Pleasanter/Libraries/Requests/Forms.cs
@@ -51,6 +51,7 @@
         {
             return Data(name)
                 .Split(delimiter)
+                .Where(o => o != string.Empty)
                 .Select(o => o.ToInt())
                 .Distinct();
         }
@@ -59,6 +60,7 @@
         {
             return Data(name)
                 .Split(delimiter)
+                .Where(o => o != string.Empty)
                 .Select(o => o.ToLong())
                 .Distinct();
         }


Pass Agent Trace Level into Engine

Pass Agent Trace Level into Engine

--- src/NUnitEngine/nunit-agent/Program.cs
+++ src/NUnitEngine/nunit-agent/Program.cs
@@ -114,13 +114,12 @@
             // Create TestEngine - this program is
             // conceptually part of  the engine and
             // can access its internals as needed.
-            TestEngine engine = new TestEngine();
-
-            // TODO: We need to get this from somewhere. Argument?
-            engine.InternalTraceLevel = InternalTraceLevel.Debug;
+            var engine = new TestEngine
+            {
+                InternalTraceLevel = traceLevel
+            };

             // Custom Service Initialization
-            //log.Info("Adding Services");
             engine.Services.Add(new ExtensionService());
             engine.Services.Add(new DomainManager());
             engine.Services.Add(new InProcessTestRunnerFactory());


Cleaned up home module

Cleaned up home module

--- src/Nancy.Demo.Samples/Modules/Home.cs
+++ src/Nancy.Demo.Samples/Modules/Home.cs
@@ -1,25 +1,18 @@
 namespace Nancy.Demo.Samples.Modules
 {
-    using System;
     using System.Linq;
     using Data;
-    using Models;
     using MongoDB.Driver;
-    using MongoDB.Driver.Builders;

     public class Home : NancyModule
     {
-        public Home(IDemoRepository repository, MongoDatabase database)
+        public Home(IDemoRepository repository)
         {
             Get["/"] = parameters => {
-                //var model =
-                //    repository.GetAll().OrderBy(x => x.Name).ThenBy(x => x.Author);
+                var model =
+                    repository.GetAll().OrderBy(x => x.Name).ThenBy(x => x.Author);

-                var collection = database
-                    .GetCollection<DemoModel>("demos")
-                    .Find(Query<DemoModel>.Where(x => !string.IsNullOrEmpty(x.Id)));
-
-                return Negotiate.WithModel(collection).WithView("index");
+                return Negotiate.WithModel(model).WithView("index");
             };

             Get["/about"] = parameters => {
@@ -29,30 +22,6 @@
             Get["/login"] = parameters => {
                 return View["login"];
             };
-
-            Get["/mongo/{author}"] = x =>
-            {
-                var entity =
-                    new DemoModel
-                        {
-                            Author = (string)x.author,
-                            Description = "Created using Mongo",
-                            Gravatar = "https://secure.gravatar.com/avatar/61f3187a94eb0411ef92b123d7a13584?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
-                            HasNuget = true,
-                            Id = Guid.NewGuid().ToString(),
-                            IndexedAt = DateTime.Now,
-                            LastCommit = DateTime.Now,
-                            Name = "NoPassword",
-                            Packages = Enumerable.Empty<Tuple<string, string>>()
-                        };
-
-                var collection =
-                    database.GetCollection<DemoModel>("demos");
-
-                collection.Insert(entity);
-
-                return 200;
-            };
         }
     }
 }


Document ZoneInterval.Start behavior for "to start of time"

This is in line with the other properties.

--- src/NodaTime/TimeZones/ZoneInterval.cs
+++ src/NodaTime/TimeZones/ZoneInterval.cs
@@ -157,6 +157,7 @@
         /// Gets the first Instant that the Offset applies.
         /// </summary>
         /// <value>The first Instant that the Offset applies.</value>
+        /// <exception cref="InvalidOperationException">The interval extends to the start of time.</exception>
         public Instant Start
         {
             [DebuggerStepThrough]


NTFS: Fix some corruption reading compressed NTFS files, reported by bsobel [#5206]

Fixes two assumptions:
* The start of a read is aligned with the start of a compression block
* The start of a compression block is aligned with the start of a data run.

Neither of which is true in non-trivial cases.

--- src/Ntfs/NonResidentAttributeBuffer.cs
+++ src/Ntfs/NonResidentAttributeBuffer.cs
@@ -365,11 +365,11 @@
             int dataRunIdx = FindDataRun(startVcn);
             if (runs[dataRunIdx].IsSparse)
             {
-                int numBytes = (int)Math.Min(count, compressionUnitLength);
+                int numBytes = (int)Math.Min(count, compressionUnitLength - blockOffset);
                 Array.Clear(buffer, offset, numBytes);
                 return numBytes;
             }
-            else if (IsBlockCompressed(dataRunIdx, _record.CompressionUnitSize))
+            else if (IsBlockCompressed(startVcn, _record.CompressionUnitSize))
             {
                 byte[] decompBuffer;
                 if (_cachedDecompressedBlock != null && _cachedBlockStartVcn == dataRunIdx)
@@ -379,7 +379,8 @@
                 else
                 {
                     byte[] compBuffer = new byte[compressionUnitLength];
-                    RawRead(dataRunIdx, 0, compBuffer, 0, (int)compressionUnitLength, false);
+
+                    RawRead(dataRunIdx, (startVcn - runs[dataRunIdx].StartVcn) * _bytesPerCluster, compBuffer, 0, (int)compressionUnitLength, false);

                     decompBuffer = Decompress(compBuffer);

@@ -492,11 +493,12 @@
             }
         }

-        private bool IsBlockCompressed(int startDataRunIdx, int compressionUnitSize)
-        {
-            var runs = _record.CookedDataRuns;
-            int clustersRemaining = (int)Math.Min(compressionUnitSize, (runs[runs.Count - 1].StartVcn + runs[runs.Count - 1].Length) - runs[startDataRunIdx].StartVcn);
-            int dataRunIdx = startDataRunIdx;
+        private bool IsBlockCompressed(long startVcn, int compressionUnitSize)
+        {
+            var runs = _record.CookedDataRuns;
+            int clustersRemaining = compressionUnitSize;
+            int dataRunIdx = FindDataRun(startVcn);
+            long dataRunOffset = startVcn - runs[dataRunIdx].StartVcn;

             while (clustersRemaining > 0)
             {
@@ -508,12 +510,15 @@
                     return true;
                 }

-                if (runs[dataRunIdx].Length > clustersRemaining)
+                int vcnContrib = (int)(runs[dataRunIdx].Length - dataRunOffset);
+
+                if (vcnContrib > clustersRemaining)
                 {
                     return false;
                 }

-                clustersRemaining -= (int)runs[dataRunIdx].Length;
+                clustersRemaining -= vcnContrib;
+                dataRunOffset = 0;
                 dataRunIdx++;
             }


This is not generic

This is not generic

--- src/ObjCRuntime/NativeMethodBuilder.cs
+++ src/ObjCRuntime/NativeMethodBuilder.cs
@@ -121,7 +121,7 @@
 				} else if (parms [i-argoffset].ParameterType.IsArray && IsWrappedType (parms [i-argoffset].ParameterType.GetElementType ())) {
 					il.Emit (OpCodes.Ldarg, i);
 					if (parms [i-argoffset].ParameterType.GetElementType () == typeof (string))
-						il.Emit (OpCodes.Call, convertsarray.MakeGenericMethod (parms [i-argoffset].ParameterType.GetElementType ()));
+						il.Emit (OpCodes.Call, convertsarray);
 					else
 						il.Emit (OpCodes.Call, convertarray.MakeGenericMethod (parms [i-argoffset].ParameterType.GetElementType ()));
 					il.Emit (OpCodes.Stloc, j++);


Fix memory corruption within BigIntegerCalculator

There is an array overflow caused by the divide algorithm. The allocated
guess memory needs one more limb to hold the result of multiplying the
divisor with the current guessed digit of the quotient.

Fix #1883

--- src/System.Runtime.Numerics/src/System/Numerics/BigIntegerCalculator.DivRem.cs
+++ src/System.Runtime.Numerics/src/System/Numerics/BigIntegerCalculator.DivRem.cs
@@ -164,7 +164,7 @@
             int divisorLength = rightLength;
             fixed (uint* dividend = new uint[dividendLength],
                          divisor = new uint[divisorLength],
-                         guess = new uint[divisorLength])
+                         guess = new uint[divisorLength + 1])
             {
                 // This will create private copies of left and right, so we can
                 // modify the actual values of the dividend during computation


Ensure RabbitMQ ConcurrentMessageLimit is respected, separately from the PrefetchCount

--- src/Transports/MassTransit.RabbitMqTransport/Pipeline/RabbitMqBasicConsumer.cs
+++ src/Transports/MassTransit.RabbitMqTransport/Pipeline/RabbitMqBasicConsumer.cs
@@ -2,6 +2,7 @@
 {
     using System;
     using System.Collections.Concurrent;
+    using System.Threading;
     using System.Threading.Tasks;
     using Context;
     using Contexts;
@@ -28,6 +29,7 @@
         readonly RabbitMqReceiveEndpointContext _context;
         readonly TaskCompletionSource<bool> _deliveryComplete;
         readonly IReceivePipeDispatcher _dispatcher;
+        readonly SemaphoreSlim _limit;
         readonly ModelContext _model;
         readonly ConcurrentDictionary<ulong, RabbitMqReceiveContext> _pending;
         readonly ReceiveSettings _receiveSettings;
@@ -55,6 +57,9 @@

             _deliveryComplete = TaskUtil.GetTask<bool>();

+            if (context.ConcurrentMessageLimit.HasValue)
+                _limit = new SemaphoreSlim(context.ConcurrentMessageLimit.Value);
+
             ConsumerCancelled += OnConsumerCancelled;
         }

@@ -193,6 +198,9 @@

                 var receiveLock = _receiveSettings.NoAck ? default : new RabbitMqReceiveLockContext(_model, deliveryTag);

+                if (_limit != null)
+                    await _limit.WaitAsync(context.CancellationToken).ConfigureAwait(false);
+
                 try
                 {
                     await _dispatcher.Dispatch(context, receiveLock).ConfigureAwait(false);
@@ -203,6 +211,8 @@
                 }
                 finally
                 {
+                    _limit?.Release();
+
                     if (added)
                         _pending.TryRemove(deliveryTag, out _);

@@ -253,6 +263,8 @@
             try
             {
                 await Completed.ConfigureAwait(false);
+
+                _limit?.Dispose();
             }
             catch (OperationCanceledException)
             {


Removed immediately iterated Where(predicate) enumeration in AnalysisEntityDataFlowOperationVisitor<TAnalysisData, TAnalysisContext, TAnalysisResult, TAbstractAnalysisValue> with if inside foreach.

--- src/Utilities/FlowAnalysis/FlowAnalysis/Framework/DataFlow/DataFlowAnalysis.cs
+++ src/Utilities/FlowAnalysis/FlowAnalysis/Framework/DataFlow/DataFlowAnalysis.cs
@@ -676,41 +676,44 @@
                 // Update catch input data.
                 if (branch.LeavingRegions.Length > 0)
                 {
-                    foreach (var tryAndCatchRegion in branch.LeavingRegions.Where(region => region.Kind == ControlFlowRegionKind.TryAndCatch))
+                    foreach (var region in branch.LeavingRegions)
                     {
                         // If we have any nested finally region inside this try-catch, then mark the catch region
                         // as a successor of that nested finally region.
                         // Otherwise, merge the current data directly into the catch region.

-                        var hasNestedFinally = false;
-                        if (branch.FinallyRegions.Length > 0)
-                        {
-                            var catchRegion = TryGetReachableCatchRegionStartingHandler(tryAndCatchRegion, sourceBlock);
-                            if (catchRegion != null)
-                            {
-                                for (var i = branch.FinallyRegions.Length - 1; i >= 0; i--)
+                        if (region.Kind == ControlFlowRegionKind.TryAndCatch)
+                        {
+                            var hasNestedFinally = false;
+                            if (branch.FinallyRegions.Length > 0)
+                            {
+                                var catchRegion = TryGetReachableCatchRegionStartingHandler(region, sourceBlock);
+                                if (catchRegion != null)
                                 {
-                                    ControlFlowRegion finallyRegion = branch.FinallyRegions[i];
-                                    if (finallyRegion.LastBlockOrdinal < catchRegion.FirstBlockOrdinal)
+                                    for (var i = branch.FinallyRegions.Length - 1; i >= 0; i--)
                                     {
-                                        var successor = new BranchWithInfo(destination: cfg.Blocks[catchRegion.FirstBlockOrdinal]);
-                                        AddFinallySuccessor(finallyRegion, successor);
-                                        hasNestedFinally = true;
-                                        break;
+                                        ControlFlowRegion finallyRegion = branch.FinallyRegions[i];
+                                        if (finallyRegion.LastBlockOrdinal < catchRegion.FirstBlockOrdinal)
+                                        {
+                                            var successor = new BranchWithInfo(destination: cfg.Blocks[catchRegion.FirstBlockOrdinal]);
+                                            AddFinallySuccessor(finallyRegion, successor);
+                                            hasNestedFinally = true;
+                                            break;
+                                        }
                                     }
                                 }
                             }
-                        }
-
-                        if (!hasNestedFinally)
-                        {
-                            // No nested finally regions inside this try-catch.
-                            // Merge the current data directly into the catch region.
-                            var catchRegion = MergeIntoCatchInputData(tryAndCatchRegion, branchData, sourceBlock);
-                            if (catchRegion != null)
-                            {
-                                // We also need to enqueue the catch block into the worklist as there is no direct branch into catch.
-                                worklist.Add(catchRegion.FirstBlockOrdinal);
+
+                            if (!hasNestedFinally)
+                            {
+                                // No nested finally regions inside this try-catch.
+                                // Merge the current data directly into the catch region.
+                                var catchRegion = MergeIntoCatchInputData(region, branchData, sourceBlock);
+                                if (catchRegion != null)
+                                {
+                                    // We also need to enqueue the catch block into the worklist as there is no direct branch into catch.
+                                    worklist.Add(catchRegion.FirstBlockOrdinal);
+                                }
                             }
                         }
                     }


Фикс для теста.

Фикс для теста.

--- Lens.Test/Snippets.cs
+++ Lens.Test/Snippets.cs
@@ -231,7 +231,7 @@
 try
     var zero = 0
     1 / zero
-catch ex:DivisionByZeroException
+catch ex:DivideByZeroException
     msg = 2
 msg
 ";


падучие тесты

падучие тесты

--- Lens.Test/Snippets.cs
+++ Lens.Test/Snippets.cs
@@ -872,6 +872,34 @@
 			Test(src, true);
 		}

+		[Test]
+		public void CustomTypeLinq1()
+		{
+			var src = @"
+record Store
+    Name : string
+    Value : int
+var found = new [new Store ""a"" 1; new Store ""b"" 2; new Store ""c"" 3]
+    |> Where ((x:Store) -> x.Value < 3)
+    |> OrderBy ((x:Store) -> x.Value)
+    |> First ()
+found.Name
+";
+			Test(src, "b");
+		}
+
+		[Test]
+		public void CustomTypeLinq2()
+		{
+			var src = @"
+record Store
+    Value : int
+var data = new [new Store 1; new Store 1; new Store 40]
+data.Sum ()
+";
+			Test(src, 42);
+		}
+
 		private void Test(string src, object value)
 		{
 			Assert.AreEqual(value, Compile(src));


Added OsPlatform assembly to default loaded assemblies.

--- FlubuCore/Scripting/ScriptLoader.cs
+++ FlubuCore/Scripting/ScriptLoader.cs
@@ -298,6 +298,7 @@
                 typeof(File).GetTypeInfo().Assembly.Location,
                 typeof(ILookup<string, string>).GetTypeInfo().Assembly.Location,
                 typeof(Expression).GetTypeInfo().Assembly.Location,
+                typeof(OSPlatform).GetTypeInfo().Assembly.Location,
             };

 #if NETSTANDARD2_0


remove unused usings

remove unused usings

--- test/IdentityServer4.EntityFramework.UnitTests/Mappers/ApiResourceMappersTests.cs
+++ test/IdentityServer4.EntityFramework.UnitTests/Mappers/ApiResourceMappersTests.cs
@@ -2,13 +2,11 @@
 // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.

-using System;
 using System.Linq;
 using FluentAssertions;
 using IdentityServer4.EntityFramework.Mappers;
 using IdentityServer4.Models;
 using Xunit;
-using Client = IdentityServer4.Models.Client;
 using ApiResource = IdentityServer4.Models.ApiResource;

 namespace IdentityServer4.EntityFramework.UnitTests.Mappers


now #44 added to the mix. (covariance and contravariance).

--- test/Rezolver.Tests/TargetContainerTests.cs
+++ test/Rezolver.Tests/TargetContainerTests.cs
@@ -196,23 +196,27 @@
         ///
         /// The derived type determines the type of target container required.
         /// </summary>
-        private class CreateChildTargetContainerIntent
+        private class TargetContainerOptions
         {
             public ITargetContainer Owner { get; set; }

-            public virtual bool Validate()
+            public virtual void Validate()
             {
-                return Owner != null;
+
             }
         }

-        private class TypedCreateChildTargetContainerIntent : CreateChildTargetContainerIntent
+        /// <summary>
+        /// Options for a target container
+        /// </summary>
+        private class ChildTargetContainerOptions : TargetContainerOptions
         {
             public Type Type { get; set; }

-            public override bool Validate()
+            public override void Validate()
             {
-                return base.Validate() && Type != null;
+                if (Type == null) throw new InvalidOperationException("Type must not be null");
+                if (Owner == null) throw new InvalidOperationException("Owner must not be null");
             }
         }

@@ -220,25 +224,47 @@
         /// Indicates an intent to create an ITargetContainer that can store a list of targets
         /// by the same type.
         /// </summary>
-        private class CreateTargetList : TypedCreateChildTargetContainerIntent { }
+        private class TargetListOptions : ChildTargetContainerOptions
+        {
+            public bool DisableMultiple { get; set; } = false;
+        }

         /// <summary>
         /// Indicates an intent to create an ITargetContainer that can store multiple lists of targets
         /// of non-related types.  This is typically the root of most target container 'trees'
         /// </summary>
-        private class CreateTargetDictionary : CreateChildTargetContainerIntent { }
+        private class TargetDictionaryOptions : TargetContainerOptions { }

         /// <summary>
         /// Indicates an intent to create an ITargetContainer that is bound to a specific open generic type
         /// </summary>
-        private class CreateTargetDictionaryForGeneric : CreateChildTargetContainerIntent
-        {
-            public override bool Validate()
+        private class GenericTargetContainerOptions : ChildTargetContainerOptions
+        {
+            /// <summary>
+            /// Enables matching interface or delegate registrations when a matching type parameter is covariant and
+            /// a registration for a closed generic type uses a type argument for the same parameter which is derived
+            /// from, or which implements the type passed.
+            /// </summary>
+            public bool EnableCovariance { get; set; } = false;
+            public bool EnableContravariance { get; set; } = false;
+            /// <summary>
+            /// If true, then calling <see cref="ITargetContainer.FetchAll(Type)"/> with a method should return
+            /// all targets registered aainst
+            /// </summary>
+            public bool AlwaysFetchAllMatchingTargets { get; set; } = true;
+
+            public override void Validate()
             {
-                return base.Validate() && TypeHelpers.IsGenericTypeDefinition(Type);
+                base.Validate();
+                Type t;
+                t.GenericTypeArguments[0].
+                if (!TypeHelpers.IsGenericTypeDefinition(Type)) throw new InvalidOperationException("Type must be an open generic");
             }
         }

-
+        //TODO: should be able to resolve an Action<Base> when requesting Action<Derived> (contravariance)
+        // TODO: should be able to resolve a Func<Derived> when requesting Func<Base> (covariance)
+
+        //The code which
 	}
 }


completed GetHttpApiResponseAsync_For_HttpResponseMessage_Of_TEntity_Task tests

--- tests/WebApiDoodle.Net.Http.Client.Test/Core/HttpResponseMessageExtensionsTest.cs
+++ tests/WebApiDoodle.Net.Http.Client.Test/Core/HttpResponseMessageExtensionsTest.cs
@@ -142,6 +142,169 @@
             }
         }

+        public class GetHttpApiResponseAsync_For_HttpResponseMessage_Of_TEntity_Task {
+
+            [DataContract(Namespace = "", Name = "Car")]
+            private class Car {
+
+                [DataMember]
+                public int Id { get; set; }
+
+                [DataMember]
+                public string Make { get; set; }
+
+                [DataMember]
+                public string Model { get; set; }
+
+                [DataMember]
+                public int Year { get; set; }
+
+                [DataMember]
+                public float Price { get; set; }
+            }
+
+            [Fact]
+            public Task GetHttpApiResponseAsync_For_HttpResponseMessage_Of_TEntity_Task_Should_Deserialize_To_TEntity_For_Success_Json() {
+
+                // Arrange
+                HttpResponseMessage response = GetDummy200JsonResponse();
+                IEnumerable<MediaTypeFormatter> formatters = new MediaTypeFormatterCollection();
+                Task<HttpResponseMessage> responseTask = RunDelayed(40, () => response);
+
+                // Act
+                return responseTask.GetHttpApiResponseAsync<IEnumerable<Car>>(formatters)
+
+                    // Assert
+                    .ContinueWith(task => {
+
+                        Assert.Equal(TaskStatus.RanToCompletion, task.Status);
+                        Assert.NotNull(task.Result.Model);
+                    });
+            }
+
+            [Fact]
+            public Task GetHttpApiResponseAsync_For_HttpResponseMessage_Of_TEntity_Task_Should_Deserialize_To_TEntity_For_Success_Xml() {
+
+                // Arrange
+                HttpResponseMessage response = GetDummy200XmlResponse();
+                IEnumerable<MediaTypeFormatter> formatters = new MediaTypeFormatterCollection();
+                Task<HttpResponseMessage> responseTask = RunDelayed(40, () => response);
+
+                // Act
+                return responseTask.GetHttpApiResponseAsync<List<Car>>(formatters)
+
+                    // Assert
+                    .ContinueWith(task => {
+
+                        Assert.Equal(TaskStatus.RanToCompletion, task.Status);
+                        Assert.NotNull(task.Result.Model);
+                    });
+            }
+
+            [Fact]
+            public Task GetHttpApiResponseAsync_For_HttpResponseMessage_Of_TEntity_Task_Should_Deserialize_To_HttpApiError_For_400_Json() {
+
+                // Arrange
+                HttpResponseMessage response = GetDummy400JsonResponse();
+                IEnumerable<MediaTypeFormatter> formatters = new MediaTypeFormatterCollection();
+                Task<HttpResponseMessage> responseTask = RunDelayed(40, () => response);
+
+                // Act
+                return responseTask.GetHttpApiResponseAsync<IEnumerable<Car>>(formatters)
+
+                    // Assert
+                    .ContinueWith(task => {
+
+                        Assert.Equal(TaskStatus.RanToCompletion, task.Status);
+                        Assert.Null(task.Result.Model);
+                        Assert.NotNull(task.Result.HttpError);
+                    });
+            }
+
+            [Fact]
+            public Task GetHttpApiResponseAsync_For_HttpResponseMessage_Of_TEntity_Task_Should_Deserialize_To_HttpApiError_For_400_Xml() {
+
+                // Arrange
+                HttpResponseMessage response = GetDummy400XmlResponse();
+                IEnumerable<MediaTypeFormatter> formatters = new MediaTypeFormatterCollection();
+                Task<HttpResponseMessage> responseTask = RunDelayed(40, () => response);
+
+                // Act
+                return responseTask.GetHttpApiResponseAsync<List<Car>>(formatters)
+
+                    // Assert
+                    .ContinueWith(task => {
+
+                        Assert.Equal(TaskStatus.RanToCompletion, task.Status);
+                        Assert.NotNull(task.Result.HttpError);
+                    });
+            }
+
+            [Fact]
+            public Task GetHttpApiResponseAsync_For_HttpResponseMessage_Of_TEntity_Task_Should_Throw_While_Deserializing_To_TEntity_For_Success_With_No_Proper_Formatter() {
+
+                // Arrange
+                HttpResponseMessage response = GetDummy200XmlResponse();
+                IEnumerable<MediaTypeFormatter> formatters = new List<MediaTypeFormatter> { new JsonMediaTypeFormatter() };
+                Task<HttpResponseMessage> responseTask = RunDelayed(40, () => response);
+
+                // Act
+                return responseTask.GetHttpApiResponseAsync<List<Car>>(formatters)
+
+                    // Assert
+                    .ContinueWith(task => {
+
+                        Assert.Equal(TaskStatus.Faulted, task.Status);
+                        Assert.IsType<InvalidOperationException>(task.Exception.GetBaseException());
+                    });
+            }
+
+            [Fact]
+            public Task GetHttpApiResponseAsync_For_HttpResponseMessage_Of_TEntity_Task_Should_Return_The_Wraped_Direct_Response_For_Any_NonSuccess_Other_Than_400() {
+
+                // Arrange
+                HttpStatusCode httpStatusCode = HttpStatusCode.InternalServerError;
+                HttpResponseMessage response = GetDummyResponse(HttpMethod.Post, new ByteArrayContent(new byte[0]), httpStatusCode);
+                IEnumerable<MediaTypeFormatter> formatters = new MediaTypeFormatterCollection();
+                Task<HttpResponseMessage> responseTask = RunDelayed(40, () => response);
+
+                // Act
+                return responseTask.GetHttpApiResponseAsync<List<Car>>(formatters)
+
+                    // Assert
+                    .ContinueWith(task => {
+
+                        Assert.Equal(TaskStatus.RanToCompletion, task.Status);
+                        Assert.NotNull(task.Result.Response);
+                        Assert.Equal(httpStatusCode, task.Result.Response.StatusCode);
+                    });
+            }
+
+            [Fact]
+            public Task GetHttpApiResponseAsync_For_HttpResponseMessage_Of_TEntity_Task_Should_Propagate_Back_The_Exception_From_ResponseTask() {
+
+                // Arrange
+                IEnumerable<MediaTypeFormatter> formatters = new MediaTypeFormatterCollection();
+                Task<HttpResponseMessage> responseTask = RunDelayed<HttpResponseMessage>(40, () => {
+
+                    // This will throw DivideByZeroException
+                    int left = 1, right = 0;
+                    int result = left / right;
+                    return default(HttpResponseMessage);
+                });
+
+                // Act
+                return responseTask.GetHttpApiResponseAsync<IEnumerable<Car>>(formatters)
+
+                    // Assert
+                    .ContinueWith(task => {
+
+                        Assert.Equal(TaskStatus.Faulted, task.Status);
+                        Assert.IsType<DivideByZeroException>(task.Exception.GetBaseException());
+                    });
+            }
+        }
+
         public class GetHttpApiResponseAsync_For_HttpResponseMessage {

             [Fact]


Updated time display for the Win and Lose menus to use M:SS format

--- GGJ-2014/GGJ-2014/GGJ-2014/Game1.cs
+++ GGJ-2014/GGJ-2014/GGJ-2014/Game1.cs
@@ -402,14 +402,14 @@
                 case MenuScreenType.WIN_MENU:
                     {
                         spriteBatch.Begin();
-                        spriteBatch.DrawString(myFont, string.Format("You beat the game in {0:F} seconds!", timeElaspsed / 1000.0f), new Vector2(20, 100), Color.White);
+                        spriteBatch.DrawString(myFont, string.Format("You beat the game in {0:mms} seconds!", TimeInMillisecondsToString(timeElaspsed)), new Vector2(20, 100), Color.White);
                         spriteBatch.End();
                         break;
                     }
                 case MenuScreenType.LOSE_MENU:
                     {
                         spriteBatch.Begin();
-                        spriteBatch.DrawString(myFont, string.Format("You lost the game in {0:F} seconds!", timeElaspsed / 1000.0f), new Vector2(20, 100), Color.White);
+                        spriteBatch.DrawString(myFont, string.Format("You lost the game in {0:mms} seconds!", TimeInMillisecondsToString(timeElaspsed)), new Vector2(20, 100), Color.White);
                         spriteBatch.End();
                         break;
                     }
@@ -423,6 +423,17 @@
             spriteBatch.End();

             base.Draw(gameTime);
+        }
+
+        public static string TimeInMillisecondsToString(double time)
+        {
+            double seconds = time / 1000.0;
+            time /= 1000.0;
+
+            double minutes = seconds / 60.0;
+            seconds /= 60.0;
+
+            return string.Format("{0:0}:{1:00}", minutes, seconds);
         }
     }
 }


Hash comparison operations

Hash comparison operations

--- Novacoin/Hash.cs
+++ Novacoin/Hash.cs
@@ -17,11 +17,12 @@
  */

 using System;
+using System.Diagnostics.Contracts;
 using System.Linq;

 namespace Novacoin
 {
-    public abstract class Hash
+    public abstract class Hash : IEquatable<Hash>, IComparable<Hash>
     {
         /// <summary>
         /// Array of digest bytes.
@@ -79,6 +80,93 @@
             return h._hashBytes;
         }

+        public bool Equals(Hash item)
+        {
+            if (item == null)
+            {
+                return false;
+            }
+
+            return _hashBytes.SequenceEqual((byte[])item);
+        }
+
+        public int CompareTo(Hash item)
+        {
+            Contract.Requires<ArgumentException>(item.hashSize == hashSize, "Hashes must have the same size.");
+            Contract.Requires<ArgumentException>(item != null, "Null reference is not allowed.");
+
+            if (this > item)
+            {
+                return 1;
+            }
+            else if (this < item)
+            {
+                return -1;
+            }
+
+            return 0;
+        }
+
+        public static bool operator <(Hash a, Hash b)
+        {
+            Contract.Requires<ArgumentException>(a.hashSize == b.hashSize, "Hashes must have the same size.");
+
+            for (int i = a.hashSize; i >= 0; i--)
+            {
+                if (a._hashBytes[i] < b._hashBytes[i])
+                    return true;
+                else if (a._hashBytes[i] > b._hashBytes[i])
+                    return false;
+            }
+
+            return false;
+        }
+
+        public static bool operator <=(Hash a, Hash b)
+        {
+            Contract.Requires<ArgumentException>(a.hashSize == b.hashSize, "Hashes must have the same size.");
+
+            for (int i = a.hashSize; i >= 0; i--)
+            {
+                if (a._hashBytes[i] < b._hashBytes[i])
+                    return true;
+                else if (a._hashBytes[i] > b._hashBytes[i])
+                    return false;
+            }
+
+            return false;
+        }
+
+        public static bool operator >(Hash a, Hash b)
+        {
+            Contract.Requires<ArgumentException>(a.hashSize == b.hashSize, "Hashes must have the same size.");
+
+            for (int i = a.hashSize; i >= 0; i--)
+            {
+                if (a._hashBytes[i] > b._hashBytes[i])
+                    return true;
+                else if (a._hashBytes[i] < b._hashBytes[i])
+                    return false;
+            }
+
+            return false;
+        }
+
+        public static bool operator >=(Hash a, Hash b)
+        {
+            Contract.Requires<ArgumentException>(a.hashSize == b.hashSize, "Hashes must have the same size.");
+
+            for (int i = a.hashSize; i >= 0; i--)
+            {
+                if (a._hashBytes[i] > b._hashBytes[i])
+                    return true;
+                else if (a._hashBytes[i] < b._hashBytes[i])
+                    return false;
+            }
+
+            return true;
+        }
+
         public override string ToString()
         {
             return Interop.ToHex(Interop.ReverseBytes(_hashBytes));


[Modify] Replace it

[Modify] Replace it

--- websocket-sharp/Ext.cs
+++ websocket-sharp/Ext.cs
@@ -844,7 +844,6 @@
     )
     {
       var len = value.Length;
-      var separator = new string (separators);

       var buff = new StringBuilder (32);
       var end = len - 1;
@@ -875,7 +874,7 @@
           continue;
         }

-        if (separator.IndexOf (c) > -1) {
+        if (Array.IndexOf (separators, c) > -1) {
           if (quoted)
             continue;


[Modify] Polish it

[Modify] Polish it

--- websocket-sharp/Ext.cs
+++ websocket-sharp/Ext.cs
@@ -464,10 +464,7 @@
     /// </param>
     internal static string GetValue (this string nameAndValue, char separator)
     {
-      var idx = nameAndValue.IndexOf (separator);
-      return idx > -1 && idx < nameAndValue.Length - 1
-             ? nameAndValue.Substring (idx + 1).Trim ()
-             : null;
+      return nameAndValue.GetValue (separator, false);
     }

     internal static string GetValue (


Adjust git cmd logging

Adjust git cmd logging

--- GitMind/Utils/Git/Private/GitCmd.cs
+++ GitMind/Utils/Git/Private/GitCmd.cs
@@ -4,6 +4,7 @@
 using System.Threading;
 using System.Threading.Tasks;
 using GitMind.ApplicationHandling;
+using GitMind.Common.Tracking;
 using GitMind.Utils.OsSystem;

@@ -71,7 +72,8 @@
 			Timing t = Timing.StartNew();

 			CmdResult2 result = await cmd.RunAsync(GitCmdPath, gitArgs, options, ct);
-			Log.Usage($"{t.ElapsedMs}ms: {result.ToStringShort()}");
+			Log.Debug($"{t.ElapsedMs}ms: {result.ToStringShort()}");
+			Track.Event("git", $"{t.ElapsedMs}ms: {result.ToStringShort()}");
 			return result;
 		}


closes #146

closes #146

--- Library/JobManager.cs
+++ Library/JobManager.cs
@@ -162,23 +162,23 @@
         /// <summary>
         /// Initializes the job manager with the jobs to run and starts it.
         /// </summary>
-        /// <param name="registry">Registry of jobs to run</param>
-        public static void Initialize(Registry registry)
+        /// <param name="registries">Registries of jobs to run</param>
+        public static void Initialize(params Registry[] registries)
         {
-            InitializeWithoutStarting(registry);
+            InitializeWithoutStarting(registries);
             Start();
         }

         /// <summary>
         /// Initializes the job manager with the jobs without starting it.
         /// </summary>
-        /// <param name="registry">Registry of jobs to run</param>
-        public static void InitializeWithoutStarting(Registry registry)
+        /// <param name="registries">Registries of jobs to run</param>
+        public static void InitializeWithoutStarting(params Registry[] registries)
         {
-            if (registry == null)
-                throw new ArgumentNullException("registry");
-
-            CalculateNextRun(registry.Schedules).ToList().ForEach(RunJob);
+            if (registries == null)
+                throw new ArgumentNullException("registries");
+
+            CalculateNextRun(registries.SelectMany(r => r.Schedules)).ToList().ForEach(RunJob);
         }

         /// <summary>


Forwarding /z3exe: flag to Boogie.

Forwarding /z3exe: flag to Boogie.

--- source/Configs.cs
+++ source/Configs.cs
@@ -66,7 +66,7 @@
         public bool printProgress { get; private set; }

         public string inputFile;
-
+
         private List<string> includeFiles;

         public bool newStratifiedInlining { get; private set; }
@@ -143,7 +143,7 @@
         public bool printAllTraces { get; private set; }

         public int maxStaticLoopBound { get; private set; }
-
+
         public bool disableStaticAnalysis { get; private set; }
         public bool useDuality { get; private set; }

@@ -162,7 +162,7 @@
         {
             var inputFlags = FlagReader.read(args);

-            // Go through flags and find the bpl file and
+            // Go through flags and find the bpl file and
             // other flags

             string inputFile = null;
@@ -307,7 +307,7 @@
             siOnly = false;
             annotations = new List<string>();
             maxStaticLoopBound = 0;
-
+
             NonUniformUnfolding = false;
             FwdBckSearch = 0;
             useDI = false;
@@ -693,6 +693,10 @@
             {
                 deepAssertsNoLoop = true;
             }
+            else if (flag.StartsWith("/z3exe:"))
+            {
+                boogieOpts += " " + flag + " ";
+            }
             else if (flag.StartsWith("/z3opt"))
             {
                 boogieOpts += " " + flag + " ";
@@ -762,7 +766,7 @@
                 /**
                  * Normally, the sequentialization adds a context switch before every access to shared variables.
                  * When /cooperative is given, this behaviour is suppressed.
-                 * context switches are only added where explictly specified by a dummy call to corral_yield.
+                 * context switches are only added where explictly specified by a dummy call to corral_yield.
                  **/
                 cooperativeYield = true;
             }


Resized MainWindow.

Resized MainWindow.

--- HCDU.Windows/MainWindow.Designer.cs
+++ HCDU.Windows/MainWindow.Designer.cs
@@ -45,7 +45,7 @@
             this.actionsToolStripMenuItem});
             this.menuStrip1.Location = new System.Drawing.Point(0, 0);
             this.menuStrip1.Name = "menuStrip1";
-            this.menuStrip1.Size = new System.Drawing.Size(1132, 24);
+            this.menuStrip1.Size = new System.Drawing.Size(1008, 24);
             this.menuStrip1.TabIndex = 0;
             this.menuStrip1.Text = "menuStrip1";
             //
@@ -103,14 +103,14 @@
             | System.Windows.Forms.AnchorStyles.Right)));
             this.webBrowserPanel.Location = new System.Drawing.Point(0, 27);
             this.webBrowserPanel.Name = "webBrowserPanel";
-            this.webBrowserPanel.Size = new System.Drawing.Size(1132, 602);
+            this.webBrowserPanel.Size = new System.Drawing.Size(1008, 575);
             this.webBrowserPanel.TabIndex = 1;
             //
             // MainWindow
             //
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1132, 629);
+            this.ClientSize = new System.Drawing.Size(1008, 602);
             this.Controls.Add(this.webBrowserPanel);
             this.Controls.Add(this.menuStrip1);
             this.MainMenuStrip = this.menuStrip1;


CSharp compiler support for paths containing spaces and quotes

--- Oxide.Ext.CSharp/PluginCompiler.cs
+++ Oxide.Ext.CSharp/PluginCompiler.cs
@@ -105,15 +105,16 @@

         private void SpawnCompiler(HashSet<string> references)
         {
-            var arguments = new StringBuilder("/t:library");
+            var arguments = new List<string> { "/t:library" };

             foreach (var reference_name in references)
                 if (reference_name != "mscorlib" && reference_name != "System" && !reference_name.StartsWith("System."))
-                    arguments.AppendFormat(" /r:{0}\\{1}.dll", Interface.GetMod().ExtensionDirectory, reference_name);
-
-            arguments.AppendFormat(" /out:{0}\\{1}_{2}.dll {3}", Interface.GetMod().TempDirectory, plugin.Name, plugin.CompilationCount, plugin.ScriptPath);
-
-            var start_info = new ProcessStartInfo(BinaryPath, arguments.ToString())
+                    arguments.Add(string.Format("/r:{0}\\{1}.dll", Interface.GetMod().ExtensionDirectory, reference_name));
+
+            arguments.Add(string.Format("/out:{0}\\{1}_{2}.dll", Interface.GetMod().TempDirectory, plugin.Name, plugin.CompilationCount));
+            arguments.Add(plugin.ScriptPath);
+
+            var start_info = new ProcessStartInfo(BinaryPath, EscapeArguments(arguments.ToArray()))
             {
                 CreateNoWindow = true,
                 UseShellExecute = false,
@@ -124,8 +125,8 @@
             process = new Process { StartInfo = start_info, EnableRaisingEvents = true };

             startedAt = UnityEngine.Time.realtimeSinceStartup;
-            StdOutput = new StringBuilder("");
-            ErrOutput = new StringBuilder("");
+            StdOutput = new StringBuilder();
+            ErrOutput = new StringBuilder();

             process.OutputDataReceived += OnStdOutput;
             process.ErrorDataReceived += OnErrorOutput;
@@ -167,5 +168,39 @@
             ExitCode = process.ExitCode;
             Interface.GetMod().NextTick(() => callback(ExitCode == 0));
         }
+
+        /// <summary>
+        /// Quotes all arguments that contain whitespace, or begin with a quote and returns a single argument string
+        /// </summary>
+        /// <param name="args">A list of strings for arguments, may not contain null, '\0', '\r', or '\n'</param>
+        /// <returns>A string containing the combined list of escaped/quoted strings</returns>
+        /// <exception cref="System.ArgumentNullException">Raised when one of the arguments is null</exception>
+        /// <exception cref="System.ArgumentOutOfRangeException">Raised if an argument contains '\0', '\r', or '\n'</exception>
+        private string EscapeArguments(params string[] args)
+        {
+            var arguments = new StringBuilder();
+            var invalid_char = new Regex("[\x00\x0a\x0d]");  // these can not be escaped
+            var needs_quotes = new Regex(@"\s|""");          // contains whitespace or two quote characters
+            var escape_quote = new Regex(@"(\\*)(""|$)");    // one or more '\' followed with a quote or end of string
+            for (int i = 0; args != null && i < args.Length; i++)
+            {
+                if (args[i] == null) throw new ArgumentNullException("args[" + i + "]");
+                if (invalid_char.IsMatch(args[i])) throw new ArgumentOutOfRangeException("args[" + i + "]");
+                if (args[i] == String.Empty)
+                    arguments.Append("\"\"");
+                else if (!needs_quotes.IsMatch(args[i]))
+                    arguments.Append(args[i]);
+                else
+                {
+                    arguments.Append('"');
+                    arguments.Append(escape_quote.Replace(args[i], m =>
+                        m.Groups[1].Value + m.Groups[1].Value + (m.Groups[2].Value == "\"" ? "\\\"" : ""))
+                    );
+                    arguments.Append('"');
+                }
+                if (i + 1 < args.Length) arguments.Append(' ');
+            }
+            return arguments.ToString();
+        }
     }
 }


Added a remove spaces method to santize strings.

--- LINQToTTreeHelpers/LINQToTreeHelpers/Utils.cs
+++ LINQToTTreeHelpers/LINQToTreeHelpers/Utils.cs
@@ -3,6 +3,12 @@
 {
     internal static class Utils
     {
+        /// <summary>
+        /// Write out an object. Eventually, with ROOTNET improvements this will work better and perahps
+        /// won't be needed!
+        /// </summary>
+        /// <param name="obj"></param>
+        /// <param name="dir"></param>
         public static void InternalWriteObject(this ROOTNET.Interface.NTObject obj, ROOTNET.Interface.NTDirectory dir)
         {
             var h = obj as ROOTNET.Interface.NTH1;
@@ -18,5 +24,24 @@
                 obj.SetNull();
             }
         }
+
+        /// <summary>
+        /// Take a string and "sanatize" it for a root name.
+        /// </summary>
+        /// <param name="name">Text name to be used as a ROOT name</param>
+        /// <returns>argument name with spaces removes, as well as other characters</returns>
+        public static string FixupForROOTName(this string name)
+        {
+            var result = name.Replace(" ", "");
+            result = result.Replace("_{", "");
+            result = result.Replace("{", "");
+            result = result.Replace("}", "");
+            result = result.Replace("-", "");
+            result = result.Replace("\\", "");
+            result = result.Replace("%", "");
+            result = result.Replace("<", "");
+            result = result.Replace(">", "");
+            return result;
+        }
     }
 }


removed unused file

removed unused file

--- Liquid.NET.Tests/Filters/LookupFilterTests.cs
+++ Liquid.NET.Tests/Filters/LookupFilterTests.cs
@@ -1,130 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-using Liquid.NET.Constants;
-using Liquid.NET.Tests.Filters.Array;
-
-using NUnit.Framework;
-
-namespace Liquid.NET.Tests.Filters
-{
-    [TestFixture]
-    [Ignore("TO DELETE when replaced with IndexDereferencer")]
-    public class LookupFilterTests
-    {
-        private static String LOOKUP = "lookup";
-
-        [Test]
-        [TestCase("3", "false")]
-        [TestCase("4", "")]
-        [TestCase("30", "")]
-        [TestCase("-1", "false")]
-        [TestCase("-2", "456.0")]
-        [TestCase("-4", "a string")]
-        [TestCase("-5", "")]
-        [TestCase("4", "")]
-        [TestCase("-30", "")]
-        public void It_Should_Look_Up_ArrayValues(String index, String expected)
-        {
-            // Arrange
-            TemplateContext ctx = new TemplateContext();
-            var liquidCollection = DataFixtures.CreateArrayValue();
-            ctx.DefineLocalVariable("myarray", liquidCollection);
-            String tmpl = "{{ myarray | " + LOOKUP + ": "+index+" }}";
-
-            // Act
-            var result = RenderingHelper.RenderTemplate(tmpl, ctx);
-
-            // Assert
-            //var expected = ValueCaster.RenderAsString(liquidCollection.ArrValue[3]);
-            Assert.That(result, Is.EqualTo(expected));
-        }
-
-        [Test]
-        [TestCase("mydict.field1", "Property 1")]
-        [TestCase("mydict | lookup: \"field1\"", "Property 1")]
-        [TestCase("mydict[\"field1\"]", "Property 1")]
-        [TestCase("mydict[\"qwefqwefwef\"]", "")]
-        public void It_Should_Look_Up_DictionaryValues(String liquid, String expected)
-        {
-            // Arrange
-            TemplateContext ctx = new TemplateContext();
-            var dictValue = DataFixtures.CreateDictionary(1, "Property 1", "prop2");
-            ctx.DefineLocalVariable("mydict", dictValue);
-            String tmpl = "{{ "+liquid+" }}";
-
-            // Act
-            var result = RenderingHelper.RenderTemplate(tmpl, ctx);
-
-            // Assert
-            Assert.That(result, Is.EqualTo(expected));
-        }
-
-        [Test]
-        [TestCase("{% assign str = \"A String\" %}{{str[0]}}", "A")]
-        [TestCase("{% assign str = \"A String\" %}{{str[-1]}}", "g")]
-        [TestCase("{% assign str = \"A String\" %}{{str[-20]}}", "")]
-        [TestCase("{% assign str = \"\" %}{{str[0]}}", "")]
-        public void It_Should_Look_Up_StringValues(String input, String expected)
-        {
-
-            // Act
-            var result = RenderingHelper.RenderTemplate(input);
-
-            // Assert
-            Assert.That(result, Is.EqualTo(expected));
-        }
-
-
-        [Test]
-        // see: https://github.com/Shopify/liquid/issues/543
-        [TestCase("first", "a string")]
-        [TestCase("last", "false")]
-        [TestCase("size", "4")]
-        public void It_Should_Dereference_Properties_Of_Array(String property, String expected)
-        {
-            // Arrange
-            TemplateContext ctx = new TemplateContext();
-            var liquidCollection = DataFixtures.CreateArrayValue();
-            ctx.DefineLocalVariable("myarray", liquidCollection);
-            String tmpl = "{{ myarray."+property+" }}";
-
-            // Act
-            var result = RenderingHelper.RenderTemplate(tmpl, ctx);
-
-            // Assert
-            Assert.That(result, Is.EqualTo(expected));
-        }
-
-        [Test]
-        [TestCase("size")]
-        public void It_Should_Dereference_Properties_Of_Dictionary(String property)
-        {
-            // Arrange
-            TemplateContext ctx = new TemplateContext();
-            var dictValue = DataFixtures.CreateDictionary(1, "Property 1", "prop2");
-            ctx.DefineLocalVariable("mydict", dictValue);
-            String tmpl = "{{ mydict." + property + " }}";
-
-            // Act
-            var result = RenderingHelper.RenderTemplate(tmpl, ctx);
-
-            // Assert
-            Assert.That(result, Is.EqualTo(dictValue.DictValue.Count.ToString()));
-        }
-
-        public ArrayValue CreateArrayOfDicts()
-        {
-            // Arrange
-            IList<IExpressionConstant> objlist = new List<IExpressionConstant>
-            {
-                DataFixtures.CreateDictionary(1, "Value 1 A", "Value 1 B"),
-                DataFixtures.CreateDictionary(2, "Value 2 A", "Value 2 B"),
-                DataFixtures.CreateDictionary(3, "Value 3 A", "Value 3 B"),
-                DataFixtures.CreateDictionary(4, "Value 4 A", "Value 4 B"),
-            };
-            return new ArrayValue(objlist);
-
-        }
-    }
-}


Fix a bug of android notify

Fix a bug of android notify

--- src/Android/UI.Android.cs
+++ src/Android/UI.Android.cs
@@ -18,10 +18,15 @@
     [Activity]
     class NotificationRedirectActivity : Activity
     {
-        public NotificationRedirectActivity()
-        {
+        protected override void OnStart()
+        {
+            base.OnStart();
             Finish();
-
+        }
+
+        protected override void OnDestroy()
+        {
+            base.OnDestroy();
             if (AppUI._notificationTcs != null)
             {
                 AppUI._notificationTcs.TrySetResult(true);


[Modify] Polish it

[Modify] Polish it

--- websocket-sharp/Server/WebSocketServer.cs
+++ websocket-sharp/Server/WebSocketServer.cs
@@ -1131,12 +1131,12 @@
     ///   <paramref name="path"/> is already in use.
     ///   </para>
     /// </exception>
-    public void AddWebSocketService<TBehaviorWithNew> (
-      string path, Action<TBehaviorWithNew> initializer
+    public void AddWebSocketService<TBehavior> (
+      string path, Action<TBehavior> initializer
     )
-      where TBehaviorWithNew : WebSocketBehavior, new ()
-    {
-      _services.AddService<TBehaviorWithNew> (path, initializer);
+      where TBehavior : WebSocketBehavior, new ()
+    {
+      _services.AddService<TBehavior> (path, initializer);
     }

     /// <summary>


use a HashSet

use a HashSet

--- src/AutoMapper/TypeMap.cs
+++ src/AutoMapper/TypeMap.cs
@@ -26,7 +26,7 @@
         private readonly List<SourceMemberConfig> _sourceMemberConfigs = new List<SourceMemberConfig>();
         private PropertyMap[] _orderedPropertyMaps;
         private bool _sealed;
-        private readonly List<TypeMap> _inheritedTypeMaps = new List<TypeMap>();
+        private readonly HashSet<TypeMap> _inheritedTypeMaps = new HashSet<TypeMap>();
         private readonly List<(TypeMap, LambdaExpression)> _includedMembersTypeMaps = new List<(TypeMap, LambdaExpression)>();
         private readonly List<ValueTransformerConfiguration> _valueTransformerConfigs = new List<ValueTransformerConfiguration>();

@@ -304,10 +304,7 @@
             return config;
         }

-        public void AddInheritedMap(TypeMap inheritedTypeMap)
-        {
-            _inheritedTypeMaps.Add(inheritedTypeMap);
-        }
+        public bool AddInheritedMap(TypeMap inheritedTypeMap) => _inheritedTypeMaps.Add(inheritedTypeMap);

         private void ApplyIncludedMemberTypeMap((TypeMap, LambdaExpression) includedMember)
         {
@@ -368,7 +365,7 @@
             inheritedTypeMap.PathMaps.Where(
                     baseConfig => PathMaps.All(derivedConfig => derivedConfig.MemberPath != baseConfig.MemberPath)).ToArray();

-        internal void CopyInheritedMapsTo(TypeMap typeMap) => typeMap._inheritedTypeMaps.AddRange(_inheritedTypeMaps);
+        internal void CopyInheritedMapsTo(TypeMap typeMap) => typeMap._inheritedTypeMaps.UnionWith(_inheritedTypeMaps);

         private IEnumerable<IMemberMap> GetConstructorMemberMaps()
             => CustomCtorExpression != null


Fixed correctly open browser with the retrieved url.

--- Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/GDataDBRequestFactory.cs
+++ Assets/QuickSheet/GDataPlugin/Editor/GDataDB/GDataDB/Impl/GDataDBRequestFactory.cs
@@ -7,16 +7,22 @@
 ///////////////////////////////////////////////////////////////////////////////

 using UnityEngine;
-using System.Collections;
+using UnityEditor;
+using System;
 using System.Collections.Generic;
 using Google.GData.Client;
 using Google.GData.Spreadsheets;
-
 using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;

 namespace GDataDB.Impl
 {
+    /// <summary>
+    /// Handles OAuth2 credentials to access on google spreadsheets.
+    ///
+    /// Note that it needs json type of private key to get access code.
+    ///
+    /// </summary>
     public class GDataDBRequestFactory
     {
         const string SCOPE = "https://www.googleapis.com/auth/drive https://spreadsheets.google.com/feeds https://docs.google.com/feeds";
@@ -60,21 +66,36 @@

             // Retrieves the Authorization URL
             parameters.Scope = SCOPE;
-            parameters.AccessType = "offline"; // IMPORTANT and was missing in the original
-            parameters.TokenType = TOKEN_TYPE; // IMPORTANT and was missing in the original
+            parameters.AccessType = "offline"; // IMPORTANT
+            parameters.TokenType = TOKEN_TYPE; // IMPORTANT

             string authorizationUrl = OAuthUtil.CreateOAuth2AuthorizationUrl(parameters);
             Debug.Log(authorizationUrl);
-            Debug.Log("Please visit the URL above to authorize your OAuth "
-                  + "request token.  Once that is complete, type in your access code to "
-                  + "continue...");
+            //Debug.Log("Please visit the URL above to authorize your OAuth "
+            //      + "request token.  Once that is complete, type in your access code to "
+            //      + "continue...");

             parameters.AccessCode = accessCode;

-            if (string.IsNullOrEmpty(parameters.AccessCode))
+            if (IsValidURL(authorizationUrl))
             {
                 Application.OpenURL(authorizationUrl);
+                const string message = @"Copy the 'Access Code' on your browser into the access code textfield.";
+                EditorUtility.DisplayDialog("Info", message, "OK");
             }
+            else
+                EditorUtility.DisplayDialog("Error", "Invalid URL: " + authorizationUrl, "OK");
+        }
+
+        /// <summary>
+        ///  Check whether the given string is a valid http or https URL.
+        /// </summary>
+        private static bool IsValidURL(string url)
+        {
+            Uri uriResult;
+            return (Uri.TryCreate(url, UriKind.Absolute, out uriResult) &&
+                                (uriResult.Scheme == Uri.UriSchemeHttp ||
+                                 uriResult.Scheme == Uri.UriSchemeHttps));
         }

         public static void FinishAuthenticate()
@@ -85,8 +106,8 @@
             parameters.RedirectUri = REDIRECT_URI;

             parameters.Scope = SCOPE;
-            parameters.AccessType = "offline"; // IMPORTANT and was missing in the original
-            parameters.TokenType = TOKEN_TYPE; // IMPORTANT and was missing in the original
+            parameters.AccessType = "offline"; // IMPORTANT
+            parameters.TokenType = TOKEN_TYPE; // IMPORTANT

             parameters.AccessCode = GoogleDataSettings.Instance._AccessCode;


:name_badge: Rename TestCase

:name_badge: Rename TestCase

* リネーム漏れてた

--- Assets/Tests/Scripts/UnityModule/AnimationEventDispatcher/GeneralDispatcherTest.cs
+++ Assets/Tests/Scripts/UnityModule/AnimationEventDispatcher/GeneralDispatcherTest.cs
@@ -8,7 +8,7 @@

 namespace Tests.UnityModule {

-    public class AnimationEventDispatcherTest {
+    public class GeneralDispatcherTest {

         [UnityTest]
         public IEnumerator OnDispatchAsObservableTest() {


clean

clean

--- CSharpGL/0Foundations/OpenGLObjects/Buffers/VertexBuffers/VertexAttributeBuffer.cs
+++ CSharpGL/0Foundations/OpenGLObjects/Buffers/VertexBuffers/VertexAttributeBuffer.cs
@@ -3,9 +3,10 @@
     /// <summary>
     /// 顶点属性Buffer。描述顶点的位置或颜色或UV等各种属性。
     /// <para>每个<see cref="VertexAttributeBuffer<T>"/>仅描述其中一个属性。</para>
-    /// <para>Vertex Buffer Object that describes vertex' property(position, color, uv coordinate, ect.).</para>
+    /// <para>Vertex Buffer Object that describes vertex' property(position, color, uv coordinate, etc.).</para>
     /// <para>Each <see cref="VertexAttributeBuffer<T>"/> describes only 1 property.</para>
-    /// <para>Note: If <typeparamref name="T"/> matches one of this.Config's value, then (this.ByteLength / (this.DataSize * this.DataTypeByteLength)) equals (this.Length).</para>
+    /// <para>Note: If <typeparamref name="T"/> matches one of this.Config's value, then (Ptr.ByteLength / (Ptr.DataSize * Ptr.DataTypeByteLength)) equals (Ptr.Length).</para>
+    /// <para><typeparamref name="T"/> is type of element of this array in application level.</para>
     /// </summary>
     /// <typeparam name="T">element type in this array in application level.</typeparam>
     public class VertexAttributeBuffer<T> : Buffer where T : struct
@@ -13,8 +14,10 @@
         /// <summary>
         /// 顶点属性Buffer。描述顶点的位置或颜色或UV等各种属性。
         /// <para>每个<see cref="VertexAttributeBuffer<T>"/>仅描述其中一个属性。</para>
-        /// <para>Vertex Buffer Object that describes vertex' property(position, color, uv coordinate, ect.).</para>
+        /// <para>Vertex Buffer Object that describes vertex' property(position, color, uv coordinate, etc.).</para>
         /// <para>Each <see cref="VertexAttributeBuffer<T>"/> describes only 1 property.</para>
+        /// <para>Note: If <typeparamref name="T"/> matches one of this.Config's value, then (Ptr.ByteLength / (Ptr.DataSize * Ptr.DataTypeByteLength)) equals (Ptr.Length).</para>
+        /// <para><typeparamref name="T"/> is type of element of this array in application level.</para>
         /// </summary>
         /// <param name="varNameInVertexShader">此顶点属性VBO对应于vertex shader中的哪个in变量？<para>Mapping variable's name in vertex shader.</para></param>
         /// <param name="config">This <paramref name="config"/> decides parameters' values in glVertexAttribPointer(attributeLocation, size, type, false, 0, IntPtr.Zero);