Refactor duplicate path removal

Refactor duplicate path removal

--- src/Imageflow/Bindings/NativeLibraryLoading.cs
+++ src/Imageflow/Bindings/NativeLibraryLoading.cs
@@ -173,18 +173,31 @@

         internal static IEnumerable<string> SearchPossibilitiesForFile(string filename, IEnumerable<string> customSearchDirectories = null)
         {
+            var attemptedPaths = new HashSet<string>();
             var subdir = ArchitectureSubdir.Value;
             foreach (var f in BaseFolders(customSearchDirectories))
             {
                 if (string.IsNullOrEmpty(f)) continue;
                 var directory = Path.GetFullPath(f);
                 // Try architecture-specific subdirectories first
+                string path;
                 if (subdir != null)
                 {
-                    yield return Path.Combine(directory, subdir, filename);
+                    path = Path.Combine(directory, subdir, filename);
+                    if (!attemptedPaths.Contains(path))
+                    {
+                        attemptedPaths.Add(path);
+                        yield return path;
+                    }
                 }
                 // Try the folder itself
-                yield return Path.Combine(directory, filename);
+                path = Path.Combine(directory, filename); ;
+                if (!attemptedPaths.Contains(path))
+                {
+
+                    attemptedPaths.Add(path);
+                    yield return path;
+                }
             }
         }

@@ -259,11 +272,8 @@
             var filename = GetFilenameWithoutDirectory(basename);

             exePath = null;
-            var attemptedPaths = new HashSet<string>();
             foreach (var path in RuntimeFileLocator.SearchPossibilitiesForFile(filename, customSearchDirectories))
             {
-                if (attemptedPaths.Contains(path)) continue; //Don't try the same path twice
-                attemptedPaths.Add(path);
                 if (!File.Exists(path))
                 {
                     log.NotifyAttempt(basename, path, false, false, 0);
@@ -360,11 +370,8 @@
         private static bool TryLoadByBasenameInternal(string basename, ILibraryLoadLogger log, out IntPtr handle, IEnumerable<string> customSearchDirectories = null)
         {
             var filename = GetFilenameWithoutDirectory(basename);
-            var attemptedPaths = new HashSet<string>();
             foreach (var path in RuntimeFileLocator.SearchPossibilitiesForFile(filename, customSearchDirectories))
             {
-                if (attemptedPaths.Contains(path)) continue; //Don't try the same path twice
-                attemptedPaths.Add(path);
                 if (!File.Exists(path))
                 {
                     log.NotifyAttempt(basename, path, false, false, 0);


Optimization by returning the same instance

--- src/Umbraco.Core/PropertyEditors/DataEditor.cs
+++ src/Umbraco.Core/PropertyEditors/DataEditor.cs
@@ -19,6 +19,7 @@
     public class DataEditor : IDataEditor
     {
         private IDictionary<string, object> _defaultConfiguration;
+        private IDataValueEditor _reusableEditor;

         /// <summary>
         /// Initializes a new instance of the <see cref="DataEditor"/> class.
@@ -90,7 +91,8 @@
         /// simple enough for now.</para>
         /// </remarks>
         // TODO: point of that one? shouldn't we always configure?
-        public IDataValueEditor GetValueEditor() => ExplicitValueEditor ?? CreateValueEditor();
+        public IDataValueEditor GetValueEditor() => ExplicitValueEditor ?? (_reusableEditor ?? (_reusableEditor = CreateValueEditor()));
+

         /// <inheritdoc />
         /// <remarks>


Makes MapFromMember protected virtual

Makes MapFromMember protected virtual

--- src/UmbracoIdentity/UmbracoMembersUserStore.cs
+++ src/UmbracoIdentity/UmbracoMembersUserStore.cs
@@ -460,7 +460,12 @@
             _disposed = true;
         }

-        private TMember MapFromMember(IMember member)
+        /// <summary>
+        /// Maps the data from <see cref="IMember"/> back to the <see cref="TMember"/> when retreived from the data source
+        /// </summary>
+        /// <param name="member"></param>
+        /// <returns></returns>
+        protected virtual TMember MapFromMember(IMember member)
         {
             var result = new TMember
             {


added some null checks, updated server_console base regex to allow checking for players losing connectivity

--- beParser/frmMain.cs
+++ beParser/frmMain.cs
@@ -946,7 +946,7 @@

         internal string PlayerToGuidGet(string player)
         {
-            if (playerToGuid.ContainsKey(player))
+            if (player != null && playerToGuid.ContainsKey(player))
             {
                 return playerToGuid[player];
             }
@@ -966,7 +966,7 @@

         internal string UidToPlayerGet(string uid)
         {
-            if (uidToPlayer.ContainsKey(uid))
+            if (uid != null && uidToPlayer.ContainsKey(uid))
             {
                 return uidToPlayer[uid];
             }
@@ -1006,7 +1006,7 @@

         internal int PlayerToSlotGet(string player)
         {
-            if (playerToSlot.ContainsKey(player))
+            if (player != null && playerToSlot.ContainsKey(player))
             {
                 return playerToSlot[player];
             }
@@ -1396,7 +1396,7 @@
         private string rule;
         private Int32 unixtime = 0;
         private string evt;
-        private Regex server_console1 = new Regex(@"\d+:\d+:\d+ (?:BattlEye Server: Player #(?<slot>\d+) (?<player>.*?) (?:- GUID: (?<guid>[a-f0-9]{32}) \(unverified\)|\((?<ip>[0-9.]+?):\d+\) connected)|(?:BattlEye Server: )?Player #?(?<slot>\d+)?\s?(?<player>.*?) (?:kicked off by BattlEye: (?<evt>Admin Ban)|connected \(id=(?<uid>[0-9AX]+)\)\.|(?<evt>disconnected\.?)|kicked off by BattlEye: (?<evt>Global Ban) #[a-f0-9]+)|Player #(?<slot>\d+) (?<player>.*?) \([a-f0-9]{32}\) has been kicked by BattlEye: (?<evt>Invalid GUID)|BattlEye Server: \((?<evt>.*?)\) (?<player>.*?) *: (?<msg>.*)) *$", RegexOptions.Compiled | RegexOptions.Singleline);
+        private Regex server_console1 = new Regex(@"(?<time>\d+:\d+:\d+) (?:BattlEye Server: Player #(?<slot>\d+) (?<player>.*?) (?:- GUID: (?<guid>[a-f0-9]{32}) \(unverified\)|\((?<ip>[0-9.]+?):\d+\) connected)|(?:BattlEye Server: )?Player #?(?<slot>\d+)?\s?(?<player>.*?) (?:kicked off by BattlEye: (?<evt>Admin Ban)|connected \(id=(?<uid>[0-9AX]+)\)\.|(?<evt>disconnected\.?)|kicked off by BattlEye: (?<evt>Global Ban) #[a-f0-9]+)|Player #(?<slot>\d+) (?<player>.*?) \([a-f0-9]{32}\) has been kicked by BattlEye: (?<evt>Invalid GUID)|BattlEye Server: \((?<evt>.*?)\) (?<player>.*?) *: (?<msg>.*)|Player (?<player>.*) is losing connection) *$", RegexOptions.Compiled | RegexOptions.Singleline);
         private Regex publicvariable1 = new Regex(@"([0-9]+\.[0-9]+\.[0-9]+ [0-9]+:[0-9]+:[0-9]+): (.*) \(([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}):[0-9]+\) ([0-9a-z]{32}) - ", RegexOptions.Compiled | RegexOptions.Singleline);
         private Regex otherfiles1 = new Regex(@"(?<date>(?<D>\d+)\.(?<M>\d+)\.(?<Y>\d+) (?<h>\d+):(?<m>\d+):(?<s>\d+)): (?<player>.*?) ?\((?<ip>[0-9.]{7,15}):[0-9]{1,5}\) (?<guid>(?:-|[a-f0-9]{32})) - ", RegexOptions.Compiled | RegexOptions.Singleline);

@@ -1428,10 +1428,26 @@

                         if (_match1.Success)
                         {
+                            Group timeExists = _match1.Groups["time"];
+                            Group playerExists = _match1.Groups["player"];
                             Group guidExists = _match1.Groups["guid"];
                             Group uidExists = _match1.Groups["uid"];
                             Group ipExists = _match1.Groups["ip"];
                             Group evtExists = _match1.Groups["evt"];
+
+                            if(timeExists.Success)
+                            {
+                                DateTime dt = DateTime.Now;
+                                TimeSpan ts = TimeSpan.Parse(_match1.Groups["time"].Value);
+                                dt = dt.Date + ts;
+                                unixtime = (Int32)(dt.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
+                            }
+
+                            if(playerExists.Success)
+                            {
+                                player = _match1.Groups["player"].Value;
+                                guid = _parentForm.PlayerToGuidGet(player);
+                            }

                             if (guidExists.Success)
                             {
@@ -1687,11 +1703,11 @@
                                 else
                                 {
                                     string key = rule + guid + Convert.ToString(Convert.ToDecimal((unixtime / _fileChecks[i].seconds)));
-
+
                                     _parentForm.UpdateRuleCount(key);
                                     int currentCount = _parentForm.GetRuleCount(key);

-                                    ThreadLogOutput(_parentForm.GetDateString() + " " + currentCount + "/" + _fileChecks[i].count + ":" + _fileName + ":" + line);
+                                    ThreadLogOutput(_parentForm.GetDateString() + " " + currentCount + "/" + _fileChecks[i].count + ":" + _fileName + ":" + line + " - guid " + guid + " player " + player);
                                     if (currentCount == _fileChecks[i].count)
                                     {
                                         _parentForm.Ban(guid, ip, player, slot, date, rule, _fileChecks[i].command);


error handling yahoo requests

error handling yahoo requests

--- QDMS.Server.DataSources.Yahoo/Yahoo.cs
+++ QDMS.Server.DataSources.Yahoo/Yahoo.cs
@@ -169,7 +169,16 @@
                 ToTimestamp(endDate),
                 _crumb);

-            var response = await _client.GetAsync(splitURL).ConfigureAwait(false);
+            HttpResponseMessage response;
+            try
+            {
+                response = await _client.GetAsync(splitURL).ConfigureAwait(false);
+            }
+            catch (WebException ex)
+            {
+                _logger.Error(ex, "Yahoo downloader failure, URL: " + splitURL);
+                return new List<OHLCBar>();
+            }

             if (!response.IsSuccessStatusCode)
             {
@@ -214,7 +223,15 @@
                 ToTimestamp(endDate),
                 _crumb);

-            response = await _client.GetAsync(divURL).ConfigureAwait(false);
+            try
+            {
+                response = await _client.GetAsync(divURL).ConfigureAwait(false);
+            }
+            catch (WebException ex)
+            {
+                _logger.Error(ex, "Yahoo downloader failure, URL: " + divURL);
+                return new List<OHLCBar>();
+            }

             if (!response.IsSuccessStatusCode)
             {
@@ -256,7 +273,16 @@
                 ToTimestamp(endDate),
                 _crumb);

-            response = await _client.GetAsync(dataURL).ConfigureAwait(false);
+            try
+            {
+                response = await _client.GetAsync(dataURL).ConfigureAwait(false);
+            }
+            catch (WebException ex)
+            {
+                _logger.Error(ex, "Yahoo downloader failure, URL: " + dataURL);
+                return new List<OHLCBar>();
+            }
+

             if (!response.IsSuccessStatusCode)
             {


updateposition time reduce

updateposition time reduce

--- src/L2dotNET/world/L2Character.cs
+++ src/L2dotNET/world/L2Character.cs
@@ -67,7 +67,7 @@

         public StandartAiTemplate AiCharacter = new StandartAiTemplate();

-        private Timer _updatePositionTime = new Timer(100);
+        private Timer _updatePositionTime = new Timer(90);

         public L2Character(int objectId, CharTemplate template) : base(objectId)
         {


Update SiteVarDistinct.cs

Update SiteVarDistinct.cs

--- src/Landscapes/SiteVarDistinct.cs
+++ src/Landscapes/SiteVarDistinct.cs
@@ -1,13 +1,5 @@
 // Copyright 2005-2006 University of Wisconsin
 // All rights reserved.
-//
-// The copyright holders license this file under the New (3-clause) BSD
-// License (the "License").  You may not use this file except in
-// compliance with the License.  A copy of the License is available at
-//
-//   http://www.opensource.org/licenses/BSD-3-Clause
-//
-// and is included in the NOTICE.txt file distributed with this work.
 //
 // Contributors:
 //   James Domingo, UW-Madison, Forest Landscape Ecology Lab


Added method to load devices from the deviceprovider-loader

--- RGB.NET.Core/RGBSurfaceDeviceLoader.cs
+++ RGB.NET.Core/RGBSurfaceDeviceLoader.cs
@@ -8,7 +8,19 @@
     {
         #region Methods

-        // ReSharper disable once UnusedMember.Global
+        // ReSharper disable UnusedMember.Global
+        /// <summary>
+        /// Loads all devices the given by the <see cref="IRGBDeviceProvider"/> provided by the give <see cref="IRGBDeviceProviderLoader{T}"/>.
+        /// </summary>
+        /// <param name="deviceProviderLoader">The <see cref="IRGBDeviceProviderLoader{T}"/> which provides the <see cref="IRGBDeviceProvider"/> to load the devices from.</param>
+        /// <param name="loadFilter">Specifies which types of devices to load.</param>
+        /// <param name="exclusiveAccessIfPossible">Specifies whether the application should request exclusive access of possible or not.</param>
+        /// <param name="throwExceptions">Specifies whether exception during the initialization sequence should be thrown or not.</param>
+        public void LoadDevices<T>(IRGBDeviceProviderLoader<T> deviceProviderLoader, RGBDeviceType loadFilter = RGBDeviceType.All,
+                                  bool exclusiveAccessIfPossible = false, bool throwExceptions = false)
+            where T : class, IRGBDeviceProviderLoader<T>, new()
+            => LoadDevices(deviceProviderLoader.GetDeviceProvider(), loadFilter, exclusiveAccessIfPossible, throwExceptions);
+
         /// <summary>
         /// Loads all devices the given <see cref="IRGBDeviceProvider"/> is able to provide.
         /// </summary>
@@ -56,6 +68,8 @@
             }
         }

+        // ReSharper restore UnusedMember.Global
+
         private void DeviceOnPropertyChanged(object sender, PropertyChangedEventArgs propertyChangedEventArgs)
         {
             UpdateSurfaceRectangle();


Move variable declaration closer to assignment

--- src/LfMerge/LfMergeSettingsIni.cs
+++ src/LfMerge/LfMergeSettingsIni.cs
@@ -182,7 +182,6 @@

 		public static IniData ParseFiles(string defaultConfig, string globalConfigFilename, string userConfigFilename)
 		{
-			IniData result;
 			var utf8 = new UTF8Encoding(false);
 			var parserConfig = new IniParserConfiguration {
 				// ThrowExceptionsOnError = false,
@@ -191,7 +190,7 @@
 			};

 			var parser = new IniDataParser(parserConfig);
-			result = parser.Parse(DefaultLfMergeSettings.DefaultIniText);
+			IniData result = parser.Parse(DefaultLfMergeSettings.DefaultIniText);

 			string globalIni = File.Exists(globalConfigFilename) ? File.ReadAllText(globalConfigFilename, utf8) : "";
 			if (String.IsNullOrEmpty(globalIni)) {


priorize projects with roslyn reports

priorize projects with roslyn reports

--- RemoveSonarOutputDuplicates/Program.cs
+++ RemoveSonarOutputDuplicates/Program.cs
@@ -9,6 +9,13 @@

 namespace RemoveSonarOutputDuplicates
 {
+    public class ProjectInfo
+    {
+        public string File { get; set; }
+        public string Guid { get; set; }
+        public bool HasRoslynReport { get; set; }
+    }
+
     public class Program
     {
         static int Main(string[] args)
@@ -27,6 +34,7 @@
             }

             Dictionary<string, string> projects = new Dictionary<string, string>();
+            List<ProjectInfo> projectsAll = new List<ProjectInfo>();

             foreach (var projectDir in Directory.GetDirectories(baseDir))
             {
@@ -49,6 +57,12 @@
                     continue;
                 }

+                /*
+                xdoc.Elements()
+                    .First((xe) => xe.Name.LocalName == "ProjectInfo").Elements()
+                    .First(xe => xe.Name.LocalName == "IsExcluded").Value = "false";
+                xdoc.Save(projectInfoFileName);
+                */

                 string projectGuid = string.Empty;
                 try
@@ -56,7 +70,7 @@
                     projectGuid = xdoc.Elements()
                         .First((xe) => xe.Name.LocalName == "ProjectInfo").Elements()
                         .First(xe => xe.Name.LocalName == "ProjectGuid").Value;
-                    Console.WriteLine("GUID {0}.", projectGuid);
+                    Console.WriteLine("GUID {0}", projectGuid);
                 }
                 catch (Exception e)
                 {
@@ -64,29 +78,72 @@
                     continue;
                 }

-                if (projects.ContainsKey(projectGuid))
+                bool hasRoslynReportFilePath = false;
+                try
                 {
-                    try
-                    {
-                        xdoc.Elements()
-                            .First((xe) => xe.Name.LocalName == "ProjectInfo").Elements()
-                            .First(xe => xe.Name.LocalName == "IsExcluded").Value = "true";
-                        xdoc.Save(projectInfoFileName);
-                        Console.WriteLine("Duplicated project removed from analysis!");
-                    }
-                    catch (Exception e)
-                    {
-                        Console.WriteLine("*** Can't set {0} excluded. Message: {1}", projectInfoFileName, e.ToString());
-                        return 1;
-                    }
+                    hasRoslynReportFilePath = xdoc.Elements()
+                        .First((xe) => xe.Name.LocalName == "ProjectInfo").Elements()
+                        .First(xe => xe.Name.LocalName == "AnalysisSettings").Elements()
+                        .Any((xe) => xe.Attributes().Any((xa) => xa.Name.LocalName == "Name" && xa.Value == "sonar.cs.roslyn.reportFilePath"));
+                    Console.WriteLine("Roslyn Report File Path: {0}", hasRoslynReportFilePath);
                 }
-                else
+                catch (Exception e)
                 {
-                    Console.WriteLine("Nothing to do.");
-                    projects[projectGuid] = projectInfoFileName;
+                    Console.WriteLine("*** Can't load project sonar.cs.roslyn.reportFilePath attribute. Message: {0}", projectInfoFileName, e.ToString());
+                    continue;
                 }

+                projectsAll.Add(new ProjectInfo() { File = projectInfoFileName, Guid = projectGuid, HasRoslynReport = hasRoslynReportFilePath });
+
                 Console.WriteLine();
+            }
+
+            Console.WriteLine("Verifying duplicated projects...");
+            foreach (string guid in projectsAll.Select((pi) => pi.Guid).Distinct())
+            {
+                var duplicatedProjs = projectsAll.Where((pi) => pi.Guid == guid).ToList();
+
+                if (duplicatedProjs.Count > 1)
+                {
+                    Console.WriteLine("There are {0} projects with GUID {1}.", duplicatedProjs.Count, guid);
+
+                    var projWithRoslyn = duplicatedProjs.FirstOrDefault((pi) => pi.HasRoslynReport);
+
+                    bool thereIsAWinner = false;
+                    for (int i = 0; i < duplicatedProjs.Count; i++)
+                    {
+                        if (projWithRoslyn != null && duplicatedProjs[i].File == projWithRoslyn.File)
+                        {
+                            Console.WriteLine("Project {0} with Roslyn report will be preserved!", duplicatedProjs[i].File);
+                            thereIsAWinner = true;
+                            continue;
+                        }
+
+                        if (i == (duplicatedProjs.Count - 1) && !thereIsAWinner)
+                        {
+                            Console.WriteLine("Remaining project {0} will be preserved!", duplicatedProjs[i].File);
+                            continue;
+                        }
+                        else
+                        {
+                            try
+                            {
+                                var xdoc = XDocument.Load(duplicatedProjs[i].File);
+                                xdoc.Elements()
+                                    .First((xe) => xe.Name.LocalName == "ProjectInfo").Elements()
+                                    .First(xe => xe.Name.LocalName == "IsExcluded").Value = "true";
+                                xdoc.Save(duplicatedProjs[i].File);
+                                Console.WriteLine("Duplicated project {0} removed from analysis!", duplicatedProjs[i].File);
+                            }
+                            catch (Exception e)
+                            {
+                                Console.WriteLine("*** Can't set {0} excluded. Message: {1}", duplicatedProjs[i].File, e.ToString());
+                                return 1;
+                            }
+                        }
+                    }
+                    Console.WriteLine();
+                }
             }

             return 0;


Added a Load function to allow the GameObjectCreator to create the game object using the Unity Resources API

--- GameObjectCreator.cs
+++ GameObjectCreator.cs
@@ -40,6 +40,11 @@
         /// Game object is parented under the 'procedural game object parent'.
         /// </summary>
         GameObject CreatePermanent(string name);
+
+        /// <summary>
+        /// Load a game object using Unity's resource API
+        /// </summary>
+        GameObject Load(string newGameObjectName, string resourcePath);
     }

     /// <summary>
@@ -99,6 +104,24 @@
             Argument.StringNotNullOrEmpty(() => name);

             return Create(name, GetProceduralRootObject());
+        }
+
+        /// <summary>
+        /// Load a game object using Unity's resource API
+        /// </summary>
+        public GameObject Load(string newGameObjectName, string resourcePath)
+        {
+            Argument.StringNotNullOrEmpty(() => newGameObjectName);
+            Argument.StringNotNullOrEmpty(() => resourcePath);
+
+            var loadedObj = Resources.Load(resourcePath);
+
+            if (loadedObj == null)
+            {
+                throw new ApplicationException("Failed to load assets from path: " + resourcePath);
+            }
+
+            return Instantiate(newGameObjectName, (GameObject)loadedObj);
         }

         /// <summary>


Document WriteTo... methods in InternalLogger class

* Document WriteTo... methods in InternalLogger class
* Reserve large enough buffer space in memory so the StringBuilder can hold the formatted output message without resizing.

--- src/NLog/Common/InternalLogger.cs
+++ src/NLog/Common/InternalLogger.cs
@@ -288,7 +288,7 @@
             var formattedMessage =
                 (args == null) ? message : string.Format(CultureInfo.InvariantCulture, message, args);

-            var builder = new StringBuilder(formattedMessage.Length + TimeStampFormat.Length + 8);
+            var builder = new StringBuilder(formattedMessage.Length + TimeStampFormat.Length + ex?.ToString()?.Length ?? 0 + 25);
             if (IncludeTimestamp)
             {
                 builder
@@ -344,6 +344,14 @@
                    LogWriter != null;
         }

+        /// <summary>
+        /// Write internal messages to the log file defined in <see cref="LogFile"/>.
+        /// </summary>
+        /// <param name="message">Message to write.</param>
+        /// <remarks>
+        /// Message will be logged only when the property <see cref="LogFile"/> is not <c>null</c>, otherwise the
+        /// method has no effect.
+        /// </remarks>
         private static void WriteToLogFile(string message)
         {
             var logFile = LogFile;
@@ -361,6 +369,14 @@
             }
         }

+        /// <summary>
+        /// Write internal messages to the <see cref="System.IO.TextWriter"/> defined in <see cref="LogWriter"/>.
+        /// </summary>
+        /// <param name="message">Message to write.</param>
+        /// <remarks>
+        /// Message will be logged only when the property <see cref="LogWriter"/> is not <c>null</c>, otherwise the
+        /// method has no effect.
+        /// </remarks>
         private static void WriteToTextWriter(string message)
         {
             var writer = LogWriter;
@@ -375,6 +391,14 @@
             }
         }

+        /// <summary>
+        /// Write internal messages to the <see cref="System.Console"/>.
+        /// </summary>
+        /// <param name="message">Message to write.</param>
+        /// <remarks>
+        /// Message will be logged only when the property <see cref="LogToConsole"/> is <c>true</c>, otherwise the
+        /// method has no effect.
+        /// </remarks>
         private static void WriteToConsole(string message)
         {
             if (!LogToConsole)
@@ -388,6 +412,14 @@
             }
         }

+        /// <summary>
+        /// Write internal messages to the <see cref="System.Console.Error"/>.
+        /// </summary>
+        /// <param name="message">Message to write.</param>
+        /// <remarks>
+        /// Message will be logged when the property <see cref="LogToConsoleError"/> is <c>true</c>, otherwise the
+        /// method has no effect.
+        /// </remarks>
         private static void WriteToErrorConsole(string message)
         {
             if (!LogToConsoleError)


changed queries to allow wild cards in find

--- model/SccmConnector.cs
+++ model/SccmConnector.cs
@@ -273,7 +273,7 @@
         {
             try
             {
-                string query = "select * from SMS_FullCollectionMembership WHERE Name='" +  name + "'";
+                string query = "select * from SMS_FullCollectionMembership WHERE Name LIKE '" +  name + "'";
                 SccmDevice cmresource = new SccmDevice();
                 int count = 0;
                 // Run query
@@ -302,7 +302,7 @@
         {
             try
             {
-                string query = "select * from SMS_FullCollectionMembership WHERE SMSID='" + name.Replace(@"\",@"\\") + "'";
+                string query = "select * from SMS_FullCollectionMembership WHERE SMSID LIKE '" + name.Replace(@"\",@"\\") + "'";
                 SccmUser cmresource = new SccmUser();
                 int count = 0;
                 // Run query


修复MPQ Session错误的问题

修复MPQ Session错误的问题

--- src/Newbe.Mahua.MPQ/QqProvider.cs
+++ src/Newbe.Mahua.MPQ/QqProvider.cs
@@ -1,5 +1,4 @@
-using Newbe.Mahua.Logging;
-using Newbe.Mahua.MPQ.NativeApi;
+using Newbe.Mahua.MPQ.NativeApi;
 using System;

 namespace Newbe.Mahua.MPQ
@@ -14,18 +13,15 @@
             _mpqApi = mpqApi;
         }

-        // TODO 需要测试
         public Func<string> DefaultQqProvider => () =>
         {
             var apiGetOnlineQQlist = _mpqApi.Api_GetOnlineQQlist();
-            LogProvider.For<QqProvider>().Info($" get qq list {apiGetOnlineQQlist}");
-            return string.Empty;
+            return apiGetOnlineQQlist;
         };

         public bool CheckQq(string qq)
         {
-            // TODO 需要实现
-            return false;
+            return DefaultQqProvider() == qq;
         }
     }
 }


add source info for dfm code renderer. (#1624)

--- src/Microsoft.DocAsCode.Dfm/DfmCodeRenderer.cs
+++ src/Microsoft.DocAsCode.Dfm/DfmCodeRenderer.cs
@@ -82,7 +82,9 @@

         public virtual StringBuffer RenderOpenPreTag(StringBuffer result, DfmFencesToken token, Options options)
         {
-            return result + "<pre>";
+            result += "<pre";
+            result = HtmlRenderer.AppendSourceInfo(result, options, token);
+            return result + ">";
         }

         public virtual StringBuffer RenderClosePreTag(StringBuffer result, DfmFencesToken token, Options options)


Restore hashrate interval

Restore hashrate interval

--- src/MiningCore/Blockchain/Monero/MoneroPool.cs
+++ src/MiningCore/Blockchain/Monero/MoneroPool.cs
@@ -344,7 +344,7 @@
             base.SetupStats();

             // Pool Hashrate
-            var poolHashRateSampleIntervalSeconds = 60;
+            var poolHashRateSampleIntervalSeconds = 60 * 10;

             disposables.Add(validSharesSubject
                 .Buffer(TimeSpan.FromSeconds(poolHashRateSampleIntervalSeconds))


Reacting to ForeignKey API change.

Reacting to ForeignKey API change.

--- src/MusicStore.Spa/Models/MusicStoreContext.cs
+++ src/MusicStore.Spa/Models/MusicStoreContext.cs
@@ -47,17 +47,16 @@
             builder.Entity<CartItem>().Key(ci => ci.CartItemId);
             builder.Entity<OrderDetail>().Key(od => od.OrderDetailId);

-            builder.Entity<Album>()
-                .ForeignKeys(kb =>
+            builder.Entity<Album>(b =>
                 {
-                    kb.ForeignKey<Genre>(a => a.GenreId);
-                    kb.ForeignKey<Artist>(a => a.ArtistId);
+                    b.ForeignKey<Genre>(a => a.GenreId);
+                    b.ForeignKey<Artist>(a => a.ArtistId);
                 });
-            builder.Entity<OrderDetail>()
-                .ForeignKeys(kb =>
+
+            builder.Entity<OrderDetail>(b =>
                 {
-                    kb.ForeignKey<Album>(a => a.AlbumId);
-                    kb.ForeignKey<Order>(a => a.OrderId);
+                    b.ForeignKey<Album>(a => a.AlbumId);
+                    b.ForeignKey<Order>(a => a.OrderId);
                 });

             var genre = builder.Model.GetEntityType(typeof(Genre));


Improve unused exception test.

Improve unused exception test.

--- src/NConsole.Tests/UnexpectedArgumentsTests.cs
+++ src/NConsole.Tests/UnexpectedArgumentsTests.cs
@@ -58,13 +58,13 @@
             ////Act
             try
             {
-                var result = await processor.ProcessAsync(new string[] { "test", "first", "second", "third" });
+                var result = await processor.ProcessAsync(new string[] { "test", "first", "second", "/third:third", "/Fourth" });
                 var command = (MyArgumentCommand)result.Last().Command;
                 Assert.Fail();
             }
             catch (UnusedArgumentException ex)
             {
-                Assert.AreEqual(ex.Message, "Unrecognised arguments are present: [second, third]");
+                Assert.AreEqual(ex.Message, "Unrecognised arguments are present: [second, /third:third, /Fourth]");
             }
         }


Add license header

Add license header

--- Helper/ISelection.cs
+++ Helper/ISelection.cs
@@ -1,6 +1,8 @@
-using System;
+// <copyright file="ISelection.cs" company="Public Domain">
+//     Copyright (c) 2017 Nelson Garcia.
+// </copyright>
+
 using System.Collections.Generic;
-using System.Text;

 namespace Helper
 {


NH-741 using a parameter inside a function in order by clause.

SVN: 488784591515bd4cdaa016be4ec9b172dc4e7caf@2478

--- src/NHibernate.Test/Legacy/MasterDetailTest.cs
+++ src/NHibernate.Test/Legacy/MasterDetailTest.cs
@@ -1292,7 +1292,7 @@
 			using (ISession s = OpenSession())
 			{
 				s.CreateQuery(
-					"select m from Master m order by m.id + :param")
+					"select m from Master m order by m.id + cast(:param as integer)")
 					.SetParameter("param", 10, NHibernateUtil.Int32)
 					.List();
 			}


Per message culture

Per message culture

--- HitagiBot/Program.cs
+++ HitagiBot/Program.cs
@@ -1,4 +1,5 @@
 using System;
+using System.Globalization;
 using System.IO;
 using System.Text;
 using System.Threading.Tasks;
@@ -77,6 +78,8 @@
             if ((DateTime.Now - message.Date).TotalMinutes > 1)
                 return;

+            CultureInfo.CurrentCulture = new CultureInfo(message.From.LanguageCode);
+
             if (!string.IsNullOrWhiteSpace(message.Text))
                 _messageHandler.Run(botHandle, message, message.Text).FireAndForget(botHandle, message);
         }


usings

usings

--- src/Package/Impl/Expansions/ExpansionClient.cs
+++ src/Package/Impl/Expansions/ExpansionClient.cs
@@ -2,14 +2,10 @@
 // Licensed under the MIT License. See LICENSE in the project root for license information.

 using System.Collections.Generic;
-using Microsoft.Common.Core;
 using Microsoft.Languages.Core.Text;
 using Microsoft.Languages.Editor.Extensions;
 using Microsoft.Languages.Editor.Text;
 using Microsoft.R.Components.Extensions;
-using Microsoft.R.Core.AST.Expressions;
-using Microsoft.R.Core.AST.Scopes;
-using Microsoft.R.Core.Parser;
 using Microsoft.R.Core.Tokens;
 using Microsoft.R.Editor;
 using Microsoft.R.Editor.Document;


prevent cross-thread operation of taskbarProgress in WorkingForm

--- mp4box/WorkingForm.cs
+++ mp4box/WorkingForm.cs
@@ -52,6 +52,7 @@
             bgworker.DoWork += bgworker_DoWork;
             bgworker.WorkerReportsProgress = true;
             bgworker.ProgressChanged += bgworker_ProgressChanged;
+            bgworker.RunWorkerCompleted += bgworker__RunWorkerCompleted;
             bgworker.WorkerSupportsCancellation = true;
         }

@@ -224,7 +225,7 @@
             /// </remarks>
             private const string fileRegStr = @"-o ""(?<fileOut>[^""]+)"" ""(?<fileIn>[^""]+)""|ffmpeg.exe[""]? -i ""(?<fileIn>[^""]+)""";
             //private const string fileRegStr = @">""(?<workDIR>[^""]+)\\x264.+-o ""(?<fileOut>[^""]+)"" ""(?<fileIn>[^""]+)""";
-
+
             /// <summary>
             /// Filename and working directory Regex.
             ///     Available patterns: workDIR, fileOut, fileIn.
@@ -236,7 +237,7 @@

             private const string fileCompletedRegStr = @"echo ===== one file is completed! =====";
             public static readonly Regex fileCompletedReg = new Regex(fileCompletedRegStr, RegexOptions.Singleline);
-
+
             /// <summary>
             /// ffmpeg -i sample output:
             /// <para>Duration: 00:02:20.22, start: 0.000000, bitrate: 827 kb/s</para>
@@ -392,6 +393,12 @@
             UpdateProgress((double)e.UserState);
         }

+        void bgworker__RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
+        {
+            if (win7supported)
+                taskbarProgress.SetProgressState(this.Handle, TBPFLAG.TBPF_NOPROGRESS);
+        }
+
         #endregion

         /// <summary>
@@ -404,8 +411,7 @@
             buttonAbort.InvokeIfRequired(() =>
                 buttonAbort.Enabled = false);
             UpdateProgress(1);
-            if (win7supported)
-                taskbarProgress.SetProgressState(this.Handle, TBPFLAG.TBPF_NOPROGRESS);
+
             // wait a little bit for the last asynchronous reading
             System.Threading.Thread.Sleep(75);
             // append finish tag
@@ -566,12 +572,25 @@
                 progressBarX264.Value = Convert.ToInt32(value * progressBarX264.Maximum));
             labelProgress.InvokeIfRequired(() =>
                 labelProgress.Text = value.ToString("P"));
+
             if (win7supported)
-                taskbarProgress.SetProgressValue(this.Handle,
-                    Convert.ToUInt64(value * progressBarX264.Maximum), Convert.ToUInt64(progressBarX264.Maximum));
+                UpdateTaskBar(value);

             notifyIcon.Text = "小丸工具箱" + Environment.NewLine +
                 labelworkCount.Text + " - " + labelProgress.Text;
+        }
+
+        public void UpdateTaskBar(double value)
+        {
+            if (this.InvokeRequired)
+            {
+                this.Invoke(new MethodInvoker(delegate { UpdateTaskBar(value); }));
+            }
+            else
+            {
+                taskbarProgress.SetProgressValue(this.Handle,
+                                  Convert.ToUInt64(value * progressBarX264.Maximum), Convert.ToUInt64(progressBarX264.Maximum));
+            }
         }

         /// <summary>


Unit tests part 1 of 500

Unit tests part 1 of 500

--- src/Production/DataCloner.Tests/ClonerTests.cs
+++ src/Production/DataCloner.Tests/ClonerTests.cs
@@ -24,11 +24,12 @@
             _cache = CreateCache();

             _queryHelper = Substitute.For<IQueryHelper>();
-            _queryHelper.Select(NewRi(0, "", "", "customer", new ColumnsWithValue { { "pk", 1 } }))
-                        .Returns(new object[][] {new object[] {1,2,3} });
+            _queryHelper.Select(NewRi(0, "", "", "customer", new ColumnsWithValue { { "id", 1 } }))
+                        .Returns(new[] { new object[] { 1, 2, 3 } });

             _queryDispatcher = Substitute.For<IQueryDispatcher>();
             _queryDispatcher.GetQueryHelper(0).Returns(_queryHelper);
+            _queryDispatcher.GetQueryHelper(Arg.Is<IRowIdentifier>(r => r.ServerId == 0)).Returns(_queryHelper);

             _cloner = new Cloner(_queryDispatcher, (a, b, c, d, e, f) => _cache);
             _cloner.Config = new Configuration();
@@ -47,18 +48,41 @@
             };
         }

+
         [Fact]
-        public void TestFakeObjectsInitializedForCloner()
+        public void QueryDispatcherCalledWithRowIdentifierFromExtensionReturnData()
         {
-            var row = NewRi(0, "", "", "customer", new ColumnsWithValue {{"id", 1}});
+            var row = NewRi(0, "", "", "customer", new ColumnsWithValue { { "id", 1 } });
             var result = _queryDispatcher.Select(row);

-            _queryDispatcher.Received();
-            _queryDispatcher.Received().GetQueryHelper(Arg.Any<short>());
-            _queryDispatcher.Received().GetQueryHelper(0);
+            _queryDispatcher.Received().GetQueryHelper(row);
+            _queryHelper.Received().Select(row);

-            _queryHelper.Received().Select(Arg.Any<IRowIdentifier>());
-            _queryHelper.Received().Select(NewRi(0, "", "", "customer", new ColumnsWithValue { { "id", 1 } }));
+            Assert.Equal(new[] { new object[] { 1, 2, 3 } }, result);
+        }
+
+        [Fact]
+        public void QueryDispatcherCalledWithRowIdentifierReturnData()
+        {
+            var row = NewRi(0, "", "", "customer", new ColumnsWithValue { { "id", 1 } });
+            var result = _queryDispatcher.GetQueryHelper(row).Select(row);
+
+            _queryDispatcher.Received().GetQueryHelper(row);
+            _queryHelper.Received().Select(row);
+
+            Assert.Equal(new[] { new object[] { 1, 2, 3 } }, result);
+        }
+
+        [Fact]
+        public void QueryDispatcherCalledWithIntegerReturnGoodData()
+        {
+            var row = NewRi(0, "", "", "customer", new ColumnsWithValue { { "id", 1 } });
+            var result = _queryDispatcher.GetQueryHelper(0).Select(row);
+
+            _queryDispatcher.Received().GetQueryHelper(row.ServerId);
+            _queryHelper.Received().Select(row);
+
+            Assert.Equal(new[] { new object[] { 1, 2, 3 } }, result);
         }

         [Fact]


Removed duplicate exports

Removed duplicate exports

--- iOS/MaterialComponents/source/MaterialComponents/ContainerScheme.cs
+++ iOS/MaterialComponents/source/MaterialComponents/ContainerScheme.cs
@@ -78,7 +78,7 @@
 		[BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
 		public virtual SemanticColorScheme ColorScheme
 		{
-			[Export("colorScheme", ArgumentSemantic.UnsafeUnretained)]
+			//[Export("colorScheme", ArgumentSemantic.UnsafeUnretained)]
 			get
 			{
 				SemanticColorScheme ret;
@@ -120,7 +120,7 @@
 		[BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
 		public virtual ShapeScheme ShapeScheme
 		{
-			[Export("shapeScheme", ArgumentSemantic.UnsafeUnretained)]
+			//[Export("shapeScheme", ArgumentSemantic.UnsafeUnretained)]
 			get
 			{
 				ShapeScheme ret;
@@ -161,7 +161,7 @@
 		[BindingImpl(BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
 		public virtual TypographyScheme TypographyScheme
 		{
-			[Export("typographyScheme", ArgumentSemantic.UnsafeUnretained)]
+			//[Export("typographyScheme", ArgumentSemantic.UnsafeUnretained)]
 			get
 			{
 				TypographyScheme ret;


remove flaky test

remove flaky test

--- tests/AcceptanceTests/MandrillAcceptanceTests.cs
+++ tests/AcceptanceTests/MandrillAcceptanceTests.cs
@@ -46,21 +46,6 @@
                            && c.Replies[0].Response.Email == "recipient@mandrill.com"
                            && (c.Replies[0].Response.Status == MandrillSendMessageResponseStatus.Sent ||
                                c.Replies[0].Response.Status == MandrillSendMessageResponseStatus.Queued))
-                .Run();
-        }
-
-        [Test]
-        public void When_sending_invalid_request_error_is_thrown()
-        {
-            var badtemplate = Guid.NewGuid().ToString("N");
-            Scenario.Define<Context>()
-                .WithEndpoint<MandrillEndpointWithReply>(builder => builder
-                    .Given(bus =>
-                    {
-                        bus.SendEmailTemplate(new MandrillMessage(), badtemplate);
-                    }))
-                .AllowExceptions()
-                .Done(c => c.Exceptions?.IndexOf("Unknown_Template", StringComparison.Ordinal) > -1)
                 .Run();
         }


Use vbc options in vbc test cases.

Use vbc options in vbc test cases.

--- tests/Buildalyzer.Tests/AnalyzerResultFixture.cs
+++ tests/Buildalyzer.Tests/AnalyzerResultFixture.cs
@@ -12,6 +12,7 @@
     public class AnalyzerResultFixture
     {
         private const string CscOptions = "/noconfig /unsafe- /checked- /nowarn:1701,1702,1701,1702,1701,1702 /nostdlib+ /errorreport:prompt /warn:4 /define:TRACE;DEBUG;NETCOREAPP;NETCOREAPP2_1 ";
+        private const string VbcOptions = "/noconfig /imports:Microsoft.VisualBasic,System,System.Collections,System.Collections.Generic,System.Diagnostics,System.Linq,System.Xml.Linq,System.Threading.Tasks /optioncompare:Binary /optionexplicit+ /optionstrict:custom /nowarn:41999,42016,42017,42018,42019,42020,42021,42022,42032,42036 /nosdkpath /optioninfer+ /nostdlib /errorreport:prompt /rootnamespace:ConsoleApp21 /highentropyva+ /define:CONFIG=Debug,DEBUG=-1 /warnaserror+:NU1605 ";

         [TestCase("foo.cs", new[] { "foo.cs" })]
         [TestCase("foo.cs bar.cs", new[] { "foo.cs", "bar.cs" })]
@@ -129,7 +130,7 @@
         {
             // Given
             string commandLine = Path.Combine("/", "Fizz", "Buzz", "vbc.exe") + " "
-                + CscOptions
+                + VbcOptions
                 + input;

             // When
@@ -138,7 +139,7 @@
             // Then
             result.Command.ShouldBe(commandLine);
             result.FileName.ShouldBe(Path.Combine("/", "Fizz", "Buzz", "vbc.exe"));
-            result.Arguments.ShouldBe(CscOptions.Split(' ', StringSplitOptions.RemoveEmptyEntries).Concat(sourceFiles));
+            result.Arguments.ShouldBe(VbcOptions.Split(' ', StringSplitOptions.RemoveEmptyEntries).Concat(sourceFiles));
             result.ProcessedArguments.Where(x => x.Item1 == null).Select(x => x.Item2).Skip(1).ShouldBe(sourceFiles);
         }

@@ -149,7 +150,7 @@
         {
             // Given
             commandLine = Path.Combine("/", "Fizz", "Buzz", "vbc.exe") + " "
-                + CscOptions
+                + VbcOptions
                 + commandLine;
             string projectFilePath = Path.Combine("/", "Code", "Project", "project.vbproj");
             AnalyzerResult result = new AnalyzerResult(projectFilePath, null, null);


Small name change

Small name change

--- src/Q42.HueApi.Streaming/StreamingHueClient.cs
+++ src/Q42.HueApi.Streaming/StreamingHueClient.cs
@@ -79,15 +79,15 @@
     /// <summary>
     /// Auto update the streamgroup
     /// </summary>
-    /// <param name="entGroup"></param>
+    /// <param name="streamingGroup"></param>
     /// <param name="frequency"></param>
     /// <param name="onlySendDirtyStates">Only send light states that have been changed since last update</param>
     /// <param name="cancellationToken"></param>
-    public void AutoUpdate(StreamingGroup entGroup, CancellationToken cancellationToken, int frequency = 50, bool onlySendDirtyStates = false)
+    public void AutoUpdate(StreamingGroup streamingGroup, CancellationToken cancellationToken, int frequency = 50, bool onlySendDirtyStates = false)
     {
       if (!_simulator)
       {
-        int groupCount = (entGroup.Count / 10) + 1;
+        int groupCount = (streamingGroup.Count / 10) + 1;
         frequency = frequency / groupCount;
       }
       else
@@ -102,7 +102,7 @@
         {
           var sw = Stopwatch.StartNew();

-          IEnumerable<IEnumerable<StreamingLight>> chunks = entGroup.GetChunksForUpdate(forceUpdate: !onlySendDirtyStates);
+          IEnumerable<IEnumerable<StreamingLight>> chunks = streamingGroup.GetChunksForUpdate(forceUpdate: !onlySendDirtyStates);
           if (chunks != null)
           {
             Send(chunks);
@@ -113,7 +113,7 @@
             if (missedMessages > frequency)
             {
               //If there are no updates, still send updates to keep connection open
-              chunks = entGroup.GetChunksForUpdate(forceUpdate: true);
+              chunks = streamingGroup.GetChunksForUpdate(forceUpdate: true);
               Send(chunks);
               missedMessages = 0;
             }


Fix for deserializing string-like values. This removes the surrounding double-quotes around strings that aren't part of the original value.

--- RestSharp/Extensions/MiscExtensions.cs
+++ RestSharp/Extensions/MiscExtensions.cs
@@ -78,7 +78,7 @@
 		/// <returns></returns>
 		public static string AsString(this JToken token)
 		{
-			return token.ToString();
+			return token.Value<string>();
 		}
 	}
 }


Fix unintentional copypasta.

Fix unintentional copypasta.

--- src/SJP.Schematic.MySql/MySqlDbTypeProvider.cs
+++ src/SJP.Schematic.MySql/MySqlDbTypeProvider.cs
@@ -227,17 +227,7 @@
             "bit",
             "tinyint",
             "smallint",
-            "mediumint",/// <summary>
-        /// Gets the CLR type for the associated type name.
-        /// </summary>
-        /// <param name="typeName">A type name.</param>
-        /// <returns>A CLR type for the associated database type.</returns>
-        /// <exception cref="ArgumentNullException"><paramref name="typeName"/> is <c>null</c>, empty or whitespace.</exception>/// <summary>
-        /// Gets the CLR type for the associated type name.
-        /// </summary>
-        /// <param name="typeName">A type name.</param>
-        /// <returns>A CLR type for the associated database type.</returns>
-        /// <exception cref="ArgumentNullException"><paramref name="typeName"/> is <c>null</c>, empty or whitespace.</exception>
+            "mediumint",
             "int",
             "bigint",
             "double",


ZeroOrMore/OneOrMore parser repeaters produce an IReadOnlyList<TValue> rather than an IEnumerable<TValue>, because the realized collection is in fact known in a List<TValue> already and because IReadOnlyList provides more useful/efficient access of the items at the call site vs IEnumerable.

--- src/Parsley/Grammar.Repetition.cs
+++ src/Parsley/Grammar.Repetition.cs
@@ -46,9 +46,9 @@
     /// end of the sequence, p must fail without consuming input, otherwise the
     /// sequence will fail with the error reported by p.
     /// </summary>
-    public static Parser<TItem, IEnumerable<TValue>> ZeroOrMore<TItem, TValue>(Parser<TItem, TValue> item)
-    {
-        return (ReadOnlySpan<TItem> input, ref int index, [NotNullWhen(true)] out IEnumerable<TValue>? values, [NotNullWhen(false)] out string? expectation) =>
+    public static Parser<TItem, IReadOnlyList<TValue>> ZeroOrMore<TItem, TValue>(Parser<TItem, TValue> item)
+    {
+        return (ReadOnlySpan<TItem> input, ref int index, [NotNullWhen(true)] out IReadOnlyList<TValue>? values, [NotNullWhen(false)] out string? expectation) =>
         {
             var accumulator = new List<TValue>();

@@ -59,9 +59,9 @@
     /// <summary>
     /// OneOrMore(p) behaves like ZeroOrMore(p), except that p must succeed at least one time.
     /// </summary>
-    public static Parser<TItem, IEnumerable<TValue>> OneOrMore<TItem, TValue>(Parser<TItem, TValue> item)
-    {
-        return (ReadOnlySpan<TItem> input, ref int index, [NotNullWhen(true)] out IEnumerable<TValue>? values, [NotNullWhen(false)] out string? expectation) =>
+    public static Parser<TItem, IReadOnlyList<TValue>> OneOrMore<TItem, TValue>(Parser<TItem, TValue> item)
+    {
+        return (ReadOnlySpan<TItem> input, ref int index, [NotNullWhen(true)] out IReadOnlyList<TValue>? values, [NotNullWhen(false)] out string? expectation) =>
         {
             var accumulator = new List<TValue>();

@@ -85,9 +85,9 @@
     /// ZeroOrMore(p, s) parses zero or more occurrences of p separated by occurrences of s,
     /// returning the list of values returned by successful applications of p.
     /// </summary>
-    public static Parser<TItem, IEnumerable<TValue>> ZeroOrMore<TItem, TValue, S>(Parser<TItem, TValue> item, Parser<TItem, S> separator)
-    {
-        return (ReadOnlySpan<TItem> input, ref int index, [NotNullWhen(true)] out IEnumerable<TValue>? values, [NotNullWhen(false)] out string? expectation) =>
+    public static Parser<TItem, IReadOnlyList<TValue>> ZeroOrMore<TItem, TValue, S>(Parser<TItem, TValue> item, Parser<TItem, S> separator)
+    {
+        return (ReadOnlySpan<TItem> input, ref int index, [NotNullWhen(true)] out IReadOnlyList<TValue>? values, [NotNullWhen(false)] out string? expectation) =>
         {
             var accumulator = new List<TValue>();
             var originalIndex = index;
@@ -125,9 +125,9 @@
     /// <summary>
     /// OneOrMore(p, s) behaves like ZeroOrMore(p, s), except that p must succeed at least one time.
     /// </summary>
-    public static Parser<TItem, IEnumerable<TValue>> OneOrMore<TItem, TValue, S>(Parser<TItem, TValue> item, Parser<TItem, S> separator)
-    {
-        return (ReadOnlySpan<TItem> input, ref int index, [NotNullWhen(true)] out IEnumerable<TValue>? values, [NotNullWhen(false)] out string? expectation) =>
+    public static Parser<TItem, IReadOnlyList<TValue>> OneOrMore<TItem, TValue, S>(Parser<TItem, TValue> item, Parser<TItem, S> separator)
+    {
+        return (ReadOnlySpan<TItem> input, ref int index, [NotNullWhen(true)] out IReadOnlyList<TValue>? values, [NotNullWhen(false)] out string? expectation) =>
         {
             var accumulator = new List<TValue>();

@@ -156,7 +156,7 @@
                                       Parser<TItem, TValue> item,
                                       ReadOnlySpan<TItem> input,
                                       ref int index,
-                                      [NotNullWhen(true)] out IEnumerable<TValue>? values,
+                                      [NotNullWhen(true)] out IReadOnlyList<TValue>? values,
                                       [NotNullWhen(false)] out string? expectation)
     {
         var oldIndex = index;


Fixed whitelist loading

Fixed whitelist loading

--- src/ServiceBase/Plugins/PluginAssembyLoader.cs
+++ src/ServiceBase/Plugins/PluginAssembyLoader.cs
@@ -56,13 +56,13 @@
             foreach (string pluginPath in Directory.GetDirectories(basePath))
             {
                 string dirName = Path.GetFileName(
-                    basePath.RemoveTrailingSlash());
+                    pluginPath.RemoveTrailingSlash());

                 string listItem = list.FirstOrDefault(s => s.Equals(
                     dirName,
                     StringComparison.InvariantCultureIgnoreCase));

-                if (string.IsNullOrWhiteSpace(listItem))
+                if (!String.IsNullOrWhiteSpace(listItem))
                 {
                     list.Remove(listItem);


Make download progress reach 100% reliably

--- src/Squirrel/UpdateManager.DownloadReleases.cs
+++ src/Squirrel/UpdateManager.DownloadReleases.cs
@@ -40,6 +40,16 @@
                                 progress((int)Math.Round(current += component));
                             }
                         });
+						// With a lot of small updates, and since notifications are only sent every half second
+						// for each one, we can easily miss half or more of the progress on each download.
+						// To make sure we eventually get to 100% of the whole process, we need to update
+						// progress (and especially the total in current) to indicate that this one is complete.
+						lock (progress)
+						{
+							current -= component;
+							component = toIncrement;
+							progress((int)Math.Round(current += component));
+						}
                     });
                 } else {
                     // From Disk


force build

force build

--- src/Q42.HueApi.Tests/GroupTest.cs
+++ src/Q42.HueApi.Tests/GroupTest.cs
@@ -85,7 +85,6 @@
       Assert.IsNotNull(group);
       Assert.IsTrue(group.Lights.Count == 2);

-
     }
   }
 }


change: SourcePart: Support negtive Length at ctor

--- src/Reni/hw/Scanner/SourcePart.cs
+++ src/Reni/hw/Scanner/SourcePart.cs
@@ -31,8 +31,16 @@
         SourcePart(Source source, int position, int length)
         {
             Source = source;
-            Length = length;
-            Position = position;
+            if(length >= 0)
+            {
+                Length = length;
+                Position = position;
+            }
+            else
+            {
+                Length = -length;
+                Position = position + length;
+            }
         }

         [DisableDump]
@@ -64,7 +72,7 @@

             var start = Math.Min(Position, other.Position);
             var end = Math.Max(EndPosition, other.EndPosition);
-            return new SourcePart(Source, start, end - start);
+            return new(Source, start, end - start);
         }

         public SourcePart Intersect(SourcePart other)
@@ -98,17 +106,16 @@
         {
             (Source == other.Source).Assert();
             (EndPosition <= other.Position).Assert();
-            return new SourcePart(Source, Position, other.EndPosition - Position);
+            return new(Source, Position, other.EndPosition - Position);
         }

         public static SourcePart Span(SourcePosition first, SourcePosition other)
         {
             var length = other - first;
-            return new SourcePart(first.Source, first.Position, length);
-        }
-
-        public static SourcePart Span(SourcePosition first, int length)
-            => new SourcePart(first.Source, first.Position, length);
+            return new(first.Source, first.Position, length);
+        }
+
+        public static SourcePart Span(SourcePosition first, int length) => new(first.Source, first.Position, length);

         public bool Contains(SourcePosition sourcePosition)
             => Source == sourcePosition.Source &&
@@ -138,23 +145,23 @@
         public static bool operator !=(SourcePart left, SourcePart right) => !(left == right);

         public static bool operator >(SourcePart left, SourcePosition right) => right < left;
+
         public static bool operator >(SourcePosition left, SourcePart right) => right < left;
+
         public static bool operator >(SourcePart left, SourcePart right) => right < left;

-        public static bool operator <(SourcePart left, SourcePosition right)
-            => left != null && left.End < right;
-
-        public static bool operator <(SourcePosition left, SourcePart right)
-            => right != null && left < right.Start;
+        public static bool operator <(SourcePart left, SourcePosition right) => left != null && left.End < right;
+
+        public static bool operator <(SourcePosition left, SourcePart right) => right != null && left < right.Start;

         public static bool operator <(SourcePart left, SourcePart right)
             => left != null && right != null && left.End <= right.Start;

         public static bool operator ==(SourcePart left, SourcePart right)
         {
-            if((object)left == null)
-                return (object)right == null;
-            if((object)right == null)
+            if((object) left == null)
+                return (object) right == null;
+            if((object) right == null)
                 return false;

             return left.Start == right.Start &&
@@ -190,9 +197,11 @@
             yield return currentValue;
         }

-        bool Equals(SourcePart other) => Length == other.Length && Position == other.Position && Equals(Source, other.Source);
-
-        public override bool Equals(object obj) => ReferenceEquals(this, obj) || obj is SourcePart other && Equals(other);
+        bool Equals(SourcePart other)
+            => Length == other.Length && Position == other.Position && Equals(Source, other.Source);
+
+        public override bool Equals(object obj)
+            => ReferenceEquals(this, obj) || obj is SourcePart other && Equals(other);

         public override int GetHashCode()
         {


* Removed erroneous mention

* Removed erroneous mention

--- RobIII/Views/Static/WallOfShame.cshtml
+++ RobIII/Views/Static/WallOfShame.cshtml
@@ -67,7 +67,6 @@

Stijn Grove - MCXess

-
Leendert Klaasen - Qualitrol Generation (Iris Power & PDTech)

Mario John Lemmers - MP Recruitment

                 Kirsten Tol - .NET Professionals


Fixed broken ui

Fixed broken ui

--- src/VisualJsonEditor/Models/JsonObjectModel.cs
+++ src/VisualJsonEditor/Models/JsonObjectModel.cs
@@ -84,7 +84,7 @@

                     result[property.Key] = list;
                 }
-                else if (propertySchema.Type.HasFlag(JsonObjectType.Object) || propertySchema.Type.HasFlag(JsonObjectType.None))
+                else if (propertySchema.Type.HasFlag(JsonObjectType.Object) || propertySchema.Type == JsonObjectType.None)
                 {
                     var token = obj[property.Key];
                     if (token is JObject)


Reorder notification context menu to place relevant items on top

Closes #81


Bind to 127.0.0.1

Bind to 127.0.0.1

--- SOVND.Server/Settings/RedisProvider.cs
+++ SOVND.Server/Settings/RedisProvider.cs
@@ -18,7 +18,7 @@

         public RedisProvider()
         {
-            _redis = ConnectionMultiplexer.Connect("localhost");
+            _redis = ConnectionMultiplexer.Connect("127.0.0.1");
         }
     }
 }


double to decimal for exponent floats in json

--- KiteConnect/Utils.cs
+++ KiteConnect/Utils.cs
@@ -63,7 +63,42 @@
         {
             var jss = new JavaScriptSerializer();
             Dictionary<string, dynamic> dict = jss.Deserialize<Dictionary<string, dynamic>>(Json);
+            // Replace double with decimal in the map
+            dict = DoubleToDecimal(dict);
             return dict;
+        }
+
+        /// <summary>
+        /// Recursively traverses an object and converts double fields to decimal.
+        /// This is used in Json deserialization. JavaScriptSerializer converts floats
+        /// in exponential notation to double and everthing else to double. This function
+        /// makes everything decimal. Currently supports only Dictionary and Array as input.
+        /// </summary>
+        /// <param name="obj">Input object.</param>
+        /// <returns>Object with decimals instead of doubles</returns>
+        public static dynamic DoubleToDecimal(dynamic obj)
+        {
+            if (obj is double)
+            {
+                obj = Convert.ToDecimal(obj);
+            }
+            else if (obj is IDictionary)
+            {
+                var keys = new List<string>(obj.Keys);
+                for (int i = 0; i < keys.Count; i++)
+                {
+                    obj[keys[i]] = DoubleToDecimal(obj[keys[i]]);
+                }
+            }
+            else if (obj is ICollection)
+            {
+                obj = new ArrayList(obj);
+                for (int i = 0; i < obj.Count; i++)
+                {
+                    obj[i] = DoubleToDecimal(obj[i]);
+                }
+            }
+            return obj;
         }

         /// <summary>


Main modified

Main modified

--- KotoriCore/Kotori.cs
+++ KotoriCore/Kotori.cs
@@ -4,8 +4,7 @@
 using KotoriCore.Database;
 using KotoriCore.Database.DocumentDb;
 using Microsoft.Extensions.Configuration;
-using System;
-using System.Linq;
+using System;

 namespace KotoriCore
 {


Remove tempUnscaleTime, it's did codes very confuse, should not over optimize :p. InitInterpResults when switch owner

--- Scripts/GameApi/LiteNetLibTransform.cs
+++ Scripts/GameApi/LiteNetLibTransform.cs
@@ -65,7 +65,6 @@
         private TransformResult endInterpResult;
         private TransformResult syncResult;
         // Optimize garbage collection
-        private float tempUnscaledTime;
         private float tempDeltaTime;

         private void Awake()
@@ -88,19 +87,22 @@

         private void Start()
         {
-            tempUnscaledTime = Time.unscaledTime;
-            tempDeltaTime = Time.deltaTime;
             InitInterpResults(syncingTransform.position, syncingTransform.rotation);
             if (IsServer)
                 Teleport(syncingTransform.position, syncingTransform.rotation);
         }

+        public override void OnSetOwnerClient(bool isOwnerClient)
+        {
+            InitInterpResults(syncingTransform.position, syncingTransform.rotation);
+        }
+
         private void InitInterpResults(Vector3 position, Quaternion rotation)
         {
             currentInterpResult = new TransformResult();
             currentInterpResult.position = position;
             currentInterpResult.rotation = rotation;
-            currentInterpResult.timestamp = tempUnscaledTime;
+            currentInterpResult.timestamp = Time.unscaledTime;
             syncResult = currentInterpResult;
             endInterpResult = currentInterpResult;
         }
@@ -130,7 +132,7 @@
                 return;
             lastClientTimestamp = result.timestamp;
             // Adding results to the results list so they can be used in interpolation process
-            result.timestamp = tempUnscaledTime;
+            result.timestamp = Time.unscaledTime;
             endInterpResult = result;
         }

@@ -152,7 +154,7 @@
             SerializeRotationAxis(writer, transformResult.rotation.eulerAngles.x, syncRotationX);
             SerializeRotationAxis(writer, transformResult.rotation.eulerAngles.y, syncRotationY);
             SerializeRotationAxis(writer, transformResult.rotation.eulerAngles.z, syncRotationZ);
-            writer.Put(tempUnscaledTime);
+            writer.Put(Time.unscaledTime);
         }

         public void Teleport(Vector3 position, Quaternion rotation)
@@ -171,7 +173,7 @@
             {
                 syncResult.position = syncingTransform.position;
                 syncResult.rotation = syncingTransform.rotation;
-                syncResult.timestamp = tempUnscaledTime;
+                syncResult.timestamp = Time.unscaledTime;
                 return true;
             }
             return false;
@@ -185,7 +187,7 @@
             SerializeRotationAxis(writer, syncingTransform.rotation.eulerAngles.x, syncRotationX);
             SerializeRotationAxis(writer, syncingTransform.rotation.eulerAngles.y, syncRotationY);
             SerializeRotationAxis(writer, syncingTransform.rotation.eulerAngles.z, syncRotationZ);
-            writer.Put(tempUnscaledTime);
+            writer.Put(Time.unscaledTime);
         }

         public override void OnDeserialize(NetDataReader reader)
@@ -199,7 +201,7 @@
                 return;
             lastServerTimestamp = result.timestamp;
             // Adding results to the results list so they can be used in interpolation process
-            result.timestamp = tempUnscaledTime;
+            result.timestamp = Time.unscaledTime;
             endInterpResult = result;
         }

@@ -283,7 +285,6 @@

         private void Update()
         {
-            tempUnscaledTime = Time.unscaledTime;
             tempDeltaTime = Time.deltaTime;
             // Sending client transform result to server
             // Don't send to server if it's server which already update transform result
@@ -302,24 +303,24 @@
                 ownerSendElapsed += tempDeltaTime;
             }

-            UpdateInterpolate();
-        }
-
-        private void UpdateInterpolate()
+            UpdateInterpolate(tempDeltaTime);
+        }
+
+        private void UpdateInterpolate(float deltaTime)
         {
             // Sending transform to all clients
             if (IsServer)
             {
                 // Interpolate transform that receives from clients
                 if (ownerClientCanSendTransform && !IsOwnerClient)
-                    Interpolate();
+                    Interpolate(deltaTime);
             }
             // Interpolating results for non-owner client objects on clients
             else if (!ownerClientCanSendTransform || !IsOwnerClient)
-                Interpolate();
-        }
-
-        private void Interpolate()
+                Interpolate(deltaTime);
+        }
+
+        private void Interpolate(float deltaTime)
         {
             if (ShouldSnap(endInterpResult.position))
             {
@@ -329,8 +330,8 @@
             }
             else if (!IsOwnerClient || !ownerClientNotInterpolate)
             {
-                currentInterpResult.position = Vector3.Lerp(currentInterpResult.position, endInterpResult.position, SendRate * tempDeltaTime);
-                currentInterpResult.rotation = Quaternion.Slerp(currentInterpResult.rotation, endInterpResult.rotation, SendRate * tempDeltaTime);
+                currentInterpResult.position = Vector3.Lerp(currentInterpResult.position, endInterpResult.position, SendRate * deltaTime);
+                currentInterpResult.rotation = Quaternion.Slerp(currentInterpResult.rotation, endInterpResult.rotation, SendRate * deltaTime);
                 Interpolate(currentInterpResult.position, currentInterpResult.rotation);
             }
         }


now only generating colors/textures from loading materials when the material shader actually has the _Color property

--- Scripts/Utils/Loading/LoadingHelper.cs
+++ Scripts/Utils/Loading/LoadingHelper.cs
@@ -1,4 +1,5 @@
 using System.Collections.Generic;
+using Software10101.Logging;
 using UnityEngine;

 namespace Software10101.Utils.Loading {
@@ -29,7 +30,8 @@
 				}
 			}
 		}
-//#else
+#endif
+
 		private void Awake () {
 			Materials.Clear();
 			Colors.Clear();
@@ -37,32 +39,43 @@
 			Prefabs.Clear();

 			foreach (Material m in MaterialInputs) {
+				Log.Info("Loading Material '" + m.name + "'...");
+
 				Materials[m.name] = m;

-				Colors[m.name] = m.color;
+				if (m.HasProperty("_Color")) {
+					Colors[m.name] = m.color;

-				Texture2D t = new Texture2D(1, 1);
-				t.SetPixel(0, 0, m.color);
-				t.Apply();
-				Textures[m.name] = t;
+					Texture2D t = new Texture2D(1, 1);
+					t.SetPixel(0, 0, m.color);
+					t.Apply();
+					Textures[m.name] = t;
+				}
 			}

 			foreach (ColorObject c in ColorsInputs) {
+				Log.Info("Loading Color '" + c.name + "'...");
+
 				Colors[c.name] = c.Color;
 			}

 			foreach (Texture2D t in TextureInputs) {
+				Log.Info("Loading Texture '" + t.name + "'...");
+
 				Textures[t.name] = t;
 			}

 			foreach (Sprite s in SpriteInputs) {
+				Log.Info("Loading Sprite '" + s.name + "'...");
+
 				Sprites[s.name] = s;
 			}

 			foreach (GameObject go in PrefabInputs) {
+				Log.Info("Loading Prefab '" + go.name + "'...");
+
 				Prefabs[go.name] = go;
 			}
 		}
-#endif
 	}
 }


Renaming of the full sort/sort all variation.

--- SortingAndPagingPerformance/Program.cs
+++ SortingAndPagingPerformance/Program.cs
@@ -29,8 +29,8 @@
         return time(sortAndPage.Name + "(Random): {0}", iterations, () => sortAndPage.SortAndPage(start, length, dataToSortAndPage));
       }).ToArray();

-      var sortAll = new SortAll();
-      var expected = time(sortAll.Name + ": {0}", 0, () => sortAll.SortAndPage(start, length, dataToSortAndPage));
+      var fullSort = new FullSort();
+      var expected = time(fullSort.Name + ": {0}", 0, () => fullSort.SortAndPage(start, length, dataToSortAndPage));

       for(var i = 0; i < actuals.Length; i++) {
         actuals[i].ShouldEqual(expected);
@@ -77,8 +77,8 @@
     Guid[] SortAndPage(int start, int length, Guid[] dataToSortAndPage);
   }

-  class SortAll : ISortAndPage {
-    public string Name { get { return "Sort All"; } }
+  class FullSort : ISortAndPage {
+    public string Name { get { return "Full Sort"; } }

     public Guid[] SortAndPage(int start, int length, Guid[] dataToSortAndPage) {
       Array.Sort(dataToSortAndPage);


Fixed a script error that would occur if you didn't have google analytics configured.

--- Source/App/Views/Account/Signup.cshtml
+++ Source/App/Views/Account/Signup.cshtml
@@ -98,8 +98,13 @@
             var form = $("#signupform");
             form.validate();
             var isValid = form.valid();
+
+    @if (Exceptionless.Core.Settings.Current.EnableGoogleAnalytics) {
+        <text>
             if (isValid)
                 ga('send', 'event', 'Signup', 'Submit');
+        </text>
+    }

             return isValid;
         }


Added some documentation

Added some documentation

--- Source/EventFlow/Core/GuidFactories.cs
+++ Source/EventFlow/Core/GuidFactories.cs
@@ -40,6 +40,17 @@
                 return DateTime.UtcNow.Ticks + i;
             }

+            /// <summary>
+            /// Generates a GUID values that causes less index fragmentation when stored
+            /// in e.g. <c>uniqueidentifier</c> columns in MSSQL.
+            /// </summary>
+            /// <example>
+            /// 2825c1d8-4587-cc55-08c1-08d6bde2765b
+            /// 901337ba-c64b-c6d4-08c2-08d6bde2765b
+            /// 45d57ba2-acc5-ce80-08c3-08d6bde2765b
+            /// 36528acf-352a-c28c-08c4-08d6bde2765b
+            /// 6fc88b5e-3782-c8fd-08c5-08d6bde2765b
+            /// </example>
             public static Guid Create()
             {
                 var uid = Guid.NewGuid().ToByteArray();
@@ -56,6 +67,17 @@
                         });
             }

+            /// <summary>
+            /// Generates a GUID values that causes less index fragmentation when stored
+            /// in e.g. <c>nvarchar(n)</c> columns in MSSQL.
+            /// </summary>
+            /// <example>
+            /// 899ee1b9-bde2-08d6-20d8-b7e20375c7c9
+            /// 899f09b9-bde2-08d6-fd1c-5ec8f3349bcf
+            /// 899f09ba-bde2-08d6-1521-51d781607ac4
+            /// 899f09bb-bde2-08d6-7e6a-fe84f5237dc4
+            /// 899f09bc-bde2-08d6-c2f0-276123e06fcf
+            /// </example>
             public static Guid CreateForString()
             {
                 /*


fixed a bug in remote page loading

fixed a bug in remote page loading


remove remaining reference to BCad.UI

remove remaining reference to BCad.UI

--- BCad/App.xaml.cs
+++ BCad/App.xaml.cs
@@ -26,8 +26,7 @@
                     currentAssembly,
                     Assembly.LoadFile(Path.Combine(assemblyDir, "BCad.Core.dll")),
                     Assembly.LoadFile(Path.Combine(assemblyDir, "BCad.Core.UI.dll")),
-                    Assembly.LoadFile(Path.Combine(assemblyDir, "BCad.FileHandlers.dll")),
-                    Assembly.LoadFile(Path.Combine(assemblyDir, "BCad.UI.dll")),
+                    Assembly.LoadFile(Path.Combine(assemblyDir, "BCad.FileHandlers.dll"))
                 });
             Container = configuration.CreateContainer();
         }


Add Update List

Add Update List

--- Src/Asp.Net/SqlSugar/SqlSugarClient.cs
+++ Src/Asp.Net/SqlSugar/SqlSugarClient.cs
@@ -284,6 +284,11 @@
             UpdateableProvider<T> reval = base.CreateUpdateable(UpdateObjs);
             return reval;
         }
+        public virtual IUpdateable<T> Updateable<T>(List<T> UpdateObjs) where T : class, new()
+        {
+            Check.ArgumentNullException(UpdateObjs, "Updateable.UpdateObjs can't be null");
+            return Updateable(UpdateObjs.ToArray());
+        }
         public virtual IUpdateable<T> Updateable<T>(T UpdateObj) where T : class, new()
         {
             return this.Updateable(new T[] { UpdateObj });


BytesTrie refactor, using bytes internally as keys

--- Src/BlockchainSharp/Tries/BytesTrie.cs
+++ Src/BlockchainSharp/Tries/BytesTrie.cs
@@ -34,7 +34,7 @@

         public BytesTrie Put(string key, byte[] value)
         {
-            BytesTrie newtrie = this.Put(key, 0, value);
+            BytesTrie newtrie = this.Put(ToBytes(key), 0, value);

             if (newtrie == null)
                 return empty;
@@ -44,7 +44,7 @@

         public byte[] Get(string key)
         {
-            return this.Get(key, 0);
+            return this.Get(ToBytes(key), 0);
         }

         public BytesTrie Remove(string key)
@@ -52,20 +52,12 @@
             return this.Put(key, null);
         }

-        private static int GetOffset(char ch)
-        {
-            if (ch >= '0' && ch <= '9')
-                return ch - '0';
-
-            return ch - 'a' + 10;
-        }
-
-        private byte[] Get(string key, int position)
+        private byte[] Get(byte[] key, int position)
         {
             if (position == key.Length)
                 return this.value;

-            var offset = GetOffset(key[position]);
+            var offset = key[position];

             if (this.leafs == null)
                 return null;
@@ -78,12 +70,12 @@
             return trie.Get(key, position + 1);
         }

-        private BytesTrie Put(string key, int position, byte[] value)
+        private BytesTrie Put(byte[] key, int position, byte[] value)
         {
             if (position == key.Length)
                 return this.ChangeValue(value);

-            int offset = GetOffset(key[position]);
+            int offset = key[position];
             BytesTrie leaf;

             if (this.leafs != null && this.leafs[offset] != null)
@@ -159,5 +151,23 @@

             return newleafs;
         }
+
+        private static byte[] ToBytes(string key)
+        {
+            byte[] bytes = new byte[key.Length];
+
+            for (int k = 0; k < bytes.Length; k++)
+                bytes[k] = ToByte(key[k]);
+
+            return bytes;
+        }
+
+        private static byte ToByte(char ch)
+        {
+            if (ch >= '0' && ch <= '9')
+                return (byte)(ch - '0');
+
+            return (byte)(ch - 'a' + 10);
+        }
     }
 }


Drop optional parameters in Diff.cs

Drop optional parameters in Diff.cs

--- LibGit2Sharp/Diff.cs
+++ LibGit2Sharp/Diff.cs
@@ -107,14 +107,90 @@
         /// </summary>
         /// <param name="oldBlob">The <see cref="Blob"/> you want to compare from.</param>
         /// <param name="newBlob">The <see cref="Blob"/> you want to compare to.</param>
+        /// <returns>A <see cref="ContentChanges"/> containing the changes between the <paramref name="oldBlob"/> and the <paramref name="newBlob"/>.</returns>
+        public virtual ContentChanges Compare(Blob oldBlob, Blob newBlob)
+        {
+            return Compare(oldBlob, newBlob, null);
+        }
+
+        /// <summary>
+        /// Show changes between two <see cref="Blob"/>s.
+        /// </summary>
+        /// <param name="oldBlob">The <see cref="Blob"/> you want to compare from.</param>
+        /// <param name="newBlob">The <see cref="Blob"/> you want to compare to.</param>
         /// <param name="compareOptions">Additional options to define comparison behavior.</param>
         /// <returns>A <see cref="ContentChanges"/> containing the changes between the <paramref name="oldBlob"/> and the <paramref name="newBlob"/>.</returns>
-        public virtual ContentChanges Compare(Blob oldBlob, Blob newBlob, CompareOptions compareOptions = null)
+        public virtual ContentChanges Compare(Blob oldBlob, Blob newBlob, CompareOptions compareOptions)
         {
             using (GitDiffOptions options = BuildOptions(DiffModifiers.None, compareOptions: compareOptions))
             {
                 return new ContentChanges(repo, oldBlob, newBlob, options);
             }
+        }
+
+        /// <summary>
+        /// Show changes between two <see cref="Tree"/>s.
+        /// </summary>
+        /// <param name="oldTree">The <see cref="Tree"/> you want to compare from.</param>
+        /// <param name="newTree">The <see cref="Tree"/> you want to compare to.</param>
+        /// <returns>A <see cref="TreeChanges"/> containing the changes between the <paramref name="oldTree"/> and the <paramref name="newTree"/>.</returns>
+        public virtual T Compare<T>(Tree oldTree, Tree newTree) where T : class
+        {
+            return Compare<T>(oldTree, newTree, null, null, null);
+        }
+
+        /// <summary>
+        /// Show changes between two <see cref="Tree"/>s.
+        /// </summary>
+        /// <param name="oldTree">The <see cref="Tree"/> you want to compare from.</param>
+        /// <param name="newTree">The <see cref="Tree"/> you want to compare to.</param>
+        /// <param name="paths">The list of paths (either files or directories) that should be compared.</param>
+        /// <returns>A <see cref="TreeChanges"/> containing the changes between the <paramref name="oldTree"/> and the <paramref name="newTree"/>.</returns>
+        public virtual T Compare<T>(Tree oldTree, Tree newTree, IEnumerable<string> paths) where T : class
+        {
+            return Compare<T>(oldTree, newTree, paths, null, null);
+        }
+
+        /// <summary>
+        /// Show changes between two <see cref="Tree"/>s.
+        /// </summary>
+        /// <param name="oldTree">The <see cref="Tree"/> you want to compare from.</param>
+        /// <param name="newTree">The <see cref="Tree"/> you want to compare to.</param>
+        /// <param name="paths">The list of paths (either files or directories) that should be compared.</param>
+        /// <param name="explicitPathsOptions">
+        /// If set, the passed <paramref name="paths"/> will be treated as explicit paths.
+        /// Use these options to determine how unmatched explicit paths should be handled.
+        /// </param>
+        /// <returns>A <see cref="TreeChanges"/> containing the changes between the <paramref name="oldTree"/> and the <paramref name="newTree"/>.</returns>
+        public virtual T Compare<T>(Tree oldTree, Tree newTree, IEnumerable<string> paths,
+            ExplicitPathsOptions explicitPathsOptions) where T : class
+        {
+            return Compare<T>(oldTree, newTree, paths, explicitPathsOptions, null);
+        }
+
+        /// <summary>
+        /// Show changes between two <see cref="Tree"/>s.
+        /// </summary>
+        /// <param name="oldTree">The <see cref="Tree"/> you want to compare from.</param>
+        /// <param name="newTree">The <see cref="Tree"/> you want to compare to.</param>
+        /// <param name="paths">The list of paths (either files or directories) that should be compared.</param>
+        /// <param name="compareOptions">Additional options to define patch generation behavior.</param>
+        /// <returns>A <see cref="TreeChanges"/> containing the changes between the <paramref name="oldTree"/> and the <paramref name="newTree"/>.</returns>
+        public virtual T Compare<T>(Tree oldTree, Tree newTree, IEnumerable<string> paths, CompareOptions compareOptions) where T : class
+        {
+            return Compare<T>(oldTree, newTree, paths, null, compareOptions);
+        }
+
+        /// <summary>
+        /// Show changes between two <see cref="Tree"/>s.
+        /// </summary>
+        /// <param name="oldTree">The <see cref="Tree"/> you want to compare from.</param>
+        /// <param name="newTree">The <see cref="Tree"/> you want to compare to.</param>
+        /// <param name="compareOptions">Additional options to define patch generation behavior.</param>
+        /// <returns>A <see cref="TreeChanges"/> containing the changes between the <paramref name="oldTree"/> and the <paramref name="newTree"/>.</returns>
+        public virtual T Compare<T>(Tree oldTree, Tree newTree, CompareOptions compareOptions) where T : class
+        {
+            return Compare<T>(oldTree, newTree, null, null, compareOptions);
         }

         /// <summary>
@@ -129,8 +205,8 @@
         /// </param>
         /// <param name="compareOptions">Additional options to define patch generation behavior.</param>
         /// <returns>A <see cref="TreeChanges"/> containing the changes between the <paramref name="oldTree"/> and the <paramref name="newTree"/>.</returns>
-        public virtual T Compare<T>(Tree oldTree, Tree newTree, IEnumerable<string> paths = null, ExplicitPathsOptions explicitPathsOptions = null,
-            CompareOptions compareOptions = null) where T : class
+        public virtual T Compare<T>(Tree oldTree, Tree newTree, IEnumerable<string> paths, ExplicitPathsOptions explicitPathsOptions,
+            CompareOptions compareOptions) where T : class
         {
             Func<DiffSafeHandle, object> builder;

@@ -173,6 +249,64 @@
         /// </summary>
         /// <param name="oldTree">The <see cref="Tree"/> to compare from.</param>
         /// <param name="diffTargets">The targets to compare to.</param>
+        /// <typeparam name="T">Can be either a <see cref="TreeChanges"/> if you are only interested in the list of files modified, added, ..., or
+        /// a <see cref="Patch"/> if you want the actual patch content for the whole diff and for individual files.</typeparam>
+        /// <returns>A <typeparamref name="T"/> containing the changes between the <see cref="Tree"/> and the selected target.</returns>
+        public virtual T Compare<T>(Tree oldTree, DiffTargets diffTargets) where T : class
+        {
+            return Compare<T>(oldTree, diffTargets, null, null, null);
+        }
+
+        /// <summary>
+        /// Show changes between a <see cref="Tree"/> and the Index, the Working Directory, or both.
+        /// <para>
+        /// The level of diff performed can be specified by passing either a <see cref="TreeChanges"/>
+        /// or <see cref="Patch"/> type as the generic parameter.
+        /// </para>
+        /// </summary>
+        /// <param name="oldTree">The <see cref="Tree"/> to compare from.</param>
+        /// <param name="diffTargets">The targets to compare to.</param>
+        /// <param name="paths">The list of paths (either files or directories) that should be compared.</param>
+        /// <typeparam name="T">Can be either a <see cref="TreeChanges"/> if you are only interested in the list of files modified, added, ..., or
+        /// a <see cref="Patch"/> if you want the actual patch content for the whole diff and for individual files.</typeparam>
+        /// <returns>A <typeparamref name="T"/> containing the changes between the <see cref="Tree"/> and the selected target.</returns>
+        public virtual T Compare<T>(Tree oldTree, DiffTargets diffTargets, IEnumerable<string> paths) where T : class
+        {
+            return Compare<T>(oldTree, diffTargets, paths, null, null);
+        }
+
+        /// <summary>
+        /// Show changes between a <see cref="Tree"/> and the Index, the Working Directory, or both.
+        /// <para>
+        /// The level of diff performed can be specified by passing either a <see cref="TreeChanges"/>
+        /// or <see cref="Patch"/> type as the generic parameter.
+        /// </para>
+        /// </summary>
+        /// <param name="oldTree">The <see cref="Tree"/> to compare from.</param>
+        /// <param name="diffTargets">The targets to compare to.</param>
+        /// <param name="paths">The list of paths (either files or directories) that should be compared.</param>
+        /// <param name="explicitPathsOptions">
+        /// If set, the passed <paramref name="paths"/> will be treated as explicit paths.
+        /// Use these options to determine how unmatched explicit paths should be handled.
+        /// </param>
+        /// <typeparam name="T">Can be either a <see cref="TreeChanges"/> if you are only interested in the list of files modified, added, ..., or
+        /// a <see cref="Patch"/> if you want the actual patch content for the whole diff and for individual files.</typeparam>
+        /// <returns>A <typeparamref name="T"/> containing the changes between the <see cref="Tree"/> and the selected target.</returns>
+        public virtual T Compare<T>(Tree oldTree, DiffTargets diffTargets, IEnumerable<string> paths,
+            ExplicitPathsOptions explicitPathsOptions) where T : class
+        {
+            return Compare<T>(oldTree, diffTargets, paths, explicitPathsOptions, null);
+        }
+
+        /// <summary>
+        /// Show changes between a <see cref="Tree"/> and the Index, the Working Directory, or both.
+        /// <para>
+        /// The level of diff performed can be specified by passing either a <see cref="TreeChanges"/>
+        /// or <see cref="Patch"/> type as the generic parameter.
+        /// </para>
+        /// </summary>
+        /// <param name="oldTree">The <see cref="Tree"/> to compare from.</param>
+        /// <param name="diffTargets">The targets to compare to.</param>
         /// <param name="paths">The list of paths (either files or directories) that should be compared.</param>
         /// <param name="explicitPathsOptions">
         /// If set, the passed <paramref name="paths"/> will be treated as explicit paths.
@@ -182,8 +316,8 @@
         /// <typeparam name="T">Can be either a <see cref="TreeChanges"/> if you are only interested in the list of files modified, added, ..., or
         /// a <see cref="Patch"/> if you want the actual patch content for the whole diff and for individual files.</typeparam>
         /// <returns>A <typeparamref name="T"/> containing the changes between the <see cref="Tree"/> and the selected target.</returns>
-        public virtual T Compare<T>(Tree oldTree, DiffTargets diffTargets, IEnumerable<string> paths = null,
-            ExplicitPathsOptions explicitPathsOptions = null, CompareOptions compareOptions = null) where T : class
+        public virtual T Compare<T>(Tree oldTree, DiffTargets diffTargets, IEnumerable<string> paths,
+            ExplicitPathsOptions explicitPathsOptions, CompareOptions compareOptions) where T : class
         {
             Func<DiffSafeHandle, object> builder;

@@ -217,6 +351,76 @@
             {
                 return (T)builder(diff);
             }
+        }
+
+        /// <summary>
+        /// Show changes between the working directory and the index.
+        /// <para>
+        /// The level of diff performed can be specified by passing either a <see cref="TreeChanges"/>
+        /// or <see cref="Patch"/> type as the generic parameter.
+        /// </para>
+        /// </summary>
+        /// <typeparam name="T">Can be either a <see cref="TreeChanges"/> if you are only interested in the list of files modified, added, ..., or
+        /// a <see cref="Patch"/> if you want the actual patch content for the whole diff and for individual files.</typeparam>
+        /// <returns>A <typeparamref name="T"/> containing the changes between the working directory and the index.</returns>
+        public virtual T Compare<T>() where T : class
+        {
+            return Compare<T>(DiffModifiers.None);
+        }
+
+        /// <summary>
+        /// Show changes between the working directory and the index.
+        /// <para>
+        /// The level of diff performed can be specified by passing either a <see cref="TreeChanges"/>
+        /// or <see cref="Patch"/> type as the generic parameter.
+        /// </para>
+        /// </summary>
+        /// <param name="paths">The list of paths (either files or directories) that should be compared.</param>
+        /// <typeparam name="T">Can be either a <see cref="TreeChanges"/> if you are only interested in the list of files modified, added, ..., or
+        /// a <see cref="Patch"/> if you want the actual patch content for the whole diff and for individual files.</typeparam>
+        /// <returns>A <typeparamref name="T"/> containing the changes between the working directory and the index.</returns>
+        public virtual T Compare<T>(IEnumerable<string> paths) where T : class
+        {
+            return Compare<T>(DiffModifiers.None, paths);
+        }
+
+        /// <summary>
+        /// Show changes between the working directory and the index.
+        /// <para>
+        /// The level of diff performed can be specified by passing either a <see cref="TreeChanges"/>
+        /// or <see cref="Patch"/> type as the generic parameter.
+        /// </para>
+        /// </summary>
+        /// <param name="paths">The list of paths (either files or directories) that should be compared.</param>
+        /// <param name="includeUntracked">If true, include untracked files from the working dir as additions. Otherwise ignore them.</param>
+        /// <typeparam name="T">Can be either a <see cref="TreeChanges"/> if you are only interested in the list of files modified, added, ..., or
+        /// a <see cref="Patch"/> if you want the actual patch content for the whole diff and for individual files.</typeparam>
+        /// <returns>A <typeparamref name="T"/> containing the changes between the working directory and the index.</returns>
+        public virtual T Compare<T>(IEnumerable<string> paths, bool includeUntracked) where T : class
+        {
+            return Compare<T>(includeUntracked ? DiffModifiers.IncludeUntracked : DiffModifiers.None, paths);
+        }
+
+        /// <summary>
+        /// Show changes between the working directory and the index.
+        /// <para>
+        /// The level of diff performed can be specified by passing either a <see cref="TreeChanges"/>
+        /// or <see cref="Patch"/> type as the generic parameter.
+        /// </para>
+        /// </summary>
+        /// <param name="paths">The list of paths (either files or directories) that should be compared.</param>
+        /// <param name="includeUntracked">If true, include untracked files from the working dir as additions. Otherwise ignore them.</param>
+        /// <param name="explicitPathsOptions">
+        /// If set, the passed <paramref name="paths"/> will be treated as explicit paths.
+        /// Use these options to determine how unmatched explicit paths should be handled.
+        /// </param>
+        /// <typeparam name="T">Can be either a <see cref="TreeChanges"/> if you are only interested in the list of files modified, added, ..., or
+        /// a <see cref="Patch"/> if you want the actual patch content for the whole diff and for individual files.</typeparam>
+        /// <returns>A <typeparamref name="T"/> containing the changes between the working directory and the index.</returns>
+        public virtual T Compare<T>(IEnumerable<string> paths, bool includeUntracked,
+            ExplicitPathsOptions explicitPathsOptions) where T : class
+        {
+            return Compare<T>(includeUntracked ? DiffModifiers.IncludeUntracked : DiffModifiers.None, paths, explicitPathsOptions);
         }

         /// <summary>
@@ -236,8 +440,8 @@
         /// <typeparam name="T">Can be either a <see cref="TreeChanges"/> if you are only interested in the list of files modified, added, ..., or
         /// a <see cref="Patch"/> if you want the actual patch content for the whole diff and for individual files.</typeparam>
         /// <returns>A <typeparamref name="T"/> containing the changes between the working directory and the index.</returns>
-        public virtual T Compare<T>(IEnumerable<string> paths = null, bool includeUntracked = false, ExplicitPathsOptions explicitPathsOptions = null,
-            CompareOptions compareOptions = null) where T : class
+        public virtual T Compare<T>(IEnumerable<string> paths, bool includeUntracked, ExplicitPathsOptions explicitPathsOptions,
+            CompareOptions compareOptions) where T : class
         {
             return Compare<T>(includeUntracked ? DiffModifiers.IncludeUntracked : DiffModifiers.None, paths, explicitPathsOptions, compareOptions);
         }


fix(BoxSplits): Vertical: Don't Split of Direction = 0

--- CV_Processing.cs
+++ CV_Processing.cs
@@ -151,14 +151,25 @@
                 box1.X += box.Width - box1.Width;
               }

-              output.Draw( box1, bgrRed, 2 );
-              output.Draw( box2, bgrRed, 2 );
+              if (moveDirection == 0)
+              {
+                output.Draw( box1, bgrRed, 2 );

-              output.Draw(new Rectangle(Center(box1).X, Center(box1).Y, 2, 2), bgrBlu, 2);
-              output.Draw(new Rectangle(Center(box2).X, Center(box2).Y, 2, 2), bgrBlu, 2);
-
-              boxesFound.Add( box1 );
-              boxesFound.Add( box2 );
+                output.Draw(new Rectangle(Center(box1).X, Center(box1).Y, 2, 2), bgrBlu, 2);
+
+                boxesFound.Add( box1 );
+              }
+              else
+              {
+                output.Draw( box1, bgrRed, 2 );
+                output.Draw( box2, bgrRed, 2 );
+
+                output.Draw(new Rectangle(Center(box1).X, Center(box1).Y, 2, 2), bgrBlu, 2);
+                output.Draw(new Rectangle(Center(box2).X, Center(box2).Y, 2, 2), bgrBlu, 2);
+
+                boxesFound.Add( box1 );
+                boxesFound.Add( box2 );
+              }
             }
             else
             {


Replaced KeyCode consts with EnumKey values

--- FameBot/Core/Plugin.cs
+++ FameBot/Core/Plugin.cs
@@ -76,14 +76,6 @@

         #region KeyCodes
         private bool W_PRESSED, A_PRESSED, S_PRESSED, D_PRESSED;
-
-        public const int WM_KEYDOWN = 0x0100;
-        public const int WM_KEYUP = 0x0101;
-
-        public const short VK_A = 0x41;
-        public const short VK_D = 0x44;
-        public const short VK_W = 0x57;
-        public const short VK_S = 0x53;
         #endregion

         public void Initialize(Proxy proxy)
@@ -257,22 +249,22 @@
                 if (W_PRESSED)
                 {
                     W_PRESSED = false;
-                    PostMessage(flashPtr, WM_KEYUP, VK_W, 0);
+                    PostMessage(flashPtr, (uint)Key.KeyUp, (int)Key.W, 0);
                 }
                 if (A_PRESSED)
                 {
                     A_PRESSED = false;
-                    PostMessage(flashPtr, WM_KEYUP, VK_A, 0);
+                    PostMessage(flashPtr, (uint)Key.KeyUp, (int)Key.A, 0);
                 }
                 if (S_PRESSED)
                 {
                     S_PRESSED = false;
-                    PostMessage(flashPtr, WM_KEYUP, VK_S, 0);
+                    PostMessage(flashPtr, (uint)Key.KeyUp, (int)Key.S, 0);
                 }
                 if (D_PRESSED)
                 {
                     D_PRESSED = false;
-                    PostMessage(flashPtr, WM_KEYUP, VK_D, 0);
+                    PostMessage(flashPtr, (uint)Key.KeyUp, (int)Key.D, 0);
                 }
             }

@@ -294,12 +286,12 @@
                     // Move right
                     if (!D_PRESSED)
                     {
-                        PostMessage(flashPtr, WM_KEYDOWN, VK_D, 0);
+                        PostMessage(flashPtr, (uint)Key.KeyDown, (int)Key.D, 0);
                         D_PRESSED = true;
                     }
                     if (A_PRESSED)
                     {
-                        PostMessage(flashPtr, WM_KEYUP, VK_A, 0);
+                        PostMessage(flashPtr, (uint)Key.KeyUp, (int)Key.A, 0);
                         A_PRESSED = false;
                     }
                 }
@@ -307,7 +299,7 @@
                 {
                     if (D_PRESSED)
                     {
-                        PostMessage(flashPtr, WM_KEYUP, VK_D, 0);
+                        PostMessage(flashPtr, (uint)Key.KeyUp, (int)Key.D, 0);
                         D_PRESSED = false;
                     }
                 }
@@ -316,12 +308,12 @@
                     // Move left
                     if (!A_PRESSED)
                     {
-                        PostMessage(flashPtr, WM_KEYDOWN, VK_A, 0);
+                        PostMessage(flashPtr, (uint)Key.KeyDown, (int)Key.A, 0);
                         A_PRESSED = true;
                     }
                     if (D_PRESSED)
                     {
-                        PostMessage(flashPtr, WM_KEYUP, VK_D, 0);
+                        PostMessage(flashPtr, (uint)Key.KeyUp, (int)Key.D, 0);
                         D_PRESSED = false;
                     }
                 }
@@ -329,7 +321,7 @@
                 {
                     if (A_PRESSED)
                     {
-                        PostMessage(flashPtr, WM_KEYUP, VK_A, 0);
+                        PostMessage(flashPtr, (uint)Key.KeyUp, (int)Key.A, 0);
                         A_PRESSED = false;
                     }
                 }
@@ -340,12 +332,12 @@
                     // Move down
                     if (!S_PRESSED)
                     {
-                        PostMessage(flashPtr, WM_KEYDOWN, VK_S, 0);
+                        PostMessage(flashPtr, (uint)Key.KeyDown, (int)Key.S, 0);
                         S_PRESSED = true;
                     }
                     if (W_PRESSED)
                     {
-                        PostMessage(flashPtr, WM_KEYUP, VK_W, 0);
+                        PostMessage(flashPtr, (uint)Key.KeyUp, (int)Key.W, 0);
                         W_PRESSED = false;
                     }
                 }
@@ -353,7 +345,7 @@
                 {
                     if (S_PRESSED)
                     {
-                        PostMessage(flashPtr, WM_KEYUP, VK_S, 0);
+                        PostMessage(flashPtr, (uint)Key.KeyUp, (int)Key.S, 0);
                         S_PRESSED = false;
                     }
                 }
@@ -362,12 +354,12 @@
                     // Move up
                     if (!W_PRESSED)
                     {
-                        PostMessage(flashPtr, WM_KEYDOWN, VK_W, 0);
+                        PostMessage(flashPtr, (uint)Key.KeyDown, (int)Key.W, 0);
                         W_PRESSED = true;
                     }
                     if (S_PRESSED)
                     {
-                        PostMessage(flashPtr, WM_KEYUP, VK_S, 0);
+                        PostMessage(flashPtr, (uint)Key.KeyUp, (int)Key.S, 0);
                         S_PRESSED = false;
                     }
                 }
@@ -375,7 +367,7 @@
                 {
                     if (W_PRESSED)
                     {
-                        PostMessage(flashPtr, WM_KEYUP, VK_W, 0);
+                        PostMessage(flashPtr, (uint)Key.KeyUp, (int)Key.W, 0);
                         W_PRESSED = false;
                     }
                 }


databaseCheck

databaseCheck

--- TextDuck/Controllers/HomeController.cs
+++ TextDuck/Controllers/HomeController.cs
@@ -89,13 +89,12 @@
                 {
                     Title = item.FileTitle,
                     Content = result,
-                    Date = item.FileDate,
+                    Date = DateTime.Now,
                     Category = item.FileCategory,
                     Genre = item.FileGenre,
                     Status = item.FileStatus
                 };

-                item.FileDate = DateTime.Now;
                 repo.AddFile(entityObj);
                 repo.Save();
                 return RedirectToAction("Index");