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++;


feat(server): fix wrong date displayed in blotter (ARTP-1157)

--- src/server/dotNet/Adaptive.ReactiveTrader.Server.TradeExecution/TradeExecutionEngine.cs
+++ src/server/dotNet/Adaptive.ReactiveTrader.Server.TradeExecution/TradeExecutionEngine.cs
@@ -27,7 +27,7 @@
         public async Task<ExecuteTradeResponseDto> ExecuteAsync(ExecuteTradeRequestDto request, string user)
         {
             var id = await _tradeIdProvider.GetNextId();
-            var tradeDate = DateTimeOffset.UtcNow.Date;
+            var tradeDate = DateTimeOffset.UtcNow;

             DateTimeOffset valueDate;
             if (!DateTimeOffset.TryParse(request.ValueDate, out valueDate))


Added some more tests for the ZigZagConverters

--- test/AM.Core.Algorithms.StringManipulation.Tests/Converters/ZigZagConverterTestsBase.cs
+++ test/AM.Core.Algorithms.StringManipulation.Tests/Converters/ZigZagConverterTestsBase.cs
@@ -1,4 +1,5 @@
 using AM.Core.Algorithms.StringManipulation.Converters;
+using System;
 using Xunit;

 namespace AM.Core.Algorithms.StringManipulation.Tests.Converters
@@ -32,5 +33,24 @@
         {
             Assert.Equal(expectedResult, sut.Convert(input, numberOfRows));
         }
+
+        [Fact]
+        public void Convert_ThrowsForNegativeNumberOfRows()
+        {
+            Assert.Throws<ArgumentOutOfRangeException>(() => sut.Convert("abcd", -7));
+        }
+
+        [Fact]
+        public void Convert_ThrowsForZeroNumRows()
+        {
+            Assert.Throws<ArgumentOutOfRangeException>(() => sut.Convert("abcd", 0));
+        }
+
+        [Fact]
+        public void Convert_ReturnsTheSameInputForSingleRow()
+        {
+            const string input = "asdfoasdf";
+            Assert.Equal(input, sut.Convert(input, 1));
+        }
     }
 }


compile out

compile out

--- unity-proj/Assets/BetterDefines/Editor/PlatformUtils.cs
+++ unity-proj/Assets/BetterDefines/Editor/PlatformUtils.cs
@@ -14,7 +14,6 @@
         public const string STANDALONE_PLATFORM_ID = "Standalone";
         public const string ANDROID_PLATFORM_ID = "Android";
         public const string IOS_PLATFORM_ID = "iPhone";
-        public const string TV_OS_PLATFORM_ID = "tvOS";
         public const string BLACKBERRY_PLATFORM_ID = "BlackBerry";
         public const string TIZEN_PLATFORM_ID = "Tizen";
         public const string XBOX360_PLATFORM_ID = "XBox360";
@@ -23,11 +22,15 @@
         public const string PS_VITA_PLATFORM_ID = "PSP2";
         public const string PS4_PLATFORM_ID = "PS4";
         public const string GLESEMU_PLATFORM_ID = "StandaloneGLESEmu";
-        public const string WIIU_PLATFORM_ID = "WiiU";
         public const string WINDOWS_STORE_PLATFORM_ID = "Metro";
         public const string WEB_GL_PLATFORM_ID = "WebGL";
         public const string SAMSUNG_TV_PLATFORM_ID = "SamsungTV";
+
+#if UNITY_5_3_2
         public const string NINTENDO_3DS_PLATFORM_ID = "N3DS";
+        public const string TV_OS_PLATFORM_ID = "tvOS";
+        public const string WIIU_PLATFORM_ID = "WiiU";
+#endif

         private static readonly List<BuildPlatform> _allBuildPlatforms;
         private static readonly Dictionary<string, BuildTargetGroup> _buildTargetGroups;
@@ -46,7 +49,9 @@
                 new BuildPlatform("PC, Mac & Linux Standalone", STANDALONE_PLATFORM_ID, true, LoadPlatformIcon(STANDALONE_PLATFORM_ID)),
                 new BuildPlatform("Android", ANDROID_PLATFORM_ID, true, LoadPlatformIcon(ANDROID_PLATFORM_ID)),
                 new BuildPlatform("iOS", IOS_PLATFORM_ID, true, LoadPlatformIcon(IOS_PLATFORM_ID)),
+#if UNITY_5_3_2
                 new BuildPlatform("tvOS", TV_OS_PLATFORM_ID, true, LoadPlatformIcon(TV_OS_PLATFORM_ID)),
+#endif
                 new BuildPlatform("BlackBerry", BLACKBERRY_PLATFORM_ID, true, LoadPlatformIcon(BLACKBERRY_PLATFORM_ID)),
                 new BuildPlatform("Tizen", TIZEN_PLATFORM_ID, true, LoadPlatformIcon(TIZEN_PLATFORM_ID)),
                 new BuildPlatform("Xbox 360", XBOX360_PLATFORM_ID, true, LoadPlatformIcon(XBOX360_PLATFORM_ID)),
@@ -56,11 +61,13 @@
                 new BuildPlatform("PS4", PS4_PLATFORM_ID, true, LoadPlatformIcon(PS4_PLATFORM_ID)),
                 // TODO GLES Emulator - what is this?
                 //new BuildPlatform("GLES Emulator", GLESEMU_PLATFORM_ID, true, LoadPlatformIcon(GLESEMU_PLATFORM_ID)),
+#if UNITY_5_3_2
                 new BuildPlatform("Wii U", WIIU_PLATFORM_ID, true, LoadPlatformIcon(WIIU_PLATFORM_ID)),
+                new BuildPlatform("Nintendo 3DS", NINTENDO_3DS_PLATFORM_ID, true, LoadPlatformIcon(NINTENDO_3DS_PLATFORM_ID)),
+#endif
                 new BuildPlatform("Windows Store", WINDOWS_STORE_PLATFORM_ID, true, LoadPlatformIcon(WINDOWS_STORE_PLATFORM_ID)),
                 new BuildPlatform("WebGL", WEB_GL_PLATFORM_ID, true, LoadPlatformIcon(WEB_GL_PLATFORM_ID)),
                 new BuildPlatform("Samsung TV", SAMSUNG_TV_PLATFORM_ID, true, LoadPlatformIcon(SAMSUNG_TV_PLATFORM_ID)),
-                new BuildPlatform("Nintendo 3DS", NINTENDO_3DS_PLATFORM_ID, true, LoadPlatformIcon(NINTENDO_3DS_PLATFORM_ID))
             };
         }

@@ -72,7 +79,12 @@
                 {STANDALONE_PLATFORM_ID, BuildTargetGroup.Standalone},
                 {ANDROID_PLATFORM_ID, BuildTargetGroup.Android},
                 {IOS_PLATFORM_ID, BuildTargetGroup.iOS},
+#if UNITY_5_3_2
                 {TV_OS_PLATFORM_ID, BuildTargetGroup.tvOS},
+                {NINTENDO_3DS_PLATFORM_ID, BuildTargetGroup.Nintendo3DS},
+                {WIIU_PLATFORM_ID, BuildTargetGroup.WiiU},
+#endif
+
 #if !UNITY_5
                 { IOS_PLATFORM_ID, BuildTargetGroup.iPhone },
 #endif
@@ -83,11 +95,9 @@
                 {PS3_PLATFORM_ID, BuildTargetGroup.PS3},
                 {PS_VITA_PLATFORM_ID, BuildTargetGroup.PSP2},
                 {PS4_PLATFORM_ID, BuildTargetGroup.PS4},
-                {WIIU_PLATFORM_ID, BuildTargetGroup.WiiU},
                 {WINDOWS_STORE_PLATFORM_ID, BuildTargetGroup.WSA},
                 {WEB_GL_PLATFORM_ID, BuildTargetGroup.WebGL},
                 {SAMSUNG_TV_PLATFORM_ID, BuildTargetGroup.SamsungTV},
-                {NINTENDO_3DS_PLATFORM_ID, BuildTargetGroup.Nintendo3DS}
             };
         }


Correct process stop handling for Demo console app.

--- Resonance.Demo/Program.cs
+++ Resonance.Demo/Program.cs
@@ -16,7 +16,7 @@
 {
     public class Program
     {
-        private const int WORKER_COUNT = 4; // Multiple parallel workers, to make sure any issues related to parallellisation occur, if any.
+        private const int WORKER_COUNT = 1; // Multiple parallel workers, to make sure any issues related to parallellisation occur, if any.
         // 1=1750
         // 2=3350
         // 4=6000
@@ -118,8 +118,13 @@
                 workers[i] = CreateWorker(consumer, "Demo Subscription 1");
                 workers[i].Start();
             }
-            Console.WriteLine("Press a key to stop the worker(s)...");
-            Console.ReadKey();
+
+            // Wait for a user to press Ctrl+C or when windows sends the stop process signal
+            Console.WriteLine("Press Ctrl+C to stop the worker(s)...");
+            var handle = new ManualResetEvent(false);
+            Console.CancelKeyPress += (s, e) => { handle.Set(); e.Cancel = true; }; // Cancel must be true, to make sure the process is not killed and we can clean up nicely below
+            handle.WaitOne();
+
             for (int i = 0; i < WORKER_COUNT; i++)
             {
                 if (workers[i].IsRunning())
@@ -139,8 +144,12 @@
                 {
                     //Console.WriteLine($"Consumed {ceW.Id} from thread {System.Threading.Thread.CurrentThread.ManagedThreadId}.");
                     await Task.Delay(1);
+
                     if (DateTime.UtcNow.Millisecond == 1)
                         throw new Exception("Sorry");
+
+                    if (DateTime.UtcNow.Millisecond > 200)
+                        return ConsumeResult.MustRetry("Retry nodig");

                     return ConsumeResult.Succeeded;
                 },


* Fix a bug in the SnapshotConfig class that causes the percentiles to not be measured.

--- src/platform/toolkit/metrics/library/core/SnapshotConfig.cs
+++ src/platform/toolkit/metrics/library/core/SnapshotConfig.cs
@@ -109,9 +109,9 @@
         Percentiles = new double[percentiles.Length];
         for (int i = 0; i < percentiles.Length; i++) {
           double percentile = percentiles[i];
-          if (percentile < 0.0 || percentile > 1.0) {
+          if (percentile < 0.0 || percentile > 100.0) {
             throw new ArgumentOutOfRangeException("percentiles",
-              Resources.ArgIsNotInRange.Fmt(0.0, 1.0));
+              Resources.ArgIsNotInRange.Fmt(0.0, 100.0));
           }
           Percentiles[i] = percentile;
         }
@@ -179,8 +179,12 @@
       ComputeMin = builder.ComputeMin;
       ComputeStdDev = builder.ComputeStdDev;

-      Percentiles = new double[builder.Percentiles.Length];
-      Array.Copy(Percentiles, builder.Percentiles, builder.Percentiles.Length);
+      double[] percentiles = builder.Percentiles;
+      int length = percentiles.Length;
+      Percentiles = new double[length];
+      for (int i = 0; i < length; i++) {
+        Percentiles[i] = percentiles[i]/100.0;
+      }
     }

     /// <summary>


Changed NullReferenceException to InvalidOperationException

--- src/plug-ins/motoi.platform.ui/factories/FactoryProvider.cs
+++ src/plug-ins/motoi.platform.ui/factories/FactoryProvider.cs
@@ -66,7 +66,7 @@
         protected override void OnInitialize() {
             ILog logWriter = LogManager.GetLogger(typeof(FactoryProvider));
             IConfigurationElement[] configurationElements = ExtensionService.Instance.GetConfigurationElements(FactoryExtensionPointId);
-            if (configurationElements.Length == 0) throw new NullReferenceException("There is no registered UI provider!");
+            if (configurationElements.Length == 0) throw new InvalidOperationException("There is no registered UI provider!");

             if (configurationElements.Length > 1) {
                 string[] viewPartFactories = configurationElements.Select(x => x.Id).ToArray();


C# mvc: Add history creation for the first version of the file

--- web/documentserver-example/csharp-mvc/WebEditor.ashx.cs
+++ web/documentserver-example/csharp-mvc/WebEditor.ashx.cs
@@ -303,7 +303,7 @@
             var userAddress = context.Request["userAddress"];
             var fileName = Path.GetFileName(context.Request["fileName"]);
             var status = (TrackerStatus) (int) fileData["status"];  // get status from the request body
-            var saved = 1;  // editing
+            var saved = 0;  // editing
             switch (status)
             {
                 case TrackerStatus.Editing:


Fix ci issues

Fix ci issues

--- osu.Framework.Tests/Bindables/BindableNumberTest.cs
+++ osu.Framework.Tests/Bindables/BindableNumberTest.cs
@@ -39,11 +39,11 @@

             object bindable = createBindable(type);

-            MethodInfo setMethod = bindable.GetType().GetMethod(nameof(BindableNumber<int>.Set), BindingFlags.Public | BindingFlags.Instance).MakeGenericMethod(type);
-            setMethod.Invoke(bindable, new[] { expectedValue });
+            MethodInfo setMethod = bindable.GetType().GetMethod(nameof(BindableNumber<int>.Set), BindingFlags.Public | BindingFlags.Instance)?.MakeGenericMethod(type);
+            setMethod?.Invoke(bindable, new[] { expectedValue });

             PropertyInfo valueProperty = bindable.GetType().GetProperty(nameof(BindableNumber<int>.Value), BindingFlags.Public | BindingFlags.Instance);
-            object value = valueProperty.GetValue(bindable);
+            object value = valueProperty?.GetValue(bindable);

             Assert.That(Convert.ChangeType(value, typeof(int)), Is.EqualTo(expectedValue));
         }
@@ -55,15 +55,15 @@

             object bindable = createBindable(type);

-            MethodInfo addMethod = bindable.GetType().GetMethod(nameof(BindableNumber<int>.Add), BindingFlags.Public | BindingFlags.Instance).MakeGenericMethod(type);
-            addMethod.Invoke(bindable, new[] { expectedValue });
+            MethodInfo addMethod = bindable.GetType().GetMethod(nameof(BindableNumber<int>.Add), BindingFlags.Public | BindingFlags.Instance)?.MakeGenericMethod(type);
+            addMethod?.Invoke(bindable, new[] { expectedValue });

             PropertyInfo valueProperty = bindable.GetType().GetProperty(nameof(BindableNumber<int>.Value), BindingFlags.Public | BindingFlags.Instance);
-            object value = valueProperty.GetValue(bindable);
+            object value = valueProperty?.GetValue(bindable);

             Assert.That(Convert.ChangeType(value, typeof(int)), Is.EqualTo(expectedValue));
         }

-        private object createBindable(Type type) => Activator.CreateInstance(typeof(BindableNumber<>).MakeGenericType(type), new[] { Convert.ChangeType(0, type) });
+        private object createBindable(Type type) => Activator.CreateInstance(typeof(BindableNumber<>).MakeGenericType(type), Convert.ChangeType(0, type));
     }
 }


Fix `UIEvent.Target` not set on event propagation

--- osu.Framework/Input/Bindings/KeyBindingContainer.cs
+++ osu.Framework/Input/Bindings/KeyBindingContainer.cs
@@ -1,10 +1,10 @@
 // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
 // See the LICENCE file in the repository root for full licence text.

+using System;
 using System.Collections.Generic;
 using System.Linq;
 using osu.Framework.Allocation;
-using osu.Framework.Extensions.IEnumerableExtensions;
 using osu.Framework.Graphics;
 using osu.Framework.Graphics.Containers;
 using osu.Framework.Input.Events;
@@ -268,13 +268,13 @@
                 if (scrollAmount != 0)
                 {
                     var scrollEvent = new KeyBindingScrollEvent<T>(state, pressed, scrollAmount, isPrecise);
-                    handled = (Drawable)drawables.OfType<IScrollBindingHandler<T>>().FirstOrDefault(d => d.OnScroll(scrollEvent));
+                    handled = drawables.FirstOrDefault(d => triggerKeyBindingEvent(d, scrollEvent));
                 }

                 if (handled == null)
                 {
                     var pressEvent = new KeyBindingPressEvent<T>(state, pressed, repeat);
-                    handled = (Drawable)drawables.OfType<IKeyBindingHandler<T>>().FirstOrDefault(d => d.OnPressed(pressEvent));
+                    handled = drawables.FirstOrDefault(d => triggerKeyBindingEvent(d, pressEvent));
                 }
             }

@@ -295,7 +295,7 @@
                 var releaseEvent = new KeyBindingReleaseEvent<T>(state, action);

                 foreach (var kvp in keyBindingQueues.Where(k => EqualityComparer<T>.Default.Equals(k.Key.GetAction<T>(), action)))
-                    kvp.Value.OfType<IKeyBindingHandler<T>>().ForEach(d => d.OnReleased(releaseEvent));
+                    kvp.Value.ForEach(d => triggerKeyBindingEvent(d, releaseEvent));
             }

             pressedActions.Clear();
@@ -334,7 +334,7 @@
                 var releaseEvent = new KeyBindingReleaseEvent<T>(state, released);

                 foreach (var d in drawables.OfType<IKeyBindingHandler<T>>())
-                    d.OnReleased(releaseEvent);
+                    triggerKeyBindingEvent(d, releaseEvent);

                 pressedActions.Remove(released);
             }
@@ -363,6 +363,27 @@
                 currentQueue.AddRange(KeyBindingInputQueue);

             return currentQueue;
+        }
+
+        private bool triggerKeyBindingEvent(IDrawable drawable, KeyBindingEvent<T> e)
+        {
+            e.Target = (Drawable)drawable;
+
+            switch (e)
+            {
+                case KeyBindingPressEvent<T> press:
+                    return (drawable as IKeyBindingHandler<T>)?.OnPressed(press) ?? false;
+
+                case KeyBindingReleaseEvent<T> release:
+                    (drawable as IKeyBindingHandler<T>)?.OnReleased(release);
+                    return false;
+
+                case KeyBindingScrollEvent<T> scroll:
+                    return (drawable as IScrollBindingHandler<T>)?.OnScroll(scroll) ?? false;
+
+                default:
+                    throw new ArgumentOutOfRangeException(nameof(e));
+            }
         }
     }


Use slightly closer values

Use slightly closer values

--- osu.Game.Rulesets.Osu.Tests/TestSceneSliderInput.cs
+++ osu.Game.Rulesets.Osu.Tests/TestSceneSliderInput.cs
@@ -300,7 +300,7 @@
             {
                 new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_slider_start },
                 new OsuReplayFrame { Position = new Vector2(0, OsuHitObject.OBJECT_RADIUS * 1.19f), Actions = { OsuAction.LeftButton }, Time = time_slider_start + 100 },
-                new OsuReplayFrame { Position = new Vector2(slider_path_length, OsuHitObject.OBJECT_RADIUS * 1.19f), Actions = { OsuAction.LeftButton }, Time = time_slider_end },
+                new OsuReplayFrame { Position = new Vector2(slider_path_length, OsuHitObject.OBJECT_RADIUS * 1.199f), Actions = { OsuAction.LeftButton }, Time = time_slider_end },
             });

             AddAssert("Tracking kept", assertGreatJudge);
@@ -321,7 +321,7 @@
             {
                 new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_slider_start },
                 new OsuReplayFrame { Position = new Vector2(0, OsuHitObject.OBJECT_RADIUS * 1.21f), Actions = { OsuAction.LeftButton }, Time = time_slider_start + 100 },
-                new OsuReplayFrame { Position = new Vector2(slider_path_length, OsuHitObject.OBJECT_RADIUS * 1.21f), Actions = { OsuAction.LeftButton }, Time = time_slider_end },
+                new OsuReplayFrame { Position = new Vector2(slider_path_length, OsuHitObject.OBJECT_RADIUS * 1.201f), Actions = { OsuAction.LeftButton }, Time = time_slider_end },
             });

             AddAssert("Tracking dropped", assertMidSliderJudgementFail);


Add test coverage

Add test coverage

--- osu.Game.Tests/NonVisual/CustomDataDirectoryTest.cs
+++ osu.Game.Tests/NonVisual/CustomDataDirectoryTest.cs
@@ -7,14 +7,23 @@
 using System.Threading.Tasks;
 using NUnit.Framework;
 using osu.Framework.Allocation;
+using osu.Framework.Configuration;
 using osu.Framework.Platform;
 using osu.Game.Configuration;
+using osu.Game.IO;

 namespace osu.Game.Tests.NonVisual
 {
     [TestFixture]
     public class CustomDataDirectoryTest
     {
+        [SetUp]
+        public void SetUp()
+        {
+            if (Directory.Exists(customPath))
+                Directory.Delete(customPath, true);
+        }
+
         [Test]
         public void TestDefaultDirectory()
         {
@@ -36,6 +45,8 @@
             }
         }

+        private string customPath => Path.Combine(Environment.CurrentDirectory, "custom-path");
+
         [Test]
         public void TestCustomDirectory()
         {
@@ -49,7 +60,7 @@
                 storage.DeleteDirectory(string.Empty);

                 using (var storageConfig = new StorageConfigManager(storage))
-                    storageConfig.Set(StorageConfig.FullPath, Path.Combine(Environment.CurrentDirectory, "custom-path"));
+                    storageConfig.Set(StorageConfig.FullPath, customPath);

                 try
                 {
@@ -58,7 +69,52 @@
                     // switch to DI'd storage
                     storage = osu.Dependencies.Get<Storage>();

-                    Assert.That(storage.GetFullPath("."), Is.EqualTo(Path.Combine(Environment.CurrentDirectory, "custom-path")));
+                    Assert.That(storage.GetFullPath("."), Is.EqualTo(customPath));
+                }
+                finally
+                {
+                    host.Exit();
+                }
+            }
+        }
+
+        [Test]
+        public void TestMigration()
+        {
+            using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestMigration)))
+            {
+                try
+                {
+                    var osu = loadOsu(host);
+                    var storage = osu.Dependencies.Get<Storage>();
+
+                    // ensure we perform a save
+                    host.Dependencies.Get<FrameworkConfigManager>().Save();
+
+                    // ensure we "use" cache
+                    host.Storage.GetStorageForDirectory("cache");
+
+                    string defaultStorageLocation = Path.Combine(Environment.CurrentDirectory, "headless", nameof(TestMigration));
+
+                    Assert.That(storage.GetFullPath("."), Is.EqualTo(defaultStorageLocation));
+
+                    (storage as OsuStorage)?.Migrate(customPath);
+
+                    Assert.That(storage.GetFullPath("."), Is.EqualTo(customPath));
+
+                    foreach (var file in OsuStorage.IGNORE_FILES)
+                    {
+                        Assert.That(host.Storage.Exists(file), Is.True);
+                        Assert.That(storage.Exists(file), Is.False);
+                    }
+
+                    foreach (var dir in OsuStorage.IGNORE_DIRECTORIES)
+                    {
+                        Assert.That(host.Storage.ExistsDirectory(dir), Is.True);
+                        Assert.That(storage.ExistsDirectory(dir), Is.False);
+                    }
+
+                    Assert.That(new StreamReader(host.Storage.GetStream("storage.ini")).ReadToEnd().Contains($"FullPath = {customPath}"));
                 }
                 finally
                 {


Move loader hiding to a better place.

Move loader hiding to a better place.

--- osu.Game/Screens/Select/Leaderboards/Leaderboard.cs
+++ osu.Game/Screens/Select/Leaderboards/Leaderboard.cs
@@ -51,6 +51,8 @@

                 if (scores == null)
                     return;
+
+                loading.Hide();

                 if (scores.Count() == 0)
                 {
@@ -191,7 +193,6 @@
             getScoresRequest.Success += r =>
             {
                 Scores = r.Scores;
-                loading.Hide();
             };
             api.Queue(getScoresRequest);
         }


ExpressionSample - more string tests

ExpressionSample - more string tests

--- projects/ExpressionSample/GWExpr.Test/Atoms.cs
+++ projects/ExpressionSample/GWExpr.Test/Atoms.cs
@@ -19,6 +19,8 @@
         }

         [InlineData("\"1\"", "StringLiteral(\"1\")")]
+        [InlineData("\"\"", "StringLiteral(\"\")")]
+        [InlineData("\"string with spaces\"", "StringLiteral(\"string with spaces\")")]
         [Theory]
         public void Strings(string input, string output)
         {


Added AddMultipartFormDataContent method for formData requests body

--- RestClient/RESTRequest.cs
+++ RestClient/RESTRequest.cs
@@ -38,6 +38,23 @@
         public void AddContent(HttpContent content)
         {
             this.content = content;
+        }
+        /// <summary>
+        /// Add a new MultipartFormDataContent to HTTPContent request. Be careful, it overwrite the previous HTTPContent, if it exists
+        /// </summary>
+        /// <param name="key"></param>
+        /// <param name="value"></param>
+        public void AddMultipartFormDataContent(string key, string value)
+        {
+            if(this.content != null && this.content.GetType() != typeof(MultipartFormDataContent))
+            {
+                this.content = new MultipartFormDataContent();
+                (this.content as MultipartFormDataContent).Add(new StringContent(value), key);
+            }
+            else
+            {
+                (this.content as MultipartFormDataContent).Add(new StringContent(value), key);
+            }
         }
         /// <summary>
         /// Add header to the request


Fix recursion

Fix recursion

--- RevitLookup/Core/Utils.cs
+++ RevitLookup/Core/Utils.cs
@@ -363,10 +363,13 @@
         return widthArray;
     }

-    public static TreeNode GetRootNode(TreeNode node)
-    {
-        if (node.Parent is null) return node;
-        return GetRootNode(node.Parent);
+    private static TreeNode GetRootNode(TreeNode node)
+    {
+        while (true)
+        {
+            if (node.Parent is null) return node;
+            node = node.Parent;
+        }
     }

     public static string GetPrintDocumentName(TreeNode node)


Correcting spelling mistake Addresss to Addresses.

--- Accounting/Wilson.Accounting.Data/AccountingDbContext.cs
+++ Accounting/Wilson.Accounting.Data/AccountingDbContext.cs
@@ -20,7 +20,7 @@
         public virtual DbSet<Payment> Payments { get; set; }
         public virtual DbSet<Price> Prices { get; set; }
         public virtual DbSet<Storehouse> Storehouses { get; set; }
-        public virtual DbSet<Address> Addresss { get; set; }
+        public virtual DbSet<Address> Addresses { get; set; }
         public virtual DbSet<Company> Companies { get; set; }
         public virtual DbSet<Employee> Employees { get; set; }
         public virtual DbSet<Project> Projects { get; set; }


Update IMessageSource.cs

Update IMessageSource.cs

--- Archimedes.Localisation/MessageSources/IMessageSource.cs
+++ Archimedes.Localisation/MessageSources/IMessageSource.cs
@@ -13,7 +13,7 @@
     public interface IMessageSource
     {
         /// <summary>
-        /// Load all localized messages in the given culture and returns them in a PropertyStore
+        /// Load all localized messages in the given culture and returns them in a Dictionary
         /// </summary>
         /// <param name="culture"></param>
         /// <returns></returns>


Split GUI for PrimitiveCreatorWindow into functions

--- Assets/PrimativeCreator/Editor/PrimitiveCreatorWindow.cs
+++ Assets/PrimativeCreator/Editor/PrimitiveCreatorWindow.cs
@@ -53,8 +53,29 @@

         private void OnGUI()
         {
+            this.DrawConfigPresetSelectionGUI();
+
+            EditorGUILayout.Space();
+
+            this.DrawConfigGUI();
+
+            EditorGUILayout.Space();
+
+            if (GUILayout.Button(this.createPrimitiveButtonLabel))
+            {
+                GameObject shape = PrimitiveCreator.CreatePrimitive(this.currentConfig);
+
+                Selection.activeGameObject = shape;
+            }
+
+            this.SaveSettings();
+        }
+
+        private void DrawConfigPresetSelectionGUI()
+        {
             EditorGUILayout.BeginHorizontal();

+            // Check for changes so that we can load in the new Config as it's selected.
             EditorGUI.BeginChangeCheck();
             this.selectedConfigPreset = EditorGUILayout.Popup(
                 this.savedConfigLabel,
@@ -66,49 +87,60 @@
                 this.LoadConfigPresetByIndex(this.selectedConfigPreset);
             }

-            EditorGUI.BeginDisabledGroup(this.saveData.HasConfigForIndex(this.selectedConfigPreset));
+            var isConfigPresetSelected = this.saveData.HasConfigForIndex(this.selectedConfigPreset);
+            EditorGUI.BeginDisabledGroup(isConfigPresetSelected);
             if (GUILayout.Button(this.saveButtonLabel))
             {
                 var namePresetWindow = PrimitiveCreatorNamePresetWindow.Show("Name Preset");

-                namePresetWindow.NameSaved.AddListener((string name) =>
-                    {
-                        this.currentConfig.Name = name;
-                        this.saveData.ConfigPresets.Add(this.currentConfig);
-                        this.PopulateConfigPresetsDropdown();
-
-                        this.selectedConfigPreset = this.saveData.ConfigPresets.Count - 1;
-                        this.LoadConfigPresetByIndex(this.selectedConfigPreset);
-                    });
+                namePresetWindow.NameSaved.AddListener(SaveSelectedPreset);
             }
             EditorGUI.EndDisabledGroup();

-            EditorGUI.BeginDisabledGroup(!this.saveData.HasConfigForIndex(this.selectedConfigPreset));
+            EditorGUI.BeginDisabledGroup(!isConfigPresetSelected);
             if (GUILayout.Button(this.renameButtonLabel))
             {
                 var namePresetWindow = PrimitiveCreatorNamePresetWindow.Show("Rename Preset",
                                            this.currentConfig.Name);

-                namePresetWindow.NameSaved.AddListener((string name) =>
-                    {
-                        this.currentConfig.Name = name;
-                        this.PopulateConfigPresetsDropdown();
-                    });
+                namePresetWindow.NameSaved.AddListener(RenameSelectedPreset);
             }

             if (GUILayout.Button(this.deleteButtonLabel))
             {
-                this.saveData.ConfigPresets.Remove(this.currentConfig);
-                this.selectedConfigPreset = this.saveData.ConfigPresets.Count;
-                this.PopulateConfigPresetsDropdown();
-                this.LoadConfigPresetByIndex(this.selectedConfigPreset);
+                this.DeleteSelectedPreset();
             }

             EditorGUI.EndDisabledGroup();
             EditorGUILayout.EndHorizontal();
-
-            EditorGUILayout.Space();
-
+        }
+
+        private void SaveSelectedPreset(string name)
+        {
+            this.currentConfig.Name = name;
+            this.saveData.ConfigPresets.Add(this.currentConfig);
+            this.PopulateConfigPresetsDropdown();
+
+            this.selectedConfigPreset = this.saveData.ConfigPresets.Count - 1;
+            this.LoadConfigPresetByIndex(this.selectedConfigPreset);
+        }
+
+        private void RenameSelectedPreset(string name)
+        {
+            this.currentConfig.Name = name;
+            this.PopulateConfigPresetsDropdown();
+        }
+
+        private void DeleteSelectedPreset()
+        {
+            this.saveData.ConfigPresets.Remove(this.currentConfig);
+            this.selectedConfigPreset = this.saveData.ConfigPresets.Count;
+            this.PopulateConfigPresetsDropdown();
+            this.LoadConfigPresetByIndex(this.selectedConfigPreset);
+        }
+
+        private void DrawConfigGUI()
+        {
             EditorGUILayout.LabelField(this.configHeaderLabel, EditorStyles.boldLabel);
             this.currentConfig.PrimitiveType = (PrimitiveType)EditorGUILayout.EnumPopup(
                 this.primitiveTypeLabel,
@@ -117,20 +149,9 @@
             this.currentConfig.UniformScale = EditorGUILayout.FloatField(
                 this.uniformScaleLabel,
                 this.currentConfig.UniformScale);
-
+
             this.currentConfig.Color = (PrimitiveCreator.Config.PrimitiveColor)
                 EditorGUILayout.EnumPopup(this.colorLabel, this.currentConfig.Color);
-
-            EditorGUILayout.Space();
-
-            if (GUILayout.Button(this.createPrimitiveButtonLabel))
-            {
-                GameObject shape = PrimitiveCreator.CreatePrimitive(this.currentConfig);
-
-                Selection.activeGameObject = shape;
-            }
-
-            this.SaveSettings();
         }

         private void LoadSaveData()
@@ -170,6 +191,7 @@
             }
             else
             {
+                // When no config data is found, use whatever the user last entered in
                 this.currentConfig = new PrimitiveCreator.Config();

                 this.currentConfig.PrimitiveType = (PrimitiveType)
@@ -186,6 +208,7 @@
         {
             EditorPrefs.SetInt(PrimitiveCreatorPrefKeys.PreviousConfigIndex, this.selectedConfigPreset);

+            // Remember what the user last entered for unsaved presets
             if (!this.saveData.HasConfigForIndex(this.selectedConfigPreset))
             {
                 EditorPrefs.SetInt(PrimitiveCreatorPrefKeys.Color, (int)this.currentConfig.PrimitiveType);


Minor refactoring

Minor refactoring

--- CSharpQuickReference/CSharpQuickReference/src/Structs.cs
+++ CSharpQuickReference/CSharpQuickReference/src/Structs.cs
@@ -39,6 +39,7 @@
         public structEntity(string color)
         {
             this.color = color;
+            this.Color = color;
         }

         public string Describe()


add hack for new amd opengl driver version format

--- CompatBot/Database/Providers/AmdDriverVersionProvider.cs
+++ CompatBot/Database/Providers/AmdDriverVersionProvider.cs
@@ -13,6 +13,7 @@
 {
     private static readonly Dictionary<string, List<string>> VulkanToDriver = new();
     private static readonly Dictionary<string, string> OpenglToDriver = new();
+    private static readonly Dictionary<string, string> InternalToDriver = new();
     private static readonly SemaphoreSlim SyncObj = new(1, 1);

     public static async Task RefreshAsync()
@@ -33,18 +34,21 @@
                 {
                     var winVer = (string?)driver.Element("windows-version");
                     var vkVer = (string?)driver.Element("vulkan-version");
+                    var internVer = (string?)driver.Element("internal-version");
                     var driverVer = (string?)driver.Attribute("version");
                     if (vkVer is null)
                         continue;

                     if (!VulkanToDriver.TryGetValue(vkVer, out var verList))
-                        VulkanToDriver[vkVer] = verList = new List<string>();
+                        VulkanToDriver[vkVer] = verList = new();
                     if (string.IsNullOrEmpty(driverVer))
                         continue;

                     verList.Insert(0, driverVer);
                     if (!string.IsNullOrEmpty(winVer))
                         OpenglToDriver[winVer] = driverVer;
+                    if (!string.IsNullOrEmpty(internVer))
+                        InternalToDriver[internVer] = driverVer;
                 }
                 foreach (var key in VulkanToDriver.Keys.ToList())
                     VulkanToDriver[key] = VulkanToDriver[key].Distinct().ToList();
@@ -66,6 +70,9 @@

         if (!Version.TryParse(openglVersion, out var glVersion))
             return openglVersion;
+
+        if (glVersion is { Major: >= 22, Minor: < 13, Build: <10, Revision: > 220600 })
+            return $"{glVersion.Major}.{glVersion.Minor}.{glVersion.Build}";

         var glVersions = new List<(Version glVer, string driverVer)>(OpenglToDriver.Count);
         foreach (var key in OpenglToDriver.Keys)