added info command

added info command

--- YuGiOhBot/Commands/InfoCommands.cs
+++ YuGiOhBot/Commands/InfoCommands.cs
@@ -1,7 +1,10 @@
-using Discord.Commands;
+using Discord;
+using Discord.Commands;
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.Linq;
+using System.Runtime.InteropServices;
 using System.Text;
 using System.Threading.Tasks;

@@ -21,5 +24,183 @@

         }

+        [Command("info")]
+        [Summary("Returns info on the system the bot is on and the bot itself")]
+        public async Task InfoCommand()
+        {
+
+            EmbedBuilder eBuilder;
+
+            using (Context.Channel.EnterTypingState())
+            {
+
+                IApplication AppInfo = await Context.Client.GetApplicationInfoAsync();
+                string ownerAvatarId = AppInfo.Owner.GetAvatarUrl();
+                DateTimeOffset creationTime = AppInfo.CreatedAt;
+                string botDescription = AppInfo.Description;
+                string owner = AppInfo.Owner.Username;
+                string botName = AppInfo.Name;
+                string botAvatarId = Context.Client.CurrentUser.GetAvatarUrl();
+                string framework = RuntimeInformation.FrameworkDescription;
+                var architecture = RuntimeInformation.OSArchitecture.ToString();
+                var ramUsage = ((Process.GetCurrentProcess().WorkingSet64 / 1024f) / 1024f).ToString();
+                TimeSpan Uptime = DateTime.Now.Subtract(Process.GetCurrentProcess().StartTime);
+
+                var authorBuilder = new EmbedAuthorBuilder()
+                {
+
+                    Name = owner,
+                    Url = "https://github.com/melikechoco",
+                    IconUrl = ownerAvatarId
+
+                };
+
+                var footerBuilder = new EmbedFooterBuilder()
+                {
+
+                    IconUrl = "http://2static2.fjcdn.com/thumbnails/comments/Ahegao+_0eaf3dbc104f428d0d2c548c7a62c78b.jpg",
+                    Text = $"A shitty bot made by {owner} aka MeLikeChoco"
+
+                };
+
+                eBuilder = new EmbedBuilder()
+                {
+                    Color = new Color(255, 128, 128),
+                    Author = authorBuilder,
+                    Description = $"**{botName}**\nThis was {owner}'s first major PUBLIC coding project.",
+                    ThumbnailUrl = botAvatarId,
+                    Footer = footerBuilder,
+                    Timestamp = DateTimeOffset.Now
+                };
+
+                eBuilder.AddField(x =>
+                {
+
+                    x.Name = "When was this bot created?";
+                    x.Value = creationTime.ToString();
+                    x.IsInline = false;
+
+                });
+
+                eBuilder.AddField(x =>
+                {
+
+                    x.Name = "What is this thing?";
+                    x.Value = botDescription;
+                    x.IsInline = false;
+
+                });
+
+                eBuilder.AddField(x =>
+                {
+
+                    x.Name = "Can I see the source code?";
+                    x.Value = "I suck at coding ;_;" +
+                    "\npls no flame" +
+                    "\nhttps://github.com/MeLikeChoco/YuGiOhBot";
+                    x.IsInline = false;
+
+                });
+
+                eBuilder.AddField(x =>
+                {
+
+                    x.Name = "What language and API?";
+                    x.Value = "Bot is coded in C# with .NET Core using Discord.NET library";
+                    x.IsInline = false;
+
+                });
+
+                eBuilder.AddField(x =>
+                {
+
+                    x.Name = "Would you like a donation?";
+                    x.Value = "I think about it, but it would mean nothing because if I wanted to stop working on it for no reason, " +
+                    "your donations would go to waste.";
+                    x.IsInline = false;
+
+                });
+
+                eBuilder.AddField(x =>
+                {
+
+                    x.Name = "Framework";
+                    x.Value = framework;
+                    x.IsInline = false;
+
+                });
+
+                eBuilder.AddField(x =>
+                {
+
+                    x.Name = "System Info";
+                    x.Value = $"{OperatingSystem()} {architecture}";
+                    x.IsInline = true;
+
+                });
+
+                eBuilder.AddField(x =>
+                {
+
+                    x.Name = "RAM Usage";
+                    x.Value = $"{ramUsage} Megabytes";
+                    x.IsInline = true;
+
+                });
+
+                eBuilder.AddField(x =>
+                {
+
+                    x.Name = "Uptime";
+                    x.Value = $"{Uptime.Days} days {Uptime.Hours} hours {Uptime.Minutes} minutes {Uptime.Seconds} seconds";
+                    x.IsInline = false;
+
+                });
+
+                eBuilder.AddField(x =>
+                {
+
+                    x.Name = "Support";
+                    x.Value = "[Support Server](https://image.slidesharecdn.com/bitcoin-130620013853-phpapp01/95/bitcoin-digital-gold-52-638.jpg?cb=1371692421)" +
+                    "\nOr you could use ";
+                    x.IsInline = false;
+
+                });
+
+            }
+
+            await ReplyAsync(string.Empty, embed: eBuilder);
+
+        }
+
+        public string OperatingSystem()
+        {
+
+            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+            {
+
+                return "Windows";
+
+            }
+            else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
+            {
+
+                return "Linux";
+
+            }
+            else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
+            {
+
+                return "OSX";
+
+            }
+            else
+            {
+
+                return "Some alien OS";
+
+            }
+
+        }
     }
 }


Clean up Generator and remove generator cache (use singletons or your own cache if absolutely needed)

--- Source/Eto/Generator.cs
+++ Source/Eto/Generator.cs
@@ -184,16 +184,11 @@
 		{
 			get
 			{
-                if (current == null)
-                    throw new ApplicationException("Generator has not been initialized");
-                return current;
-            }
-        }
-
-        public static void Initialize(string assembly)
-        {
-            Initialize(GetGenerator(assembly));
-        }
+				if (current == null)
+					throw new ApplicationException ("Generator has not been initialized");
+				return current;
+			}
+		}

 		/// <summary>
 		/// Returns the current generator, or detects the generator to use if no current generator is set.
@@ -211,59 +206,58 @@
 			{
 				if (current != null)
 					return current;
+
+				Generator detected = null;
 #if MOBILE
-				Initialize(Generator.GetGenerator (Generators.IosAssembly, true));
+				detected = Generator.GetGenerator (Generators.IosAssembly, true);
 #elif DESKTOP

 				if (EtoEnvironment.Platform.IsMac)
-					Initialize(Generator.GetGenerator (Generators.MacAssembly, true));
+					detected = Generator.GetGenerator (Generators.MacAssembly, true);
 				else if (EtoEnvironment.Platform.IsWindows) {
-					Initialize(Generator.GetGenerator (Generators.WpfAssembly, true));
-					if (current == null)
-						Initialize(Generator.GetGenerator (Generators.WinAssembly, true));
+					detected = Generator.GetGenerator (Generators.WpfAssembly, true);
+					if (detected == null)
+						detected = Generator.GetGenerator (Generators.WinAssembly, true);
 				}

-				if (current == null && EtoEnvironment.Platform.IsUnix)
-					Initialize(Generator.GetGenerator (Generators.GtkAssembly, true));
+				if (detected == null && EtoEnvironment.Platform.IsUnix)
+					detected = Generator.GetGenerator (Generators.GtkAssembly, true);
 #endif

-				if (current == null)
+				if (detected == null)
 					throw new EtoException ("Could not detect platform. Are you missing a platform assembly?");

+				Initialize (detected);
 				return current;
 			}
 		}

-        /// <summary>
-        /// Can be used by apps that switch between generators.
-        ///
-        /// Set this property at the start of a block of code.
-        /// All objects created after that point are verified to
-        /// use this generator.
-        ///
-        /// If null, no validation is performed.
-        /// </summary>
-        public static Generator ValidateGenerator { get; set; }
-
-        /// <summary>
-        /// Called by handlers to make sure they use the generator
-        /// specified by ValidateGenerator
-        /// </summary>
-        /// <param name="generator"></param>
-        public static void Validate(Generator generator)
-        {
-            if (ValidateGenerator != null &&
-                !object.ReferenceEquals(
-                generator,
-                ValidateGenerator))
-            {
-                throw new EtoException(
-                    string.Format("Expected to use generator {0}", ValidateGenerator));
-            }
-        }
-
-		/// <summary>
-		/// Initializes this generator as the current generator
+		/// <summary>
+		/// Can be used by apps that switch between generators.
+		///
+		/// Set this property at the start of a block of code.
+		/// All objects created after that point are verified to
+		/// use this generator.
+		///
+		/// If null, no validation is performed.
+		/// </summary>
+		public static Generator ValidateGenerator { get; set; }
+
+		/// <summary>
+		/// Called by handlers to make sure they use the generator
+		/// specified by ValidateGenerator
+		/// </summary>
+		/// <param name="generator"></param>
+		public static void Validate(Generator generator)
+		{
+			if (ValidateGenerator != null && !object.ReferenceEquals(generator, ValidateGenerator))
+			{
+				throw new EtoException(string.Format("Expected to use generator {0}", ValidateGenerator));
+			}
+		}
+
+		/// <summary>
+		/// Initializes the specified <see cref="generator"/> as the current generator
 		/// </summary>
 		/// <remarks>
 		/// This is called automatically by the <see cref="Forms.Application"/> when it is constructed
@@ -273,7 +267,16 @@
 		{
 			current = generator;
 		}
-
+
+		/// <summary>
+		/// Initialize the generator with the specified <paramref name="generatorType"/> as the current generator
+		/// </summary>
+		/// <param name="generatorType">Type of the generator to set as the current generator</param>
+		public static void Initialize(string generatorType)
+		{
+			Initialize(GetGenerator(generatorType));
+		}
+
 		/// <summary>
 		/// Gets the generator of the specified type
 		/// </summary>
@@ -283,10 +286,6 @@
 		{
 			return GetGenerator (generatorType, false);
 		}
-
-        // A static dictionary of generator instances.
-        static Dictionary<Type, Generator> GeneratorInstances =
-            new Dictionary<Type, Generator>();

 		static Generator GetGenerator (string generatorType, bool allowNull)
 		{
@@ -297,20 +296,7 @@
 				else
 					throw new EtoException ("Generator not found. Are you missing the platform assembly?");
 			}
-			try {
-                Generator result = null;
-
-                if (!GeneratorInstances.TryGetValue(type, out result) ||
-                    result == null)
-                {
-                    result = (Generator)Activator.CreateInstance(type);
-                    GeneratorInstances[type] = result;
-                }
-
-                return result;
-				} catch (TargetInvocationException e) {
-				throw e.InnerException;
-			}
+			return (Generator)Activator.CreateInstance (type);
 		}

 		/// <summary>


RLE Length property

RLE Length property

Added Length property to reconstruct original array. Added capacity to
one of the factory methods.

--- Source/RLE/RLEBitset.cs
+++ Source/RLE/RLEBitset.cs
@@ -29,7 +29,8 @@

         #region "Declaration"

-        private List<Run> _RLEArray = new List<Run>();
+        private List<Run> _RunArray = new List<Run>();
+        private int _Length;

         #endregion

@@ -38,6 +39,7 @@
         public static IBitset CreateFrom(BitArray bits)
         {
             RLEBitset rtnVal = new RLEBitset();
+            rtnVal._Length = bits.Length;
             Run currRun = new Run();
             for (int i = 0; i < bits.Count; i++)
             {
@@ -49,7 +51,7 @@
                         if (bits.Get(j) == false)
                         {
                             currRun.RunLength = j - i;
-                            rtnVal._RLEArray.Add(currRun);
+                            rtnVal._RunArray.Add(currRun);
                             i = j;
                             currRun = new Run();
                             break;
@@ -61,20 +63,29 @@
             return rtnVal;
         }

-        public static IBitset CreateFrom(int[] indicies)
+        public static IBitset CreateFrom(int[] indices)
         {
+            int capacity = indices.Max();
+            return RLEBitset.CreateFrom(indices, capacity);
+        }
+
+        public static IBitset CreateFrom(int[] indices, int capacity)
+        {
+            //sort the input array first.
+            Array.Sort(indices);
             RLEBitset rtnVal = new RLEBitset();
+            rtnVal._Length = capacity;
             Run currRun = new Run();
-            for (int i = 0; i < indicies.Length; i++)
+            for (int i = 0; i < indices.Length; i++)
             {
-                if (indicies[i + 1] - indicies[i] == 1)
+                if (indices[i + 1] - indices[i] == 1)
                 {
                     currRun.StartIndex = i;
                     currRun.RunLength = currRun.RunLength + 1;
                 }
                 else
                 {
-                    rtnVal._RLEArray.Add(currRun);
+                    rtnVal._RunArray.Add(currRun);
                     currRun = new Run();
                 }
             }


move getCardinality functionality to Cardinality method in RoaringBitset

--- Source/RoaringBitset.cs
+++ Source/RoaringBitset.cs
@@ -255,19 +255,9 @@
                 }
                 leftover -= thiscard;
             }
-            throw new ArgumentOutOfRangeException("select " + j + " when the cardinality is " + this.getCardinality());
-        }
-
-        public int getCardinality()
-        {
-            int size = 0;
-            for (int i = 0; i < this.containers.size; i++)
-            {
-                size += this.containers.getContainerAtIndex(i).getCardinality();
-            }
-            return size;
-        }
-
+            throw new ArgumentOutOfRangeException("select " + j + " when the cardinality is " + this.Cardinality());
+        }
+
         public IBitset And(IBitset otherSet)
         {
             if (otherSet is RoaringBitset) {
@@ -494,7 +484,12 @@

         public int Cardinality()
         {
-            return 0;
+            int size = 0;
+            for (int i = 0; i < this.containers.size; i++)
+            {
+                size += this.containers.getContainerAtIndex(i).getCardinality();
+            }
+            return size;
         }

         /// <summary>


Batched send and queue size limit

Batched send and queue size limit

--- SplunkNLog/SplunkNLog.cs
+++ SplunkNLog/SplunkNLog.cs
@@ -5,12 +5,15 @@
 using System.Net;
 using System.IO;
 using System.Text;
+using System.Collections;
+using System.Threading;
+using System.ComponentModel;

 namespace SplunkNLog
 {
     public class SplunkMessage
     {
-        public string Event { get; set; }
+        public string[] Event { get; set; }
     }

     [Target("SplunkNLog")]
@@ -18,6 +21,24 @@
     {
         public SplunkNLog()
         {
+            isStopping = false;
+
+            Queue q = new Queue();
+            messagesToSplunk = Queue.Synchronized(q);
+
+            stopSign = new EventWaitHandle(false, EventResetMode.ManualReset);
+            hasMessageToLog = new EventWaitHandle(false, EventResetMode.AutoReset);
+
+            MaxPendingQueueSize = 65000;
+
+            SplunkerThread = new Thread(ProcessLogMessages);
+            SplunkerThread.Start();
+        }
+
+        ~SplunkNLog()
+        {
+            isStopping = true;
+            stopSign.Set();
         }

         [RequiredParameter]
@@ -29,42 +50,117 @@
         [RequiredParameter]
         public string Token { get; set; }

+        [DefaultValue(65000), DefaultParameter]
+        public int MaxPendingQueueSize { get; set; }
+
+
+        private Queue           messagesToSplunk;
+        private EventWaitHandle stopSign;
+        private EventWaitHandle hasMessageToLog;
+        private Thread          SplunkerThread;
+        private bool            isStopping;
+
+        private void ProcessLogMessages()
+        {
+            WaitHandle[] handles = { hasMessageToLog, stopSign };
+
+            while (true)
+            {
+                int index = WaitHandle.WaitAny(handles);
+                if (index == 1)
+                {
+                    // Stop signal received. Quit.
+                    return;
+                }
+
+                while (messagesToSplunk.Count > MaxPendingQueueSize)
+                {
+                    try
+                    {
+                        // Discard the oldest messages, until we get back below the limit.
+                        messagesToSplunk.Dequeue();
+                    }
+                    catch (InvalidOperationException)
+                    {
+                        // Just go on.
+                    }
+                }
+
+                int messageCount = messagesToSplunk.Count;
+                if (messageCount <= 0)
+                {
+                    continue;
+                }
+
+                int maxBatchSize = 100;
+                // Do not work with too large batches
+                if (messageCount > maxBatchSize) messageCount = maxBatchSize;
+
+                string[] messageBatch = new string[messageCount];
+                for (int i = 0; i < messageCount; ++i)
+                {
+                    messageBatch[i] = (string)messagesToSplunk.Dequeue();
+                }
+
+                if (isStopping)
+                {
+                    // Shutting down. Abort.
+                    return;
+                }
+
+                try
+                {
+                    WebRequest request = WebRequest.Create(String.Format("{0}:{1}/services/collector/event", this.Host, this.Port));
+                    request.Credentials = CredentialCache.DefaultCredentials;
+                    request.Headers.Add("Authorization", String.Format("Splunk {0}", Token));
+
+                    //((HttpWebRequest)request).UserAgent = ".NET Framework Example Client";
+                    request.Method = "POST";
+
+                    SplunkMessage spm = new SplunkMessage();
+                    spm.Event = messageBatch;
+
+                    fastJSON.JSONParameters param = new fastJSON.JSONParameters();
+                    param.SerializeToLowerCaseNames = true;
+                    param.UseExtensions = false;
+                    string jsonContent = fastJSON.JSON.ToJSON(spm, param);
+
+                    byte[] byteArray = Encoding.UTF8.GetBytes(jsonContent);
+
+                    request.ContentLength = byteArray.Length;
+                    request.ContentType = "application/x-www-form-urlencoded";
+
+                    Stream dataStream = request.GetRequestStream();
+                    dataStream.Write(byteArray, 0, byteArray.Length);
+                    dataStream.Close();
+
+                    // It's important to get the response, otherwise it won't send new requests.
+                    WebResponse response = request.GetResponse();
+                    response.Close();
+                }
+                catch (Exception)
+                {
+                    // TODO: Retry log message on connection error
+                    continue;
+                }
+            }
+        }
+
         protected override void Write(LogEventInfo logEvent)
         {
             string logMessage = this.Layout.Render(logEvent);
-
-            WebRequest request = WebRequest.Create(String.Format("{0}:{1}/services/collector/event", this.Host, this.Port));
-            request.Credentials = CredentialCache.DefaultCredentials;
-            request.Headers.Add("Authorization", String.Format("Splunk {0}", Token));
-
-            //((HttpWebRequest)request).UserAgent = ".NET Framework Example Client";
-            request.Method = "POST";
-
-            SplunkMessage spm = new SplunkMessage();
-            spm.Event = logMessage;
-
-            fastJSON.JSONParameters param = new fastJSON.JSONParameters();
-            param.SerializeToLowerCaseNames = true;
-            param.UseExtensions = false;
-            string jsonContent = fastJSON.JSON.ToJSON(spm, param);
-
-            byte[] byteArray = Encoding.UTF8.GetBytes(jsonContent);
-
-            request.ContentLength = byteArray.Length;
-            request.ContentType = "application/x-www-form-urlencoded";
-
-            Stream dataStream = request.GetRequestStream();
-            dataStream.Write(byteArray, 0, byteArray.Length);
-            dataStream.Close();
-
-            // It's important to get the response, otherwise it won't send new requests.
-            WebResponse response = request.GetResponse();
-            response.Close();
+            messagesToSplunk.Enqueue(logMessage);
+            hasMessageToLog.Set();
         }

-        //protected override void CloseTarget()
-        //{
-        //    base.CloseTarget();
-        //}
+        protected override void CloseTarget()
+        {
+            isStopping = true;
+            stopSign.Set();
+
+            base.CloseTarget();
+
+            SplunkerThread.Join(5000);
+        }
     }
 }


入場者タイプ毎に識別してから、時間帯による入場料判定に処理を変更

入場者タイプ毎に識別してから、時間帯による入場料判定に処理を変更

--- WhyCleanCode/App2/MainClass.cs
+++ WhyCleanCode/App2/MainClass.cs
@@ -18,42 +18,31 @@
         /// <returns>入場料</returns>
         public int AdmissionFee(PersonType personType)
         {
-
             //時計を用意
             var clock=new Clock();

-            //夕方以降の場合
-            if (clock.IsEvening())
-            {
-                //夕方以外の場合
-                switch (personType)
-                {
-                    case PersonType.大人:
-                        return 700;
-                    case PersonType.学生:
-                        return 400;
-                    case PersonType.子供:
-                        return 200;
-                    default:
-                        //該当する入場者タイプが無い場合
-                        throw new ArgumentOutOfRangeException(nameof(personType), personType, null);
-                }
-            }
-
-
-            //夕方以外の場合
             switch (personType)
             {
                 case PersonType.大人:
+                    if (clock.IsEvening())
+                        return 700;  //夕方
                     return 1000;
+
                 case PersonType.学生:
+                    if (clock.IsEvening())
+                        return 400;  //夕方
                     return 700;
+
                 case PersonType.子供:
+                    if (clock.IsEvening())
+                        return 200;  //夕方
                     return 500;
+
                 default:
                     //該当する入場者タイプが無い場合
                     throw new ArgumentOutOfRangeException(nameof(personType), personType, null);
             }
+
         }
     }
 }


Automatically Change Cursor

Automatically Change Cursor

--- XwtPlus.TextEditor/TextArea.cs
+++ XwtPlus.TextEditor/TextArea.cs
@@ -18,6 +18,8 @@
         TextEditor editor;

         List<Margin> margins = new List<Margin>();
+        LineNumberMargin lineNumberMargin;
+        PaddingMargin paddingMargin;
         TextViewMargin textViewMargin;

         public TextArea(TextEditor editor)
@@ -26,10 +28,12 @@

             CanGetFocus = true;

+            lineNumberMargin = new LineNumberMargin(editor);
+            paddingMargin = new PaddingMargin(5);
             textViewMargin = new TextViewMargin(editor);

-            margins.Add(new LineNumberMargin(editor));
-            margins.Add(new PaddingMargin(5));
+            margins.Add(lineNumberMargin);
+            margins.Add(paddingMargin);
             margins.Add(textViewMargin);

             contextMenu = new Menu();
@@ -431,6 +435,11 @@
         {
             base.OnMouseMoved(args);

+            if (args.X >= textViewMargin.XOffset)
+                this.Cursor = CursorType.IBeam;
+            else
+                this.Cursor = CursorType.Arrow;
+
             NotifyTrackers(args.X, args.Y);
         }


It is better to lose a few characters in analytics than crash the game.

--- parts/0000-core/Assets/Vendor/GoogleAnalytics/FormExts.cs
+++ parts/0000-core/Assets/Vendor/GoogleAnalytics/FormExts.cs
@@ -8,8 +8,7 @@
       int maxLength = 0
     ) {
       if (value == null) return;
-      value.checkLength(argName, maxLength);
-      form.AddField(googleName, value);
+      form.AddField(googleName, fixLength(value, maxLength));
     }

     internal static void checkLength(
@@ -20,5 +19,10 @@
           $"length cannot exceed {maxLength} bytes, but it was {value.Length} bytes: {value}"
         ), argName);
     }
+
+    static string fixLength(string value, int maxLength) {
+      if (value.Length <= maxLength) return value;
+      return value.Substring(0, maxLength);
+    }
   }
 }


Add default server handler for unknown packet

--- Client/NetServer.cs
+++ Client/NetServer.cs
@@ -363,6 +363,10 @@
                                 pship.targets.Remove(targetid);
                             pship.changed |= ObjectProperty.Targets;
                             break;
+
+                        default:
+                            SDGame.Logger.LogError($"Server got unknown packet ({recv.GetID()}), client #{clientID}");
+                            break;
                     }

                 }


Update Program.cs

Update Program.cs

--- svg/Svg.Skia.Demo/Program.cs
+++ svg/Svg.Skia.Demo/Program.cs
@@ -32,24 +32,28 @@
                 }

                 var paths = new List<string>();
+                var output = default(string);

                 if (args[0] == "-f" && args.Length == 2)
                 {
                     paths.Add(args[1]);
                 }
-                else if (args[0] == "-d" && args.Length == 2)
-                {
-                    paths.AddRange(Directory.EnumerateFiles(".", args[1]));
-                }
-                else if (args[0] == "-d" && args.Length == 3)
+                else if (args[0] == "-d" && (args.Length == 3 || args.Length == 4))
                 {
                     paths.AddRange(Directory.EnumerateFiles(args[1], args[2]));
+
+                    if (args.Length == 4)
+                    {
+                        output = args[3];
+                    }
                 }
                 else
                 {
-                    Console.WriteLine($"Usage: SvgDemo -f <filename.svg>");
-                    Console.WriteLine($"       SvgDemo -d *.svg");
-                    Console.WriteLine($"       SvgDemo -d . *.svg");
+                    Console.WriteLine($"Usage: Svg.Skia.Demo -f <file.svg>");
+                    Console.WriteLine($"       Svg.Skia.Demo -d <indir> *.svg");
+                    Console.WriteLine($"       Svg.Skia.Demo -d <indir> *.svg <outdir>");
+                    Console.WriteLine($"       Svg.Skia.Demo -d . *.svg");
+                    Console.WriteLine($"       Svg.Skia.Demo -d . *.svg <outdir>");
                     return;
                 }

@@ -78,10 +82,19 @@
                         {
                             var yaml = svgDebug.Builder.ToString();
                             string ymlPath = path.Remove(path.Length - extension.Length) + ".yml";
+                            if (!string.IsNullOrEmpty(output))
+                            {
+                                ymlPath = Path.Combine(output, Path.GetFileName(ymlPath));
+                            }
                             File.WriteAllText(ymlPath, yaml);
                         }
 #endif
                         string pngPath = path.Remove(path.Length - extension.Length) + ".png";
+                        if (!string.IsNullOrEmpty(output))
+                        {
+                            pngPath = Path.Combine(output, Path.GetFileName(pngPath));
+                        }
+
                         SkiaSvgRenderer.SaveImage(svgDocument, pngPath, SKEncodedImageFormat.Png, 100, 1, 1);
                     }
                 }


Update Program.cs

Update Program.cs

--- svg/Svg.Skia.Demo/Program.cs
+++ svg/Svg.Skia.Demo/Program.cs
@@ -62,7 +62,7 @@
                     {
                         svgDocument.FlushStyles(true);

-                        var extension = Path.GetExtension(path).ToCharArray();
+                        var extension = Path.GetExtension(path);
 #if false
                         var svgDebug = new SvgDebug()
                         {


MultiThreadFlow: now supports default number of threads

--- src/x2net/Flows/MultiThreadFlow.cs
+++ src/x2net/Flows/MultiThreadFlow.cs
@@ -14,7 +14,11 @@
         : MultiThreadFlow<SynchronizedEventQueue>
 #endif
     {
+        public MultiThreadFlow() : base() { }
+
         public MultiThreadFlow(int numThreads) : base(numThreads) { }
+
+        public MultiThreadFlow(string name) : base(name) { }

         public MultiThreadFlow(string name, int numThreads) : base(name, numThreads) { }
     }
@@ -24,10 +28,20 @@
         protected List<Thread> threads;
         protected int numThreads;

+        public MultiThreadFlow()
+            : this(Environment.ProcessorCount)
+        {
+        }
+
         public MultiThreadFlow(int numThreads)
         {
             threads = new List<Thread>();
             this.numThreads = numThreads;
+        }
+
+        public MultiThreadFlow(string name)
+            : this(name, Environment.ProcessorCount)
+        {
         }

         public MultiThreadFlow(string name, int numThreads)


增补注释，优化代码

增补注释，优化代码

--- WebHost/PlayerHost.cs
+++ WebHost/PlayerHost.cs
@@ -101,13 +101,9 @@

-
-    protected override PlayerConsoleBase CreatePlayerConsole()
-    {
-      return new PlayerConsole( this );
-    }
-
-
+    /// <summary>
+    /// 覆写 Console 属性，返回强类型的玩家客户端对象
+    /// </summary>
     protected new PlayerConsole Console
     {
       get { return (PlayerConsole) base.Console; }


protect against misconfigured proxy in production

--- src/mikeandwan.us/Startup.cs
+++ src/mikeandwan.us/Startup.cs
@@ -28,7 +28,7 @@
 using Maw.Domain.Photos;
 using MawMvcApp.ViewModels;
 using MawMvcApp.ViewModels.About;
-
+using Microsoft.AspNetCore.Mvc;

 namespace MawMvcApp
 {
@@ -37,10 +37,13 @@
     public class Startup
     {
         readonly IConfiguration _config;
+        readonly IHostingEnvironment _env;

         public Startup(IHostingEnvironment hostingEnvironment)
         {
+            _env = hostingEnvironment;
+
             var builder = new ConfigurationBuilder()
                 .SetBasePath(hostingEnvironment.ContentRootPath)
                 .AddJsonFile("config.json")
@@ -64,10 +67,10 @@
                 .Configure<ContactConfig>(_config.GetSection("ContactUs"));

             services
-                .AddDbContext<BlogContext>(options => options.UseNpgsql(_config["Environment:DbConnectionString"]))
-                .AddDbContext<IdentityContext>(options => options.UseNpgsql(_config["Environment:DbConnectionString"]))
-                .AddDbContext<PhotoContext>(options => options.UseNpgsql(_config["Environment:DbConnectionString"]))
-                .AddDbContext<VideoContext>(options => options.UseNpgsql(_config["Environment:DbConnectionString"]));
+                .AddDbContext<BlogContext>(opts => opts.UseNpgsql(_config["Environment:DbConnectionString"]))
+                .AddDbContext<IdentityContext>(opts => opts.UseNpgsql(_config["Environment:DbConnectionString"]))
+                .AddDbContext<PhotoContext>(opts => opts.UseNpgsql(_config["Environment:DbConnectionString"]))
+                .AddDbContext<VideoContext>(opts => opts.UseNpgsql(_config["Environment:DbConnectionString"]));

             services
                 .AddScoped<IFileProvider>(x => new PhysicalFileProvider(_config["Environment:AssetsPath"]))
@@ -81,7 +84,7 @@
                 .AddScoped<IUserStore<MawUser>, MawUserStore>()
                 .AddScoped<IRoleStore<MawRole>, MawRoleStore>();

-            services.AddAntiforgery(options => options.HeaderName = "X-XSRF-TOKEN");
+            services.AddAntiforgery(opts => opts.HeaderName = "X-XSRF-TOKEN");

             services.AddLogging();

@@ -112,13 +115,20 @@
                     opts.AddPolicy(MawConstants.POLICY_ADMIN_SITE, new AuthorizationPolicyBuilder().RequireRole(MawConstants.ROLE_ADMIN).Build());
                 });

-            services.AddMvc();
+            services.AddMvc(opts =>
+                {
+                    if(_env.IsProduction())
+                    {
+                        // this should already be set in nginx, but this protects us if that is misconfigured
+                        opts.Filters.Add(new RequireHttpsAttribute());
+                    }
+                });
         }

-        public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
+        public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory)
         {
-            if (env.IsDevelopment())
+            if (_env.IsDevelopment())
             {
                 loggerFactory.AddConsole();

@@ -130,7 +140,7 @@
             else
             {
                 app.AddNLogWeb();
-                env.ConfigureNLog("nlog.config");
+                _env.ConfigureNLog("nlog.config");

                 app.UseExceptionHandler("/error/");
             }


Remove unneeded items before PR.

Remove unneeded items before PR.

--- src/double/Edge.js/dotnet/EdgeJs.cs
+++ src/double/Edge.js/dotnet/EdgeJs.cs
@@ -7,9 +7,6 @@
 using System.Threading;
 using System.Threading.Tasks;

-#if DOTNETVERSION
-[assembly:AssemblyVersionAttribute("8.9.3.0")]
-#endif
 namespace EdgeJs
 {
     public class Edge


Implement IDisposable on SctWriter

Implement IDisposable on SctWriter

--- TAUtil/Sct/SctWriter.cs
+++ TAUtil/Sct/SctWriter.cs
@@ -1,10 +1,11 @@
 namespace TAUtil.Sct
 {
+    using System;
     using System.IO;

     using TAUtil.Tnt;

-    public class SctWriter
+    public class SctWriter : IDisposable
     {
         private readonly BinaryWriter writer;

@@ -43,6 +44,20 @@
             this.WriteMinimap(adapter);
         }

+        public void Dispose()
+        {
+            this.Dispose(true);
+            GC.SuppressFinalize(this);
+        }
+
+        protected virtual void Dispose(bool disposing)
+        {
+            if (disposing)
+            {
+                this.writer.Dispose();
+            }
+        }
+
         private void WriteMinimap(ISctSource adapter)
         {
             this.writer.Write(adapter.GetMinimap());


Revert "ignore tests that are not passing in build server"

This reverts commit 1451a3c3b80ff56969f20327e4e588f6874950a0.

--- test/CodeCracker.Test/ConvertToSwitchTests.cs
+++ test/CodeCracker.Test/ConvertToSwitchTests.cs
@@ -271,7 +271,7 @@
         }

-        [Fact(Skip = "Failing in build server.")]
+        [Fact]
         public async Task FixReplacesNestedIfsWithSwitch()
         {
             const string test = @"
@@ -326,7 +326,7 @@
             await VerifyCSharpFixAsync(test, expected, formatBeforeCompare: false);
         }

-        [Fact(Skip = "Failing in build server.")]
+        [Fact]
         public async Task FixReplacesNestedIfsWithSwitchWithDefaultCaseWhenElseIsUsed()
         {
             const string test = @"
@@ -390,7 +390,7 @@
             await VerifyCSharpFixAsync(test, expected, formatBeforeCompare: false);
         }

-        [Fact(Skip = "Failing in build server.")]
+        [Fact]
         public async Task FixDoesNotUsesBreakWhenSwitchSectionReturns()
         {
             const string test = @"


clear child comment

clear child comment

--- test/Pigeon.Tests/Actor/ActorLifeCycleSpec.cs
+++ test/Pigeon.Tests/Actor/ActorLifeCycleSpec.cs
@@ -356,6 +356,10 @@
             expectMsg(2);
             supervisor.Tell(new SupervisorTestActor.ContextStop() { Name = names[1] });
             expectMsg(Tuple.Create("Terminated", names[1]));
+
+            //we need to wait for the child actor to unregister itself from the parent.
+            //this is done after PostStop so we have no way to wait for it
+            //ideas?
             Task.Delay(100).Wait();
             supervisor.Tell(new SupervisorTestActor.Count());
             expectMsg(1);


assetInfo: make addAttribute chainable

assetInfo: make addAttribute chainable

--- Dashen/AssetInfo.cs
+++ Dashen/AssetInfo.cs
@@ -22,9 +22,10 @@
 			_tag = new Lazy<string>(BuildTag);
 		}

-		public void AddAttribute(string name, string value)
+		public AssetInfo AddAttribute(string name, string value)
 		{
 			_attributes[name] = value;
+			return this;
 		}

 		private string BuildTag()


Update code documentation

Update code documentation

--- src/kafka-net/Protocol/Protocol.cs
+++ src/kafka-net/Protocol/Protocol.cs
@@ -4,7 +4,9 @@

 namespace KafkaNet.Protocol
 {
-
+    /// <summary>
+    /// Extension methods which allow compression of byte arrays
+    /// </summary>
     public static class Compression
     {
         public static byte[] Zip(byte[] bytes)
@@ -33,45 +35,125 @@
         }
     }

+    /// <summary>
+    /// Enumeration of numeric codes that the ApiKey in the request can take for each request types.
+    /// </summary>
     public enum ApiKeyRequestType
     {
         Produce = 0,
         Fetch = 1,
         Offset = 2,
         MetaData = 3,
-        LeaderAndIsr = 4,
-        StopReplica = 5,
         OffsetCommit = 8,
         OffsetFetch = 9,
         ConsumerMetadataRequest = 10
     }

-    public enum ErrorResponseCode
-    {
+    /// <summary>
+    /// Enumeration of error codes that might be returned from a Kafka server
+    /// </summary>
+    public enum ErrorResponseCode : short
+    {
+        /// <summary>
+        /// No error--it worked!
+        /// </summary>
         NoError = 0,
+
+        /// <summary>
+        /// An unexpected server error
+        /// </summary>
         Unknown = -1,
+
+        /// <summary>
+        /// The requested offset is outside the range of offsets maintained by the server for the given topic/partition.
+        /// </summary>
         OffsetOutOfRange = 1,
+
+        /// <summary>
+        /// This indicates that a message contents does not match its CRC
+        /// </summary>
         InvalidMessage = 2,
+
+        /// <summary>
+        /// This request is for a topic or partition that does not exist on this broker.
+        /// </summary>
         UnknownTopicOrPartition = 3,
+
+        /// <summary>
+        /// The message has a negative size
+        /// </summary>
         InvalidMessageSize = 4,
+
+        /// <summary>
+        /// This error is thrown if we are in the middle of a leadership election and there is currently no leader for this partition and hence it is unavailable for writes.
+        /// </summary>
         LeaderNotAvailable = 5,
+
+        /// <summary>
+        /// This error is thrown if the client attempts to send messages to a replica that is not the leader for some partition. It indicates that the clients metadata is out of date.
+        /// </summary>
         NotLeaderForPartition = 6,
+
+        /// <summary>
+        /// This error is thrown if the request exceeds the user-specified time limit in the request.
+        /// </summary>
         RequestTimedOut = 7,
+
+        /// <summary>
+        /// This is not a client facing error and is used only internally by intra-cluster broker communication.
+        /// </summary>
         BrokerNotAvailable = 8,
+
+        /// <summary>
+        /// If replica is expected on a broker, but is not.
+        /// </summary>
         ReplicaNotAvailable = 9,
+
+        /// <summary>
+        /// The server has a configurable maximum message size to avoid unbounded memory allocation. This error is thrown if the client attempt to produce a message larger than this maximum.
+        /// </summary>
         MessageSizeTooLarge = 10,
+
+        /// <summary>
+        /// Internal error code for broker-to-broker communication.
+        /// </summary>
         StaleControllerEpochCode = 11,
+
+        /// <summary>
+        /// If you specify a string larger than configured maximum for offset metadata
+        /// </summary>
         OffsetMetadataTooLargeCode = 12,
+
+        /// <summary>
+        /// The broker returns this error code for an offset fetch request if it is still loading offsets (after a leader change for that offsets topic partition).
+        /// </summary>
         OffsetsLoadInProgressCode = 14,
+
+        /// <summary>
+        /// The broker returns this error code for consumer metadata requests or offset commit requests if the offsets topic has not yet been created.
+        /// </summary>
         ConsumerCoordinatorNotAvailableCode = 15,
+
+        /// <summary>
+        /// The broker returns this error code if it receives an offset fetch or commit request for a consumer group that it is not a coordinator for.
+        /// </summary>
         NotCoordinatorForConsumerCode = 16
     }
-
+
+    /// <summary>
+    /// Protocol specific constants
+    /// </summary>
     public struct ProtocolConstants
     {
+        /// <summary>
+        ///  The lowest 2 bits contain the compression codec used for the message. The other bits should be set to 0.
+        /// </summary>
         public static byte AttributeCodeMask = 0x03;
     }

+    /// <summary>
+    /// Enumeration which specifies the compression type of messages
+    /// </summary>
     public enum MessageCodec
     {
         CodecNone = 0x00,


Remove debug logs.

Remove debug logs.

--- Davenport/Client.cs
+++ Davenport/Client.cs
@@ -67,8 +67,6 @@
                     throw ex;
                 }

-                Console.WriteLine(rawBody);
-
                 return JsonConvert.DeserializeObject<T>(rawBody);
             }
         }


JimEvans: Removing accidentally checked-in code.

r11270

--- dotnet/test/WebDriver.Firefox.Tests/FirefoxDriverTest.cs
+++ dotnet/test/WebDriver.Firefox.Tests/FirefoxDriverTest.cs
@@ -266,17 +266,5 @@
                 Assert.Fail("Interrupted");
             }
         }
-
-        [Test]
-        public void TestBasicFunc()
-        {
-            driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5));
-            driver.Url = "http://www.google.com/webhp?hl=en&as_qdr=all";
-            IWebElement e = driver.FindElement(By.Name("q"));
-            e.Click();
-            IWebElement e2 = driver.FindElement(By.Name("btnG"));
-            e2.Click();
-            driver.FindElement(By.ClassName("hd"));
-        }
     }
 }


Added IgnoreResult task extension

Added IgnoreResult task extension

--- Tasks/TaskExtensions.cs
+++ Tasks/TaskExtensions.cs
@@ -63,5 +63,13 @@
         {
             return task.ContinueWith(t => t.GetAwaiter().GetResult(), token);
         }
+
+        /// <summary>
+        /// Executes a task and ignores the result.
+        /// </summary>
+        /// <param name="task">The task to execute.</param>
+        public static void IgnoreResult(this Task task)
+        {
+        }
     }
 }


Renamed ChangeAdminPassword to ChangeUserDetails and updated ChangeUserDetails Functionality

--- TemplateMod/Commands.cs
+++ TemplateMod/Commands.cs
@@ -266,10 +266,12 @@

             return false;
         }
-        public static bool ChangeAdminPassword(Hacknet.OS os, string[] args)
-        {
-            Computer computer = os.connectedComp;
-            string newPass = args[1];
+        public static bool ChangeUserDetails(Hacknet.OS os, string[] args)
+        {
+            Computer computer = os.connectedComp;
+            string oldUser = args[1];
+            string newUser = args[2];
+            string newPass = args[3];
             if (args.Length < 0)
             {
                 os.write("Usage: changeAdminPassword (NewPassword)");
@@ -277,8 +279,8 @@
             }
             for (int index = 0; index < computer.users.Count; ++index)
             {
-                if (computer.users[index].name.ToLower().Equals("admin"))
-                    computer.users[index] = new UserDetail("admin", newPass, (byte)0);
+                if (computer.users[index].name.ToLower().Equals(oldUser))
+                    computer.users[index] = new UserDetail(newUser, newPass, (byte)0);
             }
             return false;
         }


Added missing test for Force units in UnitValueTests.cs.

--- Tests/UnitValueTests.cs
+++ Tests/UnitValueTests.cs
@@ -10,10 +10,11 @@
         {
             double newValue;
             Assert.False(new UnitValue(1, Unit.Meter).TryConvert(Unit.Second, out newValue));
-            Assert.False(new UnitValue(1, Unit.Kilogram).TryConvert(Unit.Second, out newValue));
-            Assert.False(new UnitValue(1, Unit.Pascal).TryConvert(Unit.Second, out newValue));
             Assert.False(new UnitValue(1, Unit.SquareMeter).TryConvert(Unit.Second, out newValue));
             Assert.False(new UnitValue(1, Unit.CubicMeter).TryConvert(Unit.Second, out newValue));
+            Assert.False(new UnitValue(1, Unit.Newton).TryConvert(Unit.Second, out newValue));
+            Assert.False(new UnitValue(1, Unit.Pascal).TryConvert(Unit.Second, out newValue));
+            Assert.False(new UnitValue(1, Unit.Kilogram).TryConvert(Unit.Second, out newValue));
             Assert.False(new UnitValue(1, Unit.Degree).TryConvert(Unit.Second, out newValue));
         }
     }


Spelling correction

Spelling correction

--- DynaShape/Triple.cs
+++ DynaShape/Triple.cs
@@ -115,7 +115,7 @@

         public Triple TryGeneratePerpendicular()
         {
-            if (X == 0f && Y == 0f && Z == 0f) throw new Exception("Cannot genernate perpendicular vector for a zero vector");
+            if (X == 0f && Y == 0f && Z == 0f) throw new Exception("Cannot generate a perpendicular vector for a zero vector");
             return
                 Math.Abs(X) < Math.Abs(Y)
                     ? Math.Abs(X) < Math.Abs(Z)


Edit program cs

Edit program cs

--- TwitterStream/Program.cs
+++ TwitterStream/Program.cs
@@ -8,21 +8,21 @@
     {
         static void Main(string[] args)
         {
-            //using (var context = new TwitterStreamContext())
-            //{
-            //    TwitterStream stream = new TwitterStream(context);
+            using (var context = new TwitterStreamContext())
+            {
+                TwitterStream stream = new TwitterStream(context);

-            //    try
-            //    {
-            //        stream.Start();
-            //    }
-            //    catch (WebException ex)
-            //    {
-            //        Console.WriteLine("***HATA ALINDI ***: " + ex.Message + "\n\n");
+                try
+                {
+                    stream.Start();
+                }
+                catch (WebException ex)
+                {
+                    Console.WriteLine("***HATA ALINDI ***: " + ex.Message + "\n\n");

-            //        stream.InsertError(ex);
-            //    }
-            //}
+                    stream.InsertError(ex);
+                }
+            }
         }
     }
 }


Add test for bit parameters

Add test for bit parameters

--- tests/MiniProfiler.Tests/SqlFormatterTests.cs
+++ tests/MiniProfiler.Tests/SqlFormatterTests.cs
@@ -219,6 +219,24 @@

         [Theory]
         [MemberData(nameof(GetParamPrefixes))]
+        public void TableQueryWithBit(string at)
+        {
+            // arrange
+            _commandText = "select 1 from dbo.Table where x = @x, y = @y";
+            const string expectedOutput = "DECLARE @x bit = 1,\r\n        @y bit = null;\r\n\r\nselect 1 from dbo.Table where x = @x, y = @y;";
+            CreateDbCommand(CommandType.Text);
+            AddDbParameter<bool?>(at + "x", true, type: DbType.Boolean);
+            AddDbParameter<bool?>(at + "y", null, type: DbType.Boolean);
+
+            // act
+            var actualOutput = GenerateOutput();
+
+            // assert
+            Assert.Equal(expectedOutput, actualOutput);
+        }
+
+        [Theory]
+        [MemberData(nameof(GetParamPrefixes))]
         public void TableQueryWithVarchar(string at)
         {
             // arrange


Add documentation to Reset()

Add documentation to Reset()


Update tests

Update tests

--- osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs
+++ osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs
@@ -2,6 +2,7 @@
 // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

 using System;
+using System.IO;
 using System.Collections.Generic;
 using System.Linq;
 using System.Threading;
@@ -40,8 +41,16 @@
             using (HeadlessGameHost host = new HeadlessGameHost())
             {
                 var osu = loadOsu(host);
-                osu.Dependencies.Get<BeatmapDatabase>().Import(osz_path);
+
+                var temp = prepareTempCopy(osz_path);
+
+                Assert.IsTrue(File.Exists(temp));
+
+                osu.Dependencies.Get<BeatmapDatabase>().Import(temp);
+
                 ensureLoaded(osu);
+
+                Assert.IsFalse(File.Exists(temp));
             }
         }

@@ -56,12 +65,24 @@

                 var osu = loadOsu(host);

+                var temp = prepareTempCopy(osz_path);
+
+                Assert.IsTrue(File.Exists(temp));
+
                 var importer = new BeatmapImporter(client);
-                if (!importer.ImportAsync(osz_path).Wait(1000))
+                if (!importer.ImportAsync(temp).Wait(1000))
                     Assert.Fail(@"IPC took too long to send");

                 ensureLoaded(osu);
+
+                Assert.IsFalse(File.Exists(temp));
             }
+        }
+
+        private string prepareTempCopy(string path)
+        {
+            var temp = Path.GetTempFileName();
+            return new FileInfo(osz_path).CopyTo(temp, true).FullName;
         }

         private OsuGameBase loadOsu(GameHost host)


Revert back to `private set`

Revert back to `private set`

Co-authored-by: Salman Ahmed <a7afa2b28823372a757eb860a4c7da8b68c3cb44@gmail.com>

--- osu.Game/Graphics/UserInterface/OsuSliderBar.cs
+++ osu.Game/Graphics/UserInterface/OsuSliderBar.cs
@@ -40,7 +40,7 @@
         private readonly Box rightBox;
         private readonly Container nubContainer;

-        public virtual LocalisableString TooltipText { get; protected set; }
+        public virtual LocalisableString TooltipText { get; private set; }

         /// <summary>
         /// Whether to format the tooltip as a percentage or the actual value.


add back update in onUserChange

add back update in onUserChange

--- osu.Game/Graphics/UserInterface/OsuSliderBar.cs
+++ osu.Game/Graphics/UserInterface/OsuSliderBar.cs
@@ -127,6 +127,7 @@
         {
             base.OnUserChange(value);
             playSample(value);
+            updateTooltipText(value);
         }

         private void playSample(T value)


Localise rankings Spotlight selector.

Localise rankings Spotlight selector.

--- osu.Game/Overlays/Rankings/SpotlightSelector.cs
+++ osu.Game/Overlays/Rankings/SpotlightSelector.cs
@@ -16,6 +16,8 @@
 using osu.Framework.Graphics.UserInterface;
 using osu.Game.Online.API.Requests;
 using osu.Framework.Extensions.Color4Extensions;
+using osu.Framework.Localisation;
+using osu.Game.Resources.Localisation.Web;

 namespace osu.Game.Overlays.Rankings
 {
@@ -92,10 +94,10 @@
                                         Margin = new MarginPadding { Bottom = 5 },
                                         Children = new Drawable[]
                                         {
-                                            startDateColumn = new InfoColumn(@"Start Date"),
-                                            endDateColumn = new InfoColumn(@"End Date"),
-                                            mapCountColumn = new InfoColumn(@"Map Count"),
-                                            participantsColumn = new InfoColumn(@"Participants")
+                                            startDateColumn = new InfoColumn(RankingsStrings.SpotlightStartDate),
+                                            endDateColumn = new InfoColumn(RankingsStrings.SpotlightEndDate),
+                                            mapCountColumn = new InfoColumn(RankingsStrings.SpotlightMapCount),
+                                            participantsColumn = new InfoColumn(RankingsStrings.SpotlightParticipants)
                                         }
                                     },
                                     new RankingsSortTabControl
@@ -123,21 +125,21 @@
             startDateColumn.Value = dateToString(response.Spotlight.StartDate);
             endDateColumn.Value = dateToString(response.Spotlight.EndDate);
             mapCountColumn.Value = response.BeatmapSets.Count.ToString();
-            participantsColumn.Value = response.Spotlight.Participants?.ToString("N0");
-        }
-
-        private string dateToString(DateTimeOffset date) => date.ToString("yyyy-MM-dd");
+            participantsColumn.Value = response.Spotlight.Participants?.ToLocalisableString("N0");
+        }
+
+        private LocalisableString dateToString(DateTimeOffset date) => date.ToLocalisableString("yyyy-MM-dd");

         private class InfoColumn : FillFlowContainer
         {
-            public string Value
+            public LocalisableString Value
             {
                 set => valueText.Text = value;
             }

             private readonly OsuSpriteText valueText;

-            public InfoColumn(string name)
+            public InfoColumn(LocalisableString name)
             {
                 AutoSizeAxes = Axes.Both;
                 Direction = FillDirection.Vertical;


Allow attaching a replay to a FrameStabilityContainer when FrameStablePlayback is off

--- osu.Game/Rulesets/UI/FrameStabilityContainer.cs
+++ osu.Game/Rulesets/UI/FrameStabilityContainer.cs
@@ -123,39 +123,63 @@

             try
             {
-                if (!FrameStablePlayback)
-                    return;
-
-                if (firstConsumption)
+                if (FrameStablePlayback)
                 {
-                    // On the first update, frame-stability seeking would result in unexpected/unwanted behaviour.
-                    // Instead we perform an initial seek to the proposed time.
-
-                    // process frame (in addition to finally clause) to clear out ElapsedTime
-                    manualClock.CurrentTime = newProposedTime;
-                    framedClock.ProcessFrame();
-
-                    firstConsumption = false;
-                }
-                else if (manualClock.CurrentTime < gameplayStartTime)
-                    manualClock.CurrentTime = newProposedTime = Math.Min(gameplayStartTime, newProposedTime);
-                else if (Math.Abs(manualClock.CurrentTime - newProposedTime) > sixty_frame_time * 1.2f)
-                {
-                    newProposedTime = newProposedTime > manualClock.CurrentTime
-                        ? Math.Min(newProposedTime, manualClock.CurrentTime + sixty_frame_time)
-                        : Math.Max(newProposedTime, manualClock.CurrentTime - sixty_frame_time);
+                    if (firstConsumption)
+                    {
+                        // On the first update, frame-stability seeking would result in unexpected/unwanted behaviour.
+                        // Instead we perform an initial seek to the proposed time.
+
+                        // process frame (in addition to finally clause) to clear out ElapsedTime
+                        manualClock.CurrentTime = newProposedTime;
+                        framedClock.ProcessFrame();
+
+                        firstConsumption = false;
+                    }
+                    else if (manualClock.CurrentTime < gameplayStartTime)
+                        manualClock.CurrentTime = newProposedTime = Math.Min(gameplayStartTime, newProposedTime);
+                    else if (Math.Abs(manualClock.CurrentTime - newProposedTime) > sixty_frame_time * 1.2f)
+                    {
+                        newProposedTime = newProposedTime > manualClock.CurrentTime
+                            ? Math.Min(newProposedTime, manualClock.CurrentTime + sixty_frame_time)
+                            : Math.Max(newProposedTime, manualClock.CurrentTime - sixty_frame_time);
+                    }
                 }

                 if (isAttached)
                 {
-                    double? newTime = ReplayInputHandler.SetFrameFromTime(newProposedTime);
-
-                    if (newTime == null)
-                    {
-                        // we shouldn't execute for this time value. probably waiting on more replay data.
-                        validState = false;
-                        requireMoreUpdateLoops = true;
-                        return;
+                    double? newTime;
+
+                    if (FrameStablePlayback)
+                    {
+                        // when stability is turned on, we shouldn't execute for time values the replay is unable to satisfy.
+                        if ((newTime = ReplayInputHandler.SetFrameFromTime(newProposedTime)) == null)
+                        {
+                            // setting invalid state here ensures that gameplay will not continue (ie. our child
+                            // hierarchy won't be updated).
+                            validState = false;
+
+                            // potentially loop to catch-up playback.
+                            requireMoreUpdateLoops = true;
+
+                            return;
+                        }
+                    }
+                    else
+                    {
+                        // when stability is disabled, we don't really care about accuracy.
+                        // looping over the replay will allow it to catch up and feed out the required values
+                        // for the current time.
+                        while ((newTime = ReplayInputHandler.SetFrameFromTime(newProposedTime)) != newProposedTime)
+                        {
+                            if (newTime == null)
+                            {
+                                // special case for when the replay actually can't arrive at the required time.
+                                // protects from potential endless loop.
+                                validState = false;
+                                return;
+                            }
+                        }
                     }

                     newProposedTime = newTime.Value;


Move initial state set inside updateClock

--- osu.Game/Rulesets/UI/FrameStabilityContainer.cs
+++ osu.Game/Rulesets/UI/FrameStabilityContainer.cs
@@ -85,22 +85,6 @@

         public override bool UpdateSubTree()
         {
-            if (frameStableClock.WaitingOnFrames.Value)
-            {
-                // waiting on frames is a special case where we want to avoid doing any update propagation, unless new frame data has arrived.
-                state = PlaybackState.Valid;
-            }
-            else if (!frameStableClock.IsPaused.Value)
-            {
-                state = PlaybackState.Valid;
-            }
-            else
-            {
-                // time should not advance while paused, nor should anything run.
-                state = PlaybackState.NotValid;
-                return true;
-            }
-
             int loops = MaxCatchUpFrames;

             do
@@ -121,13 +105,26 @@

         private void updateClock()
         {
+            if (frameStableClock.WaitingOnFrames.Value)
+            {
+                // if waiting on frames, run one update loop to determine if frames have arrived.
+                state = PlaybackState.Valid;
+            }
+            else if (frameStableClock.IsPaused.Value)
+            {
+                // time should not advance while paused, nor should anything run.
+                state = PlaybackState.NotValid;
+                return;
+            }
+            else
+            {
+                state = PlaybackState.Valid;
+            }
+
             if (parentGameplayClock == null)
                 setClock(); // LoadComplete may not be run yet, but we still want the clock.

             double proposedTime = parentGameplayClock.CurrentTime;
-
-            // each update start with considering things in valid state.
-            state = PlaybackState.Valid;

             if (FrameStablePlayback)
                 // if we require frame stability, the proposed time will be adjusted to move at most one known


Fixed some glitches here and there in the contracts.

--- URandomGen/RandomGen.cs
+++ URandomGen/RandomGen.cs
@@ -179,7 +179,7 @@
                 base.Next(minValue, maxValue); //Throw ArgumentOutOfRangeException according to default form.
 #if !NOCONTRACT
             Contract.Ensures(Contract.Result<int>() >= minValue);
-            Contract.Ensures(Contract.Result<int>() < maxValue);
+            Contract.Ensures(maxValue == minValue || Contract.Result<int>() < maxValue);
             Contract.EndContractBlock();
 #endif
             long length = maxValue - (long)minValue;
@@ -201,7 +201,7 @@
                 base.Next(maxValue); //Throw ArgumentOutOfRangeException according to default form.
 #if !NOCONTRACT
             Contract.Ensures(Contract.Result<int>() >= 0);
-            Contract.Ensures(Contract.Result<int>() < maxValue);
+            Contract.Ensures(maxValue == 0 || Contract.Result<int>() < maxValue);
             Contract.EndContractBlock();
 #endif
             return (int)_sampleValue(this, maxValue);
@@ -232,7 +232,7 @@
                 base.Next(1, 0); //Throw ArgumentOutOfRangeException according to default form.
 #if !NOCONTRACT
             Contract.Ensures(Contract.Result<uint>() >= minValue);
-            Contract.Ensures(Contract.Result<uint>() < maxValue);
+            Contract.Ensures(maxValue == minValue || Contract.Result<uint>() < maxValue);
             Contract.EndContractBlock();
 #endif
             long length = maxValue - (long)minValue;
@@ -252,7 +252,7 @@
         {
 #if !NOCONTRACT
             Contract.Ensures(Contract.Result<uint>() >= 0);
-            Contract.Ensures(Contract.Result<uint>() < maxValue);
+            Contract.Ensures(maxValue == 0 || Contract.Result<uint>() < maxValue);
             Contract.EndContractBlock();
 #endif
             return (uint)_sampleValue(this, maxValue);
@@ -306,7 +306,7 @@
                 generator.Next(1, 0); //Throw ArgumentOutOfRangeException according to default form.
 #if !NOCONTRACT
             Contract.Ensures(Contract.Result<uint>() >= minValue);
-            Contract.Ensures(Contract.Result<uint>() < maxValue);
+            Contract.Ensures(maxValue == minValue || Contract.Result<uint>() < maxValue);
             Contract.EndContractBlock();
 #endif
             return _nextUInt32(generator, minValue, maxValue);
@@ -331,7 +331,7 @@
                 generator.Next(-1); //Throw ArgumentOutOfRangeException according to default form.
 #if !NOCONTRACT
             Contract.Ensures(Contract.Result<uint>() >= 0);
-            Contract.Ensures(Contract.Result<uint>() < maxValue);
+            Contract.Ensures(maxValue == 0 || Contract.Result<uint>() < maxValue);
             Contract.EndContractBlock();
 #endif
             return _nextUInt32(generator, 0, maxValue);
@@ -401,7 +401,7 @@
                 base.Next(1, 0); //Throw ArgumentOutOfRangeException according to default form.
 #if !NOCONTRACT
             Contract.Ensures(Contract.Result<long>() >= minValue);
-            Contract.Ensures(Contract.Result<long>() < maxValue);
+            Contract.Ensures(maxValue == minValue || Contract.Result<long>() < maxValue);
             Contract.EndContractBlock();
 #endif
             decimal length = (decimal)maxValue - minValue;
@@ -423,7 +423,7 @@
                 base.Next(-1); //Throw ArgumentOutOfRangeException according to default form.
 #if !NOCONTRACT
             Contract.Ensures(Contract.Result<long>() >= 0);
-            Contract.Ensures(Contract.Result<long>() < maxValue);
+            Contract.Ensures(maxValue == 0 || Contract.Result<long>() < maxValue);
             Contract.EndContractBlock();
 #endif
             return (long)_sampleValue(this, (decimal)maxValue);
@@ -457,7 +457,7 @@
                 generator.Next(1, 0); //Throw ArgumentOutOfRangeException according to default form.
 #if !NOCONTRACT
             Contract.Ensures(Contract.Result<long>() >= minValue);
-            Contract.Ensures(Contract.Result<long>() < maxValue);
+            Contract.Ensures(maxValue == minValue || Contract.Result<long>() < maxValue);
             Contract.EndContractBlock();
 #endif
             return (long)_next64(generator, minValue, maxValue);
@@ -481,7 +481,7 @@
                 generator.Next(-1); //Throw ArgumentOutOfRangeException according to default form.
 #if !NOCONTRACT
             Contract.Ensures(Contract.Result<long>() >= 0);
-            Contract.Ensures(Contract.Result<long>() < maxValue);
+            Contract.Ensures(maxValue == 0 || Contract.Result<long>() < maxValue);
             Contract.EndContractBlock();
 #endif
             return (long)_next64(generator, 0, maxValue);
@@ -516,7 +516,7 @@
                 base.Next(1, 0); //Throw ArgumentOutOfRangeException according to default form.
 #if !NOCONTRACT
             Contract.Ensures(Contract.Result<ulong>() >= minValue);
-            Contract.Ensures(Contract.Result<ulong>() < maxValue);
+            Contract.Ensures(maxValue == minValue || Contract.Result<ulong>() < maxValue);
             Contract.EndContractBlock();
 #endif
             decimal length = (decimal)maxValue - minValue;
@@ -536,7 +536,7 @@
         {
 #if !NOCONTRACT
             Contract.Ensures(Contract.Result<ulong>() >= 0);
-            Contract.Ensures(Contract.Result<ulong>() < maxValue);
+            Contract.Ensures(maxValue == 0 || Contract.Result<ulong>() < maxValue);
             Contract.EndContractBlock();
 #endif
             return (ulong)_sampleValue(this, (decimal)maxValue);
@@ -570,7 +570,7 @@
                 generator.Next(1, 0); //Throw ArgumentOutOfRangeException according to default form.
 #if !NOCONTRACT
             Contract.Ensures(Contract.Result<ulong>() >= minValue);
-            Contract.Ensures(Contract.Result<ulong>() < maxValue);
+            Contract.Ensures(maxValue == minValue || Contract.Result<ulong>() < maxValue);
             Contract.EndContractBlock();
 #endif
             return (ulong)_next64(generator, minValue, maxValue);
@@ -594,7 +594,7 @@
                 generator.Next(-1); //Throw ArgumentOutOfRangeException according to default form.
 #if !NOCONTRACT
             Contract.Ensures(Contract.Result<ulong>() >= 0);
-            Contract.Ensures(Contract.Result<ulong>() < maxValue);
+            Contract.Ensures(maxValue == 0 || Contract.Result<ulong>() < maxValue);
             Contract.EndContractBlock();
 #endif
             var value = _next64(generator, 0, maxValue);
@@ -725,7 +725,7 @@
             if (generator == null) throw new ArgumentNullException("generator");
             if (collection == null) throw new ArgumentNullException("collection");
 #if !NOCONTRACT
-            Contract.Ensures(Contract.Result<List<T>>() != null);
+            Contract.Ensures(Contract.Result<T[]>() != null);
             Contract.EndContractBlock();
 #endif
             int count;


Convert tabs to spaces

Convert tabs to spaces

--- Vector3IntExtensions.cs
+++ Vector3IntExtensions.cs
@@ -15,11 +15,11 @@
         /// <returns>Vector3 struct.</returns>
         public static Vector3 ToVector3(this Vector3Int vector)
         {
-			return new Vector3(
-				Convert.ToSingle(vector.x),
-				Convert.ToSingle(vector.y),
-				Convert.ToSingle(vector.z)
-			);
+            return new Vector3(
+                Convert.ToSingle(vector.x),
+                Convert.ToSingle(vector.y),
+                Convert.ToSingle(vector.z)
+            );
         }
     }
 }


Make IJavaScriptRuntimeExtensions public

--- src/BaristaLabs.BaristaCore.Common/JavaScript/Extensions/IJavaScriptRuntimeExtensions.cs
+++ src/BaristaLabs.BaristaCore.Common/JavaScript/Extensions/IJavaScriptRuntimeExtensions.cs
@@ -5,7 +5,7 @@
     using System.Runtime.InteropServices;
     using System.Threading.Tasks;

-    internal static class IJavaScriptRuntimeExtensions
+    public static class IJavaScriptRuntimeExtensions
     {
         private const string EvalSourceUrl = "[eval code]";


Check if eventargs is null

Check if eventargs is null

--- src/Core/Managed/Shared/Extensibility/Implementation/Tracing/DiagnosticsEventListener.cs
+++ src/Core/Managed/Shared/Extensibility/Implementation/Tracing/DiagnosticsEventListener.cs
@@ -23,8 +23,13 @@

         protected override void OnEventWritten(EventWrittenEventArgs eventSourceEvent)
         {
+            if (eventSourceEvent == null)
+            {
+                return;
+            }
+
             var metadata = new EventMetaData
-            {
+            {
                 Keywords = (long)eventSourceEvent.Keywords,
                 MessageFormat = eventSourceEvent.Message,
                 EventId = eventSourceEvent.EventId,


Add null check.

Add null check.

--- src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.IncrementalAnalyzerProcessor.cs
+++ src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.IncrementalAnalyzerProcessor.cs
@@ -194,6 +194,11 @@
                         }

                         var local = analyzer;
+                        if (local == null)
+                        {
+                            return;
+                        }
+
                         await GetOrDefaultAsync(value, async (v, c) =>
                         {
                             await runnerAsync(local, v, c).ConfigureAwait(false);


Expose short TFM when examining supported fxs

--- src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetSupportedPackagesFromPackageReports.cs
+++ src/Microsoft.DotNet.Build.Tasks.Packaging/src/GetSupportedPackagesFromPackageReports.cs
@@ -5,6 +5,7 @@
 using Microsoft.Build.Framework;
 using Microsoft.Build.Utilities;
 using Newtonsoft.Json;
+using NuGet.Frameworks;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -35,10 +36,12 @@
                 {
                     var fx = fxRIDGrouping.Key;
                     var rids = fxRIDGrouping.ToArray();
+                    var nugetFx = NuGetFramework.Parse(fx);

                     var supportedPackage = new TaskItem(packageId);
                     supportedPackage.SetMetadata("Version", packageVersion);
                     supportedPackage.SetMetadata("TargetFramework", fx);
+                    supportedPackage.SetMetadata("TargetFrameworkShort", nugetFx.GetShortFolderName());

                     var ridList = string.Join(";", rids);


Simplify with pattern matching

Simplify with pattern matching

--- src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractReferenceFinder.cs
+++ src/Workspaces/Core/Portable/FindSymbols/FindReferences/Finders/AbstractReferenceFinder.cs
@@ -894,8 +894,8 @@

         public override Task<ImmutableArray<Project>> DetermineProjectsToSearchAsync(ISymbol symbol, Solution solution, IImmutableSet<Project> projects, CancellationToken cancellationToken)
         {
-            return symbol is TSymbol && CanFind((TSymbol)symbol)
-                ? DetermineProjectsToSearchAsync((TSymbol)symbol, solution, projects, cancellationToken)
+            return symbol is TSymbol typedSymbol && CanFind(typedSymbol)
+                ? DetermineProjectsToSearchAsync(typedSymbol, solution, projects, cancellationToken)
                 : SpecializedTasks.EmptyImmutableArray<Project>();
         }

@@ -903,8 +903,8 @@
             ISymbol symbol, Project project, IImmutableSet<Document> documents,
             FindReferencesSearchOptions options, CancellationToken cancellationToken)
         {
-            return symbol is TSymbol && CanFind((TSymbol)symbol)
-                ? DetermineDocumentsToSearchAsync((TSymbol)symbol, project, documents, options, cancellationToken)
+            return symbol is TSymbol typedSymbol && CanFind(typedSymbol)
+                ? DetermineDocumentsToSearchAsync(typedSymbol, project, documents, options, cancellationToken)
                 : SpecializedTasks.EmptyImmutableArray<Document>();
         }

@@ -912,8 +912,8 @@
             ISymbol symbol, Document document, SemanticModel semanticModel,
             FindReferencesSearchOptions options, CancellationToken cancellationToken)
         {
-            return symbol is TSymbol && CanFind((TSymbol)symbol)
-                ? FindReferencesInDocumentAsync((TSymbol)symbol, document, semanticModel, options, cancellationToken)
+            return symbol is TSymbol typedSymbol && CanFind(typedSymbol)
+                ? FindReferencesInDocumentAsync(typedSymbol, document, semanticModel, options, cancellationToken)
                 : SpecializedTasks.EmptyImmutableArray<FinderLocation>();
         }


Adding the data masking properties

Adding the data masking properties

--- src/ResourceManagement/Sql/SqlManagement/Generated/Models/DataMaskingPolicyProperties.cs
+++ src/ResourceManagement/Sql/SqlManagement/Generated/Models/DataMaskingPolicyProperties.cs
@@ -51,17 +51,6 @@
             set { this._exemptPrincipals = value; }
         }

-        private string _maskingLevel;
-
-        /// <summary>
-        /// Required. Gets or sets the masking level
-        /// </summary>
-        public string MaskingLevel
-        {
-            get { return this._maskingLevel; }
-            set { this._maskingLevel = value; }
-        }
-
         /// <summary>
         /// Initializes a new instance of the DataMaskingPolicyProperties class.
         /// </summary>
@@ -73,7 +62,7 @@
         /// Initializes a new instance of the DataMaskingPolicyProperties class
         /// with required arguments.
         /// </summary>
-        public DataMaskingPolicyProperties(string dataMaskingState, string exemptPrincipals, string maskingLevel)
+        public DataMaskingPolicyProperties(string dataMaskingState, string exemptPrincipals)
             : this()
         {
             if (dataMaskingState == null)
@@ -84,13 +73,8 @@
             {
                 throw new ArgumentNullException("exemptPrincipals");
             }
-            if (maskingLevel == null)
-            {
-                throw new ArgumentNullException("maskingLevel");
-            }
             this.DataMaskingState = dataMaskingState;
             this.ExemptPrincipals = exemptPrincipals;
-            this.MaskingLevel = maskingLevel;
         }
     }
 }


Gestione Partenza - Fix stato squadre

Gestione Partenza - Fix stato squadre

--- src/backend/SO115App.FakePersistance.ExternalAPI/Composizione/UpdateConfermaPartenzeExt.cs
+++ src/backend/SO115App.FakePersistance.ExternalAPI/Composizione/UpdateConfermaPartenzeExt.cs
@@ -177,9 +177,9 @@
                     }

                     if (partenza.Mezzo.Distaccamento.Codice != null)
-                        _setStatoSquadra.SetStato(squadra.Codice, command.ConfermaPartenze.IdRichiesta, partenza.Mezzo.Stato, partenza.Mezzo.Distaccamento.Codice, partenza.Mezzo.Codice, partenza.Turno);
+                        _setStatoSquadra.SetStato(squadra.Codice, command.ConfermaPartenze.IdRichiesta, partenza.Mezzo.Stato, squadra.Distaccamento.Codice, partenza.Mezzo.Codice, partenza.Turno);
                     else if (partenza.Mezzo.Appartenenza != null)
-                        _setStatoSquadra.SetStato(squadra.Codice, command.ConfermaPartenze.IdRichiesta, partenza.Mezzo.Stato, partenza.Mezzo.Appartenenza, partenza.Mezzo.Codice, partenza.Turno);
+                        _setStatoSquadra.SetStato(squadra.Codice, command.ConfermaPartenze.IdRichiesta, partenza.Mezzo.Stato, squadra.Distaccamento.Codice, partenza.Mezzo.Codice, partenza.Turno);
                 }
             }


Update

Update

--- main/dbms_gui_02/dbms_gui_02/Test_Functions/Program.cs
+++ main/dbms_gui_02/dbms_gui_02/Test_Functions/Program.cs
@@ -246,12 +246,16 @@

                     columnsList = TrimmedList(columnsList);
                     valuesList = TrimmedList(valuesList);
+
+                    return db.Insert(tableName, valuesList, columnsList);
                }
             }
             catch (Exception e)
             {
                 return false;
             }
+
+            return false;
         }

         /// <summary>


Updated list with red background to indicate excess friends condition

--- Form1.cs
+++ Form1.cs
@@ -25,6 +25,7 @@

         private string m_folderName = String.Empty;
         private Dictionary<string, List<string>> m_friendsDb = new Dictionary<string, List<string>>();
+        private bool m_requiresUpdate = false;

         public Form1()
         {
@@ -106,6 +107,7 @@
         {
             listBoxDetails.Items.Clear();
             listBoxDetails.BackColor = Color.White;
+            m_requiresUpdate = false;
         }

         private void ProcessServer(bool bSelectAllFiles = true)
@@ -223,6 +225,19 @@
             if (listBoxDetails.Items.Count > 0)
             {
                 this.Text += " (" + listBoxDetails.Items.Count + ")";
+
+                if (listBoxDetails.Items.Count > 100)
+                {
+                    listBoxDetails.BackColor =  ControlPaint.Light(Color.IndianRed);
+                }
+                else if (m_requiresUpdate)
+                {
+                    listBoxDetails.BackColor = ControlPaint.Light(Color.Yellow);
+                }
+                else
+                {
+                    listBoxDetails.BackColor = Color.White;
+                }
             }
         }

@@ -242,7 +257,8 @@

                     if ((firstNotSecond.Count > 0) || (secondNotFirst.Count > 0))
                     {
-                        listBoxDetails.BackColor = Color.Yellow;
+                        listBoxDetails.BackColor = ControlPaint.Light(Color.Yellow);
+                        m_requiresUpdate = true;
                     }
                 }


update door open/close hooks

update door open/close hooks

--- Hooks.cs
+++ Hooks.cs
@@ -692,6 +692,9 @@
             if ((open && door.IsOpen()) || (!open && !door.IsOpen()))
                 return;

+            if (door.IsBusy())
+                return;
+
             var preDoorUseEvent = new Pre<DoorUseEvent>(door, msg, open);

             OnNext("Pre_DoorUse", preDoorUseEvent);
@@ -718,7 +721,6 @@
             if (doAction) {
                 door.SetFlag(BaseEntity.Flags.Open, open);
                 door.SendNetworkUpdateImmediate(false);
-                door.CallMethod("UpdateDoorAnimationParameters", false);

                 OnNext("On_DoorUse", preDoorUseEvent.Event);
             }


Added new tests

Added new tests

--- test/Scientist.Test/ScientistTests.cs
+++ test/Scientist.Test/ScientistTests.cs
@@ -744,5 +744,84 @@

             mock.Received().Clean(expectedResult);
         }
+
+        [Fact]
+        public void NoCandidate()
+        {
+            const int expectedResult = 42;
+
+            var mock = Substitute.For<IControlCandidate<int>>();
+            mock.Control().Returns(expectedResult);
+
+            const string experimentName = "noCandidate";
+
+            var result = Scientist.Science<int>(experimentName, experiment =>
+            {
+                experiment.Use(mock.Control);
+            });
+
+            Assert.Equal(expectedResult, result);
+            mock.Received().Control();
+        }
+
+        [Fact]
+        public void NoCandidateMeansCleanIsNeverRun()
+        {
+            var mock = Substitute.For<IControlCandidate<int, int>>();
+            mock.Clean(Arg.Any<int>()).Returns(0);
+
+            Scientist.Science<int, int>("noCandidateNoClean", experiment =>
+            {
+                experiment.Use(() => 42);
+                experiment.Clean(mock.Clean);
+            });
+
+            mock.DidNotReceive().Clean(Arg.Any<int>());
+        }
+
+        [Fact]
+        public void NoCandidateMeansRunIfIsNeverRun()
+        {
+            var mock = Substitute.For<IControlCandidate<int>>();
+            mock.RunIf().Returns(false);
+
+            Scientist.Science<int, int>("noCandidateNoRunIf", experiment =>
+            {
+                experiment.Use(() => 42);
+                experiment.RunIf(mock.RunIf);
+            });
+
+            mock.DidNotReceive().RunIf();
+        }
+
+        [Fact]
+        public void NoCandidateMeansNoDisable()
+        {
+            var settings = Substitute.For<IScientistSettings>();
+            settings.Enabled().Returns(Task.FromResult(false));
+
+            using (Swap.Enabled(settings.Enabled))
+            {
+                Scientist.Science<int>("noCandidateNoDisable", experiment =>
+                {
+                    experiment.Use(() => 42);
+                });
+
+                settings.DidNotReceive().Enabled();
+            }
+        }
+
+        [Fact]
+        public void NoCandidateMeansNoPublish()
+        {
+            const string experimentName = "noCandidateNoPublish";
+
+            var result = Scientist.Science<int>(experimentName, experiment =>
+            {
+                experiment.Use(() => 42);
+            });
+
+            Assert.False(TestHelper.Results<int>().Any(m => m.ExperimentName == experimentName));
+        }
     }
 }


Remove unused private field `index`. Update file `Points.cs`

--- Group.Net/Points.cs
+++ Group.Net/Points.cs
@@ -9,7 +9,6 @@
 	public class Points : IComparable<Points>, IEnumerable<int>
 	{
 		private readonly IList<int> points;
-		private readonly IList<int> index;

 		public int Count
 		{


Documentation.

Documentation.

--- Gu.Inject/Kernel.cs
+++ Gu.Inject/Kernel.cs
@@ -62,9 +62,12 @@
         }

         /// <summary>
-        /// Provide an override to the automatic mapping.
+        /// Provide an override for the automatic mapping.
+        /// The kernel will keep <paramref name="instance"/> alive until disposed.
+        /// <paramref name="instance"/> is not disposed by the kernel if disposable.
         /// </summary>
         /// <typeparam name="T">The mapped type.</typeparam>
+        /// <param name="instance">The instance to bind.</param>
         public void Bind<T>(T instance)
             where T : class
         {


Delete TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs


Skip StreamingTests_Consumer_Producer_SubscribeToTwoStream_MessageWithPolymorphism.

--- test/Tester/StreamingTests/ProgrammaticSubscribeTests/ProgrammaticSubcribeTestsRunner.cs
+++ test/Tester/StreamingTests/ProgrammaticSubscribeTests/ProgrammaticSubcribeTestsRunner.cs
@@ -170,7 +170,7 @@
         }

-        [SkippableFact]
+        [SkippableFact(Skip="https://github.com/dotnet/orleans/issues/5650")]
         public async Task StreamingTests_Consumer_Producer_SubscribeToTwoStream_MessageWithPolymorphism()
         {
             var subscriptionManager = new SubscriptionManager(this.fixture.HostedCluster);


Fix handling of semicolon followed by empty statement

Fixes #1777

--- StyleCop.Analyzers/StyleCop.Analyzers/SpacingRules/SA1002SemicolonsMustBeSpacedCorrectly.cs
+++ StyleCop.Analyzers/StyleCop.Analyzers/SpacingRules/SA1002SemicolonsMustBeSpacedCorrectly.cs
@@ -92,11 +92,26 @@
             else
             {
                 SyntaxToken nextToken = token.GetNextToken();
-                if (nextToken.IsKind(SyntaxKind.CloseParenToken))
+                switch (nextToken.Kind())
                 {
+                case SyntaxKind.CloseParenToken:
                     // Special handling for the following case:
                     // for (; ;)
                     missingFollowingSpace = false;
+                    break;
+
+                case SyntaxKind.SemicolonToken:
+                    // Special handling for the following case:
+                    // Statement();;
+                    if (nextToken.Parent.IsKind(SyntaxKind.EmptyStatement))
+                    {
+                        missingFollowingSpace = false;
+                    }
+
+                    break;
+
+                default:
+                    break;
                 }
             }


Fix SourceType property.

Fix SourceType property.

--- Xml/TablatureDocument.cs
+++ Xml/TablatureDocument.cs
@@ -221,7 +221,6 @@
         #region Implementation of ITablatureFile

         public DateTime Created { get; set; }
-        private TablatureSourceType SourceType { get; set; }
         public string Comment { get; set; }

         #endregion
@@ -236,7 +235,7 @@

         #region Implementation of ITablatureSourceAttribute

-        TablatureSourceType ITablatureSourceAttributes.SourceType { get; set; }
+        public TablatureSourceType SourceType { get; set; }
         public Uri Source { get; set; }

         #endregion


math.Round is losing bytes..gg

math.Round is losing bytes..gg


For all Flotasm group module XMLRPC calls, correct parameter requestingAgentID to RequestingAgentID

This was stopping the get group member roles call from working, and may have affected other things

--- OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
+++ OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs
@@ -957,7 +957,6 @@
                     CacheKey = sb.ToString();
                     m_memoryCache.TryGetValue(CacheKey, out resp);
                 }
-
             }

             if (resp == null)
@@ -965,21 +964,18 @@
                 string UserService;
                 UUID SessionID;
                 GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID);
-                param.Add("requestingAgentID", requestingAgentID.ToString());
+
+                param.Add("RequestingAgentID", requestingAgentID.ToString());
                 param.Add("RequestingAgentUserService", UserService);
                 param.Add("RequestingSessionID", SessionID.ToString());
-
-
                 param.Add("ReadKey", m_groupReadKey);
                 param.Add("WriteKey", m_groupWriteKey);

-
                 IList parameters = new ArrayList();
                 parameters.Add(param);

                 ConfigurableKeepAliveXmlRpcRequest req;
                 req = new ConfigurableKeepAliveXmlRpcRequest(function, parameters, m_disableKeepAlive);
-

                 try
                 {
@@ -989,7 +985,6 @@
                     {
                         m_memoryCache.AddOrUpdate(CacheKey, resp, TimeSpan.FromSeconds(m_cacheTimeout));
                     }
-
                 }
                 catch (Exception e)
                 {
@@ -1058,10 +1053,8 @@
                 {
                     m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0}", line);
                 }
-
-            }
-        }
-
+            }
+        }

         /// <summary>
         /// Group Request Tokens are an attempt to allow the groups service to authenticate


Test added to prove the bug in the Diagnostic Services when building singleton decorators that depend on a Func<T>.

--- SimpleServiceLocator/SimpleInjector.NET.Tests.Unit/Extensions/DecoratorExtensionsTests.cs
+++ SimpleServiceLocator/SimpleInjector.NET.Tests.Unit/Extensions/DecoratorExtensionsTests.cs
@@ -1473,6 +1473,37 @@
             // Assert
             Assert.AreEqual(1, relationships.Count(actual => expectedRelationship1.Equals(actual)));
         }
+
+        // This test was written for work item https://simpleinjector.codeplex.com/workitem/20141.
+        [TestMethod]
+        public void GetRelationships_DecoratorDependingOnFuncDecorateeFactory_ReturnsRelationshipForThatFactory()
+        {
+            // Arrange
+            var expectedRelationship = new RelationshipInfo
+            {
+                Lifestyle = Lifestyle.Singleton,
+                ImplementationType = typeof(NonGenericServiceDecoratorWithFunc),
+                Dependency = new DependencyInfo(typeof(Func<INonGenericService>), Lifestyle.Singleton)
+            };
+
+            var container = new Container();
+
+            container.Register<INonGenericService, RealNonGenericService>(Lifestyle.Transient);
+
+            container.RegisterDecorator(typeof(INonGenericService),
+                typeof(NonGenericServiceDecoratorWithFunc), Lifestyle.Singleton);
+
+            container.Verify();
+
+            // Act
+            var relationships = container.GetRegistration(typeof(INonGenericService)).GetRelationships();
+
+            // Assert
+            var actualRelationship = relationships.Single();
+
+            Assert.IsTrue(expectedRelationship.Equals(actualRelationship),
+                "actual: " + RelationshipInfo.ToString(actualRelationship));
+        }
 #endif

         [TestMethod]


Support for nested properties on class with MapFrom attribute

--- Source/DesignTimeMapper/DesignTimeMapper.Engine/MapperGeneration/MapperMethodGenerator.cs
+++ Source/DesignTimeMapper/DesignTimeMapper.Engine/MapperGeneration/MapperMethodGenerator.cs
@@ -181,18 +181,19 @@
         }

-        private void BuildMatchingPropertyTree(IEnumerable<IPropertySymbol> classToMapToSymbols, MapTreeNode<IPropertySymbol> mapToNode, IEnumerable<IPropertySymbol> classToMapFromSymbols, MapTreeNode<IPropertySymbol> mapFromTree)
+        private void BuildMatchingPropertyTree(IEnumerable<IPropertySymbol> classToMapToSymbols, MapTreeNode<IPropertySymbol> mapToNode, IEnumerable<IPropertySymbol> classToMapFromSymbols, MapTreeNode<IPropertySymbol> mapFromNode)
         {
             foreach (var classToMapToSymbol in classToMapToSymbols)
             {
-                var mapToChild = mapToNode.AddChild(classToMapToSymbol);
+                var mapToChild = mapToNode.AddOrGetChild(classToMapToSymbol);
+                if(mapToChild.MapsTo != null) continue;

                 string potentialName = string.Empty;
                 mapToChild.TraverseAncestors(s => potentialName = potentialName.Insert(0, s.Name));

                 foreach (var classToMapFromSymbol in classToMapFromSymbols)
                 {
-                    var mapFromChild = mapFromTree.AddOrGetChild(classToMapFromSymbol);
+                    var mapFromChild = mapFromNode.AddOrGetChild(classToMapFromSymbol);
                     if (potentialName == classToMapFromSymbol.Name)
                     {
                         mapToChild.AddMapping(mapFromChild);
@@ -214,14 +215,8 @@
                     }
                     if (classToMapFromSymbol.Name.StartsWith(potentialName))
                     {
-
-                    }
-
-                    string potentialMappedName = string.Empty;
-                    mapFromTree.TraverseAncestors(s => potentialName = potentialName.Insert(0, s.Name));
-                    if (potentialMappedName == potentialName)
-                    {
-
+                        var childSymbols = classToMapToSymbol.Type.GetMembers().Where(m => m.Kind == SymbolKind.Property).Cast<IPropertySymbol>();
+                        BuildMatchingPropertyTree(childSymbols, mapToChild, classToMapFromSymbols, mapFromNode);
                     }
                 }
             }


Id setter removed and TotalResults added

--- Terradue.OpenSearch.GeoJson/Terradue/OpenSearch/GeoJson/Result/FeatureResultCollection.cs
+++ Terradue.OpenSearch.GeoJson/Terradue/OpenSearch/GeoJson/Result/FeatureResultCollection.cs
@@ -270,6 +270,15 @@
             }
         }

+        public long TotalResults {
+            get {
+                var el = ElementExtensions.ReadElementExtensions<string>("totalResults", "http://a9.com/-/spec/opensearch/1.1/");
+                if (el.Count > 0)
+                    return long.Parse(el[0]);
+                return 0;
+            }
+        }
+
         public void SerializeToStream(System.IO.Stream stream) {
             JsConfig.ExcludeTypeInfo = true;
             JsConfig.IncludeTypeInfo = false;


point was replaced by parameters

point was replaced by parameters

--- Third_semestr/Homework_4/SimpleGraphicsEditor/SimpleGraphicsEditor/ChangePointsCommand.cs
+++ Third_semestr/Homework_4/SimpleGraphicsEditor/SimpleGraphicsEditor/ChangePointsCommand.cs
@@ -11,16 +11,11 @@
 {
     class ChangePointsCommand : ICommand
     {
-        private Log log;
-        private Shape shape;
-        private Point point;
-        private Point prevPoint;
-
-        public ChangePointsCommand(Log log, Shape shape, Point point)
+        public ChangePointsCommand(Log log, Shape shape, Parameters parameters)
         {
             this.log = log;
             this.shape = shape;
-            this.point = point;
+            this.parameters = parameters;
         }

         public string Name
@@ -30,13 +25,18 @@

         public void Execute()
         {
-            prevPoint = shape.Parameter.start;
-            shape.Parameter.move = point;
+            prevParameters = shape.Parameter;
+            shape.Parameter = parameters;
         }

         public void UnExecute()
         {
-            shape.Parameter.move = prevPoint;
+            shape.Parameter = prevParameters;
         }
+
+        private Parameters parameters;
+        private Parameters prevParameters;
+        private Log log;
+        private Shape shape;
     }
 }


fixed default PageIndex

fixed default PageIndex

--- src/microwf.AspNetCoreEngine/Models/PagingParameters.cs
+++ src/microwf.AspNetCoreEngine/Models/PagingParameters.cs
@@ -5,7 +5,7 @@
 {
   public class PagingParameters
   {
-    public int PageIndex { get; set; } = 1;
+    public int PageIndex { get; set; } = 0;

     public int PageSize { get; set; } = 20;


Converters for signed integers can read unsigned too, if they less than max value.

--- src/msgpack.light/Converters/IntConverter.cs
+++ src/msgpack.light/Converters/IntConverter.cs
@@ -53,7 +53,7 @@

         public void Write(sbyte value, IMsgPackWriter writer)
         {
-            var unsignedValue = (byte) value;
+            var unsignedValue = (byte)value;
             if ((value > 0 && TryWriteUnsignedFixNum(unsignedValue, writer)) ||
                 TryWriteSignedFixNum(value, writer) ||
                 (value > 0 && TryWriteUInt8(unsignedValue, writer)) ||
@@ -121,6 +121,15 @@
             {
                 case DataTypes.UInt8:
                     return ReadUInt8(reader);
+
+                case DataTypes.UInt16:
+                    var ushortValue = ReadUInt16(reader);
+                    if (ushortValue < short.MaxValue)
+                    {
+                        return (short)ushortValue;
+                    }
+
+                    throw ExceptionUtils.IntDeserializationFailure(type);

                 case DataTypes.Int8:
                     return ReadInt8(reader);
@@ -215,6 +224,15 @@

                 case DataTypes.UInt16:
                     return ReadUInt16(reader);
+
+                case DataTypes.UInt32:
+                    var uintValue = ReadUInt32(reader);
+                    if (uintValue < int.MaxValue)
+                    {
+                        return (int)uintValue;
+                    }
+
+                    throw ExceptionUtils.IntDeserializationFailure(type);

                 case DataTypes.Int8:
                     return ReadInt8(reader);
@@ -325,6 +343,15 @@
                 case DataTypes.UInt32:
                     return ReadUInt32(reader);

+                case DataTypes.UInt64:
+                    var ulongValue = ReadUInt64(reader);
+                    if (ulongValue < long.MaxValue)
+                    {
+                        return (long)ulongValue;
+                    }
+
+                    throw ExceptionUtils.IntDeserializationFailure(type);
+
                 case DataTypes.Int8:
                     return ReadInt8(reader);


Updated the UTF-8 encoding to never use the Byte Order Mark

--- prometheus-net/Internal/AsciiFormatter.cs
+++ prometheus-net/Internal/AsciiFormatter.cs
@@ -12,7 +12,12 @@
         public static void Format(Stream destination, IEnumerable<MetricFamily> metrics)
         {
             var metricFamilys = metrics.ToArray();
-            using (var streamWriter = new StreamWriter(destination, Encoding.UTF8))
+
+            // Use UTF-8 encoding, but provide the flag to ensure the Unicode Byte Order Mark is never
+            //  pre-pended to the output stream. If the BOM exists the push gateway won't understand
+            //  the metric data sent to it.
+            //
+            using (var streamWriter = new StreamWriter(destination, new UTF8Encoding(false)))
             {
                 streamWriter.NewLine = "\n";
                 foreach (var metricFamily in metricFamilys)