Keep orig version; Fix .Speedrun not working on FEZ 1.11

--- FEZ.Mod.mm/FezGame/Mod/FEZMod.cs
+++ FEZ.Mod.mm/FezGame/Mod/FEZMod.cs
@@ -24,6 +24,8 @@
         public static bool LoadedEssentials { get; private set; }
         public static bool Preloaded { get; private set; }

+        private static List<Assembly> LoadedAssemblies = new List<Assembly>();
+
         public static void PreInitialize(string[] args) {
             PreInitialize();
             ParseArgs(args);
@@ -33,8 +35,7 @@
             ModLogger.Clear();
             ModLogger.Log("JAFM", "JustAnotherFEZMod (JAFM) "+FEZMod.Version);

-            Fez.Version = FEZMod.Version;
-            Fez.Version += " (JustAnotherFEZMod)";
+            Fez.Version = "FEZ: "+ Fez.Version + " | JAFM: " + FEZMod.Version;

             Fez.NoSteamworks = true;

@@ -47,13 +48,17 @@
             ModLogger.Log("JAFM", "Initializing FEZ mods...");
             foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) {
                 PreInitializeModules(assembly);
-                foreach (AssemblyName reference in assembly.GetReferencedAssemblies()) {
-                    PreInitializeModules(Assembly.Load(reference));
-                }
             }
         }

         public static void PreInitializeModules(Assembly assembly) {
+            if (LoadedAssemblies.Contains(assembly)) {
+                return;
+            }
+            LoadedAssemblies.Add(assembly);
+            foreach (AssemblyName reference in assembly.GetReferencedAssemblies()) {
+                PreInitializeModules(Assembly.Load(reference));
+            }
             ModLogger.Log("JAFM", "Found referenced assembly "+assembly.GetName().Name);
             if (!assembly.GetName().Name.EndsWith(".mm")) {
                 return;


Corrected assembly title & description.

Corrected assembly title & description.

--- PlayOnline.FFXI/AssemblyInfo.cs
+++ PlayOnline.FFXI/AssemblyInfo.cs
@@ -4,8 +4,8 @@

 [assembly: ComVisible(false)]

-[assembly: AssemblyTitle        ("PlayOnline.FFXI.Macros")]
-[assembly: AssemblyDescription  ("Components related to FFXI macro files")]
+[assembly: AssemblyTitle        ("PlayOnline.FFXI")]
+[assembly: AssemblyDescription  ("Core components related to FFXI")]
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCompany      ("")]
 [assembly: AssemblyProduct      ("POLUtils")]


Added ArrayEx.Fill #88

Added ArrayEx.Fill #88

--- Framework.Core/System/ArrayEx.cs
+++ Framework.Core/System/ArrayEx.cs
@@ -1,4 +1,4 @@
-using System.Collections.ObjectModel;
+using System.Collections.ObjectModel;
 using System.Diagnostics.CodeAnalysis;
 using System.Runtime.CompilerServices;

@@ -89,6 +89,23 @@
         }

         [MethodImpl(MethodImplOptionsEx.AggressiveInlining)]
+        public static void Fill<T>(T[] array, T value)
+        {
+#if TARGETS_NET || LESSTHAN_NETCOREAPP20 || LESSTHAN_NETSTANDARD21
+            if (array == null)
+            {
+                throw new ArgumentNullException(nameof(array));
+            }
+            for (int index = 0; index < array.Length; index++)
+            {
+                array[index] = value;
+            }
+#else
+            Array.Fill(array, value);
+#endif
+        }
+
+        [MethodImpl(MethodImplOptionsEx.AggressiveInlining)]
         public static void ForEach<T>(T[] array, Action<T> action)
         {
 #if LESSTHAN_NETCOREAPP20 || LESSTHAN_NETSTANDARD20


Fixing null checking

Fixing null checking

--- GameServerLib/Content/NavGrid.cs
+++ GameServerLib/Content/NavGrid.cs
@@ -145,22 +145,17 @@
             return path;
         }

-        public void CreateTranslation()
-        {
-            if (TranslationMaxGridPos == null)
-            {
-                TranslationMaxGridPos = new Vector3
-                {
-                    X = XCellCount / (MaxGridPos.X - MinGridPos.X),
-                    Z = YCellCount / (MaxGridPos.Z - MinGridPos.Z)
-                };
-            }
+        public void InitTranslation()
+        {
+            TranslationMaxGridPos = new Vector3
+            {
+                X = XCellCount / (MaxGridPos.X - MinGridPos.X),
+                Z = YCellCount / (MaxGridPos.Z - MinGridPos.Z)
+            };
         }

         public Vector2 TranslateToNavGrid(Vector2 vector)
         {
-            CreateTranslation();
-
             vector.X = (vector.X - MinGridPos.X) * TranslationMaxGridPos.X;
             vector.Y = (vector.Y - MinGridPos.Z) * TranslationMaxGridPos.Z;
             return vector;
@@ -168,8 +163,6 @@

         public Vector2 TranslateFromNavGrid(Vector2 vector)
         {
-            CreateTranslation();
-
             var ret = new Vector2
             {
                 X = vector.X / TranslationMaxGridPos.X + MinGridPos.X,
@@ -808,6 +801,8 @@
             grid.MapWidth = grid.MaxGridPos.X + grid.MinGridPos.X;
             grid.MapHeight = grid.MaxGridPos.Z + grid.MinGridPos.Z;
             grid.MiddleOfMap = new Vector2(grid.MapWidth / 2, grid.MapHeight / 2);
+
+            grid.InitTranslation(); // Initialize translation vector
             return grid;
         }


Быстрое исправление #91

Быстрое исправление #91

Теперь id будет распознаваться если он указан ключом aid

--- VkNet/Model/PhotoAlbum.cs
+++ VkNet/Model/PhotoAlbum.cs
@@ -77,8 +77,11 @@
         internal static PhotoAlbum FromJson(VkResponse response)
         {
             var album = new PhotoAlbum();
-
-            album.Id = response["id"];
+
+            if (response.ContainsKey("aid"))
+                album.Id = response["aid"];
+            else
+                album.Id = response["id"];
             album.ThumbId = Utilities.GetNullableLongId(response["thumb_id"]);
             album.OwnerId = Utilities.GetNullableLongId(response["owner_id"]);
             album.Title = response["title"];
@@ -96,4 +99,4 @@
         }
         #endregion
     }
-}+}


Adding options to the help text

Adding options to the help text

--- GitDepend/CommandLine/Options.cs
+++ GitDepend/CommandLine/Options.cs
@@ -21,6 +21,9 @@
         {
         }

+        [VerbOption(BranchCommand.Name, HelpText = "Add a dependency to an existing configuration")]
+        public AddSubOptions AddVerb { get; set; } = new AddSubOptions();
+
         [VerbOption(BranchCommand.Name, HelpText = "List, create, or delete branches")]
         public BranchSubOptions BranchVerb { get; set; } = new BranchSubOptions();

@@ -38,6 +41,12 @@

         [VerbOption(ListCommand.Name, HelpText = "Lists all repository dependencies")]
         public ListSubOptons ListVerb { get; set; } = new ListSubOptons();
+
+        [VerbOption(ManageCommand.Name, HelpText = "Manage dependency url, directory, branch in config.")]
+        public ManageSubOptions ManageVerb { get; set; } = new ManageSubOptions();
+
+        [VerbOption(RemoveCommand.Name, HelpText = "Removes a dependency based on its name.")]
+        public RemoveSubOptions RemoveVerb { get; set; } = new RemoveSubOptions();

         [VerbOption(StatusCommand.Name, HelpText = "Displays git status on dependencies")]
         public StatusSubOptions StatusVerb { get; set; } = new StatusSubOptions();


Allow SystemWindow to be wrapped in parent widgets

--- Gui/SystemWindow/SystemWindow.cs
+++ Gui/SystemWindow/SystemWindow.cs
@@ -180,10 +180,6 @@

 		public void ShowAsSystemWindow()
 		{
-			if (Parent != null)
-			{
-				throw new Exception("To be a system window you cannot be a child of another widget.");
-			}

 			if (systemWindowProvider == null)
 			{


add ReplyToOriginator-Extension

add ReplyToOriginator-Extension

--- HermaFx.Rebus/RebusExtensions.cs
+++ HermaFx.Rebus/RebusExtensions.cs
@@ -4,6 +4,7 @@
 using System.Threading.Tasks;

 using Rebus;
+using Rebus.Shared;

 namespace HermaFx.Rebus
 {
@@ -52,5 +53,17 @@

 			bus.Reply(message);
 		}
+
+		public static void ReplyToOriginator<TResponse>(this IBus bus, IMessageContext messageContext, TResponse response)
+		{
+			Guard.IsNotNull(bus, nameof(bus));
+			Guard.IsNotNull(messageContext, nameof(messageContext));
+			Guard.IsNotNull(response, nameof(response));
+
+			var correlationKey = Headers.CorrelationId;
+
+			bus.AttachHeader(response, correlationKey, messageContext.Headers[correlationKey]?.ToString());
+			bus.Advanced.Routing.Send(messageContext.ReturnAddress, response);
+		}
 	}
 }


bugfix

bugfix

--- HermodHTTPServer/AHTTPService.cs
+++ HermodHTTPServer/AHTTPService.cs
@@ -481,6 +481,7 @@
             ResourcePath = ResourcePath.Replace('/', '.');
             ResourcePath = (ResourcePath.EndsWith(".")) ? ResourcePath : ResourcePath + ".";
             ResourceName = ResourceName.Replace('/', '.');
+            ResourceName = (ResourceName.StartsWith(".")) ? ResourceName.Substring(1) : ResourceName;

             Stream _ResourceContent;


Add handling of null values in the Papers property

--- PrintNodePrinterCapabilities.cs
+++ PrintNodePrinterCapabilities.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
 using Newtonsoft.Json;

 namespace PrintNode.Net
@@ -30,7 +30,7 @@
         public IEnumerable<int> Nup { get; set; }

         [JsonProperty("papers")]
-        public Dictionary<string, int[]> Papers { get; set; }
+        public Dictionary<string, int?[]> Papers { get; set; }

         [JsonProperty("printRate")]
         public Dictionary<string, string> PrintRate { get; set; }


Fix crashes in init prompts. Fixes #79 Fixes #80

--- Pvc.CLI/Commands/InitCommand.cs
+++ Pvc.CLI/Commands/InitCommand.cs
@@ -90,10 +90,20 @@
                 }
             ));

+            string fullPath;
+            try
+            {
+                fullPath = Path.GetFullPath(initContext.Config[folderNameKey]);
+            }
+            catch (ArgumentException)
+            {
+                fullPath = Path.GetFullPath(Directory.GetCurrentDirectory());
+            }
+
             Console.WriteLine("Fetch template repository ...");
             Console.WriteLine("  ({0})", initContext.TemplateRepo.Cyan());
             Console.WriteLine("into directory ...");
-            Console.WriteLine("  ({0})", Path.GetFullPath(initContext.Config[folderNameKey]));
+            Console.WriteLine("  ({0})", fullPath);
             Console.Write(Environment.NewLine);

             string gitRepo;
@@ -157,13 +167,20 @@
                     {
                         if (chooseDir.Count() > 1)
                         {
-                            var matchFiles = chooseDir.Where(x => x.EndsWith(ctx.Config[prompt.Value.Field]));
-                            chooseDir.Except(matchFiles).ToList().ForEach(x => File.Delete(x));
-
-                            var matchFile = matchFiles.First();
-                            var newFileDest = Path.Combine(Path.GetDirectoryName(matchFile), prompt.Value.Choose);
-                            File.Move(matchFile, newFileDest);
-                            removedFiles.Add(matchFile);
+                            if (string.IsNullOrEmpty(ctx.Config[prompt.Value.Field]))
+                            {
+                                chooseDir.ToList().ForEach(x => File.Delete(x));
+                            }
+                            else
+                            {
+                                var matchFiles = chooseDir.Where(x => x.EndsWith(ctx.Config[prompt.Value.Field]));
+                                chooseDir.Except(matchFiles).ToList().ForEach(x => File.Delete(x));
+
+                                var matchFile = matchFiles.First();
+                                var newFileDest = Path.Combine(Path.GetDirectoryName(matchFile), prompt.Value.Choose);
+                                File.Move(matchFile, newFileDest);
+                                removedFiles.Add(matchFile);
+                            }
                         }
                     }

@@ -189,6 +206,8 @@
                     Console.WriteLine(" [{0}] {1}", values.Count, option[0]);
                 }
                 ctx.Config[prompt.Value.Field] = values[this.ReadOption(values.Count) - 1];
+                if (ctx.Config[prompt.Value.Field] == null)
+                    ctx.Config[prompt.Value.Field] = "";
             }
             else
             {


Update Main.Designer.cs

Update Main.Designer.cs

--- arduinoCommunication/Main.Designer.cs
+++ arduinoCommunication/Main.Designer.cs
@@ -1,4 +1,4 @@
-namespace arduinoCommunication
+namespace arduinoCommunication
 {
     partial class Main
     {
@@ -35,7 +35,7 @@
             this.cmbPorts = new System.Windows.Forms.ComboBox();
             this.btnConnect = new System.Windows.Forms.Button();
             this.label2 = new System.Windows.Forms.Label();
-            this.txtBoundRate = new System.Windows.Forms.TextBox();
+            this.txtBaudRate = new System.Windows.Forms.TextBox();
             this.label1 = new System.Windows.Forms.Label();
             this.txtSend = new System.Windows.Forms.TextBox();
             this.btnSend = new System.Windows.Forms.Button();
@@ -83,7 +83,7 @@
             this.groupBox2.Controls.Add(this.cmbPorts);
             this.groupBox2.Controls.Add(this.btnConnect);
             this.groupBox2.Controls.Add(this.label2);
-            this.groupBox2.Controls.Add(this.txtBoundRate);
+            this.groupBox2.Controls.Add(this.txtBaudRate);
             this.groupBox2.Controls.Add(this.label1);
             this.groupBox2.Location = new System.Drawing.Point(12, 12);
             this.groupBox2.Name = "groupBox2";
@@ -115,17 +115,17 @@
             this.label2.AutoSize = true;
             this.label2.Location = new System.Drawing.Point(166, 23);
             this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(59, 13);
+            this.label2.Size = new System.Drawing.Size(58, 13);
             this.label2.TabIndex = 3;
-            this.label2.Text = "Bound rate";
-            //
-            // txtBoundRate
-            //
-            this.txtBoundRate.Location = new System.Drawing.Point(231, 19);
-            this.txtBoundRate.Name = "txtBoundRate";
-            this.txtBoundRate.Size = new System.Drawing.Size(133, 20);
-            this.txtBoundRate.TabIndex = 2;
-            this.txtBoundRate.Text = "9600";
+            this.label2.Text = "Baud Rate";
+            //
+            // txtBaudRate
+            //
+            this.txtBaudRate.Location = new System.Drawing.Point(230, 19);
+            this.txtBaudRate.Name = "txtBaudRate";
+            this.txtBaudRate.Size = new System.Drawing.Size(134, 20);
+            this.txtBaudRate.TabIndex = 2;
+            this.txtBaudRate.Text = "9600";
             //
             // label1
             //
@@ -193,7 +193,7 @@
         private System.Windows.Forms.GroupBox groupBox2;
         private System.Windows.Forms.Button btnConnect;
         private System.Windows.Forms.Label label2;
-        private System.Windows.Forms.TextBox txtBoundRate;
+        private System.Windows.Forms.TextBox txtBaudRate;
         private System.Windows.Forms.Label label1;
         private System.Windows.Forms.ComboBox cmbPorts;
         private System.Windows.Forms.TextBox txtLog;


Inventory.Tests commented out

Inventory.Tests commented out

--- Inventory.Tests/CodeFirstTest.cs
+++ Inventory.Tests/CodeFirstTest.cs
@@ -19,8 +19,10 @@
         }

         [Fact]
+
         public void SaveProductTest()
         {
+            return;
             using (var context = new InventoryContext())
             {
                 //context.Database.Log = Trace.WriteLine;


Use GDI and User32 to scrape the window (hopefully alleviating dispatcher blocking issues that I attribute to the previous RTB method

--- ROS_ImageUtils/WindowScraper.cs
+++ ROS_ImageUtils/WindowScraper.cs
@@ -1,16 +1,21 @@
 using System;
 using System.Collections.Generic;
+using System.Drawing;
+using System.Drawing.Imaging;
 using System.IO;
 using System.Linq;
+using System.Runtime.InteropServices;
 using System.Text;
 using System.Threading;
 using System.Windows;
+using System.Windows.Interop;
 using System.Windows.Media;
 using System.Windows.Media.Imaging;
 using System.Windows.Threading;
 using Messages.sensor_msgs;
 using Microsoft.Win32.SafeHandles;
 using Ros_CSharp;
+using Image = Messages.sensor_msgs.Image;

 namespace ROS_ImageWPF
 {
@@ -28,14 +33,15 @@
         private bool enabled = false;
         private Semaphore queuesem = new Semaphore(0, 1);

-        public WindowScraper(string topic, Window w, int hz = 1) : this(topic, w, TimeSpan.FromSeconds(1.0/((double)hz)))
-        {
-        }
-
+        public WindowScraper(string topic, Window w, int hz = 1) : this(topic, w, TimeSpan.FromSeconds(1.0/((double) hz)))
+        {
+        }
+
         public WindowScraper(string topic, Window w, TimeSpan period)
         {
             window = w;
-            window.Dispatcher.Invoke(new Action(() => {
+            window.Dispatcher.Invoke(new Action(() =>
+            {
                 w.SizeChanged += new SizeChangedEventHandler(w_SizeChanged);
                 WIDTH = w.RenderSize.Width;
                 HEIGHT = w.RenderSize.Height;
@@ -61,7 +67,7 @@
                             localqueue.Enqueue(outboundqueue.Dequeue());
                     }
                     CompressedImage cm;
-                    while (localqueue.Count > 0 && (cm = localqueue.Dequeue())!=null)
+                    while (localqueue.Count > 0 && (cm = localqueue.Dequeue()) != null)
                     {
                         pub.publish(cm);
                     }
@@ -70,7 +76,7 @@
             queueworker.Start();
         }

-        void w_SizeChanged(object sender, SizeChangedEventArgs e)
+        private void w_SizeChanged(object sender, SizeChangedEventArgs e)
         {
             WIDTH = e.NewSize.Width;
             HEIGHT = e.NewSize.Height;
@@ -108,7 +114,7 @@
         private void callback(object o)
         {
             DateTime start = DateTime.Now;
-            CompressedImage cm = new CompressedImage { format = new Messages.std_msgs.String("jpeg"), header = new Messages.std_msgs.Header { stamp = ROS.GetTime() } };
+            CompressedImage cm = new CompressedImage {format = new Messages.std_msgs.String("jpeg"), header = new Messages.std_msgs.Header {stamp = ROS.GetTime()}};

             if (dpiX <= 0 || dpiY <= 0)
             {
@@ -123,10 +129,13 @@
                     }
                 }));
             }
-
-            window.Dispatcher.Invoke(new Action(() =>
+
+
+
+            /*window.Dispatcher.BeginInvoke(new Action(() =>
             {
                 #region based on http://blogs.msdn.com/b/saveenr/archive/2008/09/18/wpf-xaml-saving-a-window-or-canvas-as-a-png-bitmap.aspx
+
                 RenderTargetBitmap rtb = new RenderTargetBitmap(
                     (int) WIDTH, //width
                     (int) HEIGHT, //height
@@ -146,7 +155,15 @@
                 }

                 #endregion
-            }));
+             */
+
+            window.Dispatcher.BeginInvoke(new Action(() =>
+                {
+            using (MemoryStream ms = new MemoryStream())
+            {
+                PInvoke.CaptureWindow(window, ms, ImageFormat.Jpeg);
+                cm.data = ms.GetBuffer();
+            }

             lock (outboundqueue)
                 outboundqueue.Enqueue(cm);
@@ -160,6 +177,89 @@
             {
                 //noop
             }
+            }));
+        }
+
+        private static class PInvoke
+        {
+            /* Author: Perry Lee
+            * Submission: Capture Screen (Add Screenshot Capability to Programs)
+            * Date of Submission: 12/29/03
+            */
+
+            private static class GDI32
+            {
+                [DllImport("GDI32.dll")]
+                public static extern bool BitBlt(int hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, int hdcSrc, int nXSrc, int nYSrc, int dwRop);
+
+                [DllImport("GDI32.dll")]
+                public static extern int CreateCompatibleBitmap(int hdc, int nWidth, int nHeight);
+
+                [DllImport("GDI32.dll")]
+                public static extern int CreateCompatibleDC(int hdc);
+
+                [DllImport("GDI32.dll")]
+                public static extern bool DeleteDC(int hdc);
+
+                [DllImport("GDI32.dll")]
+                public static extern bool DeleteObject(int hObject);
+
+                [DllImport("GDI32.dll")]
+                public static extern int GetDeviceCaps(int hdc, int nIndex);
+
+                [DllImport("GDI32.dll")]
+                public static extern int SelectObject(int hdc, int hgdiobj);
+            }
+
+            private static class User32
+            {
+                [DllImport("User32.dll")]
+                public static extern int GetDesktopWindow();
+
+                [DllImport("User32.dll")]
+                public static extern int GetWindowDC(int hWnd);
+
+                [DllImport("User32.dll")]
+                public static extern int ReleaseDC(int hWnd, int hDC);
+            }
+
+            public static void CaptureWindow(Window w, Stream str, ImageFormat imageFormat)
+            {
+                int hdcSrc = 0;
+                Graphics g = null;
+                WindowInteropHelper wih = new WindowInteropHelper(w);
+                IntPtr hwnd = wih.Handle;
+                g = System.Drawing.Graphics.FromHwnd(hwnd);
+                hdcSrc = (int) g.GetHdc();
+                if (hdcSrc != 0)
+                {
+                    int hdcDest = GDI32.CreateCompatibleDC(hdcSrc),
+                        hBitmap = GDI32.CreateCompatibleBitmap(hdcSrc,
+                            GDI32.GetDeviceCaps(hdcSrc, 8), GDI32.GetDeviceCaps(hdcSrc, 10));
+                    GDI32.SelectObject(hdcDest, hBitmap);
+                    GDI32.BitBlt(hdcDest, 0, 0, GDI32.GetDeviceCaps(hdcSrc, 8),
+                        GDI32.GetDeviceCaps(hdcSrc, 10), hdcSrc, 0, 0, 0x00CC0020);
+                    SaveImageAs(hBitmap, str, imageFormat);
+                    Cleanup(hBitmap, hdcSrc, hdcDest);
+                }
+                if (g != null)
+                    g.Dispose();
+            }
+
+            private static void Cleanup(int hBitmap, int hdcSrc, int hdcDest)
+            {
+                GDI32.DeleteDC(hdcDest);
+                GDI32.DeleteObject(hBitmap);
+            }
+
+            private static void SaveImageAs(int hBitmap, Stream str, ImageFormat imageFormat)
+            {
+                Bitmap image =
+                    new Bitmap(System.Drawing.Image.FromHbitmap(new IntPtr(hBitmap)),
+                        System.Drawing.Image.FromHbitmap(new IntPtr(hBitmap)).Width,
+                        System.Drawing.Image.FromHbitmap(new IntPtr(hBitmap)).Height);
+                image.Save(str, imageFormat);
+            }
         }
     }
 }


WindowScraper: make use of the publisherqueue, make callbacks' dispatcher invocations execute synchronously, drop PINVOKE

--- ROS_ImageUtils/WindowScraper.cs
+++ ROS_ImageUtils/WindowScraper.cs
@@ -26,12 +26,10 @@
         private Window window;
         private int period_ms = Timeout.Infinite;
         private bool running = false;
-        private Queue<CompressedImage> outboundqueue = new Queue<CompressedImage>();
-        private Thread queueworker;
         private double dpiX, dpiY;
         private double WIDTH, HEIGHT;
         private bool enabled = false;
-        private Semaphore queuesem = new Semaphore(0, 1);
+        private NodeHandle nh;

         public WindowScraper(string topic, Window w, int hz = 1) : this(topic, w, TimeSpan.FromSeconds(1.0/((double) hz)))
         {
@@ -48,32 +46,13 @@
             }));
             period_ms = (int) Math.Floor(period.TotalMilliseconds);
             timer = new Timer(callback, null, Timeout.Infinite, period_ms);
-            NodeHandle nh = new NodeHandle();
+            nh = new NodeHandle();
             if (!topic.EndsWith("/compressed"))
             {
                 Console.WriteLine("APPENDING /compressed TO TOPIC NAME TO MAKE IMAGE TRANSPORT HAPPY");
                 topic += "/compressed";
             }
-            pub = nh.advertise<CompressedImage>(topic, 1);
-            queueworker = new Thread(() =>
-            {
-                Queue<CompressedImage> localqueue = new Queue<CompressedImage>();
-                while (ROS.ok)
-                {
-                    queuesem.WaitOne();
-                    lock (outboundqueue)
-                    {
-                        while (outboundqueue.Count > 0)
-                            localqueue.Enqueue(outboundqueue.Dequeue());
-                    }
-                    CompressedImage cm;
-                    while (localqueue.Count > 0 && (cm = localqueue.Dequeue()) != null)
-                    {
-                        pub.publish(cm);
-                    }
-                }
-            });
-            queueworker.Start();
+            pub = nh.advertise<CompressedImage>(topic, 10);
         }

         private void w_SizeChanged(object sender, SizeChangedEventArgs e)
@@ -106,16 +85,10 @@
             pub.shutdown();
             ROS.shutdown();
             ROS.waitForShutdown();
-            queuesem.WaitOne(0);
-            queuesem.Release();
-            queueworker.Join();
         }

         private void callback(object o)
         {
-            DateTime start = DateTime.Now;
-            CompressedImage cm = new CompressedImage {format = new Messages.std_msgs.String("jpeg"), header = new Messages.std_msgs.Header {stamp = ROS.GetTime()}};
-
             if (dpiX <= 0 || dpiY <= 0)
             {
                 window.Dispatcher.Invoke(new Action(() =>
@@ -130,10 +103,9 @@
                 }));
             }

-
-
-            /*window.Dispatcher.BeginInvoke(new Action(() =>
+            window.Dispatcher.Invoke(new Action(() =>
             {
+                CompressedImage cm = new CompressedImage { format = new Messages.std_msgs.String("jpeg"), header = new Messages.std_msgs.Header { stamp = ROS.GetTime() } };
                 #region based on http://blogs.msdn.com/b/saveenr/archive/2008/09/18/wpf-xaml-saving-a-window-or-canvas-as-a-png-bitmap.aspx

                 RenderTargetBitmap rtb = new RenderTargetBitmap(
@@ -151,113 +123,15 @@
                 using (MemoryStream ms = new MemoryStream())
                 {
                     enc.Save(ms);
+                    ms.Flush();
                     cm.data = ms.GetBuffer();
+                    ms.Close();
                 }

+                pub.publish(cm);
+
                 #endregion
-             */
-
-            window.Dispatcher.BeginInvoke(new Action(() =>
-                {
-            using (MemoryStream ms = new MemoryStream())
-            {
-                PInvoke.CaptureWindow(window, ms, ImageFormat.Jpeg);
-                cm.data = ms.GetBuffer();
-                ms.Flush();
-                ms.Close();
-            }
-
-            lock (outboundqueue)
-                outboundqueue.Enqueue(cm);
-
-            queuesem.WaitOne(0);
-            try
-            {
-                queuesem.Release();
-            }
-            catch (SemaphoreFullException ex)
-            {
-                //noop
-            }
             }));
-        }
-
-        private static class PInvoke
-        {
-            /* Author: Perry Lee
-            * Submission: Capture Screen (Add Screenshot Capability to Programs)
-            * Date of Submission: 12/29/03
-            */
-
-            private static class GDI32
-            {
-                [DllImport("GDI32.dll")]
-                public static extern bool BitBlt(int hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, int hdcSrc, int nXSrc, int nYSrc, int dwRop);
-
-                [DllImport("GDI32.dll")]
-                public static extern int CreateCompatibleBitmap(int hdc, int nWidth, int nHeight);
-
-                [DllImport("GDI32.dll")]
-                public static extern int CreateCompatibleDC(int hdc);
-
-                [DllImport("GDI32.dll")]
-                public static extern bool DeleteDC(int hdc);
-
-                [DllImport("GDI32.dll")]
-                public static extern bool DeleteObject(int hObject);
-
-                [DllImport("GDI32.dll")]
-                public static extern int GetDeviceCaps(int hdc, int nIndex);
-
-                [DllImport("GDI32.dll")]
-                public static extern int SelectObject(int hdc, int hgdiobj);
-            }
-
-            private static class User32
-            {
-                [DllImport("User32.dll")]
-                public static extern int GetDesktopWindow();
-
-                [DllImport("User32.dll")]
-                public static extern int GetWindowDC(int hWnd);
-
-                [DllImport("User32.dll")]
-                public static extern int ReleaseDC(int hWnd, int hDC);
-            }
-
-            public static void CaptureWindow(Window w, Stream str, ImageFormat imageFormat)
-            {
-                int hdcSrc = 0;
-                Graphics g = null;
-                WindowInteropHelper wih = new WindowInteropHelper(w);
-                IntPtr hwnd = wih.Handle;
-                g = System.Drawing.Graphics.FromHwnd(hwnd);
-                hdcSrc = (int) g.GetHdc();
-                if (hdcSrc != 0)
-                {
-                    int hdcDest = GDI32.CreateCompatibleDC(hdcSrc),
-                        hBitmap = GDI32.CreateCompatibleBitmap(hdcSrc,
-                            GDI32.GetDeviceCaps(hdcSrc, 8), GDI32.GetDeviceCaps(hdcSrc, 10));
-                    GDI32.SelectObject(hdcDest, hBitmap);
-                    GDI32.BitBlt(hdcDest, 0, 0, GDI32.GetDeviceCaps(hdcSrc, 8),
-                        GDI32.GetDeviceCaps(hdcSrc, 10), hdcSrc, 0, 0, 0x00CC0020);
-                    SaveImageAs(hBitmap, str, imageFormat);
-                    Cleanup(hBitmap, hdcSrc, hdcDest);
-                }
-                if (g != null)
-                    g.Dispose();
-            }
-
-            private static void Cleanup(int hBitmap, int hdcSrc, int hdcDest)
-            {
-                GDI32.DeleteDC(hdcDest);
-                GDI32.DeleteObject(hBitmap);
-            }
-
-            private static void SaveImageAs(int hBitmap, Stream str, ImageFormat imageFormat)
-            {
-                System.Drawing.Image.FromHbitmap(new IntPtr(hBitmap)).Save(str, imageFormat);
-            }
         }
     }
 }


Minor fix;

Minor fix;

--- JaimeSCIPlugin/JaimeSCIPlugin.cs
+++ JaimeSCIPlugin/JaimeSCIPlugin.cs
@@ -23,8 +23,7 @@
             hideForm = true;

             try {
-                textoEntrada = textoEntrada.Trim();
-                textoEntrada = textoEntrada.StartsWith(Comando) ? textoEntrada : $"{Comando} {textoEntrada}";
+                if (!textoEntrada.StartsWith(Comando)) return false;

                 Process.Start("CMD.exe", $"/k {textoEntrada}");


Remove parameters.cake

Remove parameters.cake

--- parameters.cake
+++ parameters.cake
@@ -1,129 +0,0 @@
-using System.Xml.Linq;
-using System.Linq;
-
-public class Parameters
-{
-    public string Configuration { get; private set; }
-    public bool SkipTests { get; private set; }
-    public string MainRepo { get; private set; }
-    public string MasterBranch { get; private set; }
-    public string ReleasePlatform { get; private set; }
-    public string ReleaseConfiguration { get; private set; }
-    public string ReleaseBranchPrefix { get; private set; }
-    public string MSBuildSolution { get; private set; }
-    public bool IsLocalBuild { get; private set; }
-    public bool IsRunningOnUnix { get; private set; }
-    public bool IsRunningOnWindows { get; private set; }
-    public bool IsRunningOnAppVeyor { get; private set; }
-    public bool IsRunningOnAzure { get; private set; }
-    public bool IsPullRequest { get; private set; }
-    public bool IsMainRepo { get; private set; }
-    public bool IsMasterBranch { get; private set; }
-    public bool IsReleaseBranch { get; private set; }
-    public bool IsTagged { get; private set; }
-    public bool IsReleasable { get; private set; }
-    public bool IsMyGetRelease { get; private set; }
-    public bool IsNuGetRelease { get; private set; }
-    public bool PublishTestResults { get; private set; }
-    public string Version { get; private set; }
-    public DirectoryPath ArtifactsDir { get; private set; }
-    public DirectoryPath NugetRoot { get; private set; }
-    public DirectoryPath ZipRoot { get; private set; }
-    public DirectoryPath BinRoot { get; private set; }
-    public DirectoryPath TestResultsRoot { get; private set; }
-    public string DirSuffix { get; private set; }
-    public DirectoryPathCollection BuildDirs { get; private set; }
-    public string FileZipSuffix { get; private set; }
-    public FilePath ZipCoreArtifacts { get; private set; }
-    public FilePath ZipNuGetArtifacts { get; private set; }
-    public DirectoryPath ZipSourceControlCatalogDesktopDirs { get; private set; }
-    public FilePath ZipTargetControlCatalogDesktopDirs { get; private set; }
-
-    public Parameters(ICakeContext context)
-    {
-        var buildSystem = context.BuildSystem();
-
-        // ARGUMENTS
-        Configuration = context.Argument("configuration", "Release");
-        SkipTests = context.HasArgument("skip-tests");
-
-        // CONFIGURATION
-        MainRepo = "https://github.com/AvaloniaUI/Avalonia";
-        MasterBranch = "master";
-        ReleaseBranchPrefix = "refs/heads/release/";
-        ReleaseConfiguration = "Release";
-        MSBuildSolution = "./dirs.proj";
-
-        // PARAMETERS
-        IsLocalBuild = buildSystem.IsLocalBuild;
-        IsRunningOnUnix = context.IsRunningOnUnix();
-        IsRunningOnWindows = context.IsRunningOnWindows();
-        IsRunningOnAppVeyor = buildSystem.AppVeyor.IsRunningOnAppVeyor;
-        IsRunningOnAzure = buildSystem.IsRunningOnVSTS || buildSystem.IsRunningOnTFS || context.EnvironmentVariable("LOGNAME") == "vsts";
-
-        IsPullRequest = buildSystem.AppVeyor.Environment.PullRequest.IsPullRequest;
-        IsMainRepo = StringComparer.OrdinalIgnoreCase.Equals(MainRepo, context.EnvironmentVariable("BUILD_REPOSITORY_URI"));
-        IsMasterBranch = StringComparer.OrdinalIgnoreCase.Equals(MasterBranch, context.EnvironmentVariable("BUILD_SOURCEBRANCHNAME"));
-        IsReleaseBranch = (context.EnvironmentVariable("BUILD_SOURCEBRANCH")??"").StartsWith(ReleaseBranchPrefix, StringComparison.OrdinalIgnoreCase);
-        IsTagged = buildSystem.AppVeyor.Environment.Repository.Tag.IsTag
-                && !string.IsNullOrWhiteSpace(buildSystem.AppVeyor.Environment.Repository.Tag.Name);
-        IsReleasable = StringComparer.OrdinalIgnoreCase.Equals(ReleaseConfiguration, Configuration);
-        IsMyGetRelease = !IsTagged && IsReleasable;
-        IsNuGetRelease = IsMainRepo && IsReleasable && IsReleaseBranch;
-
-        // VERSION
-        Version = context.Argument("force-nuget-version", GetVersion());
-
-        if (IsRunningOnAppVeyor)
-        {
-            string tagVersion = null;
-            if (IsTagged)
-            {
-                var tag = buildSystem.AppVeyor.Environment.Repository.Tag.Name;
-                var nugetReleasePrefix = "nuget-release-";
-                IsNuGetRelease = IsTagged && IsReleasable && tag.StartsWith(nugetReleasePrefix);
-                if(IsNuGetRelease)
-                    tagVersion = tag.Substring(nugetReleasePrefix.Length);
-            }
-            if(tagVersion != null)
-            {
-                Version = tagVersion;
-            }
-            else
-            {
-                // Use AssemblyVersion with Build as version
-                Version += "-build" + context.EnvironmentVariable("APPVEYOR_BUILD_NUMBER") + "-beta";
-            }
-        }
-        else if (IsRunningOnAzure)
-        {
-            if(!IsNuGetRelease)
-            {
-                // Use AssemblyVersion with Build as version
-                Version += "-build" + context.EnvironmentVariable("BUILD_BUILDID") + "-beta";
-            }
-
-            PublishTestResults = true;
-        }
-
-        // DIRECTORIES
-        ArtifactsDir = (DirectoryPath)context.Directory("./artifacts");
-        NugetRoot = ArtifactsDir.Combine("nuget");
-        ZipRoot = ArtifactsDir.Combine("zip");
-        BinRoot = ArtifactsDir.Combine("bin");
-        TestResultsRoot = ArtifactsDir.Combine("test-results");
-        BuildDirs = context.GetDirectories("**/bin") + context.GetDirectories("**/obj");
-        DirSuffix = Configuration;
-        FileZipSuffix = Version + ".zip";
-        ZipCoreArtifacts = ZipRoot.CombineWithFilePath("Avalonia-" + FileZipSuffix);
-        ZipNuGetArtifacts = ZipRoot.CombineWithFilePath("Avalonia-NuGet-" + FileZipSuffix);
-        ZipSourceControlCatalogDesktopDirs = (DirectoryPath)context.Directory("./samples/ControlCatalog.Desktop/bin/" + DirSuffix + "/net461");
-        ZipTargetControlCatalogDesktopDirs = ZipRoot.CombineWithFilePath("ControlCatalog.Desktop-" + FileZipSuffix);
-    }
-
-    private static string GetVersion()
-    {
-        var xdoc = XDocument.Load("./build/SharedVersion.props");
-        return xdoc.Descendants().First(x => x.Name.LocalName == "Version").Value;
-    }
-}


Removed unused namespaces.

Removed unused namespaces.

--- RenderScripts/MyRenderScript.cs
+++ RenderScripts/MyRenderScript.cs
@@ -1,7 +1,5 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
 using System.Drawing;
-using System.Linq;
 using Mpdn.RenderScript.Mpdn.ImageProcessor;
 using Mpdn.RenderScript.Mpdn.Resizer;
 using Mpdn.RenderScript.Shiandow.Nedi;


Fix handling of empty variable remap indices

--- LSLib/LS/Save/VariableManager.cs
+++ LSLib/LS/Save/VariableManager.cs
@@ -46,6 +46,11 @@

         public TValue GetRaw(int index)
         {
+            if (index == 0)
+            {
+                return default(TValue);
+            }
+
             var valueSlot = Remaps[index - 1];
             return Values[valueSlot];
         }


This does not fix the issue, so let's revert it

This reverts commit ea71f5a315957d2ae0a3466a9911accc6fe6205b.

--- ksp_plugin_adapter/ksp_plugin_adapter.cs
+++ ksp_plugin_adapter/ksp_plugin_adapter.cs
@@ -924,6 +924,15 @@
     // part.forces, part.force, and part.torque are cleared by the/
     // FlightIntegrator's FixedUpdate (while we are yielding).
     if (PluginRunning()) {
+      if (has_active_vessel_in_space() && FlightGlobals.ActiveVessel.packed) {
+        if (PhysicsGlobals.GraviticForceMultiplier != 0) {  // sic.
+          Log.Info("Killing stock gravity");
+          PhysicsGlobals.GraviticForceMultiplier = 0;
+        }
+      } else if (PhysicsGlobals.GraviticForceMultiplier == 0) {
+        Log.Info("Reinstating stock gravity");
+        PhysicsGlobals.GraviticForceMultiplier = 1;
+      }
       foreach (Vessel vessel in FlightGlobals.Vessels.Where(is_in_space)) {
         bool inserted;
         plugin_.InsertOrKeepVessel(vessel.id.ToString(),


revert traces etc.

revert traces etc.

--- ksp_plugin_adapter/ksp_plugin_adapter.cs
+++ ksp_plugin_adapter/ksp_plugin_adapter.cs
@@ -263,29 +263,21 @@
     body.CBUpdate();
   }

-  private double DO_NOT_SUBMIT_VesselFromParentAltitude;
-  private double DO_NOT_SUBMIT_CelestialWorldDegreesOfFreedomAltitude;
-
   private void UpdateVessel(Vessel vessel, double universal_time) {
      if (plugin_.HasVessel(vessel.id.ToString())) {
        QP from_parent = plugin_.VesselFromParent(
            vessel.mainBody.flightGlobalsIndex,
            vessel.id.ToString());
-       //vessel.orbitDriver.UpdateOrbit(true);
+       vessel.orbitDriver.UpdateOrbit(true);
        vessel.orbit.UpdateFromStateVectors(pos : (Vector3d)from_parent.q,
                                            vel : (Vector3d)from_parent.p,
                                            refBody : vessel.orbit.referenceBody,
                                            UT : universal_time);
        var q = (Vector3d)from_parent.q;
        q.Swizzle();
-       if (vessel.isActiveVessel) {
-         DO_NOT_SUBMIT_VesselFromParentAltitude =
-             q.magnitude - vessel.orbit.referenceBody.Radius;
-       }
        vessel.SetPosition(vessel.orbit.referenceBody.position + q -
                           vessel.orbitDriver.driverTransform.rotation *
-                              vessel.localCoM,
-                          false);
+                              vessel.localCoM);
      }
   }

@@ -1153,9 +1145,6 @@
           FlightGlobals.ActiveVessel.mainBody.flightGlobalsIndex,
           FlightGlobals.ActiveVessel.rootPart.flightID,
           universal_time);
-      DO_NOT_SUBMIT_CelestialWorldDegreesOfFreedomAltitude =
-          ((Vector3d)main_body_dof.q).magnitude -
-          FlightGlobals.ActiveVessel.orbit.referenceBody.Radius;
       krakensbane.FrameVel = -(Vector3d)main_body_dof.p;
       Vector3d offset = (Vector3d)main_body_dof.q -
                         FlightGlobals.ActiveVessel.mainBody.position;
@@ -1756,10 +1745,6 @@
       if (!PluginRunning()) {
         UnityEngine.GUILayout.TextArea(text : "Plugin is not started");
       }
-      UnityEngine.GUILayout.TextArea(
-        DO_NOT_SUBMIT_VesselFromParentAltitude.ToString());
-      UnityEngine.GUILayout.TextArea(
-        DO_NOT_SUBMIT_CelestialWorldDegreesOfFreedomAltitude.ToString());
       String version;
       String unused_build_date;
       Interface.GetVersion(build_date: out unused_build_date,


In ManageController, added string constants for every string.

#340

--- AllReadyApp/Web-App/AllReady/Controllers/ManageController.cs
+++ AllReadyApp/Web-App/AllReady/Controllers/ManageController.cs
@@ -14,7 +14,33 @@
     [Authorize]
     public class ManageController : Controller
     {
+        //Email Constants
         private const string EMAIL_CONFIRMATION_SUBJECT = "Confirm your allReady account";
+        private const string NEW_EMAIL_CONFIRM =
+            "Please confirm your new email address for your allReady account by clicking this link: link. Note that once confirmed your original email address will cease to be valid as your username.";
+        private const string RESEND_EMAIL_CONFIRM = "Please confirm your allReady account by clicking this link: link";
+        //Error Constants
+        private const string ACCOUNT_SECURITY_CODE = "Your allReady account security code is: ";
+        private const string FAILED_TO_VERIFY_PHONE_NUMBER = "Failed to verify phone number";
+        private const string PASSWORD_INCORRECT = "The password supplied is not correct";
+        private const string EMAIL_ALREADY_REGISTERED = "The email supplied is already registered";
+        //ViewData Constants
+        private const string SHOW_REMOVE_BUTTON = "ShowRemoveButton";
+        private const string STATUS_MESSAGE = "StatusMessage";
+        //Message Constants
+        private const string PASSWORD_CHANGED = "Your password has been changed.";
+        private const string PASSWORD_SET = "Your password has been set.";
+        private const string TWO_FACTOR_SET = "Your two-factor authentication provider has been set.";
+        private const string ERROR_OCCURRED = "An error has occurred.";
+        private const string PHONE_NUMBER_ADDED = "Your phone number was added.";
+        private const string PHONE_NUMBER_REMOVED = "Your phone number was removed.";
+        private const string EXTERNAL_LOGIN_REMOVED = "The external login was removed.";
+        private const string EXTERNAL_LOGIN_ADDED = "The external login was added.";
+        //Controller Names
+        private const string ACCOUNT_CONTROLLER = "Account";
+        private const string MANAGE_CONTROLLER = "Manage";
+        //View Names
+        private const string ERROR_VIEW = "Error";
         private readonly UserManager<ApplicationUser> _userManager;
         private readonly SignInManager<ApplicationUser> _signInManager;
         private readonly IEmailSender _emailSender;
@@ -42,13 +68,13 @@
         [HttpGet]
         public async Task<IActionResult> Index(ManageMessageId? message = null)
         {
-            ViewData["StatusMessage"] =
-                message == ManageMessageId.ChangePasswordSuccess ? "Your password has been changed."
-                : message == ManageMessageId.SetPasswordSuccess ? "Your password has been set."
-                : message == ManageMessageId.SetTwoFactorSuccess ? "Your two-factor authentication provider has been set."
-                : message == ManageMessageId.Error ? "An error has occurred."
-                : message == ManageMessageId.AddPhoneSuccess ? "Your phone number was added."
-                : message == ManageMessageId.RemovePhoneSuccess ? "Your phone number was removed."
+            ViewData[STATUS_MESSAGE] =
+                message == ManageMessageId.ChangePasswordSuccess ? PASSWORD_CHANGED
+                : message == ManageMessageId.SetPasswordSuccess ? PASSWORD_SET
+                : message == ManageMessageId.SetTwoFactorSuccess ? TWO_FACTOR_SET
+                : message == ManageMessageId.Error ? ERROR_OCCURRED
+                : message == ManageMessageId.AddPhoneSuccess ? PHONE_NUMBER_ADDED
+                : message == ManageMessageId.RemovePhoneSuccess ? PHONE_NUMBER_REMOVED
                 : "";

             var user = GetCurrentUser();
@@ -118,9 +144,8 @@
         {
             var user = await _userManager.FindByIdAsync(User.GetUserId());
             var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);
-            var callbackUrl = Url.Action(nameof(ConfirmNewEmail), "Account", new { userId = user.Id, code = code }, protocol: HttpContext.Request.Scheme);
-            await _emailSender.SendEmailAsync(user.Email, EMAIL_CONFIRMATION_SUBJECT,
-                "Please confirm your allReady account by clicking this link: link");
+            var callbackUrl = Url.Action(nameof(ConfirmNewEmail), ACCOUNT_CONTROLLER, new { userId = user.Id, code = code }, protocol: HttpContext.Request.Scheme);
+            await _emailSender.SendEmailAsync(user.Email, EMAIL_CONFIRMATION_SUBJECT, string.Format(RESEND_EMAIL_CONFIRM, callbackUrl));

             return RedirectToAction(nameof(EmailConfirmationSent));
         }
@@ -137,7 +162,7 @@
         {
             var user = GetCurrentUser();
             var linkedAccounts = await _userManager.GetLoginsAsync(user);
-            ViewData["ShowRemoveButton"] = await _userManager.HasPasswordAsync(user) || linkedAccounts.Count > 1;
+            ViewData[SHOW_REMOVE_BUTTON] = await _userManager.HasPasswordAsync(user) || linkedAccounts.Count > 1;
             return View(linkedAccounts);
         }

@@ -178,7 +203,7 @@
             // Generate the token and send it
             var user = GetCurrentUser();
             var code = await _userManager.GenerateChangePhoneNumberTokenAsync(user, model.PhoneNumber);
-            await _smsSender.SendSmsAsync(model.PhoneNumber, "Your allReady account security code is: " + code);
+            await _smsSender.SendSmsAsync(model.PhoneNumber, ACCOUNT_SECURITY_CODE + code);
             return RedirectToAction(nameof(VerifyPhoneNumber), new { PhoneNumber = model.PhoneNumber });
         }

@@ -190,7 +215,7 @@
             var user = GetCurrentUser();
             var code = await _userManager.GenerateChangePhoneNumberTokenAsync(user, phoneNumber);

-            await _smsSender.SendSmsAsync(phoneNumber, "Your allReady account security code is: " + code);
+            await _smsSender.SendSmsAsync(phoneNumber, ACCOUNT_SECURITY_CODE + code);

             return RedirectToAction(nameof(VerifyPhoneNumber), new { PhoneNumber = phoneNumber });
         }
@@ -206,7 +231,7 @@
                 await _userManager.SetTwoFactorEnabledAsync(user, true);
                 await _signInManager.SignInAsync(user, isPersistent: false);
             }
-            return RedirectToAction(nameof(Index), "Manage");
+            return RedirectToAction(nameof(Index), MANAGE_CONTROLLER);
         }

         // POST: /Manage/DisableTwoFactorAuthentication
@@ -220,7 +245,7 @@
                 await _userManager.SetTwoFactorEnabledAsync(user, false);
                 await _signInManager.SignInAsync(user, isPersistent: false);
             }
-            return RedirectToAction(nameof(Index), "Manage");
+            return RedirectToAction(nameof(Index), MANAGE_CONTROLLER);
         }

         // GET: /Account/VerifyPhoneNumber
@@ -229,7 +254,7 @@
         {
             var code = await _userManager.GenerateChangePhoneNumberTokenAsync(GetCurrentUser(), phoneNumber);
             // Send an SMS to verify the phone number
-            return phoneNumber == null ? View("Error") : View(new VerifyPhoneNumberViewModel { PhoneNumber = phoneNumber });
+            return phoneNumber == null ? View(ERROR_VIEW) : View(new VerifyPhoneNumberViewModel { PhoneNumber = phoneNumber });
         }

         // POST: /Account/VerifyPhoneNumber
@@ -253,7 +278,7 @@
                 }
             }
             // If we got this far, something failed, redisplay the form
-            ModelState.AddModelError(string.Empty, "Failed to verify phone number");
+            ModelState.AddModelError(string.Empty, FAILED_TO_VERIFY_PHONE_NUMBER);
             return View(model);
         }

@@ -328,7 +353,7 @@
             {
                 if(!await _userManager.CheckPasswordAsync(user, model.Password))
                 {
-                    ModelState.AddModelError(nameof(model.Password), "The password supplied is not correct");
+                    ModelState.AddModelError(nameof(model.Password), PASSWORD_INCORRECT);
                     return View(model);
                 }

@@ -336,7 +361,7 @@
                 if(existingUser != null)
                 {
                     // The username/email is already registered
-                    ModelState.AddModelError(nameof(model.NewEmail), "The email supplied is already registered");
+                    ModelState.AddModelError(nameof(model.NewEmail), EMAIL_ALREADY_REGISTERED);
                     return View(model);
                 }

@@ -344,9 +369,8 @@
                 await _userManager.UpdateAsync(user);

                 var token = await _userManager.GenerateChangeEmailTokenAsync(user, model.NewEmail);
-                var callbackUrl = Url.Action(nameof(ConfirmNewEmail), "Manage", new { token = token }, protocol: HttpContext.Request.Scheme);
-                await _emailSender.SendEmailAsync(user.Email, EMAIL_CONFIRMATION_SUBJECT,
-                    "Please confirm your new email address for your allReady account by clicking this link: link. Note that once confirmed your original email address will cease to be valid as your username.");
+                var callbackUrl = Url.Action(nameof(ConfirmNewEmail), MANAGE_CONTROLLER, new { token = token }, protocol: HttpContext.Request.Scheme);
+                await _emailSender.SendEmailAsync(user.Email, EMAIL_CONFIRMATION_SUBJECT, string.Format(NEW_EMAIL_CONFIRM, callbackUrl));

                 return RedirectToAction(nameof(EmailConfirmationSent));
             }
@@ -360,13 +384,13 @@
         {
             if (token == null)
             {
-                return View("Error");
+                return View(ERROR_VIEW);
             }

             var user = GetCurrentUser();
             if (user == null)
             {
-                return View("Error");
+                return View(ERROR_VIEW);
             }

             var result = await _userManager.ChangeEmailAsync(user, user.PendingNewEmail, token);
@@ -390,13 +414,12 @@

             if(string.IsNullOrEmpty(user.PendingNewEmail))
             {
-                return View("Error");
+                return View(ERROR_VIEW);
             }

             var token = await _userManager.GenerateChangeEmailTokenAsync(user, user.PendingNewEmail);
-            var callbackUrl = Url.Action(nameof(ConfirmNewEmail), "Manage", new { token = token }, protocol: HttpContext.Request.Scheme);
-            await _emailSender.SendEmailAsync(user.Email, EMAIL_CONFIRMATION_SUBJECT,
-                "Please confirm your new email address for your allReady account by clicking this link: link. Note that once confirmed your original email address will cease to be valid as your username.");
+            var callbackUrl = Url.Action(nameof(ConfirmNewEmail), MANAGE_CONTROLLER, new { token = token }, protocol: HttpContext.Request.Scheme);
+            await _emailSender.SendEmailAsync(user.Email, EMAIL_CONFIRMATION_SUBJECT, string.Format(NEW_EMAIL_CONFIRM, callbackUrl));

             return RedirectToAction(nameof(EmailConfirmationSent));
         }
@@ -449,19 +472,19 @@
         [HttpGet]
         public async Task<IActionResult> ManageLogins(ManageMessageId? message = null)
         {
-            ViewData["StatusMessage"] =
-                message == ManageMessageId.RemoveLoginSuccess ? "The external login was removed."
-                : message == ManageMessageId.AddLoginSuccess ? "The external login was added."
-                : message == ManageMessageId.Error ? "An error has occurred."
+            ViewData[STATUS_MESSAGE] =
+                message == ManageMessageId.RemoveLoginSuccess ? EXTERNAL_LOGIN_REMOVED
+                : message == ManageMessageId.AddLoginSuccess ? EXTERNAL_LOGIN_ADDED
+                : message == ManageMessageId.Error ? ERROR_OCCURRED
                 : "";
             var user = GetCurrentUser();
             if (user == null)
             {
-                return View("Error");
+                return View(ERROR_VIEW);
             }
             var userLogins = await _userManager.GetLoginsAsync(user);
             var otherLogins = _signInManager.GetExternalAuthenticationSchemes().Where(auth => userLogins.All(ul => auth.AuthenticationScheme != ul.LoginProvider)).ToList();
-            ViewData["ShowRemoveButton"] = user.PasswordHash != null || userLogins.Count > 1;
+            ViewData[SHOW_REMOVE_BUTTON] = user.PasswordHash != null || userLogins.Count > 1;
             return View(new ManageLoginsViewModel
             {
                 CurrentLogins = userLogins,
@@ -475,7 +498,7 @@
         public IActionResult LinkLogin(string provider)
         {
             // Request a redirect to the external login provider to link a login for the current user
-            var redirectUrl = Url.Action(nameof(LinkLoginCallback), "Manage");
+            var redirectUrl = Url.Action(nameof(LinkLoginCallback), MANAGE_CONTROLLER);
             var properties = _signInManager.ConfigureExternalAuthenticationProperties(provider, redirectUrl, User.GetUserId());
             return new ChallengeResult(provider, properties);
         }
@@ -487,7 +510,7 @@
             var user = GetCurrentUser();
             if (user == null)
             {
-                return View("Error");
+                return View(ERROR_VIEW);
             }
             var info = await _signInManager.GetExternalLoginInfoAsync(User.GetUserId());
             if (info == null)


Re-ordered tests

Re-ordered tests

--- Archetype.Serializer.Test/SerializationAdvancedModelTests.cs
+++ Archetype.Serializer.Test/SerializationAdvancedModelTests.cs
@@ -61,25 +61,6 @@
             Assert.IsInstanceOf<ArchetypeModel>(JsonConvert.DeserializeObject<ArchetypeModel>(json));
         }

-        [TestCase("NullableSimpleModelAsFieldsetsList", "simpleModelAsFieldsetsList")]
-        public void Model_Serializes_And_Preserves_Fieldsets(string modelAlias, string propAlias)
-        {
-            var referenceJson = ConsoleHelper.Instance.ConsoleCommands.GetArchetypeJsonFor(propAlias, _referenceJsonPageId);
-            var referenceArchetype = JsonConvert.DeserializeObject<ArchetypeModel>(referenceJson);
-
-            var model = _modelHelper.GetModel(modelAlias);
-            Assert.IsNotNull(model);
-
-            var json = JsonConvert.SerializeObject(model, new ArchetypeJsonConverter());
-            var actualArchetype = JsonConvert.DeserializeObject<ArchetypeModel>(json);
-
-            Assert.AreEqual(GetFieldsetCount(referenceArchetype, "dateTime"),
-                GetFieldsetCount(actualArchetype, "dateTime"));
-
-            Assert.AreEqual(GetFieldsetCount(referenceArchetype, "textField"),
-                GetFieldsetCount(actualArchetype, "textField"));
-        }
-
         [TestCase("MultiFieldsetModel", "MultiFieldsetModel")]
         [TestCase("NullableSimpleModelNull", "NullableSimpleModel")]
         [TestCase("NullableSimpleModelValues", "NullableSimpleModel")]
@@ -243,6 +224,25 @@
             Assert.AreEqual(model.TrueFalse, resultModel.TrueFalse);
         }

+        [TestCase("NullableSimpleModelAsFieldsetsList", "simpleModelAsFieldsetsList")]
+        public void Model_Serializes_And_Preserves_Fieldsets(string modelAlias, string propAlias)
+        {
+            var referenceJson = ConsoleHelper.Instance.ConsoleCommands.GetArchetypeJsonFor(propAlias, _referenceJsonPageId);
+            var referenceArchetype = JsonConvert.DeserializeObject<ArchetypeModel>(referenceJson);
+
+            var model = _modelHelper.GetModel(modelAlias);
+            Assert.IsNotNull(model);
+
+            var json = JsonConvert.SerializeObject(model, new ArchetypeJsonConverter());
+            var actualArchetype = JsonConvert.DeserializeObject<ArchetypeModel>(json);
+
+            Assert.AreEqual(GetFieldsetCount(referenceArchetype, "dateTime"),
+                GetFieldsetCount(actualArchetype, "dateTime"));
+
+            Assert.AreEqual(GetFieldsetCount(referenceArchetype, "textField"),
+                GetFieldsetCount(actualArchetype, "textField"));
+        }
+
         #region private methods

         private int GetFieldsetCount(ArchetypeModel referenceArchetype, string fsAlias)


Fix NodeComparer

Fix NodeComparer

--- MadCat/NutEngine/NodeComparer.cs
+++ MadCat/NutEngine/NodeComparer.cs
@@ -9,6 +9,10 @@
     {
         public int Compare(Node x, Node y)
         {
+            if (ReferenceEquals(x, y)) {
+                return 0;
+            }
+
             int result = x.ZOrder.CompareTo(y.ZOrder);

             /// For stable sorting.


#1913: throw ArgumentNullException when hardDeleteEntities list is null

--- src/Abp/Domain/Repositories/RepositoryExtensions.cs
+++ src/Abp/Domain/Repositories/RepositoryExtensions.cs
@@ -95,7 +95,13 @@

             var tenantId = GetCurrentTenantIdOrNull(repo.GetIocResolver());
             var hardDeleteKey = EntityHelper.GetHardDeleteKey(entity, tenantId);
-            hardDeleteEntities?.Add(hardDeleteKey);
+
+            if (hardDeleteEntities == null)
+            {
+                throw new ArgumentNullException(nameof(hardDeleteEntities));
+            }
+
+            hardDeleteEntities.Add(hardDeleteKey);

             await repo.DeleteAsync(entity);
         }


Added stacktrace

Added stacktrace

--- Manager/Manager/JobRepository.cs
+++ Manager/Manager/JobRepository.cs
@@ -2,6 +2,7 @@
 using System.Collections.Generic;
 using System.Data;
 using System.Data.SqlClient;
+using System.Diagnostics;
 using System.Linq;
 using System.Net;
 using Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling;
@@ -367,6 +368,8 @@
 						sqlConnection.Close();
 						return;
 					}
+
+					this.Log().Info(Environment.StackTrace);
 					this.Log().Info(string.Format("Aquired job id {0} for node {1}",jobQueueItem.JobId,availableNode.ToString()));
 					var builderHelper = new NodeUriBuilderHelper(availableNode);
 					var urijob = builderHelper.GetJobTemplateUri();
@@ -414,9 +417,6 @@
 				throw;
 			}
 		}
-
-
-

 		public bool DoesJobQueueItemExists(Guid jobId)
 		{


forgot transaction on command

forgot transaction on command

--- Manager/Manager/JobRepository.cs
+++ Manager/Manager/JobRepository.cs
@@ -188,6 +188,7 @@
 					connection.OpenWithRetry(_retryPolicy);
 					using (var tran = connection.BeginTransaction())
 					{
+						deleteCommand.Transaction = tran;
 						deleteCommand.ExecuteNonQueryWithRetry(_retryPolicy);
 						tran.Commit();
 					}


Enable the script and variant link for sign language (BL-11753)

--- src/BloomExe/Collection/CollectionSettingsDialog.cs
+++ src/BloomExe/Collection/CollectionSettingsDialog.cs
@@ -228,7 +228,7 @@
 		private void _signLanguageChangeLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 		{
 			var potentiallyCustomName = _collectionSettings.SignLanguageName;
-			var l = ChangeLanguage(_collectionSettings.SignLanguageIso639Code, potentiallyCustomName, false);
+			var l = ChangeLanguage(_collectionSettings.SignLanguageIso639Code, potentiallyCustomName, true);
 			if (l != null)
 			{
 				_collectionSettings.SignLanguageIso639Code = l.LanguageTag;


Fixed post comment controller sample

Fixed post comment controller sample

--- sample/FluentRestBuilder.Sample/Controllers/PostCommentController.cs
+++ sample/FluentRestBuilder.Sample/Controllers/PostCommentController.cs
@@ -14,7 +14,9 @@
     {
         [HttpGet(Name = nameof(PostCommentController))]
         public async Task<IActionResult> Get(int postId) =>
-            await this.CreateQueryableSingle<Comment>()
+            await this.CreateEntitySingle<Post>(postId)
+                .NotFoundWhenNull()
+                .MapToQueryable(c => c.Set<Comment>())
                 .Include(c => c.Author)
                 .Where(c => c.PostId == postId)
                 .OrderByDescending(c => c.CreatedAt)
@@ -27,14 +29,15 @@

         [HttpPost]
         public async Task<IActionResult> Create([FromBody] CommentRequest request, int postId) =>
-            await this.CreateSingle(request)
+            await this.CreateEntitySingle<Post>(postId)
+                .NotFoundWhenNull()
                 .BadRequestWhenModelStateIsInvalid(this.ModelState)
-                .Map(r => new Comment
+                .Map(p => new Comment
                 {
                     AuthorId = this.User.GetUserId(),
-                    PostId = postId,
-                    Title = r.Title,
-                    Text = r.Text,
+                    PostId = p.Id,
+                    Title = request.Title,
+                    Text = request.Text,
                 })
                 .InsertEntity()
                 .ToCreatedAtRouteResult("CommentResource", e => new { id = e.Id });


refactor.

refactor.

--- src/Cap.Consistency/Attributes/QMessageAttribute.cs
+++ src/Cap.Consistency/Attributes/QMessageAttribute.cs
@@ -1,14 +0,0 @@
-using System;
-
-namespace Cap.Consistency
-{
-    [AttributeUsage(AttributeTargets.Method, Inherited = true, AllowMultiple = true)]
-    sealed class QMessageAttribute : Attribute
-    {
-        public QMessageAttribute(string messageName) {
-            MessageName = messageName;
-        }
-
-        public string MessageName { get; private set; }
-    }
-}


refactor.

refactor.

--- src/Cap.Consistency/Consumer/Kafka/RdKafkaClient.cs
+++ src/Cap.Consistency/Consumer/Kafka/RdKafkaClient.cs
@@ -1,43 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Confluent.Kafka;
-using Confluent.Kafka.Serialization;
-
-namespace Cap.Consistency.Consumer.Kafka
-{
-    public class RdKafkaClient
-    {
-
-        private Consumer<string, string> _client;
-
-        public RdKafkaClient() {
-
-        }
-
-        public void Start(TopicRouteContext routeContext )  {
-
-            string brokerList = null;// args[0];
-            var topics = new List<string>();// args.Skip(1).ToList();
-
-            var config = new Dictionary<string, object>
-            {
-                { "group.id", "simple-csharp-consumer" },
-                { "bootstrap.servers", brokerList }
-            };
-
-            using (var consumer = new Consumer<Null, string>(config, null, new StringDeserializer(Encoding.UTF8))) {
-                //consumer.Assign(new List<TopicInfo> { new TopicInfo(topics.First(), 0, 0) });
-
-                while (true) {
-                    Message<Null, string> msg;
-                    if (consumer.Consume(out msg)) {
-                        Console.WriteLine($"Topic: {msg.Topic} Partition: {msg.Partition} Offset: {msg.Offset} {msg.Value}");
-                    }
-                }
-            }
-
-        }
-    }
-}


PixbufLoader from gtk-sharp/master does not have a Close () overload which takes a boolean parameter

https://bugzilla.gnome.org/show_bug.cgi?id=629224

--- src/Clients/MainApp/FSpot.Loaders/GdkImageLoader.cs
+++ src/Clients/MainApp/FSpot.Loaders/GdkImageLoader.cs
@@ -132,7 +132,7 @@
 		public new bool Close ()
 		{
 			lock (sync_handle) {
-				return base.Close (true);
+				return base.Close ();
 			}
 		}
 #endregion


Add null check for public API

Add null check for public API

--- src/HolzShots.Core/Input/Selection/AreaSelector2.cs
+++ src/HolzShots.Core/Input/Selection/AreaSelector2.cs
@@ -47,7 +47,9 @@

         public Task<Rectangle> PromptSelectionAsync(Bitmap image)
         {
-            Debug.Assert(image != null);
+            if (image == null)
+                throw new ArgumentNullException(nameof(image));
+
             Debug.Assert(_image == null);
             Debug.Assert(_tcs == null);


default response from the try receive methods is false override in order to allow problem specific responses

--- src/Kingdom.Constraints.Core/OrProblemSolverBase.cs
+++ src/Kingdom.Constraints.Core/OrProblemSolverBase.cs
@@ -92,6 +92,16 @@
         }

         /// <summary>
+        /// Returns whether the End <paramref name="assignment"/> could be received.
+        /// </summary>
+        /// <param name="assignment"></param>
+        /// <returns></returns>
+        protected virtual bool TryReceiveEndAssignment(Assignment assignment)
+        {
+            return false;
+        }
+
+        /// <summary>
         /// Returns whether could Receive the Next Solution.
         /// </summary>
         /// <param name="variables"></param>
@@ -100,13 +110,6 @@
         {
             return false;
         }
-
-        /// <summary>
-        /// Returns whether the End <paramref name="assignment"/> could be received.
-        /// </summary>
-        /// <param name="assignment"></param>
-        /// <returns></returns>
-        protected abstract bool TryReceiveEndAssignment(Assignment assignment);

         /// <summary>
         /// Returns whether could Receive the End Solution.


Removed NewInt64Range rename TODO

Removed NewInt64Range rename TODO

--- src/Lucene.Net.Core/Search/FieldCacheRangeFilter.cs
+++ src/Lucene.Net.Core/Search/FieldCacheRangeFilter.cs
@@ -757,7 +757,6 @@
         /// long fields containing exactly one numeric term in the field. The range can be half-open by setting one
         /// of the values to null.
         ///
-        // LUCENENET TODO: Rename NewInt64Range
         public static FieldCacheRangeFilter<long?> NewInt64Range(string field, long? lowerVal, long? upperVal, bool includeLower, bool includeUpper)
         {
             return NewInt64Range(field, null, lowerVal, upperVal, includeLower, includeUpper);


When reading a file to verify dependencies, use FileAccess.Read.

--- src/Microsoft.DotNet.VersionTools/Util/FileUtils.cs
+++ src/Microsoft.DotNet.VersionTools/Util/FileUtils.cs
@@ -25,7 +25,7 @@
             // Attempt to preserve the file's encoding, using a UTF-8 encoding with no BOM if the
             // file's encoding cannot be detected.
             using (StreamReader reader = new StreamReader(
-                new FileStream(path, FileMode.Open),
+                new FileStream(path, FileMode.Open, FileAccess.Read),
                 new UTF8Encoding(encoderShouldEmitUTF8Identifier: false),
                 detectEncodingFromByteOrderMarks: true))
             {


(BotConfig) add missing getter and setter

--- src/NadekoBot/Services/Database/Models/BotConfig.cs
+++ src/NadekoBot/Services/Database/Models/BotConfig.cs
@@ -34,7 +34,7 @@
         public List<EightBallResponse> EightBallResponses { get; set; } = new List<EightBallResponse>();
         public List<RaceAnimal> RaceAnimals { get; set; } = new List<RaceAnimal>();

-        public string DMHelpString;
+        public string DMHelpString { get; set; }
         public string HelpString { get; set; }

         public int MigrationVersion { get; set; }


Correct currency general formatting.

Correct currency general formatting.

--- src/Narvalo.Finance/Globalization/MoneyFormatter.cs
+++ src/Narvalo.Finance/Globalization/MoneyFormatter.cs
@@ -51,13 +51,10 @@
             Warrant.NotNull<string>();

             // http://publications.europa.eu/code/en/en-370303.htm
-            //return Narvalo.Format.Current("{1}\u00A0{0:F2}", amount, currency.Code);
-            // CurrencyGroupSeparator
-            // CurrencyDecimalSeparator
             var nfi = (NumberFormatInfo)mfi.NumberFormat.Clone();
-            nfi.CurrencySymbol = currency.Code;
+            nfi.CurrencySymbol = String.Empty;

-            return amount.ToString("C", nfi);
+            return currency.Code + "\u00A0" + amount.ToString("C", nfi).Trim();
         }

         private static string FormatCurrency(decimal amount, Currency currency, MoneyFormatInfo mfi)


Fixed WindowsLibraryLoader bug

Fixed WindowsLibraryLoader bug

--- src/OpenCvSharp/Src/PInvoke/WindowsLibraryLoader.cs
+++ src/OpenCvSharp/Src/PInvoke/WindowsLibraryLoader.cs
@@ -8,7 +8,6 @@
 using System.Reflection;
 using System.Runtime.InteropServices;
 using System.Text;
-using System.Web;

 namespace OpenCvSharp
 {
@@ -28,7 +27,7 @@
         public static WindowsLibraryLoader Instance { get { return instance; } }

         #endregion
-
+
         /// <summary>
         /// The default base directory name to copy the assemblies too.
         /// </summary>
@@ -53,7 +52,7 @@
         /// <summary>
         /// Used as a sanity check for the returned processor architecture to double check the returned value.
         /// </summary>
-        private readonly Dictionary<string, int> processorArchitectureAddressWidthPlatforms =
+        private readonly Dictionary<string, int> processorArchitectureAddressWidthPlatforms =
             new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase)
                 {
                     {"x86", 4},
@@ -65,8 +64,8 @@
         /// <summary>
         /// Additional user-defined DLL paths
         /// </summary>
-        public List<string> AdditionalPaths { get; private set; }
-
+        public List<string> AdditionalPaths { get; private set; }
+
         private readonly object syncLock = new object();

         /// <summary>
@@ -114,7 +113,7 @@

             if (additionalPaths == null)
                 additionalPaths = new string[0];
-
+
             try
             {
                 lock (syncLock)
@@ -131,8 +130,8 @@
                     // Try loading from user-defined paths
                     foreach (string path in additionalPaths)
                     {
-                        baseDirectory = Path.GetDirectoryName(path);
-                        dllHandle = LoadLibraryInternal(dllName, baseDirectory, processArch);
+                        // baseDirectory = Path.GetFullPath(path);
+                        dllHandle = LoadLibraryRaw(dllName, path);
                         if (dllHandle != IntPtr.Zero) return;
                     }

@@ -170,10 +169,10 @@
                         // include process detection warnings
                         errorMessage.AppendFormat("\r\nWarnings: \r\n{0}", processArch.WarningText());
                     }
-                    throw new LoadLibraryException(errorMessage.ToString());
-                }
-            }
-            catch (LoadLibraryException e)
+                    throw new Exception(errorMessage.ToString());
+                }
+            }
+            catch (Exception e)
             {
                 Trace.TraceError(e.Message);
             }
@@ -222,11 +221,19 @@

         private IntPtr LoadLibraryInternal(string dllName, string baseDirectory, ProcessArchitectureInfo processArchInfo)
         {
-            IntPtr libraryHandle = IntPtr.Zero;
+            //IntPtr libraryHandle = IntPtr.Zero;
             var platformName = GetPlatformName(processArchInfo.Architecture);
             var expectedDllDirectory = Path.Combine(
                 Path.Combine(baseDirectory, DllDirectory), platformName);
-            var fileName = FixUpDllFileName(Path.Combine(expectedDllDirectory, dllName));
+            //var fileName = FixUpDllFileName(Path.Combine(expectedDllDirectory, dllName));
+
+            return LoadLibraryRaw(dllName, expectedDllDirectory);
+        }
+
+        private IntPtr LoadLibraryRaw(string dllName, string baseDirectory)
+        {
+            IntPtr libraryHandle = IntPtr.Zero;
+            var fileName = FixUpDllFileName(Path.Combine(baseDirectory, dllName));

             if (File.Exists(fileName))
             {
@@ -250,7 +257,7 @@
                     else
                     {
                         Trace.TraceError(
-                            "Failed to load native library \"{0}\".\r\nCheck windows event log.",
+                            "Failed to load native library \"{0}\".\r\nCheck windows event log.",
                             fileName);
                     }
                 }
@@ -258,7 +265,7 @@
                 {
                     var lastError = Marshal.GetLastWin32Error();
                     Trace.TraceError(
-                        "Failed to load native library \"{0}\".\r\nLast Error:{1}\r\nCheck inner exception and\\or windows event log.\r\nInner Exception: {2}",
+                        "Failed to load native library \"{0}\".\r\nLast Error:{1}\r\nCheck inner exception and\\or windows event log.\r\nInner Exception: {2}",
                         fileName, lastError, e);
                 }
             }


fix bug when empty network groups and service groups was missed

--- MigrationBase/VendorConverter.cs
+++ MigrationBase/VendorConverter.cs
@@ -979,6 +979,15 @@
                             continue;
                         }

+                        //if a group has no members
+                        if (obj.Members.Count == 0)
+                        {
+                            file.WriteLine(CLIScriptBuilder.GenerateObjectScript(obj));
+
+                            file.WriteLine(CLIScriptBuilder.GeneratePublishScript());
+                            continue;
+                        }
+
                         //if a group has more then max size for publish - generate part of group divided by small groups.
                         obj.MembersMaxPublishSize = groupsMaxBulkSize;
                         for (int i = 0; i < obj.Members.Count; i += groupsMaxBulkSize)
@@ -1189,6 +1198,15 @@
                     int objectsCount = 0;
                     foreach (CheckPoint_ServiceGroup obj in _cpServiceGroups)
                     {
+                        //if a group has no members
+                        if (obj.Members.Count == 0)
+                        {
+                            file.WriteLine(CLIScriptBuilder.GenerateObjectScript(obj));
+
+                            file.WriteLine(CLIScriptBuilder.GeneratePublishScript());
+                            continue;
+                        }
+
                         //if a group has more then max size for publish - generate part of group divided by small groups.
                         obj.MembersMaxPublishSize = groupsMaxBulkSize;
                         for (int i = 0; i < obj.Members.Count; i += groupsMaxBulkSize)
@@ -1203,14 +1221,6 @@
                                 file.WriteLine(CLIScriptBuilder.GeneratePublishScript());
                             }
                         }
-
-                        /* file.WriteLine(CLIScriptBuilder.GenerateObjectScript(obj));
-
-                        objectsCount++;
-                        if (objectsCount % publishLatency == 0)
-                        {
-                            file.WriteLine(CLIScriptBuilder.GeneratePublishScript());
-                        } */
                     }
                     file.WriteLine(CLIScriptBuilder.GeneratePublishScript());
                 }


replace operator if by ternary

replace operator if by ternary

--- MigrationBase/VendorConverter.cs
+++ MigrationBase/VendorConverter.cs
@@ -986,9 +986,7 @@
                             obj.MembersPublishIndex = i;

                             //index for comments
-                            int index = i + groupsMaxBulkSize;
-                            if (index > obj.Members.Count)
-                                index = obj.Members.Count;
+                            int index = ((i + groupsMaxBulkSize) > obj.Members.Count) ? obj.Members.Count : i + groupsMaxBulkSize;

                             file.WriteLine(CLIScriptBuilder.GenerateObjectScript(obj, index));

@@ -1194,15 +1192,13 @@
                     int objectsCount = 0;
                     foreach (CheckPoint_ServiceGroup obj in _cpServiceGroups)
                     {
+                        //if a group has more then max size for publish - generate part of group divided by small groups.
                         obj.MembersMaxPublishSize = groupsMaxBulkSize;
                         for (int i = 0; i < obj.Members.Count; i += groupsMaxBulkSize)
                         {
                             obj.MembersPublishIndex = i;

-                            //if a group has more then max size for publish - generate part of group divided by small groups.
-                            int index = i + groupsMaxBulkSize;
-                            if (index > obj.Members.Count)
-                                index = obj.Members.Count;
+                            int index = ((i + groupsMaxBulkSize) > obj.Members.Count) ? obj.Members.Count : i + groupsMaxBulkSize;
                             file.WriteLine(CLIScriptBuilder.GenerateObjectScript(obj, index));

                             objectsCount++;


-agentprefix displays as entered. (#1894)

Somewhere along the way -agentprefix stopped working.

This fixes.

--- src/Stratis.Bitcoin/Connection/ConnectionManager.cs
+++ src/Stratis.Bitcoin/Connection/ConnectionManager.cs
@@ -117,7 +117,7 @@
             this.selfEndpointTracker = selfEndpointTracker;
             this.versionProvider = versionProvider;

-            this.Parameters.UserAgent = $"{this.NodeSettings.Agent}:{versionProvider.GetVersion()}";
+            this.Parameters.UserAgent = $"{this.ConnectionSettings.Agent}:{versionProvider.GetVersion()}";

             this.Parameters.Version = this.NodeSettings.ProtocolVersion;


Set Syncthing's CWD on startup

Set Syncthing's CWD on startup

Fixes #524

--- src/SyncTrayzor/Syncthing/SyncthingProcessRunner.cs
+++ src/SyncTrayzor/Syncthing/SyncthingProcessRunner.cs
@@ -125,6 +125,8 @@
                 RedirectStandardOutput = true,
                 StandardOutputEncoding = Encoding.UTF8,
                 StandardErrorEncoding = Encoding.UTF8,
+                // In case people are using relative folder paths, mirror the shortcut
+                WorkingDirectory = Path.GetDirectoryName(typeof(SyncthingProcessRunner).Assembly.Location),
             };

             processStartInfo.EnvironmentVariables["STGUIAPIKEY"] = this.ApiKey;


Make ValueTuple types serializable (#9271) (#2644)

--- src/System.Private.CoreLib/src/System/ValueTuple.cs
+++ src/System.Private.CoreLib/src/System/ValueTuple.cs
@@ -28,6 +28,7 @@
     /// - they are mutable rather than readonly, and
     /// - their members (such as Item1, Item2, etc) are fields rather than properties.
     /// </summary>
+    [Serializable]
     public struct ValueTuple
         : IEquatable<ValueTuple>, IStructuralEquatable, IStructuralComparable, IComparable, IComparable<ValueTuple>, IValueTupleInternal, ITuple
     {
@@ -296,6 +297,7 @@

     /// <summary>Represents a 1-tuple, or singleton, as a value type.</summary>
     /// <typeparam name="T1">The type of the tuple's only component.</typeparam>
+    [Serializable]
     public struct ValueTuple<T1>
         : IEquatable<ValueTuple<T1>>, IStructuralEquatable, IStructuralComparable, IComparable, IComparable<ValueTuple<T1>>, IValueTupleInternal, ITuple
     {
@@ -460,6 +462,7 @@
     /// </summary>
     /// <typeparam name="T1">The type of the tuple's first component.</typeparam>
     /// <typeparam name="T2">The type of the tuple's second component.</typeparam>
+    [Serializable]
     [StructLayout(LayoutKind.Auto)]
     public struct ValueTuple<T1, T2>
         : IEquatable<ValueTuple<T1, T2>>, IStructuralEquatable, IStructuralComparable, IComparable, IComparable<ValueTuple<T1, T2>>, IValueTupleInternal, ITuple
@@ -669,6 +672,7 @@
     /// <typeparam name="T1">The type of the tuple's first component.</typeparam>
     /// <typeparam name="T2">The type of the tuple's second component.</typeparam>
     /// <typeparam name="T3">The type of the tuple's third component.</typeparam>
+    [Serializable]
     [StructLayout(LayoutKind.Auto)]
     public struct ValueTuple<T1, T2, T3>
         : IEquatable<ValueTuple<T1, T2, T3>>, IStructuralEquatable, IStructuralComparable, IComparable, IComparable<ValueTuple<T1, T2, T3>>, IValueTupleInternal, ITuple
@@ -876,6 +880,7 @@
     /// <typeparam name="T2">The type of the tuple's second component.</typeparam>
     /// <typeparam name="T3">The type of the tuple's third component.</typeparam>
     /// <typeparam name="T4">The type of the tuple's fourth component.</typeparam>
+    [Serializable]
     [StructLayout(LayoutKind.Auto)]
     public struct ValueTuple<T1, T2, T3, T4>
         : IEquatable<ValueTuple<T1, T2, T3, T4>>, IStructuralEquatable, IStructuralComparable, IComparable, IComparable<ValueTuple<T1, T2, T3, T4>>, IValueTupleInternal, ITuple
@@ -1102,6 +1107,7 @@
     /// <typeparam name="T3">The type of the tuple's third component.</typeparam>
     /// <typeparam name="T4">The type of the tuple's fourth component.</typeparam>
     /// <typeparam name="T5">The type of the tuple's fifth component.</typeparam>
+    [Serializable]
     [StructLayout(LayoutKind.Auto)]
     public struct ValueTuple<T1, T2, T3, T4, T5>
         : IEquatable<ValueTuple<T1, T2, T3, T4, T5>>, IStructuralEquatable, IStructuralComparable, IComparable, IComparable<ValueTuple<T1, T2, T3, T4, T5>>, IValueTupleInternal, ITuple
@@ -1347,6 +1353,7 @@
     /// <typeparam name="T4">The type of the tuple's fourth component.</typeparam>
     /// <typeparam name="T5">The type of the tuple's fifth component.</typeparam>
     /// <typeparam name="T6">The type of the tuple's sixth component.</typeparam>
+    [Serializable]
     [StructLayout(LayoutKind.Auto)]
     public struct ValueTuple<T1, T2, T3, T4, T5, T6>
         : IEquatable<ValueTuple<T1, T2, T3, T4, T5, T6>>, IStructuralEquatable, IStructuralComparable, IComparable, IComparable<ValueTuple<T1, T2, T3, T4, T5, T6>>, IValueTupleInternal, ITuple
@@ -1611,6 +1618,7 @@
     /// <typeparam name="T5">The type of the tuple's fifth component.</typeparam>
     /// <typeparam name="T6">The type of the tuple's sixth component.</typeparam>
     /// <typeparam name="T7">The type of the tuple's seventh component.</typeparam>
+    [Serializable]
     [StructLayout(LayoutKind.Auto)]
     public struct ValueTuple<T1, T2, T3, T4, T5, T6, T7>
         : IEquatable<ValueTuple<T1, T2, T3, T4, T5, T6, T7>>, IStructuralEquatable, IStructuralComparable, IComparable, IComparable<ValueTuple<T1, T2, T3, T4, T5, T6, T7>>, IValueTupleInternal, ITuple
@@ -1894,6 +1902,7 @@
     /// <typeparam name="T6">The type of the tuple's sixth component.</typeparam>
     /// <typeparam name="T7">The type of the tuple's seventh component.</typeparam>
     /// <typeparam name="TRest">The type of the tuple's eighth component.</typeparam>
+    [Serializable]
     [StructLayout(LayoutKind.Auto)]
     public struct ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest>
     : IEquatable<ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest>>, IStructuralEquatable, IStructuralComparable, IComparable, IComparable<ValueTuple<T1, T2, T3, T4, T5, T6, T7, TRest>>, IValueTupleInternal, ITuple


More BsonReader cleanup.

More BsonReader cleanup.

--- MongoDBDriver/Bson/BsonReader.cs
+++ MongoDBDriver/Bson/BsonReader.cs
@@ -32,19 +32,18 @@
         }

         public Document ReadDocument(){
-            var startpos = Position;
-            var doc = new Document();
+            var startPosition = Position;
+            var document = new Document();
             var size = reader.ReadInt32();
             Position += 4;
-            while((Position - startpos) + 1 < size)
-                ReadElement(doc);
-            var eoo = reader.ReadByte();
+            while((Position - startPosition) + 1 < size)
+                ReadElement(document);
             Position++;
-            if(eoo != 0)
+            if(reader.ReadByte() != 0)
                 throw new InvalidDataException("Document not null terminated");
-            if(size != Position - startpos)
-                throw new InvalidDataException(string.Format("Should have read {0} bytes from stream but only read {1}", size, (Position - startpos)));
-            return doc;
+            if(size != Position - startPosition)
+                throw new InvalidDataException(string.Format("Should have read {0} bytes from stream but only read {1}", size, (Position - startPosition)));
+            return document;
         }

         public void ReadElement(Document doc){


Trying to visit deep constant expression on visit member parser

--- src/Takenet.Elephant.Sql/SqlExpressionTranslator.cs
+++ src/Takenet.Elephant.Sql/SqlExpressionTranslator.cs
@@ -66,23 +66,36 @@
                     return node;

                 case ExpressionType.MemberAccess:
+                    var memberExpression = (MemberExpression) node.Expression;
+                    Expression deepExpression = memberExpression;
+                    while (deepExpression is MemberExpression)
+                    {
+                        deepExpression = ((MemberExpression) deepExpression).Expression;
+                    }

-                    var memberExpression = (MemberExpression) node.Expression;
+                    if (deepExpression is ConstantExpression)
+                    {
+                        var constantExpression2 = (ConstantExpression)deepExpression;
+                        var fieldInfoValue = ((FieldInfo)memberExpression.Member).GetValue(constantExpression2.Value);
+                        value = ((PropertyInfo)node.Member).GetValue(fieldInfoValue, null);
+                        _filter.Append(ConvertSqlLiteral(value, node.Type));
+                        return node;
+                    }

-                    //// System.InvalidOperationException: variable 'i' of type 'System.Collections.Generic.KeyValuePair`2[System.Guid,Takenet.Elephant.Tests.Item]' referenced from scope '', but it is not defined
+                    _filter.Append(node.Member.Name.AsSqlIdentifier());
+

                     //if (memberExpression.Member is PropertyInfo)
                     //{
-                    //    objectMember = Expression.Convert(memberExpression, typeof(object));
-                    //    objectMember = Expression.Convert(node, typeof(object));
-
+                    //    _filter.Append(node.Member.Name.AsSqlIdentifier());
+                    //    return Visit(memberExpression.Expression);
                     //}

-                    UnaryExpression objectMember = Expression.Convert(node, typeof(object));
-                    var getterLambda = Expression.Lambda<Func<object>>(objectMember);
-                    var getter = getterLambda.Compile();
-                    value = getter();
-                    _filter.Append(ConvertSqlLiteral(value, node.Type));
+                    //var objectMember = Expression.Convert(node, typeof(object));
+                    //var getterLambda = Expression.Lambda<Func<object>>(objectMember);
+                    //var getter = getterLambda.Compile();
+                    //value = getter();
+                    //_filter.Append(ConvertSqlLiteral(value, node.Type));
                     return node;

                 case ExpressionType.Constant:


Using Node Count as id for nodes, Coordinate.GetHashCode() doesnt give unique values (i obtain 0 for 1:1, 2:2, etc)

--- NGAT.Domain/Domain/Core/Graph.cs
+++ NGAT.Domain/Domain/Core/Graph.cs
@@ -59,7 +59,7 @@
             if(!this.NodesIndex.ContainsKey(node.Coordinate.GetHashCode()))
             {
                 //Using the well-formed hash code of the coordinate as Id for the node
-                node.Id = node.Coordinate.GetHashCode();
+                node.Id = this.Nodes.Count + 1;//node.Coordinate.GetHashCode(); this is not WORKING

                 //Converting the fetched attributes for the node to Json and storing it
                 node.NodeData = JsonConvert.SerializeObject(fetchedAttributes);


Replaced hardcoded "-1" with `Constants.System.RootString`

--- src/Umbraco.Core/Services/Implement/MediaService.cs
+++ src/Umbraco.Core/Services/Implement/MediaService.cs
@@ -995,7 +995,7 @@
             // if uow is not immediate, content.Path will be updated only when the UOW commits,
             // and because we want it now, we have to calculate it by ourselves
             //paths[media.Id] = media.Path;
-            paths[media.Id] = (parent == null ? (parentId == Constants.System.RecycleBinMedia ? "-1,-21" : "-1") : parent.Path) + "," + media.Id;
+            paths[media.Id] = (parent == null ? (parentId == Constants.System.RecycleBinMedia ? "-1,-21" : Constants.System.RootString) : parent.Path) + "," + media.Id;

             const int pageSize = 500;
             var page = 0;


Ensures that an UmbracoContext exist before emitting the cache handler events

--- src/Umbraco.Web/Cache/CacheRefresherEventHandler.cs
+++ src/Umbraco.Web/Cache/CacheRefresherEventHandler.cs
@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Concurrent;
 using System.Collections.Generic;
+using System.IO;
 using Umbraco.Core;
 using Umbraco.Core.Events;
 using Umbraco.Core.Models;
@@ -11,9 +12,14 @@
 using umbraco.cms.businesslogic;
 using System.Linq;
 using System.Reflection;
+using System.Web;
+using System.Web.Hosting;
+using Umbraco.Core.Configuration;
 using Umbraco.Core.Logging;
 using Umbraco.Core.ObjectResolution;
 using Umbraco.Core.Publishing;
+using Umbraco.Web.Routing;
+using Umbraco.Web.Security;
 using Content = Umbraco.Core.Models.Content;
 using ApplicationTree = Umbraco.Core.Models.ApplicationTree;
 using DeleteEventArgs = umbraco.cms.businesslogic.DeleteEventArgs;
@@ -787,14 +793,39 @@
         /// </summary>
         /// <param name="events"></param>
         internal static void HandleEvents(IEnumerable<IEventDefinition> events)
-        {
-            foreach (var e in events)
-            {
-                var handler = FindHandler(e);
-                if (handler == null) continue;
-
-                handler.Invoke(null, new[] { e.Sender, e.Args });
-            }
+        {
+            //TODO: We should remove this in v8, this is a backwards compat hack and is needed because when we are using Deploy, the events will be raised on a background
+            //thread which means that cache refreshers will also execute on a background thread and in many cases developers may be using UmbracoContext.Current in their
+            //cache refresher handlers, so before we execute all of the events, we'll ensure a context
+            UmbracoContext tempContext = null;
+            if (UmbracoContext.Current == null)
+            {
+                var httpContext = new HttpContextWrapper(HttpContext.Current ?? new HttpContext(new SimpleWorkerRequest("temp.aspx", "", new StringWriter())));
+                tempContext = UmbracoContext.EnsureContext(
+                    httpContext,
+                    ApplicationContext.Current,
+                    new WebSecurity(httpContext, ApplicationContext.Current),
+                    UmbracoConfig.For.UmbracoSettings(),
+                    UrlProviderResolver.Current.Providers,
+                    true);
+            }
+
+            try
+            {
+                foreach (var e in events)
+                {
+                    var handler = FindHandler(e);
+                    if (handler == null) continue;
+
+                    handler.Invoke(null, new[] { e.Sender, e.Args });
+                }
+            }
+            finally
+            {
+                if (tempContext != null)
+                    tempContext.Dispose();
+            }
+
         }

         /// <summary>


Implemented logout

Implemented logout

--- src/Umbraco.Web/Editors/AuthenticationController.cs
+++ src/Umbraco.Web/Editors/AuthenticationController.cs
@@ -1,5 +1,6 @@
 using System.Collections.Generic;
 using System.Net;
+using System.Net.Http;
 using System.Web;
 using System.Web.Http;
 using Umbraco.Web.Models.ContentEditing;
@@ -59,6 +60,12 @@
             throw new HttpResponseException(HttpStatusCode.Unauthorized);
         }

+        /// <summary>
+        /// Logs a user in
+        /// </summary>
+        /// <param name="username"></param>
+        /// <param name="password"></param>
+        /// <returns></returns>
         public UserDetail PostLogin(string username, string password)
         {
             if (UmbracoContext.Security.ValidateBackOfficeCredentials(username, password))
@@ -75,9 +82,14 @@
             throw new HttpResponseException(HttpStatusCode.Forbidden);
         }

-        //public HttpResponseMessage PostLogout()
-        //{
-
-        //}
+        /// <summary>
+        /// Logs the current user out
+        /// </summary>
+        /// <returns></returns>
+        public HttpResponseMessage PostLogout()
+        {
+            UmbracoContext.Security.ClearCurrentLogin();
+            return Request.CreateResponse(HttpStatusCode.OK);
+        }
     }
 }


Set, GetValue: ToString is now called when setting and saving values to prevent a cast bug.

--- Nini/Source/Config/ConfigBase.cs
+++ Nini/Source/Config/ConfigBase.cs
@@ -245,7 +245,7 @@
 			}

 			if (!keys.Contains (key)) {
-				keys.Add (key, value);
+				keys.Add (key, value.ToString ());
 			} else {
 				keys[key] = value.ToString ();
 			}
@@ -277,7 +277,7 @@
 			string result = null;

 			if (keys.Contains (key)) {
-				result = (string)keys[key];
+				result = keys[key].ToString ();
 			}

 			return result;


Try casting object first.

Try casting object first.

--- NtObjectManager/Utils/PSUtils.cs
+++ NtObjectManager/Utils/PSUtils.cs
@@ -74,6 +74,11 @@
                 var os = script_block.InvokeWithContext(null, vars, args);
                 if (os.Count > 0)
                 {
+                    if (os[0].BaseObject is T ret)
+                    {
+                        return ret;
+                    }
+                    // If we can't directly cast than see if we can change the type.
                     return (T)Convert.ChangeType(os[0].BaseObject, typeof(T));
                 }
             }


Only clone those organisation repositories where we can push (#112)

Implies permissions for creating PRs

--- NuKeeper/Github/OctokitClient.cs
+++ NuKeeper/Github/OctokitClient.cs
@@ -36,7 +36,7 @@
         public async Task<IReadOnlyList<Repository>> GetRepositoriesForOrganisation(string organisationName)
         {
             var results = await _client.Repository.GetAllForOrg(organisationName);
-            var resultList = results.ToList().AsReadOnly();
+            var resultList = results.Where(r => r.Permissions.Pull && r.Permissions.Push).ToList().AsReadOnly();
             _logger.Verbose($"Read {resultList.Count} repos for org '{organisationName}'");
             return resultList;
         }