#41 Replaced Command in CommandBuilder

#41 Replaced Command in CommandBuilder

--- src/Procon.Core.Shared/CommandBuilder.cs
+++ src/Procon.Core.Shared/CommandBuilder.cs
@@ -18,7 +18,7 @@
         /// <param name="group">The name of the database group to use</param>
         /// <param name="queries">The queries to send </param>
         /// <returns>The built command to dispatch</returns>
-        public static Command DatabaseQuery(String group, params IDatabaseObject[] queries) {
+        public static ICommand DatabaseQuery(String group, params IDatabaseObject[] queries) {
             return new Command() {
                 CommandType = CommandType.DatabaseQuery,
                 Parameters = new List<CommandParameter>() {
@@ -43,7 +43,7 @@
         /// </summary>
         /// <param name="queries">The queries to send </param>
         /// <returns>The built command to dispatch</returns>
-        public static Command DatabaseQuery(params IDatabaseObject[] queries) {
+        public static ICommand DatabaseQuery(params IDatabaseObject[] queries) {
             return new Command() {
                 CommandType = CommandType.DatabaseQuery,
                 Parameters = new List<CommandParameter>() {
@@ -60,7 +60,7 @@
         /// Builds a command to send a InstanceServiceRestart signal
         /// </summary>
         /// <returns>The built command to the dispatch</returns>
-        public static Command InstanceServiceRestart() {
+        public static ICommand InstanceServiceRestart() {
             return new Command() {
                 CommandType = CommandType.InstanceServiceRestart
             };
@@ -72,7 +72,7 @@
         /// <param name="uri">The uri of the repository to find the package source in</param>
         /// <param name="packageId">The package id to install</param>
         /// <returns>The built command to the dispatch</returns>
-        public static Command InstanceServiceMergePackage(String uri, String packageId) {
+        public static ICommand InstanceServiceMergePackage(String uri, String packageId) {
             return new Command() {
                 CommandType = CommandType.InstanceServiceMergePackage,
                 Parameters = new List<CommandParameter>() {
@@ -99,7 +99,7 @@
         /// </summary>
         /// <param name="packageId">The package id to uninstall</param>
         /// <returns>The built command to the dispatch</returns>
-        public static Command InstanceServiceUninstallPackage(String packageId) {
+        public static ICommand InstanceServiceUninstallPackage(String packageId) {
             return new Command() {
                 CommandType = CommandType.InstanceServiceUninstallPackage,
                 Parameters = new List<CommandParameter>() {
@@ -119,7 +119,7 @@
         /// </summary>
         /// <param name="packageId">The package id to install</param>
         /// <returns>The built command to the dispatch</returns>
-        public static Command PackagesMergePackage(String packageId) {
+        public static ICommand PackagesMergePackage(String packageId) {
             return new Command() {
                 CommandType = CommandType.PackagesMergePackage,
                 Parameters = new List<CommandParameter>() {
@@ -139,7 +139,7 @@
         /// </summary>
         /// <param name="packageId">The package id to install</param>
         /// <returns>The built command to the dispatch</returns>
-        public static Command PackagesUninstallPackage(String packageId) {
+        public static ICommand PackagesUninstallPackage(String packageId) {
             return new Command() {
                 CommandType = CommandType.PackagesUninstallPackage,
                 Parameters = new List<CommandParameter>() {
@@ -158,7 +158,7 @@
         /// Builds a command to send a PackagesFetchPackages
         /// </summary>
         /// <returns>The built command to the dispatch</returns>
-        public static Command PackagesFetchPackages() {
+        public static ICommand PackagesFetchPackages() {
             return new Command() {
                 CommandType = CommandType.PackagesFetchPackages
             };
@@ -170,7 +170,7 @@
         /// <param name="username">The username to attach to the command and parameter</param>
         /// <param name="passwordPlainText">The plain text password to add as a parameter</param>
         /// <returns>The build command to dispatch</returns>
-        public static Command SecurityAccountAuthenticate(String username, String passwordPlainText) {
+        public static ICommand SecurityAccountAuthenticate(String username, String passwordPlainText) {
             return new Command() {
                 Authentication = {
                     Username = username
@@ -201,7 +201,7 @@
         /// <param name="name">The name of the variable to set</param>
         /// <param name="value">The value to assign to the variable</param>
         /// <returns>The built command to dispatch</returns>
-        public static Command VariablesSet(String name, String value) {
+        public static ICommand VariablesSet(String name, String value) {
             return new Command() {
                 CommandType = CommandType.VariablesSet,
                 Parameters = new List<CommandParameter>() {
@@ -229,7 +229,7 @@
         /// <param name="name">The name of the variable to set</param>
         /// <param name="value">The value to assign to the variable</param>
         /// <returns>The built command to dispatch</returns>
-        public static Command VariablesSet(String name, List<String> value) {
+        public static ICommand VariablesSet(String name, List<String> value) {
             return new Command() {
                 CommandType = CommandType.VariablesSet,
                 Parameters = new List<CommandParameter>() {
@@ -255,7 +255,7 @@
         /// <param name="name">The name of the variable to set</param>
         /// <param name="value">The value to assign to the variable</param>
         /// <returns>The built command to dispatch</returns>
-        public static Command VariablesSet(CommonVariableNames name, String value) {
+        public static ICommand VariablesSet(CommonVariableNames name, String value) {
             return VariablesSet(name.ToString(), value);
         }

@@ -265,7 +265,7 @@
         /// <param name="name">The name of the variable to set</param>
         /// <param name="value">The value to assign to the variable</param>
         /// <returns>The built command to dispatch</returns>
-        public static Command VariablesSet(CommonVariableNames name, List<String> value) {
+        public static ICommand VariablesSet(CommonVariableNames name, List<String> value) {
             return VariablesSet(name.ToString(), value);
         }

@@ -275,7 +275,7 @@
         /// <param name="name">The name of the variable to set</param>
         /// <param name="value">The value to assign to the variable</param>
         /// <returns>The built command to dispatch</returns>
-        public static Command VariablesSetA(String name, String value) {
+        public static ICommand VariablesSetA(String name, String value) {
             return new Command() {
                 CommandType = CommandType.VariablesSetA,
                 Parameters = new List<CommandParameter>() {
@@ -303,7 +303,7 @@
         /// <param name="name">The name of the variable to set</param>
         /// <param name="value">The value to assign to the variable</param>
         /// <returns>The built command to dispatch</returns>
-        public static Command VariablesSetA(String name, List<String> value) {
+        public static ICommand VariablesSetA(String name, List<String> value) {
             return new Command() {
                 CommandType = CommandType.VariablesSetA,
                 Parameters = new List<CommandParameter>() {
@@ -329,7 +329,7 @@
         /// <param name="name">The name of the variable to set</param>
         /// <param name="value">The value to assign to the variable</param>
         /// <returns>The built command to dispatch</returns>
-        public static Command VariablesSetA(CommonVariableNames name, String value) {
+        public static ICommand VariablesSetA(CommonVariableNames name, String value) {
             return VariablesSetA(name.ToString(), value);
         }

@@ -339,7 +339,7 @@
         /// <param name="name">The name of the variable to set</param>
         /// <param name="value">The value to assign to the variable</param>
         /// <returns>The built command to dispatch</returns>
-        public static Command VariablesSetA(CommonVariableNames name, List<String> value) {
+        public static ICommand VariablesSetA(CommonVariableNames name, List<String> value) {
             return VariablesSetA(name.ToString(), value);
         }

@@ -349,7 +349,7 @@
         /// <param name="name">The name of the variable to set</param>
         /// <param name="value">The value to assign to the variable</param>
         /// <returns>The built command to dispatch</returns>
-        public static Command VariablesSetF(String name, String value) {
+        public static ICommand VariablesSetF(String name, String value) {
             return new Command() {
                 CommandType = CommandType.VariablesSetF,
                 Parameters = new List<CommandParameter>() {
@@ -377,7 +377,7 @@
         /// <param name="name">The name of the variable to set</param>
         /// <param name="value">The value to assign to the variable</param>
         /// <returns>The built command to dispatch</returns>
-        public static Command VariablesSetF(CommonVariableNames name, String value) {
+        public static ICommand VariablesSetF(CommonVariableNames name, String value) {
             return VariablesSetF(name.ToString(), value);
         }

@@ -386,7 +386,7 @@
         /// </summary>
         /// <param name="name">The name of the variable to set</param>
         /// <returns>The built command to dispatch</returns>
-        public static Command VariablesGet(String name) {
+        public static ICommand VariablesGet(String name) {
             return new Command() {
                 CommandType = CommandType.VariablesGet,
                 Parameters = new List<CommandParameter>() {
@@ -406,7 +406,7 @@
         /// </summary>
         /// <param name="name">The name of the variable to set</param>
         /// <returns>The built command to dispatch</returns>
-        public static Command VariablesGet(CommonVariableNames name) {
+        public static ICommand VariablesGet(CommonVariableNames name) {
             return VariablesGet(name.ToString());
         }
     }


Use 'Platform.IsWindowsDesktop' instead of checking both NanoServer and IoT (#10205)

--- src/Microsoft.PowerShell.ConsoleHost/WindowsTaskbarJumpList/TaskbarJumpList.cs
+++ src/Microsoft.PowerShell.ConsoleHost/WindowsTaskbarJumpList/TaskbarJumpList.cs
@@ -23,7 +23,7 @@
         {
             // The STA apartment state is not supported on NanoServer and Windows IoT.
             // Plus, there is not need to create jump list in those environment anyways.
-            if (Platform.IsNanoServer || Platform.IsIoT)
+            if (!Platform.IsWindowsDesktop)
             {
                 return;
             }


Cleaning parts description

Cleaning parts description

--- src/Orchard.Cms.Web/Modules/Orchard.ContentTypes/Views/Admin/AddPartsTo.cshtml
+++ src/Orchard.Cms.Web/Modules/Orchard.ContentTypes/Views/Admin/AddPartsTo.cshtml
@@ -1,4 +1,4 @@
-@model AddPartsViewModel
+@model AddPartsViewModel
 @{
     int i = 0;
 }
@@ -20,8 +20,8 @@

                         <input asp-for="PartSelections[i].IsSelected" type="hidden" />
                         <input asp-for="PartSelections[i].PartName" type="hidden" />
+                        @T["— {0}", @partSelection.PartDescription]

-                    @partSelection.PartDescription

                 i++;


Fix being unable to open a project created on Windows.

With the .NET Core custom MSBuild targets installed a .NET Core
project could be created but then not opened again. The IDE
would show a message saying that the project does not support
.NETFramework,Version=v4.5,Profile=Client. The Microsoft.DotNet.Props
file sets the TargetFrameworkProfile to Client:

  <TargetFrameworkProfile>Client</TargetFrameworkProfile>

The IDE marks the client profile as only supporting the .NET 4.0 CLR
and the project fails to load since the XProject explicitly states it
only supports .NET 4.5 or above since .NET Core projects only support
.NET 4.5 or above. To fix this a check is made in the overridden
OnSupportsFramework method so that if the profile is Client and
the .NET Framework is 4.5 or higher the XProject indicates that this
framework is supported which allows the project to be loaded.

Fixes #28

--- src/MonoDevelop.Dnx/MonoDevelop.Dnx/XProject.cs
+++ src/MonoDevelop.Dnx/MonoDevelop.Dnx/XProject.cs
@@ -28,6 +28,7 @@
 using System;
 using MonoDevelop.Projects;
 using MonoDevelop.Core;
+using MonoDevelop.Core.Assemblies;

 namespace MonoDevelop.Dnx
 {
@@ -62,6 +63,38 @@
 		{
 			DefaultNamespace = GetDefaultNamespace (fileName);
 		}
+
+		protected override bool OnSupportsFramework (TargetFramework framework)
+		{
+			if (IsSupportedClientProfile (framework)) {
+				return true;
+			}
+			return base.OnSupportsFramework (framework);
+		}
+
+		/// <summary>
+		/// If .NET Core MSBuild targets are installed on the machine then
+		/// they set the TargetFrameworkProfile to be Client and the
+		/// TargetFramework class indicates the ClrVersion is 4.0 even though the
+		/// framework version 4.5. .NET 4.0 is not supported by .NET Core which
+		/// the XProject indicates in the OnGetSupportedClrVersions method.
+		/// This causes the project to fail to load. So here an explicit
+		/// check for a Client profile and if it is .NET 4.5 or higher the
+		/// XProject indicates that it is supported.
+		/// </summary>
+		/// <returns>The supported client profile.</returns>
+		/// <param name="framework">Framework.</param>
+		bool IsSupportedClientProfile (TargetFramework framework)
+		{
+			if (framework.Id.Profile == "Client" && framework.Id.Identifier == ".NETFramework") {
+				Version version = null;
+				if (System.Version.TryParse (framework.Id.Version, out version)) {
+					return version.Major >= 4 && version.Minor >= 5;
+				}
+			}
+
+			return false;
+		}
 	}
 }


Document runspace extension method

Document runspace extension method

--- src/PowerShellEditorServices/Services/PowerShell/Utility/RunspaceExtensions.cs
+++ src/PowerShellEditorServices/Services/PowerShell/Utility/RunspaceExtensions.cs
@@ -18,12 +18,9 @@
         static RunspaceExtensions()
         {
             // PowerShell ApartmentState APIs aren't available in PSStandard, so we need to use reflection.
-            if (!VersionUtils.IsNetCore || VersionUtils.IsPS7OrGreater)
-            {
-                MethodInfo setterInfo = typeof(Runspace).GetProperty("ApartmentState").GetSetMethod();
-                Delegate setter = Delegate.CreateDelegate(typeof(Action<Runspace, ApartmentState>), firstArgument: null, method: setterInfo);
-                s_runspaceApartmentStateSetter = (Action<Runspace, ApartmentState>)setter;
-            }
+            MethodInfo setterInfo = typeof(Runspace).GetProperty("ApartmentState").GetSetMethod();
+            Delegate setter = Delegate.CreateDelegate(typeof(Action<Runspace, ApartmentState>), firstArgument: null, method: setterInfo);
+            s_runspaceApartmentStateSetter = (Action<Runspace, ApartmentState>)setter;

             MethodInfo getRemotePromptMethod = typeof(HostUtilities).GetMethod("GetRemotePrompt", BindingFlags.NonPublic | BindingFlags.Static);
             ParameterExpression runspaceParam = Expression.Parameter(typeof(Runspace));
@@ -45,6 +42,13 @@
             s_runspaceApartmentStateSetter?.Invoke(runspace, ApartmentState.STA);
         }

+        /// <summary>
+        /// Augment a given prompt string with a remote decoration.
+        /// This is an internal method on <c>Runspace</c> in PowerShell that we reuse via reflection.
+        /// </summary>
+        /// <param name="runspace">The runspace the prompt is for.</param>
+        /// <param name="basePrompt">The base prompt to decorate.</param>
+        /// <returns>A prompt string decorated with remote connection details.</returns>
         public static string GetRemotePrompt(this Runspace runspace, string basePrompt)
         {
             return s_getRemotePromptFunc(runspace, basePrompt);


Single quotes in paths are annoying on Linux

--- src/NUnit.TestAdapter.Tests.Acceptance/Utils.cs
+++ src/NUnit.TestAdapter.Tests.Acceptance/Utils.cs
@@ -26,9 +26,6 @@

                 switch (arbitraryString[replaceIndex])
                 {
-                    case '"':
-                        r.Append("''");
-                        break;
                     case '<':
                     case '>':
                     case '|':
@@ -41,6 +38,7 @@
                     case '\0':
                     case '\f':
                     case '?':
+                    case '"':
                         break;
                     case '\t':
                     case '\n':


Fixed !!pl

Fixed !!pl

--- src/NadekoBot/Services/Impl/GoogleApiService.cs
+++ src/NadekoBot/Services/Impl/GoogleApiService.cs
@@ -119,7 +119,7 @@
                 count -= toGet;

                 var query = yt.PlaylistItems.List("contentDetails");
-                query.MaxResults = count;
+                query.MaxResults = toGet;
                 query.PlaylistId = playlistId;
                 query.PageToken = nextPageToken;


Fix more FxCop

Fix more FxCop

--- src/NuGetGallery/DataServices/SearchHijacker.cs
+++ src/NuGetGallery/DataServices/SearchHijacker.cs
@@ -130,7 +130,7 @@
                 return false;
             }

-            private bool IsSelectV2FeedPackage(MethodCallExpression expr)
+            private static bool IsSelectV2FeedPackage(MethodCallExpression expr)
             {
                 // We expect:
                 //  Queryable.Select(<nested expression>, p => new V2FeedPackage() ...)
@@ -188,7 +188,7 @@
                 return query.ToString();
             }

-            private Tuple<Target, string> ExtractComparison(MethodCallExpression outerWhere)
+            private static Tuple<Target, string> ExtractComparison(MethodCallExpression outerWhere)
             {
                 // We expect to see an expression that looks like this:
                 //  Queryable.Where(<nested expression>, p => <constant> == p.<property>);


SignalR usage is added;

SignalR usage is added;

--- src/Orleans/UserPresence/WebFrontEnd/Startup.cs
+++ src/Orleans/UserPresence/WebFrontEnd/Startup.cs
@@ -67,34 +67,34 @@

             // This is connection point of SignalR using OWIN
             // We'll remove this approach for now, using just REST for signaling user presence
-            //app.UseSignalR();
+            app.UseSignalR();
         }
     }

-    //public static class AppBuilderExtensions
-    //{
-    //    public static IApplicationBuilder UseAppBuilder(this IApplicationBuilder app, Action<IAppBuilder> configure)
-    //    {
-    //        app.UseOwin(addToPipeline =>
-    //        {
-    //            addToPipeline(next =>
-    //            {
-    //                var appBuilder = new AppBuilder();
-    //                appBuilder.Properties["builder.DefaultApp"] = next;
+    public static class AppBuilderExtensions
+    {
+        public static IApplicationBuilder UseAppBuilder(this IApplicationBuilder app, Action<IAppBuilder> configure)
+        {
+            app.UseOwin(addToPipeline =>
+            {
+                addToPipeline(next =>
+                {
+                    var appBuilder = new AppBuilder();
+                    appBuilder.Properties["builder.DefaultApp"] = next;

-    //                configure(appBuilder);
+                    configure(appBuilder);

-    //                return appBuilder.Build<AppFunc>();
-    //            });
-    //        });
+                    return appBuilder.Build<AppFunc>();
+                });
+            });

-    //        return app;
-    //    }
+            return app;
+        }

-    //    public static void UseSignalR(this IApplicationBuilder app)
-    //    {
-    //        app.UseAppBuilder(appBuilder => appBuilder.MapSignalR());
-    //    }
-    //}
+        public static void UseSignalR(this IApplicationBuilder app)
+        {
+            app.UseAppBuilder(appBuilder => appBuilder.MapSignalR());
+        }
+    }
 }


Remove redundant

Remove redundant

--- src/SilentHunter.Formats/Dat/Chunks/DatChunk.cs
+++ src/SilentHunter.Formats/Dat/Chunks/DatChunk.cs
@@ -139,15 +139,6 @@
 		}

 		/// <summary>
-		/// Serializes the chunk.
-		/// </summary>
-		/// <param name="stream">The stream to write to.</param>
-		protected override void Serialize(Stream stream)
-		{
-			base.Serialize(stream);
-		}
-
-		/// <summary>
 		/// Deserializes the chunk, optionally including the 8 byte header, excluding the magic. To deserialize an entire chunk including magic use a ChunkReader.
 		/// </summary>
 		/// <param name="stream">The stream to read from.</param>


Rewrite to async HttpClient

Rewrite to async HttpClient

Trying to avoid Azure-only 503 errors (or get more info)

--- rss-to-jsonp/Controllers/HomeController.cs
+++ rss-to-jsonp/Controllers/HomeController.cs
@@ -2,6 +2,8 @@
 using System.Collections.Generic;
 using System.Diagnostics;
 using System.Linq;
+using System.Net.Http;
+using System.Threading;
 using System.Threading.Tasks;
 using System.Web.Mvc;
 using System.Xml.Linq;
@@ -16,6 +18,7 @@
 {
     public class HomeController : Controller
     {
+        static HttpClient httpClient = new HttpClient();
         /// <summary>
         /// Cheesy way of avoiding namespaces.
         /// </summary>
@@ -23,18 +26,20 @@
         {
             return source.FirstOrDefault(e => e.Name.LocalName == name);
         }
-        private static XDocument GetFeed(string url)
+        private async Task<XDocument> GetFeed(string url, CancellationToken cancellationToken)
         {
-            return XDocument.Load(url);
+            var responseStream = await httpClient.GetStreamAsync(url).ConfigureAwait(false);
+            var xdoc = await XDocument.LoadAsync(responseStream, LoadOptions.None, cancellationToken).ConfigureAwait(false);
+            return xdoc;
         }
-        public JsonResult Atom(string url, string callback)
+        public async Task<JsonResult> Atom(string url, string callback)
         {
             if (url == null)
             {
                 return Json(null);
             }

-            IEnumerable<XElement> rootElements = GetFeed(url).Root.Elements();
+            IEnumerable<XElement> rootElements = (await GetFeed(url, CancellationToken.None)).Root.Elements();
             IEnumerable<XElement> entryElements = rootElements.Where(e => e.Name.LocalName == "entry");
             var entries = entryElements.Select(e => {
                 IEnumerable<XElement> entryDetails = e.Elements();
@@ -56,14 +61,14 @@
             }, callback);
             return result;
         }
-        public JsonResult Rss(string url, string callback)
+        public async Task<JsonResult> Rss(string url, string callback)
         {
             if (url == null)
             {
                 return Json(null);
             }

-            IEnumerable<XElement> rootElements = getElement(GetFeed(url).Root.Elements(), "channel").Elements();
+            IEnumerable<XElement> rootElements = getElement((await GetFeed(url, CancellationToken.None)).Root.Elements(), "channel").Elements();
             IEnumerable<XElement> entryElements = rootElements.Where(e => e.Name.LocalName == "item");
             var entries = entryElements.Select(e => {
                 IEnumerable<XElement> entryDetails = e.Elements();


Add ToString/Parse to HslColor

Add ToString/Parse to HslColor

--- src/Avalonia.Visuals/Media/HslColor.cs
+++ src/Avalonia.Visuals/Media/HslColor.cs
@@ -169,6 +169,146 @@
             return HslColor.ToRgb(H, S, L, A);
         }

+        /// <inheritdoc/>
+        public override string ToString()
+        {
+            var sb = new StringBuilder();
+
+            // Use a format similar to CSS. However:
+            //   - To ensure precision is never lost, allow decimal places.
+            //     This is especially important for round-trip serialization.
+            //   - To maintain numerical consistency, do not use percent.
+            //
+            // Example:
+            //
+            // hsla(hue, saturation, lightness, alpha)
+            // hsla(230, 1.0, 0.5, 1.0)
+            //
+
+            sb.Append("hsva(");
+            sb.Append(H.ToString(CultureInfo.InvariantCulture));
+            sb.Append(", ");
+            sb.Append(S.ToString(CultureInfo.InvariantCulture));
+            sb.Append(", ");
+            sb.Append(L.ToString(CultureInfo.InvariantCulture));
+            sb.Append(", ");
+            sb.Append(A.ToString(CultureInfo.InvariantCulture));
+            sb.Append(')');
+
+            return sb.ToString();
+        }
+
+        /// <summary>
+        /// Parses an HSL color string.
+        /// </summary>
+        /// <param name="s">The HSL color string to parse.</param>
+        /// <returns>The parsed <see cref="HslColor"/>.</returns>
+        public static HslColor Parse(string s)
+        {
+            if (s is null)
+            {
+                throw new ArgumentNullException(nameof(s));
+            }
+
+            if (TryParse(s, out HslColor hslColor))
+            {
+                return hslColor;
+            }
+
+            throw new FormatException($"Invalid HSL color string: '{s}'.");
+        }
+
+        /// <summary>
+        /// Parses an HSL color string.
+        /// </summary>
+        /// <param name="s">The HSL color string to parse.</param>
+        /// <param name="hslColor">The parsed <see cref="HslColor"/>.</param>
+        /// <returns>True if parsing was successful; otherwise, false.</returns>
+        public static bool TryParse(string s, out HslColor hslColor)
+        {
+            hslColor = default;
+
+            if (s is null)
+            {
+                return false;
+            }
+
+            string workingString = s.Trim();
+
+            if (workingString.Length == 0 ||
+                workingString.IndexOf(",", StringComparison.Ordinal) < 0)
+            {
+                return false;
+            }
+
+            if (workingString.Length > 6 &&
+                workingString.StartsWith("hsla(", StringComparison.OrdinalIgnoreCase) &&
+                workingString.EndsWith(")", StringComparison.Ordinal))
+            {
+                workingString = workingString.Substring(5, workingString.Length - 6);
+            }
+
+            if (workingString.Length > 5 &&
+                workingString.StartsWith("hsl(", StringComparison.OrdinalIgnoreCase) &&
+                workingString.EndsWith(")", StringComparison.Ordinal))
+            {
+                workingString = workingString.Substring(4, workingString.Length - 5);
+            }
+
+            string[] components = workingString.Split(',');
+
+            if (components.Length == 3) // HSL
+            {
+                if (double.TryParse(components[0], NumberStyles.Number, CultureInfo.InvariantCulture, out double hue) &&
+                    TryInternalParse(components[1], out double saturation) &&
+                    TryInternalParse(components[2], out double lightness))
+                {
+                    hslColor = new HslColor(1.0, hue, saturation, lightness);
+                    return true;
+                }
+            }
+            else if (components.Length == 4) // HSLA
+            {
+                if (double.TryParse(components[0], NumberStyles.Number, CultureInfo.InvariantCulture, out double hue) &&
+                    TryInternalParse(components[1], out double saturation) &&
+                    TryInternalParse(components[2], out double lightness) &&
+                    TryInternalParse(components[3], out double alpha))
+                {
+                    hslColor = new HslColor(alpha, hue, saturation, lightness);
+                    return true;
+                }
+            }
+
+            // Local function to specially parse a double value with an optional percentage sign
+            bool TryInternalParse(string inString, out double outDouble)
+            {
+                // The percent sign, if it exists, must be at the end of the number
+                int percentIndex = inString.IndexOf("%", StringComparison.Ordinal);
+
+                if (percentIndex >= 0)
+                {
+                    var result = double.TryParse(
+                        inString.Substring(0, percentIndex),
+                        NumberStyles.Number,
+                        CultureInfo.InvariantCulture,
+                        out double percentage);
+
+                    outDouble = percentage / 100.0;
+                    return result;
+                }
+                else
+                {
+                    return double.TryParse(
+                        inString,
+                        NumberStyles.Number,
+                        CultureInfo.InvariantCulture,
+                        out outDouble);
+                }
+            }
+
+            return false;
+        }
+
         /// <summary>
         /// Creates a new <see cref="HslColor"/> from individual color component values.
         /// </summary>


Update Banco_Uniprime.cs

Update Banco_Uniprime.cs

feat: adicionado a validação do boleto para geração do digito verificador no NossoNumero

--- src/Boleto.Net/Banco/Banco_Uniprime.cs
+++ src/Boleto.Net/Banco/Banco_Uniprime.cs
@@ -692,6 +692,8 @@

         public string GerarDetalheRemessaCNAB400(Boleto boleto, int numeroRegistro, TipoArquivo tipoArquivo)
         {
+            boleto.Valida(); //Adicionado por Bruno Guelere (para validar o boleto e gerar o Didito Verificador do NossoNumero
+
             try
             {
                 base.GerarDetalheRemessa(boleto, numeroRegistro, tipoArquivo);


Ceasar cipher example ;)

Ceasar cipher example ;)

--- src/ByteEncodings.Test/Inspirations.cs
+++ src/ByteEncodings.Test/Inspirations.cs
@@ -157,5 +157,21 @@
             // Are you still with me here?
             Assert.Equal(knownValue, mappedPwd);
         }
+
+        [Fact]
+        public void We_can_make_Ceasar_cipher_absurdally_inefficient()
+        {
+            // Caesar cipher: ABCD -> XYZA
+            var plaintext = "THEQUICKBROWNFOXJUMPSOVERTHELAZYDOG";
+            var expected = "QEBNRFZHYOLTKCLUGRJMPLSBOQEBIXWVALD";
+
+            var plainAlphabet = new Alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
+            var cipherAlphabet = new Alphabet("XYZABCDEFGHIJKLMNOPQRSTUVW");
+
+            var bytes = plainAlphabet.GetBytes(plaintext);
+            var ciphertext = cipherAlphabet.GetString(bytes);
+            Assert.Equal(expected, ciphertext);
+            // we could check that we can decode back to plaintext, but it's obvious now - isn't it?
+        }
     }
 }


iOS5: CoreData, NSSaveChangesRequest;  And we are done!

--- src/coredata.cs
+++ src/coredata.cs
@@ -991,7 +991,25 @@
 		[Since (5,0)]
 		[Export ("ordered")]
 		bool Ordered { [Bind ("isOrdered")]get; set; }
-
-	}
+	}
+
+	[BaseType (typeof (NSPersistentStoreRequest))]
+	interface NSSaveChangesRequest {
+		[Export ("initWithInsertedObjects:updatedObjects:deletedObjects:lockedObjects:")]
+		IntPtr Constructor (NSSet insertedObjects, NSSet updatedObjects, NSSet deletedObjects, NSSet lockedObjects);
+
+		[Export ("insertedObjects")]
+		NSSet InsertedObjects { get; }
+
+		[Export ("updatedObjects")]
+		NSSet UpdatedObjects { get; }
+
+		[Export ("deletedObjects")]
+		NSSet DeletedObjects { get; }
+
+		[Export ("lockedObjects")]
+		NSSet LockedObjects { get; }
+	}
+
 }


Add one more test.

Add one more test.


Update DrawContainerView.cs

Update DrawContainerView.cs

--- src/Draw2D/Editor/DrawContainerView.cs
+++ src/Draw2D/Editor/DrawContainerView.cs
@@ -125,8 +125,8 @@

         private void DrawSkia(IContainerView view, SKCanvas canvas, double width, double height, double dx, double dy, double zx, double zy)
         {
-            view.CurrentContainer.Invalidate();
-            view.WorkingContainer.Invalidate();
+            //view.CurrentContainer.Invalidate();
+            //view.WorkingContainer.Invalidate();

             var pictureShapes = RecordPicture(view, zx, DrawShapes);
             var pictureDecorators = RecordPicture(view, zx, DrawDecorators);
@@ -162,8 +162,8 @@
             _avaloniaRenderer.Scale = zx;
             _avaloniaRenderer.Selection = view.Selection;

-            view.CurrentContainer.Invalidate();
-            view.WorkingContainer.Invalidate();
+            //view.CurrentContainer.Invalidate();
+            //view.WorkingContainer.Invalidate();

             if (view.CurrentContainer.InputBackground != null)
             {


Use framework methods to join strings.

Use framework methods to join strings.

--- src/Faithlife.Utility/StringUtility.cs
+++ src/Faithlife.Utility/StringUtility.cs
@@ -652,10 +652,7 @@
 		/// </summary>
 		/// <param name="strings">The strings.</param>
 		/// <returns>All of the strings concatenated with no separator.</returns>
-		public static string Join(this IEnumerable<string?> strings)
-		{
-			return Join(strings, default);
-		}
+		public static string Join(this IEnumerable<string?> strings) => string.Join("", strings);

 		/// <summary>
 		/// Joins the specified strings using the specified separator.
@@ -663,25 +660,8 @@
 		/// <param name="strings">The strings.</param>
 		/// <param name="separator">The separator. (The empty string is used if null.)</param>
 		/// <returns>All of the strings concatenated with the specified separator.</returns>
-		public static string Join(this IEnumerable<string?> strings, string? separator)
-		{
-			if (strings is null)
-				throw new ArgumentNullException(nameof(strings));
-
-			using var enumerator = strings.GetEnumerator();
-			if (enumerator.MoveNext())
-			{
-				var sb = new StringBuilder(enumerator.Current);
-				while (enumerator.MoveNext())
-				{
-					sb.Append(separator);
-					sb.Append(enumerator.Current);
-				}
-				return sb.ToString();
-			}
-
-			return "";
-		}
+		public static string Join(this IEnumerable<string?> strings, string? separator) =>
+			string.Join(separator ?? "", strings ?? throw new ArgumentNullException(nameof(strings)));

 		/// <summary>
 		/// Joins the specified strings into one string.


Add guard clause to not map (I)Lists

Add guard clause to not map (I)Lists

--- src/FluentWebControls/Mapping/UIMap.cs
+++ src/FluentWebControls/Mapping/UIMap.cs
@@ -22,15 +22,46 @@
 			foreach (var matchingProperty in Reflection
 				.GetMatchingProperties(typeof (TDomain), typeof (TModel)))
 			{
+				var source = matchingProperty.SourcePropertyType;
+				if (source.IsGenericType &&
+				    (source.GetGenericTypeDefinition() == typeof (List<>) ||
+				     source.GetGenericTypeDefinition() == typeof (IList<>)))
+				{
+					continue;
+				}
+				var property = matchingProperty.DestinationPropertyType;
+				if (property.IsGenericType &&
+				    (property.GetGenericTypeDefinition() == typeof (List<>) ||
+				     property.GetGenericTypeDefinition() == typeof (IList<>)))
+				{
+					continue;
+				}
+
 				_mappings.Add(matchingProperty.Name, GetMap(matchingProperty));
 			}
 		}

+		public TDomain Item { get; private set; }
+
+		#region IUIMap Members
+
+		public void WithIdPrefix(string prefix)
+		{
+			if (_idPrefix.IsNullOrEmpty())
+			{
+				_idPrefix = prefix;
+				return;
+			}
+			_idPrefix = String.Format("{0}.{1}", _idPrefix, prefix);
+		}
+
+		#endregion
+
 		public void Populate(TModel model)
 		{
 			var properties = typeof (TModel).GetProperties()
-				.ToDictionary(x=>x.Name, x=>x);
-			foreach(var mapping in _mappings)
+				.ToDictionary(x => x.Name, x => x);
+			foreach (var mapping in _mappings)
 			{
 				if (!properties.ContainsKey(mapping.Key)) continue;
 				var property = properties[mapping.Key];
@@ -57,10 +88,10 @@
 					continue;
 				}

-				if (source is IChoiceListMap &&
+				if (source is IChoiceListMap &&
 				    property.PropertyType.IsGenericType)
 				{
-					if (property.PropertyType.GetGenericTypeDefinition() == typeof(List<>))
+					if (property.PropertyType.GetGenericTypeDefinition() == typeof (List<>))
 					{
 						var itemType = property.PropertyType.GetGenericArguments()[0];
 						var choiceList = source as IChoiceListMap;
@@ -69,7 +100,7 @@
 						var addMethod = targetList.GetType().GetMethod("Add");
 						foreach (var item in items)
 						{
-							addMethod.Invoke(targetList, new[] { item });
+							addMethod.Invoke(targetList, new[] {item});
 						}
 					}
 				}
@@ -80,22 +111,6 @@
 				}
 			}
 		}
-
-		public TDomain Item { get; private set; }
-
-		#region IUIMap Members
-
-		public void WithIdPrefix(string prefix)
-		{
-			if (_idPrefix.IsNullOrEmpty())
-			{
-				_idPrefix = prefix;
-				return;
-			}
-			_idPrefix = String.Format("{0}.{1}", _idPrefix, prefix);
-		}
-
-		#endregion

 		public CheckBoxData CheckBoxFor(Expression<Func<TModel, object>> source)
 		{


Value comparison added to the unit test

Value comparison added to the unit test


Add ExecutionNode constructor xml comments (#2069)

--- src/GraphQL/Execution/ExecutionNode.cs
+++ src/GraphQL/Execution/ExecutionNode.cs
@@ -17,8 +17,8 @@
         public ExecutionNode Parent { get; }

         /// <summary>
-        /// Returns the underlying graph type of this node; does not represent a <see cref="NonNullGraphType"/>, and
-        /// for child nodes of an array execution node, does not represent a <see cref="ListGraphType"/> instance.
+        /// Returns the graph type of this node, unwrapped if it is a <see cref="NonNullGraphType"/>.
+        /// Array nodes will be a <see cref="ListGraphType"/> instance.
         /// </summary>
         public IGraphType GraphType { get; }

@@ -96,6 +96,11 @@
         /// <summary>
         /// Initializes an instance of <see cref="ExecutionNode"/> with the specified values
         /// </summary>
+        /// <param name="parent">The parent node, or null if this is the root node</param>
+        /// <param name="graphType">The graph type of this node, unwrapped if it is a <see cref="NonNullGraphType"/>. Array nodes will be a <see cref="ListGraphType"/> instance.</param>
+        /// <param name="field">The AST field of this node</param>
+        /// <param name="fieldDefinition">The graph's field type of this node</param>
+        /// <param name="indexInParentNode">For child array item nodes of a <see cref="ListGraphType"/>, the index of this array item within the field; otherwise, null</param>
         protected ExecutionNode(ExecutionNode parent, IGraphType graphType, Field field, FieldType fieldDefinition, int? indexInParentNode)
         {
             Parent = parent;


Small fix

Small fix


Removed nuget doc comment as tests shouldn't have them.


Change landuse factory to work with just parks

it gets quite messy with everything so limited to just parks for now


DataGrid-Refresh-Synergie

DataGrid-Refresh-Synergie

Bei den Flugzeugen gab es dieses Problem auch noch.

--- Autopilot/GUI/Stammdaten_flugzeug.xaml.cs
+++ Autopilot/GUI/Stammdaten_flugzeug.xaml.cs
@@ -77,13 +77,15 @@
                 ID.ftyp_id = Convert.ToInt32(cb_Flugzeugtyp.SelectedValue.ToString());

                 content.SaveChanges();
-                MessageBox.Show("Update des DataGrid-Updates noch nicht gebaut.");
+
+                content = new AutopilotEntities();
+                DataGrid.ItemsSource = GetList();
             }
         }

         private void DataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
-            if (DataGrid.SelectedCells.Count != 0 && DataGrid.ItemsSource != null)
+            if (DataGrid.SelectedCells.Count != 0 && DataGrid.ItemsSource != null && DataGrid.CurrentItem != null)
             {
                 DataRowView row = DataGrid.SelectedItems as DataRowView;
                 flz_id = ((flugzeugliste)DataGrid.SelectedItem).flz_id;


Added operation-based alteration.

Added operation-based alteration.


feat(PedidoController): adicionar actions de exclusão, alteração, detalhação e listagem.

--- src/modulo-05-.NET/LojaNinja.MVC/LojaNinja.MVC/Controllers/PedidoController.cs
+++ src/modulo-05-.NET/LojaNinja.MVC/LojaNinja.MVC/Controllers/PedidoController.cs
@@ -18,12 +18,73 @@
             return View();
         }

+        public ActionResult Editar(int id)
+        {
+            var pedido = repositorio.ObterPedidoPorId(id);
+            PedidoModel pedidoModel = new PedidoModel
+            {
+                NomeCliente = pedido.NomeCliente,
+                NomeProduto = pedido.NomeProduto,
+                NumeroPedido = pedido.NumeroPedido,
+                Cidade = pedido.Cidade,
+                DataEntrega = pedido.DataEntrega,
+                Estado = pedido.Estado,
+                TipoDePagamento = pedido.TipoDePagamento,
+                Valor = pedido.Valor
+            };
+            return View("Cadastro", pedidoModel);
+        }
+
         public ActionResult Salvar(PedidoModel model)
         {
-            var pedido = new Pedido(model.DataEntrega, model.NomeProduto, model.Valor, model.TipoDePagamento,
-                                    model.NomeCliente, model.Cidade, model.Estado);
-            repositorio.IncluirPedido(pedido);
-            return View("Detalhes", model);
+            if (ModelState.IsValid)
+            {
+                Pedido pedido;
+                try
+                {
+                    pedido = new Pedido(model.DataEntrega, model.NomeProduto, model.Valor, model.TipoDePagamento,
+                        model.NomeCliente, model.Cidade, model.Estado);
+                    if (model.NumeroPedido.HasValue)
+                    {
+                        int id = (int)model.NumeroPedido;
+                        repositorio.AlterarPedido(id, model.DataEntrega, model.NomeProduto, model.Valor, model.TipoDePagamento,
+                            model.NomeCliente, model.Cidade, model.Estado);
+                        return View("Detalhes", pedido);
+                    }
+                    else {
+                        repositorio.IncluirPedido(pedido);
+                        return View("Detalhes", pedido);
+                    }
+                }
+                catch (ArgumentException ex)
+                {
+                    ModelState.AddModelError("", ex.Message);
+                    return View("Cadastro", model);
+                }
+            }
+            else
+            {
+                return View("Cadastro", model);
+            }
+        }
+
+        public ActionResult Detalhes(int id)
+        {
+            return View(repositorio.ObterPedidoPorId(id));
+        }
+
+        public ActionResult Listagem()
+        {
+            var pedidos = repositorio.ObterPedidos();
+            return View(pedidos);
+        }
+
+        public ActionResult Excluir(int id)
+        {
+            repositorio.RemoverPedido(id);
+            var pedidos = repositorio.ObterPedidos();
+
+            return View("Listagem", pedidos);
         }
     }
 }


partially revert "crutch for netcoreapp3.0"

This partially reverts commit e6c7ade09af6335948c29db8127752a8ac34fed4.


Add InitializeOnStartup for GraphQL

Add InitializeOnStartup for GraphQL


Update fields

Update fields


Version to 1.8.0

Version to 1.8.0

--- WebApi.Toolkit/Properties/AssemblyInfo.cs
+++ WebApi.Toolkit/Properties/AssemblyInfo.cs
@@ -9,6 +9,6 @@
 [assembly: AssemblyFileVersion("1.8.0.0")]

 // This version is used by NuGet:
-[assembly: AssemblyInformationalVersion("1.8.0-prerelease02")]
+[assembly: AssemblyInformationalVersion("1.8.0")]

 [assembly: InternalsVisibleTo("Affecto.WebApi.Toolkit.Tests")]


Removed commented useless code.

Removed commented useless code.

--- WebFormsDBI18NDemo/SqlResourceProvider.cs
+++ WebFormsDBI18NDemo/SqlResourceProvider.cs
@@ -25,36 +25,6 @@
             this.virtualPath = virtualPath;
             this.className = className;
         }
-
-        //private IDictionary GetResourceCache(string cultureName)
-        //{
-        //    if (log.IsDebugEnabled)
-        //    {
-        //        log.Debug("Getting resource cache for culture name: " + cultureName);
-        //    }
-        //    object cultureKey;
-        //    if (cultureName != null)
-        //    {
-        //        cultureKey = cultureName;
-        //    }
-        //    else
-        //    {
-        //        cultureKey = CultureNeutralKey;
-        //    }
-
-        //    //if (_resourceCache == null)
-        //    //{
-        //        _resourceCache = new ListDictionary();
-        //    //}
-        //    IDictionary resourceDict = _resourceCache[cultureKey] as IDictionary;
-        //    if (resourceDict == null)
-        //    {
-        //        resourceDict = SqlResourceHelper.GetResources(_virtualPath,
-        //                      _className, cultureName, false, null);
-        //        _resourceCache[cultureKey] = resourceDict;
-        //    }
-        //    return resourceDict;
-        //}

         object IResourceProvider.GetObject(string resourceKey, CultureInfo culture)
         {


Put resend delay back to 2 seconds (I had changed it to 5)

git-svn-id: baf6e02d125cf6f9bfcfe153b2eb83d6e1f5ace6@509 52acb1d6-8a22-11de-b505-999d5b087335

--- libsecondlife-cs/AssetSystem/AssetRequestUpload.cs
+++ libsecondlife-cs/AssetSystem/AssetRequestUpload.cs
@@ -86,12 +86,12 @@
         {
             this.SendFirstPacket();

-            while (this.Completed.WaitOne(5000, true) == false)
+            while (this.Completed.WaitOne(1000, true) == false)
             {
                 //Console.WriteLine("WaitOne() timeout while uploading");
-                if (this.SecondsSinceLastPacket > 5)
-                {
-                    Console.WriteLine("Resending Packet (more then 5 seconds since last confirm)");
+                if (this.SecondsSinceLastPacket > 2)
+                {
+                    Console.WriteLine("Resending Packet (more than 2 seconds since last confirm)");
                     this.SendCurrentPacket();
                 }
             }


Fixed uint serializer tests

Fixed uint serializer tests

--- tests/FreecraftCore.Serialization.Tests/SerializerTests/UIntSerializerTests.cs
+++ tests/FreecraftCore.Serialization.Tests/SerializerTests/UIntSerializerTests.cs
@@ -17,9 +17,10 @@
 		[TestCase((uint)28532)]
 		public void Test_Int_Serializer_Doesnt_Throw_On_Serialize(uint data)
 		{
-			ITypeSerializerStrategy strategy = new GenericTypePrimitiveSerializerStrategy<uint>();
+			var strategy = GenericTypePrimitiveSerializerStrategy<uint>.Instance;
+			int offset = 0;

-			Assert.DoesNotThrow(() => strategy.Write(data, new TestStorageWriterMock()));
+			Assert.DoesNotThrow(() => strategy.Write(data, new Span<byte>(new byte[sizeof(uint)]), ref offset));
 		}

 		[Test]
@@ -29,14 +30,15 @@
 		public void Test_Int_Serializer_Writes_Ints_Into_WriterStream(uint data)
 		{
 			//arrange
-			ITypeSerializerStrategy strategy = new GenericTypePrimitiveSerializerStrategy<uint>();
-			TestStorageWriterMock writer = new TestStorageWriterMock();
+			var strategy = GenericTypePrimitiveSerializerStrategy<uint>.Instance;
+			Span<byte> buffer = new Span<byte>(new byte[sizeof(uint)]);
+			int offset = 0;

 			//act
-			strategy.Write(data, writer);
+			strategy.Write(data, buffer, ref offset);

 			//assert
-			Assert.False(writer.WriterStream.Length == 0);
+			Assert.False(offset == 0);
 		}

 		[Test]
@@ -46,37 +48,17 @@
 		public void Test_Byte_Serializer_Writes_And_Reads_Same_Byte(uint data)
 		{
 			//arrange
-			ITypeSerializerStrategy strategy = new GenericTypePrimitiveSerializerStrategy<uint>();
-			TestStorageWriterMock writer = new TestStorageWriterMock();
-			TestStorageReaderMock reader = new TestStorageReaderMock(writer.WriterStream);
+			var strategy = GenericTypePrimitiveSerializerStrategy<uint>.Instance;
+			Span<byte> buffer = new Span<byte>(new byte[sizeof(uint)]);
+			int offset = 0;

 			//act
-			strategy.Write(data, writer);
-			writer.WriterStream.Position = 0;
-			uint intvalue = (uint)strategy.Read(reader);
+			strategy.Write(data, buffer, ref offset);
+			offset = 0;
+			uint intvalue = (uint)strategy.Read(buffer, ref offset);

 			//assert
 			Assert.AreEqual(data, intvalue);
 		}
-
-		/*[Test]
-		[TestCase(0,1,2,3)]
-		[TestCase(255,0,255,0)]
-		[TestCase(1,1,1,1)]
-		public void Test_Byte_Serializer_Writes_And_Reads_Same_ByteArray(params byte[] data)
-		{
-			//arrange
-			ByteSerializerStrategy strategy = new ByteSerializerStrategy();
-			TestStorageWriterMock writer = new TestStorageWriterMock();
-			TestStorageReaderMock reader = new TestStorageReaderMock(writer.WriterStream);
-
-			//act
-			strategy.Write(data, writer);
-			writer.WriterStream.Position = 0;
-			byte b = reader.ReadByte();
-
-			//assert
-			Assert.AreEqual(data, b);
-		}*/
 	}
 }


cleaning up extraneous code

cleaning up extraneous code

--- AllReadyApp/Web-App/AllReady.UnitTest/Controllers/ActivityApiControllerTests.cs
+++ AllReadyApp/Web-App/AllReady.UnitTest/Controllers/ActivityApiControllerTests.cs
@@ -61,7 +61,7 @@
             var controller = GetActivityApiController();

             // Act
-            var recordId = 5;
+            const int recordId = 5;
             var activityViewModel = controller.Get(recordId);

             // Assert
@@ -75,43 +75,31 @@

         [Fact]
         public void ActivityDoesExist()
-        {
-            // Arrange
+        {
+            var controller = GetActivityApiController();
+            var activityViewModel = controller.Get(1);
+            Assert.NotNull(activityViewModel);
+        }
+
+        [Fact]
+        public void HandlesInvalidActivityId()
+        {
             var controller = GetActivityApiController();
-
-            // Act
-            const int recordId = 1;
-            var activityViewModel = controller.Get(recordId);
-
-            Assert.NotNull(activityViewModel);
-        }
-
-        [Fact]
-        public void HandlesInvalidActivityId()
-        {
-            // Arrange
-            var controller = GetActivityApiController();
-
-            // Act
-            const int recordId = -1;
-            var activityViewModel = controller.Get(recordId);
-
+            var activityViewModel = controller.Get(-1);
             Assert.Null(activityViewModel);
         }

         [Fact]
         public async Task UnregisterActivityShouldRemoveActivitySignup()
         {
-            // Arrange
             const int recordId = 5;
             var controller = GetActivityApiController()
                 .SetFakeUser(recordId.ToString());

-            // Act
             var result = await controller.UnregisterActivity(recordId);

-            // Assert
             Assert.NotNull(result);
+
             var context = _serviceProvider.GetService<AllReadyContext>();
             var numOfUsersSignedUp = context.Activities
                 .First(e => e.Id == recordId)
@@ -122,22 +110,28 @@
         [Fact]
         public async Task UnregisterActivityShouldRemoveTaskSignup()
         {
-            // Arrange
             const int recordId = 5;
             var controller = GetActivityApiController()
                 .SetFakeUser(recordId.ToString());

-            // Act
             var result = await controller.UnregisterActivity(recordId);

-            // Assert
             Assert.NotNull(result);
+
             var context = _serviceProvider.GetService<AllReadyContext>();
             var numOfTasksSignedUpFor = context.TaskSignups.Count(e => e.Task.Activity.Id == recordId);
             Assert.Equal(0, numOfTasksSignedUpFor);
         }

         [Fact]
+        public void GetAllActivities()
+        {
+            var controller = GetActivityApiController();
+            var activities = new List<ActivityViewModel>(controller.Get());
+            Assert.Equal(activitiesAdded, activities.Count());
+        }
+
+        [Fact]
         public void ControllerHasRouteAtttributeWithTheCorrectRoute()
         {
             var sut = new ActivityApiController(null, null);
@@ -267,19 +261,6 @@
             var sut = new ActivityApiController(null, null);
             var attribute = (AuthorizeAttribute)sut.GetAttributesOn(x => x.UnregisterActivity(It.IsAny<int>())).SingleOrDefault(x => x.GetType() == typeof(AuthorizeAttribute));
             Assert.NotNull(attribute);
-        }
-
-        [Fact]
-        public void GetAllActivities()
-        {
-            // Arrange
-            var controller = GetActivityApiController();
-
-            // Act
-            var activities = new List<ActivityViewModel>(controller.Get());
-
-            // Assert
-            Assert.Equal(activitiesAdded, activities.Count());
         }

         #region Helper Methods


Update the MixedRealityKeyboard doccomments to reflect the platforms it was intended for.

It was only designed to handle the HL2 workaround, so we should at least write this down.

Note that there is more work here to make the general system keyboard example script work in immersive/HL1 cases.

--- Assets/MixedRealityToolkit.SDK/Experimental/Features/UX/MixedRealityKeyboard.cs
+++ Assets/MixedRealityToolkit.SDK/Experimental/Features/UX/MixedRealityKeyboard.cs
@@ -11,8 +11,7 @@
 namespace Microsoft.MixedReality.Toolkit.Experimental.UI
 {
     /// <summary>
-    /// Class that can launch and hide a system keyboard specifically for Windows Mixed Reality
-    /// devices (HoloLens 2, Windows Mixed Reality).
+    /// Class that can launch and hide a system keyboard specifically for HoloLens 2.
     ///
     /// Implements a workaround for UWP TouchScreenKeyboard bug which prevents
     /// UWP keyboard from showing up again after it is closed.


Fixes a crash bug in InMemoryRoutingDataStore.

--- BotMessageRouting/MessageRouting/DataStore/InMemory/InMemoryRoutingDataStore.cs
+++ BotMessageRouting/MessageRouting/DataStore/InMemory/InMemoryRoutingDataStore.cs
@@ -50,10 +50,11 @@
         /// </summary>
         public InMemoryRoutingDataStore()
         {
-            AggregationChannels = new List<ConversationReference>();
             Users = new List<ConversationReference>();
             BotInstances = new List<ConversationReference>();
+            AggregationChannels = new List<ConversationReference>();
             ConnectionRequests = new List<ConnectionRequest>();
+            Connections = new List<Connection>();
         }

         public IList<ConversationReference> GetUsers()


Fixed cases where there were no basetypes

--- DESign_Sales_Excel_Add-in/DESign_Sales_Excel_Add-in/Worksheet_Values/Takeoff.cs
+++ DESign_Sales_Excel_Add-in/DESign_Sales_Excel_Add-in/Worksheet_Values/Takeoff.cs
@@ -60,12 +60,15 @@
             int firstBaseTypeRow = 0;

             int i = 4;
-            while (firstBaseTypeReached == false)
-            {
-                if (baseTypesCells[i, 1] != null)
-                {
-                    firstBaseTypeReached = true;
-                    firstBaseTypeRow = i;
+            while (firstBaseTypeReached == false && i<baseTypesCells.GetLength(0))
+            {
+                if (baseTypesCells != null)
+                {
+                    if (baseTypesCells[i, 1] != null)
+                    {
+                        firstBaseTypeReached = true;
+                        firstBaseTypeRow = i;
+                    }
                 }
                 i++;
             }
@@ -94,69 +97,72 @@
             List<BaseType> baseTypes = new List<BaseType>();

             int rowCount = firstBaseTypeRow;
-            foreach (int rowsForThisBaseType in rowsPerBaseTypeList)
-            {
-                BaseType baseType = new BaseType();
-
-                baseType.Name = new StringWithUpdateCheck { Text = (string)baseTypesCells[rowCount, 1] , IsUpdated = isUpdated[rowCount-1, 0]};
-                baseType.Description = new StringWithUpdateCheck { Text = (string)baseTypesCells[rowCount, 2], IsUpdated = isUpdated[rowCount - 1, 1] };
-                baseType.BaseLengthFt = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount, 3], IsUpdated = isUpdated[rowCount - 1, 2] };
-                baseType.BaseLengthIn = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount, 4], IsUpdated = isUpdated[rowCount - 1, 3] };
-                baseType.TcxlQuantity = new IntWithUpdateCheck { Value = (int?)(double?)baseTypesCells[rowCount, 5], IsUpdated = isUpdated[rowCount - 1, 4] };
-                baseType.TcxlLengthFt = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount, 6], IsUpdated = isUpdated[rowCount - 1, 5] };
-                baseType.TcxlLengthIn = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount, 7], IsUpdated = isUpdated[rowCount - 1, 6] };
-                baseType.TcxrQuantity = new IntWithUpdateCheck { Value = (int?)(double?)baseTypesCells[rowCount, 8], IsUpdated = isUpdated[rowCount - 1, 7] };
-                baseType.TcxrLengthFt = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount, 9], IsUpdated = isUpdated[rowCount - 1, 8] };
-                baseType.TcxrLengthIn = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount, 10], IsUpdated = isUpdated[rowCount - 1, 9] };
-                baseType.SeatDepthLE = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount, 11], IsUpdated = isUpdated[rowCount - 1, 10] };
-                baseType.SeatDepthRE = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount, 12], IsUpdated = isUpdated[rowCount - 1, 11] };
-                baseType.BcxQuantity = new IntWithUpdateCheck { Value = (int?)(double?)baseTypesCells[rowCount, 13], IsUpdated = isUpdated[rowCount - 1, 12] };
-                baseType.Uplift = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount, 14], IsUpdated = isUpdated[rowCount - 1, 13] };
-                baseType.Erfos = new StringWithUpdateCheck { Text = (string)baseTypesCells[rowCount, 26], IsUpdated = isUpdated[rowCount - 1, 25] };
-                baseType.DeflectionTL = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount, 27], IsUpdated = isUpdated[rowCount - 1, 26] };
-                baseType.DeflectionLL = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount, 28], IsUpdated = isUpdated[rowCount - 1, 27] };
-                baseType.WnSpacing = new StringWithUpdateCheck { Text = (string)baseTypesCells[rowCount, 29], IsUpdated = isUpdated[rowCount - 1, 28] };
-
-
-                List<Load> loads = new List<Load>();
-                List<StringWithUpdateCheck> notes = new List<StringWithUpdateCheck>();
-
-                for (i = 0; i < rowsForThisBaseType; i++)
-                {
-
-                    Load load = new Load();
-                    load.LoadInfoType = new StringWithUpdateCheck { Text = (string)baseTypesCells[rowCount + i, 15], IsUpdated = isUpdated[rowCount + i - 1, 14] };
-                    load.LoadInfoCategory = new StringWithUpdateCheck { Text = (string)baseTypesCells[rowCount + i, 16], IsUpdated = isUpdated[rowCount + i - 1, 15] };
-                    load.LoadInfoPosition = new StringWithUpdateCheck { Text = (string)baseTypesCells[rowCount + i, 17], IsUpdated = isUpdated[rowCount + i - 1, 16] };
-                    load.Load1Value = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount + i, 18], IsUpdated = isUpdated[rowCount + i - 1, 17] };
-                    load.Load1DistanceFt = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount + i, 19], IsUpdated = isUpdated[rowCount + i - 1, 18] };
-                    load.Load1DistanceIn = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount + i, 20], IsUpdated = isUpdated[rowCount + i - 1, 19] };
-                    load.Load2Value = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount + i, 21], IsUpdated = isUpdated[rowCount + i - 1, 20] };
-                    load.Load2DistanceFt = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount + i, 22], IsUpdated = isUpdated[rowCount + i - 1, 21] };
-                    load.Load2DistanceIn = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount + i, 23], IsUpdated = isUpdated[rowCount + i - 1, 22] };
-                    load.CaseNumber = new DoubleWithUpdateCheck { Value = ToNullableDouble((string)baseTypesCells[rowCount + i, 24]), IsUpdated = isUpdated[rowCount + i - 1, 23] };
-                    load.LoadNote = new StringWithUpdateCheck { Text = (string)baseTypesCells[rowCount + i, 25], IsUpdated = isUpdated[rowCount + i - 1, 24] };
-                    if (load.IsNull == false)
-                    {
-                        loads.Add(load);
-                    }
-
-                    StringWithUpdateCheck note = new StringWithUpdateCheck { Text = (string)baseTypesCells[rowCount + i, 30], IsUpdated = isUpdated[rowCount + i - 1, 29] };
-                    if (note.Text != null)
-                    {
-                        notes.Add(note);
-                    }
-                    if(note.Text == null && note.IsUpdated == true)
-                    {
-                        notes.Add(note);
-                    }
-
-                }
-                baseType.Loads = loads;
-                baseType.Notes = notes;
-
-                baseTypes.Add(baseType);
-                rowCount = rowCount + rowsForThisBaseType;
+            if (rowCount != 0)
+            {
+                foreach (int rowsForThisBaseType in rowsPerBaseTypeList)
+                {
+                    BaseType baseType = new BaseType();
+
+                    baseType.Name = new StringWithUpdateCheck { Text = (string)baseTypesCells[rowCount, 1], IsUpdated = isUpdated[rowCount - 1, 0] };
+                    baseType.Description = new StringWithUpdateCheck { Text = (string)baseTypesCells[rowCount, 2], IsUpdated = isUpdated[rowCount - 1, 1] };
+                    baseType.BaseLengthFt = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount, 3], IsUpdated = isUpdated[rowCount - 1, 2] };
+                    baseType.BaseLengthIn = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount, 4], IsUpdated = isUpdated[rowCount - 1, 3] };
+                    baseType.TcxlQuantity = new IntWithUpdateCheck { Value = (int?)(double?)baseTypesCells[rowCount, 5], IsUpdated = isUpdated[rowCount - 1, 4] };
+                    baseType.TcxlLengthFt = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount, 6], IsUpdated = isUpdated[rowCount - 1, 5] };
+                    baseType.TcxlLengthIn = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount, 7], IsUpdated = isUpdated[rowCount - 1, 6] };
+                    baseType.TcxrQuantity = new IntWithUpdateCheck { Value = (int?)(double?)baseTypesCells[rowCount, 8], IsUpdated = isUpdated[rowCount - 1, 7] };
+                    baseType.TcxrLengthFt = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount, 9], IsUpdated = isUpdated[rowCount - 1, 8] };
+                    baseType.TcxrLengthIn = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount, 10], IsUpdated = isUpdated[rowCount - 1, 9] };
+                    baseType.SeatDepthLE = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount, 11], IsUpdated = isUpdated[rowCount - 1, 10] };
+                    baseType.SeatDepthRE = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount, 12], IsUpdated = isUpdated[rowCount - 1, 11] };
+                    baseType.BcxQuantity = new IntWithUpdateCheck { Value = (int?)(double?)baseTypesCells[rowCount, 13], IsUpdated = isUpdated[rowCount - 1, 12] };
+                    baseType.Uplift = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount, 14], IsUpdated = isUpdated[rowCount - 1, 13] };
+                    baseType.Erfos = new StringWithUpdateCheck { Text = (string)baseTypesCells[rowCount, 26], IsUpdated = isUpdated[rowCount - 1, 25] };
+                    baseType.DeflectionTL = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount, 27], IsUpdated = isUpdated[rowCount - 1, 26] };
+                    baseType.DeflectionLL = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount, 28], IsUpdated = isUpdated[rowCount - 1, 27] };
+                    baseType.WnSpacing = new StringWithUpdateCheck { Text = (string)baseTypesCells[rowCount, 29], IsUpdated = isUpdated[rowCount - 1, 28] };
+
+
+                    List<Load> loads = new List<Load>();
+                    List<StringWithUpdateCheck> notes = new List<StringWithUpdateCheck>();
+
+                    for (i = 0; i < rowsForThisBaseType; i++)
+                    {
+
+                        Load load = new Load();
+                        load.LoadInfoType = new StringWithUpdateCheck { Text = (string)baseTypesCells[rowCount + i, 15], IsUpdated = isUpdated[rowCount + i - 1, 14] };
+                        load.LoadInfoCategory = new StringWithUpdateCheck { Text = (string)baseTypesCells[rowCount + i, 16], IsUpdated = isUpdated[rowCount + i - 1, 15] };
+                        load.LoadInfoPosition = new StringWithUpdateCheck { Text = (string)baseTypesCells[rowCount + i, 17], IsUpdated = isUpdated[rowCount + i - 1, 16] };
+                        load.Load1Value = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount + i, 18], IsUpdated = isUpdated[rowCount + i - 1, 17] };
+                        load.Load1DistanceFt = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount + i, 19], IsUpdated = isUpdated[rowCount + i - 1, 18] };
+                        load.Load1DistanceIn = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount + i, 20], IsUpdated = isUpdated[rowCount + i - 1, 19] };
+                        load.Load2Value = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount + i, 21], IsUpdated = isUpdated[rowCount + i - 1, 20] };
+                        load.Load2DistanceFt = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount + i, 22], IsUpdated = isUpdated[rowCount + i - 1, 21] };
+                        load.Load2DistanceIn = new DoubleWithUpdateCheck { Value = (double?)baseTypesCells[rowCount + i, 23], IsUpdated = isUpdated[rowCount + i - 1, 22] };
+                        load.CaseNumber = new DoubleWithUpdateCheck { Value = ToNullableDouble((string)baseTypesCells[rowCount + i, 24]), IsUpdated = isUpdated[rowCount + i - 1, 23] };
+                        load.LoadNote = new StringWithUpdateCheck { Text = (string)baseTypesCells[rowCount + i, 25], IsUpdated = isUpdated[rowCount + i - 1, 24] };
+                        if (load.IsNull == false)
+                        {
+                            loads.Add(load);
+                        }
+
+                        StringWithUpdateCheck note = new StringWithUpdateCheck { Text = (string)baseTypesCells[rowCount + i, 30], IsUpdated = isUpdated[rowCount + i - 1, 29] };
+                        if (note.Text != null)
+                        {
+                            notes.Add(note);
+                        }
+                        if (note.Text == null && note.IsUpdated == true)
+                        {
+                            notes.Add(note);
+                        }
+
+                    }
+                    baseType.Loads = loads;
+                    baseType.Notes = notes;
+
+                    baseTypes.Add(baseType);
+                    rowCount = rowCount + rowsForThisBaseType;
+                }
             }

             ///////////////////


Fix grammar issue that made sentence ambiguous (#28785)

--- src/System.Console/src/System/IO/StdInReader.cs
+++ src/System.Console/src/System/IO/StdInReader.cs
@@ -341,7 +341,7 @@
         /// <summary>
         /// Try to intercept the key pressed.
         ///
-        /// Unlike Windows Unix has no concept of virtual key codes.
+        /// Unlike Windows, Unix has no concept of virtual key codes.
         /// Hence, in case we do not recognize a key, we can't really
         /// get the ConsoleKey key code associated with it.
         /// As a result, we try to recognize the key, and if that does


comment some log stuff

comment some log stuff

--- src/TWCore.Messaging/Server/MQueueServerBase.cs
+++ src/TWCore.Messaging/Server/MQueueServerBase.cs
@@ -280,7 +280,7 @@
                 if (_serverQueues?.AdditionalSendQueues?.Any() == true)
                     e.ResponseQueues.AddRange(_serverQueues.AdditionalSendQueues);
                 e.Response.Header.Response.Label = Config.ResponseOptions.ServerSenderOptions.Label;
-                Core.Log.InfoDetail("Request message received with CorrelationId = {0} . Current messages processing = {1}", e.Request.CorrelationId, iMessages);
+                //Core.Log.InfoDetail("Request message received with CorrelationId = {0} . Current messages processing = {1}", e.Request.CorrelationId, iMessages);
                 if (RequestReceived != null)
                     await RequestReceived.InvokeAsync(sender, e).ConfigureAwait(false);
                 e.Response.Header.Response.Label = string.IsNullOrEmpty(e.Response.Header.Response.Label) ? typeof(ResponseMessage).FullName : e.Response.Header.Response.Label;
@@ -334,7 +334,7 @@
             try
             {
                 Counters.IncrementReceivingTime(e.Message.Header.Response.TotalTime);
-                Core.Log.InfoDetail("Response message received with CorrelationId = {0} . Current messages processing = {1}", e.Message.CorrelationId, iMessages);
+                //Core.Log.InfoDetail("Response message received with CorrelationId = {0} . Current messages processing = {1}", e.Message.CorrelationId, iMessages);
                 if (ResponseReceived != null)
                     await ResponseReceived.InvokeAsync(sender, e).ConfigureAwait(false);
                 if (MQueueServerEvents.ResponseReceived != null)


Corrigido o bug das waves angulares

Corrigido o bug das waves angulares

--- Assets/Scripts/Wave.cs
+++ Assets/Scripts/Wave.cs
@@ -14,7 +14,7 @@
 	}

 	public void Shoot (Vector3 direction) {
-		this.GetComponent<Rigidbody2D> ().AddForce ( direction * speed);
+		this.GetComponent<Rigidbody2D> ().AddRelativeForce ( direction * speed);
 		InvokeRepeating ("Fade", 0, 0.1f * fadingTime);
 	}


use for loop to create task instead of enumerable

--- src/MeepMeep/Workloads/WorkloadBase.cs
+++ src/MeepMeep/Workloads/WorkloadBase.cs
@@ -50,20 +50,19 @@
             var workloadTimer = Stopwatch.StartNew();
             if (_rateLimit == 0)
             {
-                await Task.WhenAll(
-                    Enumerable.Range(1, WorkloadSize).Select(index => CreateWorkloadTask(bucket, workloadIndex, 0, workloadResult))
-                );
+                for (var i = 0; i < WorkloadSize; i++)
+                {
+                    await CreateWorkloadTask(bucket, workloadIndex, 0, workloadResult);
+                }
             }
             else
             {
                 var timeConstraint = TimeLimiter.GetFromMaxCountByInterval(_rateLimit, TimeSpan.FromSeconds(1));
-                await Task.WhenAll(
-                    Enumerable.Range(1, WorkloadSize).Select(async index =>
-                    {
-                        await timeConstraint;
-                        return CreateWorkloadTask(bucket, workloadIndex, 0, workloadResult);
-                    })
-                );
+                for (var i = 0; i < WorkloadSize; i++)
+                {
+                    await timeConstraint;
+                    await CreateWorkloadTask(bucket, workloadIndex, 0, workloadResult);
+                }
             }

             workloadResult.TimeTaken = workloadTimer.Elapsed;


Fixed crashes on mobile

Fixed crashes on mobile

--- src/MiNET/MiNET/Blocks/BlockFactory.cs
+++ src/MiNET/MiNET/Blocks/BlockFactory.cs
@@ -99,18 +99,21 @@
 				foreach (var obj in result)
 				{
 					var name = (string) obj.name;
-					if (legacyIdMap.TryGetValue(name, out var id))
+
+					int id = -1;
+					if (legacyIdMap.TryGetValue(name, out id))
 					{
 						LegacyToRuntimeId[((int) id << 4) | (int) obj.data] = (int) runtimeId;
-						Blockstates.Add(runtimeId, new Blockstate()
-						{
-							Id = id,
-							Data = (short) obj.data,
-							Name = name,
-							RuntimeId = runtimeId
-						});
-						runtimeId++;
 					}
+
+					Blockstates.Add(runtimeId, new Blockstate()
+					{
+						Id = id,
+						Data = (short) obj.data,
+						Name = name,
+						RuntimeId = runtimeId
+					});
+					runtimeId++;
 				}
 			}
 		}


Daemonized hosting of the Nancy process

Daemonized hosting of the Nancy process

--- src/MindstormR.Server.Nancy/Program.cs
+++ src/MindstormR.Server.Nancy/Program.cs
@@ -1,29 +1,39 @@
 using System;
-using System.Diagnostics;
+using System.Linq;
+using System.Threading;
 using Nancy.Hosting.Self;

 namespace MindstormR.Server.Nancy
 {
-    class MainClass
+    internal class MainClass
     {
         public static void Main(string[] args)
         {
-            using (var nancyHost = new NancyHost(new Uri("http://localhost:8888/")))
+            const string uri = "http://localhost:8888";
+            W("Starting MindstormR Nancy webserver at {0}", uri);
+
+            var host = new NancyHost(new Uri(uri));
+            host.Start();
+            W("Nancy hosting started");
+
+            // Under mono if you daemonize a process a Console.ReadLine will cause an EOF
+            // so we need to block another way.
+            if (args.Any(s => s.Equals("-d", StringComparison.CurrentCultureIgnoreCase)))
             {
-                nancyHost.Start();
-
-                Console.WriteLine("Nancy now listening - navigating to http://localhost:8888/nancy/. Press enter to stop");
-                try
-                {
-                    Process.Start("http://localhost:8888/");
-                }
-                catch (Exception)
-                {
-                }
+                Thread.Sleep(Timeout.Infinite);
+            }
+            else
+            {
                 Console.ReadKey();
             }

-            Console.WriteLine("Stopped. Good bye!");
+            host.Stop();
+            W("Hosting stopped");
+        }
+
+        private static void W(string format, params object[] args)
+        {
+            Console.WriteLine(format, args);
         }
     }
 }


Added event so people can update their stats at regular intervals

svn path=/trunk/bitsharp/; revision=75369

--- src/MonoTorrent.Client/ClientEngine.cs
+++ src/MonoTorrent.Client/ClientEngine.cs
@@ -55,8 +55,15 @@
         #endregion

-        #region Private Member Variables
-        /// <summary>
+		#region Events
+
+		public event EventHandler StatsUpdate;
+
+		#endregion
+
+
+		#region Private Member Variables
+		/// <summary>
         /// A logic tick will be performed every TickLength miliseconds
         /// </summary>
         internal const int TickLength = 500;
@@ -513,8 +520,15 @@
                         break;  // Do nothing.
                 }
             }
-        }
-
+
+			RaiseStatsUpdate();
+        }
+
+		internal void RaiseStatsUpdate()
+		{
+			if (StatsUpdate != null)
+				StatsUpdate(null, EventArgs.Empty);
+		}

         /// <summary>
         ///


Make class public and all methods virtual so that it can be used as a base class for interceptors.

SVN: 488784591515bd4cdaa016be4ec9b172dc4e7caf@2077

--- src/NHibernate/Cfg/EmptyInterceptor.cs
+++ src/NHibernate/Cfg/EmptyInterceptor.cs
@@ -5,55 +5,46 @@
 namespace NHibernate.Cfg
 {
 	[Serializable]
-	internal class EmptyInterceptor : IInterceptor
+	public class EmptyInterceptor : IInterceptor
 	{
-
-		public EmptyInterceptor()
-		{
-		}
-
-		public void OnDelete( object entity, object id, object[ ] state, string[ ] propertyNames, IType[ ] types )
+		public virtual void OnDelete( object entity, object id, object[ ] state, string[ ] propertyNames, IType[ ] types )
 		{
 		}

-		public bool OnFlushDirty( object entity, object id, object[ ] currentState, object[ ] previousState, string[ ] propertyNames, IType[ ] types )
+		public virtual bool OnFlushDirty( object entity, object id, object[ ] currentState, object[ ] previousState, string[ ] propertyNames, IType[ ] types )
 		{
 			return false;
 		}

-		public bool OnLoad( object entity, object id, object[ ] state, string[ ] propertyNames, IType[ ] types )
+		public virtual bool OnLoad( object entity, object id, object[ ] state, string[ ] propertyNames, IType[ ] types )
 		{
 			return false;
 		}

-		public bool OnSave( object entity, object id, object[ ] state, string[ ] propertyNames, IType[ ] types )
+		public virtual bool OnSave( object entity, object id, object[ ] state, string[ ] propertyNames, IType[ ] types )
 		{
 			return false;
 		}

-		public void OnPostFlush( object entity, object id, object[ ] currentState, string[ ] propertyNames, IType[ ] types )
+		public virtual void PostFlush( ICollection entities )
 		{
 		}

-		public void PostFlush( ICollection entities )
+		public virtual void PreFlush( ICollection entitites )
 		{
 		}

-		public void PreFlush( ICollection entitites )
-		{
-		}
-
-		public object IsUnsaved( object entity )
+		public virtual object IsUnsaved( object entity )
 		{
 			return null;
 		}

-		public object Instantiate( System.Type clazz, object id )
+		public virtual object Instantiate( System.Type clazz, object id )
 		{
 			return null;
 		}

-		public int[ ] FindDirty( object entity, object id, object[ ] currentState, object[ ] previousState, string[ ] propertyNames, IType[ ] types )
+		public virtual int[] FindDirty( object entity, object id, object[] currentState, object[] previousState, string[] propertyNames, IType[] types )
 		{
 			return null;
 		}


added append method

added append method

SVN: 488784591515bd4cdaa016be4ec9b172dc4e7caf@284

--- src/NHibernate/SqlCommand/SqlString.cs
+++ src/NHibernate/SqlCommand/SqlString.cs
@@ -25,6 +25,16 @@

 		public object[] SqlParts {
 			get { return sqlParts;}
+		}
+
+		// this method treats this as immutable
+		public SqlString Append(SqlString sqlString)
+		{
+		    object[] temp = new object[sqlString.SqlParts.Length + sqlParts.Length];
+			Array.Copy(sqlParts, 0, temp, 0, sqlParts.Length);
+			Array.Copy(sqlString.SqlParts, 0, temp, sqlParts.Length, sqlString.SqlParts.Length);
+
+			return new SqlString(temp);
 		}

 		/// <summary>


StringBuilderPool - Allow FastPool-object to have larger capacity without being discarded

--- src/NLog/Internal/StringBuilderPool.cs
+++ src/NLog/Internal/StringBuilderPool.cs
@@ -93,7 +93,12 @@
         {
             if (stringBuilder.Length > _maxBuilderCapacity)
             {
-                stringBuilder = new StringBuilder(_maxBuilderCapacity / 2);
+                // Avoid high memory usage by not keeping huge StringBuilders alive (Except one StringBuilder)
+                int maxBuilderCapacity = poolIndex == -1 ? _maxBuilderCapacity * 10 : _maxBuilderCapacity;
+                if (stringBuilder.Length > maxBuilderCapacity)
+                {
+                    stringBuilder = new StringBuilder(maxBuilderCapacity / 2);
+                }
             }
             else
             {


Consistently complete with OCE on cancellation

Fixes #170

--- src/Nerdbank.Streams/PipeExtensions.cs
+++ src/Nerdbank.Streams/PipeExtensions.cs
@@ -111,8 +111,9 @@
             {
                 try
                 {
-                    while (!cancellationToken.IsCancellationRequested)
-                    {
+                    while (true)
+                    {
+                        cancellationToken.ThrowIfCancellationRequested();
                         ReadResult readResult = await pipe.Reader.ReadAsync(cancellationToken).ConfigureAwait(false);
                         if (readResult.Buffer.Length > 0)
                         {
@@ -233,11 +234,12 @@
             var pipe = new Pipe(pipeOptions ?? PipeOptions.Default);
             Task.Run(async delegate
             {
-                while (!cancellationToken.IsCancellationRequested)
+                while (true)
                 {
                     Memory<byte> memory = pipe.Writer.GetMemory(sizeHint);
                     try
                     {
+                        cancellationToken.ThrowIfCancellationRequested();
                         var readResult = await webSocket.ReceiveAsync(memory, cancellationToken).ConfigureAwait(false);
                         if (readResult.Count == 0)
                         {
@@ -283,8 +285,9 @@
             {
                 try
                 {
-                    while (!cancellationToken.IsCancellationRequested)
-                    {
+                    while (true)
+                    {
+                        cancellationToken.ThrowIfCancellationRequested();
                         ReadResult readResult = await pipe.Reader.ReadAsync(cancellationToken).ConfigureAwait(false);
                         if (readResult.Buffer.Length > 0)
                         {
@@ -389,8 +392,9 @@
             {
                 try
                 {
-                    while (!cancellationToken.IsCancellationRequested)
-                    {
+                    while (true)
+                    {
+                        cancellationToken.ThrowIfCancellationRequested();
                         var result = await reader.ReadAsync(cancellationToken).ConfigureAwait(false);
                         writer.Write(result.Buffer);
                         reader.AdvanceTo(result.Buffer.End);


Clean up comments slightly in MapZone.

Clean up comments slightly in MapZone.

--- src/NodaTime/TimeZones/Cldr/MapZone.cs
+++ src/NodaTime/TimeZones/Cldr/MapZone.cs
@@ -53,20 +53,22 @@
         public string Territory { get { return territory; } }

         /// <summary>
-        /// Gets a read-only collection of TZDB zone identifiers for this mapping, such as
+        /// Gets a read-only non-empty collection of TZDB zone identifiers for this mapping, such as
         /// "America/Chicago" and "America/Matamoros" (both of which are TZDB zones associated with the "Central Standard Time"
         /// Windows system time zone).
         /// </summary>
         /// <remarks>
-        /// For the primary and fixed-offset territory IDs ("001" and "ZZ") this is always
-        /// a single zone ID.
+        /// For the primary and fixed-offset territory IDs ("001" and "ZZ") this always
+        /// contains exactly one time zone ID.
         /// </remarks>
         public IList<string> TzdbIds { get { return tzdbIds; } }

         /// <summary>
-        /// Creates a new mapping entry. This constructor is public mostly to allow code which needs
-        /// to use this class to create
+        /// Creates a new mapping entry.
         /// </summary>
+        /// <remarks>
+        /// This constructor is only public for the sake of testability.
+        /// </remarks>
         /// <param name="windowsId">Windows system time zone identifier. Must not be null.</param>
         /// <param name="territory">Territory code. Must not be null.</param>
         /// <param name="tzdbIds">List of territory codes. Must not be null, and must not


More work on the same, once again intermediate commit.

--- Source/CILAssemblyManipulator/CILAssemblyManipulator.Physical/MetaData.Signatures.cs
+++ Source/CILAssemblyManipulator/CILAssemblyManipulator.Physical/MetaData.Signatures.cs
@@ -99,33 +99,46 @@
          out Int32 sentinelMark
          )
       {
-         var retVal = idx >= 0 && idx < sig.Length;
-         if ( retVal )
-         {
-            elementType = (SignatureStarters) sig.ReadByteFromBytes( ref idx );
+         var retVal = false;
+         if ( stream.TryReadSigStarter( out elementType ) )
+         {
             genericCount = 0;
-            if ( elementType.IsGeneric() )
-            {
-               genericCount = sig.DecompressUInt32( ref idx );
-            }
-
-            var amountOfParams = sig.DecompressUInt32( ref idx );
-            retVal = amountOfParams >= 0 && amountOfParams <= UInt16.MaxValue;
-            if ( retVal )
-            {
-               returnParameter = ReadParameter( sig, ref idx );
+            Int32 amountOfParams;
+            if ( ( !elementType.IsGeneric() || stream.DecompressUInt32( out genericCount ) )
+                 && stream.DecompressUInt32( out amountOfParams )
+                 && amountOfParams <= UInt16.MaxValue
+               )
+            {
+               returnParameter = ReadParameter( stream );
                sentinelMark = -1;
                if ( amountOfParams > 0 )
                {
                   parameters = new ParameterSignature[amountOfParams];
-                  for ( var i = 0; i < amountOfParams; ++i )
+                  Int32 i;
+                  for ( i = 0; i < amountOfParams; ++i )
                   {
-                     if ( sig[idx] == (Byte) SignatureElementTypes.Sentinel )
+                     SignatureElementTypes sentinel;
+                     if ( stream.TryReadSigElementType( out sentinel ) )
                      {
-                        sentinelMark = i;
+                        if ( sentinel == SignatureElementTypes.Sentinel )
+                        {
+                           sentinelMark = i;
+                        }
+                        else
+                        {
+                           --stream.Stream.Position;
+                        }
+                        if ( ( parameters[i] = ReadParameter( stream ) ) == null )
+                        {
+                           break;
+                        }
                      }
-                     parameters[i] = ReadParameter( sig, ref idx );
+                     else
+                     {
+                        break;
+                     }
                   }
+                  retVal = i == amountOfParams;
                }
                else
                {
@@ -153,30 +166,44 @@
          return retVal;
       }

-      internal static ParameterSignature ReadParameter( Byte[] sig, ref Int32 idx )
+      internal static ParameterSignature ReadParameter( StreamHelper stream )
       {
          var retVal = new ParameterSignature();
-         CustomModifierSignature.AddFromBytes( sig, ref idx, retVal.CustomModifiers );
-         var elementType = (SignatureElementTypes) sig.ReadByteFromBytes( ref idx );
-         TypeSignature type;
-         if ( elementType == SignatureElementTypes.TypedByRef )
-         {
-            type = SimpleTypeSignature.TypedByRef;
+         CustomModifierSignature.AddFromBytes( stream, retVal.CustomModifiers );
+         SignatureElementTypes elementType;
+         if ( stream.TryReadSigElementType( out elementType ) )
+         {
+            TypeSignature type;
+            if ( elementType == SignatureElementTypes.TypedByRef )
+            {
+               type = SimpleTypeSignature.TypedByRef;
+            }
+            else
+            {
+               if ( elementType == SignatureElementTypes.ByRef )
+               {
+                  retVal.IsByRef = true;
+               }
+               else
+               {
+                  // Go backwards
+                  --stream.Stream.Position;
+               }
+               type = TypeSignature.ReadTypeSignature( stream );
+               if ( type == null )
+               {
+                  retVal = null;
+               }
+               else
+               {
+                  retVal.Type = type;
+               }
+            }
          }
          else
          {
-            if ( elementType == SignatureElementTypes.ByRef )
-            {
-               retVal.IsByRef = true;
-            }
-            else
-            {
-               // Go backwards
-               --idx;
-            }
-            type = TypeSignature.ReadFromBytesWithRef( sig, ref idx );
-         }
-         retVal.Type = type;
+            retVal = null;
+         }
          return retVal;
       }
    }
@@ -196,12 +223,8 @@
          }
       }

-      public static MethodDefinitionSignature ReadFromBytes( Byte[] sig, Int32 idx )
-      {
-         return ReadFromBytesWithRef( sig, ref idx );
-      }
-
-      public static MethodDefinitionSignature ReadFromBytesWithRef( Byte[] sig, ref Int32 idx )
+
+      public static MethodDefinitionSignature ReadMethodSignature( StreamHelper stream )
       {
          SignatureStarters elementType;
          Int32 genericCount;
@@ -209,7 +232,7 @@
          ParameterSignature[] parameters;
          Int32 sentinelMark;
          MethodDefinitionSignature retVal;
-         if ( ReadFromBytes( sig, ref idx, out elementType, out genericCount, out returnParameter, out parameters, out sentinelMark ) )
+         if ( ReadFromBytes( stream, out elementType, out genericCount, out returnParameter, out parameters, out sentinelMark ) )
          {
             retVal = new MethodDefinitionSignature( parameters.Length )
             {
@@ -217,10 +240,7 @@
                ReturnType = returnParameter,
                SignatureStarter = elementType,
             };
-            foreach ( var p in parameters )
-            {
-               retVal.Parameters.Add( p );
-            }
+            retVal.Parameters.AddRange( parameters );
          }
          else
          {
@@ -256,7 +276,7 @@
          }
       }

-      public static MethodReferenceSignature ReadFromBytes( StreamHelper stream )
+      public static MethodReferenceSignature ReadMethodSignature( StreamHelper stream )
       {
          SignatureStarters elementType;
          Int32 genericCount;
@@ -264,7 +284,7 @@
          ParameterSignature[] parameters;
          Int32 sentinelMark;
          MethodReferenceSignature retVal;
-         if ( ReadFromBytes( sig, ref idx, out elementType, out genericCount, out returnParameter, out parameters, out sentinelMark ) )
+         if ( ReadFromBytes( stream, out elementType, out genericCount, out returnParameter, out parameters, out sentinelMark ) )
          {
             var pLength = sentinelMark == -1 ? parameters.Length : sentinelMark;
             var vLength = sentinelMark == -1 ? 0 : ( parameters.Length - sentinelMark );
@@ -274,13 +294,10 @@
                ReturnType = returnParameter,
                SignatureStarter = elementType,
             };
-            for ( var i = 0; i < pLength; ++i )
-            {
-               retVal.Parameters.Add( parameters[i] );
-            }
-            for ( var i = 0; i < vLength; ++i )
-            {
-               retVal.VarArgsParameters.Add( parameters[i + pLength] );
+            retVal.Parameters.AddRange( vLength > 0 ? parameters.Take( pLength ) : parameters );
+            if ( vLength > 0 )
+            {
+               retVal.VarArgsParameters.AddRange( parameters.Skip( pLength ) );
             }
          }
          else
@@ -327,12 +344,7 @@
          }
       }

-      public static FieldSignature ReadFromBytes( Byte[] sig, Int32 idx )
-      {
-         return ReadFromBytesWithRef( sig, ref idx );
-      }
-
-      public static FieldSignature ReadFromBytesWithRef( Byte[] sig, ref Int32 idx )
+      public static FieldSignature ReadFieldSignature( StreamHelper stream )
       {
          FieldSignature retVal;
          if ( idx >= 0 && idx < sig.Length )
@@ -616,7 +628,7 @@
          Int32 auxiliary;
          SignatureElementTypes elementType;
          TypeSignature retVal = null;
-         if ( TryReadSigElementType( stream, out elementType ) )
+         if ( stream.TryReadSigElementType( out elementType ) )
          {
             switch ( elementType )
             {
@@ -654,7 +666,7 @@
                case SignatureElementTypes.GenericInst:
                   var isGeneric = elementType == SignatureElementTypes.GenericInst;
                   if ( !isGeneric
-                     || ( TryReadSigElementType( stream, out elementType )
+                     || ( stream.TryReadSigElementType( out elementType )
                         && ( elementType == SignatureElementTypes.Class || elementType == SignatureElementTypes.ValueType )
                         )
                      )
@@ -715,14 +727,6 @@
                   break;
             }
          }
-         return retVal;
-      }
-
-      private static Boolean TryReadSigElementType( StreamHelper stream, out SignatureElementTypes sig )
-      {
-         Byte b;
-         var retVal = stream.TryReadByteFromBytes( out b );
-         sig = retVal ? (SignatureElementTypes) b : SignatureElementTypes.End;
          return retVal;
       }

@@ -2301,4 +2305,20 @@
             return null;
       }
    }
+
+   internal static Boolean TryReadSigElementType( this StreamHelper stream, out SignatureElementTypes sig )
+   {
+      Byte b;
+      var retVal = stream.TryReadByteFromBytes( out b );
+      sig = retVal ? (SignatureElementTypes) b : SignatureElementTypes.End;
+      return retVal;
+   }
+
+   internal static Boolean TryReadSigStarter( this StreamHelper stream, out SignatureStarters sig )
+   {
+      Byte b;
+      var retVal = stream.TryReadByteFromBytes( out b );
+      sig = retVal ? (SignatureStarters) b : (SignatureStarters) 0;
+      return retVal;
+   }
 }