Refactor MainWindow code layout

Refactor MainWindow code layout

--- src/DiabloInterface/Gui/MainWindow.cs
+++ src/DiabloInterface/Gui/MainWindow.cs
@@ -1,18 +1,18 @@
 using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Reflection;
+using System.Text;
+using System.Threading;
 using System.Windows.Forms;
-using System.Threading;
-using System.IO;
-using System.Collections.Generic;
-using System.Reflection;
+using Zutatensuppe.D2Reader;
+using Zutatensuppe.D2Reader.Struct.Item;
+using Zutatensuppe.DiabloInterface.Autosplit;
+using Zutatensuppe.DiabloInterface.Core.Logging;
+using Zutatensuppe.DiabloInterface.Gui.Forms;
 using Zutatensuppe.DiabloInterface.Server;
-using Zutatensuppe.DiabloInterface.Core.Logging;
-using System.Text;
-using Zutatensuppe.D2Reader;
-using Zutatensuppe.DiabloInterface.Gui.Forms;
-using Zutatensuppe.DiabloInterface.Autosplit;
+using Zutatensuppe.DiabloInterface.Server.Handlers;
 using Zutatensuppe.DiabloInterface.Settings;
-using Zutatensuppe.DiabloInterface.Server.Handlers;
-using Zutatensuppe.D2Reader.Struct.Item;

 namespace Zutatensuppe.DiabloInterface.Gui
 {
@@ -21,9 +21,8 @@
         static readonly ILogger Logger = LogServiceLocator.Get(MethodBase.GetCurrentMethod().DeclaringType);

         const string ItemServerPipeName = "DiabloInterfacePipe";
-        const string WindowTitleFormat = "Diablo Interface v{0}"; // {0} => Application.ProductVersion
-
-        public ApplicationSettings Settings { get; private set; }
+
+        ApplicationSettings Settings { get; set; }

         Thread dataReaderThread;

@@ -35,68 +34,26 @@

         public MainWindow()
         {
-            // We want to dispose our handles once the window is disposed.
-            Disposed += OnWindowDisposed;
-
+            RegisterWindowEventHandlers();
             InitializeComponent();
-
-            // Display current version along with the application name.
-            Text = string.Format(WindowTitleFormat, Application.ProductVersion);
-        }
-
-
-        protected override void OnFormClosing(FormClosingEventArgs e)
-        {
-            pipeServer.Stop();
-            base.OnFormClosing(e);
-        }
-
-        private void OnWindowDisposed(object sender, EventArgs e)
-        {
-            // Make sure the process handles close correctly.
-            if (dataReader != null)
-            {
-                dataReader.Dispose();
-                dataReader = null;
-            }
-        }
-
-        private ApplicationSettings LoadSettings()
-        {
-            var persistence = new SettingsPersistence();
-            var settings = persistence.Load();
-
-            if (settings == null)
-            {
-                Logger.Info("Loaded default settings.");
-
-                // Return default settings.
-                return new ApplicationSettings();
-            }
-
-            return settings;
-        }
-
-        private ApplicationSettings LoadSettings(string fileName)
-        {
-            var persistence = new SettingsPersistence();
-
-            ApplicationSettings settings = null;
-
-            if (fileName == String.Empty)
-                settings = persistence.Load();
-            else
-                settings = persistence.Load(fileName);
-
-            if (settings == null)
-            {
-                Logger.Info("Loaded default settings.");
-
-                // Return default settings.
-                return new ApplicationSettings();
-            }
-
-            return settings;
+        }
+
+        void RegisterWindowEventHandlers()
+        {
+            // These events are not exposed through the Designer.
+            Disposed += MainWindow_Disposed;
+        }
+
+        void MainWindow_Load(object sender, EventArgs e)
+        {
+            SetTitleWithApplicationVersion();
+            Initialize();
+        }
+
+        void SetTitleWithApplicationVersion()
+        {
+            Text = $@"Diablo Interface v{Application.ProductVersion}";
+            Update();
         }

         void Initialize()
@@ -120,17 +77,16 @@
             if (dataReader == null)
             {
                 dataReader = new D2DataReader(Settings.D2Version);
-                dataReader.NewCharacter += new NewCharacterCreatedEventHandler(this.d2Reader_NewCharacter);
-                dataReader.DataRead += new DataReadEventHandler(this.d2Reader_DataRead);
-                dataReader.DataReader += new DataReaderEventHandler(this.d2Reader_DataReader);
+                dataReader.NewCharacter += dataReader_NewCharacter;
+                dataReader.DataRead += dataReader_DataRead;
+                dataReader.DataReader += dataReader_DataReader;
             }

             InitializePipeServer();

             if (dataReaderThread == null)
             {
-                dataReaderThread = new Thread(dataReader.readDataThreadFunc);
-                dataReaderThread.IsBackground = true;
+                dataReaderThread = new Thread(dataReader.readDataThreadFunc) {IsBackground = true};
                 dataReaderThread.Start();
             }

@@ -140,6 +96,44 @@
             }

             ApplySettings(Settings);
+        }
+
+        ApplicationSettings LoadSettings()
+        {
+            var persistence = new SettingsPersistence();
+            var settings = persistence.Load();
+
+            if (settings == null)
+            {
+                Logger.Info("Loaded default settings.");
+
+                // Return default settings.
+                return new ApplicationSettings();
+            }
+
+            return settings;
+        }
+
+        ApplicationSettings LoadSettings(string fileName)
+        {
+            var persistence = new SettingsPersistence();
+
+            ApplicationSettings settings;
+
+            if (fileName == String.Empty)
+                settings = persistence.Load();
+            else
+                settings = persistence.Load(fileName);
+
+            if (settings == null)
+            {
+                Logger.Info("Loaded default settings.");
+
+                // Return default settings.
+                return new ApplicationSettings();
+            }
+
+            return settings;
         }

         void InitializePipeServer()
@@ -149,7 +143,7 @@

             pipeServer = new DiabloInterfaceServer(ItemServerPipeName);
             pipeServer.AddRequestHandler(@"version", () =>
-                new VersionRequestHandler(System.Reflection.Assembly.GetEntryAssembly()));
+                new VersionRequestHandler(Assembly.GetEntryAssembly()));
             pipeServer.AddRequestHandler(@"items", () =>
                 new AllItemsRequestHandler(dataReader));
             pipeServer.AddRequestHandler(@"items/(\w+)", () =>
@@ -160,26 +154,109 @@
                 new QuestRequestHandler(dataReader));
         }

-        void d2Reader_DataReader(object sender, DataReaderEventArgs e)
+        void ApplySettings(ApplicationSettings settings)
+        {
+            if (InvokeRequired)
+            {
+                // Delegate call to UI thread.
+                Invoke((Action)(() => ApplySettings(settings)));
+                return;
+            }
+
+            Settings = settings;
+
+            dataReader.SetD2Version(Settings.D2Version);
+
+            if (Settings.DisplayLayoutHorizontal)
+            {
+                verticalLayout2.MakeInactive();
+                horizontalLayout1.MakeActive(Settings);
+            }
+            else
+            {
+                horizontalLayout1.MakeInactive();
+                verticalLayout2.MakeActive(Settings);
+            }
+
+            // Update debug window.
+            if (debugWindow != null && debugWindow.Visible)
+            {
+                debugWindow.UpdateAutosplits(Settings.Autosplits);
+            }
+
+            LoadConfigFileList();
+            LogAutoSplits();
+        }
+
+        void LoadConfigFileList()
+        {
+            loadConfigMenuItem.DropDownItems.Clear();
+
+            List<ToolStripItem> items = new List<ToolStripItem>();
+            string settingsFolder = @".\Settings";
+
+            if (!Directory.Exists(settingsFolder))
+            {
+                Directory.CreateDirectory(settingsFolder);
+            }
+            DirectoryInfo di = new DirectoryInfo(settingsFolder);
+            foreach (FileInfo fi in di.GetFiles("*.conf", SearchOption.AllDirectories))
+            {
+                ToolStripMenuItem tsmi = new ToolStripMenuItem();
+                tsmi.Text = fi.Name.Substring(0, fi.Name.LastIndexOf('.'));
+                tsmi.Tag = fi.FullName;
+                tsmi.Click += LoadConfigFile;
+                items.Add(tsmi);
+            }
+
+            loadConfigMenuItem.DropDownItems.AddRange(items.ToArray());
+        }
+
+        void LoadConfigFile(object sender, EventArgs e)
+        {
+            var fileName = ((ToolStripMenuItem)sender).Tag.ToString();
+            var settings = LoadSettings(fileName);
+            Properties.Settings.Default.SettingsFile = fileName;
+            ApplySettings(settings);
+        }
+
+        void LogAutoSplits()
+        {
+            var logMessage = new StringBuilder();
+            logMessage.Append("Configured autosplits:");
+
+            for (var i = 0; i < Settings.Autosplits.Count; ++i)
+            {
+                var split = Settings.Autosplits[i];
+
+                logMessage.AppendLine();
+                logMessage.Append("  ");
+                logMessage.Append($"#{i} [{split.Type}, {split.Value}, {split.Difficulty}] \"{split.Name}\"");
+            }
+
+            Logger.Info(logMessage.ToString());
+        }
+
+        void dataReader_DataReader(object sender, DataReaderEventArgs e)
         {
             Logger.Info("Generic Data reader event: "+ e.type.ToString());
         }

-        void d2Reader_DataRead(object sender, DataReadEventArgs e)
-        {
-            this.UpdateLabels(e.Character, e.ItemClassMap);
-            this.WriteFiles(e.Character);
+        void dataReader_DataRead(object sender, DataReadEventArgs e)
+        {
+            UpdateLabels(e.Character, e.ItemClassMap);
+            WriteFiles(e.Character);

             UpdateDebugWindow(e.QuestBuffers, e.ItemStrings);

             // Update autosplits only if enabled and the character was a freshly started character.
-            if (e.IsAutosplitCharacter && this.Settings.DoAutosplit)
+            if (e.IsAutosplitCharacter && Settings.DoAutosplit)
             {
                 UpdateAutoSplits(e.QuestBuffers, e.CurrentArea, e.CurrentDifficulty, e.ItemIds, e.Character);
             }
         }

-        void d2Reader_NewCharacter(object sender, NewCharacterEventArgs e)
+        void dataReader_NewCharacter(object sender, NewCharacterEventArgs e)
         {
             Reset();
             Logger.Info($"A new character was created - autosplits OK for {e.Character.Name}");
@@ -195,8 +272,7 @@
             verticalLayout2.Reset();
         }

-
-        private void UpdateDebugWindow(Dictionary<int, ushort[]> questBuffers, Dictionary<BodyLocation, string> itemStrings)
+        void UpdateDebugWindow(Dictionary<int, ushort[]> questBuffers, Dictionary<BodyLocation, string> itemStrings)
         {
             if (debugWindow == null)
             {
@@ -215,7 +291,7 @@
             debugWindow.UpdateItemStats(itemStrings);
         }

-        private void UpdateAutoSplits(Dictionary<int, ushort[]> questBuffers, int areaId, byte difficulty, List<int> itemIds, Character character)
+        void UpdateAutoSplits(Dictionary<int, ushort[]> questBuffers, int areaId, byte difficulty, List<int> itemIds, Character character)
         {
             foreach (AutoSplit autosplit in Settings.Autosplits)
             {
@@ -229,20 +305,20 @@
                 }
                 if (autosplit.Value == (int)AutoSplit.Special.GameStart)
                 {
-                    CompleteAutoSplit(autosplit, character);
+                    CompleteAutoSplit(autosplit);
                 }
                 if (autosplit.Value == (int)AutoSplit.Special.Clear100Percent
                     && character.CompletedQuestCounts[difficulty] == D2QuestHelper.Quests.Count
                     && autosplit.MatchesDifficulty(difficulty))
                 {
-                    CompleteAutoSplit(autosplit, character);
+                    CompleteAutoSplit(autosplit);
                 }
                 if (autosplit.Value == (int)AutoSplit.Special.Clear100PercentAllDifficulties
                     && character.CompletedQuestCounts[0] == D2QuestHelper.Quests.Count
                     && character.CompletedQuestCounts[1] == D2QuestHelper.Quests.Count
                     && character.CompletedQuestCounts[2] == D2QuestHelper.Quests.Count)
                 {
-                    CompleteAutoSplit(autosplit, character);
+                    CompleteAutoSplit(autosplit);
                 }
             }

@@ -299,32 +375,32 @@
                     case AutoSplit.SplitType.CharLevel:
                         if (autosplit.Value <= character.Level)
                         {
-                            CompleteAutoSplit(autosplit, character);
+                            CompleteAutoSplit(autosplit);
                         }
                         break;
                     case AutoSplit.SplitType.Area:
                         if (autosplit.Value == areaId)
                         {
-                            CompleteAutoSplit(autosplit, character);
+                            CompleteAutoSplit(autosplit);
                         }
                         break;
                     case AutoSplit.SplitType.Item:
                         if (itemIds.Contains(autosplit.Value))
                         {
-                            CompleteAutoSplit(autosplit, character);
+                            CompleteAutoSplit(autosplit);
                         }
                         break;
                     case AutoSplit.SplitType.Quest:
                         if (D2QuestHelper.IsQuestComplete((D2QuestHelper.Quest)autosplit.Value, questBuffer))
                         {
-                            CompleteAutoSplit(autosplit, character);
+                            CompleteAutoSplit(autosplit);
                         }
                         break;
                 }
             }
         }

-        void CompleteAutoSplit(AutoSplit autosplit, Character character)
+        void CompleteAutoSplit(AutoSplit autosplit)
         {
             // Autosplit already reached.
             if (autosplit.IsReached)
@@ -333,9 +409,9 @@
             }

             autosplit.IsReached = true;
-            TriggerAutosplit(character);
-
-            var autoSplitIndex = this.Settings.Autosplits.IndexOf(autosplit);
+            TriggerAutosplit();
+
+            var autoSplitIndex = Settings.Autosplits.IndexOf(autosplit);
             Logger.Info($"AutoSplit: #{autoSplitIndex} ({autosplit.Name}, {autosplit.Difficulty}) Reached.");
         }

@@ -356,7 +432,7 @@
             }
         }

-        void TriggerAutosplit(Character player)
+        void TriggerAutosplit()
         {
             if (Settings.DoAutosplit && Settings.AutosplitHotkey != Keys.None)
             {
@@ -366,7 +442,7 @@

         void WriteFiles(Character player)
         {
-            // todo: only write files if content changed
+            // TODO: Only write files if content changed.
             if (!Settings.CreateFiles)
             {
                 return;
@@ -395,83 +471,28 @@
             File.WriteAllText(Settings.FileFolder + "/ias.txt", player.IncreasedAttackSpeed.ToString());
         }

-        private void ApplySettings(ApplicationSettings settings)
-        {
-            if (InvokeRequired)
-            {
-                // Delegate call to UI thread.
-                Invoke((Action)(() => ApplySettings(settings)));
-                return;
-            }
-
-            Settings = settings;
-
-            dataReader.SetD2Version(Settings.D2Version);
-
-            if (Settings.DisplayLayoutHorizontal)
-            {
-                verticalLayout2.MakeInactive();
-                horizontalLayout1.MakeActive(Settings);
-            } else
-            {
-                horizontalLayout1.MakeInactive();
-                verticalLayout2.MakeActive(Settings);
-            }
-
-            // Update debug window.
-            if (debugWindow != null && debugWindow.Visible)
-            {
-                debugWindow.UpdateAutosplits(Settings.Autosplits);
-            }
-
-            LoadConfigFileList();
-            LogAutoSplits();
-        }
-
-        void LogAutoSplits()
-        {
-            var logMessage = new StringBuilder();
-            logMessage.Append("Configured autosplits:");
-
-            for (var i = 0; i < Settings.Autosplits.Count; ++i)
-            {
-                var split = Settings.Autosplits[i];
-
-                logMessage.AppendLine();
-                logMessage.Append("  ");
-                logMessage.Append($"#{i} [{split.Type}, {split.Value}, {split.Difficulty}] \"{split.Name}\"");
-            }
-
-            Logger.Info(logMessage.ToString());
-        }
-
-        private void exitMenuItem_Click(object sender, EventArgs e)
+        void exitMenuItem_Click(object sender, EventArgs e)
         {
             Close();
         }

-        private void resetMenuItem_Click(object sender, EventArgs e)
+        void resetMenuItem_Click(object sender, EventArgs e)
         {
             Reset();
         }

-        private void settingsMenuItem_Click(object sender, EventArgs e)
+        void settingsMenuItem_Click(object sender, EventArgs e)
         {
             if (settingsWindow == null || settingsWindow.IsDisposed)
             {
                 settingsWindow = new SettingsWindow(Settings);
-                settingsWindow.SettingsUpdated += (settings) => ApplySettings(settings);
+                settingsWindow.SettingsUpdated += ApplySettings;
             }

             settingsWindow.ShowDialog();
         }

-        private void MainWindow_Load(object sender, EventArgs e)
-        {
-            Initialize();
-        }
-
-        private void debugMenuItem_Click(object sender, EventArgs e)
+        void debugMenuItem_Click(object sender, EventArgs e)
         {
             if (debugWindow == null || debugWindow.IsDisposed)
             {
@@ -479,50 +500,33 @@
                 debugWindow.UpdateAutosplits(Settings.Autosplits);

                 dataReader.RequiredData |= D2DataReader.READ_EQUIPPED_ITEM_STRINGS;
-                // dataReader.RequiredData |= D2DataReader.DATA_QUEST_BUFFERS;
-
-                debugWindow.FormClosed += new FormClosedEventHandler(this.DebugWindow_FormClosed);
+
+                debugWindow.FormClosed += DebugWindow_FormClosed;
             }

             debugWindow.Show();
         }

-        private void DebugWindow_FormClosed(object sender, FormClosedEventArgs e)
+        void DebugWindow_FormClosed(object sender, FormClosedEventArgs e)
         {
             dataReader.RequiredData &= ~D2DataReader.READ_EQUIPPED_ITEM_STRINGS;
-            //dataReader.RequiredData &= ~D2DataReader.DATA_QUEST_BUFFERS;
-        }
-
-        private void LoadConfigFileList()
-        {
-            loadConfigMenuItem.DropDownItems.Clear();
-
-            List<ToolStripItem> items = new List<ToolStripItem>();
-            string settingsFolder = @".\Settings";
-
-            if (!Directory.Exists(settingsFolder))
-            {
-                Directory.CreateDirectory(settingsFolder);
-            }
-            DirectoryInfo di = new DirectoryInfo(settingsFolder);
-            foreach (FileInfo fi in di.GetFiles("*.conf", SearchOption.AllDirectories))
-            {
-                ToolStripMenuItem tsmi = new ToolStripMenuItem();
-                tsmi.Text = fi.Name.Substring(0,fi.Name.LastIndexOf('.'));
-                tsmi.Tag = fi.FullName;
-                tsmi.Click += LoadConfigFile;
-                items.Add(tsmi);
-            }
-
-            loadConfigMenuItem.DropDownItems.AddRange(items.ToArray());
-        }
-
-        private void LoadConfigFile(object sender, EventArgs e)
-        {
-            var fileName = ((ToolStripMenuItem)sender).Tag.ToString();
-            var settings = LoadSettings(fileName);
-            Properties.Settings.Default.SettingsFile = fileName;
-            ApplySettings(settings);
+        }
+
+        protected override void OnFormClosing(FormClosingEventArgs e)
+        {
+            pipeServer.Stop();
+            base.OnFormClosing(e);
+        }
+
+        void MainWindow_Disposed(object sender, EventArgs e)
+        {
+            DisposeDataReader();
+        }
+
+        void DisposeDataReader()
+        {
+            dataReader?.Dispose();
+            dataReader = null;
         }
     }
 }


partial batch norm implementation for conv. nn

--- BrightWire.Source/ExecutionGraph/Node/Layer/BatchNorm.cs
+++ BrightWire.Source/ExecutionGraph/Node/Layer/BatchNorm.cs
@@ -1,4 +1,5 @@
-using BrightWire.ExecutionGraph.Node.Input;
+using System;
+using BrightWire.ExecutionGraph.Node.Input;
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
@@ -78,10 +79,40 @@

 		public override void ExecuteForward(IContext context)
 		{
+			var data = context.Data;
+			IMatrix input;
+			IReadOnlyList<IVector> samples;
+			var lap = context.LinearAlgebraProvider;
+			var shouldDispose = false;
+
+			if (data.Depth > 1) {
+				// reshape the tensor by depth slice
+				var tensor4D = data.Get4DTensor();
+				var slots = new List<IVector>[data.Depth];
+				for (var i = 0; i < data.Depth; i++)
+					slots[i] = new List<IVector>();
+
+				foreach (var tensor in tensor4D.ReshapeAsMatrix().ColumnVectors()) {
+					var depthSlices = tensor.ReshapeAsColumnMatrix().ReshapeAsVector().Split(data.Depth);
+					for (var i = 0; i < data.Depth; i++)
+						slots[i].Add(depthSlices[i]);
+				}
+
+				// TODO: create row vectors from slots and matrix from rows
+
+				//input = lap.CreateMatrixFromRows(list);
+				//samples = list;
+				shouldDispose = true;
+				throw new NotImplementedException();
+			}
+			else {
+				input = context.Data.GetMatrix();
+				samples = input.RowVectors();
+			}
+
 			// collect statistics
 			if (context.IsTraining && _statistics != null) {
-				var input = context.Data.GetMatrix();
-				foreach (var vector in input.RowVectors()) {
+				foreach (var vector in samples) {
 					_statistics.Update(vector);
 					vector.Dispose();
 				}
@@ -103,16 +134,15 @@
 				}
 			}
 			else if(_statistics != null) {
-				var input = context.Data.GetMatrix();
-				if (_gammaCached?.IsValid != true)
+				if (_gammaCached?.IsValid != true || _gammaCached?.RowCount != input.RowCount || _gammaCached?.ColumnCount != input.ColumnCount)
 					_gammaCached = context.LinearAlgebraProvider.CreateMatrix(input.RowCount, input.ColumnCount, (x, y) => _gamma.Data[y]);
-				if(_betaCached?.IsValid != true)
+				if(_betaCached?.IsValid != true || _betaCached?.RowCount != input.RowCount || _betaCached?.ColumnCount != input.ColumnCount)
 					_betaCached = context.LinearAlgebraProvider.CreateMatrix(input.RowCount, input.ColumnCount, (x, y) => _beta.Data[y]);
-				if (_meanCached?.IsValid != true) {
+				if (_meanCached?.IsValid != true || _meanCached?.RowCount != input.RowCount || _meanCached?.ColumnCount != input.ColumnCount) {
 					var mean = _statistics.Mean;
 					_meanCached = context.LinearAlgebraProvider.CreateMatrixFromRows(Enumerable.Repeat(mean, input.RowCount).ToList());
 				}
-				if (_stdDevCached?.IsValid != true) {
+				if (_stdDevCached?.IsValid != true || _stdDevCached?.RowCount != input.RowCount || _stdDevCached?.ColumnCount != input.ColumnCount) {
 					using (var variance = _statistics.GetSampleVariance())
 					using (var stdDev = variance.Sqrt()) {
 						_stdDevCached = context.LinearAlgebraProvider.CreateMatrixFromRows(Enumerable.Repeat(stdDev, input.RowCount).ToList());
@@ -127,6 +157,11 @@
 					}
 				}
 			}
+
+			if (shouldDispose)
+				input.Dispose();
+			foreach (var item in samples)
+				item.Dispose();
 		}

 		protected override (string Description, byte[] Data) _GetInfo()
@@ -136,12 +171,9 @@

 		public override void WriteTo(BinaryWriter writer)
 		{
-			var gamma = (VectorInput)_input.FindByName("gamma");
-			var beta = (VectorInput)_input.FindByName("beta");
-
 			writer.Write(_inputSize);
-			gamma.WriteTo(writer);
-			beta.WriteTo(writer);
+			_gamma.WriteTo(writer);
+			_beta.WriteTo(writer);

 			writer.Write(_statistics.Count);
 			_statistics.Mean.Data.WriteTo(writer);


minor

minor

--- src/biz.dfch.CS.CoffeeTracker.Core/Controllers/UsersController.cs
+++ src/biz.dfch.CS.CoffeeTracker.Core/Controllers/UsersController.cs
@@ -1,18 +1,9 @@
-using System;
-using System.Collections.Generic;
-using System.Data;
-using System.Data.Entity;
-using System.Data.Entity.Infrastructure;
-using System.Diagnostics.Contracts;
+using System.Diagnostics.Contracts;
 using System.Linq;
 using System.Net;
-using System.Net.Http;
 using System.Threading.Tasks;
 using System.Web.Http;
-using System.Web.Http.ModelBinding;
 using System.Web.Http.OData;
-using System.Web.Http.OData.Routing;
-using biz.dfch.CS.CoffeeTracker.Core.DbContext;
 using biz.dfch.CS.CoffeeTracker.Core.Logging;
 using biz.dfch.CS.CoffeeTracker.Core.Managers;
 using biz.dfch.CS.CoffeeTracker.Core.Model;


Fixes a bug in axis value computation

Fixes a bug in axis value computation


fix(mapper): escape double quotes before parsing

--- EDILibrary/GenericEDILoader.cs
+++ EDILibrary/GenericEDILoader.cs
@@ -433,6 +433,7 @@

             string message = edi.Substring(UNAoffset + segDelimiterLength, edi.Length - (UNAoffset + segDelimiterLength));
             message = message.Replace("?'", "?$");
+            message = message.Replace("\"", "\\\"");
             var Segments = message.LowMemSplit(segmentDelimiter);
             if (tree != null)
             {


InsertOrUpdate method rename

InsertOrUpdate method rename

--- LinqHelper.cs
+++ LinqHelper.cs
@@ -105,7 +105,7 @@
                 }
             }
         }
-        public T InserOrUpdate<T>(T item, bool submit = false)
+        public T InsertOrUpdate<T>(T item, bool submit = false)
             where T : class, IDataEntity
         {
             bool isNew = (item.Id == "0" || string.IsNullOrEmpty(item.Id));


Bug- and performancefixes

Bug- and performancefixes

Now the algorithm only gets the neighbouring views instead of the entire view chain. This should make it much faster!

This is possible because we now use x & y positions instead of width / height calculations.

Signed-off-by: Anders Bech Mellson <dcd67d1087e07b87a59bb90a9324a369479ccb75@appbureauet.dk>

--- EasyLayout.Forms/EasyLayout.cs
+++ EasyLayout.Forms/EasyLayout.cs
@@ -58,16 +58,14 @@
 					return Constraint.Constant(RightExpression.Constant.Value);
 				}

-                if (dependentViews != null)
-                {
+                if (dependentViews != null && dependentViews.Count == 2)
+                {
+                    var v1 = dependentViews.ElementAt(0);
+                    var v2 = dependentViews.ElementAt(1);
                     if (position == Position.Width)
-                    {
-                        return Constraint.RelativeToParent(rl =>
-                            rl.Width - dependentViews.Aggregate(0.0, (d, view) => d + GetWidth(rl, view.Id, false, 0)));
-                    }
+                        return Constraint.RelativeToParent(rl => v2.Bounds.X - v2.Width - v1.Bounds.X);
                     if (position == Position.Height)
-                        return Constraint.RelativeToParent(rl =>
-                            rl.Height - dependentViews.Aggregate(0.0, (d, view) => d + GetHeight(rl, view.Id, 0)));
+                        return Constraint.RelativeToParent(rl => v2.Bounds.Y - v2.Height - v1.Bounds.Y);
                 }
                 else
                 {
@@ -395,26 +393,14 @@
             if (!fullyConstrained) return null;

             // Get all dependent views in either direction/position (top and bottom) or (left and right)
-            var dependentViews = new List<View>();
-            GetDependentViewsRecursively(view, allAssertions, position, dependentViews);
-            GetDependentViewsRecursively(view, allAssertions, oppositePosition, dependentViews);
-
+            var dependentViews = (
+                from assertion in allAssertions
+                where assertion.View.Equals(view)
+                      && (assertion.Position == position || assertion.Position == oppositePosition)
+                      && !assertion.RightExpression.IsParent
+                select assertion.RightExpression.View).Distinct().ToList();
+
             return !dependentViews.Any() ? null : dependentViews;
-        }
-
-        private static void GetDependentViewsRecursively(View view, List<Assertion> allAssertions, Position position, List<View> result)
-        {
-            var dependentViews = from assertion in allAssertions
-                where assertion.View.Equals(view)
-                      && assertion.Position == position
-                      && !assertion.RightExpression.IsParent
-                select assertion.RightExpression.View;
-
-            foreach (var dependentView in dependentViews)
-            {
-                result.Add(dependentView);
-                GetDependentViewsRecursively(dependentView, allAssertions, position, result);
-            }
         }

         private static Constraint GetXConstraint(IGrouping<View, Assertion> assertions, Assertion widthAssertion)


A fix for something

A fix for something

--- Eavesdrop/Network/EavesNode.cs
+++ Eavesdrop/Network/EavesNode.cs
@@ -132,6 +132,8 @@
             {
                 foreach (string header in headers.AllKeys)
                 {
+                    if (header == "Transfer-Encoding") continue;
+
                     string value = headers[header];
                     if (string.IsNullOrWhiteSpace(value)) continue;


Improved balls adherence to play area bounds. so it matches the players.

--- Dodgeball/Dodgeball/Screens/GameScreen.cs
+++ Dodgeball/Dodgeball/Screens/GameScreen.cs
@@ -152,14 +152,14 @@

         private void BallVsWallsCollision()
         {
-            if (BallInstance.XVelocity < 0 && BallInstance.X < -1920/2.0f + 30 ||
-                BallInstance.XVelocity > 0 && BallInstance.X > 1920 / 2.0f - 30)
+            if (BallInstance.XVelocity < 0 && BallInstance.X < -1920/2.0f + BallInstance.CircleInstance.Radius ||
+                BallInstance.XVelocity > 0 && BallInstance.X > 1920 / 2.0f - BallInstance.CircleInstance.Radius)
             {
                 BallInstance.BounceOffWall(isLeftOrRightWall: true);
             }

-            if(BallInstance.YVelocity > 0 && BallInstance.Y > PlayAreaTop ||
-                BallInstance.YVelocity < 0 && BallInstance.Y < PlayAreaBottom + 30)
+            if((BallInstance.YVelocity > 0 && (BallInstance.Y - (BallInstance.CircleInstance.Radius / 2) > PlayAreaTop)) ||
+                (BallInstance.YVelocity < 0 && BallInstance.Y - BallInstance.CircleInstance.Radius < PlayAreaBottom))
             {
                 BallInstance.BounceOffWall(isLeftOrRightWall: false);
             }


Adjust version number to match DokanNet

Adjust version number to match DokanNet

--- DokanNet.Tests/Properties/AssemblyInfo.cs
+++ DokanNet.Tests/Properties/AssemblyInfo.cs
@@ -29,6 +29,6 @@
 // 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.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyVersion("0.8.0.0")]
+[assembly: AssemblyFileVersion("0.8.0.0")]
 [assembly: CLSCompliant(true)]


Removed aspnet layout renderers. Turns out that they require NLog.Web to work

--- Elmah.Io.NLog/ElmahIoTarget.cs
+++ Elmah.Io.NLog/ElmahIoTarget.cs
@@ -55,32 +55,20 @@
                 User = Identity(logEvent),
                 Hostname = MachineName(logEvent),
                 Application = Application,
-                Url = AspNetRequestUrl(logEvent),
             };

             _client.Messages.CreateAndNotify(LogId, message);
         }

-        private string AspNetRequestUrl(LogEventInfo logEvent)
-        {
-            Layout renderer = "${aspnet-request-url:IncludeQueryString=true}";
-            var url = renderer.Render(logEvent);
-            return string.IsNullOrWhiteSpace(url) ? null : url;
-        }
-
         private string Identity(LogEventInfo logEvent)
         {
-            Layout aspNetRenderer = "${aspnet-user-identity}";
-            var user = aspNetRenderer.Render(logEvent);
-            if (!string.IsNullOrWhiteSpace(user)) return user;
-
             var renderer = new IdentityLayoutRenderer
             {
                 Name = true,
                 AuthType = false,
                 IsAuthenticated = false
             };
-            user = renderer.Render(logEvent);
+            var user = renderer.Render(logEvent);
             return string.IsNullOrWhiteSpace(user) ? null : user;
         }


disable testdata

disable testdata

--- Domain/Migrations/Configuration.cs
+++ Domain/Migrations/Configuration.cs
@@ -1,11 +1,8 @@
 namespace EventFeedback.Domain.Migrations
 {
-    using System;
-    using System.Data.Entity;
     using System.Data.Entity.Migrations;
-    using System.Linq;

-    internal sealed class Configuration : DbMigrationsConfiguration<EventFeedback.Domain.DataContext>
+    internal sealed class Configuration : DbMigrationsConfiguration<DataContext>
     {
         public Configuration()
         {
@@ -14,19 +11,7 @@

         protected override void Seed(EventFeedback.Domain.DataContext context)
         {
-            //  TestData.Seed(context);
-            //  This method will be called after migrating to the latest version.
-
-            //  You can use the DbSet<T>.AddOrUpdate() helper extension method
-            //  to avoid creating duplicate seed data. E.g.
-            //
-            //    context.People.AddOrUpdate(
-            //      p => p.FullName,
-            //      new Person { FullName = "Andrew Peters" },
-            //      new Person { FullName = "Brice Lambson" },
-            //      new Person { FullName = "Rowan Miller" }
-            //    );
-            //
+            // TestData.Seed(context);
         }
     }
 }


Hopefully a .dll file?

Hopefully a .dll file?

--- DoubleStuffedUnitTest/UnitTest1.cs
+++ DoubleStuffedUnitTest/UnitTest1.cs
@@ -9,6 +9,7 @@
         [TestMethod]
         public void TestMethod1()
         {
+            Console.WriteLine("Please give me a .dll");
         }
     }
 }


Don't bail out quite so quickly if vertex buffers are insufficient

* This allows 'partial' rows in the mesh viewer, if a vertex input element
  references invalid/out of bounds data, but the others are fine (coming
  from different streams).

--- renderdocui/Windows/BufferViewer.cs
+++ renderdocui/Windows/BufferViewer.cs
@@ -1333,9 +1333,11 @@
                         index = 0;
                     }

-                    try
-                    {
-                        for (int el = 0; el < bufferFormats.Length; el++)
+                    int elemsWithData = 0;
+
+                    for (int el = 0; el < bufferFormats.Length; el++)
+                    {
+                        try
                         {
                             byte[] bytedata = d[bufferFormats[el].buffer];
                             Stream strm = state.m_Stream[bufferFormats[el].buffer];
@@ -1374,7 +1376,7 @@
                             rawWriter.Write(bytes);

                             if (bytes.Length != bytesToRead)
-                                throw new System.IO.EndOfStreamException();
+                                continue;

                             if (elname == "POSITION" || elname == "SV_POSITION")
                             {
@@ -1418,12 +1420,16 @@
                                     }
                                 }
                             }
+
+                            elemsWithData++;
                         }
-                    }
-                    catch (System.IO.EndOfStreamException)
-                    {
-                        finished = true;
-                    }
+                        catch (System.IO.EndOfStreamException)
+                        {
+                            // don't increment elemsWithData
+                        }
+                    }
+
+                    finished = (elemsWithData > 0);

                     rownum++;
                 }
@@ -1589,9 +1595,11 @@
                         x = 1;
                     }

-                    try
-                    {
-                        for (int el = 0; el < bufferFormats.Length; el++)
+                    for (int el = 0; el < bufferFormats.Length; el++)
+                    {
+                        int xstart = x;
+
+                        try
                         {
                             byte[] bytedata = d[bufferFormats[el].buffer];
                             Stream strm = state.m_Stream[bufferFormats[el].buffer];
@@ -1648,11 +1656,15 @@
                                 }
                             }
                         }
-                    }
-                    catch (System.IO.EndOfStreamException)
-                    {
-                        for (int leftovers = x; leftovers < rowlen; leftovers++)
-                            rowdata[leftovers] = "-";
+                        catch (System.IO.EndOfStreamException)
+                        {
+                            for (int i = 0; i < bufferFormats[el].format.compCount; i++)
+                            {
+                                rowdata[xstart + i] = "-";
+                            }
+
+                            x = (int)(xstart + bufferFormats[el].format.compCount);
+                        }
                     }

                     if (rowdata != null)


Convert const fields to properties

Convert const fields to properties

--- AnimationPathAnimator.cs
+++ AnimationPathAnimator.cs
@@ -31,59 +31,54 @@
     [ExecuteInEditMode]
     public class AnimationPathAnimator : GameComponent {

-        #region CONSTANTS
-
+
+
+        #region EVENTS
+
+        public event EventHandler NodeTiltChanged;
+
+        public event EventHandler RotationPointPositionChanged;
+
+        #endregion EVENTS
+
+        #region FIELDS
         /// <summary>
         ///     Value of the jump when modifier key is pressed.
         /// </summary>
-        public const float ShortJumpValue = 0.002f;
-
-        private const string CurrentRotationPointGizmoIcon = "rec_16x16-yellow";
-        private const string ForwardPointIcon = "target_22x22-pink";
-        private const int RotationCurveSampling = 20;
-        private const string RotationPointGizmoIcon = "rec_16x16";
-        private const string TargetGizmoIcon = "target_22x22-blue";
-
-        #endregion CONSTANTS
-
-        #region EVENTS
-
-        public event EventHandler NodeTiltChanged;
-
-        public event EventHandler RotationPointPositionChanged;
-
-        #endregion EVENTS
-
-        #region FIELDS
+        private float shortJumpValue = 0.002f;
+
+        private string currentRotationPointGizmoIcon = "rec_16x16-yellow";
+        private string forwardPointIcon = "target_22x22-pink";
+        private int rotationCurveSampling = 20;
+        private string rotationPointGizmoIcon = "rec_16x16";
+        private string targetGizmoIcon = "target_22x22-blue";
+
         private readonly Color rotationCurveColor = Color.gray;
-        [SerializeField]
-        private WrapMode wrapMode = WrapMode.Clamp;
-
         /// <summary>
         ///     Path used to animate the <c>animatedGO</c> transform.
         /// </summary>
         [SerializeField] private AnimationPathBuilder animationPathBuilder;
-
-        [SerializeField] private bool autoPlay = true;
-
-        [SerializeField] private AnimatorHandleMode handleMode =
-            AnimatorHandleMode.None;
-
         /// <summary>
         ///     If animation is currently enabled (may be paused).
         /// </summary>
         /// <remarks>Used in play mode.</remarks>
         private bool isPlaying;
-
-        [SerializeField] private AnimatorRotationMode rotationMode =
+        #endregion FIELDS
+
+        #region SERIALIZED FIELDS
+        [SerializeField]
+        private AnimatorRotationMode rotationMode =
             AnimatorRotationMode.Forward;

-
-        [SerializeField] private bool updateAllMode;
-
-        #endregion FIELDS
-
-        #region SERIALIZED FIELDS
+        [SerializeField]
+        private AnimatorHandleMode handleMode =
+            AnimatorHandleMode.None;
+
+        [SerializeField]
+        private WrapMode wrapMode = WrapMode.Clamp;
+
+        [SerializeField]
+        private bool autoPlay = true;

         [SerializeField]
 #pragma warning disable 169
@@ -142,7 +137,15 @@

         #endregion SERIALIZED FIELDS

+        [SerializeField]
+        private bool updateAllMode;
+
         #region PUBLIC PROPERTIES
+        public string CurrentRotationPointGizmoIcon {
+            get { return currentRotationPointGizmoIcon; }
+            set { currentRotationPointGizmoIcon = value; }
+        }
+
         public float FloatPrecision {
             get { return 0.001f; }
         }
@@ -207,6 +210,34 @@
             set { updateAllMode = value; }
         }

+        public string ForwardPointIcon {
+            get { return forwardPointIcon; }
+            protected set { forwardPointIcon = value; }
+        }
+
+        public int RotationCurveSampling {
+            get { return rotationCurveSampling; }
+            protected set { rotationCurveSampling = value; }
+        }
+
+        public string RotationPointGizmoIcon {
+            get { return rotationPointGizmoIcon; }
+            protected set { rotationPointGizmoIcon = value; }
+        }
+
+        public string TargetGizmoIcon {
+            get { return targetGizmoIcon; }
+            protected set { targetGizmoIcon = value; }
+        }
+
+        /// <summary>
+        ///     Value of the jump when modifier key is pressed.
+        /// </summary>
+        public float ShortJumpValue {
+            get { return shortJumpValue; }
+            protected set { shortJumpValue = value; }
+        }
+
         //public AnimationCurve EaseCurve {
         //    get { return easeCurve; }
         //}
@@ -255,7 +286,7 @@
         }

         [SuppressMessage("ReSharper", "UnusedMember.Local")]
-        private void OnEnable() {
+        public virtual void OnEnable() {
             // Subscribe to events.
             animationPathBuilder.PathReset += animationPathBuilder_PathReset;
             animationPathBuilder.NodeAdded += animationPathBuilder_NodeAdded;


Restore fix for FileControl when adding new library - need blank option for default

--- EditorControls/FileControl.xaml.cs
+++ EditorControls/FileControl.xaml.cs
@@ -130,7 +130,11 @@

         private IEnumerable<string> GetAvailableLibraries()
         {
-            return m_helper.Controller.GetAvailableLibraries();
+            yield return "";
+            foreach (string result in m_helper.Controller.GetAvailableLibraries())
+            {
+                yield return result;
+            }
         }

         private IEnumerable<string> GetFilesInGamePath()


Remove handler

Remove handler

This causes application to crash on JNI exception with Android. Will need to see if this means that we will miss any crashes

--- src/Bugsnag.Unity/IClient.cs
+++ src/Bugsnag.Unity/IClient.cs
@@ -66,7 +66,6 @@
       // might need to do this later?
       SceneManager.sceneLoaded += SceneLoaded;
       Application.logMessageReceivedThreaded += Notify;
-      AppDomain.CurrentDomain.UnhandledException += Notify;
     }

     public void Send(IPayload payload)
@@ -117,27 +116,6 @@
           { "condition", condition },
           { "stackTrace", stackTrace },
         });
-      }
-    }
-
-    /// <summary>
-    /// Notify an unhandled exception.
-    /// </summary>
-    /// <param name="sender"></param>
-    /// <param name="e"></param>
-    void Notify(object sender, UnhandledExceptionEventArgs e)
-    {
-      // this will always be an unhandled exception
-      if (Configuration.AutoNotify)
-      {
-        if (e.ExceptionObject is System.Exception exception)
-        {
-          // this will always be a handled exception?
-          var @event = new Payload.Event(Configuration.Context, GenerateMetadata(), GenerateAppData(), GenerateDeviceData(), User, new Exceptions(exception).ToArray(), HandledState.ForUnhandledException(), Breadcrumbs.Retrieve(), SessionTracking.CurrentSession);
-          var report = new Report(Configuration, @event);
-
-          Notify(report, null);
-        }
       }
     }


Add emoji ramp option for supported fonts.

--- CharacterMap/CharacterMap/ViewModels/FontMapViewModel.cs
+++ CharacterMap/CharacterMap/ViewModels/FontMapViewModel.cs
@@ -378,14 +378,21 @@
         }
         private IReadOnlyList<String> GetRampOptions(FontVariant variant)
         {
+            var list = DefaultRampOptions.ToList();
+
             if (variant?.TryGetSampleText() is String s)
             {
-                var list = DefaultRampOptions.ToList();
                 list.Insert(0, s);
-                return list;
-            }
-
-            return DefaultRampOptions;
+            }
+
+            if (Unicode.ContainsRange(variant, UnicodeRange.Emoticons))
+            {
+                string emoji = "😂😍😭💁👍💋🐱🦉🌺🌲🍓🍕🎂🏰🏠🚄🚒🛫🛍";
+                if (!list.Contains(emoji))
+                    list.Add(emoji);
+            }
+
+            return list.Count == DefaultRampOptions.Count ? DefaultRampOptions : list;
         }

         internal void UpdateVariations()


fixes code.

fixes code.

--- src/Chloe/DbContextButler.cs
+++ src/Chloe/DbContextButler.cs
@@ -103,8 +103,9 @@

             try
             {
-                foreach (var pair in this.PersistedDbContextProviders)
-                {
+                for (int i = 0; i < this.PersistedDbContextProviders.Count; i++)
+                {
+                    DataSourceDbContextProviderPair pair = this.PersistedDbContextProviders[i];
                     pair.DbContextProvider.Session.BeginTransaction(il);
                 }
             }
@@ -132,8 +133,9 @@
                 throw new ChloeException("Current session does not open a transaction.");
             }

-            foreach (var pair in this.PersistedDbContextProviders)
-            {
+            for (int i = 0; i < this.PersistedDbContextProviders.Count; i++)
+            {
+                DataSourceDbContextProviderPair pair = this.PersistedDbContextProviders[i];
                 var dbContextProvider = pair.DbContextProvider;

                 if (!dbContextProvider.Session.IsInTransaction)
@@ -159,8 +161,9 @@
         {
             List<Exception> exceptions = null;

-            foreach (var pair in this.PersistedDbContextProviders)
-            {
+            for (int i = 0; i < this.PersistedDbContextProviders.Count; i++)
+            {
+                DataSourceDbContextProviderPair pair = this.PersistedDbContextProviders[i];
                 var dbContextProvider = pair.DbContextProvider;
                 if (!dbContextProvider.Session.IsInTransaction)
                 {
@@ -193,8 +196,9 @@

         public void UseTransaction(IDbTransaction dbTransaction)
         {
-            foreach (var pair in this.PersistedDbContextProviders)
-            {
+            for (int i = 0; i < this.PersistedDbContextProviders.Count; i++)
+            {
+                DataSourceDbContextProviderPair pair = this.PersistedDbContextProviders[i];
                 pair.DbContextProvider.Session.UseTransaction(dbTransaction);
             }
         }


Fix a bug in rolebans. (#7029)

Fix a bug in rolebans. (#7029)

--- Content.Server/Administration/Managers/RoleBanManager.cs
+++ Content.Server/Administration/Managers/RoleBanManager.cs
@@ -37,7 +37,7 @@
             return;

         var netChannel = e.Session.ConnectedClient;
-        await CacheDbRoleBans(e.Session.UserId, netChannel.RemoteEndPoint.Address, netChannel.UserData.HWId);
+        await CacheDbRoleBans(e.Session.UserId, netChannel.RemoteEndPoint.Address, netChannel.UserData.HWId.Length == 0 ? null : netChannel.UserData.HWId);
     }

     private async Task<bool> AddRoleBan(ServerRoleBanDef banDef)


Added IsSteamChinaLauncher

Added IsSteamChinaLauncher

--- Facepunch.Steamworks/SteamUtils.cs
+++ Facepunch.Steamworks/SteamUtils.cs
@@ -255,5 +255,11 @@
 			failed = false;
 			return Internal.IsAPICallCompleted( call, ref failed );
 		}
+
+
+		/// <summary>
+		/// Returns whether this steam client is a Steam China specific client, vs the global client
+		/// </summary>
+		public static bool IsSteamChinaLauncher => Internal.IsSteamChinaLauncher();
 	}
 }


Spiderweb and Fire blocks no longer cast shadows (for purposes of plant physics).

--- FemtoCraft/Physics/PlantPhysics.cs
+++ FemtoCraft/Physics/PlantPhysics.cs
@@ -160,6 +160,8 @@
                 case Block.BrownMushroom:
                 case Block.RedMushroom:
                 case Block.Sapling:
+                case Block.SpiderWeb:
+                case Block.Fire:
                     return false;
                 default:
                     return true;


add quoting and make "defun" "real" function


* Updated MemoryErrorLog to have the read-only modifier on its size field since this is not modified after construction.


优化资源更新代码的异常处理

优化资源更新代码的异常处理

--- GameFramework/Resource/ResourceManager.cs
+++ GameFramework/Resource/ResourceManager.cs
@@ -50,7 +50,7 @@
         private string m_ReadOnlyPath;
         private string m_ReadWritePath;
         private ResourceMode m_ResourceMode;
-        private bool m_RefuseSetCurrentVariant;
+        private bool m_RefuseSetFlag;
         private string m_CurrentVariant;
         private string m_UpdatePrefixUri;
         private string m_ApplicableGameVersion;
@@ -98,7 +98,7 @@
             m_ReadOnlyPath = null;
             m_ReadWritePath = null;
             m_ResourceMode = ResourceMode.Unspecified;
-            m_RefuseSetCurrentVariant = false;
+            m_RefuseSetFlag = false;
             m_CurrentVariant = null;
             m_UpdatePrefixUri = null;
             m_ApplicableGameVersion = null;
@@ -779,6 +779,11 @@
                 throw new GameFrameworkException("Readonly path is invalid.");
             }

+            if (m_RefuseSetFlag)
+            {
+                throw new GameFrameworkException("You can not set readonly path at this time.");
+            }
+
             if (m_ResourceLoader.TotalAgentCount > 0)
             {
                 throw new GameFrameworkException("You must set readonly path before add load resource agent helper.");
@@ -798,6 +803,11 @@
                 throw new GameFrameworkException("Read-write path is invalid.");
             }

+            if (m_RefuseSetFlag)
+            {
+                throw new GameFrameworkException("You can not set read-write path at this time.");
+            }
+
             if (m_ResourceLoader.TotalAgentCount > 0)
             {
                 throw new GameFrameworkException("You must set read-write path before add load resource agent helper.");
@@ -815,6 +825,11 @@
             if (resourceMode == ResourceMode.Unspecified)
             {
                 throw new GameFrameworkException("Resource mode is invalid.");
+            }
+
+            if (m_RefuseSetFlag)
+            {
+                throw new GameFrameworkException("You can not set resource mode at this time.");
             }

             if (m_ResourceMode == ResourceMode.Unspecified)
@@ -867,7 +882,7 @@
         /// <param name="currentVariant">当前变体。</param>
         public void SetCurrentVariant(string currentVariant)
         {
-            if (m_RefuseSetCurrentVariant)
+            if (m_RefuseSetFlag)
             {
                 throw new GameFrameworkException("You can not set current variant at this time.");
             }
@@ -1009,7 +1024,7 @@
                 throw new GameFrameworkException("You can not use InitResources at this time.");
             }

-            m_RefuseSetCurrentVariant = true;
+            m_RefuseSetFlag = true;
             m_InitResourcesCompleteCallback = initResourcesCompleteCallback;
             m_ResourceIniter.InitResources(m_CurrentVariant);
         }
@@ -1100,7 +1115,7 @@
                 throw new GameFrameworkException("You can not use CheckResources at this time.");
             }

-            m_RefuseSetCurrentVariant = true;
+            m_RefuseSetFlag = true;
             m_CheckResourcesCompleteCallback = checkResourcesCompleteCallback;
             m_ResourceChecker.CheckResources(m_CurrentVariant, ignoreOtherVariant);
         }


Rename field to use _ prefix

Rename field to use _ prefix

--- src/GitLinkTask/LinkPdbToGitRemote.cs
+++ src/GitLinkTask/LinkPdbToGitRemote.cs
@@ -48,11 +48,11 @@

         private class MSBuildListener : LogListenerBase
         {
-            private readonly TaskLoggingHelper log;
+            private readonly TaskLoggingHelper _log;

             internal MSBuildListener(TaskLoggingHelper log)
             {
-                this.log = log;
+                _log = log;
             }

             protected override void Write(ILog log, string message, LogEvent logEvent, object extraData, LogData logData, DateTime time)
@@ -60,16 +60,16 @@
                 switch (logEvent)
                 {
                     case LogEvent.Error:
-                        this.log.LogError(message);
+                        _log.LogError(message);
                         break;
                     case LogEvent.Warning:
-                        this.log.LogWarning(message);
+                        _log.LogWarning(message);
                         break;
                     case LogEvent.Info:
-                        this.log.LogMessage(MessageImportance.Normal, message);
+                        _log.LogMessage(MessageImportance.Normal, message);
                         break;
                     case LogEvent.Debug:
-                        this.log.LogMessage(MessageImportance.Low, message);
+                        _log.LogMessage(MessageImportance.Low, message);
                         break;
                     default:
                         break;


Completed implementation of PriorityQueue.

--- src/Graphs.Utilities/PriorityQueue.cs
+++ src/Graphs.Utilities/PriorityQueue.cs
@@ -61,6 +61,50 @@
             BubbleUp(Count - 1);
         }

+        public T ExtractMinimum()
+        {
+            if (Count < 0)
+            {
+                throw new Exception("The priority queue is empty.");
+            }
+
+            T minimum = _queue[0];
+            _queue[0] = _queue[Count - 1];
+            Count--;
+            BubbleDown(0);
+            return minimum;
+        }
+
+        private void BubbleDown(int p)
+        {
+            int minimumValueIndex = p;
+            int childIndex;
+
+            while (true)
+            {
+                childIndex = YoungChild(p);
+                // this loop finds the index with minimum value from among three elements: pth element and its two children
+                for (int i = 0; i <= 1; i++)
+                {
+                    if ((childIndex + i) < Count)
+                    {
+                        if (_queue[minimumValueIndex].CompareTo(_queue[childIndex + i]) > 0)
+                        {
+                            minimumValueIndex = childIndex + i;
+                        }
+                    }
+                }
+                if (minimumValueIndex == p)
+                {
+                    return;
+                }
+
+                SwapElementsAt(p, minimumValueIndex);
+                p = minimumValueIndex;
+
+            }
+        }
+
         private void BubbleUp(int p)
         {
             // if root of the heap, i.e. no parent then return straightaway


Apply C# 7 syntax

Apply C# 7 syntax

--- src/HBitcoin.Tests/QBitNinjaJutsus.cs
+++ src/HBitcoin.Tests/QBitNinjaJutsus.cs
@@ -58,14 +58,13 @@
 			foreach (var op in opSet)
 			{
 				var txId = op.TransactionId;
-				List<BalanceOperation> ol;
-				if (operationsPerTransactions.TryGetValue(txId, out ol))
-				{
-					ol.Add(op);
-					operationsPerTransactions[txId] = ol;
-				}
-				else operationsPerTransactions.Add(txId, new List<BalanceOperation> { op });
-			}
+                if (operationsPerTransactions.TryGetValue(txId, out List<BalanceOperation> ol))
+                {
+                    ol.Add(op);
+                    operationsPerTransactions[txId] = ol;
+                }
+                else operationsPerTransactions.Add(txId, new List<BalanceOperation> { op });
+            }

 			return operationsPerTransactions;
 		}


Fixed order of operations

Fixed order of operations

--- src/Pioneer.Blog/Startup.cs
+++ src/Pioneer.Blog/Startup.cs
@@ -116,7 +116,6 @@
                 }
             });

-
             ConfigureSecurity(app);
             ConfigureMvc(app);
         }
@@ -169,10 +168,10 @@
                 TokenValidationParameters = new TokenValidationParameters
                 {
                     IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Configuration.GetSection("AppConfiguration:Key").Value)),
-                    ValidAudience = Configuration.GetSection("Configuration:SiteUrl").Value,
+                    ValidAudience = Configuration.GetSection("AppConfiguration:SiteUrl").Value,
                     ValidateIssuerSigningKey = true,
                     ValidateLifetime = true,
-                    ValidIssuer = Configuration.GetSection("Configuration:SiteUrl").Value
+                    ValidIssuer = Configuration.GetSection("AppConfiguration:SiteUrl").Value
                 }
             });


ContentType bug

ContentType bug

--- src/Hl7.Fhir.Core/Rest/ContentType.cs
+++ src/Hl7.Fhir.Core/Rest/ContentType.cs
@@ -117,7 +117,7 @@
         /// <returns></returns>
         public static bool IsValidResourceContentType(string contentType)
         {
-            var f = contentType.ToLowerInvariant();
+            var f = new System.Net.Mime.ContentType(contentType).MediaType.ToLowerInvariant();

             return JSON_CONTENT_HEADERS.Contains(f) || XML_CONTENT_HEADERS.Contains(f);
         }


fix tests

fix tests

--- src/UnitTest/AuthorsTest.cs
+++ src/UnitTest/AuthorsTest.cs
@@ -102,7 +102,7 @@
 				else
 				{
 					Assert.True(false, $"Feed(s) for {author.FirstName} {author.LastName}  @{author?.GitHubHandle}  is null or empty @{author?.FeedUris?.FirstOrDefault()?.OriginalString}");
-					_output.WriteLine($"Feed(s) for {author.FirstName} {author.LastName} is null or empty");*/
+					_output.WriteLine($"Feed(s) for {author.FirstName} {author.LastName} is null or empty");
 				}

 				throw ex;


doc improvements

doc improvements

--- src/DbExtensions/SqlTable.cs
+++ src/DbExtensions/SqlTable.cs
@@ -411,8 +411,8 @@
    }

    /// <summary>
-   /// A <see cref="SqlSet<TEntity>"/> that provides additional methods for CRUD (Create, Read, Update, Delete)
-   /// operations for entities mapped using the <see cref="N:System.Data.Linq.Mapping"/> API.
+   /// A <see cref="SqlSet<TEntity>"/> that provides CRUD (Create, Read, Update, Delete)
+   /// operations for annotated classes.
    /// This class cannot be instantiated, to get an instance use the <see cref="Database.Table<TEntity>"/> method.
    /// </summary>
    /// <typeparam name="TEntity">The type of the entity.</typeparam>
@@ -896,7 +896,7 @@
       }

       /// <summary>
-      /// Sets all mapped members of <paramref name="entity"/> to their most current persisted value.
+      /// Sets all column members of <paramref name="entity"/> to their most current persisted value.
       /// </summary>
       /// <param name="entity">The entity to refresh.</param>

@@ -999,7 +999,7 @@
    }

    /// <summary>
-   /// Generates SQL commands for entities mapped by <see cref="SqlTable<TEntity>"/> and <see cref="SqlTable"/>.
+   /// Generates SQL commands for annotated classes.
    /// This class cannot be instantiated, to get an instance use the <see cref="SqlTable<TEntity>.CommandBuilder"/>
    /// or <see cref="SqlTable.CommandBuilder"/> properties.
    /// </summary>
@@ -1305,7 +1305,7 @@
       /// or null if the <paramref name="id"/> does not exist.
       /// </returns>
       /// <remarks>
-      /// This method can only be used on mapped sets created by <see cref="Database"/>.
+      /// This method can only be used on sets where the result type is an annotated class.
       /// </remarks>

       public object Find(object id) {
@@ -1355,7 +1355,7 @@
       /// <param name="path">Dot-separated list of related objects to return in the query results.</param>
       /// <returns>A new <see cref="SqlSet"/> with the defined query path.</returns>
       /// <remarks>
-      /// This method can only be used on mapped sets created by <see cref="Database"/>.
+      /// This method can only be used on sets where the result type is an annotated class.
       /// </remarks>

       public SqlSet Include(string path) {


do not lock file upon running the script

--- src/Dotnet.Script/Program.cs
+++ src/Dotnet.Script/Program.cs
@@ -81,10 +81,13 @@
             }

             var directory = Path.IsPathRooted(file) ? Path.GetDirectoryName(file) : Path.GetDirectoryName(Path.Combine(Directory.GetCurrentDirectory(), file));
-            var sourceText = SourceText.From(new FileStream(file, FileMode.Open));
-            var context = new ScriptContext(sourceText, directory, config, args, file, debugMode);

-            Run(debugMode, context);
+            using (var filestream = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
+            {
+                var sourceText = SourceText.From(filestream);
+                var context = new ScriptContext(sourceText, directory, config, args, file, debugMode);
+                Run(debugMode, context);
+            }
         }

         private static void RunCode(string code, string config, bool debugMode, IEnumerable<string> args, string currentWorkingDirectory)


Add linux support

Add linux support

--- src/EmbeddedNativeLibrary.cs
+++ src/EmbeddedNativeLibrary.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.Diagnostics;
@@ -158,24 +158,24 @@

         private IntPtr LoadFromDllInfos(string libraryName, DllInfo[] dllInfos, List<Exception> exceptions)
         {
-                foreach (var dllInfo in dllInfos.Where(info => RuntimeMatchesTarget(info.TargetRuntime)))
-                {
-                    var libraryPath = GetLibraryPath(libraryName, dllInfo);
-                    var maybePointer = _libraryLoader.LoadLibrary(libraryPath);
-
-                    if (maybePointer.HasValue)
-                    {
-                        return maybePointer.Value;
-                    }
-
-                    exceptions.Add(new AggregateException(
-                        string.Format(
-                            "The load library operation for '{0}' failed and reported {1} exception{2}.",
-                            dllInfo.ResourceName,
-                            maybePointer.Exceptions.Length,
-                            maybePointer.Exceptions.Length > 1 ? "s" : ""),
-                        maybePointer.Exceptions));
-                }
+            foreach (var dllInfo in dllInfos.Where(info => RuntimeMatchesTarget(info.TargetRuntime)))
+            {
+                var libraryPath = GetLibraryPath(libraryName, dllInfo);
+                var maybePointer = _libraryLoader.LoadLibrary(libraryPath);
+
+                if (maybePointer.HasValue)
+                {
+                    return maybePointer.Value;
+                }
+
+                exceptions.Add(new AggregateException(
+                    string.Format(
+                        "The load library operation for '{0}' failed and reported {1} exception{2}.",
+                        dllInfo.ResourceName,
+                        maybePointer.Exceptions.Length,
+                        maybePointer.Exceptions.Length > 1 ? "s" : ""),
+                    maybePointer.Exceptions));
+            }

             return IntPtr.Zero;
         }
@@ -205,6 +205,8 @@
                     return _runtimeOS == RuntimeOS.Windows && IntPtr.Size == 4;
                 case TargetRuntime.Win64:
                     return _runtimeOS == RuntimeOS.Windows && IntPtr.Size == 8;
+                case TargetRuntime.Linux:
+                    return _runtimeOS == RuntimeOS.Linux;
                 default:
                     return false;
             }
@@ -311,8 +313,9 @@
             {
                 case RuntimeOS.Windows:
                     return new WindowsLibraryLoader();
+                case RuntimeOS.Linux:
+                    return new LinuxLibraryLoader();
                 case RuntimeOS.Mac:
-                case RuntimeOS.Linux:
                 default:
                     return new NullLibraryLoader();
             }
@@ -426,7 +429,7 @@

         private static string WriteDll(byte[] dllData, string resourceName, string directory)
         {
-            var fileName = Regex.Match(resourceName, @"[^.]+\.(?:dll|exe)").Value;
+            var fileName = Regex.Match(resourceName, @"[^.]+\.(?:dll|exe|so)").Value;
             var path = Path.Combine(directory, fileName);

             if (!File.Exists(path))
@@ -624,6 +627,141 @@
             }
         }

+        private class LinuxLibraryLoader : ILibraryLoader
+        {
+            private static readonly string[] _candidateLocations;
+            private static readonly string[] _installLocations;
+
+            static LinuxLibraryLoader()
+            {
+                _candidateLocations = new[] { "/tmp", "/var/tmp" };
+            }
+
+            public string[] CandidateLocations { get { return _candidateLocations; } }
+
+            public IEnumerable<string> GetInstallPathCandidates(string libraryName)
+            {
+                string potentialInstallPath;
+                var fullName = libraryName + ".so";
+
+                var installLocations = new List<string>();
+
+                potentialInstallPath = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), fullName);
+                if (File.Exists(potentialInstallPath))
+                {
+                    installLocations.Add(potentialInstallPath);
+                }
+
+                var ldLibraryPath = Environment.GetEnvironmentVariable("LD_LIBRARY_PATH");
+                if (!string.IsNullOrEmpty(ldLibraryPath))
+                {
+                    foreach (var path in ldLibraryPath.Split(new[] { ':' }, StringSplitOptions.RemoveEmptyEntries))
+                    {
+                        potentialInstallPath = Path.Combine(path, fullName);
+                        if (File.Exists(potentialInstallPath))
+                        {
+                            installLocations.Add(potentialInstallPath);
+                        }
+                    }
+                }
+
+                var process = Process.Start(new ProcessStartInfo
+                {
+                    FileName = "/bin/bash",
+                    Arguments = "ldconfig -p",
+                    RedirectStandardOutput = true,
+                    UseShellExecute = false,
+                    CreateNoWindow = true
+                });
+
+                var ldconfigResult = process.StandardOutput.ReadToEnd();
+                process.WaitForExit();
+                var ldconfigMatch = Regex.Match(ldconfigResult, libraryName + @"\.so.*?=>\s*(.*)");
+                if (ldconfigMatch.Success)
+                {
+                    potentialInstallPath = ldconfigMatch.Groups[1].Value;
+                    if (File.Exists(potentialInstallPath))
+                    {
+                        installLocations.Add(potentialInstallPath);
+                    }
+                }
+
+                potentialInstallPath = Path.Combine("/lib", fullName);
+                if (File.Exists(potentialInstallPath))
+                {
+                    installLocations.Add(potentialInstallPath);
+                }
+
+                potentialInstallPath = Path.Combine("/usr/lib", fullName);
+                if (File.Exists(potentialInstallPath))
+                {
+                    installLocations.Add(potentialInstallPath);
+                }
+
+                return installLocations;
+            }
+
+            public MaybeIntPtr LoadLibrary(string libraryPath)
+            {
+                var exceptions = new List<Exception>();
+
+                // NativeMethods.dlerror();
+                var libraryPointer = NativeMethods.dlopen(libraryPath, dlopenFlags.RTLD_LAZY | dlopenFlags.RTLD_GLOBAL);
+
+                if (libraryPointer != IntPtr.Zero)
+                {
+                    return new MaybeIntPtr(libraryPointer);
+                }
+
+                exceptions.Add(new Exception(NativeMethods.dlerror()));
+
+                return new MaybeIntPtr(exceptions.ToArray());
+            }
+
+            public void FreeLibrary(IntPtr libraryPointer)
+            {
+                NativeMethods.dlclose(libraryPointer);
+            }
+
+            public MaybeIntPtr GetFunctionPointer(IntPtr libraryPointer, string functionName)
+            {
+                var functionPointer = NativeMethods.dlsym(libraryPointer, functionName);
+
+                if (functionPointer != IntPtr.Zero)
+                {
+                    return new MaybeIntPtr(functionPointer);
+                }
+
+                return new MaybeIntPtr(new [] { new Exception(NativeMethods.dlerror()) });
+            }
+
+            private static class NativeMethods
+            {// libdl.so libcoreclr.so
+                [DllImport("libdl.so")]
+                public static extern IntPtr dlopen(string filename, dlopenFlags flag);
+
+                [DllImport("libdl.so")]
+                public static extern string dlerror();
+
+                [DllImport("libdl.so")]
+                public static extern IntPtr dlsym(IntPtr handle, string name);
+
+                [DllImport("libdl.so")]
+                public static extern int dlclose(IntPtr handle);
+            }
+
+            [Flags]
+            private enum dlopenFlags
+            {
+                RTLD_LAZY = 0x1,
+                RTLD_NOW = 0x2,
+                RTLD_LOCAL = 0x4,
+                RTLD_GLOBAL = 0x8,
+                RTLD_NOLOAD = 0x10,
+                RTLD_NODELETE = 0x80,
+            }
+        }
+
         private class NullLibraryLoader : ILibraryLoader
         {
             private static readonly string[] _empty = new string[0];
@@ -787,6 +925,11 @@
         /// <summary>
         /// A Windows 64-bit environment.
         /// </summary>
-        Win64
+        Win64,
+
+        /// <summary>
+        /// A Linux environment.
+        /// </summary>
+        Linux,
     }
 }


score replaced with coins

score replaced with coins

--- Documents/Unity3D/Catcheep/Assets/Scripts/gameManager.cs
+++ Documents/Unity3D/Catcheep/Assets/Scripts/gameManager.cs
@@ -50,7 +50,7 @@
         }

         scoreText = GameObject.Find("score");
-        scoreText.GetComponent<TextMeshProUGUI>().text = "Score: " + score;
+        scoreText.GetComponent<TextMeshProUGUI>().text = "" + score;

         //edge of screen is a vector3 that holds the screens width (can't get it directly cause of Screen/World point difference)
         Vector3 helpToolsPlateWidth = helpToolsPlate.GetComponent<RectTransform>().rect.size;


Fix(Adapters): if type is interface (eg: IEnumerable<int>), count not find ToString method

--- src/Mapster/Adapters/StringAdapter.cs
+++ src/Mapster/Adapters/StringAdapter.cs
@@ -18,6 +18,10 @@
             if (destinationType == typeof(string))
             {
                 var method = source.Type.GetMethod("ToString", Type.EmptyTypes);
+                if (method == null)
+                {
+                    method = typeof(object).GetMethod("ToString", Type.EmptyTypes);
+                }
                 return Expression.Call(source, method);
             }
             else //if (sourceType == typeof(string))


Fix chunks with blocks with Y > 239

Fix chunks with blocks with Y > 239

--- src/MiNET/MiNET/Worlds/ChunkColumn.cs
+++ src/MiNET/MiNET/Worlds/ChunkColumn.cs
@@ -312,21 +312,24 @@
 			{
 				NbtBinaryWriter writer = new NbtBinaryWriter(stream, true);

-				int topEmpty = 0;
-				for (int ci = 15; ci > 0; ci--)
-				{
-					if (chunks[ci].IsAllAir()) topEmpty = ci + 1;
+				int topEmpty = 16;
+				for (int ci = 15; ci >= 0; ci--)
+				{
+					if (chunks[ci].IsAllAir()) topEmpty = ci;
 					else break;
 				}

 				writer.Write((byte) topEmpty);
-				Log.Debug($"Saved sending {16 - topEmpty} chunks");
-
+
+				int sent = 0;
 				for (int ci = 0; ci < topEmpty; ci++)
 				{
 					writer.Write((byte) 0);
 					writer.Write(chunks[ci].GetBytes());
-				}
+					sent++;
+				}
+
+				Log.Debug($"Saved sending {16 - sent} chunks");

 				//RecalcHeight();
 				writer.Write(height);


Flag bug fixed - user cannot flag open fields

--- src/Minesweeper.Logic/PlayingField.cs
+++ src/Minesweeper.Logic/PlayingField.cs
@@ -78,7 +78,10 @@
         {
             MineCell field = this.field[row, column];

-            field.Status = FieldStatus.Flagged;
+            if (field.Status != FieldStatus.Opened)
+            {
+                field.Status = FieldStatus.Flagged;
+            }
         }

         internal void RemoveFlag(int row, int column)


Added a Color histogram class to Histogram.cs

This is a wrapper over three histograms which represent red, green, and blue.

--- src/lib/Imaging/Histogram.cs
+++ src/lib/Imaging/Histogram.cs
@@ -11,6 +11,46 @@

 namespace Libraries.Imaging
 {
+	public class ColorHistogram
+	{
+		//take a blow up in space to have verified code
+		private int[][] image;
+		private int width, height;
+		private Histogram red, green, blue;
+		public Histogram Red { get { return red; } }
+		public Histogram Green { get { return green; } }
+		public Histogram Blue { get { return blue; } }
+		public int Width { get { return width; } }
+		public int Height { get { return height; } }
+		public ColorHistogram(int[][] image)
+		{
+			width = image.Length;
+			height = image[0].Length;
+			byte[][] r = new byte[width][];
+			byte[][] g = new byte[width][];
+			byte[][] b = new byte[width][];
+			for(int i = 0; i < width; i++)
+			{
+				byte[] rLine = new byte[height];
+				byte[] gLine = new byte[height];
+				byte[] bLine = new byte[height];
+				byte[] line = image[i];
+				for(int j = 0; j < height; j++)
+				{
+					Color c = Color.FromArgb(line[j]);
+					rLine[j] = c.R;
+					gLine[j] = c.G;
+					bLine[j] = c.B;
+				}
+				r[i] = rLine;
+				g[i] = gLine;
+				b[i] = bLine;
+			}
+			red = new Histogram(r);
+			green = new Histogram(g);
+			blue = new Histogram(b);
+		}
+	}
   public class Histogram
   {
     //8-bit histogram


do not try to connect to empty port from bogus config data.

--- Xmmk/MainWindow.cs
+++ Xmmk/MainWindow.cs
@@ -40,11 +40,11 @@
 		{
 			settings.Load ();
 			SetOutputChannel (settings.OutputChannel);
-			if (settings.DefaultInputDevice != null)
+			if (!string.IsNullOrEmpty(settings.DefaultInputDevice))
 				ChangeInputDevice (settings.DefaultInputDevice);
-			if (settings.DefaultOutputDevice != null)
+			if (!string.IsNullOrEmpty(settings.DefaultOutputDevice))
 				ChangeOutputDevice (settings.DefaultOutputDevice);
-			if (settings.KeyMapLow != null && settings.KeyMapHigh != null)
+			if (!string.IsNullOrEmpty(settings.KeyMapLow) && !string.IsNullOrEmpty(settings.KeyMapHigh))
 				ApplyKeyMap (new KeyMap (null, settings.KeyMapLow, settings.KeyMapHigh));
 		}


Increase frame rate... and volatility.

Increase frame rate... and volatility.

--- EricIsAMAZING/CallbackQueue.cs
+++ EricIsAMAZING/CallbackQueue.cs
@@ -266,10 +266,13 @@
             lock (mutex)
             {
                 if (!enabled) return;
-                if (callbacks.Count == 0 && timeout != 0)
-                {
-                    sem.WaitOne(timeout);
-                }
+            }
+            if (callbacks.Count == 0 && timeout != 0)
+            {
+                sem.WaitOne(timeout);
+            }
+            lock(mutex)
+            {
                 if (callbacks.Count == 0 || !enabled)
                     return;
                 bool wasempty = tls.Count == 0;


var all the things

var all the things

--- Extras/MSOwin/LoggerFactory.cs
+++ Extras/MSOwin/LoggerFactory.cs
@@ -91,7 +91,7 @@

             public bool WriteCore(TraceEventType eventType, int eventId, object state, Exception exception, Func<object, Exception, string> formatter)
             {
-                LogEventLevel level = _getLogEventLevel(eventType);
+                var level = _getLogEventLevel(eventType);

                 // According to docs http://katanaproject.codeplex.com/SourceControl/latest#src/Microsoft.Owin/Logging/ILogger.cs
                 // "To check IsEnabled call WriteCore with only TraceEventType and check the return value, no event will be written."


object comparison

object comparison

removed deprecated code

--- src/Peachpie.Runtime/Comparison.cs
+++ src/Peachpie.Runtime/Comparison.cs
@@ -157,9 +157,8 @@
                 case PhpTypeCode.Alias: return Compare(x, y.Alias.Value);
                 case PhpTypeCode.String: return -CompareStringToObject(y.String, x);
                 case PhpTypeCode.Object:
-                    if (y.Object == null) goto case PhpTypeCode.Null;
-                    bool incomparable;
-                    var result = CompareObjects(x, y.Object, PhpComparer.Default, out incomparable);
+                    Debug.Assert(y.Object != null);
+                    var result = CompareObjects(x, y.Object, PhpComparer.Default, out var incomparable);
                     if (incomparable)
                     {
                         PhpException.Throw(PhpError.Warning,


Add checking for active build project configurations in solution files (#203)

--- source/Nuke.Common/Execution/BuildExecutor.cs
+++ source/Nuke.Common/Execution/BuildExecutor.cs
@@ -9,13 +9,14 @@
 using System.IO;
 using System.Linq;
 using System.Linq.Expressions;
-using System.Security.Cryptography;
-using System.Text;
 using System.Threading;
+using System.Threading.Tasks;
 using Nuke.Common.IO;
 using Nuke.Common.OutputSinks;
+using Nuke.Common.ProjectModel;
 using Nuke.Common.Tooling;
 using Nuke.Common.Utilities;
+using Nuke.Common.Utilities.Collections;

 namespace Nuke.Common.Execution
 {
@@ -23,6 +24,7 @@
     {
         public const string DefaultTarget = "default";
         private const int c_debuggerAttachTimeout = 10_000;
+        private const int c_configurationCheckTimeout = 500;

         public static int Execute<T>(Expression<Func<T, Target>> defaultTargetExpression)
             where T : NukeBuild
@@ -31,6 +33,7 @@
             var build = CreateBuildInstance(defaultTargetExpression);

             HandleCompletion(build);
+            CheckActiveBuildProjectConfigurations();
             AttachVisualStudioDebugger();

             try
@@ -88,9 +91,27 @@
             File.WriteAllText(NukeBuild.TemporaryDirectory / "visual-studio.dbg",
                 Process.GetCurrentProcess().Id.ToString());
             ControlFlow.Assert(SpinWait.SpinUntil(() => Debugger.IsAttached, millisecondsTimeout: c_debuggerAttachTimeout),
-                $"VisualStudio debugger was not attached within timeout of {c_debuggerAttachTimeout} milliseconds.");
-        }
-
+                $"VisualStudio debugger was not attached within {c_debuggerAttachTimeout} milliseconds.");
+        }
+
+        private static void CheckActiveBuildProjectConfigurations()
+        {
+            ControlFlow.AssertWarn(Task.Run(CheckConfiguration).Wait(c_configurationCheckTimeout),
+                $"Could not complete checking build configurations within {c_configurationCheckTimeout} milliseconds.");
+
+            Task CheckConfiguration()
+            {
+                Directory.GetFiles(NukeBuild.RootDirectory, "*.sln", SearchOption.AllDirectories)
+                    .Select(ProjectModelTasks.ParseSolution)
+                    .SelectMany(x => x.Projects)
+                    .Where(x => x.Directory.Equals(NukeBuild.BuildProjectDirectory))
+                    .Where(x => x.Configurations.Any(y => y.Key.Contains("Build")))
+                    .ForEach(x => Logger.Warn($"Solution {x.Solution.Path} has an active build configurations for {x.Path}."));
+
+                return Task.CompletedTask;
+            }
+        }
+
         private static void HandleCompletion(NukeBuild build)
         {
             var completionItems = new SortedDictionary<string, string[]>();


Fixed double-hooking of TransportAdded and TransportRemoved. Consistently reference IConnexion instances as 'client'.

--- GTServer/ClientRepeater/Program.cs
+++ GTServer/ClientRepeater/Program.cs
@@ -248,9 +248,6 @@
             {
                 foreach(ConnexionToClient client in list)
                 {
-                    client.TransportAdded += _client_TransportAdded;
-                    client.TransportRemoved += _client_TransportRemoved;
-
                     StringBuilder builder = new StringBuilder("Client joined: ");
                     builder.Append(client.Identity);
                     builder.Append(':');
@@ -267,11 +264,11 @@
             }
             if (SessionChangesChannel < 0) { return; }

-            foreach (IConnexion cnx in list)
-            {
-                cnx.TransportAdded += _client_TransportAdded;
-                cnx.TransportRemoved += _client_TransportRemoved;
-                server.Send(new SessionMessage((byte)SessionChangesChannel, cnx.Identity,
+            foreach (IConnexion client in list)
+            {
+                client.TransportAdded += _client_TransportAdded;
+                client.TransportRemoved += _client_TransportRemoved;
+                server.Send(new SessionMessage((byte)SessionChangesChannel, client.Identity,
                     SessionAction.Joined), null, sessionMDR);
             }
         }
@@ -298,29 +295,29 @@
             }
             if (SessionChangesChannel < 0) { return; }

-            foreach (IConnexion cnx in list)
+            foreach (IConnexion client in list)
             {
                 //inform others client is gone
-                server.Send(new SessionMessage((byte)SessionChangesChannel, cnx.Identity,
+                server.Send(new SessionMessage((byte)SessionChangesChannel, client.Identity,
                     SessionAction.Left), null, sessionMDR);
             }
         }

-        private void _client_TransportAdded(IConnexion connexion, ITransport newTransport)
+        private void _client_TransportAdded(IConnexion client, ITransport newTransport)
         {
             if (Verbose > 0)
             {
                 Console.WriteLine(String.Format("{0}: Client {1}: transport added: {2}",
-                    DateTime.Now, connexion.Identity, newTransport));
-            }
-        }
-
-        private void _client_TransportRemoved(IConnexion connexion, ITransport newTransport)
+                    DateTime.Now, client.Identity, newTransport));
+            }
+        }
+
+        private void _client_TransportRemoved(IConnexion client, ITransport newTransport)
         {
             if (Verbose > 0)
             {
                 Console.WriteLine(String.Format("{0}: Client {1}: transport removed: {2}",
-                    DateTime.Now, connexion.Identity, newTransport));
+                    DateTime.Now, client.Identity, newTransport));
             }
         }


Fixed issue in the ZoneService that caused a crash when the player is in an instance/personal story instance

--- GW2PAO.API/Services/ZoneService.cs
+++ GW2PAO.API/Services/ZoneService.cs
@@ -43,88 +43,96 @@
                 foreach (var floorId in map.Floors)
                 {
                     var floor = GwApi.GetMapFloor(map.ContinentId, floorId);
+                    if (floor != null && floor.Regions != null)
+                    {
+                        // Find the region that this map is located in
+                        var region = floor.Regions.Values.FirstOrDefault(r => r.Maps.ContainsKey(mapId));
+                        if (region != null)
+                        {
+                            if (region.Maps.ContainsKey(mapId))
+                            {
+                                var regionMap = region.Maps[mapId];

-                    // Find the region that this map is located in
-                    var region = floor.Regions.Values.FirstOrDefault(r => r.Maps.ContainsKey(mapId));
-                    var regionMap = region.Maps[mapId];
+                                // Iterate over every PointsOfInterest in the map (note: PointsOfInterest includes POIs, Vistas, and Waypoints)
+                                foreach (var item in regionMap.PointsOfInterest)
+                                {
+                                    if (item.Type != PointOfInterestType.Unlock)
+                                    {
+                                        // If we havn't already added the item, get it's info and add it
+                                        if (!zoneItems.Any(zi => zi.ID == item.Id))
+                                        {
+                                            // Determine the location
+                                            var location = GwMapsHelper.PixelToWorldPos(map, new Gw2Point(item.Coordinates[0], item.Coordinates[1]), continent.MaxZoom);

-                    // Iterate over every PointsOfInterest in the map (note: PointsOfInterest includes POIs, Vistas, and Waypoints)
-                    foreach (var item in regionMap.PointsOfInterest)
-                    {
-                        if (item.Type != PointOfInterestType.Unlock)
-                        {
-                            // If we havn't already added the item, get it's info and add it
-                            if (!zoneItems.Any(zi => zi.ID == item.Id))
-                            {
-                                // Determine the location
-                                var location = GwMapsHelper.PixelToWorldPos(map, new Gw2Point(item.Coordinates[0], item.Coordinates[1]), continent.MaxZoom);
+                                            ZoneItem zoneItem = new ZoneItem();
+                                            zoneItem.ID = item.Id;
+                                            zoneItem.Name = item.Name;
+                                            zoneItem.Location = new Point(location.X, location.Y);
+                                            zoneItem.MapId = mapId;
+                                            zoneItem.MapName = map.MapName;

-                                ZoneItem zoneItem = new ZoneItem();
-                                zoneItem.ID = item.Id;
-                                zoneItem.Name = item.Name;
-                                zoneItem.Location = new Point(location.X, location.Y);
-                                zoneItem.MapId = mapId;
-                                zoneItem.MapName = map.MapName;
+                                            // Translate the item's type
+                                            switch (item.Type)
+                                            {
+                                                case PointOfInterestType.Landmark:
+                                                    zoneItem.Type = Data.Enums.ZoneItemType.PointOfInterest;
+                                                    break;
+                                                case PointOfInterestType.Vista:
+                                                    zoneItem.Type = Data.Enums.ZoneItemType.Vista;
+                                                    break;
+                                                case PointOfInterestType.Waypoint:
+                                                    zoneItem.Type = Data.Enums.ZoneItemType.Waypoint;
+                                                    break;
+                                            }

-                                // Translate the item's type
-                                switch (item.Type)
-                                {
-                                    case PointOfInterestType.Landmark:
-                                        zoneItem.Type = Data.Enums.ZoneItemType.PointOfInterest;
-                                        break;
-                                    case PointOfInterestType.Vista:
-                                        zoneItem.Type = Data.Enums.ZoneItemType.Vista;
-                                        break;
-                                    case PointOfInterestType.Waypoint:
-                                        zoneItem.Type = Data.Enums.ZoneItemType.Waypoint;
-                                        break;
+                                            zoneItems.Add(zoneItem);
+                                        }
+                                    }
                                 }

-                                zoneItems.Add(zoneItem);
+                                // Iterate over every Task in the map (Tasks are the same as HeartQuests
+                                foreach (var item in regionMap.Tasks)
+                                {
+                                    // If we havn't already added the item, get it's info and add it
+                                    if (!zoneItems.Any(zi => zi.ID == item.Id))
+                                    {
+                                        // Determine the location
+                                        var location = GwMapsHelper.PixelToWorldPos(map, new Gw2Point(item.Coordinates[0], item.Coordinates[1]), continent.MaxZoom);
+
+                                        ZoneItem zoneItem = new ZoneItem();
+                                        zoneItem.ID = item.Id;
+                                        zoneItem.Name = item.Objective;
+                                        zoneItem.Level = item.Level;
+                                        zoneItem.Location = new Point(location.X, location.Y);
+                                        zoneItem.MapId = mapId;
+                                        zoneItem.MapName = map.MapName;
+                                        zoneItem.Type = Data.Enums.ZoneItemType.HeartQuest;
+
+                                        zoneItems.Add(zoneItem);
+                                    }
+                                }
+
+                                // Iterate over every skill challenge in the map
+                                foreach (var item in regionMap.SkillChallenges)
+                                {
+                                    // Determine the location, this serves an internally-used ID for skill challenges
+                                    var location = GwMapsHelper.PixelToWorldPos(map, new Gw2Point(item.Coordinents[0], item.Coordinents[1]), continent.MaxZoom);
+                                    int id = (int)(mapId + location.X + location.Y);
+
+                                    // If we havn't already added the item, get it's info and add it
+                                    if (!zoneItems.Any(zi => zi.ID == id))
+                                    {
+                                        ZoneItem zoneItem = new ZoneItem();
+                                        zoneItem.ID = id;
+                                        zoneItem.Location = new Point(location.X, location.Y);
+                                        zoneItem.MapId = mapId;
+                                        zoneItem.MapName = map.MapName;
+                                        zoneItem.Type = Data.Enums.ZoneItemType.SkillChallenge;
+
+                                        zoneItems.Add(zoneItem);
+                                    }
+                                }
                             }
-                        }
-                    }
-
-                    // Iterate over every Task in the map (Tasks are the same as HeartQuests
-                    foreach (var item in regionMap.Tasks)
-                    {
-                        // If we havn't already added the item, get it's info and add it
-                        if (!zoneItems.Any(zi => zi.ID == item.Id))
-                        {
-                            // Determine the location
-                            var location = GwMapsHelper.PixelToWorldPos(map, new Gw2Point(item.Coordinates[0], item.Coordinates[1]), continent.MaxZoom);
-
-                            ZoneItem zoneItem = new ZoneItem();
-                            zoneItem.ID = item.Id;
-                            zoneItem.Name = item.Objective;
-                            zoneItem.Level = item.Level;
-                            zoneItem.Location = new Point(location.X, location.Y);
-                            zoneItem.MapId = mapId;
-                            zoneItem.MapName = map.MapName;
-                            zoneItem.Type = Data.Enums.ZoneItemType.HeartQuest;
-
-                            zoneItems.Add(zoneItem);
-                        }
-                    }
-
-                    // Iterate over every skill challenge in the map
-                    foreach (var item in regionMap.SkillChallenges)
-                    {
-                        // Determine the location, this serves an internally-used ID for skill challenges
-                        var location = GwMapsHelper.PixelToWorldPos(map, new Gw2Point(item.Coordinents[0], item.Coordinents[1]), continent.MaxZoom);
-                        int id = (int)(mapId + location.X + location.Y);
-
-                        // If we havn't already added the item, get it's info and add it
-                        if (!zoneItems.Any(zi => zi.ID == id))
-                        {
-                            ZoneItem zoneItem = new ZoneItem();
-                            zoneItem.ID = id;
-                            zoneItem.Location = new Point(location.X, location.Y);
-                            zoneItem.MapId = mapId;
-                            zoneItem.MapName = map.MapName;
-                            zoneItem.Type = Data.Enums.ZoneItemType.SkillChallenge;
-
-                            zoneItems.Add(zoneItem);
                         }
                     }
                 }
@@ -143,7 +151,7 @@
             if (map != null)
                 return map.MapName;
             else
-                return null;
+                return "Unknown";
         }
     }
 }


Created parameterless ctor

Created parameterless ctor

--- src/FeatureDeploy/Project.cs
+++ src/FeatureDeploy/Project.cs
@@ -17,44 +17,17 @@
         /// <summary>
         /// Build server definition
         /// </summary>
-        public IBuildServer BuildServer { get; private set; }
+        public IBuildServer BuildServer { get; set; }

         /// <summary>
         /// Deploy definition
         /// </summary>
-        public IDeploy DeployMethod { get; private set; }
+        public IDeploy DeployMethod { get; set; }

         /// <summary>
         /// VCS definition
         /// </summary>
-        public IVCSSource VCS { get; private set; }
-
-        /// <summary>
-        /// Create a project to watch and deploy
-        /// </summary>
-        /// <param name="name">Project name</param>
-        /// <param name="buildServer">Build server definition</param>
-        /// <param name="vcs">VCS definition</param>
-        /// <param name="deploy">Deploy definition</param>
-        public Project(string name, IBuildServer buildServer, IVCSSource vcs, IDeploy deploy)
-        {
-            if (string.IsNullOrEmpty(name))
-                throw new ArgumentNullException("name", "Project name cannot be null");
-
-            if (buildServer == null)
-                throw new ArgumentNullException("buildServer", "Build server definition cannot be null");
-
-            if (vcs == null)
-                throw new ArgumentNullException("vcs", "VCS definition cannot be null");
-
-            if (deploy == null)
-                throw new ArgumentNullException("deploy", "Deploy definition cannot be null");
-
-            this.Name = name;
-            this.BuildServer = buildServer;
-            this.DeployMethod = deploy;
-            this.VCS = vcs;
-        }
+        public IVCSSource VCS { get; set; }

         /// <summary>
         /// List the built project features
@@ -62,6 +35,12 @@
         /// <returns>Build list</returns>
         public async Task<IEnumerable<Build>> GetFeatures()
         {
+            if (this.BuildServer == null)
+                throw new ArgumentNullException("buildServer", "Build server definition cannot be null");
+
+            if (this.VCS == null)
+                throw new ArgumentNullException("vcs", "VCS definition cannot be null");
+
             var branches = await this.VCS.GetBranches();
             var builds = await this.BuildServer.GetBuilds(branches);

@@ -75,10 +54,16 @@
         /// <returns>Async task</returns>
         public async Task Deploy(string buildId)
         {
+            if (this.BuildServer == null)
+                throw new ArgumentNullException("buildServer", "Build server definition cannot be null");
+
+            if (this.DeployMethod == null)
+                throw new ArgumentNullException("deploy", "Deploy definition cannot be null");
+
             var artifactsPath = await this.BuildServer.DownloadArtifacts(buildId);
             await this.DeployMethod.Deploy(artifactsPath.FullName);

             await Task.Factory.StartNew(() => artifactsPath.Delete(true));
         }
     }
-}
+}


Resource wurde nicht korrekt aktualisiert

--- VaultAtlas/src/VaultAtlas.Editor/UI/ShowResourceEditor.cs
+++ VaultAtlas/src/VaultAtlas.Editor/UI/ShowResourceEditor.cs
@@ -338,6 +338,7 @@
                             textEd.Dock = DockStyle.Fill;
                         }

+					    textEd.Resource = res;
                         textEd.Value = res.Value;

 						break;