Update TestCaseNestedMenus with NUnit tests

--- osu.Framework.Desktop.Tests/Visual/TestCaseNestedMenus.cs
+++ osu.Framework.Desktop.Tests/Visual/TestCaseNestedMenus.cs
@@ -15,6 +15,7 @@
 using OpenTK;
 using OpenTK.Input;
 using MouseState = osu.Framework.Input.MouseState;
+using NUnit.Framework;

 namespace osu.Framework.Desktop.Tests.Visual
 {
@@ -26,50 +27,53 @@
         private Random rng;

         private ManualInputManager inputManager;
-        private readonly Container menuContainer;
         private MenuStructure menus;

         public TestCaseNestedMenus()
         {
-            Add(menuContainer = new Container { RelativeSizeAxes = Axes.Both });
-
-            testReset(false);
-
-            AddStep("Add automated InputManager", delegate
-            {
-                if (inputManager != null) return;
-
-                Remove(menuContainer);
-
-                Add(inputManager = new ManualInputManager
-                {
-                    Children = new Drawable[]
+            rng = new Random(1337);
+
+            Add(createMenu());
+        }
+
+        [SetUp]
+        public void SetUp()
+        {
+            Clear();
+
+            rng = new Random(1337);
+
+            Menu menu;
+            Add(inputManager = new ManualInputManager
+            {
+                UseParentState = false,
+                Children = new Drawable[]
+                {
+                    new CursorContainer(),
+                    new Container
                     {
-                        new CursorContainer(),
-                        menuContainer
+                        RelativeSizeAxes = Axes.Both,
+                        Child = menu = createMenu()
                     }
-                });
-            });
-
-            testAlwaysOpen();
-            testHoverState();
-            testRequireClickToOpen();
-            testDoubleClick();
-            testActionClick();
-            testInstantOpen();
-            testHoverOpen();
-            testHoverChange();
-            testDelayedHoverChange();
-            testMenuClicksDontClose();
-            testMenuClickClosesSubMenus();
-            testActionClickClosesMenus();
-            testClickingOutsideClosesMenus(false);
-            testClickingOutsideClosesMenus(true);
-
-            AddStep("Give back control", () => testReset(false, true));
-
-            // Todo: Convert all of these to NUnit tests after https://github.com/ppy/osu-framework/issues/1014 is resolved
-        }
+                }
+            });
+
+            menus = new MenuStructure(menu);
+            inputManager.MoveMouseTo(Vector2.Zero);
+        }
+
+        private Menu createMenu() => new ClickOpenMenu(TimePerAction)
+        {
+            Anchor = Anchor.Centre,
+            Origin = Anchor.Centre,
+            AlwaysOpen = true,
+            Items = new[]
+            {
+                generateRandomMenuItem("First"),
+                generateRandomMenuItem("Second"),
+                generateRandomMenuItem("Third"),
+            }
+        };

         private class ClickOpenMenu : Menu
         {
@@ -83,53 +87,14 @@
         }

         #region Test Cases
-        /// <summary>
-        /// Blocks all user input and resets the <see cref="Menu"/>.
-        /// </summary>
-        private void testReset(bool step = true, bool userControl = false)
-        {
-            var reset = new Action(() =>
-            {
-                rng = new Random(1337);
-
-                var menu = new ClickOpenMenu(TimePerAction)
-                {
-                    Anchor = Anchor.Centre,
-                    Origin = Anchor.Centre,
-                    AlwaysOpen = true,
-                    Items = new[]
-                    {
-                        generateRandomMenuItem("First"),
-                        generateRandomMenuItem("Second"),
-                        generateRandomMenuItem("Third"),
-                    }
-                };
-
-                menuContainer.Clear();
-                menuContainer.Add(menu);
-                menus = new MenuStructure(menu);
-
-                if (inputManager != null)
-                {
-                    inputManager.UseParentState = userControl;
-                    inputManager.MoveMouseTo(Vector2.Zero);
-                }
-            });
-
-            if (step)
-                AddStep("Reset", reset);
-            else
-                reset();
-        }

         /// <summary>
         /// Tests if the <see cref="Menu"/> respects <see cref="Menu.AlwaysOpen"/> = true, by not alowing it to be closed
         /// when a click happens outside the <see cref="Menu"/>.
         /// </summary>
-        private void testAlwaysOpen()
-        {
-            testReset();
-
+        [Test]
+        public void TestAlwaysOpen()
+        {
             AddStep("Click outside", () => inputManager.Click(MouseButton.Left));
             AddAssert("Check AlwaysOpen = true", () => menus.GetSubMenu(0).State == MenuState.Open);
         }
@@ -137,10 +102,9 @@
         /// <summary>
         /// Tests if the hover state on <see cref="Menu.DrawableMenuItem"/>s is valid.
         /// </summary>
-        private void testHoverState()
-        {
-            testReset();
-
+        [Test]
+        public void TestHoverState()
+        {
             AddAssert("Check submenu closed", () => menus.GetSubMenu(1)?.State != MenuState.Open);
             AddStep("Hover item", () => inputManager.MoveMouseTo(menus.GetMenuItem(0)));
             AddAssert("Check item hovered", () => menus.GetMenuItem(0).IsHovered);
@@ -149,10 +113,9 @@
         /// <summary>
         /// Tests if the <see cref="Menu"/> respects <see cref="Menu.RequireClickToOpen"/> = true.
         /// </summary>
-        private void testRequireClickToOpen()
-        {
-            testReset();
-
+        [Test]
+        public void TestRequireClickToOpen()
+        {
             AddStep("Hover item", () => inputManager.MoveMouseTo(menus.GetSubStructure(0).GetMenuItem(0)));
             AddAssert("Check closed", () => menus.GetSubMenu(1)?.State != MenuState.Open);
             AddAssert("Check closed", () => menus.GetSubMenu(1)?.State != MenuState.Open);
@@ -164,10 +127,9 @@
         /// Tests if clicking once on a menu that has <see cref="Menu.RequireClickToOpen"/> opens it, and clicking a second time
         /// closes it.
         /// </summary>
-        private void testDoubleClick()
-        {
-            testReset();
-
+        [Test]
+        public void TestDoubleClick()
+        {
             AddStep("Click item", () => clickItem(0, 0));
             AddAssert("Check open", () => menus.GetSubMenu(1).State == MenuState.Open);
             AddStep("Click item", () => clickItem(0, 0));
@@ -177,10 +139,9 @@
         /// <summary>
         /// Tests whether click on <see cref="Menu.DrawableMenuItem"/>s causes sub-menus to instantly appear.
         /// </summary>
-        private void testInstantOpen()
-        {
-            testReset();
-
+        [Test]
+        public void TestInstantOpen()
+        {
             AddStep("Click item", () => clickItem(0, 1));
             AddAssert("Check open", () => menus.GetSubMenu(1).State == MenuState.Open);
             AddStep("Click item", () => clickItem(1, 0));
@@ -190,10 +151,9 @@
         /// <summary>
         /// Tests if clicking on an item that has no sub-menu causes the menu to close.
         /// </summary>
-        private void testActionClick()
-        {
-            testReset();
-
+        [Test]
+        public void TestActionClick()
+        {
             AddStep("Click item", () => clickItem(0, 0));
             AddStep("Click item", () => clickItem(1, 0));
             AddAssert("Check closed", () => menus.GetSubMenu(1)?.State != MenuState.Open);
@@ -202,10 +162,9 @@
         /// <summary>
         /// Tests if hovering over menu items respects the <see cref="Menu.HoverOpenDelay"/>.
         /// </summary>
-        private void testHoverOpen()
-        {
-            testReset();
-
+        [Test]
+        public void TestHoverOpen()
+        {
             AddStep("Click item", () => clickItem(0, 1));
             AddStep("Hover item", () => inputManager.MoveMouseTo(menus.GetSubStructure(1).GetMenuItem(0)));
             AddAssert("Check closed", () => menus.GetSubMenu(2)?.State != MenuState.Open);
@@ -219,10 +178,9 @@
         /// Tests if hovering over a different item on the main <see cref="Menu"/> will instantly open another menu
         /// and correctly changes the sub-menu items to the new items from the hovered item.
         /// </summary>
-        private void testHoverChange()
-        {
-            testReset();
-
+        [Test]
+        public void TestHoverChange()
+        {
             IReadOnlyList<MenuItem> currentItems = null;
             AddStep("Click item", () =>
             {
@@ -261,10 +219,9 @@
         /// Tests whether hovering over a different item on a sub-menu opens a new sub-menu in a delayed fashion
         /// and correctly changes the sub-menu items to the new items from the hovered item.
         /// </summary>
-        private void testDelayedHoverChange()
-        {
-            testReset();
-
+        [Test]
+        public void TestDelayedHoverChange()
+        {
             AddStep("Click item", () => clickItem(0, 2));
             AddStep("Hover item", () => inputManager.MoveMouseTo(menus.GetSubStructure(1).GetMenuItem(0)));
             AddAssert("Check closed", () => menus.GetSubMenu(2)?.State != MenuState.Open);
@@ -302,10 +259,9 @@
         /// <summary>
         /// Tests whether clicking on <see cref="Menu"/>s that have opened sub-menus don't close the sub-menus.
         /// </summary>
-        private void testMenuClicksDontClose()
-        {
-            testReset();
-
+        [Test]
+        public void TestMenuClicksDontClose()
+        {
             AddStep("Click item", () => clickItem(0, 1));
             AddStep("Click item", () => clickItem(1, 0));
             AddStep("Click item", () => clickItem(2, 0));
@@ -334,10 +290,9 @@
         /// <summary>
         /// Tests whether clicking on the <see cref="Menu"/> that has <see cref="Menu.RequireClickToOpen"/> closes all sub menus.
         /// </summary>
-        private void testMenuClickClosesSubMenus()
-        {
-            testReset();
-
+        [Test]
+        public void TestMenuClickClosesSubMenus()
+        {
             AddStep("Click item", () => clickItem(0, 1));
             AddStep("Click item", () => clickItem(1, 0));
             AddStep("Click item", () => clickItem(2, 0));
@@ -360,10 +315,9 @@
         /// <summary>
         /// Tests whether clicking on an action in a sub-menu closes all <see cref="Menu"/>s.
         /// </summary>
-        private void testActionClickClosesMenus()
-        {
-            testReset();
-
+        [Test]
+        public void TestActionClickClosesMenus()
+        {
             AddStep("Click item", () => clickItem(0, 1));
             AddStep("Click item", () => clickItem(1, 0));
             AddStep("Click item", () => clickItem(2, 0));
@@ -387,10 +341,10 @@
         /// Tests whether clicking outside the <see cref="Menu"/> structure closes all sub-menus.
         /// </summary>
         /// <param name="hoverPrevious">Whether the previous menu should first be hovered before clicking outside.</param>
-        private void testClickingOutsideClosesMenus(bool hoverPrevious)
-        {
-            testReset();
-
+        [TestCase(false)]
+        [TestCase(true)]
+        public void TestClickingOutsideClosesMenus(bool hoverPrevious)
+        {
             for (int i = 0; i <= 3; i++)
             {
                 int i2 = i;


Add clearSelection method

Add clearSelection method

--- osu.Game/Rulesets/Edit/Layers/Selection/SelectionLayer.cs
+++ osu.Game/Rulesets/Edit/Layers/Selection/SelectionLayer.cs
@@ -27,12 +27,11 @@
         private SelectionBox selectionBox;
         private CaptureBox captureBox;

-        private readonly List<DrawableHitObject> capturedHitObjects = new List<DrawableHitObject>();
+        private readonly List<DrawableHitObject> selectedHitObjects = new List<DrawableHitObject>();

         protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
         {
-            capturedHitObjects.Clear();
-            captureBox?.Hide();
+            clearSelection();
             return true;
         }

@@ -72,13 +71,22 @@
         }

         /// <summary>
+        /// Deselects all selected <see cref="DrawableHitObject"/>s.
+        /// </summary>
+        private void clearSelection()
+        {
+            selectedHitObjects.Clear();
+            captureBox?.Hide();
+        }
+
+        /// <summary>
         /// Captures all hitobjects that are present within the area of a <see cref="Quad"/>.
         /// </summary>
         /// <param name="screenSpaceQuad">The capture <see cref="Quad"/>.</param>
         private void captureQuad(Quad screenSpaceQuad)
         {
             foreach (var obj in playfield.HitObjects.Objects.Where(h => h.IsAlive && h.IsPresent && screenSpaceQuad.Contains(h.SelectionPoint)))
-                capturedHitObjects.Add(obj);
+                selectedHitObjects.Add(obj);
         }

         /// <summary>
@@ -91,12 +99,12 @@
             if (captured == null)
                 return;

-            capturedHitObjects.Add(captured);
+            selectedHitObjects.Add(captured);
         }

         private void finishCapture(bool fromDrag)
         {
-            if (capturedHitObjects.Count == 0)
+            if (selectedHitObjects.Count == 0)
                 return;

             // Due to https://github.com/ppy/osu-framework/issues/1382, we may get here through both
@@ -104,9 +112,9 @@
             captureBox?.Hide();

             if (fromDrag)
-                AddInternal(captureBox = new DragCaptureBox(this, capturedHitObjects.ToList(), selectionBox.Position, selectionBox.Size));
+                AddInternal(captureBox = new DragCaptureBox(this, selectedHitObjects.ToList(), selectionBox.Position, selectionBox.Size));
             else
-                AddInternal(captureBox = new InstantCaptureBox(this, capturedHitObjects.ToList()));
+                AddInternal(captureBox = new InstantCaptureBox(this, selectedHitObjects.ToList()));
         }
     }
 }


[trunk] VSSolution support for publishing. Dependencies are copied next to the primary module

--- packages/Publisher/dev/VSSolutionBuilder/ProductModule.cs
+++ packages/Publisher/dev/VSSolutionBuilder/ProductModule.cs
@@ -7,7 +7,11 @@
 {
     public sealed partial class VSSolutionBuilder
     {
-        private static void CopyNodes(IProject toProject, Opus.Core.DependencyNode toCopy)
+        private static void
+        CopyNodes(
+            Publisher.ProductModule moduleToBuild,
+            IProject toProject,
+            Opus.Core.DependencyNode toCopy)
         {
             var configCollection = toProject.Configurations;
             // TODO: this should be done from the base target!
@@ -22,13 +26,19 @@
                 configuration.AddToolIfMissing(vcPostBuildEventTool);
             }

+            // TODO: the key needs to be on an options interface or similiar
             var sourceLoc = toCopy.Module.Locations[C.Application.OutputFile];
             var sourcePath = sourceLoc.GetSingleRawPath();
+
             var destinationDir = configuration.OutputDirectory;
+            var destinationDirPath = destinationDir.GetSingleRawPath();
+
+            var newKeyName = Publisher.ProductModuleUtilities.GetPublishedKeyName(toCopy.Module, toCopy.Module, C.Application.OutputFile);
+            var primaryKey = new Opus.Core.LocationKey(newKeyName, Opus.Core.ScaffoldLocation.ETypeHint.File);
+            var destPath = Publisher.ProductModuleUtilities.GenerateDestinationPath(sourcePath, destinationDirPath, moduleToBuild, primaryKey);

             var commandLine = new System.Text.StringBuilder();
-            commandLine.AppendFormat("IF NOT EXIST \"{0}\" MKDIR \"{0}\"{1}", destinationDir, System.Environment.NewLine);
-            commandLine.AppendFormat("cmd.exe /c COPY \"{0}\" \"{1}\"{2}", sourcePath, destinationDir, System.Environment.NewLine);
+            commandLine.AppendFormat("cmd.exe /c COPY \"{0}\" \"{1}\"{2}", sourcePath, destPath, System.Environment.NewLine);

             {
                 string attributeName = null;
@@ -57,11 +67,39 @@
             }
         }

-        public object Build(Publisher.ProductModule moduleToBuild, out bool success)
+        public object
+        Build(
+            Publisher.ProductModule moduleToBuild,
+            out bool success)
         {
             var primaryNode = Publisher.ProductModuleUtilities.GetPrimaryNode(moduleToBuild);
             var projectData = primaryNode.Data as IProject;
-            CopyNodes(projectData, primaryNode);
+
+            foreach (var dependency in primaryNode.ExternalDependents)
+            {
+                var module = dependency.Module;
+                var moduleType = module.GetType();
+                var flags = System.Reflection.BindingFlags.Instance |
+                            System.Reflection.BindingFlags.NonPublic;
+                var fields = moduleType.GetFields(flags);
+                foreach (var field in fields)
+                {
+                    var candidates = field.GetCustomAttributes(typeof(Publisher.PublishModuleDependencyAttribute), false);
+                    if (0 == candidates.Length)
+                    {
+                        continue;
+                    }
+                    if (candidates.Length > 1)
+                    {
+                        throw new Opus.Core.Exception("More than one publish module dependency found");
+                    }
+                    var candidateData = field.GetValue(module) as Opus.Core.Array<Opus.Core.LocationKey>;
+                    foreach (var key in candidateData)
+                    {
+                        CopyNodes(moduleToBuild, projectData, module.OwningNode);
+                    }
+                }
+            }

             success = true;
             return null;


Automatically dispose simulation after successful completion

--- src/SME/Simulation.cs
+++ src/SME/Simulation.cs
@@ -322,6 +322,7 @@
             finally
             {
 				Scope.Current.Clock.Clear();
+                this.Dispose();
 			}
 		}


ios6: new enum values for new PKCS supported SHA formats


First run at sorting columns in FeedView

--- src/Summa/FeedView.cs
+++ src/Summa/FeedView.cs
@@ -67,9 +67,17 @@
             trender.Ellipsize = Pango.EllipsizeMode.End;

             // set up the columns for the view
-            InsertColumn(-1, "Read", new Gtk.CellRendererPixbuf(), "pixbuf", 0);
+            TreeViewColumn column_Read = new Gtk.TreeViewColumn("Read", new Gtk.CellRendererPixbuf(), "pixbuf", 0);
+            column_Read.SortColumnId = 0;
+            column_Read.SortIndicator = true;
+            AppendColumn(column_Read);
+
             InsertColumn(-1, "Name", trender, "text", 1);

+            HeadersClickable = true;
+            RulesHint = true;
+            store.SetSortColumnId(0, Gtk.SortType.Descending);
+
             // set up the icon theme so that we can make stuff pretty
             icon_theme = Gtk.IconTheme.Default;
         }


Implement basic creation of shortcuts in Update.exe

--- src/Update/Program.cs
+++ src/Update/Program.cs
@@ -17,7 +17,7 @@
 namespace Squirrel.Update
 {
     enum UpdateAction {
-        Unset = 0, Install, Uninstall, Download, Update, Releasify,
+        Unset = 0, Install, Uninstall, Download, Update, Releasify, Shortcut
     }

     class Program : IEnableLogger
@@ -79,6 +79,7 @@
                     { "download=", "Download the releases specified by the URL and write new results to stdout as JSON", v => { updateAction = UpdateAction.Download; target = v; } },
                     { "update=", "Update the application to the latest remote version specified by URL", v => { updateAction = UpdateAction.Update; target = v; } },
                     { "releasify=", "Update or generate a releases directory with a given NuGet package", v => { updateAction = UpdateAction.Releasify; target = v; } },
+                    { "createShortcut=", "Create a shortcut for the given executable name", v => { updateAction = UpdateAction.Shortcut; target = v; } },
                     "",
                     "Options:",
                     { "h|?|help", "Display Help and exit", _ => ShowHelp() },
@@ -112,6 +113,9 @@
                 case UpdateAction.Releasify:
                     Releasify(target, releaseDir, packagesDir, bootstrapperExe, backgroundGif);
                     break;
+                case UpdateAction.Shortcut:
+                    Shortcut(target);
+                    break;
                 }

                 animatedGifWindowToken.Cancel();
@@ -271,6 +275,18 @@
             }
         }

+        public void Shortcut(string exeName)
+        {
+            if (String.IsNullOrWhiteSpace(exeName)) {
+                ShowHelp();
+                return;
+            }
+
+            var appName = getAppNameFromDirectory();
+            using (var mgr = new UpdateManager("", appName, FrameworkVersion.Net45)) {
+                mgr.CreateShortcutsForExecutable(exeName, ShortcutLocation.Desktop | ShortcutLocation.StartMenu);
+            }
+        }

         public void ShowHelp()
         {


Generalize call to CheatColorSphere and change player color

--- 140-speedrun-timer/LevelObject/Cheats.cs
+++ 140-speedrun-timer/LevelObject/Cheats.cs
@@ -249,6 +249,10 @@
 			{
 				TeleportToBeatLayerSwitch(_beatSwitches[id]);
 			}
+			// change the colors of the level and player according to the gate
+			var player = Globals.player.GetComponent<MyCharacterController>();
+			player.visualPlayer.SetColor((id % 2 == 0) ? Color.black : Color.white, 1f);
+			Globals.colorChangeSystem.CheatColorSphere(id + 1);
 		}

 		public static void TeleportToBeatLayerSwitch(BeatLayerSwitch beatSwitch)
@@ -256,8 +260,6 @@
 			var player = Globals.player.GetComponent<MyCharacterController>();
 			player.SetVelocity(Vector2.zero);
 			player.PlacePlayerCharacter(beatSwitch.transform.position, true);
-			if (beatSwitch.globalBeatLayer > 1)
-				Globals.colorChangeSystem.CheatColorSphere(beatSwitch.globalBeatLayer);
 			if (beatSwitch.globalBeatLayer >= Globals.beatMaster.GetCurrentBeatLayer())
 				beatSwitch.CheatUse();
 		}


log 支持额外的 log target

log 支持额外的 log target

--- ulog/LogService.cs
+++ ulog/LogService.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.ComponentModel;
 using System.IO;
 using System.Linq;
 using System.Text;
@@ -7,8 +8,28 @@

 namespace GameCommon
 {
+    public class LogEventArgs : EventArgs
+    {
+        public LogEventArgs(int seqID, LogType type, string content, float time)
+        {
+            SeqID = seqID;
+            LogType = type;
+            Content = content;
+            Time = time;
+        }
+
+        public int SeqID = 0;
+        public LogType LogType;
+        public string Content = "";
+        public float Time = 0.0f;
+    }
+
+    public delegate void LogTargetHandler(object sender, LogEventArgs args);
+
     public class LogService : IDisposable
     {
+        public event LogTargetHandler LogTargets;
+
         public LogService(bool logIntoFile)
         {
             RegisterCallback();
@@ -100,6 +121,17 @@
                 {
                     _logWriter.WriteLine("{0:0.00} {1}: {2}", Time.realtimeSinceStartup, type, condition);
                 }
+
+                foreach (LogTargetHandler Caster in LogTargets.GetInvocationList())
+                {
+                    ISynchronizeInvoke SyncInvoke = Caster.Target as ISynchronizeInvoke;
+                    LogEventArgs args = new LogEventArgs(_seqID, type, condition, Time.realtimeSinceStartup);
+
+                    if (SyncInvoke != null && SyncInvoke.InvokeRequired)
+                        SyncInvoke.Invoke(Caster, new object[] { this, args });
+                    else
+                        Caster(this, args);
+                }
             }
             catch (System.Exception ex)
             {


Improve day 4 performance

Improve day 4 performance

--- 2015/day-04/AdventOfCode.Day4/Program.cs
+++ 2015/day-04/AdventOfCode.Day4/Program.cs
@@ -77,28 +77,34 @@
         {
             string prefix = new string('0', zeroes);

-            ConcurrentBag<int> bag = new ConcurrentBag<int>();
-
-            // N.B. It is possible that for other input values that one range of the partition
-            // yields an answer earlier than tha partition that would produce a lower number.
-            var source = Partitioner.Create(Enumerable.Range(1, int.MaxValue - 1));
+            var bag = new ConcurrentBag<int>();
+            var source = Partitioner.Create(1, int.MaxValue - 1, 50000);

             Parallel.ForEach(
                 source,
-                (i, s) =>
+                (range, state) =>
                 {
-                    string value = string.Format(CultureInfo.InvariantCulture, "{0}{1}", secretKey, i);
-                    string hash = ComputeMD5(value);
-
-                    if (hash.StartsWith(prefix, StringComparison.Ordinal))
+                    // Does this range start at a value greater than an already found value?
+                    if (bag.Count > 0 && range.Item1 > bag.Min())
                     {
-                        bag.Add(i);
-                        s.Stop();
+                        return;
                     }

-                    if (i % 100000 == 0)
+                    for (int i = range.Item1; !state.ShouldExitCurrentIteration && i < range.Item2; i++)
                     {
-                        Console.Write('.');
+                        string value = string.Format(CultureInfo.InvariantCulture, "{0}{1}", secretKey, i);
+                        string hash = ComputeMD5(value);
+
+                        if (hash.StartsWith(prefix, StringComparison.Ordinal))
+                        {
+                            // We've found a possible solution stop this loop
+                            bag.Add(i);
+                        }
+
+                        if (i % 100000 == 0)
+                        {
+                            Console.Write('.');
+                        }
                     }
                 });


[PhotoFilter] dropped "_" prefix

[PhotoFilter] dropped "_" prefix

--- ios8/PhotoFilter/PhotoFilterExtension/AVReaderWriter.cs
+++ ios8/PhotoFilter/PhotoFilterExtension/AVReaderWriter.cs
@@ -18,41 +18,41 @@
 		// In production – your should extract interface from PhotoEditingViewController (ex IAVReaderWriterDelegate)
 		public PhotoEditingViewController Delegate { get; set; }

-		private AVAsset _asset;
-		private CMTimeRange _timeRange;
-		private NSUrl _outputURL;
-
-		private Action<float>    _progressProc;
-		private Action<NSError>  _completionProc;
-
-		CancellationTokenSource _cancellationTokenSrc;
-
-		private AVAssetReader _assetReader;
-		private AVAssetWriter _assetWriter;
-		private ReadWriteSampleBufferChannel _audioSampleBufferChannel;
-		private ReadWriteSampleBufferChannel _videoSampleBufferChannel;
+		private AVAsset asset;
+		private CMTimeRange timeRange;
+		private NSUrl outputURL;
+
+		private Action<float>    progressProc;
+		private Action<NSError>  completionProc;
+
+		CancellationTokenSource cancellationTokenSrc;
+
+		private AVAssetReader assetReader;
+		private AVAssetWriter assetWriter;
+		private ReadWriteSampleBufferChannel audioSampleBufferChannel;
+		private ReadWriteSampleBufferChannel videoSampleBufferChannel;

 		public AVReaderWriter (AVAsset asset)
 		{
-			_asset = asset;
-			_cancellationTokenSrc = new CancellationTokenSource ();
+			this.asset = asset;
+			cancellationTokenSrc = new CancellationTokenSource ();
 		}

 		public void WriteToUrl(NSUrl localOutputURL, Action<float> progress, Action<NSError> completion)
 		{
-			_outputURL = localOutputURL;
-
-			AVAsset localAsset = _asset;
-
-			_completionProc = completion;
-			_progressProc = progress;
+			outputURL = localOutputURL;
+
+			AVAsset localAsset = asset;
+
+			completionProc = completion;
+			progressProc = progress;

 			// Dispatch the setup work with _cancellationTokenSrc, to ensure this work can be cancelled
 			localAsset.LoadValuesTaskAsync (new string[] { "tracks", "duration" }).ContinueWith(_ => {
 				// Since we are doing these things asynchronously, the user may have already cancelled on the main thread.
 				// In that case, simply return from this block
-				_cancellationTokenSrc.Token.ThrowIfCancellationRequested();
+				cancellationTokenSrc.Token.ThrowIfCancellationRequested();

 				bool success = true;
 				NSError localError = null;
@@ -63,7 +63,7 @@
 				if(!success)
 					throw new NSErrorException(localError);

-				_timeRange = new CMTimeRange {
+				timeRange = new CMTimeRange {
 					Start = CMTime.Zero,
 					Duration = localAsset.Duration
 				};
@@ -77,7 +77,7 @@
 				StartReadingAndWriting();

 				return localError;
-			}, _cancellationTokenSrc.Token).ContinueWith(prevTask => {
+			}, cancellationTokenSrc.Token).ContinueWith(prevTask => {
 				switch(prevTask.Status) {
 					case TaskStatus.Canceled:
 						ReadingAndWritingDidFinish(false, null);
@@ -95,17 +95,17 @@

 		private void SetupReaderAndWriter()
 		{
-			AVAsset localAsset = _asset;
-			NSUrl localOutputURL = _outputURL;
+			AVAsset localAsset = asset;
+			NSUrl localOutputURL = outputURL;
 			NSError error = null;

 			// Create asset reader and asset writer
-			_assetReader = new AVAssetReader (localAsset, out error);
-			if (_assetReader == null)
+			assetReader = new AVAssetReader (localAsset, out error);
+			if (assetReader == null)
 				throw new NSErrorException(error);

-			_assetWriter = new AVAssetWriter (localOutputURL, AVFileType.QuickTimeMovie, out error);
-			if (_assetWriter == null)
+			assetWriter = new AVAssetWriter (localOutputURL, AVFileType.QuickTimeMovie, out error);
+			if (assetWriter == null)
 				throw new NSErrorException(error);

 			// Create asset reader outputs and asset writer inputs for the first audio track and first video track of the asset
@@ -124,14 +124,14 @@

 			// Decompress to Linear PCM with the asset reader
 			AVAssetReaderOutput output = AVAssetReaderTrackOutput.Create (audioTrack, (AudioSettings)null);
-			_assetReader.AddOutput (output);
+			assetReader.AddOutput (output);

 			AVAssetWriterInput input = AVAssetWriterInput.Create (audioTrack.MediaType, (AudioSettings)null);
-			_assetWriter.AddInput (input);
+			assetWriter.AddInput (input);

 			// Create and save an instance of ReadWriteSampleBufferChannel,
 			// which will coordinate the work of reading and writing sample buffers
-			_audioSampleBufferChannel = new ReadWriteSampleBufferChannel (output, input, false);
+			audioSampleBufferChannel = new ReadWriteSampleBufferChannel (output, input, false);
 		}

 		private void SetupAssetReaserWriterForVideo (AVAssetTrack videoTrack)
@@ -199,35 +199,35 @@
 		private void StartReadingAndWriting()
 		{
 			// Instruct the asset reader and asset writer to get ready to do work
-			if (!_assetReader.StartReading ())
-				throw new NSErrorException (_assetReader.Error);
-
-			if (!_assetWriter.StartWriting())
-				throw new NSErrorException (_assetWriter.Error);
+			if (!assetReader.StartReading ())
+				throw new NSErrorException (assetReader.Error);
+
+			if (!assetWriter.StartWriting())
+				throw new NSErrorException (assetWriter.Error);

 			// Start a sample-writing session
-			_assetWriter.StartSessionAtSourceTime (_timeRange.Start);
+			assetWriter.StartSessionAtSourceTime (timeRange.Start);

 			// Only set audio handler(obj-c delegate) for audio-only assets, else let the video channel drive progress
-			AVReaderWriter audioHandler = _videoSampleBufferChannel == null ? this : null;
-			var audioTask = StartReadingAsync (_audioSampleBufferChannel, audioHandler);
-			var videoTask = StartReadingAsync (_videoSampleBufferChannel, this);
+			AVReaderWriter audioHandler = videoSampleBufferChannel == null ? this : null;
+			var audioTask = StartReadingAsync (audioSampleBufferChannel, audioHandler);
+			var videoTask = StartReadingAsync (videoSampleBufferChannel, this);

 			// Set up a callback for when the sample writing is finished
 			Task.WhenAll (audioTask, videoTask).ContinueWith (_ => {
-				if (_cancellationTokenSrc.Token.IsCancellationRequested) {
-					_assetReader.CancelReading ();
-					_assetWriter.CancelWriting ();
+				if (cancellationTokenSrc.Token.IsCancellationRequested) {
+					assetReader.CancelReading ();
+					assetWriter.CancelWriting ();
 					throw new OperationCanceledException();
 				}

-				if (_assetReader.Status != AVAssetReaderStatus.Failed) {
-					_assetWriter.FinishWriting (() => {
-						bool success = _assetWriter.Status == AVAssetWriterStatus.Completed;
-						ReadingAndWritingDidFinish (success, _assetWriter.Error);
+				if (assetReader.Status != AVAssetReaderStatus.Failed) {
+					assetWriter.FinishWriting (() => {
+						bool success = assetWriter.Status == AVAssetWriterStatus.Completed;
+						ReadingAndWritingDidFinish (success, assetWriter.Error);
 					});
 				}
-			}, _cancellationTokenSrc.Token);
+			}, cancellationTokenSrc.Token);
 		}

 		// TODO: where called in original sample
@@ -249,29 +249,29 @@
 		{
 			if (!success)
 			{
-				_assetReader.CancelReading ();
-				_assetWriter.CancelWriting ();
+				assetReader.CancelReading ();
+				assetWriter.CancelWriting ();
 			}

 			// Tear down ivars
-			_assetReader.Dispose ();
-			_assetReader = null;
-
-			_assetWriter.Dispose ();
-			_assetWriter = null;
-
-			_audioSampleBufferChannel = null;
-			_videoSampleBufferChannel = null;
-			_cancellationTokenSrc = null;
-
-			_completionProc(error);
+			assetReader.Dispose ();
+			assetReader = null;
+
+			assetWriter.Dispose ();
+			assetWriter = null;
+
+			audioSampleBufferChannel = null;
+			videoSampleBufferChannel = null;
+			cancellationTokenSrc = null;
+
+			completionProc(error);
 		}

 		public void DidReadSampleBuffer (ReadWriteSampleBufferChannel sampleBufferChannel, CMSampleBuffer sampleBuffer)
 		{
 			// Calculate progress (scale of 0.0 to 1.0)
-			double progress = AVReaderWriter.ProgressOfSampleBufferInTimeRange(sampleBuffer, _timeRange);
-			_progressProc((float)progress * 100);
+			double progress = AVReaderWriter.ProgressOfSampleBufferInTimeRange(sampleBuffer, timeRange);
+			progressProc((float)progress * 100);

 			// Grab the pixel buffer from the sample buffer, if possible
 			CVImageBuffer imageBuffer = sampleBuffer.GetImageBuffer ();
@@ -286,8 +286,8 @@
 			CVPixelBuffer sampleBufferForWrite)
 		{
 			// Calculate progress (scale of 0.0 to 1.0)
-			double progress = AVReaderWriter.ProgressOfSampleBufferInTimeRange(sampleBuffer, _timeRange);
-			_progressProc((float)progress * 100);
+			double progress = AVReaderWriter.ProgressOfSampleBufferInTimeRange(sampleBuffer, timeRange);
+			progressProc((float)progress * 100);

 			// Grab the pixel buffer from the sample buffer, if possible
 			CVImageBuffer imageBuffer = sampleBuffer.GetImageBuffer ();


Fix Load Method signature.

Fix Load Method signature.

--- DBFilesClient.NET/DBCStorage.cs
+++ DBFilesClient.NET/DBCStorage.cs
@@ -298,7 +298,7 @@
             var method = new DynamicMethod(
                 "EntryLoader_" + m_entryTypeName,
                 typeof(void),
-                new Type[] { typeof(byte*), typeof(byte[]), typeof(sbyte*), typeof(T), typeof(bool) },
+                new Type[] { typeof(byte*), typeof(byte[]), typeof(StringGetter), typeof(T), typeof(bool) },
                 typeof(T).Module
                 );


Application Name in connectionstring set to "DbMigrator"

--- DBMigrator/Database/Database.cs
+++ DBMigrator/Database/Database.cs
@@ -26,11 +26,11 @@
             string connectionString;
             if (string.IsNullOrEmpty(username) && string.IsNullOrEmpty(password))
             {
-                connectionString = $"Data Source={servername};Initial Catalog={database};Integrated Security=true;MultipleActiveResultSets=True";
+                connectionString = $"Application Name=DbMigrator;Data Source={servername};Initial Catalog={database};Integrated Security=true;MultipleActiveResultSets=True";
             }
             else
             {
-                connectionString = $"Data Source={servername};Initial Catalog={database};Persist Security Info=True;User ID={username};Password={password};MultipleActiveResultSets=True";
+                connectionString = $"Application Name=DbMigrator;Data Source={servername};Initial Catalog={database};Persist Security Info=True;User ID={username};Password={password};MultipleActiveResultSets=True";
             }
             SetupConnAndLogger(connectionString);
         }


Quarantine ShutdownTests (#38952)

Quarantine ShutdownTests (#38952)

* Quarantine GracefulShutdownWorksWithMultipleRequestsInFlight_InProcess

* ConfigurationTouchedStress_InProcess

--- src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs
+++ src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs
@@ -194,6 +194,7 @@
     }

     [ConditionalFact]
+    [QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/38951")]
     public async Task GracefulShutdownWorksWithMultipleRequestsInFlight_InProcess()
     {
         // The goal of this test is to have multiple requests currently in progress
@@ -490,6 +491,7 @@
     }

     [ConditionalFact]
+    [QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/38951")]
     public async Task ConfigurationTouchedStress_InProcess()
     {
         await ConfigurationTouchedStress(HostingModel.InProcess);


Revert "Quarantine ConfigurationChangeStopsInProcess (#40629)" (#41304)

This reverts commit ae296947eb6cf82bb2baeec5e4ec97eb51b781bb.

--- src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs
+++ src/Servers/IIS/IIS/test/Common.LongTests/ShutdownTests.cs
@@ -371,7 +371,6 @@
     }

     [ConditionalFact]
-    [QuarantinedTest("https://github.com/dotnet/aspnetcore/issues/40628")]
     public async Task ConfigurationChangeStopsInProcess()
     {
         var deploymentParameters = Fixture.GetBaseDeploymentParameters(HostingModel.InProcess);


inform the user about the ReIndex process (#3612)

--- src/Stratis.Bitcoin.Features.BlockStore/BlockRepository.cs
+++ src/Stratis.Bitcoin.Features.BlockStore/BlockRepository.cs
@@ -1,6 +1,7 @@
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
+using System.Text;
 using System.Threading;
 using DBreeze;
 using DBreeze.DataTypes;
@@ -324,7 +325,22 @@

                 if (this.TxIndex)
                 {
+                    int rowCount = 0;
                     // Insert transactions to database.
+
+                    var totalBlocksCount = dbreezeTransaction.Count(BlockTableName);
+
+                    var warningMessage = new StringBuilder();
+                    warningMessage.AppendLine("".PadRight(59, '=') + " W A R N I N G " + "".PadRight(59, '='));
+                    warningMessage.AppendLine();
+                    warningMessage.AppendLine($"Starting ReIndex process on a total of {totalBlocksCount} blocks.");
+                    warningMessage.AppendLine("The operation could take a long time, please don't stop it.");
+                    warningMessage.AppendLine();
+                    warningMessage.AppendLine("".PadRight(133, '='));
+                    warningMessage.AppendLine();
+
+                    this.logger.LogInformation(warningMessage.ToString());
+
                     IEnumerable<Row<byte[], byte[]>> blockRows = dbreezeTransaction.SelectForward<byte[], byte[]>(BlockTableName);
                     foreach (Row<byte[], byte[]> blockRow in blockRows)
                     {
@@ -333,7 +349,15 @@
                         {
                             dbreezeTransaction.Insert<byte[], byte[]>(TransactionTableName, transaction.GetHash().ToBytes(), block.GetHash().ToBytes());
                         }
+
+                        // inform the user about the ongoing operation
+                        if (++rowCount % 1000 == 0)
+                        {
+                            this.logger.LogInformation("Reindex in process... {0}/{1} blocks processed.", rowCount, totalBlocksCount);
+                        }
                     }
+
+                    this.logger.LogInformation("Reindex completed successfully.");
                 }
                 else
                 {


insert try catch while reading Translations.xml file

--- WinFormTemplate/Translation.cs
+++ WinFormTemplate/Translation.cs
@@ -1,219 +1,246 @@
-/*
-The MIT License(MIT)
-Copyright(c) 2015 Freddy Juhel
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Xml.Linq;
-using WinFormTemplate.Properties;
-
-namespace WinFormTemplate
-{
-  public static class Translation
-  {
-    public static readonly Dictionary<string, string> LanguageDicoEn = new Dictionary<string, string>();
-    public static readonly Dictionary<string, string> LanguageDicoFr = new Dictionary<string, string>();
-    public static string CurrentLanguage = "english";
-
-    public static void LoadLanguages()
-    {
-      if (!File.Exists(Settings.Default.LanguageFileName))
-      {
-        CreateLanguageFile();
-      }
-
-      // read the translation file and feed the language
-      XDocument xDoc = XDocument.Load(Settings.Default.LanguageFileName);
-      var result = from node in xDoc.Descendants("term")
-                   where node.HasElements
-                   let xElementName = node.Element("name")
-                   where xElementName != null
-                   let xElementEnglish = node.Element("englishValue")
-                   where xElementEnglish != null
-                   let xElementFrench = node.Element("frenchValue")
-                   where xElementFrench != null
-                   select new
-                   {
-                     name = xElementName.Value,
-                     englishValue = xElementEnglish.Value,
-                     frenchValue = xElementFrench.Value
-                   };
-      foreach (var i in result)
-      {
-        LanguageDicoEn.Add(i.name, i.englishValue);
-        LanguageDicoFr.Add(i.name, i.frenchValue);
-      }
-    }
-
-    private static void CreateLanguageFile()
-    {
-      List<string> minimumVersion = new List<string>
-      {
-        "<?xml version=\"1.0\" encoding=\"utf - 8\" ?>",
-        "<Document>",
-        "<DocumentVersion>",
-        "<version> 1.0 </version>",
-        "</DocumentVersion>",
-        "<terms>",
-         "<term>",
-        "<name>MenuFile</name>",
-        "<englishValue>File</englishValue>",
-        "<frenchValue>Fichier</frenchValue>",
-        "</term>",
-        "<term>",
-        "<name>MenuFileNew</name>",
-        "<englishValue>New</englishValue>",
-        "<frenchValue>Nouveau</frenchValue>",
-        "</term>",
-        "<term>",
-        "<name>MenuFileOpen</name>",
-        "<englishValue>Open</englishValue>",
-        "<frenchValue>Ouvrir</frenchValue>",
-        "</term>",
-        "<term>",
-        "<name>MenuFileSave</name>",
-        "<englishValue>Save</englishValue>",
-        "<frenchValue>Enregistrer</frenchValue>",
-        "</term>",
-        "<term>",
-        "<name>MenuFileSaveAs</name>",
-        "<englishValue>Save as ...</englishValue>",
-        "<frenchValue>Enregistrer sous ...</frenchValue>",
-        "</term>",
-        "<term>",
-        "<name>MenuFilePrint</name>",
-        "<englishValue>Print ...</englishValue>",
-        "<frenchValue>Imprimer ...</frenchValue>",
-        "</term>",
-        "<term>",
-          "<name>MenufilePageSetup</name>",
-          "<englishValue>Page setup</englishValue>",
-          "<frenchValue>Aperçu avant impression</frenchValue>",
-        "</term>",
-        "<term>",
-          "<name>MenufileQuit</name>",
-          "<englishValue>Quit</englishValue>",
-          "<frenchValue>Quitter</frenchValue>",
-        "</term>",
-        "<term>",
-          "<name>MenuEdit</name>",
-          "<englishValue>Edit</englishValue>",
-          "<frenchValue>Edition</frenchValue>",
-        "</term>",
-        "<term>",
-          "<name>MenuEditCancel</name>",
-          "<englishValue>Cancel</englishValue>",
-          "<frenchValue>Annuler</frenchValue>",
-        "</term>",
-        "<term>",
-          "<name>MenuEditRedo</name>",
-          "<englishValue>Redo</englishValue>",
-          "<frenchValue>Rétablir</frenchValue>",
-        "</term>",
-        "<term>",
-          "<name>MenuEditCut</name>",
-          "<englishValue>Cut</englishValue>",
-          "<frenchValue>Couper</frenchValue>",
-        "</term>",
-        "<term>",
-          "<name>MenuEditCopy</name>",
-          "<englishValue>Copy</englishValue>",
-          "<frenchValue>Copier</frenchValue>",
-        "</term>",
-        "<term>",
-          "<name>MenuEditPaste</name>",
-          "<englishValue>Paste</englishValue>",
-          "<frenchValue>Coller</frenchValue>",
-        "</term>",
-        "<term>",
-          "<name>MenuEditSelectAll</name>",
-          "<englishValue>Select All</englishValue>",
-          "<frenchValue>Sélectionner tout</frenchValue>",
-        "</term>",
-        "<term>",
-          "<name>MenuTools</name>",
-          "<englishValue>Tools</englishValue>",
-          "<frenchValue>Outils</frenchValue>",
-        "</term>",
-        "<term>",
-          "<name>MenuToolsCustomize</name>",
-          "<englishValue>Customize ...</englishValue>",
-          "<frenchValue>Personaliser ...</frenchValue>",
-        "</term>",
-        "<term>",
-          "<name>MenuToolsOptions</name>",
-          "<englishValue>Options</englishValue>",
-          "<frenchValue>Options</frenchValue>",
-        "</term>",
-        "<term>",
-          "<name>MenuLanguage</name>",
-          "<englishValue>Language</englishValue>",
-          "<frenchValue>Langage</frenchValue>",
-        "</term>",
-        "<term>",
-          "<name>MenuLanguageEnglish</name>",
-          "<englishValue>English</englishValue>",
-          "<frenchValue>Anglais</frenchValue>",
-        "</term>",
-        "<term>",
-          "<name>MenuLanguageFrench</name>",
-          "<englishValue>French</englishValue>",
-          "<frenchValue>Français</frenchValue>",
-        "</term>",
-        "<term>",
-          "<name>MenuHelp</name>",
-          "<englishValue>Help</englishValue>",
-          "<frenchValue>Aide</frenchValue>",
-        "</term>",
-        "<term>",
-          "<name>MenuHelpSummary</name>",
-          "<englishValue>Summary</englishValue>",
-          "<frenchValue>Sommaire</frenchValue>",
-        "</term>",
-        "<term>",
-          "<name>MenuHelpIndex</name>",
-          "<englishValue>Index</englishValue>",
-          "<frenchValue>Index</frenchValue>",
-        "</term>",
-        "<term>",
-          "<name>MenuHelpSearch</name>",
-          "<englishValue>Search</englishValue>",
-          "<frenchValue>Rechercher</frenchValue>",
-        "</term>",
-        "<term>",
-          "<name>MenuHelpAbout</name>",
-          "<englishValue>About</englishValue>",
-          "<frenchValue>A propos de ...</frenchValue>",
-        "</term>",
-        "</terms>",
-        "</Document>"
-      };
-
-      var sw = new StreamWriter(Settings.Default.LanguageFileName);
-      foreach (string item in minimumVersion)
-      {
-        sw.WriteLine(item);
-      }
-
-      sw.Close();
-    }
-
-  }
+/*
+The MIT License(MIT)
+Copyright(c) 2015 Freddy Juhel
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+*/
+
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Windows.Forms;
+using System.Xml.Linq;
+using WinFormTemplate.Properties;
+
+namespace WinFormTemplate
+{
+  public static class Translation
+  {
+    public static readonly Dictionary<string, string> LanguageDicoEn = new Dictionary<string, string>();
+    public static readonly Dictionary<string, string> LanguageDicoFr = new Dictionary<string, string>();
+    public static string CurrentLanguage = "english";
+
+    public static void LoadLanguages()
+    {
+      if (!File.Exists(Settings.Default.LanguageFileName))
+      {
+        CreateLanguageFile();
+      }
+
+      // read the translation file and feed the language
+      XDocument xDoc;
+      try
+      {
+        xDoc = XDocument.Load(Settings.Default.LanguageFileName);
+      }
+      catch (Exception exception)
+      {
+        MessageBox.Show("Error while loading xml file " + exception);
+        CreateLanguageFile();
+        return;
+      }
+      var result = from node in xDoc.Descendants("term")
+                   where node.HasElements
+                   let xElementName = node.Element("name")
+                   where xElementName != null
+                   let xElementEnglish = node.Element("englishValue")
+                   where xElementEnglish != null
+                   let xElementFrench = node.Element("frenchValue")
+                   where xElementFrench != null
+                   select new
+                   {
+                     name = xElementName.Value,
+                     englishValue = xElementEnglish.Value,
+                     frenchValue = xElementFrench.Value
+                   };
+      foreach (var i in result)
+      {
+        if (!LanguageDicoEn.ContainsKey(i.name))
+        {
+          LanguageDicoEn.Add(i.name, i.englishValue);
+        }
+        else
+        {
+          MessageBox.Show("Your xml file has duplicate like: " + i.name);
+        }
+
+        if (!LanguageDicoFr.ContainsKey(i.name))
+        {
+          LanguageDicoFr.Add(i.name, i.frenchValue);
+        }
+        else
+        {
+          MessageBox.Show("Your xml file has duplicate like: " + i.name);
+        }
+      }
+    }
+
+    private static void CreateLanguageFile()
+    {
+      List<string> minimumVersion = new List<string>
+      {
+        "<?xml version=\"1.0\" encoding=\"utf-8\" ?>",
+        "<Document>",
+        "<DocumentVersion>",
+        "<version> 1.0 </version>",
+        "</DocumentVersion>",
+        "<terms>",
+         "<term>",
+        "<name>MenuFile</name>",
+        "<englishValue>File</englishValue>",
+        "<frenchValue>Fichier</frenchValue>",
+        "</term>",
+        "<term>",
+        "<name>MenuFileNew</name>",
+        "<englishValue>New</englishValue>",
+        "<frenchValue>Nouveau</frenchValue>",
+        "</term>",
+        "<term>",
+        "<name>MenuFileOpen</name>",
+        "<englishValue>Open</englishValue>",
+        "<frenchValue>Ouvrir</frenchValue>",
+        "</term>",
+        "<term>",
+        "<name>MenuFileSave</name>",
+        "<englishValue>Save</englishValue>",
+        "<frenchValue>Enregistrer</frenchValue>",
+        "</term>",
+        "<term>",
+        "<name>MenuFileSaveAs</name>",
+        "<englishValue>Save as ...</englishValue>",
+        "<frenchValue>Enregistrer sous ...</frenchValue>",
+        "</term>",
+        "<term>",
+        "<name>MenuFilePrint</name>",
+        "<englishValue>Print ...</englishValue>",
+        "<frenchValue>Imprimer ...</frenchValue>",
+        "</term>",
+        "<term>",
+          "<name>MenufilePageSetup</name>",
+          "<englishValue>Page setup</englishValue>",
+          "<frenchValue>Aperçu avant impression</frenchValue>",
+        "</term>",
+        "<term>",
+          "<name>MenufileQuit</name>",
+          "<englishValue>Quit</englishValue>",
+          "<frenchValue>Quitter</frenchValue>",
+        "</term>",
+        "<term>",
+          "<name>MenuEdit</name>",
+          "<englishValue>Edit</englishValue>",
+          "<frenchValue>Edition</frenchValue>",
+        "</term>",
+        "<term>",
+          "<name>MenuEditCancel</name>",
+          "<englishValue>Cancel</englishValue>",
+          "<frenchValue>Annuler</frenchValue>",
+        "</term>",
+        "<term>",
+          "<name>MenuEditRedo</name>",
+          "<englishValue>Redo</englishValue>",
+          "<frenchValue>Rétablir</frenchValue>",
+        "</term>",
+        "<term>",
+          "<name>MenuEditCut</name>",
+          "<englishValue>Cut</englishValue>",
+          "<frenchValue>Couper</frenchValue>",
+        "</term>",
+        "<term>",
+          "<name>MenuEditCopy</name>",
+          "<englishValue>Copy</englishValue>",
+          "<frenchValue>Copier</frenchValue>",
+        "</term>",
+        "<term>",
+          "<name>MenuEditPaste</name>",
+          "<englishValue>Paste</englishValue>",
+          "<frenchValue>Coller</frenchValue>",
+        "</term>",
+        "<term>",
+          "<name>MenuEditSelectAll</name>",
+          "<englishValue>Select All</englishValue>",
+          "<frenchValue>Sélectionner tout</frenchValue>",
+        "</term>",
+        "<term>",
+          "<name>MenuTools</name>",
+          "<englishValue>Tools</englishValue>",
+          "<frenchValue>Outils</frenchValue>",
+        "</term>",
+        "<term>",
+          "<name>MenuToolsCustomize</name>",
+          "<englishValue>Customize ...</englishValue>",
+          "<frenchValue>Personaliser ...</frenchValue>",
+        "</term>",
+        "<term>",
+          "<name>MenuToolsOptions</name>",
+          "<englishValue>Options</englishValue>",
+          "<frenchValue>Options</frenchValue>",
+        "</term>",
+        "<term>",
+          "<name>MenuLanguage</name>",
+          "<englishValue>Language</englishValue>",
+          "<frenchValue>Langage</frenchValue>",
+        "</term>",
+        "<term>",
+          "<name>MenuLanguageEnglish</name>",
+          "<englishValue>English</englishValue>",
+          "<frenchValue>Anglais</frenchValue>",
+        "</term>",
+        "<term>",
+          "<name>MenuLanguageFrench</name>",
+          "<englishValue>French</englishValue>",
+          "<frenchValue>Français</frenchValue>",
+        "</term>",
+        "<term>",
+          "<name>MenuHelp</name>",
+          "<englishValue>Help</englishValue>",
+          "<frenchValue>Aide</frenchValue>",
+        "</term>",
+        "<term>",
+          "<name>MenuHelpSummary</name>",
+          "<englishValue>Summary</englishValue>",
+          "<frenchValue>Sommaire</frenchValue>",
+        "</term>",
+        "<term>",
+          "<name>MenuHelpIndex</name>",
+          "<englishValue>Index</englishValue>",
+          "<frenchValue>Index</frenchValue>",
+        "</term>",
+        "<term>",
+          "<name>MenuHelpSearch</name>",
+          "<englishValue>Search</englishValue>",
+          "<frenchValue>Rechercher</frenchValue>",
+        "</term>",
+        "<term>",
+          "<name>MenuHelpAbout</name>",
+          "<englishValue>About</englishValue>",
+          "<frenchValue>A propos de ...</frenchValue>",
+        "</term>",
+        "</terms>",
+        "</Document>"
+      };
+
+      var sw = new StreamWriter(Settings.Default.LanguageFileName);
+      foreach (string item in minimumVersion)
+      {
+        sw.WriteLine(item);
+      }
+
+      sw.Close();
+    }
+
+  }
 }


Revert "Fix" to be able to use the LinkedIn client by Windows Store apps

--- RestSharp.Portable.OAuth2/OAuth2/Client/LinkedinClient.cs
+++ RestSharp.Portable.OAuth2/OAuth2/Client/LinkedinClient.cs
@@ -1,12 +1,9 @@
 using System;
 using System.Linq;
-#if !PCL
 using System.Xml.Linq;
-#endif
 using RestSharp.Portable.Authenticators.OAuth2.Configuration;
 using RestSharp.Portable.Authenticators.OAuth2.Infrastructure;
 using RestSharp.Portable.Authenticators.OAuth2.Models;
-using RestSharp.Portable;
 using System.Threading.Tasks;

 namespace RestSharp.Portable.Authenticators.OAuth2.Client
@@ -104,7 +101,6 @@
         /// <param name="content">The content which is received from third-party service.</param>
         protected override UserInfo ParseUserInfo(string content)
         {
-#if !PCL
             var document  = XDocument.Parse(content);
             var avatarUri = document.Element("person").Elements("picture-url").Select(x => x.Value).SingleOrDefault();
             var avatarSizeTemplate = "{0}_{0}";
@@ -128,9 +124,6 @@
                         Large  = avatarUri.Replace(avatarDefaultSize, string.Format(avatarSizeTemplate, AvatarInfo.LargeSize))
                     }
             };
-#else
-            throw new NotImplementedException();
-#endif
         }


temp disable history command

temp disable history command

--- Wox/ViewModel/MainViewModel.cs
+++ Wox/ViewModel/MainViewModel.cs
@@ -136,7 +136,7 @@
             });

-
+            /**
             DisplayNextQueryCommand = new RelayCommand(_ =>
             {
                 var nextQuery = _queryHistory.Next();
@@ -148,6 +148,7 @@
                 var prev = _queryHistory.Previous();
                 DisplayQueryHistory(prev);
             });
+            **/

             SelectNextPageCommand = new RelayCommand(_ =>
             {
@@ -426,7 +427,7 @@
             Results.RemoveResultsFor(QueryHistory.MetaData);
             _queryHistory.Reset();
         }
-
+        /**
         private void DisplayQueryHistory(HistoryItem history)
         {
             if (history != null)
@@ -458,6 +459,7 @@
                 }, _updateToken);
             }
         }
+        **/

         private Result ContextMenuTopMost(Result result)
         {


Updated how the About box displays the build number for the application.

--- Yahtzee/Yahtzee/AboutDialog.cs
+++ Yahtzee/Yahtzee/AboutDialog.cs
@@ -25,7 +25,7 @@
             _version = Assembly.GetExecutingAssembly().GetName().Version;
             _major = _version.Major;
             _minor = _version.Minor;
-            _build = 170806;// _version.Build;
+            _build = _version.Build;

             lblAppVersion.Text = lblAppVersion.Text.Replace("v*.*",
                                                             "v" + _major + "." + _minor


Hovered item indicator now disappears when moving to empty cell

--- Yeena/UI/Controls/StashGrid.cs
+++ Yeena/UI/Controls/StashGrid.cs
@@ -95,6 +95,7 @@
                     _itemInfoPopup.Show(this);
                 }
             } else {
+                RemoveMarking(_mousedMarking);
                 if (_itemInfoPopup.Visible) {
                     _itemInfoPopup.Hide();
                 }


fix payload limits (#1194)

fix payload limits (#1194)

--- neo/Network/P2P/ProtocolHandler.cs
+++ neo/Network/P2P/ProtocolHandler.cs
@@ -158,7 +158,7 @@
         private void OnGetBlocksMessageReceived(GetBlocksPayload payload)
         {
             UInt256 hash = payload.HashStart;
-            int count = payload.Count < 0 ? InvPayload.MaxHashesCount : payload.Count;
+            int count = payload.Count < 0 || payload.Count > InvPayload.MaxHashesCount ? InvPayload.MaxHashesCount : payload.Count;
             TrimmedBlock state = Blockchain.Singleton.Store.GetBlocks().TryGet(hash);
             if (state == null) return;
             List<UInt256> hashes = new List<UInt256>();
@@ -213,7 +213,7 @@
         private void OnGetHeadersMessageReceived(GetBlocksPayload payload)
         {
             UInt256 hash = payload.HashStart;
-            int count = payload.Count < 0 ? HeadersPayload.MaxHeadersCount : payload.Count;
+            int count = payload.Count < 0 || payload.Count > HeadersPayload.MaxHeadersCount ? HeadersPayload.MaxHeadersCount : payload.Count;
             DataCache<UInt256, TrimmedBlock> cache = Blockchain.Singleton.Store.GetBlocks();
             TrimmedBlock state = cache.TryGet(hash);
             if (state == null) return;


one way platforms fixed, still looking at other problems

--- Assets/PC2D/Scripts/PlatformerMotor2D.cs
+++ Assets/PC2D/Scripts/PlatformerMotor2D.cs
@@ -1,8 +1,6 @@
 using System;
-using System.Diagnostics;
 using PC2D;
 using UnityEngine;
-using Debug = UnityEngine.Debug;

 [RequireComponent(typeof(BoxCollider2D))]
 public class PlatformerMotor2D : MonoBehaviour
@@ -1194,11 +1192,12 @@

     // Used for environment checks and one way platforms
     private static RaycastHit2D[] _hits = new RaycastHit2D[STARTING_ARRAY_SIZE];
-    private static RaycastHit2D[] _hitsNoDistance = new RaycastHit2D[STARTING_ARRAY_SIZE];
+    private static Collider2D[] _overlappingColliders = new Collider2D[STARTING_ARRAY_SIZE];

     private const float NEAR_ZERO = 0.0001f;

     private const float DISTANCE_TO_END_ITERATION = 0.001f;
+    private const float CHECK_TOUCHING_TRIM = 0.01f;

     private const int STARTING_ARRAY_SIZE = 4;
     private const float INCREASE_ARRAY_SIZE_MULTIPLIER = 2;
@@ -2720,9 +2719,6 @@

         RaycastHit2D hit = GetClosestHit(_collider2D.bounds.center, toNewPos / distance, distance);

-        //Debug.Log(enableSlopes + " " + _collider2D.bounds.center.x + " " + _collider2D.bounds.center.y + " " + (toNewPos / distance).x + " " + (toNewPos / distance).y + " " + distance);
-        //Debug.Log(hit.collider + " " + hit.centroid.x + " " + hit.centroid.y + " " + hit.normal.x + " " + hit.normal.y);
-
         _previousLoc = _collider2D.bounds.center;

         if (hit.collider != null)
@@ -2839,36 +2835,30 @@

     private int GetNearbyHitsBox(
         Vector2 direction,
-        float distance,
-        bool useExternalHits)
+        float distance)
     {
         int num = Physics2D.BoxCastNonAlloc(
             _collider2D.bounds.center,
             _collider2D.bounds.size,
             0f,
             direction,
-            useExternalHits ? _hits : _hitsNoDistance,
+            _hits,
             distance,
             _collisionMask);

-        if (num > _hits.Length)
-        {
-            if (useExternalHits)
-            {
-                _hits = new RaycastHit2D[(int)(INCREASE_ARRAY_SIZE_MULTIPLIER * _hits.Length)];
-            }
-            else
-            {
-                _hitsNoDistance = new RaycastHit2D[(int)(INCREASE_ARRAY_SIZE_MULTIPLIER * _hitsNoDistance.Length)];
-            }
-        }
+        if (num <= _hits.Length)
+        {
+            return num;
+        }
+
+        _hits = new RaycastHit2D[(int)(INCREASE_ARRAY_SIZE_MULTIPLIER * num)];

         num = Physics2D.BoxCastNonAlloc(
             _collider2D.bounds.center,
             _collider2D.bounds.size,
             0f,
             direction,
-            useExternalHits ? _hits : _hitsNoDistance,
+            _hits,
             distance,
             _collisionMask);

@@ -2878,33 +2868,49 @@
     private int GetNearbyHitsRay(
         Vector2 origin,
         Vector2 direction,
-        float distance,
-        bool useExternalHits)
+        float distance)
     {
         int num = Physics2D.RaycastNonAlloc(
             origin,
             direction,
-            useExternalHits ? _hits : _hitsNoDistance,
+            _hits,
             distance,
             _collisionMask);

-        if (num > _hits.Length)
-        {
-            if (useExternalHits)
-            {
-                _hits = new RaycastHit2D[(int)(INCREASE_ARRAY_SIZE_MULTIPLIER * _hits.Length)];
-            }
-            else
-            {
-                _hitsNoDistance = new RaycastHit2D[(int)(INCREASE_ARRAY_SIZE_MULTIPLIER * _hitsNoDistance.Length)];
-            }
-        }
+        if (num <= _hits.Length)
+        {
+            return num;
+        }
+
+        _hits = new RaycastHit2D[(int)(INCREASE_ARRAY_SIZE_MULTIPLIER * num)];

         return Physics2D.RaycastNonAlloc(
             origin,
             direction,
-            useExternalHits ? _hits : _hitsNoDistance,
+             _hits,
             distance,
+            _collisionMask);
+    }
+
+    private int GetOverlappingColliders()
+    {
+        int num = Physics2D.OverlapAreaNonAlloc(
+            _collider2D.bounds.min + new Vector3(CHECK_TOUCHING_TRIM, CHECK_TOUCHING_TRIM),
+            _collider2D.bounds.max + new Vector3(-CHECK_TOUCHING_TRIM, -CHECK_TOUCHING_TRIM),
+            _overlappingColliders,
+            _collisionMask);
+
+        if (num <= _overlappingColliders.Length)
+        {
+            return num;
+        }
+
+        _overlappingColliders = new Collider2D[(int)(INCREASE_ARRAY_SIZE_MULTIPLIER) * num];
+
+        return Physics2D.OverlapAreaNonAlloc(
+            _collider2D.bounds.min + new Vector3(CHECK_TOUCHING_TRIM, CHECK_TOUCHING_TRIM),
+            _collider2D.bounds.max + new Vector3(-CHECK_TOUCHING_TRIM, -CHECK_TOUCHING_TRIM),
+            _overlappingColliders,
             _collisionMask);
     }

@@ -2940,21 +2946,22 @@
         {
             numOfHits = GetNearbyHitsBox(
                 direction,
-                distance,
-                true);
+                distance);
         }
         else
         {
             numOfHits = GetNearbyHitsRay(
                 origin,
                 direction,
-                distance,
-                true);
+                distance);
         }

         RaycastHit2D closestHit = new RaycastHit2D();
         float closeBy = float.MaxValue;

+        bool haveGotOverlapping = false;
+        int numOfNoDistanceHits = 0;
+
         for (int i = 0; i < numOfHits; i++)
         {
             if (_hits[i].collider.usedByEffector &&
@@ -2965,17 +2972,15 @@

                 bool isTouching = false;

-                // You'd think OverlapArea would be sufficient but doesn't
-                // appear to necessarily reliably return the expected colliders
-                // So we box cast a distance of 0 instead.
-                int numOfNoDistanceHits = GetNearbyHitsBox(
-                    direction,
-                    0f,
-                    false);
+                if (!haveGotOverlapping)
+                {
+                    numOfNoDistanceHits = GetOverlappingColliders();
+                    haveGotOverlapping = true;
+                }

                 for (int j = 0; j < numOfNoDistanceHits; j++)
                 {
-                    if (_hitsNoDistance[j].collider == _hits[i].collider)
+                    if (_overlappingColliders[j] == _hits[i].collider)
                     {
                         isTouching = true;
                         break;
@@ -2992,16 +2997,14 @@
                         mpMotor.transform.position = mpMotor.previousPosition;
                         bool wasTouching = false;

-                        numOfNoDistanceHits = GetNearbyHitsBox(
-                            direction,
-                            0f,
-                            false);
+                        numOfNoDistanceHits = GetOverlappingColliders();
+                        haveGotOverlapping = false;

                         mpMotor.transform.position = curPos;

                         for (int j = 0; j < numOfNoDistanceHits; j++)
                         {
-                            if (_hitsNoDistance[j].collider == _hits[i].collider)
+                            if (_overlappingColliders[j] == _hits[i].collider)
                             {
                                 wasTouching = true;
                                 break;


minor fix

minor fix

--- Forum/Views/Topics/Index.cshtml
+++ Forum/Views/Topics/Index.cshtml
@@ -2,7 +2,7 @@

 @{ var pageModifier = Model.MorePages ? 1 : 0; }

-<partial name="_TopicNav" model="@{(Model.BoardId > 0 ? Model.BoardId : 1)}" />
+<partial name="_TopicNav" model="@(Model.BoardId > 0 ? Model.BoardId : 1)" />

 <section id="topic-list">
 	@if (Model.Topics.Any()) {


Added cornerValidSize property for corner grab area #20

cornerValidSize is a new property of the PlatformerMotor2D that will be used to assess a valid corner grab region, from the top of the object's collider down.

--- Assets/PC2D/Scripts/PlatformerMotor2D.cs
+++ Assets/PC2D/Scripts/PlatformerMotor2D.cs
@@ -239,6 +239,11 @@
     /// This is the size of the corner check. This can be tweaked with if corner grabs are not working correctly.
     /// </summary>
     public float cornerDistanceCheck = 0.2f;
+
+    /// <summary>
+	/// This is the size of a valid corner check from the top of the motor collider down.
+	/// </summary>
+	public float cornerValidSize = 0.2f;

     /// <summary>
     /// After a corner or wall jump, this is how longer horizontal input is ignored.
@@ -2383,28 +2388,37 @@
         Vector2 min = box.min;
         Vector2 max = box.max;

+		Vector2 grabMin = box.min;
+		Vector2 grabMax = box.max;
+
         // New min y is always at the current max y.
         min.y = max.y;
         max.y += cornerDistanceCheck;

+		grabMax.y = min.y;
+		grabMin.y = grabMax.y - cornerValidSize;
+
         if (PressingIntoLeftWall())
         {
-            max.x = min.x;
+            max.x = grabMax.x = min.x;
             min.x -= cornerDistanceCheck;
+			grabMin.x -= cornerDistanceCheck;
         }
         else if (PressingIntoRightWall())
         {
-            min.x = max.x;
+			min.x = grabMin.x = max.x;
             max.x += cornerDistanceCheck;
+			grabMax.x += cornerDistanceCheck;
         }
         else
         {
             return false;
         }
-
+
         Collider2D col = Physics2D.OverlapArea(min, max, staticEnvLayerMask | movingPlatformLayerMask);
-
-        return col == null;
+		Collider2D grabCol = Physics2D.OverlapArea(grabMin, grabMax, staticEnvLayerMask | movingPlatformLayerMask);
+
+        return (col == null) && (grabCol != null);
     }

     private bool IsGrounded()
@@ -2918,6 +2932,22 @@
             min.x = max.x;
             max.x += cornerDistanceCheck;
             Gizmos.DrawWireCube(new Vector2((min.x + max.x) / 2, (min.y + max.y) / 2), new Vector2(max.x - min.x, min.y - max.y));
+
+            // Draw valid corner grab area
+			Gizmos.color = Color.yellow;
+			min = box.min;
+			max = box.max;
+			min.y = max.y - cornerValidSize;
+			min.x = max.x;
+			max.x += cornerDistanceCheck;
+			Gizmos.DrawWireCube(new Vector2((min.x + max.x) / 2, (min.y + max.y) / 2), new Vector2(max.x - min.x, min.y - max.y));
+
+			min = box.min;
+			max = box.max;
+			min.y = max.y - cornerValidSize;
+			max.x = min.x;
+			min.x -= cornerDistanceCheck;
+			Gizmos.DrawWireCube(new Vector2((min.x + max.x) / 2, (min.y + max.y) / 2), new Vector2(max.x - min.x, min.y - max.y));
         }

         // Show the distance that it will take for the motor to stop on the ground and air.


Naming changes

Naming changes

--- Assets/[1]Source/Common/TemplateActor.cs
+++ Assets/[1]Source/Common/TemplateActor.cs
@@ -55,28 +55,28 @@
 			return transform;
 		}

-		public void Add(Actor me)
+		public void Add(Actor actor)
 		{
-			me.conditionManualDeploy = manualDeploy;
-			EntityComposer entityComposer = new EntityComposer(me.entity, components.Length);
+			actor.conditionManualDeploy = manualDeploy;
+			EntityComposer entityComposer = new EntityComposer(actor.entity, components.Length);
 			for (int i = 0; i < components.Length; i++)
 			{
 				components[i].AsClone(ref entityComposer);
 			}

-			Tags.AddTagsRaw(me.entity, tags);
+			Tags.AddTagsRaw(actor.entity, tags);
 		}

-		public void Setup(Actor me)
+		public void Setup(Actor actor)
 		{
-			EntityComposer entityComposer = new EntityComposer(me.entity, components.Length);
+			EntityComposer entityComposer = new EntityComposer(actor.entity, components.Length);
 			for (int i = 0; i < components.Length; i++)
 			{
 				components[i].AsClone(ref entityComposer);
 			}

-			Tags.Clear(me.entity);
-			Tags.AddTagsRaw(me.entity, tags);
+			Tags.Clear(actor.entity);
+			Tags.AddTagsRaw(actor.entity, tags);
 		}
 	}
 }


Fixed rotation vector creating a top/down splitting animation when splitting units.

--- Assets/singleplayer/scripts/AIManager.cs
+++ Assets/singleplayer/scripts/AIManager.cs
@@ -27,6 +27,7 @@

 			SpawnRange range = owner.GetComponentInChildren<SpawnRange>();
 			this.rotationVector = Quaternion.Euler(new Vector3(0f, Random.Range(-180f, 180f), 0f)) * (Vector3.one * range.radius);
+			this.rotationVector.y = 0f;

 			AIUnit ownerUnit = owner.GetComponent<AIUnit>();
 			AIUnit splitUnit = split.GetComponent<AIUnit>();


[Modify] No second time

[Modify] No second time

--- websocket-sharp/WebSocket.cs
+++ websocket-sharp/WebSocket.cs
@@ -2369,6 +2369,8 @@

           if (invalid)
             return false;
+
+          comp = false;
         }
         else {
           return false;


[Modify] Polish it

[Modify] Polish it

--- websocket-sharp/WebSocket.cs
+++ websocket-sharp/WebSocket.cs
@@ -1631,7 +1631,8 @@
           return false;
         }

-        return sendBytes (new WebSocketFrame (fin, opcode, data, compressed, _client).ToArray ());
+        var frame = new WebSocketFrame (fin, opcode, data, compressed, _client);
+        return sendBytes (frame.ToArray ());
       }
     }


[Modify] Polish it

[Modify] Polish it

--- websocket-sharp/WebSocket.cs
+++ websocket-sharp/WebSocket.cs
@@ -931,49 +931,61 @@
       message = null;

       if (!context.IsWebSocketRequest) {
-        message = "Not a handshake request.";
+        message = "Not a WebSocket handshake request.";
+
         return false;
       }

       if (context.RequestUri == null) {
-        message = "It specifies an invalid Request-URI.";
+        message = "The Request-URI is invalid.";
+
         return false;
       }

       var headers = context.Headers;

       var key = headers["Sec-WebSocket-Key"];
+
       if (key == null) {
-        message = "It includes no Sec-WebSocket-Key header.";
+        message = "The Sec-WebSocket-Key header is non-existent.";
+
         return false;
       }

       if (key.Length == 0) {
-        message = "It includes an invalid Sec-WebSocket-Key header.";
+        message = "The Sec-WebSocket-Key header is invalid.";
+
         return false;
       }

       var version = headers["Sec-WebSocket-Version"];
+
       if (version == null) {
-        message = "It includes no Sec-WebSocket-Version header.";
+        message = "The Sec-WebSocket-Version header is non-existent.";
+
         return false;
       }

       if (version != _version) {
-        message = "It includes an invalid Sec-WebSocket-Version header.";
+        message = "The Sec-WebSocket-Version header is invalid.";
+
         return false;
       }

       var protocol = headers["Sec-WebSocket-Protocol"];
+
       if (protocol != null && protocol.Length == 0) {
-        message = "It includes an invalid Sec-WebSocket-Protocol header.";
+        message = "The Sec-WebSocket-Protocol header is invalid.";
+
         return false;
       }

       if (!_ignoreExtensions) {
         var extensions = headers["Sec-WebSocket-Extensions"];
+
         if (extensions != null && extensions.Length == 0) {
-          message = "It includes an invalid Sec-WebSocket-Extensions header.";
+          message = "The Sec-WebSocket-Extensions header is invalid.";
+
           return false;
         }
       }


Validation and conditional rendering of Generated Code section

--- BTCPayServer/Views/Apps/PayButton.cshtml
+++ BTCPayServer/Views/Apps/PayButton.cshtml
@@ -17,8 +17,10 @@

                         Price
-                        <input type="text" class="form-control"
-                               v-model="srvModel.price" v-on:change="inputChanges">
+                        <input name="price" type="text" class="form-control"
+                               v-model="srvModel.price" v-on:change="inputChanges"
+                               v-validate="'required|decimal|min_value:0'" :class="{'is-invalid': errors.has('price') }">
+                        {{ errors.first('price') }}

@@ -73,21 +75,25 @@

                     Server IPN
-                    <input type="text" class="form-control" placeholder="(optional)"
-                           v-model="srvModel.serverIpn" v-on:change="inputChanges">
+                    <input name="serverIpn" type="text" class="form-control" placeholder="(optional)"
+                           v-model="srvModel.serverIpn" v-on:change="inputChanges"
+                           v-validate="'email'" :class="{'is-invalid': errors.has('serverIpn') }">
+                    {{ errors.first('serverIpn') }}

                     Send Email Notifications to
-                    <input type="text" name="emailToNotify" class="form-control" placeholder="(optional)"
+                    <input name="emailToNotify" type="text" class="form-control" placeholder="(optional)"
                            v-model="srvModel.emailToNotify" v-on:change="inputChanges"
                            v-validate="'email'" :class="{'is-invalid': errors.has('emailToNotify') }">
                     {{ errors.first('emailToNotify') }}
-
+

                     Browser Redirect
-                    <input type="text" class="form-control" placeholder="(optional)"
-                           v-model="srvModel.browserRedirect" v-on:change="inputChanges">
+                    <input name="browserRedirect" type="text" class="form-control" placeholder="(optional)"
+                           v-model="srvModel.browserRedirect" v-on:change="inputChanges"
+                           v-validate="'url'" :class="{'is-invalid': errors.has('browserRedirect') }">
+                    {{ errors.first('browserRedirect') }}

@@ -100,13 +106,18 @@

Generated code

-

+

                  Copy Code

+

+

+

+

+                Please fix errors shown in order for code generation to successfully execute.


bug pablo

bug pablo

--- BeatIt!/AppCode/Pages/Challenge5.xaml.cs
+++ BeatIt!/AppCode/Pages/Challenge5.xaml.cs
@@ -216,5 +216,23 @@
             Canvas.SetLeft(redBall, x);
             Canvas.SetTop(redBall, y);
         }
+
+        protected override void OnBackKeyPress(System.ComponentModel.CancelEventArgs e)
+        {
+
+            if (_timer!= null &&  _timer.IsEnabled)
+            {
+                _timer.Stop();
+                _timer = null;
+            }
+
+            if (_acelerometer != null)
+            {
+                _acelerometer.Stop();
+                _acelerometer = null;
+            }
+
+            base.OnBackKeyPress(e);
+        }
     }
 }


Fix typo in comment

Fix typo in comment

--- Source/Csla.Blazor.WebAssembly/ConfigurationExtensions.cs
+++ Source/Csla.Blazor.WebAssembly/ConfigurationExtensions.cs
@@ -17,7 +17,7 @@
   public static class BlazorWasmConfigurationExtensions
   {
     /// <summary>
-    /// Registers services necessary for Windows Forms
+    /// Registers services necessary for Blazor WebAssembly.
     /// </summary>
     /// <param name="config">CslaConfiguration object</param>
     /// <returns></returns>


Updated Background.cs

Updated Background.cs

Added Winter pack.

--- BotBits/Models/World/Block/Background.cs
+++ BotBits/Models/World/Block/Background.cs
@@ -502,5 +502,16 @@
                 Purple = (Id)742;

         }
+
+        public static class Winter2018
+        {
+             [Pack("brickwinter2018")]
+             public const Id
+                 Brick = (Id)757,
+                 Snow = (Id)758,
+                 Ice = (Id)759,
+                 Slate = (Id)760;
+
+        }
     }
 }


Invalidating within a paint event needs queueing

--- Source/Eto.Platform.Mac/Forms/Controls/DrawableHandler.cs
+++ Source/Eto.Platform.Mac/Forms/Controls/DrawableHandler.cs
@@ -82,6 +82,18 @@
 			set { Control.CanFocus = value; }
 		}

+		public override void Invalidate()
+		{
+			if (!NeedsQueue(Invalidate))
+				base.Invalidate();
+		}
+
+		public override void Invalidate(Rectangle rect)
+		{
+			if (!NeedsQueue(() => Invalidate(rect)))
+				base.Invalidate(rect);
+		}
+
 		public void Update(Rectangle rect)
 		{
 			var context = NSGraphicsContext.CurrentContext;


Filter out posting key in emails.
Change who the email is from (hard coded to automatedemail@caes.ucdavis.edu) (Updated by TFS to TFS Connector, server: http://1x:8080/, id 6577. )

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

--- CRP/Controllers/TransactionController.cs
+++ CRP/Controllers/TransactionController.cs
@@ -442,14 +442,17 @@
                 if(transaction == null)
                 {
                     #region Email Error Results
-                    message = new MailMessage(ConfigurationManager.AppSettings["EmailForErrors"], ConfigurationManager.AppSettings["EmailForErrors"]);
+                    message = new MailMessage("automatedemail@caes.ucdavis.edu", ConfigurationManager.AppSettings["EmailForErrors"]);
                     message.Subject = "TouchNet Post Results -- Transaction not found";
                     message.IsBodyHtml = true;

                     foreach (var k in Request.Params.AllKeys)
                     {
-                        body.Append(k + ":" + Request.Params[k]);
-                        body.Append("
");
+                        if (k.ToLower() != "posting_key")
+                        {
+                            body.Append(k + ":" + Request.Params[k]);
+                            body.Append("
");
+                        }
                     }
                     message.Body = body.ToString();

@@ -562,14 +565,17 @@
                     }
                     if(transaction.TotalPaid > transaction.Total)
                     {
-                        message = new MailMessage(ConfigurationManager.AppSettings["EmailForErrors"], ConfigurationManager.AppSettings["EmailForErrors"]);
-                        message.Subject = "TouchNet Post Results -- Is Over Paid";
+                        message = new MailMessage("automatedemail@caes.ucdavis.edu", ConfigurationManager.AppSettings["EmailForErrors"]);
+                        message.Subject = "TouchNet Post Results -- Has Overpaid";
                         message.IsBodyHtml = true;

                         foreach (var k in Request.Params.AllKeys)
                         {
-                            body.Append(k + ":" + Request.Params[k]);
-                            body.Append("
");
+                            if (k.ToLower() != "posting_key")
+                            {
+                                body.Append(k + ":" + Request.Params[k]);
+                                body.Append("
");
+                            }
                         }
                         message.Body = body.ToString();

@@ -600,14 +606,17 @@
                 else
                 {
                     #region InValid PaymentLog -- Email Results
-                    message = new MailMessage(ConfigurationManager.AppSettings["EmailForErrors"], ConfigurationManager.AppSettings["EmailForErrors"]);
+                    message = new MailMessage("automatedemail@caes.ucdavis.edu", ConfigurationManager.AppSettings["EmailForErrors"]);
                     message.Subject = "Touchnet Post Results -- PaymentLog is Not Valid";
                     message.IsBodyHtml = true;

                     foreach (var k in Request.Params.AllKeys)
                     {
-                        body.Append(k + ":" + Request.Params[k]);
-                        body.Append("
");
+                        if (k.ToLower() != "posting_key")
+                        {
+                            body.Append(k + ":" + Request.Params[k]);
+                            body.Append("
");
+                        }
                     }
                     message.Body = body.ToString();


CsvExportAdapters: Added downsampling and time reasonability validation

--- Source/Libraries/Adapters/CsvAdapters/CsvExportAdapter.cs
+++ Source/Libraries/Adapters/CsvAdapters/CsvExportAdapter.cs
@@ -22,9 +22,13 @@
 //******************************************************************************************************

 using System;
+using System.Collections.Generic;
 using System.ComponentModel;
 using System.IO;
+using System.Linq;
+using System.Text;
 using GSF;
+using GSF.Collections;
 using GSF.Configuration;
 using GSF.Diagnostics;
 using GSF.IO;
@@ -54,12 +58,34 @@
         /// </summary>
         public const string DefaultTimestampFormat = "yyyy-MM-dd HH:mm:ss.fffffff";

+        /// <summary>
+        /// Default value for the <see cref="DownsampleInterval"/> property.
+        /// </summary>
+        public const double DefaultDownsampleInterval = 0.0D;
+
+        /// <summary>
+        /// Default value for the <see cref="EnableTimeReasonabilityValidation"/> property.
+        /// </summary>
+        public const bool DefaultEnableTimeReasonabilityValidation = false;
+
+        /// <summary>
+        /// Default value for the <see cref="LagTime"/> property.
+        /// </summary>
+        public const double DefaultLagTime = 5.0D;
+
+        /// <summary>
+        /// Default value for the <see cref="LeadTime"/> property.
+        /// </summary>
+        public const double DefaultLeadTime = 5.0D;
+
         private const string ScheduleName = nameof(CsvExportAdapter);

         // Fields
         private string m_activeFileName;
-        private object m_activeFileLock;
-        private ScheduleManager m_scheduleManager;
+        private readonly object m_activeFileLock;
+        private readonly ScheduleManager m_scheduleManager;
+        private readonly Dictionary<Guid, long> m_lastTimestamps;
+        private long m_totalExports;
         private bool m_disposed;

         #endregion
@@ -74,6 +100,7 @@
             m_activeFileLock = new object();
             m_scheduleManager = new ScheduleManager();
             m_scheduleManager.ScheduleDue += ScheduleManager_ScheduleDue;
+            m_lastTimestamps = new Dictionary<Guid, long>();
         }

         #endregion
@@ -114,6 +141,38 @@
         [Description("Defines the format of timestamps in the CSV exports")]
         public string TimestampFormat { get; set; }

+        /// <summary>
+        /// Gets or sets the downsampling interval, in seconds, set to zero for no downsampling.
+        /// </summary>
+        [ConnectionStringParameter]
+        [DefaultValue(DefaultDownsampleInterval)]
+        [Description("Defines the downsampling interval, in seconds, set to 0.0 for no downsampling")]
+        public double DownsampleInterval { get; set; }
+
+        /// <summary>
+        /// Gets or sets the flag that determines if timestamps should be validated against local clock for reasonability.
+        /// </summary>
+        [ConnectionStringParameter]
+        [DefaultValue(DefaultEnableTimeReasonabilityValidation)]
+        [Description("Defines the flag that determines if timestamps should be validated against local clock for reasonability")]
+        public bool EnableTimeReasonabilityValidation { get; set; }
+
+        /// <summary>
+        /// Gets or sets the allowed past time deviation tolerance against local clock for time reasonability validation, in seconds (can be sub-second).
+        /// </summary>
+        [ConnectionStringParameter]
+        [DefaultValue(DefaultLagTime)]
+        [Description("Defines the allowed past time deviation tolerance against local clock for time reasonability validation, in seconds (can be sub-second)")]
+        public double LagTime { get; set; }
+
+        /// <summary>
+        /// Gets or sets the allowed future time deviation tolerance against local clock for time reasonability validation, in seconds (can be sub-second).
+        /// </summary>
+        [ConnectionStringParameter]
+        [DefaultValue(DefaultLeadTime)]
+        [Description("Defines the allowed future time deviation tolerance against local clock for time reasonability validation, in seconds (can be sub-second)")]
+        public double LeadTime { get; set; }
+
         /// <summary>
         /// Gets the flag that determines if measurements sent to this <see cref="CsvExportAdapter"/> are destined for archival.
         /// </summary>
@@ -173,12 +232,34 @@
         }

         /// <summary>
+        /// Gets the status of this <see cref="CsvExportAdapter"/>.
+        /// </summary>
+        public override string Status
+        {
+            get
+            {
+                StringBuilder status = new StringBuilder(base.Status);
+
+                status.AppendLine($"               Export Path: {FilePath.TrimFileName(ExportPath, 51)}");
+                status.AppendLine($"              Offload Path: {FilePath.TrimFileName(OffloadPath, 51)}");
+                status.AppendLine($"         Rollover Schedule: {RolloverSchedule}");
+                status.AppendLine($"          Timestamp Format: {TimestampFormat}");
+                status.AppendLine($"       Downsample Interval: {(DownsampleInterval > 0.0D ? $"{DownsampleInterval:N4} seconds)" : "Disabled - Full Resolution Export")}");
+                status.AppendLine($" Time Reasonability Checks: {(EnableTimeReasonabilityValidation ? "Enabled" : "Disabled")}");
+                status.AppendLine($"          Allowed Lag Time: {LagTime:N4} seconds");
+                status.AppendLine($"         Allowed Lead Time: {LeadTime:N4} seconds");
+                status.AppendLine($"    Active CSV Export File: {FilePath.TrimFileName(m_activeFileName, 51)}");
+                status.AppendLine($"         Total CSV Exports: {m_totalExports:N0}");
+
+                return status.ToString();
+            }
+        }
+
+        /// <summary>
         /// Gets a short one-line status of this <see cref="CsvExportAdapter"/>.
         /// </summary>
-        public override string GetShortStatus(int maxLength)
-        {
-            return $"{ProcessedMeasurements} measurements exported so far...".CenterText(maxLength);
-        }
+        public override string GetShortStatus(int maxLength) =>
+            $"{ProcessedMeasurements} measurements exported so far...".CenterText(maxLength);

         /// <summary>
         /// Attempts to connect to data output stream.
@@ -202,6 +283,41 @@
             // Make sure the roll over the currently active file in case it would
             // otherwise end up sitting in the export directory for a long time
             RollOver();
+        }
+
+        /// <summary>
+        /// Queues a collection of measurements for processing. Measurements are automatically filtered to the defined <see cref="IAdapter.InputMeasurementKeys"/>.
+        /// </summary>
+        /// <param name="measurements">Measurements to queue for processing.</param>
+        public override void QueueMeasurementsForProcessing(IEnumerable<IMeasurement> measurements)
+        {
+            if (EnableTimeReasonabilityValidation)
+                measurements = measurements.Where(measurement => measurement.Timestamp.UtcTimeIsValid(LagTime, LeadTime));
+
+            if (DownsampleInterval > 0.0D)
+            {
+                List<IMeasurement> exportMeasurements = new List<IMeasurement>();
+
+                foreach (IMeasurement measurement in measurements)
+                {
+                    // Get last measurement timestamp -- initial timestamp is from top of second
+                    long lastTimestamp = m_lastTimestamps.GetOrDefault(measurement.ID, _ =>
+                        measurement.Timestamp.BaselinedTimestamp(BaselineTimeInterval.Second).Value);
+
+                    if ((measurement.Timestamp - lastTimestamp).ToSeconds() >= DownsampleInterval)
+                    {
+                        exportMeasurements.Add(measurement);
+                        m_lastTimestamps[measurement.ID] = measurement.Timestamp.Value;
+                    }
+                }
+
+                measurements = exportMeasurements;
+            }
+
+            if (measurements.Count() == 0)
+                return;
+
+            base.QueueMeasurementsForProcessing(measurements);
         }

         /// <summary>
@@ -235,21 +351,21 @@
         /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
         protected override void Dispose(bool disposing)
         {
-            if (!m_disposed)
-            {
-                try
+            if (m_disposed)
+                return;
+
+            try
+            {
+                if (disposing)
                 {
-                    if (disposing)
-                    {
-                        m_scheduleManager.Stop();
-                        m_scheduleManager.Dispose();
-                    }
+                    m_scheduleManager.Stop();
+                    m_scheduleManager.Dispose();
                 }
-                finally
-                {
-                    m_disposed = true;          // Prevent duplicate dispose.
-                    base.Dispose(disposing);    // Call base class Dispose().
-                }
+            }
+            finally
+            {
+                m_disposed = true;          // Prevent duplicate dispose.
+                base.Dispose(disposing);    // Call base class Dispose().
             }
         }

@@ -259,15 +375,13 @@
             string timestamp = measurement.Timestamp.ToString(TimestampFormat);
             string id = measurement.Key.SignalID.ToString();
             string value = measurement.AdjustedValue.ToString();
+
             return string.Join(",", timestamp, id, value);
         }

         // Generates the name of the next active file.
-        private string GenerateActiveFileName()
-        {
-            DateTime now = DateTime.UtcNow;
-            return $"{now:yyyy-MM-dd HH.mm}.csv";
-        }
+        private string GenerateActiveFileName() =>
+            $"{DateTime.UtcNow:yyyy-MM-dd HH.mm}.csv";

         // Rolls over the active file by moving it to the offload directory
         // and unsetting the active file name so that a new active file
@@ -283,6 +397,7 @@

                 activeFileName = m_activeFileName;
                 m_activeFileName = null;
+                m_totalExports++;
             }

             string activeFilePath = Path.Combine(ExportPath, activeFileName);
@@ -297,25 +412,21 @@

         // Executes the rollover process to offload the
         // currently active file and create a new active file.
-        private void ScheduleManager_ScheduleDue(object sender, EventArgs<Schedule> e)
-        {
+        private void ScheduleManager_ScheduleDue(object sender, EventArgs<Schedule> e) =>
             RollOver();
-        }

         // Handles the given exception.
-        private void HandleException(Exception ex)
-        {
+        private void HandleException(Exception ex) =>
             OnProcessException(MessageLevel.Error, ex);
-        }

         private StreamWriter AppendToFile(string filePath)
         {
             // The "Path traversal" security warning is not relevant
             // because the path comes from software configuration
             // performed by an administrator, not user input
-#pragma warning disable SG0018 // Path traversal
+            #pragma warning disable SG0018 // Path traversal
             return File.AppendText(filePath);
-#pragma warning restore SG0018 // Path traversal
+            #pragma warning restore SG0018
         }

         #endregion


Fix needs addition override

Fix needs addition override

I have no idea why I thought it was working yesterday because it clearly
wasn't working - the def was wrong. Fixed.

--- Source/MTW_AncestorSpirits/Detouring/Pawn_NeedsTracker.cs
+++ Source/MTW_AncestorSpirits/Detouring/Pawn_NeedsTracker.cs
@@ -37,7 +37,7 @@
                 return true;
             }
             */
-            if ((nd == NeedDefOf.Joy || nd == defComfort || nd == defBeauty || nd == defSpace) && pawn.def.defName == "AncestorSpirit") // ADDED
+            if ((nd == NeedDefOf.Joy || nd == defComfort || nd == defBeauty || nd == defSpace) && pawn.def.defName == "Spirit") // ADDED
             {
                 return true;
             }


Test composite Id Signed-off-by: hatem-b <hatem.belaid@gmail.com>

Test composite Id
Signed-off-by: hatem-b <10c67fca2bf6678a19aebf9d8ab447fdceee0336@gmail.com>

--- Source/UnitTests/SerialLabs.Data.Tests/CompositeIdTest.cs
+++ Source/UnitTests/SerialLabs.Data.Tests/CompositeIdTest.cs
@@ -63,8 +63,8 @@
             List<FakeItem<CompositeIdDesc>> actual = new List<FakeItem<CompositeIdDesc>>();

             actual = expected.OrderBy(x => x.Id.ToString()).ToList();
-
-            /* not complete */
+
+            AssertCompare(expected.First(), actual.Last());

         }

@@ -85,8 +85,8 @@
             List<FakeItem<CompositeIdAsc>> actual = new List<FakeItem<CompositeIdAsc>>();

             actual = expected.OrderBy(x => x.Id.ToString()).ToList();
-
-            /* not complete */
+
+            AssertCompare(expected.First(),actual.First());

         }

@@ -98,7 +98,19 @@
             Assert.AreEqual(expected.DateUtc, actual.DateUtc);
         }

-        public class FakeItem<IdType>
+        private static void AssertCompare(FakeItem<CompositeIdDesc> expected, FakeItem<CompositeIdDesc> actual)
+        {
+            AssertCompare(expected.Id, actual.Id);
+            Assert.AreEqual(expected.Name, actual.Name);
+        }
+
+        private static void AssertCompare(FakeItem<CompositeIdAsc> expected, FakeItem<CompositeIdAsc> actual)
+        {
+            AssertCompare(expected.Id, actual.Id);
+            Assert.AreEqual(expected.Name, actual.Name);
+        }
+
+        class FakeItem<IdType>
         {
             public IdType Id { get; set; }
             public string Name { get; set; }