Add title screen support for EU and JP builds

--- OpenKh.Game/States/TitleState.cs
+++ OpenKh.Game/States/TitleState.cs
@@ -11,14 +11,98 @@
 {
     public class TitleState : IState
     {
-        private const int BackgroundScreen = 14;
-        private const int Menu1 = 0;
-        private const int Menu2 = 2;
-        private const int Menu1OptionsCount = 2;
-        private const int Menu2OptionsCount = 3;
         private const int MainMenuNewGameOption = 0;
         private const int MainMenuLoadOption = 1;
         private const int MainMenuTheaterOption = 2;
+        private const int MainMenuBackOption = 3;
+        private const int MainMenuMaxOptionCount = 4;
+
+        private class TitleLayout
+        {
+            public int FadeIn { get; set; }
+            public int Copyright { get; set; }
+            public int Intro { get; set; }
+            public int IntroSkip { get; set; }
+            public int NewGame { get; set; }
+            public int MenuOptionNewGame { get; set; }
+            public int MenuOptionLoad { get; set; }
+            public int MenuOptionTheater { get; set; }
+            public int MenuOptionBack { get; set; }
+            public bool HasTheater { get; set; }
+            public bool HasBack { get; set; }
+        }
+
+        private static readonly TitleLayout VanillaTitleLayout = new TitleLayout
+        {
+            Copyright = 8,
+            Intro = 11,
+            IntroSkip = 12,
+            NewGame = 13,
+            MenuOptionNewGame = 0,
+            MenuOptionLoad = 1,
+            MenuOptionTheater = 2,
+            MenuOptionBack = 3,
+            HasTheater = false,
+            HasBack = false,
+        };
+
+        private static readonly TitleLayout FinalMixTitleLayout = new TitleLayout
+        {
+            FadeIn = 17,
+            Copyright = 8,
+            Intro = 12,
+            IntroSkip = 14,
+            NewGame = 10, // but also 15?
+            MenuOptionNewGame = 0,
+            MenuOptionLoad = 1,
+            MenuOptionTheater = 4,
+            HasTheater = false,
+            HasBack = false,
+        };
+
+        private static readonly TitleLayout FinalMixTheaterTitleLayout = new TitleLayout
+        {
+            FadeIn = 17,
+            Copyright = 8,
+            Intro = 13,
+            IntroSkip = 14,
+            NewGame = 11, // but also 16?
+            MenuOptionNewGame = 2,
+            MenuOptionLoad = 3,
+            MenuOptionTheater = 4,
+            HasTheater = true,
+            HasBack = false,
+        };
+
+        private static readonly TitleLayout ReMixTitleLayout = new TitleLayout
+        {
+            FadeIn = 17,
+            Copyright = 8,
+            Intro = 12,
+            IntroSkip = 14,
+            NewGame = 10, // but also 15?
+            MenuOptionNewGame = 0,
+            MenuOptionLoad = 1,
+            MenuOptionTheater = 4,
+            MenuOptionBack = 18,
+            HasTheater = false,
+            HasBack = true,
+        };
+
+        private static readonly TitleLayout ReMixTheaterTitleLayout = new TitleLayout
+        {
+            FadeIn = 17,
+            Copyright = 8,
+            Intro = 13,
+            IntroSkip = 14,
+            NewGame = 11, // but also 15?
+            MenuOptionNewGame = 2,
+            MenuOptionLoad = 3,
+            MenuOptionTheater = 4,
+            MenuOptionBack = 19,
+            HasTheater = false,
+            HasBack = true,
+        };

         private Kernel _kernel;
         private ArchiveManager _archiveManager;
@@ -29,7 +113,8 @@
         private LayoutRenderer layoutRendererBg;
         private LayoutRenderer layoutRendererTheater;
         private Dictionary<string, IEnumerable<ISurface>> cachedSurfaces;
-
+
+        private TitleLayout _titleLayout;
         private bool _isTheaterModeUnlocked;
         private int _optionSelected;
         private bool _isInTheaterMenu;
@@ -47,21 +132,23 @@
             _archiveManager.LoadArchive($"menu/{_kernel.Region}/title.2ld");
             _archiveManager.LoadArchive($"menu/{_kernel.Region}/save.2ld");

+            _isTheaterModeUnlocked = true;
+            if (_kernel.RegionId == Constants.RegionFinalMix)
+            {
+                if (_isTheaterModeUnlocked)
+                    _titleLayout = FinalMixTheaterTitleLayout;
+                else
+                    _titleLayout = FinalMixTitleLayout;
+            }
+            else
+                _titleLayout = VanillaTitleLayout;
+
             layoutRendererBg = CreateLayoutRenderer("titl");
-            layoutRendererBg.SelectedSequenceGroupIndex = BackgroundScreen;
-
             layoutRendererFg = CreateLayoutRenderer("titl");
-
-            // it will not work for non-FM versions
-            if (_kernel.RegionId == Constants.RegionFinalMix)
-            {
-                _isTheaterModeUnlocked = true;
+            layoutRendererBg.SelectedSequenceGroupIndex = _titleLayout.IntroSkip;
+
+            if (_titleLayout.HasTheater)
                 layoutRendererTheater = CreateLayoutRenderer("even");
-            }
-            else
-            {
-                _isTheaterModeUnlocked = false;
-            }

             SetOption(0);
         }
@@ -117,17 +204,9 @@
         {
             var currentOption = _optionSelected;
             if (_inputManager.IsUp)
-            {
                 currentOption--;
-                if (currentOption < 0)
-                    currentOption = GetMaxOptionsCount() - 1;
-            }
             else if (_inputManager.IsDown)
-            {
                 currentOption++;
-                if (currentOption >= GetMaxOptionsCount())
-                    currentOption = 0;
-            }
             else if (_inputManager.IsCircle || _inputManager.IsCross)
             {
                 switch (currentOption)
@@ -146,6 +225,22 @@
                 }
             }

+            if (currentOption == MainMenuTheaterOption && !_titleLayout.HasTheater)
+                currentOption++;
+            if (currentOption == MainMenuBackOption && !_titleLayout.HasBack)
+                currentOption++;
+            if (currentOption >= MainMenuMaxOptionCount)
+                currentOption = 0;
+            if (currentOption < 0)
+            {
+                if (_titleLayout.HasBack)
+                    currentOption = MainMenuBackOption;
+                else if (_titleLayout.HasTheater)
+                    currentOption = MainMenuTheaterOption;
+                else
+                    currentOption = MainMenuLoadOption;
+            }
+
             if (currentOption != _optionSelected)
                 SetOption(currentOption);
         }
@@ -159,31 +254,44 @@
             }
         }

-        private int GetMaxOptionsCount() => _isTheaterModeUnlocked ? Menu2OptionsCount : Menu1OptionsCount;
-
         private void SetOption(int option)
         {
             _optionSelected = option;
-            layoutRendererFg.SelectedSequenceGroupIndex = _optionSelected + (_isTheaterModeUnlocked ? Menu2 : Menu1);
+
+            switch (_optionSelected)
+            {
+                case MainMenuNewGameOption:
+                    layoutRendererFg.SelectedSequenceGroupIndex = _titleLayout.MenuOptionNewGame;
+                    break;
+                case MainMenuLoadOption:
+                    layoutRendererFg.SelectedSequenceGroupIndex = _titleLayout.MenuOptionLoad;
+                    break;
+                case MainMenuTheaterOption:
+                    layoutRendererFg.SelectedSequenceGroupIndex = _titleLayout.MenuOptionTheater;
+                    break;
+                case MainMenuBackOption:
+                    layoutRendererFg.SelectedSequenceGroupIndex = _titleLayout.MenuOptionBack;
+                    break;
+            }
         }

         private void CheckTitlLoop(LayoutRenderer layout)
         {
-            switch (layout.SelectedSequenceGroupIndex)
-            {
-                case Menu1:
-                case Menu1 + 1:
-                case Menu2:
-                case Menu2 + 1:
-                case Menu2 + 2:
-                    if (layout.FrameIndex > 178)
-                        layout.FrameIndex = 70;
+            var currentSequenceGroupIndex = layout.SelectedSequenceGroupIndex;
+
+            if (currentSequenceGroupIndex == _titleLayout.MenuOptionNewGame ||
+                currentSequenceGroupIndex == _titleLayout.MenuOptionLoad ||
+                currentSequenceGroupIndex == _titleLayout.MenuOptionTheater ||
+                currentSequenceGroupIndex == _titleLayout.MenuOptionBack)
+            {
+                if (layout.FrameIndex > 178)
+                    layout.FrameIndex = 70;
+                layout.FrameIndex++;
+            }
+            else if (currentSequenceGroupIndex == _titleLayout.IntroSkip)
+            {
+                if (layout.FrameIndex < 119)
                     layout.FrameIndex++;
-                    break;
-                case BackgroundScreen:
-                    if (layout.FrameIndex < 119)
-                        layout.FrameIndex++;
-                    break;
             }
         }


asset tests that still need UploadAttempts

--- OpenSim/Data/Tests/AssetTests.cs
+++ OpenSim/Data/Tests/AssetTests.cs
@@ -125,14 +125,20 @@
             m_db.StoreAsset(a1);
             m_db.StoreAsset(a2);
             m_db.StoreAsset(a3);
+            a1.UploadAttempts = 0;
+            a2.UploadAttempts = 0;
+            a3.UploadAttempts = 0;

             AssetBase a1a = m_db.GetAsset(uuid1);
+            a1a.UploadAttempts = 0;
             Assert.That(a1a, Constraints.PropertyCompareConstraint(a1));

             AssetBase a2a = m_db.GetAsset(uuid2);
+            a2a.UploadAttempts = 0;
             Assert.That(a2a, Constraints.PropertyCompareConstraint(a2));

             AssetBase a3a = m_db.GetAsset(uuid3);
+            a3a.UploadAttempts = 0;
             Assert.That(a3a, Constraints.PropertyCompareConstraint(a3));

             scrambler.Scramble(a1a);
@@ -142,14 +148,20 @@
             m_db.StoreAsset(a1a);
             m_db.StoreAsset(a2a);
             m_db.StoreAsset(a3a);
+            a1a.UploadAttempts = 0;
+            a2a.UploadAttempts = 0;
+            a3a.UploadAttempts = 0;

             AssetBase a1b = m_db.GetAsset(uuid1);
+            a1b.UploadAttempts = 0;
             Assert.That(a1b, Constraints.PropertyCompareConstraint(a1a));

             AssetBase a2b = m_db.GetAsset(uuid2);
+            a2b.UploadAttempts = 0;
             Assert.That(a2b, Constraints.PropertyCompareConstraint(a2a));

             AssetBase a3b = m_db.GetAsset(uuid3);
+            a3b.UploadAttempts = 0;
             Assert.That(a3b, Constraints.PropertyCompareConstraint(a3a));

             bool[] exist = m_db.AssetsExist(new[] { uuid1, uuid2, uuid3 });
@@ -190,16 +202,22 @@
             a3.Data = data1;

             m_db.StoreAsset(a1);
+            a1.UploadAttempts = 0;
             m_db.StoreAsset(a2);
+            a2.UploadAttempts = 0;
             m_db.StoreAsset(a3);
+            a3.UploadAttempts = 0;

             AssetBase a1a = m_db.GetAsset(uuid1);
+            a1a.UploadAttempts = 0;
             Assert.That(a1a, Constraints.PropertyCompareConstraint(a1));

             AssetBase a2a = m_db.GetAsset(uuid2);
+            a2a.UploadAttempts = 0;
             Assert.That(a2a, Constraints.PropertyCompareConstraint(a2));

             AssetBase a3a = m_db.GetAsset(uuid3);
+            a3a.UploadAttempts = 0;
             Assert.That(a3a, Constraints.PropertyCompareConstraint(a3));
         }
     }


exclude base class methods from hooks

exclude base class methods from hooks

--- Oxide.Ext.CSharp/CSharpPlugin.cs
+++ Oxide.Ext.CSharp/CSharpPlugin.cs
@@ -131,7 +131,8 @@
                 if (info_attributes.Length > 0) continue;
                 if (method.Name == "OnFrame") HookedOnFrame = true;
                 // Assume all private instance methods which are not explicitly hooked could be hooks
-                if (!hooks.ContainsKey(method.Name)) hooks[method.Name] = method;
+                if (method.DeclaringType.Name == type.Name && !hooks.ContainsKey(method.Name))
+                    hooks[method.Name] = method;
             }
         }


[Rust] Add map, size, and seed to console status bar

--- Oxide.Game.Rust/RustExtension.cs
+++ Oxide.Game.Rust/RustExtension.cs
@@ -1,6 +1,5 @@
 using System;
 using System.Collections.Generic;
-using System.Diagnostics;
 using System.IO;
 using System.Linq;
 using System.Reflection;
@@ -207,9 +206,8 @@

             Interface.Oxide.ServerConsole.Status3Left = () =>
             {
-                // TODO: World/map name, size, and seed
                 var gameTime = (!TOD_Sky.Instance ? DateTime.Now : TOD_Sky.Instance.Cycle.DateTime).ToString("h:mm tt").ToLower();
-                return string.Concat(" ", gameTime);
+                return string.Concat(" ", gameTime, ", ", ConVar.Server.level, " [", ConVar.Server.worldsize, ", ", ConVar.Server.seed, "]");
             };
             Interface.Oxide.ServerConsole.Status3Right = () =>
             {


Rename "func" to "parse".

Rename "func" to "parse".

--- Pegasus.Tests/RegressionTests.cs
+++ Pegasus.Tests/RegressionTests.cs
@@ -74,9 +74,9 @@
             var grammar = new PegParser().Parse("start = ' ' 'hoge'<1,,' '> ' ';");

             var result = PegCompiler.Compile(grammar);
-            var func = CodeCompiler.Compile<string>(result.Code);
+            var parse = CodeCompiler.Compile<string>(result.Code);

-            Assert.That(func(" hoge ", null), Is.EqualTo(" hoge "));
+            Assert.That(parse(" hoge ", null), Is.EqualTo(" hoge "));
         }
     }
 }


Added some braces (to make StyleCop complain less)

--- BattleField_Refactored/BattleField_Refactored/BattleField.cs
+++ BattleField_Refactored/BattleField_Refactored/BattleField.cs
@@ -53,11 +53,12 @@
                 {
                     Console.Write(" " + this.field[i, j].ToString());
                 }
-                Console.WriteLine(""); Console.WriteLine(""); Console.WriteLine("");
-            }
-        }
+            }
+        }
+
         public void InitMines()
-        {//tuka ne sym siguren kakvo tochno pravq ama pyk raboti
+        {
+            //tuka ne sym siguren kakvo tochno pravq ama pyk raboti
             int minesDownLimit = Convert.ToInt32(0.15 * fieldSize * fieldSize);
             int minesUpperLimit = Convert.ToInt32(0.30 * fieldSize * fieldSize);
             int tempMineXCoordinate;
@@ -82,11 +83,15 @@
                     tempMineYCoordinate =
                         Convert.ToInt32(rnd.Next(0, fieldSize - 1));
                     if (this.field[tempMineXCoordinate, tempMineYCoordinate] == " - ")
-                        this.field[tempMineXCoordinate, tempMineYCoordinate] =
-                            " " + Convert.ToString(rnd.Next(1, 6) + " ");
+                    {
+                        this.field[tempMineXCoordinate, tempMineYCoordinate] = " " + Convert.ToString(rnd.Next(1, 6) + " ");
+                    }
                     else
+                    {
                         flag = false;
-                } while (flag);
+                    }
+                }
+                while (flag);
             }
         }

@@ -95,191 +100,397 @@
         public void DetonateMine1(int XCoord, int YCoord)
         {
             if ((XCoord - 1 >= 0) && (XCoord - 1 < fieldSize) && (YCoord - 1 >= 0) && (YCoord - 1 < fieldSize))
+            {
                 this.field[XCoord - 1, YCoord - 1] = " X ";
+            }
+
             if ((XCoord - 1 >= 0) && (XCoord - 1 < fieldSize) && (YCoord + 1 >= 0) && (YCoord + 1 < fieldSize))
+            {
                 this.field[XCoord - 1, YCoord + 1] = " X ";
+            }
+
             if ((XCoord + 1 >= 0) && (XCoord + 1 < fieldSize) && (YCoord - 1 >= 0) && (YCoord - 1 < fieldSize))
+            {
                 this.field[XCoord + 1, YCoord - 1] = " X ";
+            }
+
             if ((XCoord + 1 >= 0) && (XCoord + 1 < fieldSize) && (YCoord + 1 >= 0) && (YCoord + 1 < fieldSize))
+            {
                 this.field[XCoord + 1, YCoord + 1] = " X ";
-            if ((XCoord >= 0) && (XCoord < fieldSize) && (YCoord >= 0) && (YCoord < fieldSize))
-                this.field[XCoord, YCoord] = " X ";
+            }
+
+            if ((XCoord >= 0) && (XCoord < fieldSize) && (YCoord >= 0) && (YCoord < fieldSize))
+            {
+                this.field[XCoord, YCoord] = " X ";
+            }
         }

         public void DetonateMine2(int XCoord, int YCoord)
         {
             if ((XCoord - 1 >= 0) && (XCoord - 1 < fieldSize) && (YCoord - 1 >= 0) && (YCoord - 1 < fieldSize))
+            {
                 this.field[XCoord - 1, YCoord - 1] = " X ";
+            }
+
             if ((XCoord >= 0) && (XCoord < fieldSize) && (YCoord - 1 >= 0) && (YCoord - 1 < fieldSize))
+            {
                 this.field[XCoord, YCoord - 1] = " X ";
+            }
+
             if ((XCoord + 1 >= 0) && (XCoord + 1 < fieldSize) && (YCoord - 1 >= 0) && (YCoord - 1 < fieldSize))
+            {
                 this.field[XCoord + 1, YCoord - 1] = " X ";
+            }

             if ((XCoord - 1 >= 0) && (XCoord - 1 < fieldSize) && (YCoord >= 0) && (YCoord < fieldSize))
+            {
                 this.field[XCoord - 1, YCoord] = " X ";
-            if ((XCoord >= 0) && (XCoord < fieldSize) && (YCoord >= 0) && (YCoord < fieldSize))
-                this.field[XCoord, YCoord] = " X ";
+            }
+
+            if ((XCoord >= 0) && (XCoord < fieldSize) && (YCoord >= 0) && (YCoord < fieldSize))
+            {
+                this.field[XCoord, YCoord] = " X ";
+            }
+
             if ((XCoord + 1 >= 0) && (XCoord + 1 < fieldSize) && (YCoord >= 0) && (YCoord < fieldSize))
+            {
                 this.field[XCoord + 1, YCoord] = " X ";
+            }

             if ((XCoord - 1 >= 0) && (XCoord - 1 < fieldSize) && (YCoord + 1 >= 0) && (YCoord + 1 < fieldSize))
+            {
                 this.field[XCoord - 1, YCoord + 1] = " X ";
+            }
+
             if ((XCoord >= 0) && (XCoord < fieldSize) && (YCoord + 1 >= 0) && (YCoord + 1 < fieldSize))
+            {
                 this.field[XCoord, YCoord + 1] = " X ";
+            }
+
             if ((XCoord + 1 >= 0) && (XCoord + 1 < fieldSize) && (YCoord + 1 >= 0) && (YCoord + 1 < fieldSize))
+            {
                 this.field[XCoord + 1, YCoord + 1] = " X ";
+            }
         }

         public void DetonateMine3(int XCoord, int YCoord)
         {
             if ((XCoord - 2 >= 0) && (XCoord - 2 < fieldSize) && (YCoord >= 0) && (YCoord < fieldSize))
+            {
                 this.field[XCoord - 2, YCoord] = " X ";
+            }
+
             if ((XCoord - 1 >= 0) && (XCoord - 1 < fieldSize) && (YCoord >= 0) && (YCoord < fieldSize))
+            {
                 this.field[XCoord - 1, YCoord] = " X ";
-            if ((XCoord >= 0) && (XCoord < fieldSize) && (YCoord >= 0) && (YCoord < fieldSize))
-                this.field[XCoord, YCoord] = " X ";
+            }
+
+            if ((XCoord >= 0) && (XCoord < fieldSize) && (YCoord >= 0) && (YCoord < fieldSize))
+            {
+                this.field[XCoord, YCoord] = " X ";
+            }
+
             if ((XCoord + 1 >= 0) && (XCoord + 1 < fieldSize) && (YCoord >= 0) && (YCoord < fieldSize))
+            {
                 this.field[XCoord + 1, YCoord] = " X ";
+            }
+
             if ((XCoord + 2 >= 0) && (XCoord + 2 < fieldSize) && (YCoord >= 0) && (YCoord < fieldSize))
+            {
                 this.field[XCoord + 2, YCoord] = " X ";
+            }
+

             if ((XCoord - 1 >= 0) && (XCoord - 1 < fieldSize) && (YCoord - 1 >= 0) && (YCoord - 1 < fieldSize))
+            {
                 this.field[XCoord - 1, YCoord - 1] = " X ";
-            if ((XCoord >= 0) && (XCoord < fieldSize) && (YCoord >= 0) && (YCoord < fieldSize))
-                this.field[XCoord, YCoord] = " X ";
+            }
+
+            if ((XCoord >= 0) && (XCoord < fieldSize) && (YCoord >= 0) && (YCoord < fieldSize))
+            {
+                this.field[XCoord, YCoord] = " X ";
+            }
+
             if ((XCoord + 1 >= 0) && (XCoord + 1 < fieldSize) && (YCoord + 1 >= 0) && (YCoord + 1 < fieldSize))
+            {
                 this.field[XCoord + 1, YCoord + 1] = " X ";
+            }

             if ((XCoord - 1 >= 0) && (XCoord - 1 < fieldSize) && (YCoord + 1 >= 0) && (YCoord + 1 < fieldSize))
+            {
                 this.field[XCoord - 1, YCoord + 1] = " X ";
-            if ((XCoord >= 0) && (XCoord < fieldSize) && (YCoord >= 0) && (YCoord < fieldSize))
-                this.field[XCoord, YCoord] = " X ";
+            }
+
+            if ((XCoord >= 0) && (XCoord < fieldSize) && (YCoord >= 0) && (YCoord < fieldSize))
+            {
+                this.field[XCoord, YCoord] = " X ";
+            }
+
             if ((XCoord + 1 >= 0) && (XCoord + 1 < fieldSize) && (YCoord - 1 >= 0) && (YCoord - 1 < fieldSize))
+            {
                 this.field[XCoord + 1, YCoord - 1] = " X ";
+            }

             if ((XCoord >= 0) && (XCoord < fieldSize) && (YCoord - 2 >= 0) && (YCoord - 2 < fieldSize))
+            {
                 this.field[XCoord, YCoord - 2] = " X ";
+            }
+
             if ((XCoord >= 0) && (XCoord < fieldSize) && (YCoord - 1 >= 0) && (YCoord - 1 < fieldSize))
+            {
                 this.field[XCoord, YCoord - 1] = " X ";
-            if ((XCoord >= 0) && (XCoord < fieldSize) && (YCoord >= 0) && (YCoord < fieldSize))
-                this.field[XCoord, YCoord] = " X ";
+            }
+
+            if ((XCoord >= 0) && (XCoord < fieldSize) && (YCoord >= 0) && (YCoord < fieldSize))
+            {
+                this.field[XCoord, YCoord] = " X ";
+            }
+
             if ((XCoord >= 0) && (XCoord < fieldSize) && (YCoord + 1 >= 0) && (YCoord + 1 < fieldSize))
+            {
                 this.field[XCoord, YCoord + 1] = " X ";
+            }
+
             if ((XCoord >= 0) && (XCoord < fieldSize) && (YCoord + 2 >= 0) && (YCoord + 2 < fieldSize))
+            {
                 this.field[XCoord, YCoord + 2] = " X ";
+            }
         }

         public void DetonateMine4(int XCoord, int YCoord)
         {
             if ((XCoord - 1 >= 0) && (XCoord - 1 < fieldSize) && (YCoord - 1 >= 0) && (YCoord - 1 < fieldSize))
+            {
                 this.field[XCoord - 1, YCoord - 1] = " X ";
+            }
+
             if ((XCoord >= 0) && (XCoord < fieldSize) && (YCoord - 1 >= 0) && (YCoord - 1 < fieldSize))
+            {
                 this.field[XCoord, YCoord - 1] = " X ";
+            }
+
             if ((XCoord + 1 >= 0) && (XCoord + 1 < fieldSize) && (YCoord - 1 >= 0) && (YCoord - 1 < fieldSize))
+            {
                 this.field[XCoord + 1, YCoord - 1] = " X ";
+            }

             if ((XCoord - 1 >= 0) && (XCoord - 1 < fieldSize) && (YCoord >= 0) && (YCoord < fieldSize))
+            {
                 this.field[XCoord - 1, YCoord] = " X ";
-            if ((XCoord >= 0) && (XCoord < fieldSize) && (YCoord >= 0) && (YCoord < fieldSize))
-                this.field[XCoord, YCoord] = " X ";
+            }
+
+            if ((XCoord >= 0) && (XCoord < fieldSize) && (YCoord >= 0) && (YCoord < fieldSize))
+            {
+                this.field[XCoord, YCoord] = " X ";
+            }
+
             if ((XCoord + 1 >= 0) && (XCoord + 1 < fieldSize) && (YCoord >= 0) && (YCoord < fieldSize))
+            {
                 this.field[XCoord + 1, YCoord] = " X ";
+            }

             if ((XCoord - 1 >= 0) && (XCoord - 1 < fieldSize) && (YCoord + 1 >= 0) && (YCoord + 1 < fieldSize))
+            {
                 this.field[XCoord - 1, YCoord + 1] = " X ";
+            }
+
             if ((XCoord >= 0) && (XCoord < fieldSize) && (YCoord + 1 >= 0) && (YCoord + 1 < fieldSize))
+            {
                 this.field[XCoord, YCoord + 1] = " X ";
+            }
+
             if ((XCoord + 1 >= 0) && (XCoord + 1 < fieldSize) && (YCoord + 1 >= 0) && (YCoord + 1 < fieldSize))
+            {
                 this.field[XCoord + 1, YCoord + 1] = " X ";
+            }

             if ((XCoord - 1 >= 0) && (XCoord - 1 < fieldSize) && (YCoord + 2 >= 0) && (YCoord + 2 < fieldSize))
+            {
                 this.field[XCoord - 1, YCoord + 2] = " X ";
+            }
+
             if ((XCoord >= 0) && (XCoord < fieldSize) && (YCoord + 2 >= 0) && (YCoord + 2 < fieldSize))
+            {
                 this.field[XCoord, YCoord + 2] = " X ";
+            }
+
             if ((XCoord + 1 >= 0) && (XCoord + 1 < fieldSize) && (YCoord + 2 >= 0) && (YCoord + 2 < fieldSize))
+            {
                 this.field[XCoord + 1, YCoord + 2] = " X ";
+            }

             if ((XCoord - 1 >= 0) && (XCoord - 1 < fieldSize) && (YCoord - 2 >= 0) && (YCoord - 2 < fieldSize))
+            {
                 this.field[XCoord - 1, YCoord - 2] = " X ";
+            }
+
             if ((XCoord >= 0) && (XCoord < fieldSize) && (YCoord - 2 >= 0) && (YCoord - 2 < fieldSize))
+            {
                 this.field[XCoord, YCoord - 2] = " X ";
+            }
+
             if ((XCoord + 1 >= 0) && (XCoord + 1 < fieldSize) && (YCoord - 2 >= 0) && (YCoord - 2 < fieldSize))
+            {
                 this.field[XCoord + 1, YCoord - 2] = " X ";
+            }

             if ((XCoord - 2 >= 0) && (XCoord - 2 < fieldSize) && (YCoord - 1 >= 0) && (YCoord - 1 < fieldSize))
+            {
                 this.field[XCoord - 2, YCoord - 1] = " X ";
+            }
+
             if ((XCoord - 2 >= 0) && (XCoord - 2 < fieldSize) && (YCoord >= 0) && (YCoord < fieldSize))
+            {
                 this.field[XCoord - 2, YCoord] = " X ";
+            }
+
             if ((XCoord - 2 >= 0) && (XCoord - 2 < fieldSize) && (YCoord + 1 >= 0) && (YCoord + 1 < fieldSize))
+            {
                 this.field[XCoord - 2, YCoord + 1] = " X ";
+            }

             if ((XCoord + 2 >= 0) && (XCoord + 2 < fieldSize) && (YCoord - 1 >= 0) && (YCoord - 1 < fieldSize))
+            {
                 this.field[XCoord + 2, YCoord - 1] = " X ";
+            }
+
             if ((XCoord + 2 >= 0) && (XCoord + 2 < fieldSize) && (YCoord >= 0) && (YCoord < fieldSize))
+            {
                 this.field[XCoord + 2, YCoord] = " X ";
+            }
+
             if ((XCoord + 2 >= 0) && (XCoord + 2 < fieldSize) && (YCoord + 1 >= 0) && (YCoord + 1 < fieldSize))
+            {
                 this.field[XCoord + 2, YCoord + 1] = " X ";
-        }
-
-        public void GrymniPetaBomba(int XCoord, int YCoord)
+            }
+        }
+
+        public void DetonateMine5(int XCoord, int YCoord)
         {
             if ((XCoord - 1 >= 0) && (XCoord - 1 < fieldSize) && (YCoord - 1 >= 0) && (YCoord - 1 < fieldSize))
+            {
                 this.field[XCoord - 1, YCoord - 1] = " X ";
+            }
+
             if ((XCoord >= 0) && (XCoord < fieldSize) && (YCoord - 1 >= 0) && (YCoord - 1 < fieldSize))
+            {
                 this.field[XCoord, YCoord - 1] = " X ";
+            }
+
             if ((XCoord + 1 >= 0) && (XCoord + 1 < fieldSize) && (YCoord - 1 >= 0) && (YCoord - 1 < fieldSize))
+            {
                 this.field[XCoord + 1, YCoord - 1] = " X ";
+            }

             if ((XCoord - 1 >= 0) && (XCoord - 1 < fieldSize) && (YCoord >= 0) && (YCoord < fieldSize))
+            {
                 this.field[XCoord - 1, YCoord] = " X ";
-            if ((XCoord >= 0) && (XCoord < fieldSize) && (YCoord >= 0) && (YCoord < fieldSize))
-                this.field[XCoord, YCoord] = " X ";
+            }
+
+            if ((XCoord >= 0) && (XCoord < fieldSize) && (YCoord >= 0) && (YCoord < fieldSize))
+            {
+                this.field[XCoord, YCoord] = " X ";
+            }
+
             if ((XCoord + 1 >= 0) && (XCoord + 1 < fieldSize) && (YCoord >= 0) && (YCoord < fieldSize))
+            {
                 this.field[XCoord + 1, YCoord] = " X ";
+            }

             if ((XCoord - 1 >= 0) && (XCoord - 1 < fieldSize) && (YCoord + 1 >= 0) && (YCoord + 1 < fieldSize))
+            {
                 this.field[XCoord - 1, YCoord + 1] = " X ";
+            }
+
             if ((XCoord >= 0) && (XCoord < fieldSize) && (YCoord + 1 >= 0) && (YCoord + 1 < fieldSize))
+            {
                 this.field[XCoord, YCoord + 1] = " X ";
+            }
+
             if ((XCoord + 1 >= 0) && (XCoord + 1 < fieldSize) && (YCoord + 1 >= 0) && (YCoord + 1 < fieldSize))
+            {
                 this.field[XCoord + 1, YCoord + 1] = " X ";
+            }

             if ((XCoord - 1 >= 0) && (XCoord - 1 < fieldSize) && (YCoord + 2 >= 0) && (YCoord + 2 < fieldSize))
+            {
                 this.field[XCoord - 1, YCoord + 2] = " X ";
+            }
+
             if ((XCoord >= 0) && (XCoord < fieldSize) && (YCoord + 2 >= 0) && (YCoord + 2 < fieldSize))
+            {
                 this.field[XCoord, YCoord + 2] = " X ";
+            }
+
             if ((XCoord + 1 >= 0) && (XCoord + 1 < fieldSize) && (YCoord + 2 >= 0) && (YCoord + 2 < fieldSize))
+            {
                 this.field[XCoord + 1, YCoord + 2] = " X ";
+            }

             if ((XCoord - 1 >= 0) && (XCoord - 1 < fieldSize) && (YCoord - 2 >= 0) && (YCoord - 2 < fieldSize))
+            {
                 this.field[XCoord - 1, YCoord - 2] = " X ";
+            }
+
             if ((XCoord >= 0) && (XCoord < fieldSize) && (YCoord - 2 >= 0) && (YCoord - 2 < fieldSize))
+            {
                 this.field[XCoord, YCoord - 2] = " X ";
+            }
+
             if ((XCoord + 1 >= 0) && (XCoord + 1 < fieldSize) && (YCoord - 2 >= 0) && (YCoord - 2 < fieldSize))
+            {
                 this.field[XCoord + 1, YCoord - 2] = " X ";
+            }

             if ((XCoord - 2 >= 0) && (XCoord - 2 < fieldSize) && (YCoord - 1 >= 0) && (YCoord - 1 < fieldSize))
+            {
                 this.field[XCoord - 2, YCoord - 1] = " X ";
+            }
+
             if ((XCoord - 2 >= 0) && (XCoord - 2 < fieldSize) && (YCoord >= 0) && (YCoord < fieldSize))
+            {
                 this.field[XCoord - 2, YCoord] = " X ";
+            }
+
             if ((XCoord - 2 >= 0) && (XCoord - 2 < fieldSize) && (YCoord + 1 >= 0) && (YCoord + 1 < fieldSize))
+            {
                 this.field[XCoord - 2, YCoord + 1] = " X ";
+            }

             if ((XCoord + 2 >= 0) && (XCoord + 2 < fieldSize) && (YCoord - 1 >= 0) && (YCoord - 1 < fieldSize))
+            {
                 this.field[XCoord + 2, YCoord - 1] = " X ";
+            }
+
             if ((XCoord + 2 >= 0) && (XCoord + 2 < fieldSize) && (YCoord >= 0) && (YCoord < fieldSize))
+            {
                 this.field[XCoord + 2, YCoord] = " X ";
+            }
+
             if ((XCoord + 2 >= 0) && (XCoord + 2 < fieldSize) && (YCoord + 1 >= 0) && (YCoord + 1 < fieldSize))
+            {
                 this.field[XCoord + 2, YCoord + 1] = " X ";
+            }

             if ((XCoord - 2 >= 0) && (XCoord - 2 < fieldSize) && (YCoord - 2 >= 0) && (YCoord - 2 < fieldSize))
+            {
                 this.field[XCoord - 2, YCoord - 2] = " X ";
+            }
+
             if ((XCoord + 2 >= 0) && (XCoord + 2 < fieldSize) && (YCoord - 2 >= 0) && (YCoord - 2 < fieldSize))
+            {
                 this.field[XCoord + 2, YCoord - 2] = " X ";
+            }
+
             if ((XCoord - 2 >= 0) && (XCoord - 2 < fieldSize) && (YCoord + 2 >= 0) && (YCoord + 2 < fieldSize))
+            {
                 this.field[XCoord - 2, YCoord + 2] = " X ";
+            }
+
             if ((XCoord + 2 >= 0) && (XCoord + 2 < fieldSize) && (YCoord + 2 >= 0) && (YCoord + 2 < fieldSize))
+            {
                 this.field[XCoord + 2, YCoord + 2] = " X ";
+            }
         }

@@ -296,12 +507,12 @@
                     break;
                 case 4: this.DetonateMine4(XCoord, YCoord);
                     break;
-                case 5: this.GrymniPetaBomba(XCoord, YCoord);
+                case 5: this.DetonateMine5(XCoord, YCoord);
                     break;
             }
         }

-        public int PrebroiOstavashtiteMinichki()
+        public int CountRemainingMines()
         {
             int count = 0;

@@ -310,7 +521,9 @@
                 for (int j = 0; i < fieldSize; i++)
                 {
                     if ((this.field[i, j] != " X ") && (this.field[i, j] != " - "))
+                    {
                         count++;
+                    }
                 }
             }

@@ -324,9 +537,10 @@
             Console.WriteLine("Welcome to the Battle Field game");
             do
             {
-                Console.Write("Enter legal size of board: ");
+                Console.Write("Enter battle field size: ");
                 tempFieldSize = Console.ReadLine();
-            } while ((!Int32.TryParse(tempFieldSize, out fieldSize)) || (fieldSize < 0) || (fieldSize > 11));
+            }
+            while ((!Int32.TryParse(tempFieldSize, out fieldSize)) || (fieldSize < 0) || (fieldSize > 11));

             BattleField bf = new BattleField();
             bf.InitField();
@@ -352,7 +566,7 @@
                 bf.DetonateMine(XCoord, YCoord);
                 bf.DisplayField();
                 bf.detonatedMines++;
-            } while (bf.PrebroiOstavashtiteMinichki() != 0);
+            } while (bf.CountRemainingMines() != 0);

             Console.WriteLine("Game Over. Detonated Mines: " + bf.detonatedMines);
             Console.ReadKey();


Fix IB Historical Data Request Error "HMDS query returned no data"

--- Brokerages/InteractiveBrokers/InteractiveBrokersBrokerage.cs
+++ Brokerages/InteractiveBrokers/InteractiveBrokersBrokerage.cs
@@ -1194,6 +1194,12 @@
                 errorMsg += ". Origin: " + requestMessage;
             }

+            // historical data request with no data returned
+            if (errorCode == 162 && errorMsg.Contains("HMDS query returned no data"))
+            {
+                return;
+            }
+
             Log.Trace($"InteractiveBrokersBrokerage.HandleError(): RequestId: {requestId} ErrorCode: {errorCode} - {errorMsg}");

             // figure out the message type based on our code collections below


Prevent potential race condition between GetOpenOrders and GetNextBrokerageOrderId

--- Brokerages/InteractiveBrokers/InteractiveBrokersBrokerage.cs
+++ Brokerages/InteractiveBrokers/InteractiveBrokersBrokerage.cs
@@ -444,7 +444,10 @@
             GetOpenOrdersInternal(false);

             // return all open orders (including those placed from TWS, which will have a negative order id)
-            return GetOpenOrdersInternal(true);
+            lock (_nextValidIdLocker)
+            {
+                return GetOpenOrdersInternal(true);
+            }
         }

         private List<Order> GetOpenOrdersInternal(bool all)
@@ -517,13 +520,10 @@
                 // if the function reqAllOpenOrders is used by a client, subsequent orders placed by that client
                 // must have order IDs greater than the order IDs of all orders returned because of that function call.

-                lock (_nextValidIdLocker)
-                {
-                    if (lastOrderId >= _nextValidId)
-                    {
-                        Log.Trace($"InteractiveBrokersBrokerage.GetOpenOrders(): Updating nextValidId from {_nextValidId} to {lastOrderId + 1}");
-                        _nextValidId = lastOrderId + 1;
-                    }
+                if (lastOrderId >= _nextValidId)
+                {
+                    Log.Trace($"InteractiveBrokersBrokerage.GetOpenOrders(): Updating nextValidId from {_nextValidId} to {lastOrderId + 1}");
+                    _nextValidId = lastOrderId + 1;
                 }
             }


do not show progress for logs with piracy, as it's not representative in any way

--- CompatBot/Utils/ResultFormatters/LogParserResultFormatter.cs
+++ CompatBot/Utils/ResultFormatters/LogParserResultFormatter.cs
@@ -479,6 +479,9 @@

         internal static DiscordEmbedBuilder AddAuthor(this DiscordEmbedBuilder builder, DiscordClient client, DiscordMessage message, ISource source, LogParseState state = null)
         {
+            if (state?.Error == LogParseState.ErrorCode.PiracyDetected)
+                return builder;
+
             if (message != null)
             {
                 var author = message.Author;


Fixed an error

Fixed an error

--- CustomCollections/ExtensionMethods/VectorExtensionMethods.cs
+++ CustomCollections/ExtensionMethods/VectorExtensionMethods.cs
@@ -7,6 +7,7 @@
     {
         public static Vector ToVector(this List<double> list)
         {
+
             return new Vector(list);
         }
     }


Fix for when document last line visible

Fix for when document last line visible

When only the last line is visible and the document goes out of focus
it caused an index error.

--- RelativeNumber/RelativeNumber.cs
+++ RelativeNumber/RelativeNumber.cs
@@ -175,7 +175,7 @@
                 else if (currentLoopLineNumber + 1 == currentCursorLineNumber || !HasFocus)
                 {
                     var indx = offset + counter;
-                    displayNumber = lineNumbers[indx];
+                    displayNumber = lineNumbers.Count >= indx ? lineNumbers[indx] : lineNumbers[lineNumbers.Count];
                     width = HasFocus ? numberCharactersLineCount * -1 : numberCharactersLineCount;
                     counter += 1;
                 }


ActiveCharacter reference

ActiveCharacter reference

Added class field reference to ActiveCharacter

--- EndlessClient/EndlessClient/Rendering/MouseCursorRenderer.cs
+++ EndlessClient/EndlessClient/Rendering/MouseCursorRenderer.cs
@@ -24,6 +24,7 @@
 		private readonly Texture2D _mouseCursor;
 		private readonly XNALabel _itemHoverName;
 		private readonly EOMapContextMenu _contextMenu;
+		private readonly Character _mainCharacter;

 		private Vector2 _cursorPos;
 		private int _gridX, _gridY;
@@ -56,6 +57,8 @@
 			_cursorSourceRect = new Rectangle(0, 0, _mouseCursor.Width / 5, _mouseCursor.Height);

 			_contextMenu = new EOMapContextMenu(_game.API);
+
+			_mainCharacter = World.Instance.MainPlayer.ActiveCharacter;
 		}

 		public void ShowContextMenu(CharacterRenderer player)
@@ -102,7 +105,7 @@
 				return;

 			SetGridCoordsBasedOnMousePosition(ms);
-			_cursorPos = MapRenderer.GetDrawCoordinatesFromGridUnits(_gridX, _gridY, World.Instance.MainPlayer.ActiveCharacter);
+			_cursorPos = MapRenderer.GetDrawCoordinatesFromGridUnits(_gridX, _gridY, _mainCharacter);

 			var ti = GetTileInfoAtGridCoordinates();
 			if (ti == null) return;
@@ -211,14 +214,12 @@
 			//pixY = (_gridX * 16) + (_gridY * 16) + 144 - c.OffsetY =>
 			//(pixY - (_gridX * 16) - 144 + c.OffsetY) / 16 = _gridY

-			var c = World.Instance.MainPlayer.ActiveCharacter;
-
 			//center the cursor on the mouse pointer
 			var msX = ms.X - _cursorSourceRect.Width/2;
 			var msY = ms.Y - _cursorSourceRect.Height/2;
 			//align cursor to grid based on mouse position
-			_gridX = (int) Math.Round((msX + 2*msY - 576 + c.OffsetX + 2*c.OffsetY)/64.0);
-			_gridY = (int) Math.Round((msY - _gridX*16 - 144 + c.OffsetY)/16.0);
+			_gridX = (int) Math.Round((msX + 2*msY - 576 + _mainCharacter.OffsetX + 2*_mainCharacter.OffsetY)/64.0);
+			_gridY = (int) Math.Round((msY - _gridX*16 - 144 + _mainCharacter.OffsetY)/16.0);
 		}

 		private ITileInfo GetTileInfoAtGridCoordinates()
@@ -259,10 +260,10 @@
 						HandleTileSpecClick(ti.Spec);
 						break;
 					default:
-						if (World.Instance.MainPlayer.ActiveCharacter.NeedsSpellTarget)
+						if (_mainCharacter.NeedsSpellTarget)
 						{
 							//cancel spell targeting if an invalid target was selected
-							World.Instance.MainPlayer.ActiveCharacter.SelectSpell(-1);
+							_mainCharacter.SelectSpell(-1);
 						}
 						break;
 				}
@@ -271,9 +272,9 @@

 		private void HandleMapItemClick(MapItem mi)
 		{
-			var c = World.Instance.MainPlayer.ActiveCharacter;
-
-			if ((c.ID != mi.playerID && mi.playerID != 0) && (mi.npcDrop && (DateTime.Now - mi.time).TotalSeconds <= World.Instance.NPCDropProtectTime) || (!mi.npcDrop && (DateTime.Now - mi.time).TotalSeconds <= World.Instance.PlayerDropProtectTime))
+			if ((_mainCharacter.ID != mi.playerID && mi.playerID != 0) &&
+				(mi.npcDrop && (DateTime.Now - mi.time).TotalSeconds <= World.Instance.NPCDropProtectTime) ||
+				(!mi.npcDrop && (DateTime.Now - mi.time).TotalSeconds <= World.Instance.PlayerDropProtectTime))
 			{
 				Character charRef = _parentMapRenderer.GetOtherPlayerByID((short) mi.playerID);
 				DATCONST2 msg = charRef == null ? DATCONST2.STATUS_LABEL_ITEM_PICKUP_PROTECTED : DATCONST2.STATUS_LABEL_ITEM_PICKUP_PROTECTED_BY;
@@ -282,11 +283,12 @@
 			}
 			else
 			{
+				var item = World.Instance.EIF.GetItemRecordByID(mi.id);
 				if (!EOGame.Instance.Hud.InventoryFits(mi.id))
 				{
 					EOGame.Instance.Hud.SetStatusLabel(DATCONST2.STATUS_LABEL_TYPE_INFORMATION, DATCONST2.STATUS_LABEL_ITEM_PICKUP_NO_SPACE_LEFT);
 				}
-				else if (c.Weight + (World.Instance.EIF.GetItemRecordByID(mi.id).Weight*mi.amount) > c.MaxWeight)
+				else if (_mainCharacter.Weight + item.Weight * mi.amount > _mainCharacter.MaxWeight)
 				{
 					EOGame.Instance.Hud.SetStatusLabel(DATCONST2.STATUS_LABEL_TYPE_WARNING, DATCONST2.DIALOG_ITS_TOO_HEAVY_WEIGHT);
 				}
@@ -301,55 +303,44 @@
 			{
 				case TileSpec.Chest: HandleChestClick(); break;
 				case TileSpec.BankVault: HandleBankVaultClick(); break;
+				//todo: boards, chairs
 			}
 		}

 		private void HandleChestClick()
 		{
-			Character c = World.Instance.MainPlayer.ActiveCharacter;
-
-			if (Math.Max(c.X - _gridX, c.Y - _gridY) <= 1 && (_gridX == c.X || _gridY == c.Y))
+			var characterWithinOneUnitOfChest = Math.Max(_mainCharacter.X - _gridX, _mainCharacter.Y - _gridY) <= 1;
+			var characterInSameRowOrColAsChest = _gridX == _mainCharacter.X || _gridY == _mainCharacter.Y;
+
+			if (characterWithinOneUnitOfChest && characterInSameRowOrColAsChest)
 			{
 				MapChest chest = MapRef.Chests.Find(_mc => _mc.x == _gridX && _mc.y == _gridY);
 				if (chest == null) return;

-				string requiredKey = null;
-				switch (World.Instance.MainPlayer.ActiveCharacter.CanOpenChest(chest))
-				{
-					case ChestKey.Normal:
-						requiredKey = "Normal Key";
-						break;
-					case ChestKey.Silver:
-						requiredKey = "Silver Key";
-						break;
-					case ChestKey.Crystal:
-						requiredKey = "Crystal Key";
-						break;
-					case ChestKey.Wraith:
-						requiredKey = "Wraith Key";
-						break;
-					default:
-						ChestDialog.Show(_game.API, chest.x, chest.y);
-						break;
-				}
-
-				if (requiredKey != null)
-				{
-					EOMessageBox.Show(DATCONST1.CHEST_LOCKED, XNADialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
-					_game.Hud.SetStatusLabel(DATCONST2.STATUS_LABEL_TYPE_WARNING,
-						DATCONST2.STATUS_LABEL_THE_CHEST_IS_LOCKED_EXCLAMATION,
-						" - " + requiredKey);
-				}
+				string requiredKey;
+				switch (_mainCharacter.CanOpenChest(chest))
+				{
+					case ChestKey.Normal: requiredKey = "Normal Key"; break;
+					case ChestKey.Silver: requiredKey = "Silver Key"; break;
+					case ChestKey.Crystal: requiredKey = "Crystal Key"; break;
+					case ChestKey.Wraith: requiredKey = "Wraith Key"; break;
+					default: ChestDialog.Show(_game.API, chest.x, chest.y); return;
+				}
+
+				EOMessageBox.Show(DATCONST1.CHEST_LOCKED, XNADialogButtons.Ok, EOMessageBoxStyle.SmallDialogSmallHeader);
+				_game.Hud.SetStatusLabel(DATCONST2.STATUS_LABEL_TYPE_WARNING,
+					DATCONST2.STATUS_LABEL_THE_CHEST_IS_LOCKED_EXCLAMATION,
+					" - " + requiredKey);
 			}
 		}

 		private void HandleBankVaultClick()
 		{
-			var c = World.Instance.MainPlayer.ActiveCharacter;
-			if (Math.Max(c.X - _gridX, c.Y - _gridY) <= 1 && (_gridX == c.X || _gridY == c.Y))
-			{
-				LockerDialog.Show(_game.API, (byte)_gridX, (byte)_gridY);
-			}
+			var characterWithinOneUnitOfLocker = Math.Max(_mainCharacter.X - _gridX, _mainCharacter.Y - _gridY) <= 1;
+			var characterInSameRowOrColAsLocker = _gridX == _mainCharacter.X || _gridY == _mainCharacter.Y;
+
+			if (characterWithinOneUnitOfLocker && characterInSameRowOrColAsLocker)
+				LockerDialog.Show(_game.API, (byte) _gridX, (byte) _gridY);
 		}

 		#region IDisposable


Rolli the coder 80/100 atm.

Rolli the coder 80/100 atm.

--- ExamPreparation/Exam1June2016/RollyTheCoder/RollyTheCoder.cs
+++ ExamPreparation/Exam1June2016/RollyTheCoder/RollyTheCoder.cs
@@ -8,18 +8,20 @@
     {
         string input = Console.ReadLine();
         //event participants
-        Dictionary<string, List<string>> participantsForEvent =
-            new Dictionary<string, List<string>>();
+        Dictionary<string, HashSet<string>> participantsForEvent =
+            new Dictionary<string, HashSet<string>>();
         //id , event, participants
-        Dictionary<int, Dictionary<string, List<string>>> rollyEvenet =
-            new Dictionary<int, Dictionary<string, List<string>>>();
+        Dictionary<long, Dictionary<string, List<string>>> rollyEvenet =
+            new Dictionary<long, Dictionary<string, List<string>>>();

-        while (!input.Equals("Time For Code"))
+        bool flag = false;
+        while (!input.Equals("Time for Code"))
         {
+            flag = true;
             string trimmedEvent = null;
-            string[] info = input.Split();
+            string[] info = input.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
             //get id
-            int currentId = int.Parse(info[0]);
+            long currentId = int.Parse(info[0]);
             string currentEvent = info[1];
             List<string> currentParticipants = new List<string>();

@@ -27,28 +29,48 @@
             if (IsValidEvent(currentEvent))
             {
                 trimmedEvent = TrimEvent(currentEvent);
+
+                for (int i = 2; i < info.Length; i++)
+                {
+                    currentParticipants.Add(info[i]);
+                }
+
+                if (!rollyEvenet.ContainsKey(currentId))
+                {
+                    rollyEvenet.Add(currentId, new Dictionary<string, List<string>>());
+                    if (!rollyEvenet[currentId].ContainsKey(trimmedEvent))
+                    {
+                        rollyEvenet[currentId][trimmedEvent] = new List<string>();
+                        participantsForEvent[trimmedEvent] = new HashSet<string>();
+                    }
+                }
+
+                if (rollyEvenet[currentId].ContainsKey(trimmedEvent))
+                {
+                    foreach (var currentParticipant in currentParticipants)
+                    {
+                        rollyEvenet[currentId][trimmedEvent].Add(currentParticipant);
+                        participantsForEvent[trimmedEvent].Add(currentParticipant);
+                    }
+                }
             }

-            for (int i = 2; i < info.Length; i++)
+            input = Console.ReadLine();
+        }
+
+        if (flag)
+        {
+            foreach (var eve in participantsForEvent
+            .OrderByDescending(p => p.Value.Count))
             {
-                currentParticipants.Add(info[i]);
-            }
-
-            if (!rollyEvenet.ContainsKey(currentId))
-            {
-                rollyEvenet.Add(currentId, new Dictionary<string, List<string>>());
-            }
-            else
-            {
-                if (rollyEvenet[currentId].ContainsKey(trimmedEvent))
+                Console.WriteLine($"{eve.Key} - {eve.Value.Count}");
+                foreach (var part in eve.Value
+                    .OrderBy(p => p))
                 {
-
+                    Console.WriteLine(part);
                 }
             }
-
-
-            input = Console.ReadLine();
-        }
+        }
     }

     private static string TrimEvent(string currentEvent)


Enhanced validations     CustomValidationRule + RequiredValidationRule

--- src/Client/Xamarin/Bit.Client.Xamarin.Prism/ViewModel/Validatable.cs
+++ src/Client/Xamarin/Bit.Client.Xamarin.Prism/ViewModel/Validatable.cs
@@ -58,13 +58,20 @@
         }
     }

+    public class CustomValidationRule<T> : ValidationRuleBase<T>
+    {
+        public bool IsValidValue { get; set; }
+
+        public Func<T, bool>? IsValidPredicate { get; set; }
+
+        public override bool IsValid(T value)
+        {
+            return IsValidPredicate?.Invoke(value) == true || IsValidValue;
+        }
+    }
+
     public class RequiredValidationRule<T> : ValidationRuleBase<T>
     {
-        public RequiredValidationRule(string validationMessage)
-        {
-            ValidationMessage = validationMessage;
-        }
-
         public override bool IsValid(T value)
         {
             if (value == null)
@@ -77,17 +84,13 @@
         }
     }

+    public class RequiredValidationRule : RequiredValidationRule<string>
+    {
+
+    }
+
     public class RegexValidationRule : ValidationRuleBase<string>
     {
-        public RegexValidationRule(string validationMessage, string pattern)
-        {
-            if (string.IsNullOrEmpty(pattern))
-                throw new ArgumentException(nameof(pattern));
-
-            ValidationMessage = validationMessage;
-            Pattern = pattern;
-        }
-
         public string Pattern { get; set; }

         public override bool IsValid(string value)


MediaPanelClient: Also look for extension assembly in the current folder

This allow to run the MediaPanel client uninstalled.

--- src/Clients/MediaPanel/Banshee.MediaPanel.Client/MediaPanelClient.cs
+++ src/Clients/MediaPanel/Banshee.MediaPanel.Client/MediaPanelClient.cs
@@ -44,8 +44,14 @@
         {
             // Normally Mono.Addins would load the MediaPanel extension from the
             // Extensions directory, so we need to load this reference manually
-            Assembly.LoadFile (Paths.Combine (Path.GetDirectoryName (
-                Assembly.GetEntryAssembly ().Location), "Extensions", "Banshee.MediaPanel.dll"));
+            var assembly_file = Paths.Combine (Path.GetDirectoryName (
+                Assembly.GetEntryAssembly ().Location), "Extensions", "Banshee.MediaPanel.dll");
+            if (!File.Exists (assembly_file)) {
+                // Also look into the current folder, so that we can run uninstalled
+                assembly_file = Paths.Combine (Path.GetDirectoryName (
+                    Assembly.GetEntryAssembly ().Location), "Banshee.MediaPanel.dll");
+            }
+            Assembly.LoadFile (assembly_file);
             Startup<MediaPanelClient> (args);
         }


Fix reading more data than required for the body.

--- Frameworks/MQTTnet.NetStandard/Adapter/MqttChannelAdapter.cs
+++ Frameworks/MQTTnet.NetStandard/Adapter/MqttChannelAdapter.cs
@@ -142,7 +142,13 @@
             var buffer = new byte[ReadBufferSize];
             while (body.Length < header.BodyLength)
             {
-                var readBytesCount = await stream.ReadAsync(buffer, 0, buffer.Length, cancellationToken).ConfigureAwait(false);
+                var bytesLeft = header.BodyLength - (int)body.Length;
+                if (bytesLeft > buffer.Length)
+                {
+                    bytesLeft = buffer.Length;
+                }
+
+                var readBytesCount = await stream.ReadAsync(buffer, 0, bytesLeft, cancellationToken).ConfigureAwait(false);

                 // Check if the client closed the connection before sending the full body.
                 if (readBytesCount == 0)
@@ -150,6 +156,8 @@
                     throw new MqttCommunicationException("Connection closed while reading remaining packet body.");
                 }

+                // Here is no need to await because internally only an array is used and no real I/O operation is made.
+                // Using async here will only generate overhead.
                 body.Write(buffer, 0, readBytesCount);
             }


Fix EventSource StubEnvironment

Fix EventSource StubEnvironment

--- src/Common/src/CoreLib/System/Diagnostics/Tracing/StubEnvironment.cs
+++ src/Common/src/CoreLib/System/Diagnostics/Tracing/StubEnvironment.cs
@@ -54,7 +54,7 @@
     }

 #if ES_BUILD_STANDALONE
-    internal static class BitOps
+    internal static class BitOperations
     {
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static uint RotateLeft(uint value, int offset)


Document correctness condition

Document correctness condition

--- src/Compilers/Core/Portable/Serialization/SerializationThreadPool.cs
+++ src/Compilers/Core/Portable/Serialization/SerializationThreadPool.cs
@@ -139,6 +139,25 @@
                                 {
                                     if (s_queue.Count > 0)
                                     {
+                                        // The wait timed out, but a new item was added to the queue between the time
+                                        // this thread entered the ready queue and the point where the lock was
+                                        // reacquired. Make sure to process the available item, since there is no
+                                        // guarantee another thread will exist or be notified to handle it separately.
+                                        //
+                                        // The following is one sequence which requires this path handle the queued
+                                        // element for correctness:
+                                        //
+                                        //  1. Thread A calls tryDequeue, and releases the lock in Wait
+                                        //  2. Thread B calls enqueue and holds the lock
+                                        //  3. Thread A times out and enters the ready thread queue
+                                        //  4. Thread B observes that s_queue.Count (1) <= s_availableThreads (1), so it
+                                        //     calls Pulse instead of creating a new thread
+                                        //  5. Thread B releases the lock
+                                        //  6. Thread A acquires the lock, and Monitor.Wait returns false
+                                        //
+                                        // Since no new thread was created in step 4, we must handle the enqueued
+                                        // element or the thread will exit and the item will sit in the queue
+                                        // indefinitely.
                                         break;
                                     }


DNN-9762: The ForceAdminPermission removed and  CheckPermissionForAdmin introduced. /// When true, it will force admin to have explicit Permission. When false, admin is passed without checking the Permission. All modules using ForceAdminPermission will need to be updated

--- src/Dnn.PersonaBar.Library/Attributes/AdvancedPermissionAttribute.cs
+++ src/Dnn.PersonaBar.Library/Attributes/AdvancedPermissionAttribute.cs
@@ -23,7 +23,10 @@
         /// </summary>
         public string Permission { get; set; }

-        public bool ForceAdminPermission { get; set; }
+        /// <summary>
+        /// When true, it will force admin to have explicit Permission. When false, admin is passed without checking the Permission.
+        /// </summary>
+        public bool CheckPermissionForAdmin { get; set; }

         public override bool IsAuthorized(AuthFilterContext context)
         {
@@ -34,7 +37,7 @@
             {
                 return false;
             }
-            if (ForceAdminPermission && PortalSecurity.IsInRole(Constants.AdminsRoleName))
+            if (!CheckPermissionForAdmin && PortalSecurity.IsInRole(Constants.AdminsRoleName))
             {
                 return true;
             }


Added a test for implicit conversion in conditional between the branches.

--- src/DotVVM.Framework.Tests.Common/Binding/BindingCompilationTests.cs
+++ src/DotVVM.Framework.Tests.Common/Binding/BindingCompilationTests.cs
@@ -385,6 +385,13 @@
             var result = ExecuteBinding("true ? 'Utc' : 'Local'", new object[] { }, null, null, typeof(DateTimeKind));
             Assert.AreEqual(DateTimeKind.Utc, result);
         }
+
+        [TestMethod]
+        public void BindingCompiler_ImplicitConversion_ConditionalLongAndInt()
+        {
+            var result = ExecuteBinding("_this != null ? _this.LongProperty : 0", new [] { new TestViewModel { LongProperty = 5 } });
+            Assert.AreEqual(5L, result);
+        }
     }
     class TestViewModel
     {
@@ -397,6 +404,8 @@
         public DateTime? DateTo { get; set; }
         public object Time { get; set; } = TimeSpan.FromSeconds(5);

+        public long LongProperty { get; set; }
+
         public string SetStringProp(string a, int b)
         {
             var p = StringProp;


Replace TagSectionAndMoveTreeAndResult with ParseTree<PgnGameSyntax>.

--- Sandra.Chess/Tests/ParseTrees.cs
+++ Sandra.Chess/Tests/ParseTrees.cs
@@ -45,35 +45,6 @@
             public override Type ExpectedType => typeof(T);
         }

-        private class TagSectionAndMoveTreeAndResult
-        {
-            public ParseTree<PgnTagSectionSyntax> TagSection;
-            public ParseTree<PgnPlyListSyntax> MoveSection;
-            public ParseTree<PgnGameResultWithTriviaSyntax> Result;
-
-            public TagSectionAndMoveTreeAndResult(ParseTree<PgnTagSectionSyntax> tagSection, ParseTree<PgnPlyListSyntax> moveSection)
-            {
-                TagSection = tagSection;
-                MoveSection = moveSection;
-            }
-
-            public TagSectionAndMoveTreeAndResult(ParseTree<PgnTagSectionSyntax> tagSection, ParseTree<PgnPlyListSyntax> moveSection, ParseTree<PgnGameResultWithTriviaSyntax> result)
-            {
-                TagSection = tagSection;
-                MoveSection = moveSection;
-                Result = result;
-            }
-
-            public void AddTo(ParseTree<PgnGameListSyntax> gamesSyntax)
-            {
-                ParseTree<PgnGameSyntax> gameSyntax = new ParseTree<PgnGameSyntax>();
-                gameSyntax.Add(TagSection);
-                gameSyntax.Add(MoveSection);
-                if (Result != null) gameSyntax.Add(Result);
-                gamesSyntax.Add(gameSyntax);
-            }
-        }
-
         private static readonly ParseTree<PgnEmptySyntax> Missing = new ParseTree<PgnEmptySyntax>();

         private static readonly ParseTree<PgnWhitespaceSyntax> WhitespaceElement = new ParseTree<PgnWhitespaceSyntax>();
@@ -375,42 +346,31 @@
         private static readonly ParseTree<PgnVariationWithFloatItemsSyntax> VariationOpenClose
             = VariationNoFloats(OpenNoTrivia, NoPlies, CloseNoTrivia);

-        private static TagSectionAndMoveTreeAndResult Game(
+        private static ParseTree<PgnGameSyntax> Game(
             ParseTree<PgnGameResultWithTriviaSyntax> result)
-            => new TagSectionAndMoveTreeAndResult(EmptyTagSection, NoPlies, result);
-
-        private static TagSectionAndMoveTreeAndResult Game(
+            => new ParseTree<PgnGameSyntax> { EmptyTagSection, NoPlies, result };
+
+        private static ParseTree<PgnGameSyntax> Game(
             ParseTree<PgnTagSectionSyntax> tagSection,
             ParseTree<PgnPlyListSyntax> moveSection)
-            => new TagSectionAndMoveTreeAndResult(tagSection, moveSection);
-
-        private static TagSectionAndMoveTreeAndResult Game(
+            => new ParseTree<PgnGameSyntax> { tagSection, moveSection, Missing };
+
+        private static ParseTree<PgnGameSyntax> Game(
             ParseTree<PgnTagSectionSyntax> tagSection,
             ParseTree<PgnPlyListSyntax> moveSection,
             ParseTree<PgnGameResultWithTriviaSyntax> result)
-            => new TagSectionAndMoveTreeAndResult(tagSection, moveSection, result);
-
-        private static ParseTree<PgnGameListSyntax> Games(TagSectionAndMoveTreeAndResult game1, ParseTree<PgnTriviaSyntax> trailingTrivia)
+            => new ParseTree<PgnGameSyntax> { tagSection, moveSection, result };
+
+        private static ParseTree<PgnGameListSyntax> Games(ParseTree<PgnGameSyntax> game1, ParseTree<PgnTriviaSyntax> trailingTrivia)
+            => new ParseTree<PgnGameListSyntax> { game1, trailingTrivia };
+
+        private static ParseTree<PgnGameListSyntax> Games(ParseTree<PgnGameSyntax> game1, ParseTree<PgnGameSyntax> game2, ParseTree<PgnTriviaSyntax> trailingTrivia)
+            => new ParseTree<PgnGameListSyntax> { game1, game2, trailingTrivia };
+
+        private static ParseTree<PgnGameListSyntax> Games(params ParseTree<PgnGameSyntax>[] games)
         {
             var gamesSyntax = new ParseTree<PgnGameListSyntax>();
-            game1.AddTo(gamesSyntax);
-            gamesSyntax.Add(trailingTrivia);
-            return gamesSyntax;
-        }
-
-        private static ParseTree<PgnGameListSyntax> Games(TagSectionAndMoveTreeAndResult game1, TagSectionAndMoveTreeAndResult game2, ParseTree<PgnTriviaSyntax> trailingTrivia)
-        {
-            var gamesSyntax = new ParseTree<PgnGameListSyntax>();
-            game1.AddTo(gamesSyntax);
-            game2.AddTo(gamesSyntax);
-            gamesSyntax.Add(trailingTrivia);
-            return gamesSyntax;
-        }
-
-        private static ParseTree<PgnGameListSyntax> Games(params TagSectionAndMoveTreeAndResult[] games)
-        {
-            var gamesSyntax = new ParseTree<PgnGameListSyntax>();
-            games.ForEach(x => x.AddTo(gamesSyntax));
+            games.ForEach(gamesSyntax.Add);
             gamesSyntax.Add(EmptyTrivia);
             return gamesSyntax;
         }


input.navigationoncompleted

input.navigationoncompleted

--- Sensus.Shared/UI/Inputs/Input.cs
+++ Sensus.Shared/UI/Inputs/Input.cs
@@ -293,11 +293,6 @@
 					{
 						SetScore(ScoreValue);
 					}
-
-					if (NavigationOnCompleted != NavigationResult.None)
-					{
-						InputGroupPage.Navigate(this, NavigationOnCompleted);
-					}
 				}

 				if (StoreCompletionRecords)
@@ -328,6 +323,11 @@
 							}
 						}
 					}
+				}
+
+				if (_complete && NavigationOnCompleted != NavigationResult.None)
+				{
+					InputGroupPage.Navigate(this, NavigationOnCompleted);
 				}
 			}
 		}


Formatted code

Formatted code

--- SeoPack/Helpers/HtmlSeoHelper.cs
+++ SeoPack/Helpers/HtmlSeoHelper.cs
@@ -270,7 +270,10 @@

             var str = new StringBuilder();

-            foreach (var link in foundPage.HrefLangLinks.OrderByDescending(x => x.IsDefault).ThenBy(x => x.Language))
+            foreach (var link in foundPage
+                                .HrefLangLinks
+                                .OrderByDescending(x => x.IsDefault)
+                                .ThenBy(x => x.Language))
             {
                 htmlElement = new HtmlElement("link");
                 htmlElement.AddAttribute("rel", "alternate");


JsFunction string parameters escape fix

JsFunction string parameters escape fix

--- Signum.Web/Facades/JsFunction.cs
+++ Signum.Web/Facades/JsFunction.cs
@@ -112,7 +112,7 @@
         {
             var varName = VarName(Module);

-            var args = this.Arguments.HasText() ? (", " + this.Arguments) : "";
+            var args = this.Arguments.HasText() ? (", " + this.Arguments.Replace("\"", "'")) : "";

             return "(function(that) { require(['" + Module + "'], function(" + varName + ") { " + varName + "." + FunctionName + "(that" + args + "); }); })(this);";
         }


Fixed tags error, show codec in output info

--- SimpleVideoConverter/MainForm.cs
+++ SimpleVideoConverter/MainForm.cs
@@ -18,6 +18,8 @@
         private char[] invalidChars = Path.GetInvalidPathChars();

         private const string FileTypeMP4 = "mp4";
+
+        // https://www.webmproject.org/docs/container/
         private const string FileTypeWebM = "webm";

         private const string EncodeModeBitrate = "bitrate";
@@ -702,6 +704,11 @@
             textBoxTagCopyright.Text = "";
             textBoxTagComment.Text = "";
             textBoxTagCreationTime.Text = "";
+            Tags.Title = "";
+            Tags.Author = "";
+            Tags.Copyright = "";
+            Tags.Comment = "";
+            Tags.CreationTime = "";
         }

         #endregion
@@ -1013,8 +1020,8 @@

             bool twoPass = (encodeMode == EncodeModeBitrate);

-            string videoArgs;
-            string audioArgs;
+            List<string> videoArgs = new List<string>();
+            List<string> audioArgs = new List<string>();

             // Video and audio args

@@ -1027,8 +1034,8 @@

                 // must be configurable
                 string videoPreset = "veryslow";
-                string videoProfile = "high"; // or "main" and more
-                string videoLevel = ""; // or "3.1" and more ' -level {videoLevel}'
+                string videoProfile = "high";
+                string videoLevel = "";
                 string videoParams = "-aq-mode autovariance-biased -fast-pskip 0 -mbtree 0 -pix_fmt yuv420p -x264-params \"no-dct-decimate=1:merange=32:subme=11:sar=1/1\"";

                 double finalFrameRate = CalcFinalFrameRate();
@@ -1041,22 +1048,21 @@
                         videoLevel = " -level 4.1";
                 }

-                string moreVideoArgs = $"-preset:v {videoPreset} -profile:v {videoProfile}{videoLevel} {videoParams}";
                 string moreAudioArgs = "-strict -2"; // for "aac" codec

                 if (encodeMode == EncodeModeBitrate)
-                {
-                    videoArgs = $"-c:v {videoCodec} -b:v {videoBitrate}k {moreVideoArgs}";
-                }
+                    videoArgs.Add($"-c:v {videoCodec} -b:v {videoBitrate}k");
                 else
-                {
-                    videoArgs = $"-c:v {videoCodec} -crf {crf} {moreVideoArgs}";
-                }
-
+                    videoArgs.Add($"-c:v {videoCodec} -crf {crf}");
+
+                videoArgs.Add($"-preset:v {videoPreset} -profile:v {videoProfile}{videoLevel} {videoParams}");
+
+                if (comboBoxAudioStreams.SelectedIndex == 0)
+                    audioArgs.Add("-an");
                 if (checkBoxConvertAudio.Checked)
-                    audioArgs = $"-c:a {audioCodec} -b:a {audioBitrate}k {moreAudioArgs}";
+                    audioArgs.Add($"-c:a {audioCodec} -b:a {audioBitrate}k {moreAudioArgs}");
                 else
-                    audioArgs = $"-c:a copy";
+                    audioArgs.Add($"-c:a copy");
             }
             else if (fileType == FileTypeWebM)
             {
@@ -1069,18 +1075,16 @@
                 int threads = Environment.ProcessorCount / 2;

                 if (encodeMode == EncodeModeBitrate)
-                {
-                    videoArgs = $"-c:v {videoCodec} -b:v {videoBitrate}k -threads {threads}";
-                }
+                    videoArgs.Add($"-c:v {videoCodec} -b:v {videoBitrate}k -threads {threads}");
                 else
-                {
-                    videoArgs = $"-c:v {videoCodec} -crf {crf} -b:v 0 -threads {threads}";
-                }
-
-                if (checkBoxConvertAudio.Checked)
-                    audioArgs = $"-c:a {audioCodec} -b:a {audioBitrate}k";
+                    videoArgs.Add($"-c:v {videoCodec} -crf {crf} -b:v 0 -threads {threads}");
+
+                if (comboBoxAudioStreams.SelectedIndex == 0)
+                    audioArgs.Add("-an");
+                else if (checkBoxConvertAudio.Checked)
+                    audioArgs.Add($"-c:a {audioCodec} -b:a {audioBitrate}k");
                 else
-                    audioArgs = $"-c:a copy";
+                    audioArgs.Add($"-c:a copy");
             }
             else
             {
@@ -1139,68 +1143,60 @@

             // More video args

-            videoArgs += string.Format(" -map 0:{0}", inputFile.VideoStreams[0].Index);
+            videoArgs.Add($"-map 0:{inputFile.VideoStreams[0].Index}");

             if (!string.IsNullOrWhiteSpace(frameRate))
-            {
-                videoArgs += $" -r {frameRate}";
-            }
+                videoArgs.Add($"-r {frameRate}");

             if (filters.Count > 0)
-            {
-                videoArgs += " -vf \"" + string.Join(",", filters) + "\"";
-            }
+                videoArgs.Add("-vf \"" + string.Join(",", filters) + "\"");

             // More audio args

-            if (comboBoxAudioStreams.SelectedIndex == 0)
-            {
-                audioArgs = "-an";
-            }
-            else
+            if (comboBoxAudioStreams.SelectedIndex > 0)
             {
                 string selectedStream = ((ComboBoxItem)comboBoxAudioStreams.SelectedItem).Value;
-                audioArgs += $" -map 0:{selectedStream}";
+                audioArgs.Add($"-map 0:{selectedStream}");

                 if (checkBoxConvertAudio.Checked)
                 {
                     // resampling
                     if (!string.IsNullOrWhiteSpace(audioFrequency))
                     {
-                        audioArgs += $" -ar {audioFrequency}";
+                        audioArgs.Add($"-ar {audioFrequency}");
                     }
                     // channels
                     if (!string.IsNullOrWhiteSpace(audioChannels))
                     {
-                        audioArgs += $" -ac {audioChannels}";
+                        audioArgs.Add($"-ac {audioChannels}");
                     }
                 }
             }

             // More args

-            string moreArgs = "";
+            List<string> moreArgs = new List<string>();

             if (fileType == FileTypeMP4 && checkBoxWebOptimized.Checked)
-                moreArgs += " -movflags +faststart";
+                moreArgs.Add("-movflags +faststart");

             // Meta

-            moreArgs += " -map_metadata -1";
-            if (Tags.Title.Length > 0)
-                moreArgs += $" -metadata title=\"{Tags.Title.Replace("\"", "\\\"")}\"";
-            if (Tags.Author.Length > 0)
-                moreArgs += $" -metadata artist=\"{Tags.Author.Replace("\"", "\\\"")}\"";
-            if (Tags.Copyright.Length > 0)
-                moreArgs += $" -metadata copyright=\"{Tags.Copyright.Replace("\"", "\\\"")}\"";
-            if (Tags.Comment.Length > 0)
-                moreArgs += $" -metadata comment=\"{Tags.Comment.Replace("\"", "\\\"")}\"";
-            if (Tags.CreationTime.Length > 0)
-                moreArgs += $" -metadata creation_time=\"{Tags.CreationTime.Replace("\"", "\\\"")}\"";
+            moreArgs.Add("-map_metadata -1");
+            if (!string.IsNullOrWhiteSpace(Tags.Title))
+                moreArgs.Add($"-metadata title=\"{Tags.Title.Replace("\"", "\\\"")}\"");
+            if (!string.IsNullOrWhiteSpace(Tags.Author))
+                moreArgs.Add($"-metadata artist=\"{Tags.Author.Replace("\"", "\\\"")}\"");
+            if (!string.IsNullOrWhiteSpace(Tags.Copyright))
+                moreArgs.Add($"-metadata copyright=\"{Tags.Copyright.Replace("\"", "\\\"")}\"");
+            if (!string.IsNullOrWhiteSpace(Tags.Comment))
+                moreArgs.Add($"-metadata comment=\"{Tags.Comment.Replace("\"", "\\\"")}\"");
+            if (!string.IsNullOrWhiteSpace(Tags.CreationTime))
+                moreArgs.Add($"-metadata creation_time=\"{Tags.CreationTime.Replace("\"", "\\\"")}\"");

             // Force file type

-            moreArgs += $" -f {fileType}";
+            moreArgs.Add($"-f {fileType}");

             // Convert

@@ -1208,16 +1204,17 @@

             if (twoPass)
             {
-                string passlogfile = GetTempLogFile();
+                string passLogFile = GetTempLogFile();
+                string twoPassTpl = "-pass {3} -passlogfile \"{4}\" {0} {1}{2}";

                 arguments = new string[2];
-                arguments[0] = $"-pass 1 -passlogfile \"{passlogfile}\" {videoArgs} -an{moreArgs}";
-                arguments[1] = $"-pass 2 -passlogfile \"{passlogfile}\" {videoArgs} {audioArgs}{moreArgs}";
+                arguments[0] = string.Format(twoPassTpl, string.Join(" ", videoArgs), "-an", string.Join(" ", moreArgs), "1", passLogFile);
+                arguments[1] = string.Format(twoPassTpl, string.Join(" ", videoArgs), string.Join(" ", audioArgs), string.Join(" ", moreArgs), "2", passLogFile);
             }
             else
             {
                 arguments = new string[1];
-                arguments[0] = $"{videoArgs} {audioArgs}{moreArgs}";
+                arguments[0] = string.Format("{0} {1}{2}", string.Join(" ", videoArgs), string.Join(" ", audioArgs), string.Join(" ", moreArgs));
             }

             new ConverterForm(input, output, arguments, inputFile.Duration.TotalSeconds).ShowDialog(this);
@@ -1503,11 +1500,16 @@

             // Video

+            if (fileType == FileTypeMP4)
+                info.Append($"H264");
+            else
+                info.Append($"VP9");
+
             string selectedMethod = ((ComboBoxItem)comboBoxResizeMethod.SelectedItem).Value;
             if (selectedMethod == ResizeMethodFit)
-                info.Append(finalPictureSize.ToString());
+                info.Append($", {finalPictureSize.ToString()}");
             else
-                info.Append(selectedPictureSize.ToString());
+                info.Append($", {selectedPictureSize.ToString()}");

             string selectedMethodText = ((ComboBoxItem)comboBoxResizeMethod.SelectedItem).Text;
             if (comboBoxPictureSize.SelectedIndex > 0 || string.IsNullOrWhiteSpace(comboBoxPictureSize.Text))
@@ -1543,6 +1545,11 @@
             }
             else if (comboBoxAudioStreams.SelectedIndex > 0)
             {
+                if (fileType == FileTypeMP4)
+                    info.Append($"AAC");
+                else
+                    info.Append($"OPUS");
+
                 string val = ((ComboBoxItem)comboBoxAudioStreams.SelectedItem).Value;
                 int.TryParse(val, out int index);

@@ -1551,7 +1558,7 @@
                 {
                     if (aStream.Index == index)
                     {
-                        info.Append($"#{idx}");
+                        info.Append($", #{idx}");
                         break;
                     }
                     idx++;


making function to find available port public

--- SizSelCsZzz/Extras/FakeServer.cs
+++ SizSelCsZzz/Extras/FakeServer.cs
@@ -24,23 +24,29 @@
             //  Going to try to find a port thats available.  Trying in the range 8080-8090.

             var host = "localhost";
-            var port = 8080;
-
-            while(IsThatPortOpen.HasExistingTCPListener(port))
-            {
-                port++;
-
-                if (port > 8090)
-                {
-                    throw new Exception("Couldn't find available port.. (checked 8080-8090).");
-                }
-            }
+            int port = GetAvailablePort(8080, 8090);

             BaseUrl = "http://" + host + ":" + port + "/";

             _listener = new HttpListener();
             _listener.Start();
             _listener.Prefixes.Add(BaseUrl);
+        }
+
+        static public int GetAvailablePort(int minValue, int maxValue)
+        {
+            var port = minValue;
+
+            while(IsThatPortOpen.HasExistingTCPListener(port))
+            {
+                port++;
+
+                if (port > maxValue)
+                {
+                    throw new Exception(string.Format("Couldn't find available port.. (checked {0}-{1}).", minValue, maxValue));
+                }
+            }
+            return port;
         }

         public void Start(Action<HttpListenerRequest, HttpListenerResponse> action)


[Nodes] Fix aspect ratio enum on layer (FitIn/FitOut was swapped), and Add top left option for PixelBillBoardNode

--- Nodes/VVVV.DX11.Nodes/Nodes/Layers/Space/WithinLayerNodes.cs
+++ Nodes/VVVV.DX11.Nodes/Nodes/Layers/Space/WithinLayerNodes.cs
@@ -60,6 +60,9 @@

         [Input("Double Scale", IsSingle = true, Order = 50)]
         protected ISpread<bool> FDoubleScale;
+
+        [Input("Top Left", IsSingle = true, Order = 51)]
+        protected ISpread<bool> FTopLeft;

 		protected override void UpdateSettings(DX11RenderSettings settings)
         {
@@ -67,6 +70,14 @@

             settings.View = Matrix.Identity;
             settings.Projection = Matrix.Scaling(f / settings.RenderWidth,f / settings.RenderHeight, 1.0f) * FTransformIn[0];
+
+            if (FTopLeft[0])
+            {
+                float tx = (float)settings.RenderWidth * 0.5f;
+                float ty = (float)settings.RenderHeight * 0.5f;
+                settings.Projection = Matrix.Translation(-tx, ty, 0.0f) * settings.Projection;
+            }
+
             settings.ViewProjection = settings.Projection;
         }
     }
@@ -91,7 +102,7 @@
             float sx, sy;

             #region Build scale
-            if (FAlign[0].Name == "FitIn")
+            if (FAlign[0].Name == "FitOut")
             {
                 if (w > h)
                 {
@@ -104,7 +115,7 @@
                     sy = w / h;
                 }
             }
-            else if (FAlign[0].Name == "FitOut")
+            else if (FAlign[0].Name == "FitIn")
             {
                 if (w > h)
                 {


Added test for SecurityManagerConfiguration

--- OpenIIoT.Core.Tests/Security/SecurityManagerConfiguration.cs
+++ OpenIIoT.Core.Tests/Security/SecurityManagerConfiguration.cs
@@ -57,9 +57,35 @@
                                                                                ▀████▀
                                                                                ▀▀                            */

+using Xunit;
+
 namespace OpenIIoT.Core.Tests.Security
 {
-    class SecurityManagerConfiguration
+    /// <summary>
+    ///     Unit tests for the <see cref="Core.Security.SecurityManagerConfiguration"/> class.
+    /// </summary>
+    public class SecurityManagerConfiguration
     {
+        #region Public Methods
+
+        /// <summary>
+        ///     Tests the constructor and all properties.
+        /// </summary>
+        [Fact]
+        public void Constructor()
+        {
+            Core.Security.User user = new Core.Security.User("name", "password", Core.Security.Role.Reader);
+            Core.Security.SecurityManagerConfiguration test = new Core.Security.SecurityManagerConfiguration();
+
+            Assert.IsType<Core.Security.SecurityManagerConfiguration>(test);
+            Assert.Empty(test.Users);
+
+            test.Users.Add(user);
+
+            Assert.NotEmpty(test.Users);
+            Assert.Equal(user, test.Users[0]);
+        }
+
+        #endregion Public Methods
     }
-}
+}


Change gesture activation to not quash any other flags

--- OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs
+++ OpenSim/Region/CoreModules/Avatar/Gestures/GesturesModule.cs
@@ -69,7 +69,7 @@
             item = invService.GetItem(item);
             if (item != null)
             {
-                item.Flags = 1;
+                item.Flags |= 1;
                 invService.UpdateItem(item);
             }
             else
@@ -85,7 +85,7 @@
             item = invService.GetItem(item);
             if (item != null)
             {
-                item.Flags = 0;
+                item.Flags &= ~1;
                 invService.UpdateItem(item);
             }
             else
@@ -93,4 +93,4 @@
                     "[GESTURES]: Unable to find gesture to deactivate {0} for {1}", gestureId, client.Name);
         }
     }
-}+}


forbid multiple process bootstrap instances running in the same time

--- SocketEngine/ProcessBootstrap.cs
+++ SocketEngine/ProcessBootstrap.cs
@@ -88,17 +88,27 @@

     class ProcessBootstrap : AppDomainBootstrap
     {
-        internal const string BootstrapIpcPort = "SuperSocket.Bootstrap";
+        internal static readonly string BootstrapIpcPort;

         static ProcessBootstrap()
         {
+            BootstrapIpcPort = string.Format("SuperSocket.Bootstrap[{0}]", Math.Abs(AppDomain.CurrentDomain.BaseDirectory.GetHashCode()));
             // Create the channel.
             var clientChannel = new IpcClientChannel();
             // Register the channel.
             System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(clientChannel, false);

-            var serverChannel = new IpcServerChannel("Bootstrap", BootstrapIpcPort);
-            System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(serverChannel, false);
+            try
+            {
+                var serverChannel = new IpcServerChannel("Bootstrap", BootstrapIpcPort);
+                System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(serverChannel, false);
+            }
+            catch(RemotingException) //The channel already has been registered
+            {
+                Console.WriteLine("A boostrap process is already running");
+                Environment.Exit(1);
+                return;
+            }

             RemotingConfiguration.RegisterWellKnownServiceType(typeof(ProcessBootstrapProxy), "Bootstrap.rem", WellKnownObjectMode.Singleton);
         }


fix GetDefaultInner()

fix GetDefaultInner()

--- Packages/PrefsGUI/Runtime/PrefsParam/PrefsParamOuterInner.cs
+++ Packages/PrefsGUI/Runtime/PrefsParam/PrefsParamOuterInner.cs
@@ -65,7 +65,7 @@

         protected TInner GetDefaultInner()
         {
-            if (_defaultValueInnerCache.TryGet(out var value))
+            if (!_defaultValueInnerCache.TryGet(out var value))
             {
                 value = ToInner(defaultValue);
                 _defaultValueInnerCache.Set(value);


Added color and font properties for FieldHeadingObjects

--- RptToXml/RptDefinitionWriter.cs
+++ RptToXml/RptDefinitionWriter.cs
@@ -864,6 +864,15 @@
 					writer.WriteAttributeString("FieldObjectName", fh.FieldObjectName);
 					writer.WriteAttributeString("MaxNumberOfLines", rasrdm_fh.MaxNumberOfLines.ToString());
 					writer.WriteElementString("Text", fh.Text);
+
+					if ((ShowFormatTypes & FormatTypes.Color) == FormatTypes.Color)
+						GetColorFormat(fh.Color, writer);
+
+					if ((ShowFormatTypes & FormatTypes.Font) == FormatTypes.Font)
+					{
+						GetFontFormat(fh.Font, report, writer);
+						GetFontColorConditionFormulas(rasrdm_fh.FontColor, writer);
+					}
 				}
 				else if (reportObject is FieldObject)
 				{


Notify Global Store even if WritingSystem wasn't "modified"

This way, if changes come in through Send/Receive, they will still be copied to
global.  We will still check which has a newer date before writing to global.

--- Palaso/WritingSystems/LdmlInFolderWritingSystemRepository.cs
+++ Palaso/WritingSystems/LdmlInFolderWritingSystemRepository.cs
@@ -349,22 +349,11 @@
 			// make a copy and then go through that list - SaveDefinition calls Set which
 			// may delete and then insert the same writing system - which would change WritingSystemDefinitions
 			// and not be allowed in a foreach loop
-			var allDefs = new List<IWritingSystemDefinition>();
-			foreach (var ws in AllWritingSystems)
-			{
-				if (CanSet(ws))
-				{
-					allDefs.Add(ws);
-				}
-			}
+			var allDefs = AllWritingSystems.Where(CanSet).ToList();
 			foreach (var ws in allDefs)
 			{
-				var modified = ws.Modified; // cache before saving local, because Modified is always false after saving
 				SaveDefinition(ws);
-				if (modified)
-				{
-					OnChangeNotifySharedStore(ws);
-				}
+				OnChangeNotifySharedStore(ws);
 			}


Added a close button to the Open Images pad

--- Pinta.Gui.Widgets/Widgets/OpenImages/OpenImagesListWidget.cs
+++ Pinta.Gui.Widgets/Widgets/OpenImages/OpenImagesListWidget.cs
@@ -35,6 +35,11 @@
 		private TreeView tree;
 		private ListStore store;

+		private CellRendererPixbuf file_close_cell;
+		private TreeViewColumn file_name_column;
+
+		private Gdk.Pixbuf close_icon = PintaCore.Resources.GetIcon (Stock.Close);
+
 		public OpenImagesListWidget ()
 		{
 			CanFocus = false;
@@ -47,15 +52,20 @@
 			tree.Selection.Mode = SelectionMode.Single;
 			tree.Selection.SelectFunction = HandleDocumentSelected;

-			TreeViewColumn file_name_column = new TreeViewColumn ();
+			file_name_column = new TreeViewColumn ();
 			CellRendererText file_name_cell = new CellRendererText ();
 			file_name_column.PackStart (file_name_cell, true);
 			file_name_column.AddAttribute (file_name_cell, "text", 0);

-			tree.AppendColumn(file_name_column);
+			file_close_cell = new CellRendererPixbuf ();
+			file_name_column.PackStart (file_close_cell, false);
+			file_name_column.AddAttribute (file_close_cell, "pixbuf", 1);

-			store = new ListStore (typeof (string));
+			tree.AppendColumn (file_name_column);
+
+			store = new ListStore (typeof (string), typeof (Gdk.Pixbuf));
 			tree.Model = store;
+			tree.ButtonPressEvent += HandleTreeButtonPressEvent;

 			Add (tree);
 			ShowAll ();
@@ -64,6 +74,29 @@
 			PintaCore.Workspace.DocumentClosed += HandleDocumentOpenedOrClosed;
 			PintaCore.Workspace.DocumentCreated += HandleDocumentOpenedOrClosed;
 			PintaCore.Workspace.ActiveDocumentChanged += HandleActiveDocumentChanged;
+		}
+
+		/// <summary>
+		/// Attempt to close the selected document if the close button is clicked
+		/// </summary>
+		[GLib.ConnectBefore]
+		void HandleTreeButtonPressEvent (object o, ButtonPressEventArgs args)
+		{
+			double click_x = args.Event.X;
+			double click_y = args.Event.Y;
+
+			int start_pos, width;
+			file_name_column.CellGetPosition (file_close_cell, out start_pos, out width);
+
+			// if the close button was clicked, find the row that was clicked and close that document
+			if (start_pos <= click_x && start_pos + width > click_x)
+			{
+				TreePath path;
+				tree.GetPathAtPos ((int)click_x, (int)click_y, out path);
+
+				PintaCore.Workspace.SetActiveDocument (path.Indices[0]);
+				PintaCore.Actions.File.Close.Activate ();
+			}
 		}

 		/// <summary>
@@ -92,7 +125,7 @@

 			foreach (Document doc in PintaCore.Workspace.OpenDocuments)
 			{
-				store.AppendValues (doc.Filename);
+				store.AppendValues (doc.Filename, close_icon);
 			}
 		}


Fix bug #55

Fix bug #55

--- PostfixTemplates/Templates/CSharp/ReturnStatementTemplate.cs
+++ PostfixTemplates/Templates/CSharp/ReturnStatementTemplate.cs
@@ -21,7 +21,7 @@
       var expressionContext = context.OuterExpression;
       if (expressionContext == null || !expressionContext.CanBeStatement) return null;

-      if (context.IsPreciseMode && IsWorthShowingInPreciseMode(expressionContext)) return null;
+      if (context.IsPreciseMode && !IsWorthShowingInPreciseMode(expressionContext)) return null;

       return new PostfixTemplateInfo("return", expressionContext);
     }


renaming

renaming

--- Presentation.Web/Controllers/API/SystemRelationController.cs
+++ Presentation.Web/Controllers/API/SystemRelationController.cs
@@ -103,7 +103,7 @@

         [HttpDelete]
         [Route("from/{systemUsageId}/{relationId}")]
-        public HttpResponseMessage DeleteRelationsFromSystem(int systemUsageId, int relationId)
+        public HttpResponseMessage DeleteRelationFromSystem(int systemUsageId, int relationId)
         {
             return _usageService.RemoveRelation(systemUsageId, relationId)
                 .Match


Added theming corrections to manual connection process.

--- PrinterControls/PrinterConnections/SetupStepComPortManual.cs
+++ PrinterControls/PrinterConnections/SetupStepComPortManual.cs
@@ -267,6 +267,8 @@
 				string printerComPortErrorLabel = LocalizedString.Get("Attempting to connect");
 				string printerComPortErrorLabelFull = string.Format("{0}...",printerComPortErrorLabel);
 				printerComPortError.Text = printerComPortErrorLabelFull;
+                printerComPortError.TextColor = ActiveTheme.Instance.PrimaryTextColor;
+
                 ActivePrinterProfile.Instance.ActivePrinter = this.ActivePrinter;
                 PrinterCommunication.Instance.ConnectToActivePrinter();
                 connectButton.Visible = false;
@@ -283,7 +285,10 @@

         void NextButton_Click(object sender, MouseEventArgs mouseEvent)
         {
-            Parent.Close();
+            UiThread.RunOnIdle((state) =>
+            {
+                Parent.Close();
+            });
         }

         private string GetSelectedSerialPort()


- Added - Added ConvertProjectionMatrix

- Added - Added ConvertProjectionMatrix

git-svn-id: 53f2a8ff3606f182ef4420064c1f4a5cdcbe6bb1@1443 bb9bf1cf-960d-0410-9a3a-baeba60cf407

--- Projects/Axiom/Source/RenderSystems/OpenGL/GLRenderSystem.cs
+++ Projects/Axiom/Source/RenderSystems/OpenGL/GLRenderSystem.cs
@@ -534,6 +534,15 @@
             matrix.m32 = -1.0f;

             return matrix;
+        }
+
+        public override Matrix4 ConvertProjectionMatrix( Matrix4 matrix, bool forGpuProgram )
+        {
+            // No conversion required for OpenGL
+
+            Matrix4 dest = matrix;
+
+            return dest;
         }

         public override void ApplyObliqueDepthProjection( ref Axiom.Math.Matrix4 projMatrix, Axiom.Math.Plane plane, bool forGpuProgram )


Small fix.

Small fix.

--- Samples/Connectors/SampleConnection/SecuritiesWindow.xaml.cs
+++ Samples/Connectors/SampleConnection/SecuritiesWindow.xaml.cs
@@ -123,14 +123,20 @@

 			foreach (var security in SecurityPicker.SelectedSecurities)
 			{
-				// subscribe on order book flow
-				var subscription = connector.SubscribeMarketDepth(security, settings?.From, settings?.To, buildMode: settings?.BuildMode ?? MarketDataBuildModes.LoadAndBuild, maxDepth: settings?.MaxDepth, buildFrom: settings?.BuildFrom);
-
 				// create order book window
 				var window = new QuotesWindow
 				{
 					Title = security.Id + " " + LocalizedStrings.MarketDepth
 				};
+
+				window.DepthCtrl.UpdateDepth(connector.GetMarketDepth(security));
+				window.Show();
+
+				// subscribe on order book flow
+				var subscription = connector.SubscribeMarketDepth(security, settings?.From, settings?.To, buildMode: settings?.BuildMode ?? MarketDataBuildModes.LoadAndBuild, maxDepth: settings?.MaxDepth, buildFrom: settings?.BuildFrom);
+
+				_quotesWindows.Add(subscription, window);
+
 				window.Closed += (s, e) =>
 				{
 					if (_appClosing)
@@ -139,11 +145,6 @@
 					if (subscription.State.IsActive())
 						connector.UnSubscribe(subscription);
 				};
-
-				window.DepthCtrl.UpdateDepth(connector.GetMarketDepth(security));
-				window.Show();
-
-				_quotesWindows.Add(subscription, window);
 			}
 		}


Added xaml and css to fileReader whitelist

--- SoftwareForge.Mvc/SoftwareForge.TfsService/FileTypeReader.cs
+++ SoftwareForge.Mvc/SoftwareForge.TfsService/FileTypeReader.cs
@@ -41,11 +41,12 @@
                     ".cshtml",
                     ".php",
                     ".js",
-                    ".cshtml",
                     ".xml",
                     ".csproj",
                     ".htm",
-                    ".rtf"
+                    ".rtf",
+                    ".xaml",
+                    ".css"
                 };
             List<string> blacklist = new List<string> { ".pdf", ".exe", ".zip", ".doc", ".docx", ".dot" };
             string extension = Path.GetExtension(path);


Synchrophasor: Fixed bug in PhasorServiceDataSourceValidation method when a device is not attached to any Company.

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

--- Source/Libraries/TVA.PhasorProtocols/CommonPhasorServices.cs
+++ Source/Libraries/TVA.PhasorProtocols/CommonPhasorServices.cs
@@ -18,6 +18,8 @@
 //  ----------------------------------------------------------------------------------------------------
 //  4/9/2010 - J. Ritchie Carroll
 //       Generated original version of source code.
+//  3/11/2011 - Mehulbhai P Thakkar
+//       Fixed bug in PhasorDataSourceValidation when CompanyID is NULL in Device table.
 //
 //******************************************************************************************************

@@ -1073,7 +1075,10 @@

                         if (Convert.ToInt32(connection.ExecuteScalar(string.Format("SELECT COUNT(*) FROM Measurement WHERE SignalReference='{0}' AND HistorianID={1};", signalReference, statHistorianID))) == 0)
                         {
-                            company = (string)connection.ExecuteScalar(string.Format("SELECT MapAcronym FROM Company WHERE ID={0};", device.Field<int>("CompanyID")));
+                            company = (string)connection.ExecuteScalar(string.Format("SELECT MapAcronym FROM Company WHERE ID={0};", device.Field<int?>("CompanyID") ?? 0));
+                            if (string.IsNullOrEmpty(company))
+                                company = configFile.Settings["systemSettings"]["CompanyAcronym"].Value.TruncateRight(3);
+
                             vendorDevice = (string)connection.ExecuteScalar(string.Format("SELECT Name FROM VendorDevice WHERE ID={0};", device.Field<int?>("VendorDeviceID") ?? 0));
                             pointTag = string.Format("{0}_{1}:ST{2}", company, acronym, signalIndex);
                             description = string.Format("{0} {1} Statistic for {2}", device.Field<string>("Name"), vendorDevice, statistic.Field<string>("Description"));
@@ -1099,7 +1104,10 @@

                         if (Convert.ToInt32(connection.ExecuteScalar(string.Format("SELECT COUNT(*) FROM Measurement WHERE SignalReference='{0}' AND HistorianID={1};", signalReference, statHistorianID))) == 0)
                         {
-                            company = (string)connection.ExecuteScalar(string.Format("SELECT MapAcronym FROM Company WHERE ID={0};", inputStream.Field<int>("CompanyID")));
+                            company = (string)connection.ExecuteScalar(string.Format("SELECT MapAcronym FROM Company WHERE ID={0};", inputStream.Field<int?>("CompanyID") ?? 0));
+                            if (string.IsNullOrEmpty(company))
+                                company = configFile.Settings["systemSettings"]["CompanyAcronym"].Value.TruncateRight(3);
+
                             vendorDevice = (string)connection.ExecuteScalar(string.Format("SELECT Name FROM VendorDevice WHERE ID={0};", inputStream.Field<int?>("VendorDeviceID") ?? 0)); // Modified to retrieve VendorDeviceID into Nullable of Int as it is not a required field.
                             pointTag = string.Format("{0}_{1}:ST{2}", company, acronym, signalIndex);
                             description = string.Format("{0} {1} Statistic for {2}", inputStream.Field<string>("Name"), vendorDevice, statistic.Field<string>("Description"));


plugins is updated

plugins is updated

--- common-dev/unity/plugin.cs
+++ common-dev/unity/plugin.cs
@@ -1,7 +1,9 @@
 1, first, create dynamically library, whatever mac/win/linux/android/ios, corresponding to platform arch, x86/x86_64/arm/...
+
 2, unitypro: put the binary file into the Assets/Plugins/ folder
    unityfree: put c/c++ library into the project root folder, and c# library into the Assets/Plugins/ folder.
    And after build for a target platform, copy the c/c++ library into the Data/Plugins/ folder
+
 3, create a c# wrapper class
 using System;
 using System.Runtime.InteropServices;
@@ -14,4 +16,10 @@
     public static extern string MyPluginFunction2(string param);

     ...
-}+}
+
+4,  c/c++ library must compile for specified platform,
+    linux/android->so, windows->dll, mac/ios->bundle,
+    and put them into the Plugins folder, like as Plugins/android, Plugins/linux ...
+    c# library is run everywhere once compiled
+