add unsafe poll.

add unsafe poll.

--- LiteNetLib/NetSocket.cs
+++ LiteNetLib/NetSocket.cs
@@ -29,12 +29,28 @@
             [In] int socketAddressSize);

         [DllImport("ws2_32.dll", SetLastError = true)]
-        private static extern int recvfrom([In] IntPtr socketHandle,
+        private static extern int recvfrom(
+            [In] IntPtr socketHandle,
             [In] byte[] pinnedBuffer,
             [In] int len,
             [In] SocketFlags socketFlags,
             [Out] byte[] socketAddress,
             [In, Out] ref int socketAddressSize);
+
+        internal struct TimeValue
+        {
+            public int Seconds;
+            public int Microseconds;
+        }
+        private static TimeValue SendPollTime = new TimeValue { Microseconds = SocketSendPollTime };
+
+        [DllImport("ws2_32.dll", SetLastError = true)]
+        private static extern int select(
+            [In] int ignoredParameter,
+            [In, Out] IntPtr[] readfds,
+            [In, Out] IntPtr[] writefds,
+            [In, Out] IntPtr[] exceptfds,
+            [In] ref TimeValue timeout);
 #endif

         private static readonly IPAddress MulticastAddressV6 = IPAddress.Parse (NetConstants.MulticastGroupIPv6);
@@ -68,25 +84,33 @@
             byte[] prevAddress = new byte[saddrSize];
             byte[] socketAddress = new byte[saddrSize];
             byte[] addrBuffer = new byte[16]; //IPAddress.IPv6AddressBytes
+
+            var sockeHandle = socket.Handle;
+            TimeValue time = new TimeValue {Microseconds = SocketReceivePollTime};
 #endif
             byte[] receiveBuffer = new byte[NetConstants.PacketSizeLimit];

             while (_running)
             {
-                //wait for data
-                if (!socket.Poll(SocketReceivePollTime, SelectMode.SelectRead))
-                {
-                    continue;
-                }
-
                 int result;

                 //Reading data
                 try
                 {
 #if WIN32 && UNSAFE
+                    IntPtr[] fileDescriptorSet = { (IntPtr)1, sockeHandle };
+                    int socketCount = select( 0, fileDescriptorSet, null, null, ref time);
+                    if ((SocketError) socketCount == SocketError.SocketError)
+                    {
+                        throw new SocketException(Marshal.GetLastWin32Error());
+                    }
+                    if ((int)fileDescriptorSet[0] == 0 || fileDescriptorSet[1] != sockeHandle)
+                    {
+                        continue;
+                    }
+
                     result = recvfrom(
-                        socket.Handle,
+                        sockeHandle,
                         receiveBuffer,
                         receiveBuffer.Length,
                         SocketFlags.None,
@@ -134,6 +158,10 @@
                         }
                     }
 #else
+                    if (!socket.Poll(SocketReceivePollTime, SelectMode.SelectRead))
+                    {
+                        continue;
+                    }
                     result = socket.ReceiveFrom(receiveBuffer, 0, receiveBuffer.Length, SocketFlags.None, ref bufferEndPoint);
                     if (!bufferNetEndPoint.EndPoint.Equals(bufferEndPoint))
                     {
@@ -262,25 +290,24 @@

         public bool SendBroadcast(byte[] data, int offset, int size, int port)
         {
+            bool success;
             try
             {
-                if (_udpSocketv4.SendTo(
-                        data,
-                        offset,
-                        size,
-                        SocketFlags.None,
-                        new IPEndPoint(IPAddress.Broadcast, port)) <= 0)
-                        return false;
+                success = _udpSocketv4.SendTo(
+                             data,
+                             offset,
+                             size,
+                             SocketFlags.None,
+                             new IPEndPoint(IPAddress.Broadcast, port)) > 0;

                 if (IPv6Support)
                 {
-                    if (_udpSocketv6.SendTo(
-                            data,
-                            offset,
-                            size,
-                            SocketFlags.None,
-                            new IPEndPoint(MulticastAddressV6, port)) <= 0)
-                        return false;
+                    success = success || _udpSocketv6.SendTo(
+                                 data,
+                                 offset,
+                                 size,
+                                 SocketFlags.None,
+                                 new IPEndPoint(MulticastAddressV6, port)) > 0;
                 }
             }
             catch (Exception ex)
@@ -288,47 +315,55 @@
                 NetUtils.DebugWriteError("[S][MCAST]" + ex);
                 return false;
             }
-            return true;
+            return success;
         }

         public int SendTo(byte[] data, int offset, int size, NetEndPoint remoteEndPoint, ref int errorCode)
         {
             try
             {
-                int result = 0;
-                if (remoteEndPoint.EndPoint.AddressFamily == AddressFamily.InterNetwork)
-                {
+                var socket = _udpSocketv4;
+                if (remoteEndPoint.EndPoint.AddressFamily == AddressFamily.InterNetworkV6 && IPv6Support)
+                {
+                    socket = _udpSocketv6;
+                }
+
+                int result;
 #if WIN32 && UNSAFE
-                    unsafe
-                    {
-                        fixed (byte* pinnedBuffer = data)
-                        {
-                            result = sendto(
-                                _udpSocketv4.Handle,
-                                pinnedBuffer + offset,
-                                size,
-                                SocketFlags.None,
-                                remoteEndPoint.SocketAddr,
-                                remoteEndPoint.SocketAddr.Length);
-                        }
-                    }
-
-                    if ((SocketError) result == SocketError.SocketError)
-                    {
-                        throw new SocketException(Marshal.GetLastWin32Error());
-                    }
+                var handle = socket.Handle;
+                IntPtr[] fileDescriptorSet = { (IntPtr)1, handle };
+                int socketCount = select(0, null, fileDescriptorSet, null, ref SendPollTime);
+                if ((SocketError)socketCount == SocketError.SocketError)
+                {
+                    throw new SocketException(Marshal.GetLastWin32Error());
+                }
+                if ((int)fileDescriptorSet[0] == 0 || fileDescriptorSet[1] != handle)
+                {
+                    return 0;
+                }
+                unsafe
+                {
+                    fixed (byte* pinnedBuffer = data)
+                    {
+                        result = sendto(
+                            handle,
+                            pinnedBuffer + offset,
+                            size,
+                            SocketFlags.None,
+                            remoteEndPoint.SocketAddr,
+                            remoteEndPoint.SocketAddr.Length);
+                    }
+                }
+
+                if ((SocketError) result == SocketError.SocketError)
+                {
+                    throw new SocketException(Marshal.GetLastWin32Error());
+                }
 #else
-                    if (!_udpSocketv4.Poll(SocketSendPollTime, SelectMode.SelectWrite))
-                        return -1;
-                    result = _udpSocketv4.SendTo(data, offset, size, SocketFlags.None, remoteEndPoint.EndPoint);
-#endif
-                }
-                else if(IPv6Support)
-                {
-                    if (!_udpSocketv6.Poll(SocketSendPollTime, SelectMode.SelectWrite))
-                        return -1;
-                    result = _udpSocketv6.SendTo(data, offset, size, SocketFlags.None, remoteEndPoint.EndPoint);
-                }
+                if (!socket.Poll(SocketSendPollTime, SelectMode.SelectWrite))
+                    return -1;
+                result = socket.SendTo(data, offset, size, SocketFlags.None, remoteEndPoint.EndPoint);
+#endif

                 NetUtils.DebugWrite(ConsoleColor.Blue, "[S]Send packet to {0}, result: {1}", remoteEndPoint.EndPoint, result);
                 return result;


A bit simpler example code

A bit simpler example code


Only enabling logging when an event handler is bound.

--- Magick.NET/MagickNET.cs
+++ Magick.NET/MagickNET.cs
@@ -35,6 +35,7 @@
 		};
 		//===========================================================================================
 		private static EventHandler<LogEventArgs> _Log;
+		private static LogEvents _LogEvents = LogEvents.None;
 		//===========================================================================================
 		private static string CheckDirectory(string path)
 		{
@@ -62,6 +63,23 @@

 			_Log(null, new LogEventArgs(type, text));
 		}
+		//===========================================================================================
+		private static void SetLogEvents()
+		{
+			string eventFlags = null;
+
+			if (EnumHelper.HasFlag(_LogEvents, LogEvents.All))
+			{
+				if (EnumHelper.HasFlag(_LogEvents, LogEvents.Trace))
+					eventFlags = "All,Trace";
+				else
+					eventFlags = "All";
+			}
+			else
+				eventFlags = EnumHelper.ConvertFlags(_LogEvents);
+
+			Wrapper.MagickNET.SetLogEvents(eventFlags);
+		}
 		///==========================================================================================
 		///<summary>
 		/// Returns the format information of the specified format based on the extension of the
@@ -162,7 +180,7 @@
 		{
 			Wrapper.MagickNET.SetEnv("MAGICK_OPENCL_CACHE_DIR", CheckDirectory(path));
 		}
-		///=======================================================================================
+		///==========================================================================================
 		///<summary>
 		/// Set the events that will be written to the log. The log will be written to the Log event
 		/// and the debug window in VisualStudio. To change the log settings you must use a custom
@@ -171,19 +189,10 @@
 		///<param name="events">The events that will be logged.</param>
 		public static void SetLogEvents(LogEvents events)
 		{
-			string eventFlags = null;
-
-			if (EnumHelper.HasFlag(events, LogEvents.All))
-			{
-				if (EnumHelper.HasFlag(events, LogEvents.Trace))
-					eventFlags = "All,Trace";
-				else
-					eventFlags = "All";
-			}
-			else
-				eventFlags = EnumHelper.ConvertFlags(events);
-
-			Wrapper.MagickNET.SetLogEvents(eventFlags);
+			_LogEvents = events;
+
+			if (_Log != null)
+				SetLogEvents();
 		}
 		///==========================================================================================
 		///<summary>
@@ -194,7 +203,10 @@
 			add
 			{
 				if (_Log == null)
+				{
 					Wrapper.MagickNET.SetLogDelegate(OnLog);
+					SetLogEvents();
+				}

 				_Log += value;
 			}
@@ -203,7 +215,10 @@
 				_Log -= value;

 				if (_Log == null)
+				{
 					Wrapper.MagickNET.SetLogDelegate(null);
+					Wrapper.MagickNET.SetLogEvents("None");
+				}
 			}
 		}
 		///==========================================================================================


Fix crazy memory usage of masterserver

Fix crazy memory usage of masterserver

--- MasterServer/Program.cs
+++ MasterServer/Program.cs
@@ -15,8 +15,6 @@
     ///
     internal class Program
     {
-
-
         private static void Main(string[] args)
         {
             if (!File.Exists(Constants.DllPath))
@@ -27,7 +25,7 @@

             Constants.CurrentVersion = new Version(FileVersionInfo.GetVersionInfo(Constants.DllPath).FileVersion);

-            CheckNewVersion(args);
+            //CheckNewVersion(args);
             Start(args);

             while (true)
@@ -72,7 +70,7 @@
             Task.Run(() =>
             {
                 //Wait 5 seconds before checking...
-                Task.Delay(5000);
+                Thread.Sleep(5000);

                 while (true)
                 {
@@ -97,7 +95,7 @@
                     }

                     //Sleep for 30 minutes...
-                    Task.Delay(30 * 60 * 1000);
+                    Thread.Sleep(30 * 60 * 1000);
                 }
             });
         }


Add missing null check to NestedLoops.cs.

--- MoreLinq/NestedLoops.cs
+++ MoreLinq/NestedLoops.cs
@@ -38,6 +38,7 @@

         public static IEnumerable<Action> NestedLoops(this Action action, IEnumerable<int> loopCounts)
         {
+            if (action == null) throw new ArgumentNullException("action");
             if (loopCounts == null) throw new ArgumentNullException("loopCounts");

             using (var iter = loopCounts.GetEnumerator())


Color coding failures

Color coding failures

--- MsTestRunner/Program.cs
+++ MsTestRunner/Program.cs
@@ -85,7 +85,9 @@
         {
             for (int i = 0; i < result.FailureMessages.Count; i++)
             {
+                Console.ForegroundColor = ConsoleColor.Red;
                 Console.WriteLine("Failure #{0} of {1}", i + 1, result.FailureMessages.Count);
+                Console.ForegroundColor = ConsoleColor.White;
                 Console.WriteLine(result.FailureMessages[i]);
                 Console.WriteLine();
             }


playpausing

playpausing

--- MyWmp/Models/Control.cs
+++ MyWmp/Models/Control.cs
@@ -27,7 +27,6 @@
                     Playlist.Reset();
                 if (Playlist.Current != null)
                 {
-                    this.MediaStop(this, EventArgs.Empty);
                     this.IsPlaying = true;
                     this.MediaPlay(this, EventArgs.Empty);
                 }


Update NTask.cs

Update NTask.cs

--- NReact/Classes/NTask.cs
+++ NReact/Classes/NTask.cs
@@ -7,7 +7,7 @@

 namespace NReact
 {
-  class NDispatcher
+  public class NDispatcher
   {
     public static readonly NDispatcher Default = new NDispatcher();

@@ -50,7 +50,7 @@
     void Enqueue(NTask task)
     {
 #if DUMP
-      Debug.WriteLine("Enqueue " + task);
+      Debug.WriteLine("Enqueue Task");
 #endif
       while (true)
       {
@@ -70,11 +70,6 @@
       Enqueue(new NTask { Action = task });
     }

-    internal void EnqueueUpdate(NComponent component)
-    {
-      Enqueue(component.UpdateCore);
-    }
-
     class NTask
     {
       internal NTask Next;


Finishing some incomplete unit tests.

Finishing some incomplete unit tests.

--- NStackTests/RuneTest.cs
+++ NStackTests/RuneTest.cs
@@ -163,8 +163,21 @@
 			Assert.AreEqual(3, Rune.RuneLen(s));
 			var buff = new byte[4];
 			var sb = Rune.EncodeRune('\u2503', buff);
+			Assert.AreEqual(1, Rune.ColumnWidth('\u2503'));
+			(var rune, var size) = Rune.DecodeRune(ustring.Make('\u2503'));
+			Assert.AreEqual(sb, size);
+			Assert.AreEqual('\u2503', (uint)rune);
 			var scb = char.ConvertToUtf32("℃", 0);
 			var scr = '℃'.ToString().Length;
+			Assert.AreEqual(scr, Rune.ColumnWidth((uint)scb));
+			buff = new byte [4];
+			sb = Rune.EncodeRune('\u1100', buff);
+			Assert.AreEqual(2, Rune.ColumnWidth('\u1100'));
+			Assert.AreEqual(2, ustring.Make('\u1100').ConsoleWidth);
+			Assert.AreEqual(1, '\u1100'.ToString().Length); // Length as string returns 1 but in reality it occupies 2 columns.
+			(rune, size) = Rune.DecodeRune(ustring.Make('\u1100'));
+			Assert.AreEqual(sb, size);
+			Assert.AreEqual('\u1100', (uint)rune);
 		}

 		[Test]


added PreviewStats URI

added PreviewStats URI

--- Openbook/OpenbookUri.cs
+++ Openbook/OpenbookUri.cs
@@ -71,5 +71,19 @@
             /// </summary>
             public const string Category = BaseApiUri + "/Category";
         }
+
+        public static class Users
+        {
+            internal const string BaseApiUri = BaseUri + "/Users";
+
+            /// <summary>
+            ///     Gets basic stats information about the specified user.
+            ///     The usernamed is not specified as a GET parameter but in the URI:
+            ///     /PreviewStats/username/
+            ///     So the username should be appended after this URI.
+            ///     (i.e. var uri = Users.PreviewStats + "username";)
+            /// </summary>
+            public const string PreviewStats = BaseApiUri + "/PreviewStats/";
+        }
     }
 }


moved const from struct to static class to avoid instantiation.

--- Openbook/OpenbookUri.cs
+++ Openbook/OpenbookUri.cs
@@ -6,7 +6,7 @@
     /// <remarks>
     ///     APIs seems to take a '_' parameter that seems to be the current user token
     /// </remarks>
-    public struct OpenbookUri
+    public static class OpenbookUri
     {
         public const string Protocol = "https://";
         public const string Hostname = "openbook.etoro.com";
@@ -27,7 +27,7 @@
         /// </summary>
         public const string TopPerformers = Rankings + "/TopPerformers/";

-        public struct ClientInformation
+        public static class ClientInformation
         {
             internal const string BaseApiUri = BaseUri + "/ClientInformation/";

@@ -37,7 +37,7 @@
             public const string Information = BaseApiUri + "/Information/";
         }

-        public struct Search
+        public static class Search
         {
             internal const string BaseApiUri = BaseUri + "/Search";

@@ -50,7 +50,7 @@
             public const string AdditionalData = BaseApiUri + "/AdditionalData/";
         }

-        public struct Markets
+        public static class Markets
         {
             internal const string BaseApiUri = BaseUri + "/Markets";


Increase Version

Increase Version

--- PackHistorian/Plugin.cs
+++ PackHistorian/Plugin.cs
@@ -12,7 +12,7 @@
 namespace PackTracker {
   public class Plugin : IPlugin {
     const string _name = "Pack Tracker";
-    readonly static Version _version = new Version("1.2.12");
+    readonly static Version _version = new Version("1.3.0");

     private PackWatcher _watcher;
     Updater _updater;


[Fixes bug #1186785] Disable a few more menu items when no documents are open.

Also removed some duplicated code to make this easier in the future.

--- Pinta/DialogHandlers.cs
+++ Pinta/DialogHandlers.cs
@@ -90,46 +90,7 @@
 			PintaCore.Actions.Window.RemoveDocument (e.Document);

 			if (!PintaCore.Workspace.HasOpenDocuments) {
-				PintaCore.Actions.File.Close.Sensitive = false;
-				PintaCore.Actions.File.Save.Sensitive = false;
-				PintaCore.Actions.File.SaveAs.Sensitive = false;
-				PintaCore.Actions.File.Print.Sensitive = false;
-				PintaCore.Actions.Edit.Copy.Sensitive = false;
-				PintaCore.Actions.Edit.CopyMerged.Sensitive = false;
-				PintaCore.Actions.Edit.Cut.Sensitive = false;
-				PintaCore.Actions.Edit.PasteIntoNewLayer.Sensitive = false;
-				PintaCore.Actions.Edit.SelectAll.Sensitive = false;
-
-				PintaCore.Actions.View.ActualSize.Sensitive = false;
-				PintaCore.Actions.View.ZoomIn.Sensitive = false;
-				PintaCore.Actions.View.ZoomOut.Sensitive = false;
-				PintaCore.Actions.View.ZoomToSelection.Sensitive = false;
-				PintaCore.Actions.View.ZoomToWindow.Sensitive = false;
-				PintaCore.Actions.View.ZoomComboBox.Sensitive = false;
-
-				PintaCore.Actions.Image.CropToSelection.Sensitive = false;
-				PintaCore.Actions.Image.AutoCrop.Sensitive = false;
-				PintaCore.Actions.Image.CanvasSize.Sensitive = false;
-				PintaCore.Actions.Image.Resize.Sensitive = false;
-				PintaCore.Actions.Image.FlipHorizontal.Sensitive = false;
-				PintaCore.Actions.Image.FlipVertical.Sensitive = false;
-				PintaCore.Actions.Image.Rotate180.Sensitive = false;
-				PintaCore.Actions.Image.RotateCCW.Sensitive = false;
-				PintaCore.Actions.Image.RotateCW.Sensitive = false;
-
-				PintaCore.Actions.Layers.AddNewLayer.Sensitive = false;
-				PintaCore.Actions.Layers.DuplicateLayer.Sensitive = false;
-				PintaCore.Actions.Layers.FlipHorizontal.Sensitive = false;
-				PintaCore.Actions.Layers.FlipVertical.Sensitive = false;
-				PintaCore.Actions.Layers.ImportFromFile.Sensitive = false;
-				PintaCore.Actions.Layers.Properties.Sensitive = false;
-				PintaCore.Actions.Layers.RotateZoom.Sensitive = false;
-
-				PintaCore.Actions.Adjustments.ToggleActionsSensitive (false);
-				PintaCore.Actions.Effects.ToggleActionsSensitive (false);
-
-				PintaCore.Actions.Window.SaveAll.Sensitive = false;
-				PintaCore.Actions.Window.CloseAll.Sensitive = false;
+				ToggleActions (false);
 			}
 		}

@@ -137,45 +98,55 @@
 		{
 			PintaCore.Actions.Window.AddDocument (e.Document);

-			PintaCore.Actions.File.Close.Sensitive = true;
-			PintaCore.Actions.File.Save.Sensitive = true;
-			PintaCore.Actions.File.SaveAs.Sensitive = true;
-			PintaCore.Actions.File.Print.Sensitive = true;
-			PintaCore.Actions.Edit.Copy.Sensitive = true;
-			PintaCore.Actions.Edit.CopyMerged.Sensitive = true;
-			PintaCore.Actions.Edit.Cut.Sensitive = true;
-			PintaCore.Actions.Edit.PasteIntoNewLayer.Sensitive = true;
-			PintaCore.Actions.Edit.SelectAll.Sensitive = true;
+			ToggleActions (true);
+		}

-			PintaCore.Actions.View.ActualSize.Sensitive = true;
-			PintaCore.Actions.View.ZoomIn.Sensitive = true;
-			PintaCore.Actions.View.ZoomOut.Sensitive = true;
-			PintaCore.Actions.View.ZoomToSelection.Sensitive = true;
-			PintaCore.Actions.View.ZoomToWindow.Sensitive = true;
-			PintaCore.Actions.View.ZoomComboBox.Sensitive = true;
+		private static void ToggleActions (bool enable)
+		{
+			PintaCore.Actions.File.Close.Sensitive = enable;
+			PintaCore.Actions.File.Save.Sensitive = enable;
+			PintaCore.Actions.File.SaveAs.Sensitive = enable;
+			PintaCore.Actions.File.Print.Sensitive = enable;
+			PintaCore.Actions.Edit.Copy.Sensitive = enable;
+			PintaCore.Actions.Edit.CopyMerged.Sensitive = enable;
+			PintaCore.Actions.Edit.Cut.Sensitive = enable;
+			PintaCore.Actions.Edit.PasteIntoNewLayer.Sensitive = enable;
+			PintaCore.Actions.Edit.EraseSelection.Sensitive = enable;
+			PintaCore.Actions.Edit.FillSelection.Sensitive = enable;
+			PintaCore.Actions.Edit.InvertSelection.Sensitive = enable;
+			PintaCore.Actions.Edit.SelectAll.Sensitive = enable;
+			PintaCore.Actions.Edit.Deselect.Sensitive = enable;

-			PintaCore.Actions.Image.AutoCrop.Sensitive = true;
-			PintaCore.Actions.Image.CanvasSize.Sensitive = true;
-			PintaCore.Actions.Image.Resize.Sensitive = true;
-			PintaCore.Actions.Image.FlipHorizontal.Sensitive = true;
-			PintaCore.Actions.Image.FlipVertical.Sensitive = true;
-			PintaCore.Actions.Image.Rotate180.Sensitive = true;
-			PintaCore.Actions.Image.RotateCCW.Sensitive = true;
-			PintaCore.Actions.Image.RotateCW.Sensitive = true;
+			PintaCore.Actions.View.ActualSize.Sensitive = enable;
+			PintaCore.Actions.View.ZoomIn.Sensitive = enable;
+			PintaCore.Actions.View.ZoomOut.Sensitive = enable;
+			PintaCore.Actions.View.ZoomToSelection.Sensitive = enable;
+			PintaCore.Actions.View.ZoomToWindow.Sensitive = enable;
+			PintaCore.Actions.View.ZoomComboBox.Sensitive = enable;

-			PintaCore.Actions.Layers.AddNewLayer.Sensitive = true;
-			PintaCore.Actions.Layers.DuplicateLayer.Sensitive = true;
-			PintaCore.Actions.Layers.FlipHorizontal.Sensitive = true;
-			PintaCore.Actions.Layers.FlipVertical.Sensitive = true;
-			PintaCore.Actions.Layers.ImportFromFile.Sensitive = true;
-			PintaCore.Actions.Layers.Properties.Sensitive = true;
-			PintaCore.Actions.Layers.RotateZoom.Sensitive = true;
+			PintaCore.Actions.Image.CropToSelection.Sensitive = enable;
+			PintaCore.Actions.Image.AutoCrop.Sensitive = enable;
+			PintaCore.Actions.Image.CanvasSize.Sensitive = enable;
+			PintaCore.Actions.Image.Resize.Sensitive = enable;
+			PintaCore.Actions.Image.FlipHorizontal.Sensitive = enable;
+			PintaCore.Actions.Image.FlipVertical.Sensitive = enable;
+			PintaCore.Actions.Image.Rotate180.Sensitive = enable;
+			PintaCore.Actions.Image.RotateCCW.Sensitive = enable;
+			PintaCore.Actions.Image.RotateCW.Sensitive = enable;

-			PintaCore.Actions.Adjustments.ToggleActionsSensitive (true);
-			PintaCore.Actions.Effects.ToggleActionsSensitive (true);
+			PintaCore.Actions.Layers.AddNewLayer.Sensitive = enable;
+			PintaCore.Actions.Layers.DuplicateLayer.Sensitive = enable;
+			PintaCore.Actions.Layers.FlipHorizontal.Sensitive = enable;
+			PintaCore.Actions.Layers.FlipVertical.Sensitive = enable;
+			PintaCore.Actions.Layers.ImportFromFile.Sensitive = enable;
+			PintaCore.Actions.Layers.Properties.Sensitive = enable;
+			PintaCore.Actions.Layers.RotateZoom.Sensitive = enable;

-			PintaCore.Actions.Window.SaveAll.Sensitive = true;
-			PintaCore.Actions.Window.CloseAll.Sensitive = true;
+			PintaCore.Actions.Adjustments.ToggleActionsSensitive (enable);
+			PintaCore.Actions.Effects.ToggleActionsSensitive (enable);
+
+			PintaCore.Actions.Window.SaveAll.Sensitive = enable;
+			PintaCore.Actions.Window.CloseAll.Sensitive = enable;
 		}
 	}
 }


ProcessWatcherService handle test before ingestion

--- EarTrumpet/DataModel/Internal/Services/ProcessWatcherService.cs
+++ EarTrumpet/DataModel/Internal/Services/ProcessWatcherService.cs
@@ -43,6 +43,13 @@
                 processHandle = Kernel32.OpenProcess(Kernel32.ProcessFlags.SYNCHRONIZE, false, processId)
             };
             data.quitActions.Add(processQuit);
+
+            if (Kernel32.WaitForSingleObject(data.processHandle, 0) != Kernel32.WAIT_TIMEOUT)
+            {
+                Trace.WriteLine($"ProcessWatcherService WatchProcess Error: Unwatchable handle: {processId}");
+                Kernel32.CloseHandle(data.processHandle);
+                return;
+            }

             lock (_lock)
             {
@@ -92,10 +99,10 @@
                         var returnValue = Kernel32.WaitForMultipleObjects(handles.Length, handles, false, (int)TimeSpan.FromSeconds(5).TotalMilliseconds);
                         switch(returnValue)
                         {
+                            // We never expect to see WAIT_ABANDONED since we are only waiting on process handles.
                             case Kernel32.WAIT_ABANDONED:
+                            // We don't expect WAIT_FAILED here since we did a test WaitForSingleObject on each handle before ingestion.
                             case Kernel32.WAIT_FAILED:
-                                // NOTE: We aren't logging here because this occurs a lot in the wild, we need
-                                // to investigate.
                                 Debug.Assert(false);
                                 break;
                             case Kernel32.WAIT_TIMEOUT:


Make SwitchToLogin to a Reactive Property

--- Ets.Mobile/Ets.Mobile.ViewModel/Pages/Account/LoginViewModel.cs
+++ Ets.Mobile/Ets.Mobile.ViewModel/Pages/Account/LoginViewModel.cs
@@ -144,7 +144,12 @@

         private bool _isValidating;

-        public ReactiveCommand<bool> SwitchToLogin { get; set; }
+        private ReactiveCommand<bool> _switchToLogin;
+        public ReactiveCommand<bool> SwitchToLogin
+        {
+            get { return _switchToLogin; }
+            set { this.RaiseAndSetIfChanged(ref _switchToLogin, value); }
+        }

         public ReactiveCommand<EtsUserCredentials> Login { get; set; }


FLEET-9992: Add extra property to use new long Id's

--- MiX.Integrate.Shared/Entities/Messages/SendJobMessageCarrier.cs
+++ MiX.Integrate.Shared/Entities/Messages/SendJobMessageCarrier.cs
@@ -19,7 +19,8 @@
 		public bool AddAddressSummary { get; set; }
 		public bool UseFirstAddressForSummary { get; set; }
 		public JobMessageActionNotifications NotificationSettings { get; set; }
-		public long[] AddressList { get; set; }
+		public int[] AddressList { get; set; }
+		public long[] LocationList { get; set; }
 		public CommsTransports Transport { get; set; }
 		public bool Urgent { get; set; }
 	}


wipeouts now also clear all antibodies and items from the level

--- ParticleStormControl/ParticleStormControl/InGame/Level/Level.cs
+++ ParticleStormControl/ParticleStormControl/InGame/Level/Level.cs
@@ -114,6 +114,7 @@

         /// <summary>
         /// if this is set to true, all player items will be removed in the next level update step
+        /// the same goes for all items in the level.
         /// </summary>
         private bool clearAllItems = false;

@@ -404,6 +405,12 @@
             // remove dead objects
             for (int i = 0; i < mapObjects.Count; ++i)
             {
+                if (UseItems && clearAllItems)
+                {
+                    // remove all Items from the level after a wipeout
+                    if (mapObjects[i] is Item || mapObjects[i] is Debuff)
+                        mapObjects[i].Alive = false;
+                }
                 if (!mapObjects[i].Alive)
                 {
                     // if its a item, give it to a player if its 100% his


CRQ-14551 : Fix unit test

CRQ-14551 : Fix unit test

--- Sdl.Web.Tridion.Templates.Tests/DataModelBuilderPipelineTest.cs
+++ Sdl.Web.Tridion.Templates.Tests/DataModelBuilderPipelineTest.cs
@@ -346,7 +346,7 @@
             ContentModelData regionMetadata = mergedRegionPm.Regions.First(r => r.Name == "Main").Metadata;

             Assert.AreEqual(3, regionMetadata.Count, "Number of metadata fields in the Region is different from expected");
-            Assert.AreEqual("Test Native Region Metadata", regionMetadata["MergedMetadataField"],
+            Assert.AreEqual("Native Region Metadata Value 1", regionMetadata["MergedMetadataField"],
                 $"Value in {regionMetaField1.Name} is different from expected");
             Assert.AreEqual("Native Region Metadata Value 1", regionMetadata["CmRegionMetadataField"],
                 $"Value in {regionMetaField2.Name} is different from expected");


fix duplicateList

fix duplicateList

--- Signum.Engine.Extensions/Mailing/Pop3/Pop3ConfigurationLogic.cs
+++ Signum.Engine.Extensions/Mailing/Pop3/Pop3ConfigurationLogic.cs
@@ -318,6 +318,8 @@
                             });
                         }

+                        email.SetCalculateHash();
+
                         var duplicateList = Database.Query<EmailMessageEntity>()
                                .Where(a => a.BodyHash == email.BodyHash)
                                .Select(a => new { l = a.ToLite(), date = (DateTime?)a.Mixin<EmailReceptionMixin>().ReceptionInfo!.ReceivedDate, bh = a.BodyHash, suid = a.Mixin<EmailReceptionMixin>().ReceptionInfo!.UniqueId })


Updated doc

Updated doc

--- SimpleSOAPClient/src/SimpleSOAPClient/Handlers/HandlerResult.cs
+++ SimpleSOAPClient/src/SimpleSOAPClient/Handlers/HandlerResult.cs
@@ -1,7 +1,7 @@
 namespace SimpleSOAPClient.Handlers
 {
     /// <summary>
-    /// Represents the handler result
+    /// Base class for handler results
     /// </summary>
     public abstract class HandlerResult : IHandlerResult
     {


maybe this shit works

maybe this shit works

--- SoraBot/SoraBot.Data/Repositories/GuildRepos/GuildRepository.cs
+++ SoraBot/SoraBot.Data/Repositories/GuildRepos/GuildRepository.cs
@@ -57,10 +57,8 @@
             => await _soraTransactor.DoInTransactionAsync(async context =>
             {
                 await GetOrSetAndGetGuild(guildId, context).ConfigureAwait(false);
-                var guild = await context.Guilds.FindAsync(guildId).ConfigureAwait(false);
                 var guildUser = await GetOrCreateGuildUser(guildId, userId, context).ConfigureAwait(false);
                 guildUser.Exp += expToAdd;
-                guild.GuildUsers.Add(guildUser);
                 await context.SaveChangesAsync().ConfigureAwait(false);
             }).ConfigureAwait(false);

@@ -76,6 +74,7 @@
             if (guildUser != null) return guildUser;
             // Create a user and return him
             guildUser = new GuildUser(userId, guildId, 0);
+            context.GuildUsers.Add(guildUser);
             return guildUser;
         }


Add application/vnd.restful+json to json input and output formatters

--- Source/Content/ApiTemplate/CustomServiceCollectionExtensions.cs
+++ Source/Content/ApiTemplate/CustomServiceCollectionExtensions.cs
@@ -160,6 +160,20 @@
                     // Check model state for null or invalid models and automatically return a 400 Bad Request.
                     options.Filters.Add(new ValidateModelStateAttribute());

+                    // Add RESTful JSON media type to the JSON input and output formatters. See http://restfuljson.org/
+                    options
+                        .InputFormatters
+                        .OfType<JsonInputFormatter>()
+                        .First()
+                        .SupportedMediaTypes
+                        .Add("application/vnd.restful+json");
+                    options
+                        .OutputFormatters
+                        .OfType<JsonOutputFormatter>()
+                        .First()
+                        .SupportedMediaTypes
+                        .Add("application/vnd.restful+json");
+
                     // Remove string and stream output formatters. These are not useful for an API serving JSON or XML.
                     options.OutputFormatters.RemoveType<StreamOutputFormatter>();
                     options.OutputFormatters.RemoveType<StringOutputFormatter>();


Synchrophasor: Modified FlatlineTest to use a unique, per-test FlatlineService entry in the config file.

git-tfs-id: [https://tfs.codeplex.com/tfs/TFS07]$/openpdc/Synchrophasor/Current Version;C39379

--- Source/Libraries/Adapters/DataQualityMonitoring/FlatlineTest.cs
+++ Source/Libraries/Adapters/DataQualityMonitoring/FlatlineTest.cs
@@ -297,6 +297,7 @@
             m_warningTimer.Elapsed += m_warningTimer_Elapsed;

             m_flatlineService = new FlatlineService(this);
+            m_flatlineService.SettingsCategory = base.Name + m_flatlineService.SettingsCategory;
             m_flatlineService.ServiceProcessException += m_flatlineService_ServiceProcessException;
             m_flatlineService.Initialize();
         }


Use only one DB roundtrip when (re)activating a connection

--- Thinktecture.Relay.Server/Communication/BackendCommunication.cs
+++ Thinktecture.Relay.Server/Communication/BackendCommunication.cs
@@ -177,10 +177,10 @@

 				if (!connectionContext.IsActive)
 				{
+					connectionContext.LastDbActivity = now;
 					await RegisterOnPremiseAsync(connectionContext);
 				}
-
-				if (connectionContext.LastDbActivity + _lastActivityDbUpdateDelay < now)
+				else if (connectionContext.LastDbActivity + _lastActivityDbUpdateDelay < now)
 				{
 					connectionContext.LastDbActivity = now;
 					await _linkRepository.RenewActiveConnectionAsync(connectionId);


refactor and integrate Trie and Patricia Trie

--- TrieExperimentPlatform/TrieExperimentPlatform/TrieExperiment.cs
+++ TrieExperimentPlatform/TrieExperimentPlatform/TrieExperiment.cs
@@ -14,24 +14,35 @@
         {
             string[] lines = System.IO.File.ReadAllLines(@"..\..\Data\count_1w_small.txt");
             Console.WriteLine("Read {0} lines from file", lines.Length);
+            var words = lines
+                .Select(x => x.Split('\t').FirstOrDefault())
+                .Where(x => !String.IsNullOrEmpty(x))
+                .ToArray();
+
+            RunExperiment(new Trie<string>(), words);
+            RunExperiment(new SuffixTrie<string>(0), words);
+            RunExperiment(new PatriciaTrie<string>(), words);
+            //RunExperiment(new PatriciaSuffixTrie<string>(0), words);
+
+
+
+            Console.Read();
+
+        }
+
+        public static void RunExperiment(ITrie<string> trie, IEnumerable<string> words)
+        {
+            Console.WriteLine("Running experiment for: " + trie.GetType().ToString());

             var s = Stopwatch.StartNew();
-

             var proc = Process.GetCurrentProcess();
             var startMemory = proc.WorkingSet64;

-            var SuffixTrie = new SuffixTrie<string>(0);
-
             // build trie
-            foreach(var line in lines)
+            foreach (var word in words)
             {
-                var word = line.Split('\t').FirstOrDefault();
-                if (word != null)
-                {
-                    // add to trie
-                    SuffixTrie.Add(word, word);
-                }
+                trie.Add(word, word);
             }

             s.Stop();
@@ -41,12 +52,12 @@

             //run experiment
             RandomTestcaseProvider testcase = new RandomTestcaseProvider();
-            foreach(var testWord in testcase.GetTestWords())
+            foreach (var testWord in testcase.GetTestWords())
             {
-                var result = SuffixTrie.Retrieve(testWord);
+                var result = trie.Retrieve(testWord);
                 //Console.WriteLine(String.Join(" ", result));
             }
-
+
             s.Stop();
             Console.WriteLine("Elapsed Time Running Experiment: {0} ms", s.ElapsedMilliseconds);

@@ -55,8 +66,11 @@

             Console.WriteLine("Memory Usage: {0}", endMemory - startMemory);

-            Console.Read();
+

         }
+
+
+
     }
 }


Update TabUpdateMessage.cs

Update TabUpdateMessage.cs

--- UnityProject/Assets/Scripts/Messages/Server/TabUpdateMessage.cs
+++ UnityProject/Assets/Scripts/Messages/Server/TabUpdateMessage.cs
@@ -40,7 +40,7 @@
 				return;
 			}

-			if (NumOfMessages == ElementValuesCache[UniqueID].Item2)
+			if (NumOfMessages == ElementValuesCache[UniqueID].Item2 + 1)
 			{
 				Debug.LogError("This message didnt arrive in time before the end message!");
 				ElementValuesCache.Remove(UniqueID);
@@ -54,13 +54,15 @@
 		//If end of message add
 		if(ID == 2)
 		{
-			if (NumOfMessages != ElementValuesCache[UniqueID].Item2 + 1)
+			ElementValuesCache[UniqueID] = new Tuple<ElementValue[], int>(Concat(ElementValuesCache[UniqueID].Item1, ElementValues), ElementValuesCache[UniqueID].Item2 + 1);
+
+			if (NumOfMessages != ElementValuesCache[UniqueID].Item2)
 			{
 				Debug.LogError("Not all the messages arrived in time for the NetUI update.");
 				return;
 			}

-			ElementValues = Concat(ElementValuesCache[UniqueID].Item1, ElementValues);
+			ElementValues = ElementValuesCache[UniqueID].Item1;
 			ElementValuesCache.Remove(UniqueID);
 		}


[general.wp81] Fix DeviceIdentifier to return sensible values.

--- Windows/Source/Main.WindowsRuntime/Services/DeviceIdentifier.cs
+++ Windows/Source/Main.WindowsRuntime/Services/DeviceIdentifier.cs
@@ -2,8 +2,8 @@
 // See LICENSE file for more details
 // File author: Solal Pirelli

+using System;
 using System.Runtime.InteropServices.WindowsRuntime;
-using System.Text;
 using PocketCampus.Common.Services;
 using Windows.System.Profile;

@@ -20,17 +20,10 @@
                 if ( _current == null )
                 {
                     var token = HardwareIdentification.GetPackageSpecificToken( null );
-                    _current = TokenToString( token );
+                    _current = BitConverter.ToString( token.Id.ToArray() );
                 }
                 return _current;
             }
         }
-
-
-        private static string TokenToString( HardwareToken token )
-        {
-            var bytes = token.Id.ToArray();
-            return Encoding.UTF8.GetString( bytes, 0, bytes.Length );
-        }
     }
 }


[iOS] Fix WayPointCircle control attribute identifier.

--- XamarinApp/MyTrips/MyTrips.iOS/CustomControls/WayPointCircle.cs
+++ XamarinApp/MyTrips/MyTrips.iOS/CustomControls/WayPointCircle.cs
@@ -6,99 +6,99 @@

 namespace MyTrips.iOS.CustomControls
 {
-	//[Register("WayPointCircle") DesignTimeVisible(true)]
-	//public class WayPointCircle : UIView
-	//{
-	//	public WayPointCircle()
-	//	{
-	//		Initialize();
-	//	}
+	[Register("WayPointCircle") DesignTimeVisible(true)]
+	public class WayPointCircle : UIView
+	{
+		public WayPointCircle()
+		{
+			Initialize();
+		}

-	//	public WayPointCircle(IntPtr p): base(p)
-	//	{
-	//		Initialize();
-	//	}
+		public WayPointCircle(IntPtr p): base(p)
+		{
+			Initialize();
+		}

-	//	void Initialize()
-	//	{
-	//		Text = "A";
-	//		BackgroundColor = UIColor.FromRGBA(0.882f, 0.133f, 0.180f, 1.000f);
-	//		BorderColor = UIColor.White;
-	//		SetNeedsDisplay();
-	//	}
+		void Initialize()
+		{
+			Text = "A";
+			BackgroundColor = UIColor.FromRGBA(0.882f, 0.133f, 0.180f, 1.000f);
+			BorderColor = UIColor.White;
+			SetNeedsDisplay();
+		}

-	//	private UIColor color;
-	//	private UIColor borderColor;
-	//	private string text;
+		private UIColor color;
+		private UIColor borderColor;
+		private string text;

-	//	[Export("Color"), Browsable(true)]
-	//	public UIColor Color
-	//	{
-	//		get
-	//		{
-	//			return color;
-	//		}
-	//		set
-	//		{
-	//			color = value;
-	//			SetNeedsDisplay ();
-	//		}
-	//	}
+		[Export("Color"), Browsable(true)]
+		public UIColor Color
+		{
+			get
+			{
+				return color;
+			}
+			set
+			{
+				color = value;
+				SetNeedsDisplay ();
+			}
+		}

-	//	[Export("Border Color"), Browsable(true)]
-	//	public UIColor BorderColor
-	//	{
-	//		get
-	//		{
-	//			return borderColor;
-	//		}
-	//		set
-	//		{
-	//			borderColor = value;
-	//			SetNeedsDisplay ();
-	//		}
-	//	}
+		[Export("BorderColor"), Browsable(true)]
+		public UIColor BorderColor
+		{
+			get
+			{
+				return borderColor;
+			}
+			set
+			{
+				borderColor = value;
+				SetNeedsDisplay ();
+			}
+		}

-	//	[Export("Text"), Browsable(true)]
-	//	public string Text
-	//	{
-	//		get
-	//		{
-	//			return text;
-	//		}
-	//		set
-	//		{
-	//			text = value;
-	//			SetNeedsDisplay ();
-	//		}
-	//	}
+		[Export("Text"), Browsable(true)]
+		public string Text
+		{
+			get
+			{
+				return text;
+			}
+			set
+			{
+				text = value;
+				SetNeedsDisplay ();
+			}
+		}

-	//	public override void Draw(CGRect frame)
-	//	{
-	//		base.Draw(frame);
+		public override void Draw(CGRect frame)
+		{
+			base.Draw(frame);

-	//		//// General Declarations
-	//		var context = UIGraphics.GetCurrentContext();
+			//// General Declarations
+			var context = UIGraphics.GetCurrentContext();

-	//		//// Circle Drawing
-	//		CGRect circleRect = new CGRect(frame.GetMinX() + 2.0f, frame.GetMinY() + 2.0f, frame.Width - 5.0f, frame.Height - 5.0f);
-	//		var circlePath = UIBezierPath.FromOval(circleRect);
-	//		BackgroundColor.SetFill();
-	//		circlePath.Fill();
-	//		BorderColor.SetStroke();
-	//		circlePath.LineWidth = 4.0f;
-	//		circlePath.Stroke();
-	//		UIColor.White.SetFill();
-	//		var circleStyle = new NSMutableParagraphStyle ();
-	//		circleStyle.Alignment = UITextAlignment.Center;
+			//// Circle Drawing
+			CGRect circleRect = new CGRect(frame.GetMinX() + 2.0f, frame.GetMinY() + 2.0f, frame.Width - 5.0f, frame.Height - 5.0f);
+			var circlePath = UIBezierPath.FromOval(circleRect);
+			BackgroundColor.SetFill();
+			circlePath.Fill();
+			BorderColor.SetStroke();
+			circlePath.LineWidth = 4.0f;
+			circlePath.Stroke();
+			UIColor.White.SetFill();
+			var circleStyle = new NSMutableParagraphStyle ();
+			circleStyle.Alignment = UITextAlignment.Center;

-	//		var circleFontAttributes = new UIStringAttributes () {Font = UIFont.FromName("HelveticaNeue", 18.0f), ForegroundColor = UIColor.White, ParagraphStyle = circleStyle};
-	//		var circleTextHeight = new NSString(Text).GetBoundingRect(new CGSize(circleRect.Width, nfloat.MaxValue), NSStringDrawingOptions.UsesLineFragmentOrigin, circleFontAttributes, null).Height;
-	//		context.SaveState();
-	//		context.ClipToRect(circleRect);
-	//		new NSString(Text).DrawString(new CGRect(circleRect.GetMinX(), circleRect.GetMinY() + (circleRect.Height - circleTextHeight) / 2.0f, circleRect.Width, circleTextHeight), UIFont.FromName("HelveticaNeue", 18.0f), UILineBreakMode.WordWrap, UITextAlignment.Center);
-	//		context.RestoreState();
-	//	}
-	//}
+			var circleFontAttributes = new UIStringAttributes () {Font = UIFont.FromName("HelveticaNeue", 18.0f), ForegroundColor = UIColor.White, ParagraphStyle = circleStyle};
+			var circleTextHeight = new NSString(Text).GetBoundingRect(new CGSize(circleRect.Width, nfloat.MaxValue), NSStringDrawingOptions.UsesLineFragmentOrigin, circleFontAttributes, null).Height;
+			context.SaveState();
+			context.ClipToRect(circleRect);
+			new NSString(Text).DrawString(new CGRect(circleRect.GetMinX(), circleRect.GetMinY() + (circleRect.Height - circleTextHeight) / 2.0f, circleRect.Width, circleTextHeight), UIFont.FromName("HelveticaNeue", 18.0f), UILineBreakMode.WordWrap, UITextAlignment.Center);
+			context.RestoreState();
+		}
+	}
 }


1162: remove unused field

1162: remove unused field

--- a_mini/projects/PixelFarm/MiniAgg/04_Scanline/0_ScanlineSpan.cs
+++ a_mini/projects/PixelFarm/MiniAgg/04_Scanline/0_ScanlineSpan.cs
@@ -37,21 +37,19 @@
     {
         public readonly short x;
         public short len; //+ or -
-        public readonly short cover_index;
-        public bool isDownHill;
+        public readonly short cover_index;
         public ScanlineSpan(int x, int cover_index)
         {
             this.x = (short)x;
             this.len = 1;
             this.cover_index = (short)cover_index;
-            this.isDownHill = false;
+
         }
         public ScanlineSpan(int x, int len, int cover_index)
         {
             this.x = (short)x;
             this.len = (short)len;
             this.cover_index = (short)cover_index;
-            this.isDownHill = false;
         }
 #if DEBUG
         public override string ToString()


All the datastore methods (#353)

All the datastore methods (#353)

--- apis/Google.Datastore.V1/Google.Datastore.V1/DatastoreClient.cs
+++ apis/Google.Datastore.V1/Google.Datastore.V1/DatastoreClient.cs
@@ -66,6 +66,7 @@
         {
             GaxPreconditions.CheckNotNull(existing, nameof(existing));
             LookupSettings = existing.LookupSettings?.Clone();
+            RunQuerySettings = existing.RunQuerySettings?.Clone();
             BeginTransactionSettings = existing.BeginTransactionSettings?.Clone();
             CommitSettings = existing.CommitSettings?.Clone();
             RollbackSettings = existing.RollbackSettings?.Clone();
@@ -169,6 +170,39 @@

         /// <summary>
         /// <see cref="CallSettings"/> for synchronous and asynchronous calls to
+        /// <see cref="DatastoreClient.RunQuery"/> and <see cref="DatastoreClient.RunQueryAsync"/>.
+        /// </summary>
+        /// <remarks>
+        /// The default <see cref="DatastoreClient.RunQuery"/> and
+        /// <see cref="DatastoreClient.RunQueryAsync"/> <see cref="RetrySettings"/> are:
+        /// <list type="bullet">
+        /// <item><description>Initial retry delay: 100 milliseconds</description></item>
+        /// <item><description>Retry delay multiplier: 1.3</description></item>
+        /// <item><description>Retry maximum delay: 60000 milliseconds</description></item>
+        /// <item><description>Initial timeout: 60000 milliseconds</description></item>
+        /// <item><description>Timeout multiplier: 1.0</description></item>
+        /// <item><description>Timeout maximum delay: 60000 milliseconds</description></item>
+        /// </list>
+        /// Retry will be attempted on the following response status codes:
+        /// <list>
+        /// <item><description><see cref="StatusCode.DeadlineExceeded"/></description></item>
+        /// <item><description><see cref="StatusCode.Unavailable"/></description></item>
+        /// </list>
+        /// Default RPC expiration is 600000 milliseconds.
+        /// </remarks>
+        public CallSettings RunQuerySettings { get; set; } = new CallSettings
+        {
+            Timing = CallTiming.FromRetry(new RetrySettings
+            {
+                RetryBackoff = GetDefaultRetryBackoff(),
+                TimeoutBackoff = GetDefaultTimeoutBackoff(),
+                RetryFilter = IdempotentRetryFilter,
+                TotalExpiration = Expiration.FromTimeout(TimeSpan.FromMilliseconds(600000)),
+            }),
+        };
+
+        /// <summary>
+        /// <see cref="CallSettings"/> for synchronous and asynchronous calls to
         /// <see cref="DatastoreClient.BeginTransaction"/> and <see cref="DatastoreClient.BeginTransactionAsync"/>.
         /// </summary>
         /// <remarks>
@@ -450,6 +484,154 @@
         }

         /// <summary>
+        /// Queries for entities.
+        /// </summary>
+        /// <param name="projectId">The ID of the project against which to make the request.</param>
+        /// <param name="partitionId">
+        /// Entities are partitioned into subsets, identified by a partition ID.
+        /// Queries are scoped to a single partition.
+        /// This partition ID is normalized with the standard default context
+        /// partition ID.
+        /// </param>
+        /// <param name="readOptions">The options for this query.</param>
+        /// <param name="query">The query to run.</param>
+        /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
+        /// <returns>A Task containing the RPC response.</returns>
+        public virtual Task<RunQueryResponse> RunQueryAsync(
+            string projectId,
+            PartitionId partitionId,
+            ReadOptions readOptions,
+            Query query,
+            CallSettings callSettings = null)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <summary>
+        /// Queries for entities.
+        /// </summary>
+        /// <param name="projectId">The ID of the project against which to make the request.</param>
+        /// <param name="partitionId">
+        /// Entities are partitioned into subsets, identified by a partition ID.
+        /// Queries are scoped to a single partition.
+        /// This partition ID is normalized with the standard default context
+        /// partition ID.
+        /// </param>
+        /// <param name="readOptions">The options for this query.</param>
+        /// <param name="query">The query to run.</param>
+        /// <param name="cancellationToken">A <see cref="CancellationToken"/> to use for this RPC.</param>
+        /// <returns>A Task containing the RPC response.</returns>
+        public virtual Task<RunQueryResponse> RunQueryAsync(
+            string projectId,
+            PartitionId partitionId,
+            ReadOptions readOptions,
+            Query query,
+            CancellationToken cancellationToken) => RunQueryAsync(
+                projectId,
+                partitionId,
+                readOptions,
+                query,
+                new CallSettings { CancellationToken = cancellationToken });
+
+        /// <summary>
+        /// Queries for entities.
+        /// </summary>
+        /// <param name="projectId">The ID of the project against which to make the request.</param>
+        /// <param name="partitionId">
+        /// Entities are partitioned into subsets, identified by a partition ID.
+        /// Queries are scoped to a single partition.
+        /// This partition ID is normalized with the standard default context
+        /// partition ID.
+        /// </param>
+        /// <param name="readOptions">The options for this query.</param>
+        /// <param name="query">The query to run.</param>
+        /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
+        /// <returns>The RPC response.</returns>
+        public virtual RunQueryResponse RunQuery(
+            string projectId,
+            PartitionId partitionId,
+            ReadOptions readOptions,
+            Query query,
+            CallSettings callSettings = null)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <summary>
+        /// Queries for entities.
+        /// </summary>
+        /// <param name="projectId">The ID of the project against which to make the request.</param>
+        /// <param name="partitionId">
+        /// Entities are partitioned into subsets, identified by a partition ID.
+        /// Queries are scoped to a single partition.
+        /// This partition ID is normalized with the standard default context
+        /// partition ID.
+        /// </param>
+        /// <param name="readOptions">The options for this query.</param>
+        /// <param name="gqlQuery">The GQL query to run.</param>
+        /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
+        /// <returns>A Task containing the RPC response.</returns>
+        public virtual Task<RunQueryResponse> RunQueryAsync(
+            string projectId,
+            PartitionId partitionId,
+            ReadOptions readOptions,
+            GqlQuery gqlQuery,
+            CallSettings callSettings = null)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <summary>
+        /// Queries for entities.
+        /// </summary>
+        /// <param name="projectId">The ID of the project against which to make the request.</param>
+        /// <param name="partitionId">
+        /// Entities are partitioned into subsets, identified by a partition ID.
+        /// Queries are scoped to a single partition.
+        /// This partition ID is normalized with the standard default context
+        /// partition ID.
+        /// </param>
+        /// <param name="readOptions">The options for this query.</param>
+        /// <param name="gqlQuery">The GQL query to run.</param>
+        /// <param name="cancellationToken">A <see cref="CancellationToken"/> to use for this RPC.</param>
+        /// <returns>A Task containing the RPC response.</returns>
+        public virtual Task<RunQueryResponse> RunQueryAsync(
+            string projectId,
+            PartitionId partitionId,
+            ReadOptions readOptions,
+            GqlQuery gqlQuery,
+            CancellationToken cancellationToken) => RunQueryAsync(
+                projectId,
+                partitionId,
+                readOptions,
+                gqlQuery,
+                new CallSettings { CancellationToken = cancellationToken });
+
+        /// <summary>
+        /// Queries for entities.
+        /// </summary>
+        /// <param name="projectId">The ID of the project against which to make the request.</param>
+        /// <param name="partitionId">
+        /// Entities are partitioned into subsets, identified by a partition ID.
+        /// Queries are scoped to a single partition.
+        /// This partition ID is normalized with the standard default context
+        /// partition ID.
+        /// </param>
+        /// <param name="readOptions">The options for this query.</param>
+        /// <param name="gqlQuery">The GQL query to run.</param>
+        /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
+        /// <returns>The RPC response.</returns>
+        public virtual RunQueryResponse RunQuery(
+            string projectId,
+            PartitionId partitionId,
+            ReadOptions readOptions,
+            GqlQuery gqlQuery,
+            CallSettings callSettings = null)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <summary>
         /// Begins a new transaction.
         /// </summary>
         /// <param name="projectId">The ID of the project against which to make the request.</param>
@@ -604,6 +786,103 @@
         }

         /// <summary>
+        /// Commits a transaction, optionally creating, deleting or modifying some
+        /// entities.
+        /// </summary>
+        /// <param name="projectId">The ID of the project against which to make the request.</param>
+        /// <param name="mode">The type of commit to perform. Defaults to `TRANSACTIONAL`.</param>
+        /// <param name="mutations">
+        /// The mutations to perform.
+        ///
+        /// When mode is `TRANSACTIONAL`, mutations affecting a single entity are
+        /// applied in order. The following sequences of mutations affecting a single
+        /// entity are not permitted in a single `Commit` request:
+        ///
+        /// - `insert` followed by `insert`
+        /// - `update` followed by `insert`
+        /// - `upsert` followed by `insert`
+        /// - `delete` followed by `update`
+        ///
+        /// When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
+        /// entity.
+        /// </param>
+        /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
+        /// <returns>A Task containing the RPC response.</returns>
+        public virtual Task<CommitResponse> CommitAsync(
+            string projectId,
+            CommitRequest.Types.Mode mode,
+            IEnumerable<Mutation> mutations,
+            CallSettings callSettings = null)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <summary>
+        /// Commits a transaction, optionally creating, deleting or modifying some
+        /// entities.
+        /// </summary>
+        /// <param name="projectId">The ID of the project against which to make the request.</param>
+        /// <param name="mode">The type of commit to perform. Defaults to `TRANSACTIONAL`.</param>
+        /// <param name="mutations">
+        /// The mutations to perform.
+        ///
+        /// When mode is `TRANSACTIONAL`, mutations affecting a single entity are
+        /// applied in order. The following sequences of mutations affecting a single
+        /// entity are not permitted in a single `Commit` request:
+        ///
+        /// - `insert` followed by `insert`
+        /// - `update` followed by `insert`
+        /// - `upsert` followed by `insert`
+        /// - `delete` followed by `update`
+        ///
+        /// When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
+        /// entity.
+        /// </param>
+        /// <param name="cancellationToken">A <see cref="CancellationToken"/> to use for this RPC.</param>
+        /// <returns>A Task containing the RPC response.</returns>
+        public virtual Task<CommitResponse> CommitAsync(
+            string projectId,
+            CommitRequest.Types.Mode mode,
+            IEnumerable<Mutation> mutations,
+            CancellationToken cancellationToken) => CommitAsync(
+                projectId,
+                mode,
+                mutations,
+                new CallSettings { CancellationToken = cancellationToken });
+
+        /// <summary>
+        /// Commits a transaction, optionally creating, deleting or modifying some
+        /// entities.
+        /// </summary>
+        /// <param name="projectId">The ID of the project against which to make the request.</param>
+        /// <param name="mode">The type of commit to perform. Defaults to `TRANSACTIONAL`.</param>
+        /// <param name="mutations">
+        /// The mutations to perform.
+        ///
+        /// When mode is `TRANSACTIONAL`, mutations affecting a single entity are
+        /// applied in order. The following sequences of mutations affecting a single
+        /// entity are not permitted in a single `Commit` request:
+        ///
+        /// - `insert` followed by `insert`
+        /// - `update` followed by `insert`
+        /// - `upsert` followed by `insert`
+        /// - `delete` followed by `update`
+        ///
+        /// When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
+        /// entity.
+        /// </param>
+        /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
+        /// <returns>The RPC response.</returns>
+        public virtual CommitResponse Commit(
+            string projectId,
+            CommitRequest.Types.Mode mode,
+            IEnumerable<Mutation> mutations,
+            CallSettings callSettings = null)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <summary>
         /// Rolls back a transaction.
         /// </summary>
         /// <param name="projectId">The ID of the project against which to make the request.</param>
@@ -720,6 +999,7 @@
     {
         private readonly ClientHelper _clientHelper;
         private readonly ApiCall<LookupRequest, LookupResponse> _callLookup;
+        private readonly ApiCall<RunQueryRequest, RunQueryResponse> _callRunQuery;
         private readonly ApiCall<BeginTransactionRequest, BeginTransactionResponse> _callBeginTransaction;
         private readonly ApiCall<CommitRequest, CommitResponse> _callCommit;
         private readonly ApiCall<RollbackRequest, RollbackResponse> _callRollback;
@@ -732,6 +1012,8 @@
             _clientHelper = new ClientHelper(effectiveSettings);
             _callLookup = _clientHelper.BuildApiCall<LookupRequest, LookupResponse>(
                 GrpcClient.LookupAsync, GrpcClient.Lookup, effectiveSettings.LookupSettings);
+            _callRunQuery = _clientHelper.BuildApiCall<RunQueryRequest, RunQueryResponse>(
+                GrpcClient.RunQueryAsync, GrpcClient.RunQuery, effectiveSettings.RunQuerySettings);
             _callBeginTransaction = _clientHelper.BuildApiCall<BeginTransactionRequest, BeginTransactionResponse>(
                 GrpcClient.BeginTransactionAsync, GrpcClient.BeginTransaction, effectiveSettings.BeginTransactionSettings);
             _callCommit = _clientHelper.BuildApiCall<CommitRequest, CommitResponse>(
@@ -787,6 +1069,122 @@
                 callSettings);

         /// <summary>
+        /// Queries for entities.
+        /// </summary>
+        /// <param name="projectId">The ID of the project against which to make the request.</param>
+        /// <param name="partitionId">
+        /// Entities are partitioned into subsets, identified by a partition ID.
+        /// Queries are scoped to a single partition.
+        /// This partition ID is normalized with the standard default context
+        /// partition ID.
+        /// </param>
+        /// <param name="readOptions">The options for this query.</param>
+        /// <param name="query">The query to run.</param>
+        /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
+        /// <returns>A Task containing the RPC response.</returns>
+        public override Task<RunQueryResponse> RunQueryAsync(
+            string projectId,
+            PartitionId partitionId,
+            ReadOptions readOptions,
+            Query query,
+            CallSettings callSettings = null) => _callRunQuery.Async(
+                new RunQueryRequest
+                {
+                    ProjectId = projectId,
+                    PartitionId = partitionId,
+                    ReadOptions = readOptions,
+                    Query = query,
+                },
+                callSettings);
+
+        /// <summary>
+        /// Queries for entities.
+        /// </summary>
+        /// <param name="projectId">The ID of the project against which to make the request.</param>
+        /// <param name="partitionId">
+        /// Entities are partitioned into subsets, identified by a partition ID.
+        /// Queries are scoped to a single partition.
+        /// This partition ID is normalized with the standard default context
+        /// partition ID.
+        /// </param>
+        /// <param name="readOptions">The options for this query.</param>
+        /// <param name="query">The query to run.</param>
+        /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
+        /// <returns>The RPC response.</returns>
+        public override RunQueryResponse RunQuery(
+            string projectId,
+            PartitionId partitionId,
+            ReadOptions readOptions,
+            Query query,
+            CallSettings callSettings = null) => _callRunQuery.Sync(
+                new RunQueryRequest
+                {
+                    ProjectId = projectId,
+                    PartitionId = partitionId,
+                    ReadOptions = readOptions,
+                    Query = query,
+                },
+                callSettings);
+
+        /// <summary>
+        /// Queries for entities.
+        /// </summary>
+        /// <param name="projectId">The ID of the project against which to make the request.</param>
+        /// <param name="partitionId">
+        /// Entities are partitioned into subsets, identified by a partition ID.
+        /// Queries are scoped to a single partition.
+        /// This partition ID is normalized with the standard default context
+        /// partition ID.
+        /// </param>
+        /// <param name="readOptions">The options for this query.</param>
+        /// <param name="gqlQuery">The GQL query to run.</param>
+        /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
+        /// <returns>A Task containing the RPC response.</returns>
+        public override Task<RunQueryResponse> RunQueryAsync(
+            string projectId,
+            PartitionId partitionId,
+            ReadOptions readOptions,
+            GqlQuery gqlQuery,
+            CallSettings callSettings = null) => _callRunQuery.Async(
+                new RunQueryRequest
+                {
+                    ProjectId = projectId,
+                    PartitionId = partitionId,
+                    ReadOptions = readOptions,
+                    GqlQuery = gqlQuery,
+                },
+                callSettings);
+
+        /// <summary>
+        /// Queries for entities.
+        /// </summary>
+        /// <param name="projectId">The ID of the project against which to make the request.</param>
+        /// <param name="partitionId">
+        /// Entities are partitioned into subsets, identified by a partition ID.
+        /// Queries are scoped to a single partition.
+        /// This partition ID is normalized with the standard default context
+        /// partition ID.
+        /// </param>
+        /// <param name="readOptions">The options for this query.</param>
+        /// <param name="gqlQuery">The GQL query to run.</param>
+        /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
+        /// <returns>The RPC response.</returns>
+        public override RunQueryResponse RunQuery(
+            string projectId,
+            PartitionId partitionId,
+            ReadOptions readOptions,
+            GqlQuery gqlQuery,
+            CallSettings callSettings = null) => _callRunQuery.Sync(
+                new RunQueryRequest
+                {
+                    ProjectId = projectId,
+                    PartitionId = partitionId,
+                    ReadOptions = readOptions,
+                    GqlQuery = gqlQuery,
+                },
+                callSettings);
+
+        /// <summary>
         /// Begins a new transaction.
         /// </summary>
         /// <param name="projectId">The ID of the project against which to make the request.</param>
@@ -903,6 +1301,78 @@
                 callSettings);

         /// <summary>
+        /// Commits a transaction, optionally creating, deleting or modifying some
+        /// entities.
+        /// </summary>
+        /// <param name="projectId">The ID of the project against which to make the request.</param>
+        /// <param name="mode">The type of commit to perform. Defaults to `TRANSACTIONAL`.</param>
+        /// <param name="mutations">
+        /// The mutations to perform.
+        ///
+        /// When mode is `TRANSACTIONAL`, mutations affecting a single entity are
+        /// applied in order. The following sequences of mutations affecting a single
+        /// entity are not permitted in a single `Commit` request:
+        ///
+        /// - `insert` followed by `insert`
+        /// - `update` followed by `insert`
+        /// - `upsert` followed by `insert`
+        /// - `delete` followed by `update`
+        ///
+        /// When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
+        /// entity.
+        /// </param>
+        /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
+        /// <returns>A Task containing the RPC response.</returns>
+        public override Task<CommitResponse> CommitAsync(
+            string projectId,
+            CommitRequest.Types.Mode mode,
+            IEnumerable<Mutation> mutations,
+            CallSettings callSettings = null) => _callCommit.Async(
+                new CommitRequest
+                {
+                    ProjectId = projectId,
+                    Mode = mode,
+                    Mutations = { mutations },
+                },
+                callSettings);
+
+        /// <summary>
+        /// Commits a transaction, optionally creating, deleting or modifying some
+        /// entities.
+        /// </summary>
+        /// <param name="projectId">The ID of the project against which to make the request.</param>
+        /// <param name="mode">The type of commit to perform. Defaults to `TRANSACTIONAL`.</param>
+        /// <param name="mutations">
+        /// The mutations to perform.
+        ///
+        /// When mode is `TRANSACTIONAL`, mutations affecting a single entity are
+        /// applied in order. The following sequences of mutations affecting a single
+        /// entity are not permitted in a single `Commit` request:
+        ///
+        /// - `insert` followed by `insert`
+        /// - `update` followed by `insert`
+        /// - `upsert` followed by `insert`
+        /// - `delete` followed by `update`
+        ///
+        /// When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single
+        /// entity.
+        /// </param>
+        /// <param name="callSettings">If not null, applies overrides to this RPC call.</param>
+        /// <returns>The RPC response.</returns>
+        public override CommitResponse Commit(
+            string projectId,
+            CommitRequest.Types.Mode mode,
+            IEnumerable<Mutation> mutations,
+            CallSettings callSettings = null) => _callCommit.Sync(
+                new CommitRequest
+                {
+                    ProjectId = projectId,
+                    Mode = mode,
+                    Mutations = { mutations },
+                },
+                callSettings);
+
+        /// <summary>
         /// Rolls back a transaction.
         /// </summary>
         /// <param name="projectId">The ID of the project against which to make the request.</param>


Fix directory discovery on 32bit systems failed

--- RegulatedNoise/Form1.cs
+++ RegulatedNoise/Form1.cs
@@ -324,8 +324,18 @@
             string[] autoSearchdir = { Environment.GetEnvironmentVariable("ProgramW6432"),
                                              Environment.GetEnvironmentVariable("PROGRAMFILES(X86)") };

-            var returnValue = (from directory in autoSearchdir from dir in Directory.GetDirectories(directory) where Path.GetFileName(dir) == "Frontier" select Path.Combine(dir, "EDLaunch", "Products") into p select Directory.Exists(p) ? p : null).FirstOrDefault();
-
+            string returnValue = null;
+            foreach (var directory in autoSearchdir)
+            {
+                if (directory == null) continue;
+                foreach (var dir in Directory.GetDirectories(directory))
+                {
+                    if (Path.GetFileName(dir) != "Frontier") continue;
+                    var p = Path.Combine(dir, "EDLaunch", "Products");
+                    returnValue = Directory.Exists(p) ? p : null;
+                    break;
+                }
+            }
             if (returnValue != null) return returnValue;

             if(Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Frontier_Developments\Products\"))


Fixed a possible null reference exception on parameters when ToString was being called on the value; Code cleanup;

--- RestSharp/RestClient.cs
+++ RestSharp/RestClient.cs
@@ -66,8 +66,7 @@
         /// Sets the BaseUrl property for requests made by this client instance
         /// </summary>
         /// <param name="baseUrl"></param>
-        public RestClient(string baseUrl)
-            : this()
+        public RestClient(string baseUrl) : this()
         {
             BaseUrl = baseUrl;
         }
@@ -130,6 +129,9 @@
         /// <returns>IDeserializer instance</returns>
         private IDeserializer GetHandler(string contentType)
         {
+            if (contentType == null)
+                throw new ArgumentNullException("contentType");
+
             if (string.IsNullOrEmpty(contentType) && ContentHandlers.ContainsKey("*"))
             {
                 return ContentHandlers["*"];
@@ -391,7 +393,7 @@
                 select new HttpHeader
                 {
                     Name = p.Name,
-                    Value = p.Value.ToString()
+                    Value = Convert.ToString(p.Value)
                 };

             foreach (var header in headers)
@@ -404,7 +406,7 @@
                 select new HttpCookie
                 {
                     Name = p.Name,
-                    Value = p.Value.ToString()
+                    Value = Convert.ToString(p.Value)
                 };

             foreach (var cookie in cookies)
@@ -418,7 +420,7 @@
                 select new HttpParameter
                 {
                     Name = p.Name,
-                    Value = p.Value.ToString()
+                    Value = Convert.ToString(p.Value)
                 };

             foreach (var parameter in @params)
@@ -451,17 +453,18 @@
                 if (!http.Files.Any())
                 {
                     object val = body.Value;
+
                     if (val is byte[])
                         http.RequestBodyBytes = (byte[]) val;
                     else
-                        http.RequestBody = body.Value.ToString();
+                        http.RequestBody = Convert.ToString(body.Value);
                 }
                 else
                 {
                     http.Parameters.Add(new HttpParameter
                     {
                         Name = body.Name,
-                        Value = body.Value.ToString()
+                        Value = Convert.ToString(body.Value)
                     });
                 }
             }
@@ -482,20 +485,22 @@

         private RestResponse ConvertToRestResponse(IRestRequest request, HttpResponse httpResponse)
         {
-            var restResponse = new RestResponse();
-            restResponse.Content = httpResponse.Content;
-            restResponse.ContentEncoding = httpResponse.ContentEncoding;
-            restResponse.ContentLength = httpResponse.ContentLength;
-            restResponse.ContentType = httpResponse.ContentType;
-            restResponse.ErrorException = httpResponse.ErrorException;
-            restResponse.ErrorMessage = httpResponse.ErrorMessage;
-            restResponse.RawBytes = httpResponse.RawBytes;
-            restResponse.ResponseStatus = httpResponse.ResponseStatus;
-            restResponse.ResponseUri = httpResponse.ResponseUri;
-            restResponse.Server = httpResponse.Server;
-            restResponse.StatusCode = httpResponse.StatusCode;
-            restResponse.StatusDescription = httpResponse.StatusDescription;
-            restResponse.Request = request;
+            var restResponse = new RestResponse
+            {
+                Content = httpResponse.Content,
+                ContentEncoding = httpResponse.ContentEncoding,
+                ContentLength = httpResponse.ContentLength,
+                ContentType = httpResponse.ContentType,
+                ErrorException = httpResponse.ErrorException,
+                ErrorMessage = httpResponse.ErrorMessage,
+                RawBytes = httpResponse.RawBytes,
+                ResponseStatus = httpResponse.ResponseStatus,
+                ResponseUri = httpResponse.ResponseUri,
+                Server = httpResponse.Server,
+                StatusCode = httpResponse.StatusCode,
+                StatusDescription = httpResponse.StatusDescription,
+                Request = request
+            };

             foreach (var header in httpResponse.Headers)
             {
@@ -547,6 +552,7 @@
                 if (response.ErrorException == null)
                 {
                     IDeserializer handler = GetHandler(raw.ContentType);
+
                     // Only continue if there is a handler defined else there is no way to deserialize the data.
                     // This can happen when a request returns for example a 404 page instead of the requested JSON/XML resource
                     if (handler != null)


Fixes #976

Fixes #976

--- RestSharp/RestClient.cs
+++ RestSharp/RestClient.cs
@@ -222,7 +222,9 @@

             if (contentType == "*" || IsWildcardStructuredSuffixSyntax(contentType)) return;

-            AcceptTypes.Add(contentType);
+            if (!AcceptTypes.Contains(contentType))
+                AcceptTypes.Add(contentType);
+
             // add Accept header based on registered deserializers
             var accepts = string.Join(", ", AcceptTypes.ToArray());


Add remove message to server console

Add remove message to server console

--- Server/ClientHandler.cs
+++ Server/ClientHandler.cs
@@ -745,6 +745,7 @@
                 string vesselID = mr.Read<string>();
                 if (File.Exists(Path.Combine(Server.universeDirectory, "Vessels", vesselID + ".txt")))
                 {
+                    DarkLog.Debug("Removing vessel " + vesselID + " from " + client.playerName);
                     File.Delete(Path.Combine(Server.universeDirectory, "Vessels", vesselID + ".txt"));
                     //Relay the message.
                 }


Added method to get all connected clients

changed some method access modifiers

--- Server/Forms/FrmMain.cs
+++ Server/Forms/FrmMain.cs
@@ -293,7 +293,7 @@
             {
             }
         }
-
+
         public void SetClientStatus(Client c, string text)
         {
             try
@@ -326,7 +326,7 @@
             }
         }

-        public ListViewItem GetListviewItemOfClient(Client c)
+        private ListViewItem GetListviewItemOfClient(Client c)
         {
             ListViewItem itemClient = null;

@@ -339,7 +339,7 @@
             return itemClient;
         }

-        public Client[] GetSelectedClients()
+        private Client[] GetSelectedClients()
         {
             List<Client> clients = new List<Client>();

@@ -352,6 +352,25 @@
                         lstClients.SelectedItems.Cast<ListViewItem>()
                             .Where(lvi => lvi != null && (lvi.Tag as Client) != null)
                             .Select(lvi => (Client) lvi.Tag));
+                }
+            });
+
+            return clients.ToArray();
+        }
+
+        private Client[] GetAllClients()
+        {
+            List<Client> clients = new List<Client>();
+
+            lstClients.Invoke((MethodInvoker)delegate
+            {
+                lock (_lockClients)
+                {
+                    if (lstClients.Items.Count == 0) return;
+                    clients.AddRange(
+                        lstClients.Items.Cast<ListViewItem>()
+                            .Where(lvi => lvi != null && (lvi.Tag as Client) != null)
+                            .Select(lvi => (Client)lvi.Tag));
                 }
             });


Colored shadow was wired up in wrong place.

--- Shaders/RhinoFullNxt.cs
+++ Shaders/RhinoFullNxt.cs
@@ -188,7 +188,7 @@

 			var weight_diffuse_amount_by_transparency_inv83 = new MathNode("weight_diffuse_amount_by_transparency_inv");
 			weight_diffuse_amount_by_transparency_inv83.ins.Value1.Value = part.DiffuseTexture.Amount;
-			weight_diffuse_amount_by_transparency_inv83.ins.Value2.Value = 1f;
+			weight_diffuse_amount_by_transparency_inv83.ins.Value2.Value = 0.08f;
 			weight_diffuse_amount_by_transparency_inv83.Operation = MathNode.Operations.Multiply;
 			weight_diffuse_amount_by_transparency_inv83.UseClamp = false;

@@ -290,43 +290,10 @@
 			reflection_factor117.ins.Image.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f);

 			var attenuate_shine_bsdf129 = new MixClosureNode("attenuate_shine_bsdf");
-			attenuate_shine_bsdf129.ins.Fac.Value = part.Shine;
+			attenuate_shine_bsdf129.ins.Fac.Value = 0.2f;

 			var diffuse_plus_glossy112 = new MixClosureNode("diffuse_plus_glossy");
 			diffuse_plus_glossy112.ins.Fac.Value = 0f;
-
-			var invert_roughness93 = new MathNode("invert_roughness");
-			invert_roughness93.ins.Value1.Value = 1f;
-			invert_roughness93.ins.Value2.Value = part.RefractionRoughnessPow2;
-			invert_roughness93.Operation = MathNode.Operations.Subtract;
-			invert_roughness93.UseClamp = false;
-
-			var multiply_transparency94 = new MathNode("multiply_transparency");
-			multiply_transparency94.ins.Value1.Value = 1f;
-			multiply_transparency94.ins.Value2.Value = part.Transparency;
-			multiply_transparency94.Operation = MathNode.Operations.Multiply;
-			multiply_transparency94.UseClamp = false;
-
-			var light_path91 = new LightPathNode("light_path");
-
-			var multiply_with_shadowray95 = new MathNode("multiply_with_shadowray");
-			multiply_with_shadowray95.ins.Value1.Value = 0f;
-			multiply_with_shadowray95.ins.Value2.Value = 0f;
-			multiply_with_shadowray95.Operation = MathNode.Operations.Multiply;
-			multiply_with_shadowray95.UseClamp = false;
-
-			var layer_weight97 = new LayerWeightNode("layer_weight");
-			layer_weight97.ins.Blend.Value = 0.89f;
-			layer_weight97.ins.Normal.Value = new ccl.float4(0f, 0f, 0f, 1f);
-
-			var coloured_shadow_trans_color92 = new TransparentBsdfNode("coloured_shadow_trans_color");
-			coloured_shadow_trans_color92.ins.Color.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f);
-
-			var weight_for_shadowray_coloured_shadow96 = new MathNode("weight_for_shadowray_coloured_shadow");
-			weight_for_shadowray_coloured_shadow96.ins.Value1.Value = 0f;
-			weight_for_shadowray_coloured_shadow96.ins.Value2.Value = 0f;
-			weight_for_shadowray_coloured_shadow96.Operation = MathNode.Operations.Multiply;
-			weight_for_shadowray_coloured_shadow96.UseClamp = false;

 			var attennuated_refraction_color111 = new MixNode("attennuated_refraction_color");
 			attennuated_refraction_color111.ins.Color1.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f);
@@ -334,9 +301,6 @@
 			attennuated_refraction_color111.ins.Fac.Value = part.Transparency;
 			attennuated_refraction_color111.BlendType = ccl.ShaderNodes.MixNode.BlendTypes.Mix;
 			attennuated_refraction_color111.UseClamp = false;
-
-			var coloured_shadow_mix98 = new MixClosureNode("coloured_shadow_mix");
-			coloured_shadow_mix98.ins.Fac.Value = 0f;

 			var refraction89 = new RefractionBsdfNode("refraction");
 			refraction89.ins.Color.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f);
@@ -388,6 +352,38 @@
 			diffuse103.ins.Roughness.Value = 0f;
 			diffuse103.ins.Normal.Value = new ccl.float4(0f, 0f, 0f, 1f);

+			var invert_roughness93 = new MathNode("invert_roughness");
+			invert_roughness93.ins.Value1.Value = 1f;
+			invert_roughness93.ins.Value2.Value = part.RefractionRoughnessPow2;
+			invert_roughness93.Operation = MathNode.Operations.Subtract;
+			invert_roughness93.UseClamp = false;
+
+			var multiply_transparency94 = new MathNode("multiply_transparency");
+			multiply_transparency94.ins.Value1.Value = 1f;
+			multiply_transparency94.ins.Value2.Value = part.Transparency;
+			multiply_transparency94.Operation = MathNode.Operations.Multiply;
+			multiply_transparency94.UseClamp = false;
+
+			var light_path91 = new LightPathNode("light_path");
+
+			var multiply_with_shadowray95 = new MathNode("multiply_with_shadowray");
+			multiply_with_shadowray95.ins.Value1.Value = 0.92f;
+			multiply_with_shadowray95.ins.Value2.Value = 0f;
+			multiply_with_shadowray95.Operation = MathNode.Operations.Multiply;
+			multiply_with_shadowray95.UseClamp = false;
+
+			var custom_environment_blend108 = new MixClosureNode("custom_environment_blend");
+			custom_environment_blend108.ins.Fac.Value = part.EnvironmentTexture.Amount;
+
+			var coloured_shadow_trans_color92 = new TransparentBsdfNode("coloured_shadow_trans_color");
+			coloured_shadow_trans_color92.ins.Color.Value = new ccl.float4(0.5019608f, 0.5019608f, 0.5019608f, 1f);
+
+			var weight_for_shadowray_coloured_shadow96 = new MathNode("weight_for_shadowray_coloured_shadow");
+			weight_for_shadowray_coloured_shadow96.ins.Value1.Value = 0f;
+			weight_for_shadowray_coloured_shadow96.ins.Value2.Value = 1f;
+			weight_for_shadowray_coloured_shadow96.Operation = MathNode.Operations.Multiply;
+			weight_for_shadowray_coloured_shadow96.UseClamp = false;
+
 			var transparency_texture62 = new ImageTextureNode("transparency_texture");
 			transparency_texture62.ins.Vector.Value = new ccl.float4(0f, 0f, 0f, 1f);
 			transparency_texture62.Projection = TextureNode.TextureProjection.Flat;
@@ -412,8 +408,8 @@
 			transparency_texture_amount69.Operation = MathNode.Operations.Multiply;
 			transparency_texture_amount69.UseClamp = false;

-			var custom_environment_blend108 = new MixClosureNode("custom_environment_blend");
-			custom_environment_blend108.ins.Fac.Value = part.EnvironmentTexture.Amount;
+			var coloured_shadow_mix98 = new MixClosureNode("coloured_shadow_mix");
+			coloured_shadow_mix98.ins.Fac.Value = 0f;

 			var transparent85 = new TransparentBsdfNode("transparent");
 			transparent85.ins.Color.Value = new ccl.float4(1f, 1f, 1f, 1f);
@@ -465,15 +461,7 @@
 			m_shader.AddNode(reflection_factor117);
 			m_shader.AddNode(attenuate_shine_bsdf129);
 			m_shader.AddNode(diffuse_plus_glossy112);
-			m_shader.AddNode(invert_roughness93);
-			m_shader.AddNode(multiply_transparency94);
-			m_shader.AddNode(light_path91);
-			m_shader.AddNode(multiply_with_shadowray95);
-			m_shader.AddNode(layer_weight97);
-			m_shader.AddNode(coloured_shadow_trans_color92);
-			m_shader.AddNode(weight_for_shadowray_coloured_shadow96);
 			m_shader.AddNode(attennuated_refraction_color111);
-			m_shader.AddNode(coloured_shadow_mix98);
 			m_shader.AddNode(refraction89);
 			m_shader.AddNode(add128);
 			m_shader.AddNode(blend_in_transparency88);
@@ -484,11 +472,18 @@
 			m_shader.AddNode(attenuated_environment_color107);
 			m_shader.AddNode(diffuse_glossy_and_refraction113);
 			m_shader.AddNode(diffuse103);
+			m_shader.AddNode(invert_roughness93);
+			m_shader.AddNode(multiply_transparency94);
+			m_shader.AddNode(light_path91);
+			m_shader.AddNode(multiply_with_shadowray95);
+			m_shader.AddNode(custom_environment_blend108);
+			m_shader.AddNode(coloured_shadow_trans_color92);
+			m_shader.AddNode(weight_for_shadowray_coloured_shadow96);
 			m_shader.AddNode(transparency_texture62);
 			m_shader.AddNode(transpluminance63);
 			m_shader.AddNode(invert_luminence64);
 			m_shader.AddNode(transparency_texture_amount69);
-			m_shader.AddNode(custom_environment_blend108);
+			m_shader.AddNode(coloured_shadow_mix98);
 			m_shader.AddNode(transparent85);
 			m_shader.AddNode(toggle_transparency_texture66);
 			m_shader.AddNode(custom_alpha_cutter90);
@@ -542,20 +537,11 @@
 			shadeless100.outs.Closure.Connect(diffuse_plus_glossy112.ins.Closure1);
 			glossy101.outs.BSDF.Connect(diffuse_plus_glossy112.ins.Closure2);
 			reflection_factor117.outs.R.Connect(diffuse_plus_glossy112.ins.Fac);
-			invert_roughness93.outs.Value.Connect(multiply_transparency94.ins.Value1);
-			multiply_transparency94.outs.Value.Connect(multiply_with_shadowray95.ins.Value1);
-			light_path91.outs.IsShadowRay.Connect(multiply_with_shadowray95.ins.Value2);
-			final_base_color79.outs.Image.Connect(coloured_shadow_trans_color92.ins.Color);
-			multiply_with_shadowray95.outs.Value.Connect(weight_for_shadowray_coloured_shadow96.ins.Value1);
-			layer_weight97.outs.Facing.Connect(weight_for_shadowray_coloured_shadow96.ins.Value2);
-			shadeless100.outs.Closure.Connect(coloured_shadow_mix98.ins.Closure1);
-			coloured_shadow_trans_color92.outs.BSDF.Connect(coloured_shadow_mix98.ins.Closure2);
-			weight_for_shadowray_coloured_shadow96.outs.Value.Connect(coloured_shadow_mix98.ins.Fac);
 			attennuated_refraction_color111.outs.Color.Connect(refraction89.ins.Color);
 			bump70.outs.Normal.Connect(refraction89.ins.Normal);
 			attenuate_shine_bsdf129.outs.Closure.Connect(add128.ins.Closure1);
 			diffuse_plus_glossy112.outs.Closure.Connect(add128.ins.Closure2);
-			coloured_shadow_mix98.outs.Closure.Connect(blend_in_transparency88.ins.Closure1);
+			shadeless100.outs.Closure.Connect(blend_in_transparency88.ins.Closure1);
 			refraction89.outs.BSDF.Connect(blend_in_transparency88.ins.Closure2);
 			texcoord60.outs.EnvEmap.Connect(separate_xyz105.ins.Vector);
 			separate_xyz105.outs.Y.Connect(multiply106.ins.Value1);
@@ -567,14 +553,22 @@
 			add128.outs.Closure.Connect(diffuse_glossy_and_refraction113.ins.Closure1);
 			blend_in_transparency88.outs.Closure.Connect(diffuse_glossy_and_refraction113.ins.Closure2);
 			attenuated_environment_color107.outs.Color.Connect(diffuse103.ins.Color);
+			invert_roughness93.outs.Value.Connect(multiply_transparency94.ins.Value1);
+			multiply_transparency94.outs.Value.Connect(multiply_with_shadowray95.ins.Value1);
+			light_path91.outs.IsShadowRay.Connect(multiply_with_shadowray95.ins.Value2);
+			diffuse_glossy_and_refraction113.outs.Closure.Connect(custom_environment_blend108.ins.Closure1);
+			diffuse103.outs.BSDF.Connect(custom_environment_blend108.ins.Closure2);
+			final_base_color79.outs.Image.Connect(coloured_shadow_trans_color92.ins.Color);
+			multiply_with_shadowray95.outs.Value.Connect(weight_for_shadowray_coloured_shadow96.ins.Value1);
 			texcoord60.outs.UV.Connect(transparency_texture62.ins.Vector);
 			transparency_texture62.outs.Color.Connect(transpluminance63.ins.Color);
 			transpluminance63.outs.Val.Connect(invert_luminence64.ins.Value2);
 			invert_luminence64.outs.Value.Connect(transparency_texture_amount69.ins.Value1);
-			diffuse_glossy_and_refraction113.outs.Closure.Connect(custom_environment_blend108.ins.Closure1);
-			diffuse103.outs.BSDF.Connect(custom_environment_blend108.ins.Closure2);
+			custom_environment_blend108.outs.Closure.Connect(coloured_shadow_mix98.ins.Closure1);
+			coloured_shadow_trans_color92.outs.BSDF.Connect(coloured_shadow_mix98.ins.Closure2);
+			weight_for_shadowray_coloured_shadow96.outs.Value.Connect(coloured_shadow_mix98.ins.Fac);
 			transparency_texture_amount69.outs.Value.Connect(toggle_transparency_texture66.ins.Value2);
-			custom_environment_blend108.outs.Closure.Connect(custom_alpha_cutter90.ins.Closure1);
+			coloured_shadow_mix98.outs.Closure.Connect(custom_alpha_cutter90.ins.Closure1);
 			transparent85.outs.BSDF.Connect(custom_alpha_cutter90.ins.Closure2);
 			toggle_transparency_texture66.outs.Value.Connect(custom_alpha_cutter90.ins.Fac);


redundant code

redundant code

--- SplatFody/SplatTests.cs
+++ SplatFody/SplatTests.cs
@@ -25,20 +25,7 @@
         afterAssemblyPath = WeaverHelper.Weave(beforeAssemblyPath);
         assembly = Assembly.LoadFile(afterAssemblyPath);

-
-        //var funcDependencyResolver = new FuncDependencyResolver(GetAllServices);
-        Locator.CurrentMutable.Register(() =>
-        {
-            return new FuncLogManager(GetLogger);
-        },typeof (ILogManager));
-    }
-
-    IEnumerable<object> GetAllServices(Type arg1, string arg2)
-    {
-        if (arg1 == typeof (ILogManager))
-        {
-            yield return new FuncLogManager(GetLogger);
-        }
+        Locator.CurrentMutable.Register(() => new FuncLogManager(GetLogger),typeof (ILogManager));
     }

     IFullLogger GetLogger(Type arg)


Exposing UserHandler fields.

Exposing UserHandler fields.

--- SteamBot/UserHandler.cs
+++ SteamBot/UserHandler.cs
@@ -11,11 +11,12 @@
     /// </summary>
     public abstract class UserHandler
     {
-        protected Bot Bot;
-        protected SteamID OtherSID;
+        public Bot Bot { get; private set; }
+        public SteamID OtherSID { get; private set; }
+
         private Task<Inventory> otherInventoryTask;

-        public UserHandler (Bot bot, SteamID sid)
+        public UserHandler(Bot bot, SteamID sid)
         {
             Bot = bot;
             OtherSID = sid;
@@ -39,7 +40,7 @@
         /// </example>
         public void GetOtherInventory()
         {
-            otherInventoryTask = Task.Factory.StartNew(() =>Inventory.FetchInventory(OtherSID, Bot.apiKey));
+            otherInventoryTask = Task.Factory.StartNew(() => Inventory.FetchInventory(OtherSID, Bot.apiKey));
         }

         public Inventory OtherInventory
@@ -61,27 +62,27 @@
         {
             get
             {
-                return Bot.CurrentTrade;
+                return Bot.CurrentTrade;
             }
         }
-
+
         /// <summary>
         /// Gets the log the bot uses for convenience.
         /// </summary>
-        protected Log Log
+        public Log Log
         {
             get { return Bot.log; }
         }
-
+
         /// <summary>
         /// Gets a value indicating whether the other user is admin.
         /// </summary>
         /// <value>
         /// <c>true</c> if the other user is a configured admin; otherwise, <c>false</c>.
         /// </value>
-        protected bool IsAdmin
-        {
-            get { return Bot.Admins.Contains (OtherSID); }
+        public bool IsAdmin
+        {
+            get { return Bot.Admins.Contains(OtherSID); }
         }

         /// <summary>
@@ -98,31 +99,31 @@
         /// <returns>
         /// Whether to accept.
         /// </returns>
-        public abstract bool OnFriendAdd ();
+        public abstract bool OnFriendAdd();

         /// <summary>
         /// Called when the user removes the bot as a friend.
         /// </summary>
-        public abstract void OnFriendRemove ();
+        public abstract void OnFriendRemove();

         /// <summary>
         /// Called whenever a message is sent to the bot.
         /// This is limited to regular and emote messages.
         /// </summary>
-        public abstract void OnMessage (string message, EChatEntryType type);
+        public abstract void OnMessage(string message, EChatEntryType type);

         /// <summary>
         /// Called when the bot is fully logged in.
         /// </summary>
         public abstract void OnLoginCompleted();
-
+
         /// <summary>
         /// Called whenever a user requests a trade.
         /// </summary>
         /// <returns>
         /// Whether to accept the request.
         /// </returns>
-        public abstract bool OnTradeRequest ();
+        public abstract bool OnTradeRequest();

         /// <summary>
         /// Called when a chat message is sent in a chatroom
@@ -157,25 +158,25 @@
         #region Trade events
         // see the various events in SteamTrade.Trade for descriptions of these handlers.

-        public abstract void OnTradeError (string error);
-
-        public abstract void OnTradeTimeout ();
-
-        public abstract void OnTradeSuccess ();
-
-        public virtual void OnTradeClose ()
-        {
-            Bot.log.Warn ("[USERHANDLER] TRADE CLOSED");
-            Bot.CloseTrade ();
-        }
-
-        public abstract void OnTradeInit ();
-
-        public abstract void OnTradeAddItem (Schema.Item schemaItem, Inventory.Item inventoryItem);
-
-        public abstract void OnTradeRemoveItem (Schema.Item schemaItem, Inventory.Item inventoryItem);
-
-        public abstract void OnTradeMessage (string message);
+        public abstract void OnTradeError(string error);
+
+        public abstract void OnTradeTimeout();
+
+        public abstract void OnTradeSuccess();
+
+        public virtual void OnTradeClose()
+        {
+            Bot.log.Warn("[USERHANDLER] TRADE CLOSED");
+            Bot.CloseTrade();
+        }
+
+        public abstract void OnTradeInit();
+
+        public abstract void OnTradeAddItem(Schema.Item schemaItem, Inventory.Item inventoryItem);
+
+        public abstract void OnTradeRemoveItem(Schema.Item schemaItem, Inventory.Item inventoryItem);
+
+        public abstract void OnTradeMessage(string message);

         public void OnTradeReadyHandler(bool ready)
         {
@@ -183,7 +184,7 @@
             OnTradeReady(ready);
         }

-        public abstract void OnTradeReady (bool ready);
+        public abstract void OnTradeReady(bool ready);

         public void OnTradeAcceptHandler()
         {


Updated to match current scenario

Updated to match current scenario

Need to refract this out so this can stop changing!

--- StockFighter/Program.cs
+++ StockFighter/Program.cs
@@ -10,8 +10,8 @@
     {
         static void Main(string[] args)
         {
-            var venue = @"BHKEX";
-            var account = @"WBS48015763";
+            var venue = @"BDBAEX";
+            var account = @"HAB74751055";
             var wrapper = new APIWrapper();

             try


Update Class1.cs

Update Class1.cs

--- SwatSim/units/Class1.cs
+++ SwatSim/units/Class1.cs
@@ -161,7 +161,7 @@
     }
     public class movement
     {
-        public static Point moveCoords(Decimal angle, Point p, Int length)
+        public static Point moveCoords(Decimal angle, Point p, int length)
         {

         }


Added new Create method

Added new Create method

--- Test2d/Data/Database.cs
+++ Test2d/Data/Database.cs
@@ -1,7 +1,9 @@
 // Copyright (c) Wiesław Šoltés. All rights reserved.
 // Licensed under the MIT license. See LICENSE file in the project root for full license information.
 using System;
+using System.Collections.Generic;
 using System.Collections.Immutable;
+using System.Linq;

 namespace Test2d
 {
@@ -103,5 +105,50 @@
                 Records = records
             };
         }
+
+        /// <summary>
+        ///
+        /// </summary>
+        /// <param name="name"></param>
+        /// <param name="fields"></param>
+        /// <returns></returns>
+        public static Database Create(string name, IEnumerable<string[]> fields)
+        {
+            var db = Database.Create(name);
+            var tempColumns = fields.FirstOrDefault().Select(c => Column.Create(c));
+            var columns = ImmutableArray.CreateRange<Column>(tempColumns);
+
+            if (columns.Length >= 1 && columns[0].Name == "Id")
+            {
+                // use existing record Id's
+                var tempRecords = fields
+                    .Skip(1)
+                    .Select(v =>
+                            Record.Create(
+                                v.FirstOrDefault(),
+                                columns,
+                                ImmutableArray.CreateRange<Value>(v.Select(c => Value.Create(c)))));
+                var records = ImmutableArray.CreateRange<Record>(tempRecords);
+
+                db.Columns = columns;
+                db.Records = records;
+            }
+            else
+            {
+                // create records with new Id's
+                var tempRecords = fields
+                    .Skip(1)
+                    .Select(v =>
+                            Record.Create(
+                                columns,
+                                ImmutableArray.CreateRange<Value>(v.Select(c => Value.Create(c)))));
+                var records = ImmutableArray.CreateRange<Record>(tempRecords);
+
+                db.Columns = columns;
+                db.Records = records;
+            }
+
+            return db;
+        }
     }
 }