ClientStarter:繰り返し接続し続ける機能(-e オプション)

ClientStarter:繰り返し接続し続ける機能(-e オプション)

--- ClientStarter/ClientStarter.cs
+++ ClientStarter/ClientStarter.cs
@@ -3,11 +3,14 @@
 using System;
 using System.IO;
 using System.Reflection;
+using System.Threading;

 namespace AIWolf.ClientStarter
 {
     class ClientStarter
     {
+        static AutoResetEvent are = new AutoResetEvent(false);
+
         public static void Main(string[] args)
         {
             string host = null;
@@ -16,6 +19,7 @@
             string dllName = null;
             Role? roleRequest = null;
             string playerName = null;
+            bool eternity = false;

             for (int i = 0; i < args.Length; i++)
             {
@@ -25,6 +29,10 @@
                     {
                         i++;
                         port = int.Parse(args[i]);
+                    }
+                    else if (args[i].Equals("-e"))
+                    {
+                        eternity = true;
                     }
                     else if (args[i].Equals("-h"))
                     {
@@ -95,14 +103,32 @@
             }

             TcpipClient client = new TcpipClient(host, port, roleRequest);
+            client.Completed += Client_Completed;
             if (playerName != null)
             {
                 client.PlayerName = playerName;
             }
-            if (client.Connect(player))
+
+            int turn = 1;
+            do
             {
-                Console.WriteLine("Player connected to server:" + player);
+                if (client.Connect(player))
+                {
+                    Console.WriteLine("{0}:Player connected to server:{1}", turn, player);
+                    are.WaitOne();
+                    turn++;
+                }
+                else
+                {
+                    break;
+                }
             }
+            while (eternity);
+        }
+
+        private static void Client_Completed(object sender, EventArgs e)
+        {
+            are.Set();
         }
     }
 }


Fix read ordering of obfuscation attributes

--- Confuser.Core/ObfAttrMarker.cs
+++ Confuser.Core/ObfAttrMarker.cs
@@ -4,6 +4,7 @@
 using System.IO;
 using System.Linq;
 using System.Text;
+using System.Text.RegularExpressions;
 using Confuser.Core.Project;
 using Confuser.Core.Project.Patterns;
 using dnlib.DotNet;
@@ -123,14 +124,18 @@
 			}
 		}

+		static readonly Regex OrderPattern = new Regex("^(\\d+)\\. (.+)$");
+
 		static IEnumerable<ObfuscationAttributeInfo> ReadObfuscationAttributes(IHasCustomAttribute item) {
-			var ret = new List<ObfuscationAttributeInfo>();
+			var ret = new List<Tuple<int?, ObfuscationAttributeInfo>>();
 			for (int i = item.CustomAttributes.Count - 1; i >= 0; i--) {
 				var ca = item.CustomAttributes[i];
 				if (ca.TypeFullName != "System.Reflection.ObfuscationAttribute")
 					continue;

 				var info = new ObfuscationAttributeInfo();
+				int? order = null;
+
 				info.Owner = item;
 				bool strip = true;
 				foreach (var prop in ca.Properties) {
@@ -153,6 +158,18 @@
 						case "Feature":
 							Debug.Assert(prop.Type.ElementType == ElementType.String);
 							string feature = (UTF8String)prop.Value;
+
+							var match = OrderPattern.Match(feature);
+							if (match.Success) {
+								var orderStr = match.Groups[1].Value;
+								var f = match.Groups[2].Value;
+								int o;
+								if (!int.TryParse(orderStr, out o))
+									throw new NotSupportedException(string.Format("Failed to parse feature '{0}' in {1} ", feature, item));
+								order = o;
+								feature = f;
+							}
+
 							int sepIndex = feature.IndexOf(':');
 							if (sepIndex == -1) {
 								info.FeatureName = "";
@@ -171,10 +188,10 @@
 				if (strip)
 					item.CustomAttributes.RemoveAt(i);

-				ret.Add(info);
+				ret.Add(Tuple.Create(order, info));
 			}
 			ret.Reverse();
-			return ret;
+			return ret.OrderBy(pair => pair.Item1).Select(pair => pair.Item2);
 		}

 		bool ToInfo(ObfuscationAttributeInfo attr, out ProtectionSettingsInfo info) {


Improved dispose resiliance of RamStream

--- Core/Theraot/Core/RAMStream.cs
+++ Core/Theraot/Core/RAMStream.cs
@@ -96,6 +96,7 @@

         public override int Read(byte[] buffer, int offset, int count)
         {
+            var bytes = _bytes;
             if (_position == -1)
             {
                 throw new ObjectDisposedException(typeof(RamStream).Name);
@@ -106,7 +107,7 @@
                 count = (int)(_length - _position);
             }
             var progress = 0;
-            foreach (var node in _bytes.EnumerateRange((int)(_position >> _sectorBits), int.MaxValue))
+            foreach (var node in bytes.EnumerateRange((int)(_position >> _sectorBits), int.MaxValue))
             {
                 var pair = node;
                 long contribution = 0;
@@ -204,6 +205,7 @@

         public override void SetLength(long value)
         {
+            var bytes = _bytes;
             if (_position == -1)
             {
                 throw new ObjectDisposedException(typeof(RamStream).Name);
@@ -217,14 +219,15 @@
                 throw new ArgumentOutOfRangeException("value", "Overflow");
             }
             _length = (int)value;
-            foreach (var node in _bytes.EnumerateRange(int.MaxValue, (int)value >> _sectorBits))
-            {
-                _bytes.RemoveAt((int)(node.Key >> _sectorBits));
+            foreach (var node in bytes.EnumerateRange(int.MaxValue, (int)value >> _sectorBits))
+            {
+                bytes.RemoveAt((int)(node.Key >> _sectorBits));
             }
         }

         public override void Write(byte[] buffer, int offset, int count)
         {
+            var bytes = _bytes;
             if (_position == -1)
             {
                 throw new ObjectDisposedException(typeof(RamStream).Name);
@@ -234,7 +237,7 @@
                 throw new ArgumentException("The sum of offset and count is greater than the buffer length.");
             }
             again:
-            foreach (var node in _bytes.EnumerateRange((int)(_position >> _sectorBits), int.MaxValue))
+            foreach (var node in bytes.EnumerateRange((int)(_position >> _sectorBits), int.MaxValue))
             {
                 var pair = node;
                 long contribution;
@@ -245,7 +248,7 @@
                     contribution = (1 << _sectorBits) > count ? count : 1 << _sectorBits;
                     intContribution = (int)contribution;
                     Array.Copy(buffer, offset, left, 0, intContribution);
-                    if (!Add(left, out pair))
+                    if (!Add(bytes, left, out pair))
                     {
                         break;
                     }
@@ -297,7 +300,7 @@
                 var contribution = diff > count ? count : diff;
                 var intContribution = (int) contribution;
                 Array.Copy(buffer, offset, left, index, intContribution);
-                if (!Add(left, out pair))
+                if (!Add(bytes, left, out pair))
                 {
                     goto again;
                 }
@@ -319,9 +322,9 @@
             base.Dispose(disposing);
         }

-        private bool Add(byte[] left, out KeyValuePair<long, byte[]> previous)
-        {
-            return _bytes.Insert((int)(_position >> _sectorBits), new KeyValuePair<long, byte[]>((_position >> _sectorBits) << _sectorBits, left), out previous);
+        private bool Add(Bucket<KeyValuePair<long, byte[]>> bytes, byte[] left, out KeyValuePair<long, byte[]> previous)
+        {
+            return bytes.Insert((int)(_position >> _sectorBits), new KeyValuePair<long, byte[]>((_position >> _sectorBits) << _sectorBits, left), out previous);
         }
     }
 }


Update AssemblyWithIncludesTest.cs

Update AssemblyWithIncludesTest.cs

--- Tests/AssemblyWithIncludesTest.cs
+++ Tests/AssemblyWithIncludesTest.cs
@@ -1,25 +1,29 @@
 using System.Collections.Generic;
+using System.Reflection;
 using Fody;
 using Xunit;

 public class AssemblyWithIncludesTest
 {
-    [Fact]
-    public void Simple()
+    static Assembly assembly;
+
+    static AssemblyWithIncludesTest()
     {
         var weavingTask = new ModuleWeaver
         {
             IncludeNamespaces = new List<string> { "IncludeNamespace" }
         };
-        var assembly = weavingTask.ExecuteTestRun("AssemblyWithIncludes.dll").Assembly;
-        var excludeType = assembly.GetType("ExcludeNamespace.ExcludeClass");
-        Assert.False(excludeType.GetMethod("Method").IsVirtual);
-        var includeType = assembly.GetType("IncludeNamespace.IncludeClass");
-        Assert.True(includeType.GetMethod("Method").IsVirtual);
+        assembly = weavingTask.ExecuteTestRun("AssemblyWithIncludes.dll",
+            assemblyName: nameof(IntegrationTests)).Assembly;
+    }

-        var inNamespaceButWithAttributeType = assembly.GetType("IncludeNamespace.InNamespaceButWithAttributeClass");
-        Assert.False(inNamespaceButWithAttributeType.GetMethod("Method").IsVirtual);
-        var notInNamespaceButWithAttributeType = assembly.GetType("ExcludeNamespace.NotInNamespaceButWithAttributeClass");
-        Assert.False(notInNamespaceButWithAttributeType.GetMethod("Method").IsVirtual);
+    [Fact]
+    public void Simple()
+    {
+        VirtualTester.EnsureMembersAreNotVirtual("ExcludeNamespace.ExcludeClass", assembly, "Method");
+        VirtualTester.EnsureMembersAreVirtual("IncludeNamespace.IncludeClass", assembly, "Method");
+        VirtualTester.EnsureMembersAreNotVirtual("IncludeNamespace.InNamespaceButWithAttributeClass", assembly, "Method");
+        VirtualTester.EnsureMembersAreNotVirtual("ExcludeNamespace.NotInNamespaceButWithAttributeClass", assembly, "Method");
+    }
     }
 }


Update ProxyServer.cs

Update ProxyServer.cs

--- Titanium.Web.Proxy/ProxyServer.cs
+++ Titanium.Web.Proxy/ProxyServer.cs
@@ -212,7 +212,7 @@

         /// <summary>
         ///     A callback to authenticate clients.
-        ///     Parameters are username & password as provided by client.
+        ///     Parameters are username and password as provided by client.
         ///     Return true for successful authentication.
         /// </summary>
         public Func<string, string, Task<bool>> AuthenticateUserFunc { get; set; }


Fix reflected attribute ordering in tests for Mono build.

https://github.com/davidfowl/MonoBugs/issues/3

--- test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/TagHelperDescriptorFactoryTest.cs
+++ test/Microsoft.AspNet.Razor.Runtime.Test/TagHelpers/TagHelperDescriptorFactoryTest.cs
@@ -191,7 +191,12 @@

             // Assert
             Assert.Empty(errorSink.Errors);
-            Assert.Equal(expectedDescriptors, descriptors.ToArray(), CaseSensitiveTagHelperDescriptorComparer.Default);
+
+            // We don't care about order. Mono returns reflected attributes differently so we need to ensure order
+            // doesn't matter by sorting.
+            descriptors = descriptors.OrderBy(descriptor => descriptor.TagName).ToArray();
+
+            Assert.Equal(expectedDescriptors, descriptors, CaseSensitiveTagHelperDescriptorComparer.Default);
         }

         public static TheoryData HtmlCaseData
@@ -328,7 +333,7 @@

             // Assert
             Assert.Empty(errorSink.Errors);
-            Assert.Equal(expectedDescriptors, descriptors.ToArray(), CaseSensitiveTagHelperDescriptorComparer.Default);
+            Assert.Equal(expectedDescriptors, descriptors, CaseSensitiveTagHelperDescriptorComparer.Default);
         }

         [Fact]
@@ -467,19 +472,19 @@
             var errorSink = new ParserErrorSink();
             var validProp = typeof(MultiTagTagHelper).GetProperty(nameof(MultiTagTagHelper.ValidAttribute));
             var expectedDescriptors = new[] {
+                new TagHelperDescriptor(
+                    "div",
+                    typeof(MultiTagTagHelper).FullName,
+                    AssemblyName,
+                    new[] {
+                        new TagHelperAttributeDescriptor("valid-attribute", validProp)
+                    }),
                 new TagHelperDescriptor(
                     "p",
                     typeof(MultiTagTagHelper).FullName,
                     AssemblyName,
                     new[] {
                         new TagHelperAttributeDescriptor("valid-attribute", validProp)
-                    }),
-                new TagHelperDescriptor(
-                    "div",
-                    typeof(MultiTagTagHelper).FullName,
-                    AssemblyName,
-                    new[] {
-                        new TagHelperAttributeDescriptor("valid-attribute", validProp)
                     })
             };

@@ -491,7 +496,12 @@

             // Assert
             Assert.Empty(errorSink.Errors);
-            Assert.Equal(expectedDescriptors, descriptors.ToArray(), CaseSensitiveTagHelperDescriptorComparer.Default);
+
+            // We don't care about order. Mono returns reflected attributes differently so we need to ensure order
+            // doesn't matter by sorting.
+            descriptors = descriptors.OrderBy(descriptor => descriptor.TagName).ToArray();
+
+            Assert.Equal(expectedDescriptors, descriptors, CaseSensitiveTagHelperDescriptorComparer.Default);
         }

         [Fact]
@@ -527,11 +537,11 @@
             var errorSink = new ParserErrorSink();
             var expectedDescriptors = new[] {
                 new TagHelperDescriptor(
-                    "p",
+                    "div",
                     typeof(DuplicateTagNameTagHelper).FullName,
                     AssemblyName),
                 new TagHelperDescriptor(
-                    "div",
+                    "p",
                     typeof(DuplicateTagNameTagHelper).FullName,
                     AssemblyName)
             };
@@ -544,7 +554,12 @@

             // Assert
             Assert.Empty(errorSink.Errors);
-            Assert.Equal(expectedDescriptors, descriptors.ToArray(), CaseSensitiveTagHelperDescriptorComparer.Default);
+
+            // We don't care about order. Mono returns reflected attributes differently so we need to ensure order
+            // doesn't matter by sorting.
+            descriptors = descriptors.OrderBy(descriptor => descriptor.TagName).ToArray();
+
+            Assert.Equal(expectedDescriptors, descriptors, CaseSensitiveTagHelperDescriptorComparer.Default);
         }

         [Fact]


Fixed an issue (#26) with non-standard camera viewports.

--- TouchScript/Layers/CameraLayer.cs
+++ TouchScript/Layers/CameraLayer.cs
@@ -48,7 +48,8 @@

             if (camera == null) return LayerHitResult.Error;
             if (camera.enabled == false || camera.gameObject.active == false) return LayerHitResult.Miss;
-
+            if (!camera.pixelRect.Contains(position)) return LayerHitResult.Miss;
+
             var ray = camera.ScreenPointToRay(new Vector3(position.x, position.y, camera.nearClipPlane));
             var hits = Physics.RaycastAll(ray, float.PositiveInfinity, layerMask);


minor refactor

minor refactor

--- VersionrUI/Utilities/Utilities.cs
+++ VersionrUI/Utilities/Utilities.cs
@@ -30,18 +30,17 @@
         }
         public static IEnumerable<T> FindVisualChildren<T>(DependencyObject depObj) where T : DependencyObject
         {
-            if (depObj != null)
+            if (depObj == null)
+                yield break;
+            for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++)
             {
-                for (int i = 0; i < VisualTreeHelper.GetChildrenCount(depObj); i++)
-                {
-                    DependencyObject child = VisualTreeHelper.GetChild(depObj, i);
+                DependencyObject child = VisualTreeHelper.GetChild(depObj, i);

-                    if (child != null && child is T)
-                        yield return (T)child;
+                if (child is T variable)
+                    yield return variable;

-                    foreach (T childOfChild in FindVisualChildren<T>(child))
-                        yield return childOfChild;
-                }
+                foreach (T childOfChild in FindVisualChildren<T>(child))
+                    yield return childOfChild;
             }
         }

@@ -122,20 +121,18 @@
                 var found = area.Area.GetPotentionalVersions(versionID);

                 // If not found...
-                if (found == null || !found.Any())
+                if (found != null && found.Any())
+                    return found;
+                MainWindow.Instance.Dispatcher.Invoke(() =>
                 {
-                    MainWindow.Instance.Dispatcher.Invoke(() =>
-                    {
-                        MainWindow.ShowMessage(
-                            "Repo: " + area.Name,
-                            $"Could not find a version with ID: [{versionID}] in this repo");
-                    });
-                    return null;
-                }
+                    MainWindow.ShowMessage(
+                        "Repo: " + area.Name,
+                        $"Could not find a version with ID: [{versionID}] in this repo");
+                });
+                return null;

-                return found;
             }
-            catch (Exception e)
+            catch (Exception)
             {
                 MainWindow.Instance.Dispatcher.Invoke(() =>
                 {


Issue #22 -- Move TabText attributes to actually be on the property vice the field.

--- WinFormsUI/Docking/DockContent.cs
+++ WinFormsUI/Docking/DockContent.cs
@@ -58,17 +58,18 @@
 			set	{	DockHandler.AutoHidePortion = value;	}
 		}

+        private string m_tabText = null;
 		[Localizable(true)]
 		[LocalizedCategory("Category_Docking")]
 		[LocalizedDescription("DockContent_TabText_Description")]
 		[DefaultValue(null)]
-        private string m_tabText = null;
 		public string TabText
 		{
             get { return m_tabText; }
             set { DockHandler.TabText = m_tabText = value; }
 		}
-		private bool ShouldSerializeTabText()
+
+        private bool ShouldSerializeTabText()
 		{
 			return (m_tabText != null);
 		}


Update AtomicService.cs

Update AtomicService.cs

--- Windows/Payloads/AtomicService.cs
+++ Windows/Payloads/AtomicService.cs
@@ -10,7 +10,7 @@
 // sc start AtomicService
 // sc stop AtomicSerivce
 // sc delete AtomicSerivce
-// May requjire Administrator privileges
+// May require Administrator privileges

 namespace AtomicService


Rename local variable

Rename local variable

Rename isHex to isBase64

--- Wyam.Core/Modules/ProcessFiles.cs
+++ Wyam.Core/Modules/ProcessFiles.cs
@@ -91,9 +91,9 @@
         {
             foreach (IDocument input in inputs.AsParallel())
             {
-                bool isHex = input.Get<bool>(MetadataKeys.Base64);
-
-                if (!isHex)
+                bool isBase64 = input.Get<bool>(MetadataKeys.Base64);
+
+                if (!isBase64)
                     continue;

                 var path = input.Get<string>(MetadataKeys.SourceFilePath);


MapRender: Fix crashes when npc is missing.

--- WzComparerR2.MapRender/MapData.cs
+++ WzComparerR2.MapRender/MapData.cs
@@ -563,12 +563,8 @@
                         mobNode = PluginManager.FindWz(path);
                     }

-                    if (mobNode == null)
-                    {
-                        return;
-                    }
-
                     //加载动画
+                    if (mobNode != null)
                     {
                         var aniItem = this.CreateSMAnimator(mobNode, resLoader);
                         if (aniItem != null)
@@ -594,12 +590,8 @@
                         npcNode = PluginManager.FindWz(path);
                     }

-                    if (npcNode == null)
-                    {
-                        return;
-                    }
-
                     //加载动画
+                    if (npcNode != null)
                     {
                         var aniItem = this.CreateSMAnimator(npcNode, resLoader);
                         if (aniItem != null)
@@ -612,6 +604,11 @@
                         }
                     }
                     break;
+            }
+
+            if (life.View == null) //空动画
+            {
+                life.View = new LifeItem.ItemView();
             }
         }


Patcher: fix old file not correctly closed. (fix #160)

--- WzComparerR2/Patcher/WzPatcher.cs
+++ WzComparerR2/Patcher/WzPatcher.cs
@@ -710,6 +710,7 @@
                 msBuffer = null;
                 tempFileStream.Flush();
                 tempFileStream.SetLength(tempFileStream.Position);  //设置文件大小为当前长度
+                closeAllFiles();

                 this.OnVerifyNewChecksumBegin(part);
                 //tempFileStream.Seek(0, SeekOrigin.Begin);
@@ -717,7 +718,6 @@
                 VerifyCheckSum(part.NewChecksum, newCheckSum1, part.FileName, "new");
                 this.OnVerifyNewChecksumEnd(part);

-                tempFileStream.Close();
                 this.OnTempFileClosed(part);
             }
             finally


[Gtk][Windows] Add WebView.CustomCss support

--- Xwt.Gtk.Windows/WebViewBackend.cs
+++ Xwt.Gtk.Windows/WebViewBackend.cs
@@ -26,7 +26,7 @@
 // THE SOFTWARE.

 using System;
-using System.Threading;
+using System.Linq;
 using System.Runtime.InteropServices;
 using SWF = System.Windows.Forms;
 using Xwt.GtkBackend;
@@ -41,6 +41,8 @@
 		string url;
 		Socket socket;
 		bool enableNavigatingEvent, enableLoadingEvent, enableLoadedEvent, enableTitleChangedEvent;
+		SWF.HtmlElement customCssNode;
+		string customCss;

 		[DllImportAttribute("user32.dll", EntryPoint = "SetParent")]
 		internal static extern System.IntPtr SetParent([InAttribute] System.IntPtr hwndChild, [InAttribute] System.IntPtr hwndNewParent);
@@ -119,7 +121,18 @@

 		public bool ContextMenuEnabled { get; set; }

-		public string CustomCss { get; set; }
+		public string CustomCss {
+			get {
+				return customCss;
+			}
+			set {
+				if (customCss != value)
+				{
+					customCss = value;
+					SetCustomCss();
+				}
+			}
+		}

 		public void GoBack ()
 		{
@@ -248,6 +261,7 @@
 				currentDocument = view.Document;
 				view.Document.ContextMenuShowing += HandleContextMenu;
 			}
+			SetCustomCss();

 			if (enableLoadedEvent)
 				ApplicationContext.InvokeUserCode (delegate {
@@ -259,6 +273,40 @@
 		{
 			e.ReturnValue = ContextMenuEnabled;
 		}
+
+		void SetCustomCss ()
+		{
+			var mainDocument = view.Document;
+			var head = mainDocument?.GetElementsByTagName("head")?[0];
+
+			if (head == null)
+			{
+				customCssNode = null;
+				return;
+			}
+
+			// reuse node reference only if the document did not change and still contains the injected node
+			if (customCssNode != null && !head.Children.Cast<SWF.HtmlElement>().Contains(customCssNode))
+				customCssNode = null;
+
+			if (!string.IsNullOrEmpty(CustomCss))
+			{
+				if (customCssNode == null)
+				{
+					customCssNode = mainDocument.CreateElement("style");
+					customCssNode.SetAttribute("type", "text/css");
+					head.InsertAdjacentElement(SWF.HtmlElementInsertionOrientation.AfterBegin, customCssNode);
+				}
+				if (customCssNode.InnerHtml != customCss)
+					customCssNode.InnerHtml = customCss;
+			}
+			else if (customCssNode != null)
+			{
+				if (head.Children.Cast<SWF.HtmlElement>().Contains(customCssNode))
+					customCssNode.OuterHtml = string.Empty;
+				customCssNode = null;
+			}
+		}
 	}
 }


Support map detection

Support map detection

--- Yeena/PathOfExile/PoEItemTable.cs
+++ Yeena/PathOfExile/PoEItemTable.cs
@@ -70,6 +70,10 @@
             return item.HasProperty("Experience");
         }

+        public bool IsMap(PoEItem item) {
+            return item.TypeLine.Contains("Map");
+        }
+
         public bool IsNormal(PoEItem item) {
             return !item.IsRare && !IsMagic(item);
         }


TlsStream.Read fix

TlsStream.Read fix

--- Zergatul/Network/Tls/TlsStream.cs
+++ Zergatul/Network/Tls/TlsStream.cs
@@ -803,7 +803,9 @@

         #endregion

-        private List<byte> _readBuffer = new List<byte>();
+        private byte[] _readBuffer;
+        private int _readBufferOffset;
+        private int _readBufferLength;

         public override void Flush()
         {
@@ -812,23 +814,41 @@

         public override int Read(byte[] buffer, int offset, int count)
         {
-            if (count > _readBuffer.Count && !_isClosed)
+            if (_readBuffer == null)
+            {
+                _readBuffer = new byte[RecordMessageStream.PlaintextLimit];
+                _readBufferOffset = 0;
+                _readBufferLength = 0;
+            }
+
+            if (_readBufferOffset >= _readBufferLength && !_isClosed)
             {
                 var message = _messageStream.ReadMessage();
                 if (message is ApplicationData)
                 {
                     var appData = message as ApplicationData;
-                    _readBuffer.AddRange(appData.Data);
-                }
-                if (message is Alert)
+                    Array.Copy(appData.Data, 0, _readBuffer, 0, appData.Data.Length);
+                    _readBufferOffset = 0;
+                    _readBufferLength = appData.Data.Length;
+                } else if (message is Alert)
                     OnAlert(message as Alert, true);
-            }
-
-            if (count > _readBuffer.Count)
-                count = _readBuffer.Count;
-            for (int i = 0; i < count; i++)
-                buffer[offset + i] = _readBuffer[i];
-            _readBuffer.RemoveRange(0, count);
+                else
+                    throw new InvalidOperationException();
+            }
+
+            if (_readBufferOffset >= _readBufferLength)
+            {
+                _readBufferOffset = 0;
+                _readBufferLength = 0;
+            }
+
+            if (count > _readBufferLength - _readBufferOffset)
+                count = _readBufferLength - _readBufferOffset;
+            if (count == 0)
+                return 0;
+
+            Array.Copy(_readBuffer, _readBufferOffset, buffer, offset, count);
+            _readBufferOffset += count;

             return count;
         }


Make global categories colors are display only

--- DioLive.Cache/src/DioLive.Cache.WebUI/Views/Categories/_GlobalCategoriesPartial.cshtml
+++ DioLive.Cache/src/DioLive.Cache.WebUI/Views/Categories/_GlobalCategoriesPartial.cshtml
@@ -16,6 +16,7 @@

+
             Default name
             @foreach (var culture in cultures)
             {
@@ -28,12 +29,10 @@
         {

+
+
+
                     @category.Name
-

-                        <input type="text" value="name" class="form-control" />
-                        <input type="hidden" value="#@category.Color.ToString("X6")" />
-
-

                 @foreach (var culture in cultures)
                 {


remove debug filter

remove debug filter

--- DesktopSwitch/WindowManager.cs
+++ DesktopSwitch/WindowManager.cs
@@ -60,10 +60,10 @@
         if (IsWindowVisible(hWnd) && string.IsNullOrEmpty(strTitle) == false)
         {
           // debug filter
-          int processId;
-          GetWindowThreadProcessId(hWnd, out processId);
-          if (Process.GetProcessById(processId).ProcessName != "notepad")
-            return true;
+//          int processId;
+//          GetWindowThreadProcessId(hWnd, out processId);
+//          if (Process.GetProcessById(processId).ProcessName != "notepad")
+//            return true;

           ConsoleUi.WriteLine(strTitle);
           collection.Add(hWnd);


Convert JsonTestPath() use in json regression tests to JsonGetPathType() instead

--- OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
+++ OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
@@ -158,8 +158,8 @@

             Assert.That(dsrv, Is.EqualTo(1));

-            int tprv = (int)InvokeOp("JsonTestPath", storeId, "Hello");
-            Assert.That(tprv, Is.EqualTo(0));
+            int tprv = (int)InvokeOp("JsonGetPathType", storeId, "Hello");
+            Assert.That(tprv, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_UNDEF));
         }

         [Test]
@@ -277,8 +277,8 @@
                 int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello");
                 Assert.That(returnValue, Is.EqualTo(1));

-                int result = (int)InvokeOp("JsonTestPath", storeId, "Hello");
-                Assert.That(result, Is.EqualTo(0));
+                int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello");
+                Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_UNDEF));

                 string returnValue2 = (string)InvokeOp("JsonGetValue", storeId, "Hello");
                 Assert.That(returnValue2, Is.EqualTo(""));
@@ -291,8 +291,8 @@
                 int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello");
                 Assert.That(returnValue, Is.EqualTo(1));

-                int result = (int)InvokeOp("JsonTestPath", storeId, "Hello");
-                Assert.That(result, Is.EqualTo(0));
+                int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello");
+                Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_UNDEF));

                 string returnValue2 = (string)InvokeOp("JsonGetJson", storeId, "Hello");
                 Assert.That(returnValue2, Is.EqualTo(""));
@@ -306,11 +306,11 @@
                 int returnValue = (int)InvokeOp( "JsonRemoveValue", storeId, "Hello[0]");
                 Assert.That(returnValue, Is.EqualTo(1));

-                int result = (int)InvokeOp("JsonTestPath", storeId, "Hello[0]");
-                Assert.That(result, Is.EqualTo(1));
-
-                result = (int)InvokeOp("JsonTestPath", storeId, "Hello[1]");
-                Assert.That(result, Is.EqualTo(0));
+                int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello[0]");
+                Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_VALUE));
+
+                result = (int)InvokeOp("JsonGetPathType", storeId, "Hello[1]");
+                Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_UNDEF));

                 string stringReturnValue = (string)InvokeOp("JsonGetValue", storeId, "Hello[0]");
                 Assert.That(stringReturnValue, Is.EqualTo("value2"));


Small improvement

Small improvement

--- Source/Classic/Libs/ManagedIrbis/Source/Pft/Infrastructure/PftParser.Infrastructure.cs
+++ Source/Classic/Libs/ManagedIrbis/Source/Pft/Infrastructure/PftParser.Infrastructure.cs
@@ -151,30 +151,29 @@

         private PftNode ParseCall3(PftNode result)
         {
-            bool ok = false;
-            while (!Tokens.IsEof)
+            PftTokenList innerTokens = Tokens.Segment
+                (
+                    _parenthesisOpen,
+                    _parenthesisClose,
+                    _parenthesisStop
+                )
+                .ThrowIfNull("innerTokens");
+
+            PftTokenList saveTokens = Tokens;
+            Tokens = innerTokens;
+
+            try
             {
-                PftToken token = Tokens.Current;
-
-                if (token.Kind == PftTokenKind.RightParenthesis)
+                while (!Tokens.IsEof)
                 {
-                    ok = true;
-                    Tokens.MoveNext();
-                    break;
+                    PftNode node = ParseNext();
+                    result.Children.Add(node);
                 }
-
-                if (token.Kind == PftTokenKind.LeftParenthesis)
-                {
-                    throw new PftSyntaxException(token);
-                }
-
-                PftNode node = ParseNext();
-                result.Children.Add(node);
             }
-
-            if (!ok)
+            finally
             {
-                throw new PftSyntaxException(Tokens);
+                Tokens = saveTokens;
+                Tokens.MoveNext();
             }

             return result;


Fix analysis of types derived from generics prior to VS 2015

Fixes #18

--- Tvl.VisualStudio.InheritanceMargin.CSharp.Legacy/SpecializedMatchingMemberCollector.cs
+++ Tvl.VisualStudio.InheritanceMargin.CSharp.Legacy/SpecializedMatchingMemberCollector.cs
@@ -82,8 +82,22 @@
                         continue;

                     var baseTypes = collector.GetBaseTypes(type);
-                    if (baseTypes.Contains(baseType))
-                        result.Add(type);
+                    if (baseType.TypeParameters != null && baseType.TypeParameters.Count > 0)
+                    {
+                        foreach (var candidate in baseTypes)
+                        {
+                            if (Equals(baseType, candidate.DefiningType))
+                            {
+                                result.Add(type);
+                                break;
+                            }
+                        }
+                    }
+                    else
+                    {
+                        if (baseTypes.Contains(baseType))
+                            result.Add(type);
+                    }
                 }
             }


another fix for closing the editorwindow

--- UMAProject/Assets/UMA/Core/StandardAssets/UMA/Scripts/Editor/GeometrySelectorWindow.cs
+++ UMAProject/Assets/UMA/Core/StandardAssets/UMA/Scripts/Editor/GeometrySelectorWindow.cs
@@ -162,7 +162,7 @@
         private void GeometryUpdate()
         {
             if (doneEditing)
-                Cleanup();
+                Close();
         }

         void OnSceneGUI(SceneView sceneView)
@@ -466,8 +466,6 @@
                 if (_Source.meshAsset != null)
                     Selection.activeObject = _Source.meshAsset;
                 DestroyImmediate(_Source.gameObject);
-
-                this.Close();
             }
         }
     }


Missed one function to regionalise..

Missed one function to regionalise..

Change as before

--- EDDiscovery/EDDiscoveryForm.cs
+++ EDDiscovery/EDDiscoveryForm.cs
@@ -1031,6 +1031,19 @@
             Application.Exit();
         }

+        private void dEBUGResetAllHistoryToFirstCommandeToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+            List<VisitedSystemsClass> vsall = VisitedSystemsClass.GetAll();
+
+            foreach (VisitedSystemsClass vs in vsall)
+            {
+                if (vs.Commander != 0)
+                {
+                    vs.Commander = 0;
+                    vs.Update();
+                }
+            }
+        }
         #endregion

         #region AsyncEDSM
@@ -1108,18 +1121,5 @@
         #endregion

-        private void dEBUGResetAllHistoryToFirstCommandeToolStripMenuItem_Click(object sender, EventArgs e)
-        {
-            List<VisitedSystemsClass> vsall = VisitedSystemsClass.GetAll();
-
-            foreach (VisitedSystemsClass vs in vsall)
-            {
-                if (vs.Commander != 0)
-                {
-                    vs.Commander = 0;
-                    vs.Update();
-                }
-            }
-        }
     }
 }


Added cmd line option on reposition form

And I've sucummed to re-ordering and regionalising discoveryform - its
getting too mish mashed..

--- EDDiscovery/EDDiscoveryForm.cs
+++ EDDiscovery/EDDiscoveryForm.cs
@@ -28,6 +28,8 @@

     public partial class EDDiscoveryForm : Form
     {
+        #region Variables
+
         public const int WM_NCLBUTTONDOWN = 0xA1;
         public const int HT_CAPTION = 0x2;
         public const int WM_NCL_RESIZE = 0x112;
@@ -48,14 +50,33 @@
         public string CommanderName { get; private set; }
         static public EDDConfig EDDConfig { get; private set; }

+        public TravelHistoryControl TravelControl { get { return travelHistoryControl1; } }
+        public List<SystemPosition> VisitedSystems { get { return travelHistoryControl1.visitedSystems; } }
+
+        bool option_nowindowreposition = false;                             // Cmd line options
+
         public EDDiscovery2._3DMap.MapManager Map { get; private set; }

-
         public event DistancesLoaded OnDistancesLoaded;

+        private bool CanSkipSlowUpdates()
+        {
+#if DEBUG
+            return EDDConfig.CanSkipSlowUpdates;
+#else
+            return false;
+#endif
+        }
+
+        #endregion
+
+        #region Initialisation
+
         public EDDiscoveryForm()
         {
             InitializeComponent();
+            ProcessCommandLineOptions();
+
             EDDConfig = new EDDConfig();

             //_fileTgcSystems = Path.Combine(Tools.GetAppDataDirectory(), "tgcsystems.json");
@@ -92,6 +113,213 @@
             Map = new EDDiscovery2._3DMap.MapManager();

             ApplyTheme(false);
+        }
+
+        private void EDDiscoveryForm_Layout(object sender, LayoutEventArgs e)       // Manually position, could not get gripper under tab control with it sizing for the life of me
+        {
+            if (panel_grip.Visible)
+            {
+                panel_grip.Location = new Point(this.ClientSize.Width - panel_grip.Size.Width, this.ClientSize.Height - panel_grip.Size.Height);
+                tabControl1.Size = new Size(this.ClientSize.Width - panel_grip.Size.Width, this.ClientSize.Height - panel_grip.Size.Height - tabControl1.Location.Y);
+            }
+            else
+                tabControl1.Size = new Size(this.ClientSize.Width, this.ClientSize.Height - tabControl1.Location.Y);
+        }
+
+        private void ProcessCommandLineOptions()
+        {
+            string cmdline = Environment.CommandLine;
+            option_nowindowreposition = (cmdline.IndexOf("-NoRepositionWindow", 0, StringComparison.InvariantCultureIgnoreCase) != -1 || cmdline.IndexOf("-NRW", 0, StringComparison.InvariantCultureIgnoreCase) != -1 );
+        }
+
+        private void EDDiscoveryForm_Load(object sender, EventArgs e)
+        {
+            try
+            {
+                EliteDangerous.CheckED();
+                EDDConfig.Update();
+                RepositionForm();
+                InitFormControls();
+                settings.InitSettingsTab();
+
+                CheckIfEliteDangerousIsRunning();
+                CheckIfVerboseLoggingIsTurnedOn();
+
+                if (File.Exists("test.txt"))
+                {
+                    button_test.Visible = true;
+                }
+            }
+            catch (Exception ex)
+            {
+                System.Windows.Forms.MessageBox.Show("EDDiscoveryForm_Load exception: " + ex.Message);
+                System.Windows.Forms.MessageBox.Show("Trace: " + ex.StackTrace);
+            }
+        }
+
+
+        private void EDDiscoveryForm_Shown(object sender, EventArgs e)
+        {
+            try
+            {
+                var edsmThread = new Thread(GetEDSMSystems) { Name = "Downloading EDSM Systems", IsBackground = true };
+                var downloadmapsThread = new Thread(DownloadMaps) { Name = "Downloading map Files", IsBackground = true };
+                edsmThread.Start();
+                downloadmapsThread.Start();
+
+                while (edsmThread.IsAlive || downloadmapsThread.IsAlive)
+                {
+                    Thread.Sleep(50);
+                    Application.DoEvents();
+                }
+
+                edsmThread.Join();
+                downloadmapsThread.Join();
+
+                SystemNames.Clear();                                // EDSM systems have loaded, make up names
+                foreach (SystemClass system in SystemData.SystemList)
+                {
+                    SystemNames.Add(system.name);                   // DANGER - using SystemNames in other controls while its loading freezes the UI
+                }
+
+                Console.WriteLine("Systems Loaded");
+
+                OnDistancesLoaded += new DistancesLoaded(this.DistancesLoaded);
+
+                GetEDSMDistancesAsync();
+
+                GetEDDBAsync(false);
+
+                routeControl1.textBox_From.AutoCompleteCustomSource = SystemNames;
+                routeControl1.textBox_To.AutoCompleteCustomSource = SystemNames;
+                settings.textBoxHomeSystem.AutoCompleteCustomSource = SystemNames;
+
+                imageHandler1.StartWatcher();
+                routeControl1.EnableRouteTab(); // now we have systems, we can update this..
+
+                routeControl1.travelhistorycontrol1 = travelHistoryControl1;
+                travelHistoryControl1.netlog.OnNewPosition += new NetLogEventHandler(routeControl1.NewPosition);
+                travelHistoryControl1.netlog.OnNewPosition += new NetLogEventHandler(travelHistoryControl1.NewPosition);
+                travelHistoryControl1.sync.OnNewEDSMTravelLog += new EDSMNewSystemEventHandler(travelHistoryControl1.RefreshEDSMEvent);
+
+                TravelHistoryControl.LogText("Reading travel history " + Environment.NewLine);
+                travelHistoryControl1.RefreshHistory();
+                travelHistoryControl1.netlog.StartMonitor(this);
+
+                if (EliteDangerous.CheckStationLogging())
+                {
+                    panelInfo.Visible = false;
+                }
+
+                CheckForNewInstaller();
+
+#if DEBUG
+//Robby : not sure about this, should we be moaning about this, what if people don't want to use EDmaterializer.
+                var appSettings = ConfigurationManager.AppSettings;
+                if (appSettings["EDMaterializerUsername"] == null || appSettings["EDMaterializerPassword"] == null)
+                {
+                    // Note: It's ok if this happens in DEBUG build Because we now hard code the
+                    // credentials in that particular case.
+                    LogLineHighlight("WARNING: EDMaterializer credentials are missing!");
+                }
+#endif
+                LogLineSuccess("Loading completed, Total number of systems " + SystemData.SystemList.Count().ToString());
+            }
+            catch (Exception ex)
+            {
+                System.Windows.Forms.MessageBox.Show("EDDiscovery_Load exception: " + ex.Message);
+                System.Windows.Forms.MessageBox.Show("Trace: " + ex.StackTrace);
+            }
+        }
+
+        private void CheckForNewInstaller()
+        {
+            {
+                EDDiscoveryServer eds = new EDDiscoveryServer();
+
+                string inst = eds.GetLastestInstaller();
+                if (inst != null)
+                {
+                    JObject jo = (JObject)JObject.Parse(inst);
+
+                    string newVersion = jo["Version"].Value<string>();
+                    string newInstaller = jo["Filename"].Value<string>();
+
+                    var currentVersion = Application.ProductVersion;
+
+                    Version v1, v2;
+                    v1 = new Version(newVersion);
+                    v2 = new Version(currentVersion);
+
+                    if (v1.CompareTo(v2) > 0) // Test if newver installer exists:
+                    {
+                        LogLineHighlight("New EDDiscovery installer availble  " + "http://eddiscovery.astronet.se/release/" + newInstaller + Environment.NewLine);
+                    }
+
+                }
+            }
+        }
+
+        //Pleiades Sector WU-O B16-0
+        //Pleiades Sector WU-O b6-0
+
+        private void InitFormControls()
+        {
+            labelPanelText.Text = "Loading. Please wait!";
+            panelInfo.Visible = true;
+            panelInfo.BackColor = Color.Gold;
+
+            routeControl1.travelhistorycontrol1 = travelHistoryControl1;
+        }
+
+        private void RepositionForm()
+        {
+            var top = _db.GetSettingInt("FormTop", -1);
+            if (top > 0 && option_nowindowreposition == false )
+            {
+                var left = _db.GetSettingInt("FormLeft", -1);
+                var height = _db.GetSettingInt("FormHeight", -1);
+                var width = _db.GetSettingInt("FormWidth", -1);
+                this.Top = top;
+                this.Left = left;
+                this.Height = height;
+                this.Width = width;
+            }
+        }
+
+        private void CheckIfEliteDangerousIsRunning()
+        {
+            if (EliteDangerous.EDRunning)
+            {
+                TravelHistoryControl.LogText("EliteDangerous is running." + Environment.NewLine);
+            }
+            else
+            {
+                TravelHistoryControl.LogText("EliteDangerous is not running ." + Environment.NewLine);
+            }
+        }
+
+        private void CheckIfVerboseLoggingIsTurnedOn()
+        {
+            if (!EliteDangerous.CheckStationLogging())
+            {
+                TravelHistoryControl.LogTextHighlight("Elite Dangerous is not logging system names!!! ");
+                TravelHistoryControl.LogText("Add ");
+                TravelHistoryControl.LogText("VerboseLogging=\"1\" ");
+                TravelHistoryControl.LogText("to <Network  section in File: " + Path.Combine(EliteDangerous.EDDirectory, "AppConfig.xml") + " or AppConfigLocal.xml  Remember to restart Elite!" + Environment.NewLine);
+
+                labelPanelText.Text = "Elite Dangerous is not logging system names!";
+                panelInfo.BackColor = Color.Salmon;
+            }
+        }
+
+        private void EDDiscoveryForm_Activated(object sender, EventArgs e)
+        {
+            /* TODO: Only focus the field if we're on the correct tab! */
+            if (fastTravelToolStripMenuItem.Checked && tabControl1.SelectedTab == tabPageTravelHistory)
+            {
+                travelHistoryControl1.textBoxDistanceToNextSystem.Focus();
+            }
         }

         public void ApplyTheme(bool refreshhistory)
@@ -111,133 +339,9 @@

         }

-        private void EDDiscoveryForm_Layout(object sender, LayoutEventArgs e)       // Manually position, could not get gripper under tab control with it sizing for the life of me
-        {
-            if (panel_grip.Visible)
-            {
-                panel_grip.Location = new Point(this.ClientSize.Width - panel_grip.Size.Width, this.ClientSize.Height - panel_grip.Size.Height);
-                tabControl1.Size = new Size(this.ClientSize.Width - panel_grip.Size.Width, this.ClientSize.Height - panel_grip.Size.Height - tabControl1.Location.Y);
-            }
-            else
-                tabControl1.Size = new Size(this.ClientSize.Width, this.ClientSize.Height - tabControl1.Location.Y);
-        }
-
-        public TravelHistoryControl TravelControl
-        {
-            get { return travelHistoryControl1; }
-        }
-
-
-        internal void ShowTrilaterationTab()
-        {
-            tabControl1.SelectedIndex = 1;
-        }
-
-        internal void ShowHistoryTab()
-        {
-            tabControl1.SelectedIndex = 0;
-        }
-
-        private void EDDiscoveryForm_Load(object sender, EventArgs e)
-        {
-            try
-            {
-                EliteDangerous.CheckED();
-                EDDConfig.Update();
-                RepositionForm();
-                InitFormControls();
-                settings.InitSettingsTab();
-
-                CheckIfEliteDangerousIsRunning();
-                CheckIfVerboseLoggingIsTurnedOn();
-
-                if (File.Exists("test.txt"))
-                {
-                    button_test.Visible = true;
-                }
-            }
-            catch (Exception ex)
-            {
-                System.Windows.Forms.MessageBox.Show("EDDiscoveryForm_Load exception: " + ex.Message);
-                System.Windows.Forms.MessageBox.Show("Trace: " + ex.StackTrace);
-            }
-        }
-
-
-        private void EDDiscoveryForm_Shown(object sender, EventArgs e)
-        {
-            try
-            {
-                var edsmThread = new Thread(GetEDSMSystems) { Name = "Downloading EDSM Systems", IsBackground = true };
-                var downloadmapsThread = new Thread(DownloadMaps) { Name = "Downloading map Files", IsBackground = true };
-                edsmThread.Start();
-                downloadmapsThread.Start();
-
-                while (edsmThread.IsAlive || downloadmapsThread.IsAlive)
-                {
-                    Thread.Sleep(50);
-                    Application.DoEvents();
-                }
-
-                edsmThread.Join();
-                downloadmapsThread.Join();
-
-                SystemNames.Clear();                                // EDSM systems have loaded, make up names
-                foreach (SystemClass system in SystemData.SystemList)
-                {
-                    SystemNames.Add(system.name);                   // DANGER - using SystemNames in other controls while its loading freezes the UI
-                }
-
-                Console.WriteLine("Systems Loaded");
-
-                OnDistancesLoaded += new DistancesLoaded(this.DistancesLoaded);
-
-                GetEDSMDistancesAsync();
-
-                GetEDDBAsync(false);
-
-                routeControl1.textBox_From.AutoCompleteCustomSource = SystemNames;
-                routeControl1.textBox_To.AutoCompleteCustomSource = SystemNames;
-                settings.textBoxHomeSystem.AutoCompleteCustomSource = SystemNames;
-
-                imageHandler1.StartWatcher();
-                routeControl1.EnableRouteTab(); // now we have systems, we can update this..
-
-                routeControl1.travelhistorycontrol1 = travelHistoryControl1;
-                travelHistoryControl1.netlog.OnNewPosition += new NetLogEventHandler(routeControl1.NewPosition);
-                travelHistoryControl1.netlog.OnNewPosition += new NetLogEventHandler(travelHistoryControl1.NewPosition);
-                travelHistoryControl1.sync.OnNewEDSMTravelLog += new EDSMNewSystemEventHandler(travelHistoryControl1.RefreshEDSMEvent);
-
-                TravelHistoryControl.LogText("Reading travel history " + Environment.NewLine);
-                travelHistoryControl1.RefreshHistory();
-                travelHistoryControl1.netlog.StartMonitor(this);
-
-                if (EliteDangerous.CheckStationLogging())
-                {
-                    panelInfo.Visible = false;
-                }
-
-                CheckForNewInstaller();
-
-#if DEBUG
-//Robby : not sure about this, should we be moaning about this, what if people don't want to use EDmaterializer.
-                var appSettings = ConfigurationManager.AppSettings;
-                if (appSettings["EDMaterializerUsername"] == null || appSettings["EDMaterializerPassword"] == null)
-                {
-                    // Note: It's ok if this happens in DEBUG build Because we now hard code the
-                    // credentials in that particular case.
-                    LogLineHighlight("WARNING: EDMaterializer credentials are missing!");
-                }
-#endif
-                LogLineSuccess("Loading completed, Total number of systems " + SystemData.SystemList.Count().ToString());
-            }
-            catch (Exception ex)
-            {
-                System.Windows.Forms.MessageBox.Show("EDDiscovery_Load exception: " + ex.Message);
-                System.Windows.Forms.MessageBox.Show("Trace: " + ex.StackTrace);
-            }
-        }
-
+        #endregion
+
+        #region Information Downloads

         public void DownloadMaps()          // ASYNC process
         {
@@ -329,16 +433,6 @@

             }

-        }
-
-
-        private bool CanSkipSlowUpdates()
-        {
-#if DEBUG
-            return EDDConfig.CanSkipSlowUpdates;
-#else
-            return false;
-#endif
         }

         private void GetEDSMSystems()  // ASYNC process
@@ -389,13 +483,6 @@
             GC.Collect();
         }

-
-
-        public List<SystemPosition> VisitedSystems
-        {
-            get { return travelHistoryControl1.visitedSystems; }
-        }
-
         private Thread ThreadEDSMDistances;
         private void GetEDSMDistancesAsync()
         {
@@ -477,35 +564,6 @@

         }

-        private void CheckForNewInstaller()
-        {
-            {
-                EDDiscoveryServer eds = new EDDiscoveryServer();
-
-                string inst = eds.GetLastestInstaller();
-                if (inst != null)
-                {
-                    JObject jo = (JObject)JObject.Parse(inst);
-
-                    string newVersion = jo["Version"].Value<string>();
-                    string newInstaller = jo["Filename"].Value<string>();
-
-                    var currentVersion = Application.ProductVersion;
-
-                    Version v1, v2;
-                    v1 = new Version(newVersion);
-                    v2 = new Version(currentVersion);
-
-                    if (v1.CompareTo(v2) > 0) // Test if newver installer exists:
-                    {
-                        LogLineHighlight("New EDDiscovery installer availble  " + "http://eddiscovery.astronet.se/release/" + newInstaller + Environment.NewLine);
-                    }
-
-                }
-            }
-        }
-
-
         internal void DistancesLoaded()
         {
             Invoke((MethodInvoker)delegate
@@ -609,6 +667,9 @@
             LogText("EDDB update done." + Environment.NewLine);
         }

+        #endregion
+
+        #region Logging

         private void LogText(string text)
         {
@@ -668,6 +729,9 @@
             }
         }

+        #endregion
+
+        #region JSONandMisc
         static public string LoadJsonFile(string filename)
         {
             string json = null;
@@ -717,6 +781,14 @@
             return json;
         }

+        internal void ShowTrilaterationTab()
+        {
+            tabControl1.SelectedIndex = 1;
+        }
+
+        #endregion
+
+        #region Closing

         private void SaveSettings()
         {
@@ -739,6 +811,10 @@
             _edsmSync.StopSync();
             SaveSettings();
         }
+
+        #endregion
+
+        #region ButtonsAndMouse

         private void button_test_Click(object sender, EventArgs e)
         {
@@ -850,61 +926,6 @@
             GetEDDBAsync(true);
         }

-        //Pleiades Sector WU-O B16-0
-        //Pleiades Sector WU-O b6-0
-
-        private void InitFormControls()
-        {
-            labelPanelText.Text = "Loading. Please wait!";
-            panelInfo.Visible = true;
-            panelInfo.BackColor = Color.Gold;
-
-            routeControl1.travelhistorycontrol1 = travelHistoryControl1;
-        }
-
-        private void RepositionForm()
-        {
-            var top = _db.GetSettingInt("FormTop", -1);
-            if (top > 0)
-            {
-                var left = _db.GetSettingInt("FormLeft", -1);
-                var height = _db.GetSettingInt("FormHeight", -1);
-                var width = _db.GetSettingInt("FormWidth", -1);
-                this.Top = top;
-                this.Left = left;
-                this.Height = height;
-                this.Width = width;
-            }
-        }
-
-
-
-        private void CheckIfEliteDangerousIsRunning()
-        {
-            if (EliteDangerous.EDRunning)
-            {
-                TravelHistoryControl.LogText("EliteDangerous is running." + Environment.NewLine);
-            }
-            else
-            {
-                TravelHistoryControl.LogText("EliteDangerous is not running ." + Environment.NewLine);
-            }
-        }
-
-        private void CheckIfVerboseLoggingIsTurnedOn()
-        {
-            if (!EliteDangerous.CheckStationLogging())
-            {
-                TravelHistoryControl.LogTextHighlight("Elite Dangerous is not logging system names!!! ");
-                TravelHistoryControl.LogText("Add ");
-                TravelHistoryControl.LogText("VerboseLogging=\"1\" ");
-                TravelHistoryControl.LogText("to <Network  section in File: " + Path.Combine(EliteDangerous.EDDirectory, "AppConfig.xml") + " or AppConfigLocal.xml  Remember to restart Elite!" + Environment.NewLine);
-
-                labelPanelText.Text = "Elite Dangerous is not logging system names!";
-                panelInfo.BackColor = Color.Salmon;
-            }
-        }
-
         private void prospectingToolStripMenuItem_Click(object sender, EventArgs e)
         {
             PlanetsForm frm = new PlanetsForm();
@@ -912,12 +933,107 @@
             frm.InitForm(this);
             frm.Show();
         }
-
-
+
         private void syncEDSMSystemsToolStripMenuItem_Click(object sender, EventArgs e)
         {
             AsyncSyncEDSMSystems();
         }
+
+        private void gitHubToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+            Process.Start("https://github.com/EDDiscovery/EDDiscovery");
+        }
+
+        private void reportIssueIdeasToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+            Process.Start("https://github.com/EDDiscovery/EDDiscovery/issues");
+        }
+
+        private void keepOnTopToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+            ToolStripMenuItem mi = sender as ToolStripMenuItem;
+            mi.Checked = !mi.Checked;
+            this.TopMost = mi.Checked;
+        }
+
+        private void panel_minimize_Click(object sender, EventArgs e)
+        {
+            this.WindowState = FormWindowState.Minimized;
+        }
+
+        private void panel_grip_MouseDown(object sender, MouseEventArgs e)
+        {
+            if (e.Button == MouseButtons.Left)
+            {
+                panel_grip.Captured();           // tell it, doing this royally screws up the MD/MU/ME/ML calls to it
+                ReleaseCapture();
+                SendMessage(Handle, WM_NCL_RESIZE, HT_RESIZE, 0);
+            }
+        }
+
+        private void changeMapColorToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+            settings.panel_defaultmapcolor_Click(sender, e);
+        }
+
+        private void editThemeToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+            settings.button_edittheme_Click(this, null);
+        }
+
+        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+            Close();
+            Application.Exit();
+        }
+
+        private void AboutBox()
+        {
+            AboutForm frm = new AboutForm();
+            string atext = Assembly.GetExecutingAssembly().FullName;
+            atext = atext.Split(',')[1].Split('=')[1];
+            frm.labelVersion.Text = this.Text + " " + atext;
+            frm.ShowDialog();
+        }
+
+        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+            AboutBox();
+        }
+
+        private void eDDiscoveryChatDiscordToolStripMenuItem_Click(object sender, EventArgs e)
+        {
+            Process.Start("https://discord.gg/0qIqfCQbziTWzsQu");
+        }
+
+        private void EDDiscoveryForm_MouseDown(object sender, MouseEventArgs e)
+        {
+            if (!theme.WindowsFrame && e.Button == MouseButtons.Left)           // only if theme is borderless
+            {
+                ReleaseCapture();
+                SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
+            }
+        }
+
+        private void menuStrip1_MouseDown(object sender, MouseEventArgs e)
+        {
+            EDDiscoveryForm_MouseDown(sender, e);
+        }
+
+        private void panel1_Click(object sender, EventArgs e)
+        {
+            AboutBox();
+        }
+
+        private void panel_close_Click(object sender, EventArgs e)
+        {
+            Close();
+            Application.Exit();
+        }
+
+        #endregion
+
+        #region AsyncEDSM

         private void AsyncSyncEDSMSystems()
         {
@@ -989,31 +1105,7 @@

         }

-        private void gitHubToolStripMenuItem_Click(object sender, EventArgs e)
-        {
-            Process.Start("https://github.com/EDDiscovery/EDDiscovery");
-        }
-
-        private void reportIssueIdeasToolStripMenuItem_Click(object sender, EventArgs e)
-        {
-            Process.Start("https://github.com/EDDiscovery/EDDiscovery/issues");
-        }
-
-        private void keepOnTopToolStripMenuItem_Click(object sender, EventArgs e)
-        {
-            ToolStripMenuItem mi = sender as ToolStripMenuItem;
-            mi.Checked = !mi.Checked;
-            this.TopMost = mi.Checked;
-        }
-
-        private void EDDiscoveryForm_Activated(object sender, EventArgs e)
-        {
-            /* TODO: Only focus the field if we're on the correct tab! */
-            if (fastTravelToolStripMenuItem.Checked && tabControl1.SelectedTab == tabPageTravelHistory)
-            {
-                travelHistoryControl1.textBoxDistanceToNextSystem.Focus();
-            }
-        }
+        #endregion

         private void dEBUGResetAllHistoryToFirstCommandeToolStripMenuItem_Click(object sender, EventArgs e)
@@ -1029,81 +1121,5 @@
                 }
             }
         }
-
-
-        private void AboutBox()
-        {
-            AboutForm frm = new AboutForm();
-            string atext = Assembly.GetExecutingAssembly().FullName;
-            atext = atext.Split(',')[1].Split('=')[1];
-            frm.labelVersion.Text = this.Text + " " + atext;
-            frm.ShowDialog();
-        }
-
-        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
-        {
-            AboutBox();
-        }
-
-        private void eDDiscoveryChatDiscordToolStripMenuItem_Click(object sender, EventArgs e)
-        {
-            Process.Start("https://discord.gg/0qIqfCQbziTWzsQu");
-        }
-
-        private void EDDiscoveryForm_MouseDown(object sender, MouseEventArgs e)
-        {
-            if (!theme.WindowsFrame && e.Button == MouseButtons.Left)           // only if theme is borderless
-            {
-                ReleaseCapture();
-                SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
-            }
-        }
-
-        private void menuStrip1_MouseDown(object sender, MouseEventArgs e)
-        {
-            EDDiscoveryForm_MouseDown(sender, e);
-        }
-
-        private void panel1_Click(object sender, EventArgs e)
-        {
-            AboutBox();
-        }
-
-        private void panel_close_Click(object sender, EventArgs e)
-        {
-            Close();
-            Application.Exit();
-        }
-
-        private void panel_minimize_Click(object sender, EventArgs e)
-        {
-            this.WindowState = FormWindowState.Minimized;
-        }
-
-        private void panel_grip_MouseDown(object sender, MouseEventArgs e)
-        {
-            if (e.Button == MouseButtons.Left)
-            {
-                panel_grip.Captured();           // tell it, doing this royally screws up the MD/MU/ME/ML calls to it
-                ReleaseCapture();
-                SendMessage(Handle, WM_NCL_RESIZE, HT_RESIZE, 0);
-            }
-        }
-
-        private void changeMapColorToolStripMenuItem_Click(object sender, EventArgs e)
-        {
-            settings.panel_defaultmapcolor_Click(sender, e);
-        }
-
-        private void editThemeToolStripMenuItem_Click(object sender, EventArgs e)
-        {
-            settings.button_edittheme_Click(this, null);
-        }
-
-        private void exitToolStripMenuItem_Click(object sender, EventArgs e)
-        {
-            Close();
-            Application.Exit();
-        }
     }
 }


attempt at fixing location and size saving issues

--- EDEngineer/Views/MainWindow.cs
+++ EDEngineer/Views/MainWindow.cs
@@ -194,6 +194,13 @@

             Blueprints.UpdateLayout();
             ShoppingList.UpdateLayout();
+
+            if (!AllowsTransparency)
+            {
+                SizeChanged += (o, e) => SaveDimensions();
+                LocationChanged += (o, e) => SaveDimensions();
+                ShoppingListSplitter.DragCompleted += (o, e) => SaveDimensions();
+            }
         }

         private void ConfigureShortcut(object sender, EventArgs e)
@@ -227,7 +234,6 @@
             {
                 e.Handled = true;
             }
-
         }

         private BindingBase binding;
@@ -426,33 +432,22 @@
             w.Show();
         }

-        protected override void OnClosing(CancelEventArgs e)
-        {
-            if (!bypassPositionSave)
-            {
-                var coords = PointToScreen(new Point(0, 0));
-                var yModificator = AllowsTransparency ? 0 : SystemInformation.CaptionHeight + 8;
-                var xModificator = AllowsTransparency ? 0 : 8;
-                SettingsManager.Dimensions = new WindowDimensions()
-                {
-                    Height = ActualHeight,
-                    Left = coords.X - xModificator,
-                    Top = coords.Y - yModificator,
-                    Width = ActualWidth,
-                    LeftSideWidth = ContentGrid.ColumnDefinitions[0].Width.Value,
-                    RightSideWidth = ContentGrid.ColumnDefinitions[2].Width.Value
-                };
-            }
-
-            base.OnClosing(e);
-        }
-
-        private bool bypassPositionSave = false;
+        private void SaveDimensions()
+        {
+            SettingsManager.Dimensions = new WindowDimensions()
+            {
+                Height = ActualHeight,
+                Left = Left,
+                Top = Top,
+                Width = ActualWidth,
+                LeftSideWidth = ContentGrid.ColumnDefinitions[0].Width.Value,
+                RightSideWidth = ContentGrid.ColumnDefinitions[2].Width.Value
+            };
+        }

         private void ResetWindowPositionButtonClicked(object sender, RoutedEventArgs e)
         {
             SettingsManager.Dimensions.Reset();
-            bypassPositionSave = true;

             Properties.Settings.Default.WindowUnlocked = false;
             Properties.Settings.Default.Save();


Add new plugin repository URL

Add new plugin repository URL

--- FBExtendedEvents/PluginInfo.cs
+++ FBExtendedEvents/PluginInfo.cs
@@ -4,4 +4,4 @@
 [assembly: AssemblyFogCreekMajorVersion(3)]
 [assembly: AssemblyFogCreekMinorVersionMin(5)]
 [assembly: AssemblyFogCreekEmailAddress("jozef.izso@gmail.com")]
-[assembly: AssemblyFogCreekWebsite("https://github.com/jozefizso/FBExtendedEvents")]
+[assembly: AssemblyFogCreekWebsite("https://github.com/jozefizso/FogBugz-ExtendedEvents")]


Added try/catch to ignore boilerplate answer paste errors

--- ForumSurfer/MainWindow.xaml.cs
+++ ForumSurfer/MainWindow.xaml.cs
@@ -46,11 +46,18 @@

         private object ReceiveMessage(SendBoilerplateMessage action)
         {
-            Debug.Print(action.Text);
-            Clipboard.SetText(action.Text);
-            wbFeed.Focus();
-            dynamic document = wbFeed.Document;
-            document.ExecCommand("Paste", false, null);
+            try
+            {
+                Debug.Print(action.Text);
+                Clipboard.SetText(action.Text);
+                wbFeed.Focus();
+                dynamic document = wbFeed.Document;
+                document.ExecCommand("Paste", false, null);
+            }
+            catch (Exception)
+            {
+                // Ignore
+            }
             return null;
         }
     }


Adding my Copyright to Util/RawParseUtils.cs

Signed-off-by: Meinrad Recheis <eaf05d0765f39a930bf7b0cdaff623228464d634@gmail.com>

--- GitSharp/Util/RawParseUtils.cs
+++ GitSharp/Util/RawParseUtils.cs
@@ -2,6 +2,7 @@
  * Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
  * Copyright (C) 2008, Kevin Thompson <kevin.thompson@theautomaters.com>
  * Copyright (C) 2009, Henon <meinrad.recheis@gmail.com>
+ * Copyright (C) 2009, Gil Ran <gilrun@gmail.com>
  *
  *
  * All rights reserved.


Update GetCookie function to not return bad default

--- GoogleMusicAPI.NET/Net/Http.cs
+++ GoogleMusicAPI.NET/Net/Http.cs
@@ -137,7 +137,7 @@
         {
             CookieCollection collection = GetCollection(container, url);
             if (collection != null)
-                return collection.OfType<Cookie>().FirstOrDefault(p => p.Name == cookieName).Value;
+                return collection.OfType<Cookie>().First(p => p.Name == cookieName).Value;

             return null;
         }


Version 0.0.2

Version 0.0.2

--- Ifa/Properties/AssemblyInfo.cs
+++ Ifa/Properties/AssemblyInfo.cs
@@ -29,5 +29,5 @@
 //      Build Number
 //      Revision
 //
-[assembly: AssemblyVersion("0.0.1")]
-[assembly: AssemblyFileVersion("0.0.1")]
+[assembly: AssemblyVersion("0.0.2")]
+[assembly: AssemblyFileVersion("0.0.2")]


preparing for release

preparing for release

--- Ior/Properties/AssemblyInfo.cs
+++ Ior/Properties/AssemblyInfo.cs
@@ -31,5 +31,5 @@
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.1.1.*")]
-[assembly: AssemblyFileVersion("1.1.1.*")]
+[assembly: AssemblyVersion("1.2.0.*")]
+[assembly: AssemblyFileVersion("1.2.0.*")]


New clientlib ver

New clientlib ver

--- KalturaClient/KalturaClient.cs
+++ KalturaClient/KalturaClient.cs
@@ -34,7 +34,7 @@
 		public KalturaClient(KalturaConfiguration config) : base(config)
 		{
 				ApiVersion = "3.3.0";
-				ClientTag = "dotnet:16-01-18";
+				ClientTag = "dotnet:16-01-19";
 		}

 		KalturaAccessControlProfileService _AccessControlProfileService;


:fire: Delete unreferenced using

:fire: Delete unreferenced using

--- Kip.Tests/CapabilitiesTests.cs
+++ Kip.Tests/CapabilitiesTests.cs
@@ -1,8 +1,5 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
 using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
 using System.Xml.Linq;
 using Xunit;


Comment: `Math` equivalence table.

Comment: `Math` equivalence table.

--- Lambda2Js/StaticMathMethods.cs
+++ Lambda2Js/StaticMathMethods.cs
@@ -12,6 +12,57 @@
             public byte length;
         }

+        // Equivalence table between javascript and .Net
+        //
+        // .Net methods         JavaScript functions
+        // -------------------  --------------------
+        // Math.Abs             Math.abs
+        // Math.Acos            Math.acos
+        //                      Math.acosh
+        // Math.Asin            Math.asin
+        //                      Math.asinh
+        // Math.Atan            Math.atan
+        //                      Math.atanh
+        // Math.Atan2           Math.atan2
+        //                      Math.cbrt
+        // Math.Ceiling         Math.ceil
+        //                      Math.clz32
+        // Math.Cos             Math.cos
+        // Math.Cosh            Math.cosh
+        // Math.Exp             Math.exp
+        // Math.Floor           Math.floor
+        //                      Math.expm1
+        //                      Math.fround
+        //                      Math.ipot
+        //                      Math.imul
+        // Math.IEEERemainder
+        // Math.Log             Math.log
+        // Math.Log10           Math.log10
+        //                      Math.log1p
+        //                      Math.log2
+        // Math.Max             Math.max
+        // Math.Min             Math.min
+        // Math.Pow             Math.pow
+        //                      Math.random
+        // Math.Round           Math.round
+        // Math.Sign            Math.sign
+        // Math.Sin             Math.sin
+        // Math.Sinh            Math.sinh
+        // Math.Sqrt            Math.sqrt
+        // Math.Tan             Math.tan
+        // Math.Tanh            Math.tanh
+        //                      Math.trunc
+        //
+        // .Net constants       JavaScript constants
+        // -------------------  ---------------------
+        // Math.E               Math.E
+        //                      Math.LN10
+        //                      Math.LN2
+        //                      Math.LOG10E
+        //                      Math.LOG2E
+        // Math.PI              Math.PI
+        //                      Math.SQRT1_2
+        //                      Math.SQRT2
         private static readonly Dictionary<string, NameLength> membersMap = new Dictionary<string, NameLength>
             {
                 { "Abs", new NameLength { name = "abs",     length = 1 } },
@@ -47,51 +98,6 @@

         public override void ConvertToJavascript(JavascriptConversionContext context)
         {
-            // Math.Abs             Math.abs
-            // Math.Acos            Math.acos
-            //                      Math.acosh
-            // Math.Asin            Math.asin
-            //                      Math.asinh
-            // Math.Atan            Math.atan
-            //                      Math.atanh
-            // Math.Atan2           Math.atan2
-            //                      Math.cbrt
-            // Math.Ceiling         Math.ceil
-            //                      Math.clz32
-            // Math.Cos             Math.cos
-            // Math.Cosh            Math.cosh
-            // Math.Exp             Math.exp
-            // Math.Floor           Math.floor
-            //                      Math.expm1
-            //                      Math.fround
-            //                      Math.ipot
-            //                      Math.imul
-            // Math.IEEERemainder
-            // Math.Log             Math.log
-            // Math.Log10           Math.log10
-            //                      Math.log1p
-            //                      Math.log2
-            // Math.Max             Math.max
-            // Math.Min             Math.min
-            // Math.Pow             Math.pow
-            //                      Math.random
-            // Math.Round           Math.round
-            // Math.Sign            Math.sign
-            // Math.Sin             Math.sin
-            // Math.Sinh            Math.sinh
-            // Math.Sqrt            Math.sqrt
-            // Math.Tan             Math.tan
-            // Math.Tanh            Math.tanh
-            //                      Math.trunc
-
-            // Math.E               Math.E
-            //                      Math.LN10
-            //                      Math.LN2
-            //                      Math.LOG10E
-            //                      Math.LOG2E
-            // Math.PI              Math.PI
-            //                      Math.SQRT1_2
-            //                      Math.SQRT2
             var methodCall = context.Node as MethodCallExpression;
             if (methodCall != null)
                 if (methodCall.Method.DeclaringType == typeof(Math))


add Linq where test

add Linq where test

--- LanguageExt.Tests/LinqTests.cs
+++ LanguageExt.Tests/LinqTests.cs
@@ -170,6 +170,16 @@
         }

         [Fact]
+        public void WhereArrayTest()
+        {
+            var res1 = from v in Array(1, 2, 3, 4, 5)
+                       where v < 3
+                       select v;
+
+            Assert.True(res1.Count == 2);
+        }
+
+        [Fact]
         public void WhereOptionTest()
         {
             var res1 = from v in GetOptionValue(true)


OJpeg codec improvements

OJpeg codec improvements

--- LibTiff/Internal/OJpegCodec.cs
+++ LibTiff/Internal/OJpegCodec.cs
@@ -296,6 +296,7 @@
         private OJPEGStateOutState m_out_state;
         private byte[] m_out_buffer = new byte[OJPEG_BUFFER];
         private byte[] m_skip_buffer;
+        private bool m_forceProcessedRgbOutput;

         public OJpegCodec(Tiff tif, Compression scheme, string name)
             : base(tif, scheme, name)
@@ -383,6 +384,7 @@
             m_out_state = 0;
             m_out_buffer = new byte[OJPEG_BUFFER];
             m_skip_buffer = null;
+            m_forceProcessedRgbOutput = false;
         }

         public override bool Init()
@@ -640,6 +642,13 @@
             OJPEGCleanup();
         }

+        internal void ForceProcessedRgbOutput(bool force)
+        {
+            // forces codec to output de-subsampled RGB image data
+            m_forceProcessedRgbOutput = force;
+            m_subsamplingcorrect_done = false;
+        }
+
         private bool OJPEGSetupDecode()
         {
             Tiff.WarningExt(m_tif.m_clientdata, "OJPEGSetupDecode",
@@ -1105,6 +1114,8 @@
             if (!m_subsampling_force_desubsampling_inside_decompression && (m_samples_per_pixel_per_plane > 1))
             {
                 m_libjpeg_jpeg_decompress_struct.Raw_data_out = true;
+                m_libjpeg_jpeg_decompress_struct.Do_fancy_upsampling = false;
+
                 //#if JPEG_LIB_VERSION >= 70
                 //    libjpeg_jpeg_decompress_struct.do_fancy_upsampling=FALSE;
                 //#endif
@@ -1155,8 +1166,18 @@
             }
             else
             {
-                m_libjpeg_jpeg_decompress_struct.Jpeg_color_space = J_COLOR_SPACE.JCS_UNKNOWN;
-                m_libjpeg_jpeg_decompress_struct.Out_color_space = J_COLOR_SPACE.JCS_UNKNOWN;
+                if (m_forceProcessedRgbOutput)
+                {
+                    m_libjpeg_jpeg_decompress_struct.Do_fancy_upsampling = false;
+                    m_libjpeg_jpeg_decompress_struct.Jpeg_color_space = J_COLOR_SPACE.JCS_YCbCr;
+                    m_libjpeg_jpeg_decompress_struct.Out_color_space = J_COLOR_SPACE.JCS_RGB;
+                }
+                else
+                {
+                    m_libjpeg_jpeg_decompress_struct.Jpeg_color_space = J_COLOR_SPACE.JCS_UNKNOWN;
+                    m_libjpeg_jpeg_decompress_struct.Out_color_space = J_COLOR_SPACE.JCS_UNKNOWN;
+                }
+
                 m_libjpeg_jpeg_query_style = 1;
                 m_bytes_per_line = m_samples_per_pixel_per_plane * m_strile_width;
                 m_lines_per_strile = m_strile_length;
@@ -1565,8 +1586,11 @@
                         m_subsampling_hor = (byte)(o >> 4);
                         m_subsampling_ver = (byte)(o & 15);
                         if (((m_subsampling_hor != 1) && (m_subsampling_hor != 2) && (m_subsampling_hor != 4)) ||
-                            ((m_subsampling_ver != 1) && (m_subsampling_ver != 2) && (m_subsampling_ver != 4)))
+                            ((m_subsampling_ver != 1) && (m_subsampling_ver != 2) && (m_subsampling_ver != 4)) ||
+                            m_forceProcessedRgbOutput)
+                        {
                             m_subsampling_force_desubsampling_inside_decompression = true;
+                        }
                     }
                     else
                     {


Support for null collection name in DbRef (use ResolveCollectionName)

--- LiteDB/Mapper/EntityBuilder.cs
+++ LiteDB/Mapper/EntityBuilder.cs
@@ -108,8 +108,6 @@
         /// </summary>
         public EntityBuilder<T> DbRef<K>(Expression<Func<T, K>> property, string collection = null)
         {
-            if (string.IsNullOrEmpty(collection)) throw new ArgumentNullException("collection");
-
             return this.GetProperty(property, (p) =>
             {
                 BsonMapper.RegisterDbRef(_mapper, p, collection ?? _mapper.ResolveCollectionName(typeof(K)));


IPGlobalProperties.GetIPGlobalProperties() can throw NotSupported on WASM

Wrap SmtpClient static ctor logic in a try/catch and default to "localhost".

Fixes issue #1381

--- MailKit/Net/Smtp/SmtpClient.cs
+++ MailKit/Net/Smtp/SmtpClient.cs
@@ -92,23 +92,29 @@

 		static SmtpClient ()
 		{
-			string hostName = IPGlobalProperties.GetIPGlobalProperties ().HostName;
-			var idn = new IdnMapping ();
-
-			if (!string.IsNullOrEmpty (hostName)) {
-				try {
-					hostName = idn.GetAscii (hostName);
-				} catch (ArgumentException) {
-					// This can happen if the hostName contains illegal unicode characters.
-					var ascii = new StringBuilder ();
-					for (int i = 0; i < hostName.Length; i++) {
-						if (hostName[i] <= 0x7F)
-							ascii.Append (hostName[i]);
+			string hostName;
+
+			try {
+				hostName = IPGlobalProperties.GetIPGlobalProperties ().HostName;
+				var idn = new IdnMapping ();
+
+				if (!string.IsNullOrEmpty (hostName)) {
+					try {
+						hostName = idn.GetAscii (hostName);
+					} catch (ArgumentException) {
+						// This can happen if the hostName contains illegal unicode characters.
+						var ascii = new StringBuilder ();
+						for (int i = 0; i < hostName.Length; i++) {
+							if (hostName[i] <= 0x7F)
+								ascii.Append (hostName[i]);
+						}
+
+						hostName = ascii.Length > 0 ? ascii.ToString () : null;
 					}
-
-					hostName = ascii.Length > 0 ? ascii.ToString () : null;
+				} else {
+					hostName = null;
 				}
-			} else {
+			} catch {
 				hostName = null;
 			}


Raised ApiRequestFailed when upload failed with an exception

--- MegaApiClient/MegaApiClient.cs
+++ MegaApiClient/MegaApiClient.cs
@@ -739,8 +739,9 @@
               }
               catch (Exception ex)
               {
-                Console.WriteLine("Upload failed: {0}", ex);
                 apiResult = ApiResultCode.RequestFailedRetry;
+                this.ApiRequestFailed?.Invoke(this, new ApiRequestFailedEventArgs(uri, remainingRetry, requestDelay, apiResult, ex));
+
                 break;
               }
             }
@@ -748,7 +749,7 @@

           if (apiResult != ApiResultCode.Ok)
           {
-            this.ApiRequestFailed?.Invoke(this, new ApiRequestFailedEventArgs(uri, remainingRetry, requestDelay, ApiResultCode.RequestFailedRetry, null));
+            this.ApiRequestFailed?.Invoke(this, new ApiRequestFailedEventArgs(uri, remainingRetry, requestDelay, apiResult, completionHandle));

             if (apiResult == ApiResultCode.RequestFailedRetry || apiResult == ApiResultCode.RequestFailedPermanetly || apiResult == ApiResultCode.TooManyRequests)
             {


Increased retries and delay between retries

--- MegaApiClient/MegaApiClient.cs
+++ MegaApiClient/MegaApiClient.cs
@@ -16,8 +16,8 @@

   public partial class MegaApiClient : IMegaApiClient
   {
-    private const int ApiRequestAttempts = 10;
-    private const int ApiRequestDelay = 200;
+    private const int ApiRequestAttempts = 60;
+    private const int ApiRequestDelay = 500;

     internal const int DefaultBufferSize = 8192;
     private const int DefaultChunksPackSize = 1024 * 1024;


Revert "ss-77: support unknown orders in OrderStatusMessage" task
canceled

This reverts commit 8c693fcf64d53e8111a5dbd2f60a32da68f350f1.

--- Messages/OrderStatusMessage.cs
+++ Messages/OrderStatusMessage.cs
@@ -68,12 +68,6 @@
 			set => _states = value ?? throw new ArgumentNullException(nameof(value));
 		}

-		/// <summary>
-		/// Include unknown orders.
-		/// </summary>
-		[DataMember]
-		public bool IncludeUnknownOrders { get; set; }
-
 		bool ISubscriptionMessage.FilterEnabled
 			=>
 			States.Length != 0 || SecurityId != default ||
@@ -104,7 +98,6 @@
 			destination.Count = Count;
 			destination.IsSubscribe = IsSubscribe;
 			destination.States = States.ToArray();
-			destination.IncludeUnknownOrders = IncludeUnknownOrders;
 		}

 		/// <summary>
@@ -140,9 +133,6 @@
 			if (States.Length > 0)
 				str += $",States={States.Select(s => s.To<string>()).JoinComma()}";

-			if (IncludeUnknownOrders)
-				str += $",{nameof(IncludeUnknownOrders)}";
-
 			return str;
 		}
 	}


Fix stupidity

Fix stupidity

--- ModelMultiParticlePersistFX.cs
+++ ModelMultiParticlePersistFX.cs
@@ -406,6 +406,7 @@
                                                     : persistentKspParticleEmitter.pe.transform.InverseTransformPoint(pPos);
                     }
                 }
+                particles[j] = particle;
             }
             activePhysicsPass = ++activePhysicsPass % physicsPass;
             persistentKspParticleEmitter.pe.pe.particles = particles;


moving to temp dir

moving to temp dir

--- MonJobs.Tests/MongoTestBase.cs
+++ MonJobs.Tests/MongoTestBase.cs
@@ -29,7 +29,7 @@

         public static async Task RunInMongoLand(Func<IMongoDatabase, Task> mongoWork)
         {
-            using (var runner = MongoDbRunner.Start())
+            using (var runner = MongoDbRunner.Start(System.IO.Path.GetTempPath()))
             {
                 var server = new MongoClient(runner.ConnectionString);
                 var database = server.GetDatabase("IntegrationTest");


removed usage of `nameof` in `ResolutionException`

--- Mono.Cecil/MetadataResolver.cs
+++ Mono.Cecil/MetadataResolver.cs
@@ -54,7 +54,7 @@
 			: base ("Failed to resolve " + member.FullName)
 		{
 			if (member == null)
-				throw new ArgumentNullException (nameof (member));
+				throw new ArgumentNullException ("member");

 			this.member = member;
 		}
@@ -63,7 +63,7 @@
 			: base ("Failed to resolve " + member.FullName, innerException)
 		{
 			if (member == null)
-				throw new ArgumentNullException (nameof (member));
+				throw new ArgumentNullException ("member");

 			this.member = member;
 		}


Remove empty constructor

Remove empty constructor

--- NET/API/Treehopper/Settings.cs
+++ NET/API/Treehopper/Settings.cs
@@ -44,13 +44,5 @@
         /// The WinUSB GUID used by the librarh
         /// </summary>
         public Guid Guid { get; set; } = new Guid("{5B34B38B-F4CD-49C3-B2BB-60E47A43E12D}");
-
-        /// <summary>
-        /// Construct a new settings object with Treehopper defaults.
-        /// </summary>
-        public Settings()
-        {
-
-        }
     }
 }


Fixing a problem where a BadImageFormatException was thrown but was not related to loading dlls - Thanks to vidstige

--- NiWrapper.Net/VideoFrameRef.cs
+++ NiWrapper.Net/VideoFrameRef.cs
@@ -160,7 +160,7 @@
                     format = System.Drawing.Imaging.PixelFormat.Format16bppGrayScale;
                     break;
                 default:
-                    throw new BadImageFormatException("Pixel format is not acceptable for bitmap converting.");
+                    throw new InvalidOperationException("Pixel format is not acceptable for bitmap converting.");
             }
             if ((options & copyBitmapOptions.Force24BitRGB) == copyBitmapOptions.Force24BitRGB)
                 format = PixelFormat.Format24bppRgb;
@@ -198,7 +198,7 @@
                         desiredFormat = System.Drawing.Imaging.PixelFormat.Format16bppGrayScale;
                         break;
                     default:
-                        throw new BadImageFormatException("Pixel format is not acceptable for bitmap converting.");
+                        throw new InvalidOperationException("Pixel format is not acceptable for bitmap converting.");
                 }
                 if ((options & copyBitmapOptions.Force24BitRGB) != copyBitmapOptions.Force24BitRGB &&
                     desiredFormat != image.PixelFormat)


ManualControlBoard: using ManualIndicatorBoard instead of the dummy one

--- projects/RagingBool.Carcosa.Devices_cs/InputControl/ControlBoard/ManualControlBoard.cs
+++ projects/RagingBool.Carcosa.Devices_cs/InputControl/ControlBoard/ManualControlBoard.cs
@@ -22,19 +22,19 @@
     {
         private ManualKeyboard<int, TimedKeyVelocity> _buttons;
         private ManualControllerBoard<int, double> _controllers;
-        private DummyIndicatorBoard<int, bool> _buttonLights;
+        private ManualIndicatorBoard<int, bool> _buttonLights;

         public ManualControlBoard()
         {
             _buttons = new ManualKeyboard<int, TimedKeyVelocity>();
             _controllers = new ManualControllerBoard<int, double>(0);
-            _buttonLights = new DummyIndicatorBoard<int, bool>(false);
+            _buttonLights = new ManualIndicatorBoard<int, bool>(false);
         }

         public ManualKeyboard<int, TimedKeyVelocity> Buttons { get { return _buttons; } }

         public ManualControllerBoard<int, double> Controllers { get { return _controllers; } }

-        public DummyIndicatorBoard<int, bool> ButtonLights { get { return _buttonLights; } }
+        public ManualIndicatorBoard<int, bool> ButtonLights { get { return _buttonLights; } }
     }
 }


Use IsKind

Use IsKind

--- src/Features/CSharp/Portable/Completion/KeywordRecommenders/ThrowKeywordRecommender.cs
+++ src/Features/CSharp/Portable/Completion/KeywordRecommenders/ThrowKeywordRecommender.cs
@@ -22,13 +22,13 @@
             }

             // void M() => throw
-            if (context.TargetToken.Kind() == SyntaxKind.EqualsGreaterThanToken)
+            if (context.TargetToken.IsKind(SyntaxKind.EqualsGreaterThanToken))
             {
                 return true;
             }

             // val ?? throw
-            if (context.TargetToken.Kind() == SyntaxKind.QuestionQuestionToken)
+            if (context.TargetToken.IsKind(SyntaxKind.QuestionQuestionToken))
             {
                 return true;
             }
@@ -38,7 +38,7 @@
             if (context.TargetToken.Kind() is SyntaxKind.QuestionToken or
                 SyntaxKind.ColonToken)
             {
-                return context.TargetToken.Parent?.Kind() == SyntaxKind.ConditionalExpression;
+                return context.TargetToken.Parent.IsKind(SyntaxKind.ConditionalExpression);
             }

             return false;


Updated RegisterServiceBehaviorForHost to return the IRegistrationBuilder so additional modifications can be made to the behavior registration.

--- src/Source/Autofac.Integration.Wcf/AutofacServiceHostBehaviorRegistrationExtensions.cs
+++ src/Source/Autofac.Integration.Wcf/AutofacServiceHostBehaviorRegistrationExtensions.cs
@@ -58,14 +58,14 @@
         /// <exception cref="System.ArgumentNullException">
         /// Thrown if <paramref name="builder" /> is <see langword="null" />.
         /// </exception>
-        public static void RegisterServiceBehaviorForHost<TBehavior>(this ContainerBuilder builder) where TBehavior : IServiceBehavior
+        public static IRegistrationBuilder<TBehavior, ConcreteReflectionActivatorData, SingleRegistrationStyle> RegisterServiceBehaviorForHost<TBehavior>(this ContainerBuilder builder) where TBehavior : IServiceBehavior
         {
             if (builder == null)
             {
                 throw new ArgumentNullException("builder");
             }
             builder.RegisterCollection<IServiceBehavior>(WcfServiceBehaviorForHostCollectionTag).Named<IEnumerable<IServiceBehavior>>(WcfServiceBehaviorForHostCollectionTag);
-            builder.RegisterType<TBehavior>().MemberOf(WcfServiceBehaviorForHostCollectionTag);
+            return builder.RegisterType<TBehavior>().MemberOf(WcfServiceBehaviorForHostCollectionTag);
         }

         /// <summary>


Change IntegrationTestBase to properly locate baseline files in net451.

- Net451 tests would have their current directory set to the dll that was located in bin/debug/framework/rid/... when run via `dotnet test`.

#885

--- test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/IntegrationTestBase.cs
+++ test/Microsoft.AspNetCore.Razor.Evolution.Test/IntegrationTests/IntegrationTestBase.cs
@@ -3,6 +3,7 @@

 using System;
 using System.IO;
+using System.Reflection;
 #if NET451
 using System.Runtime.Remoting;
 using System.Runtime.Remoting.Messaging;
@@ -18,6 +19,23 @@
     [IntializeTestFile]
     public abstract class IntegrationTestBase
     {
+        private static readonly string ThisProjectName = typeof(IntializeTestFileAttribute).GetTypeInfo().Assembly.GetName().Name;
+        private static readonly string TestProjectRoot = FindTestProjectRoot();
+
+        private static string FindTestProjectRoot()
+        {
+            var currentDirectory = new DirectoryInfo(Directory.GetCurrentDirectory());
+
+            while (currentDirectory != null &&
+                !string.Equals(currentDirectory.Name, ThisProjectName, StringComparison.Ordinal))
+            {
+                currentDirectory = currentDirectory.Parent;
+            }
+
+            var normalizedSeparators = currentDirectory.FullName.Replace(Path.DirectorySeparatorChar, '/');
+            return currentDirectory.FullName;
+        }
+
 #if GENERATE_BASELINES
         private static readonly bool GenerateBaselines = true;
 #else
@@ -77,7 +95,8 @@

             if (GenerateBaselines)
             {
-                File.WriteAllText(baselineFilename, RazorIRNodeSerializer.Serialize(document));
+                var baselineFullPath = Path.Combine(TestProjectRoot, baselineFilename);
+                File.WriteAllText(baselineFullPath, RazorIRNodeSerializer.Serialize(document));
                 return;
             }


add more tests for CompiledBinding Source with StaticResource

--- tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs
+++ tests/Avalonia.Markup.Xaml.UnitTests/MarkupExtensions/CompiledBindingExtensionTests.cs
@@ -584,6 +584,81 @@
         }

         [Fact]
+        public void Binds_To_Source_StaticResource1()
+        {
+            using (UnitTestApplication.Start(TestServices.StyledWindow))
+            {
+                var xaml = @"
+<Window xmlns='https://github.com/avaloniaui'
+             xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
+             xmlns:local='using:Avalonia.Markup.Xaml.UnitTests.MarkupExtensions'
+             x:CompileBindings='True'>
+    <Window.Resources>
+        <local:TestDataContext x:Key='dataKey' StringProperty='foobar'/>
+        <x:String x:Key='otherObjectKey'>test</x:String>
+    </Window.Resources>
+    <TextBlock Name='textBlock' Text='{Binding StringProperty, Source={StaticResource dataKey}}'/>
+</Window>";
+
+                var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml);
+                var textBlock = window.FindControl<TextBlock>("textBlock");
+
+                Assert.Equal("foobar", textBlock.Text);
+            }
+        }
+
+        [Fact]
+        public void Binds_To_Source_StaticResource_In_ResourceDictionary()
+        {
+            using (UnitTestApplication.Start(TestServices.StyledWindow))
+            {
+                var xaml = @"
+<Window xmlns='https://github.com/avaloniaui'
+             xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
+             xmlns:local='using:Avalonia.Markup.Xaml.UnitTests.MarkupExtensions'
+             x:DataType='local:TestDataContext' x:CompileBindings='True'>
+    <Window.Resources>
+        <ResourceDictionary>
+            <local:TestDataContext x:Key='dataKey' StringProperty='foobar'/>
+        </ResourceDictionary>
+    </Window.Resources>
+    <TextBlock Name='textBlock' Text='{Binding StringProperty, Source={StaticResource dataKey}}'/>
+</Window>";
+
+                var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml);
+                var textBlock = window.FindControl<TextBlock>("textBlock");
+
+                Assert.Equal("foobar", textBlock.Text);
+            }
+        }
+
+        [Fact]
+        public void Binds_To_Source_StaticResource_In_ResourceDictionary1()
+        {
+            using (UnitTestApplication.Start(TestServices.StyledWindow))
+            {
+                var xaml = @"
+<Window xmlns='https://github.com/avaloniaui'
+             xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
+             xmlns:local='using:Avalonia.Markup.Xaml.UnitTests.MarkupExtensions'
+             x:DataType='local:TestDataContext' x:CompileBindings='True'>
+    <Window.Resources>
+        <ResourceDictionary>
+            <local:TestDataContext x:Key='dataKey' StringProperty='foobar'/>
+            <x:String x:Key='otherObjectKey'>test</x:String>
+        </ResourceDictionary>
+    </Window.Resources>
+    <TextBlock Name='textBlock' Text='{Binding StringProperty, Source={StaticResource dataKey}}'/>
+</Window>";
+
+                var window = (Window)AvaloniaRuntimeXamlLoader.Load(xaml);
+                var textBlock = window.FindControl<TextBlock>("textBlock");
+
+                Assert.Equal("foobar", textBlock.Text);
+            }
+        }
+
+        [Fact]
         public void Binds_To_Source_xStatic()
         {
             using (UnitTestApplication.Start(TestServices.StyledWindow))


Fixed bug in BlockGroup title

Fixed bug in BlockGroup title

--- core/Piranha.Manager/Areas/Manager/Views/Shared/EditorTemplates/ContentEditBlock.cshtml
+++ core/Piranha.Manager/Areas/Manager/Views/Shared/EditorTemplates/ContentEditBlock.cshtml
@@ -33,7 +33,7 @@
         {

-
Slider

+
@blockType.Name

                 @if (blockType.UseCustomView) {
                     @Html.EditorFor(m => m.Value, Model.Value.GetType().Name)
                 }


Get context node from token directly

Get context node from token directly

--- src/Features/Core/Portable/Completion/Providers/AbstractTypeImportCompletionProvider.cs
+++ src/Features/Core/Portable/Completion/Providers/AbstractTypeImportCompletionProvider.cs
@@ -70,8 +70,7 @@

             using (Logger.LogBlock(FunctionId.Completion_TypeImportCompletionProvider_GetCompletionItemsAsync, cancellationToken))
             {
-                var root = await context.SyntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(false);
-                var node = root.FindNode(context.LeftToken.Span);
+                var node = context.LeftToken.Parent;
                 var project = document.Project;

                 // Find all namespaces in scope at current cursor location,


Renamed the 'Inspect' method to 'ToStringAwesomely'

--- src/Shouldly/MessageGenerators/ShouldContainATypeWithDefaultToStringMessageGenerator.cs
+++ src/Shouldly/MessageGenerators/ShouldContainATypeWithDefaultToStringMessageGenerator.cs
@@ -34,7 +34,7 @@
         {1}
     {2}
         but did not",
-                codePart, context.ShouldMethod.PascalToSpaced(), context.Expected.Inspect());
+                codePart, context.ShouldMethod.PascalToSpaced(), context.Expected.ToStringAwesomely());
             return message;
         }
     }


For-loop can be converted into foreach-loop

--- src/Slp.Evi.Storage/Slp.Evi.Test.Unit/Relational/Utilities/SqlAlgebraEqualityChecker.cs
+++ src/Slp.Evi.Storage/Slp.Evi.Test.Unit/Relational/Utilities/SqlAlgebraEqualityChecker.cs
@@ -40,14 +40,10 @@

             int matched = 0;

-            for (int l = 0; l < leftConditions.Count; l++)
-            {
-                var lCond = leftConditions[l];
-
-                for (int r = 0; r < rightConditions.Count; r++)
+            foreach (var lCond in leftConditions)
+            {
+                foreach (var rCond in rightConditions)
                 {
-                    var rCond = rightConditions[r];
-
                     if ((bool)lCond.Accept(this, rCond))
                     {
                         matched++;
@@ -83,14 +79,10 @@

             int matched = 0;

-            for (int l = 0; l < leftConditions.Count; l++)
-            {
-                var lCond = leftConditions[l];
-
-                for (int r = 0; r < rightConditions.Count; r++)
+            foreach (var lCond in leftConditions)
+            {
+                foreach (var rCond in rightConditions)
                 {
-                    var rCond = rightConditions[r];
-
                     if ((bool)lCond.Accept(this, rCond))
                     {
                         matched++;