CA-248254: Remove unused function

CA-248254: Remove unused function

--- XenAdmin/TabPages/GeneralTabPage.cs
+++ XenAdmin/TabPages/GeneralTabPage.cs
@@ -1734,14 +1734,6 @@
                 : poolPatchString(patch => patch.host_patches.Count > 0 && patch.host_patches.Count != xenObject.Connection.Cache.HostCount);
         }

-        private string poolNotAppliedPatches()
-        {
-            return
-                Helpers.ElyOrGreater(xenObject.Connection)
-                ? poolUpdateString(update => update.AppliedOnHosts.Count == 0)
-                : poolPatchString(patch => patch.host_patches.Count == 0);
-        }
-
         private string poolPatchString(Predicate<Pool_patch> predicate)
         {
             Pool_patch[] patches = xenObject.Connection.Cache.Pool_patches;


[Gtk] use version detection for toolkit features

--- Xwt.Gtk/Xwt.GtkBackend/GtkEngine.cs
+++ Xwt.Gtk/Xwt.GtkBackend/GtkEngine.cs
@@ -331,11 +331,12 @@

 		public override ToolkitFeatures SupportedFeatures {
 			get {
-				#if XWT_GTK3
 				var f = ToolkitFeatures.All;
-				#else
-				var f = ToolkitFeatures.All & ~ToolkitFeatures.WidgetOpacity;
-				#endif
+
+				if (GtkWorkarounds.GtkMajorVersion <= 2 ||
+				    GtkWorkarounds.GtkMajorVersion == 3 && GtkWorkarounds.GtkMinorVersion < 8)
+					f &= ~ToolkitFeatures.WidgetOpacity;
+
 				if (Platform.IsWindows)
 					f &= ~ToolkitFeatures.WindowOpacity;
 				return f;


Converted to apiv2. Some api related bugs still around.

--- StripSystem/Filter.cs
+++ StripSystem/Filter.cs
@@ -1,6 +1,10 @@
 using System;
 using System.Collections.Generic;
 using System.Text.RegularExpressions;
+using AdiIRCAPIv2.Arguments.Channel;
+using AdiIRCAPIv2.Arguments.ChannelMessages;
+using AdiIRCAPIv2.Arguments.ChannelModes;
+using AdiIRCAPIv2.Arguments.Contextless;
 using AdiIRCAPIv2.Enumerators;
 using AdiIRCAPIv2.Interfaces;

@@ -10,28 +14,18 @@
 {
     public class Filter : IPlugin // Reference this is a plugin
     {
-        IPluginHost _myHost = null;
-
+        public IPluginHost Host { get; set; }
+
+        public string Name => "Join-Part Filter";

         public string Description => "Filters join/part messages.";

-        public string Author => "Xesyto";
-
-        public string Name => "Join-Part Filter";
-
-        public string Version => "3";
-
-        public string Email => "";
-
-        public IPluginHost Host
-        {
-            get { return _myHost; }
-            set { _myHost = value; }
-        }
-
-
+        public string Author => "Xesyto";
+        public string Version => "4";
+        public string Email => "s.oudenaarden@gmail.com";
+
         private Dictionary<string, UserData> userDatabase;
-        private string ColourCode = "8"; //ascii char 3 is included at the start of this string but not clearly visible in VS Editor
+        private readonly string ColourCode = "8"; //ascii char 3 is included at the start of this string but not clearly visible in VS Editor

         public Filter()
         {
@@ -43,9 +37,178 @@
             // This is called when the plugin is loaded
             // Suscribe to delegates here

-        }
-
-        private void myHost_OnMode(IServer server, IChannel channel, IUser user, string mode, out EatData Return)
+            Host.OnChannelJoin += OnChannelJoin;
+            Host.OnChannelPart += OnChannelPart;
+            Host.OnQuit += OnQuit;
+            Host.OnChannelNormalMessage += OnChannelNormalMessage;
+            Host.OnNick += OnNick;
+            Host.OnChannelMode += OnChannelMode;
+        }
+
+
+
+        private void OnChannelNormalMessage(ChannelNormalMessageArgs argument)
+        {
+            //sometimes ( mostly twitch ) user ident or host is not yet known even though a message was received
+            if (argument.User == null || argument.User.Ident == null || argument.User.Host == null)
+                return;
+
+            var userKey = argument.Server.Network + argument.Channel.Name + argument.User.Host;
+
+            if (!userDatabase.ContainsKey(userKey))
+            {
+                var newData = new UserData { AnnouncedJoin = true, LastMessage = DateTime.Now };
+                userDatabase.Add(userKey, newData);
+            }
+            else
+            {
+                var userData = userDatabase[userKey];
+
+                if (!userData.AnnouncedJoin)
+                {
+                    var user = argument.User;
+                    var channel = argument.Channel;
+                    var message = argument.Message;
+
+                    var newMessage = $":{user.Nick}!{user.Ident}@{user.Host} PRIVMSG {channel.Name} :{message} {ColourCode}(logged in {userData.TimeSinceJoin()} ago)";
+                    argument.Server.SendFakeRaw(newMessage);
+
+                    userData.AnnouncedJoin = true;
+                }
+
+                userData.LastMessage = DateTime.Now;
+            }
+        }
+
+        private void OnChannelJoin(ChannelJoinArgs argument)
+        {
+            argument.EatData = EatData.EatText;
+
+            var userKey = argument.Server.Network + argument.Channel.Name + argument.User.Host;
+
+            if (userDatabase.ContainsKey(userKey))
+            {
+                var userData = userDatabase[userKey];
+                if (userData.TalkedRecently())
+                {
+                    argument.EatData = EatData.EatNone;
+                }
+                userData.Rejoined();
+            }
+            else
+            {
+                var userData = new UserData { Joined = DateTime.Now };
+
+                userDatabase.Add(userKey, userData);
+            }
+        }
+
+        private void OnChannelPart(ChannelPartArgs argument)
+        {
+            argument.EatData = EatData.EatText;
+
+            var userKey = argument.Server.Network + argument.Channel.Name + argument.User.Host;
+
+            if (!userDatabase.ContainsKey(userKey)) return;
+
+            var userData = userDatabase[userKey];
+            if (userData.TalkedRecently())
+            {
+                argument.EatData = EatData.EatNone;
+            }
+        }
+
+        private void OnQuit(QuitArgs argument)
+        {
+            argument.EatData = EatData.EatText;
+
+            foreach (IChannel channel in argument.Server.GetChannels)
+            {
+                var userKey = argument.Server + channel.Name + argument.User.Ident + argument.User.Host;
+
+                if (!userDatabase.ContainsKey(userKey)) continue;
+
+                var userData = userDatabase[userKey];
+                if (!userData.TalkedRecently()) continue;
+
+                argument.EatData = EatData.EatNone;
+                return;
+            }
+        }
+
+        private void OnNick(NickArgs argument)
+        {
+            //argument.EatData = EatData.EatAll;
+
+            foreach (IChannel channel in argument.Server.GetChannels)
+            {
+                var userKey = argument.Server + channel.Name + argument.User.Ident + argument.User.Host;
+
+                if (!userDatabase.ContainsKey(userKey)) continue;
+
+                var userData = userDatabase[userKey];
+                if (!userData.TalkedRecently()) continue;
+
+                //argument.EatData = EatData.EatNone;
+                return;
+            }
+        }
+
+
+        private void OnChannelMode(ChannelModeArgs argument)
+        {
+            var user = argument.User;
+            var mode = argument.Mode;
+
+            if (string.IsNullOrEmpty(user?.Ident))
+            {
+                var modeRegex = @"[+-]. (\w+)";
+                var modeResult = Regex.Match(mode, modeRegex);
+
+                string userName;
+
+                if (modeResult.Success)
+                {
+                    userName = modeResult.Groups[1].ToString();
+                }
+                else
+                {
+                    argument.EatData = EatData.EatNone;
+                    return;
+                }
+
+                foreach (IUser channelUser in argument.Channel.GetUsers)
+                {
+                    if (channelUser.Nick == userName)
+                    {
+                        user = channelUser as IChannelUser;
+                    }
+                }
+
+                if (string.IsNullOrEmpty(user?.Ident))
+                {
+                    //Twitch has a nasty habit of showing mode removal after a user has left the channel.
+                    if (!argument.Server.Network.ToLower().Contains("twitch"))
+                    {
+                        argument.EatData = EatData.EatNone;
+                        return;
+                    }
+                }
+            }
+
+            argument.EatData = EatData.EatText;
+            var userKey = argument.Server.Network + argument.Channel.Name + user.Ident + user.Host;
+
+            if (!userDatabase.ContainsKey(userKey)) return;
+
+            var userData = userDatabase[userKey];
+            if (userData.TalkedRecently())
+            {
+                argument.EatData = EatData.EatNone;
+            }
+        }
+
+        private void OnMode(IServer server, IChannel channel, IUser user, string mode, out EatData Return)
         {
             if (string.IsNullOrEmpty(user?.Ident))
             {
@@ -95,115 +258,39 @@
             }
         }

-        private void myHost_OnNick(IServer server, IUser user, string newNick, out EatData Return)
-        {
-            Return = EatData.EatText;
-
-            foreach (IChannel channel in server.GetChannels)
-            {
-                var userKey = server.Network + channel.Name + user.Ident + user.Host;
-
-                if (!userDatabase.ContainsKey(userKey)) continue;
-
-                var userData = userDatabase[userKey];
-                if (!userData.TalkedRecently()) continue;
-
-                Return = EatData.EatNone;
-                return;
-            }
-        }
-
-        void myHost_OnQuit(IServer server, IUser user, string data, out EatData Return)
-        {
-            Return = EatData.EatText;
-
-            foreach (IChannel channel in server.GetChannels)
-            {
-                var userKey = server.Network + channel.Name + user.Ident + user.Host;
-
-                if (!userDatabase.ContainsKey(userKey)) continue;
-
-                var userData = userDatabase[userKey];
-                if (!userData.TalkedRecently()) continue;
-
-                Return = EatData.EatNone;
-                return;
-            }
-        }
-
-        void myHost_OnPart(IServer server, IChannel channel, IUser user, string partMessage, out EatData Return)
-        {
-            Return = EatData.EatText;
-            var userKey = server.Network + channel.Name + user.Ident + user.Host;
-
-            if (!userDatabase.ContainsKey(userKey)) return;
-
-            var userData = userDatabase[userKey];
-            if (userData.TalkedRecently())
-            {
-                Return = EatData.EatNone;
-            }
-        }
-
-        void myHost_OnJoin(IServer server, IChannel channel, IUser user, out EatData Return)
-        {
-            Return = EatData.EatText;
-
-            var userKey = server.Network + channel.Name + user.Ident + user.Host;
-
-            if (userDatabase.ContainsKey(userKey))
-            {
-                var userData = userDatabase[userKey];
-                if (userData.TalkedRecently())
-                {
-                    Return = EatData.EatNone;
-                }
-                userData.Rejoined();
-            }
-            else
-            {
-                var userData = new UserData {Joined = DateTime.Now};
-
-                userDatabase.Add(userKey,userData);
-            }
-        }
-
-        void myHost_OnMessage(IServer server, IChannel channel, IUser user, string message, out EatData Return)
+        private void OnNick(IServer server, IUser user, string newNick, out EatData Return)
+        {
+            Return = EatData.EatText;
+        }
+
+        private void OnQuit(IServer server, IUser user, string data, out EatData Return)
+        {
+            Return = EatData.EatText;
+
+        }
+
+        private void OnPart(IServer server, IChannel channel, IUser user, string partMessage, out EatData Return)
+        {
+            Return = EatData.EatText;
+
+        }
+
+        private void OnJoin(IServer server, IChannel channel, IUser user, out EatData Return)
+        {
+            Return = EatData.EatText;
+
+
+        }
+
+        private void OnMessage(IServer server, IChannel channel, IUser user, string message, out EatData Return)
         {
             Return = EatData.EatNone;

-            //sometimes ( mostly twitch ) user ident or host is not yet known even though a message was received
-            if (user == null || user.Ident == null || user.Host == null)
-                return;
-
-            var userKey = server.Network + channel.Name + user.Ident + user.Host;
-
-            if (!userDatabase.ContainsKey(userKey))
-            {
-                var newData = new UserData {AnnouncedJoin = true,LastMessage = DateTime.Now};
-                userDatabase.Add(userKey,newData);
-            }
-            else
-            {
-                var userData = userDatabase[userKey];
-
-                if (!userData.AnnouncedJoin)
-                {
-                    Return = EatData.EatAll;
-
-                    var newMessage = $":{user.Nick}!{user.Ident}@{user.Host} PRIVMSG {channel.Name} :{message} {ColourCode}(logged in {userData.TimeSinceJoin()} ago)";
-                    server.SendFakeRaw(newMessage);
-
-                    userData.AnnouncedJoin = true;
-                }
-
-                userData.LastMessage = DateTime.Now;
-            }
+
         }

         public void Dispose()
         {
-            // This is called when the plugin is unloaded
         }
     }
 }


use environment instead of args

use environment instead of args

--- BotVentic2/Program.cs
+++ BotVentic2/Program.cs
@@ -6,15 +6,17 @@
 {
     static void Main(string[] args)
     {
-        if (args.Length < 2)
+        string token = Environment.GetEnvironmentVariable("TOKEN");
+        string clientid = Environment.GetEnvironmentVariable("CLIENT_ID");
+        if (string.IsNullOrEmpty(token))
         {
-            Console.WriteLine("Required arguments: [bot token] [client id]");
+            Console.WriteLine("Required environment variable TOKEN missing.");
         }
         else
         {
             Console.WriteLine($"Starting... Ctrl+C to stop");

-            var bot = new BotVentic2.Bot(args[0], args[1]);
+            var bot = new BotVentic2.Bot(token, clientid);

             Console.CancelKeyPress += (object sender, ConsoleCancelEventArgs e) =>
             {


Patch to allow %Path% references to Commands.xml

--- CLI/CommandCatalog.cs
+++ CLI/CommandCatalog.cs
@@ -41,6 +41,7 @@
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
 using System.IO;
+using System.Reflection;
 using System.Text;
 using System.Xml;
 using GitSharp;
@@ -72,7 +73,8 @@
         public CommandCatalog()
         {
             XmlDocument doc = new XmlDocument();
-            doc.Load("Commands.xml");
+            string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase),"Commands.xml");
+            doc.Load(path);

             XmlNodeList xmlNodeList = doc.SelectNodes("/root/CommandList/Command");
             foreach (XmlNode node in xmlNodeList)


-Refactor

-Refactor

--- Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs
+++ Src/Newtonsoft.Json/Converters/XmlNodeConverter.cs
@@ -2232,34 +2232,17 @@
         {
             foreach (IXmlNode xmlNode in c)
             {
-#if HAVE_XML_DOCUMENT
-                // ignores the attribute if it is the declaration of namespace "JsonNamespaceUri"
-                var xmlAttribute = xmlNode.WrappedNode as XmlAttribute;
-
-                if (xmlAttribute != null &&
-                    xmlAttribute.Prefix.Equals("xmlns", StringComparison.OrdinalIgnoreCase) &&
-                    xmlAttribute.Value == JsonNamespaceUri)
+                if (xmlNode.NamespaceUri == JsonNamespaceUri)
                 {
                     continue;
                 }
-#endif
-
-#if HAVE_XLINQ
-                // ignores the attribute if it is the declaration of namespace "JsonNamespaceUri"
-                var xAttribute = xmlNode.WrappedNode as XAttribute;
-
-                if (xAttribute != null &&
-                    xAttribute.IsNamespaceDeclaration &&
-                    xAttribute.Value == JsonNamespaceUri)
+
+                if (xmlNode.NamespaceUri == "http://www.w3.org/2000/xmlns/" && xmlNode.Value == JsonNamespaceUri)
                 {
                     continue;
                 }
-#endif
-
-                if (xmlNode.NamespaceUri != JsonNamespaceUri)
-                {
-                    return true;
-                }
+
+                return true;
             }

             return false;


Attempt to fix unit tests

Attempt to fix unit tests

--- Src/Test/UnitTests/Core.Logging.Test/LoggerTest.cs
+++ Src/Test/UnitTests/Core.Logging.Test/LoggerTest.cs
@@ -70,6 +70,7 @@
             int messageCount = 100;
             int sleepTime = 100;

+            _dest.GenerateErrrorsWhileProcessing = false;
             _dest.SleepTime = sleepTime;
             _dest.MaxQueueSize = 1;
             _dest.BatchSize = 1;
@@ -89,6 +90,10 @@
         [TestMethod]
         public void LoggerOrderingTest()
         {
+            _dest.BatchSize = 150;
+            _dest.MaxQueueSize = 5000;
+            _dest.GenerateErrrorsWhileProcessing = false;
+
             int messageCount = 10000;
             List<string> messages = new List<string>();


test change

test change

--- CSSPath/EntryPoint.cs
+++ CSSPath/EntryPoint.cs
@@ -41,7 +41,7 @@
         {
             RedMessage("I can't see xPath Element");
         }
-
+        //test
         Thread.Sleep(3000);
         driver.Close();
     }


refactored PS progress factory

refactored PS progress factory

--- TIKSN.Core/PowerShell/PowerShellProgressFactory.cs
+++ TIKSN.Core/PowerShell/PowerShellProgressFactory.cs
@@ -1,20 +1,20 @@
-using System.Management.Automation;
+using System;
 using TIKSN.Progress;

 namespace TIKSN.PowerShell
 {
     public class PowerShellProgressFactory : IOperationProgressFactory
     {
-        private readonly Cmdlet cmdlet;
+        private readonly ICurrentCommandProvider _currentCommandProvider;

-        public PowerShellProgressFactory(Cmdlet cmdlet)
+        public PowerShellProgressFactory(ICurrentCommandProvider currentCommandProvider)
         {
-            this.cmdlet = cmdlet;
+            _currentCommandProvider = currentCommandProvider ?? throw new ArgumentNullException(nameof(currentCommandProvider));
         }

         public DisposableProgress<OperationProgressReport> Create(string activity, string statusDescription)
         {
-            return new PowerShellProgress(cmdlet, activity, statusDescription);
+            return new PowerShellProgress(_currentCommandProvider, activity, statusDescription);
         }
     }
 }


insert random number of doors

insert random number of doors

--- PaCode.Raim/Model/MapGenerator.cs
+++ PaCode.Raim/Model/MapGenerator.cs
@@ -109,7 +109,12 @@
             int borderThickness = rnd.Next(10, 20);

             var rectangle = new Rectangle(position, size, borderThickness);
-            rectangle.AddDoors(rnd);
+
+            var doorCount = rnd.Next(1, 5);
+            for (int i = 0; i < doorCount; i++)
+            {
+                rectangle.AddDoors(rnd);
+            }

             return rectangle.Obstacles;
         }
@@ -161,16 +166,23 @@
             public void AddDoors(Random rnd)
             {
                 var doorSize = rnd.Next(40, 80);
-
-                var obstacleIndex = rnd.Next(0, Obstacles.Count);
-                var obstacle = Obstacles[obstacleIndex];
-
-                var topLeft = obstacle.Points.OrderBy(p => p.X).Take(2).OrderByDescending(p => p.Y).First();
-                var bottomRight = obstacle.Points.OrderByDescending(p => p.X).Take(2).OrderBy(p => p.Y).First();
-
-                double width = bottomRight.X - topLeft.X;
-                double height = topLeft.Y - bottomRight.Y;
-                int maxDistance = (int)Math.Max(width, height) - doorSize;
+                int obstacleIndex;
+                Obstacle obstacle;
+                int maxDistance;
+
+                do
+                {
+                    obstacleIndex = rnd.Next(0, Obstacles.Count);
+                    obstacle = Obstacles[obstacleIndex];
+
+                    var topLeft = obstacle.Points.OrderBy(p => p.X).Take(2).OrderByDescending(p => p.Y).First();
+                    var bottomRight = obstacle.Points.OrderByDescending(p => p.X).Take(2).OrderBy(p => p.Y).First();
+
+                    double width = bottomRight.X - topLeft.X;
+                    double height = topLeft.Y - bottomRight.Y;
+                    maxDistance = (int)Math.Max(width, height) - doorSize;
+                }
+                while (maxDistance < 0);

                 var distance = rnd.Next(1, maxDistance);
                 var newObstacles = obstacle.SplitWithSpace(doorSize, distance);


Don't crash if no songs have been played and channel is switched

--- SOVND.Client/Modules/NowPlayingHandler.cs
+++ SOVND.Client/Modules/NowPlayingHandler.cs
@@ -98,7 +98,8 @@
                 {
                     LogTo.Trace("NPH: _waveOut.Play()");
                     PlayingSongChanged(songID, true);
-                    _waveOut.Play();
+                    if(_waveOut != null)
+                        _waveOut.Play();
                 },
                 buffer =>
                 {
@@ -120,7 +121,8 @@
                 {
                     LogTo.Trace("NPH: _waveOut.Pause()");
                     PlayingSongChanged(songID, false);
-                    _waveOut.Stop();
+                    if(_waveOut != null)
+                        _waveOut.Stop();
                 });
         }


Shorter and cleaner code

Shorter and cleaner code

--- TestDiagnostics/VarConversion/TypeToVarAnalyzer.cs
+++ TestDiagnostics/VarConversion/TypeToVarAnalyzer.cs
@@ -79,14 +79,8 @@
             }

             var location = variableDeclaration.Type.GetLocation();
-            if (IsWithPotentialParentheses<CastExpressionSyntax>(variableInitializer.Value))
-            {
-                addDiagnostic(Diagnostic.Create(DescriptorWithCast, location));
-            }
-            else
-            {
-                addDiagnostic(Diagnostic.Create(Descriptor, location));
-            }
+            var rightIsCast = IsWithPotentialParentheses<CastExpressionSyntax>(variableInitializer.Value);
+            addDiagnostic(Diagnostic.Create(rightIsCast ? DescriptorWithCast : Descriptor, location));
         }

         static bool IsWithPotentialParentheses<T>(ExpressionSyntax expression)


Adding layer names to ArrangeRenderingTests

--- Tests/Mapsui.Tests.Common/ArrangeRenderingTests.cs
+++ Tests/Mapsui.Tests.Common/ArrangeRenderingTests.cs
@@ -30,10 +30,12 @@
         {
             var map = new Map { Viewport = { Center = new Point(100, 100), Width = 200, Height = 200, Resolution = 1 } };
             map.Layers.Add(new MemoryLayer
-                {
-                    Style = null,
-                    DataSource = Utilities.CreateProviderWithPointsWithVectorStyle()
-                });
+            {
+                Style = null,
+                DataSource = Utilities.CreateProviderWithPointsWithVectorStyle()
+                ,
+                LayerName = "Points with VectorStyle"
+            });
             return map;
         }

@@ -41,10 +43,11 @@
         {
             var map = new Map { Viewport = { Center = new Point(100, 100), Width = 200, Height = 200, Resolution = 1 } };
             var layer = new MemoryLayer
-                {
-                    Style = null,
-                    DataSource = Utilities.CreateProviderWithPointsWithSymbolStyles()
-                };
+            {
+                Style = null,
+                DataSource = Utilities.CreateProviderWithPointsWithSymbolStyles(),
+                LayerName = "Points with bitmaps"
+            };
             map.Layers.Add(layer);
             return map;
         }
@@ -52,7 +55,11 @@
         public static Map PointsWithBitmapRotatedAndOffset()
         {
             var map = new Map { Viewport = { Center = new Point(80, 80), Width = 200, Height = 200, Resolution = 1 } };
-            var layer = new MemoryLayer { DataSource = Utilities.CreateProviderWithRotatedBitmapSymbols() };
+            var layer = new MemoryLayer
+            {
+                DataSource = Utilities.CreateProviderWithRotatedBitmapSymbols(),
+                LayerName = "Points with rotated bitmaps"
+            };
             map.Layers.Add(layer);
             return map;
         }
@@ -61,11 +68,15 @@
         {
             var map = new Map { Viewport = { Center = new Point(0, 0), Width = 200, Height = 100, Resolution = 0.5 } };
             var features = new Features
-                {
-                    Utilities.CreateSimplePointFeature(-20, 0, new SymbolStyle {Fill = new Brush { Color = Color.Gray}, Outline = new Pen(Color.Black), SymbolType = SymbolType.Ellipse}),
-                    Utilities.CreateSimplePointFeature(20, 0, new SymbolStyle {Fill = new Brush { Color = Color.Gray}, Outline = new Pen(Color.Black), SymbolType = SymbolType.Rectangle})
-                };
-            var layer = new MemoryLayer { DataSource = new MemoryProvider(features) };
+            {
+                Utilities.CreateSimplePointFeature(-20, 0, new SymbolStyle {Fill = new Brush { Color = Color.Gray}, Outline = new Pen(Color.Black), SymbolType = SymbolType.Ellipse}),
+                Utilities.CreateSimplePointFeature(20, 0, new SymbolStyle {Fill = new Brush { Color = Color.Gray}, Outline = new Pen(Color.Black), SymbolType = SymbolType.Rectangle})
+            };
+            var layer = new MemoryLayer
+            {
+                DataSource = new MemoryProvider(features),
+                LayerName = "Points with various symbol types"
+            };
             map.Layers.Add(layer);
             return map;
         }
@@ -74,11 +85,11 @@
         {
             var map = new Map { Viewport = { Center = new Point(0, 0), Width = 200, Height = 100, Resolution = 0.5 } };
             var features = new Features
-                {
-                    Utilities.CreateSimplePointFeature(-20, 0, new SymbolStyle {UnitType = UnitType.Pixel}),
-                    Utilities.CreateSimplePointFeature(20, 0, new SymbolStyle {UnitType = UnitType.WorldUnit})
-                };
-            var layer = new MemoryLayer { DataSource = new MemoryProvider(features) };
+            {
+                Utilities.CreateSimplePointFeature(-20, 0, new SymbolStyle {UnitType = UnitType.Pixel}),
+                Utilities.CreateSimplePointFeature(20, 0, new SymbolStyle {UnitType = UnitType.WorldUnit})
+            };
+            var layer = new MemoryLayer { DataSource = new MemoryProvider(features), LayerName = "Points in world units"};
             map.Layers.Add(layer);
             return map;
         }
@@ -88,17 +99,19 @@
             var map = new Map
             {
                 Viewport =
-                    {
-                        Center = new Point(0, 0),
-                        Width = 600,
-                        Height = 400,
-                        Resolution = 63000
-                    }
-            };
-
-            var layer = new MemoryLayer();
-            var provider = Utilities.CreatePolygonProvider();
-            layer.DataSource = provider;
+                {
+                    Center = new Point(0, 0),
+                    Width = 600,
+                    Height = 400,
+                    Resolution = 63000
+                }
+            };
+
+            var layer = new MemoryLayer
+            {
+                DataSource = Utilities.CreatePolygonProvider(),
+                LayerName = "Polygon"
+            };
             map.Layers.Add(layer);
             return map;
         }
@@ -108,17 +121,21 @@
             var map = new Map
             {
                 Viewport =
-                    {
-                        Center = new Point(0, 0),
-                        Width = 600,
-                        Height = 400,
-                        Resolution = 63000
-                    }
-            };
-
-            var layer = new MemoryLayer { Style = null };
-            var provider = Utilities.CreateLineProvider();
-            layer.DataSource = provider;
+                {
+                    Center = new Point(0, 0),
+                    Width = 600,
+                    Height = 400,
+                    Resolution = 63000
+                }
+            };
+
+            var layer = new MemoryLayer
+            {
+                Style = null,
+                DataSource = Utilities.CreateLineProvider(),
+                LayerName = "Line"
+            };
+
             map.Layers.Add(layer);
             return map;
         }
@@ -145,7 +162,7 @@
             };

             var features = TileIndexToFeatures(tileIndexes, new SampleTileSource());
-            map.Layers.Add(new MemoryLayer { DataSource = new MemoryProvider(features) });
+            map.Layers.Add(new MemoryLayer { DataSource = new MemoryProvider(features), LayerName = "Tiles"});
             return map;
         }

@@ -179,7 +196,8 @@
             map.Layers.Add(new MemoryLayer
             {
                 Style = null,
-                DataSource = CreateProviderWithLabels()
+                DataSource = CreateProviderWithLabels(),
+                LayerName = "Labels"
             });
             return map;


minor: Add a little more detail to IOException logging in XEngine.SetXMLState()

Also removes superflous Close() commands for statements taking place within using() constructs
Also adds some comment out debug log messages for future use.

--- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -1743,6 +1743,8 @@

         public bool SetXMLState(UUID itemID, string xml)
         {
+//            m_log.DebugFormat("[XEngine]: Writing state for script item with ID {0}", itemID);
+
             if (xml == String.Empty)
                 return false;

@@ -1803,14 +1805,15 @@
                     {
                         using (FileStream fs = File.Create(path))
                         {
+//                            m_log.DebugFormat("[XEngine]: Writing assembly file {0}", path);
+
                             fs.Write(filedata, 0, filedata.Length);
-                            fs.Close();
                         }
                     }
                     catch (IOException ex)
                     {
                         // if there already exists a file at that location, it may be locked.
-                        m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", path, ex.Message);
+                        m_log.ErrorFormat("[XEngine]: Error whilst writing assembly file {0}, {1}", path, ex.Message);
                     }

                     string textpath = path + ".text";
@@ -1820,16 +1823,16 @@
                         {
                             using (StreamWriter sw = new StreamWriter(fs))
                             {
+//                                m_log.DebugFormat("[XEngine]: Writing .text file {0}", textpath);
+
                                 sw.Write(base64);
-                                sw.Close();
                             }
-                            fs.Close();
                         }
                     }
                     catch (IOException ex)
                     {
                         // if there already exists a file at that location, it may be locked.
-                        m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", textpath, ex.Message);
+                        m_log.ErrorFormat("[XEngine]: Error whilst writing .text file {0}, {1}", textpath, ex.Message);
                     }
                 }
             }
@@ -1843,16 +1846,16 @@
                 {
                     using (StreamWriter ssw = new StreamWriter(sfs))
                     {
+//                        m_log.DebugFormat("[XEngine]: Writing state file {0}", statepath);
+
                         ssw.Write(stateE.OuterXml);
-                        ssw.Close();
-                    }
-                    sfs.Close();
+                    }
                 }
             }
             catch (IOException ex)
             {
                 // if there already exists a file at that location, it may be locked.
-                m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", statepath, ex.Message);
+                m_log.ErrorFormat("[XEngine]: Error whilst writing state file {0}, {1}", statepath, ex.Message);
             }

             XmlNodeList mapL = rootE.GetElementsByTagName("LineMap");
@@ -1869,16 +1872,16 @@
                     {
                         using (StreamWriter msw = new StreamWriter(mfs))
                         {
+//                            m_log.DebugFormat("[XEngine]: Writing linemap file {0}", mappath);
+
                             msw.Write(mapE.InnerText);
-                            msw.Close();
                         }
-                        mfs.Close();
                     }
                 }
                 catch (IOException ex)
                 {
                     // if there already exists a file at that location, it may be locked.
-                    m_log.ErrorFormat("[XEngine]: File {0} already exists! {1}", mappath, ex.Message);
+                    m_log.ErrorFormat("[XEngine]: Linemap file {0} already exists! {1}", mappath, ex.Message);
                 }
             }


Android os type

Android os type

--- PlatformAbstract/OsInformation.cs
+++ PlatformAbstract/OsInformation.cs
@@ -31,7 +31,7 @@
 {
     public class OsInformation
     {
-        public enum OSType { Windows, Mac, X11, Other };
+        public enum OSType { Windows, Mac, X11, Other, Android };
         static OSType OperatingSysetm;

         public static void SetOSType(OSType osType)


State activation calls OnActivated/OnDeactivated

--- System/GameManager.cs
+++ System/GameManager.cs
@@ -81,10 +81,11 @@
             if (Has(name))
             {
                 if (activeState != null)
-                    activeState.Deactivated();
+                    activeState.OnDeactivated();

                 activeState = GetState(name);
                 activeState.Activated();
+                activeState.OnActivated();
             }
         }


Update LUAPlugin.cs

Update LUAPlugin.cs

Correction

--- Pluton/PluginLoaders/LUAPlugin.cs
+++ Pluton/PluginLoaders/LUAPlugin.cs
@@ -105,6 +105,5 @@
             PluginLoader.GetInstance().OnPluginLoaded(this);
         }
     }
-    }
 }


Fix the date time out of range behavior of the binary decoder

--- UaClient/ServiceModel/Ua/Channels/BinaryDecoder.cs
+++ UaClient/ServiceModel/Ua/Channels/BinaryDecoder.cs
@@ -12,6 +12,8 @@
 {
     public sealed class BinaryDecoder : IDecoder, IDisposable
     {
+        private const long MinFileTime =  504911232000000000L;
+        private const long MaxFileTime = 3155378975990000000L;
         private Stream stream;
         private UaTcpSecureChannel channel;
         private Encoding encoding;
@@ -121,6 +123,16 @@
         public DateTime ReadDateTime(string fieldName)
         {
             long num = this.reader.ReadInt64();
+
+            if (num <= 0)
+            {
+                return DateTime.MinValue;
+            }
+            else if (num >= MaxFileTime - MinFileTime)
+            {
+                return DateTime.MaxValue;
+            }
+
             return DateTime.FromFileTimeUtc(num);
         }


Add unit test

Add unit test

--- UnitTestUsefullFunctions/UnitTestFunctionCrypto.cs
+++ UnitTestUsefullFunctions/UnitTestFunctionCrypto.cs
@@ -302,6 +302,15 @@
       string result = CryptoFunc.Ntlm(source);
       Assert.AreEqual(result, expected);
     }
+
+    [TestMethod]
+    public void TestMethod_NTLM_d()
+    {
+      const string source = "d";
+      string expected = "9B75CF9A3FCC498E03EEDA4387BB5277";
+      string result = CryptoFunc.Ntlm(source);
+      Assert.AreEqual(result, expected);
+    }
     #endregion

   }


Refactor Fill and FillArea. Single Fill now, one without a rect param.

--- SadConsole.Core/Consoles/SurfaceEditor.cs
+++ SadConsole.Core/Consoles/SurfaceEditor.cs
@@ -982,53 +982,42 @@
         #endregion

         #region Fill
+
         /// <summary>
         /// Fills the console.
         /// </summary>
-        /// <param name="foreground">Foregorund of every cell.</param>
-        /// <param name="background">Foregorund of every cell.</param>
-        /// <param name="glyph">Glyph of every cell.</param>
+        /// <param name="foreground">Foregorund of every cell. If null, skips.</param>
+        /// <param name="background">Foregorund of every cell. If null, skips.</param>
+        /// <param name="glyph">Glyph of every cell. If null, skips.</param>
         /// <param name="effect">Effect of every cell.</param>
-        public void Fill(Color foreground, Color background, int glyph, Effects.ICellEffect effect)
+        /// <param name="spriteEffect">Sprite effect of every cell. If null, skips.</param>
+        public void Fill(Color? foreground, Color? background, int? glyph, Effects.ICellEffect effect, SpriteEffects? spriteEffect = null)
         {
             for (int i = 0; i < textSurface.Cells.Length; i++)
             {
-                textSurface.Cells[i].Foreground = foreground;
-                textSurface.Cells[i].Background = background;
-                textSurface.Cells[i].GlyphIndex = glyph;
+                if (glyph.HasValue)
+                    textSurface.Cells[i].GlyphIndex = glyph.Value;
+                if (background.HasValue)
+                    textSurface.Cells[i].Background = background.Value;
+                if (foreground.HasValue)
+                    textSurface.Cells[i].Foreground = foreground.Value;
+                if (spriteEffect.HasValue)
+                    textSurface.Cells[i].SpriteEffect = spriteEffect.Value;
+
                 textSurface.Cells[i].Effect = effect;
             }
         }

         /// <summary>
-        /// Fills the console.
-        /// </summary>
-        /// <param name="foreground">Foregorund of every cell.</param>
-        /// <param name="background">Foregorund of every cell.</param>
-        /// <param name="glyph">Glyph of every cell.</param>
+        /// Fills the specified area.
+        /// </summary>
+        /// <param name="area">The area to fill.</param>
+        /// <param name="foreground">Foregorund of every cell. If null, skips.</param>
+        /// <param name="background">Foregorund of every cell. If null, skips.</param>
+        /// <param name="glyph">Glyph of every cell. If null, skips.</param>
         /// <param name="effect">Effect of every cell.</param>
-        /// <param name="spriteEffect">Sprite effect of every cell.</param>
-        public void Fill(Color foreground, Color background, int glyph, Effects.ICellEffect effect, SpriteEffects spriteEffect)
-        {
-            for (int i = 0; i < textSurface.Cells.Length; i++)
-            {
-                textSurface.Cells[i].Foreground = foreground;
-                textSurface.Cells[i].Background = background;
-                textSurface.Cells[i].GlyphIndex = glyph;
-                textSurface.Cells[i].SpriteEffect = spriteEffect;
-                textSurface.Cells[i].Effect = effect;
-            }
-        }
-
-        /// <summary>
-        /// Fills the specified area.
-        /// </summary>
-        /// <param name="area">The area to fill.</param>
-        /// <param name="foreground">Foregorund of every cell.</param>
-        /// <param name="background">Foregorund of every cell.</param>
-        /// <param name="glyph">Glyph of every cell.</param>
-        /// <param name="effect">Effect of every cell.</param>
-        public void FillArea(Rectangle area, Color foreground, Color background, int glyph, Effects.ICellEffect effect)
+        /// <param name="spriteEffect">Sprite effect of every cell. If null, skips.</param>
+        public void Fill(Rectangle area, Color? foreground, Color? background, int? glyph, Effects.ICellEffect effect, SpriteEffects? spriteEffect = null)
         {
             // Check for valid rect
             Rectangle consoleArea = new Rectangle(0, 0, textSurface.Width, textSurface.Height);
@@ -1039,39 +1028,16 @@
                     for (int y = area.Y; y < area.Bottom; y++)
                     {
                         Cell cell = textSurface.Cells[y * textSurface.Width + x];
-                        cell.Foreground = foreground;
-                        cell.Background = background;
-                        cell.GlyphIndex = glyph;
-                        cell.Effect = effect;
-                    }
-                }
-            }
-        }
-
-        /// <summary>
-        /// Fills the specified area.
-        /// </summary>
-        /// <param name="area">The area to fill.</param>
-        /// <param name="foreground">Foregorund of every cell.</param>
-        /// <param name="background">Foregorund of every cell.</param>
-        /// <param name="glyph">Glyph of every cell.</param>
-        /// <param name="effect">Effect of every cell.</param>
-        /// <param name="spriteEffect">Sprite effect of every cell.</param>
-        public void FillArea(Rectangle area, Color foreground, Color background, int glyph, Effects.ICellEffect effect, SpriteEffects spriteEffect)
-        {
-            // Check for valid rect
-            Rectangle consoleArea = new Rectangle(0, 0, textSurface.Width, textSurface.Height);
-            if (consoleArea.Contains(area))
-            {
-                for (int x = area.X; x < area.Right; x++)
-                {
-                    for (int y = area.Y; y < area.Bottom; y++)
-                    {
-                        Cell cell = textSurface.Cells[y * textSurface.Width + x];
-                        cell.Foreground = foreground;
-                        cell.Background = background;
-                        cell.GlyphIndex = glyph;
-                        cell.SpriteEffect = spriteEffect;
+
+                        if (glyph.HasValue)
+                            cell.GlyphIndex = glyph.Value;
+                        if (background.HasValue)
+                            cell.Background = background.Value;
+                        if (foreground.HasValue)
+                            cell.Foreground = foreground.Value;
+                        if (spriteEffect.HasValue)
+                            cell.SpriteEffect = spriteEffect.Value;
+
                         cell.Effect = effect;
                     }
                 }


Fixed instant matrix rotations

Fixed instant matrix rotations

--- UnityProject/Assets/Scripts/Shuttles/MatrixMove.cs
+++ UnityProject/Assets/Scripts/Shuttles/MatrixMove.cs
@@ -801,8 +801,14 @@
 		{
 			serverState.RotationTime = rotTime;

-			//fixme: this whole class behaves like shit!
-			MatrixMoveMessage.SendToAll(gameObject, serverTargetState);
+			//fixme: this whole class behaves like ass!
+			if ( serverState.RotationTime != serverTargetState.RotationTime )
+			{ //Doesn't guarantee that matrix will stop
+				MatrixMoveMessage.SendToAll(gameObject, serverState);
+			} else
+			{ //Ends up in instant rotations
+				MatrixMoveMessage.SendToAll(gameObject, serverTargetState);
+			}
 			//Clear inform flags
 			serverTargetState.Inform = false;
 			serverState.Inform = false;


Simplified switch statement, adjusted formatting and made method static

--- UnityWeld_Editor/AnimatorParameterBindingEditor.cs
+++ UnityWeld_Editor/AnimatorParameterBindingEditor.cs
@@ -199,20 +199,22 @@
         /// </summary>
         /// <param name="parameterType">The type of parameter</param>
         /// <returns>The System.Type corresponding to paramter type</returns>
-        private Type AnimatorControllerParameterTypeToType(AnimatorControllerParameterType parameterType)
+        private static Type AnimatorControllerParameterTypeToType(
+            AnimatorControllerParameterType parameterType
+        )
         {
             switch (parameterType)
             {
                 case AnimatorControllerParameterType.Bool:
-                        return typeof(bool);
+                    return typeof(bool);
                 case AnimatorControllerParameterType.Float:
-                        return typeof(float);
+                    return typeof(float);
                 case AnimatorControllerParameterType.Int:
-                        return typeof(int);
+                    return typeof(int);
                 case AnimatorControllerParameterType.Trigger:
-                        return typeof(AnimatorParameterTrigger);
+                    return typeof(AnimatorParameterTrigger);
                 default:
-                        throw new ArgumentOutOfRangeException();
+                    throw new ArgumentOutOfRangeException();
             }
         }

@@ -300,15 +302,9 @@
                         break;

                     case "animatorParameterType":
-                        viewPropertyPrefabModified = property.prefabOverride;
-                        break;
-
                     case "animatorParameterName":
                         viewPropertyPrefabModified = property.prefabOverride;
                         break;
-
-                    default:
-                        break;
                 }
             }
             while (property.Next(false));