Added search and comment deletion

Added search and comment deletion

--- Eagleslist/RequestManager.cs
+++ Eagleslist/RequestManager.cs
@@ -7,6 +7,7 @@
 using System.Net;
 using System.IO;
 using System.Text;
+using System.Web;

 namespace Eagleslist
 {
@@ -28,6 +29,12 @@
             return await ListingsFromJson(responseString);
         }

+        public static async Task<List<Listing>> SearchForText(string text)
+        {
+            var url = $"{RootUrl}apidb/searchlistings/{HttpUtility.UrlEncode(text)}";
+            return await GetJson<List<Listing>>(url);
+        }
+
         public static async Task<BitmapImage> GetBitmapFromUri(Uri uri)
         {
             var bytes = await new WebClient().DownloadDataTaskAsync(uri);
@@ -148,11 +155,28 @@
                     { "Comment", comment }
                 };

-                Console.WriteLine(JsonConvert.SerializeObject(commentRequest));
-
                 var response = await SendObjectAsJson<CommentCreationResponse>(commentRequest, url, client.PostAsync);
-                Console.WriteLine(response.Error);
-                Console.Write("Posted a comment and response was: " + response);
+                return !string.IsNullOrEmpty(response?.Error) ? null : response;
+            }
+        }
+
+        public static async Task<CommentCreationResponse> DeleteComment(Comment comment)
+        {
+            var session = CredentialManager.GetCurrentUser()?.SessionID;
+            if (comment == null || session == null)
+            {
+                return null;
+            }
+
+            using (var client = new HttpClient(DefaultRequestHandler()))
+            {
+                var url = RootUrl + $"apidb/deletecomment/{comment.ID}/";
+                var commentRequest = new Dictionary<string, object>()
+                {
+                    { "SessionID", session }
+                };
+
+                var response = await SendObjectAsJson<CommentCreationResponse>(commentRequest, url, client.PutAsync);
                 return !string.IsNullOrEmpty(response?.Error) ? null : response;
             }
         }


trial subs can be reinstated

trial subs can be reinstated

--- src/Core/Utilities/BillingHelpers.cs
+++ src/Core/Utilities/BillingHelpers.cs
@@ -310,7 +310,7 @@
                 throw new BadRequestException("Subscription was not found.");
             }

-            if(sub.Status != "active" || !sub.CanceledAt.HasValue)
+            if((sub.Status != "active" && sub.Status != "trialing") || !sub.CanceledAt.HasValue)
             {
                 throw new BadRequestException("Subscription is not marked for cancellation.");
             }


Fixed CFProxySupport to make sure keys are valid before trying to use them

--- src/CoreFoundation/CFProxySupport.cs
+++ src/CoreFoundation/CFProxySupport.cs
@@ -206,29 +206,35 @@

 		static CFProxyType CFProxyTypeToEnum (NSString type)
 		{
-#if !MONOMAC
-			if (MonoTouch.UIKit.UIDevice.CurrentDevice.CheckSystemVersion (4, 0)) {
-#endif
+			if (CFProxyTypeAutoConfigurationJavaScript != null) {
 				if (type.Handle == CFProxyTypeAutoConfigurationJavaScript.Handle)
 					return CFProxyType.AutoConfigurationJavaScript;
-#if !MONOMAC
-			}
-#endif
-
-			if (type.Handle == CFProxyTypeAutoConfigurationURL.Handle)
-				return CFProxyType.AutoConfigurationUrl;
-
-			if (type.Handle == CFProxyTypeFTP.Handle)
-				return CFProxyType.FTP;
-
-			if (type.Handle == CFProxyTypeHTTP.Handle)
-				return CFProxyType.HTTP;
-
-			if (type.Handle == CFProxyTypeHTTPS.Handle)
-				return CFProxyType.HTTPS;
-
-			if (type.Handle == CFProxyTypeSOCKS.Handle)
-				return CFProxyType.SOCKS;
+			}
+
+			if (CFProxyTypeAutoConfigurationURL != null) {
+				if (type.Handle == CFProxyTypeAutoConfigurationURL.Handle)
+					return CFProxyType.AutoConfigurationUrl;
+			}
+
+			if (CFProxyTypeFTP != null) {
+				if (type.Handle == CFProxyTypeFTP.Handle)
+					return CFProxyType.FTP;
+			}
+
+			if (CFProxyTypeHTTP != null) {
+				if (type.Handle == CFProxyTypeHTTP.Handle)
+					return CFProxyType.HTTP;
+			}
+
+			if (CFProxyTypeHTTP != null) {
+				if (type.Handle == CFProxyTypeHTTPS.Handle)
+					return CFProxyType.HTTPS;
+			}
+
+			if (CFProxyTypeSOCKS != null) {
+				if (type.Handle == CFProxyTypeSOCKS.Handle)
+					return CFProxyType.SOCKS;
+			}

 			return CFProxyType.None;
 		}
@@ -242,21 +248,30 @@
 		}
 #endif

-		[Since (4, 0)]
+		[Since (4, 0)][Lion]
 		public NSString AutoConfigurationJavaScript {
 			get {
+				if (AutoConfigurationJavaScriptKey == null)
+					return null;
+
 				return (NSString) settings[AutoConfigurationJavaScriptKey];
 			}
 		}

 		public NSUrl AutoConfigurationUrl {
 			get {
+				if (AutoConfigurationURLKey == null)
+					return null;
+
 				return (NSUrl) settings[AutoConfigurationURLKey];
 			}
 		}

 		public string HostName {
 			get {
+				if (HostNameKey == null)
+					return null;
+
 				NSString v = (NSString) settings[HostNameKey];

 				return v != null ? v.ToString () : null;
@@ -265,6 +280,9 @@

 		public string Password {
 			get {
+				if (PasswordKey == null)
+					return null;
+
 				NSString v = (NSString) settings[PasswordKey];

 				return v != null ? v.ToString () : null;
@@ -273,6 +291,9 @@

 		public int Port {
 			get {
+				if (PortNumberKey == null)
+					return 0;
+
 				NSNumber v = (NSNumber) settings[PortNumberKey];

 				return v != null ? v.Int32Value : 0;
@@ -281,12 +302,18 @@

 		public CFProxyType ProxyType {
 			get {
+				if (ProxyTypeKey == null)
+					return CFProxyType.None;
+
 				return CFProxyTypeToEnum ((NSString) settings[ProxyTypeKey]);
 			}
 		}

 		public string Username {
 			get {
+				if (UsernameKey == null)
+					return null;
+
 				NSString v = (NSString) settings[UsernameKey];

 				return v != null ? v.ToString () : null;
@@ -370,6 +397,9 @@

 		public bool HTTPEnable {
 			get {
+				if (CFNetworkProxiesHTTPEnable == null)
+					return false;
+
 				NSNumber v = (NSNumber) settings[CFNetworkProxiesHTTPEnable];

 				return v != null ? v.BoolValue : false;
@@ -378,6 +408,9 @@

 		public int HTTPPort {
 			get {
+				if (CFNetworkProxiesHTTPPort == null)
+					return 0;
+
 				NSNumber v = (NSNumber) settings[CFNetworkProxiesHTTPPort];

 				return v != null ? v.Int32Value : 0;
@@ -386,6 +419,9 @@

 		public string HTTPProxy {
 			get {
+				if (CFNetworkProxiesHTTPProxy == null)
+					return null;
+
 				NSString v = (NSString) settings[CFNetworkProxiesHTTPProxy];

 				return v != null ? v.ToString () : null;
@@ -394,6 +430,9 @@

 		public bool ProxyAutoConfigEnable {
 			get {
+				if (CFNetworkProxiesProxyAutoConfigEnable == null)
+					return false;
+
 				NSNumber v = (NSNumber) settings[CFNetworkProxiesProxyAutoConfigEnable];

 				return v != null ? v.BoolValue : false;
@@ -402,6 +441,9 @@

 		public string ProxyAutoConfigJavaScript {
 			get {
+				if (CFNetworkProxiesProxyAutoConfigJavaScript == null)
+					return null;
+
 				NSString v = (NSString) settings[CFNetworkProxiesProxyAutoConfigJavaScript];

 				return v != null ? v.ToString () : null;
@@ -410,6 +452,9 @@

 		public string ProxyAutoConfigURLString {
 			get {
+				if (CFNetworkProxiesProxyAutoConfigURLString == null)
+					return null;
+
 				NSString v = (NSString) settings[CFNetworkProxiesProxyAutoConfigURLString];

 				return v != null ? v.ToString () : null;


Documentation

Documentation

--- Filewalker/FixedSizedList.cs
+++ Filewalker/FixedSizedList.cs
@@ -43,9 +43,11 @@
         protected int maxSize = 0;

         ///
-        ///
-        ///
-        /// <param name="size"></param>
+        /// Initialises a new instance of the list, setting the maximum number of items it will hold
+        /// to size.
+        ///
+        /// <param name="size">The maximum number of elements the list will contain.</param>
+        /// <exception cref="System.ArgumentOutOfRangeException">size is less than 0.</exception>
         public FixedSizedList(int size)
         {
             try
@@ -64,7 +66,8 @@
         /// the list can contain is set to the length of items.
         ///
         /// <param name="items">The items to fill the list with.</param>
-        /// <exception cref="System.ArgumentNullException">An element</exception>
+        /// <exception cref="System.ArgumentNullException">An element in the array evaluates to null,
+        /// or items itself is null.</exception>
         public FixedSizedList(T[] items) : this(items.Length)
         {
             try


Changed Color to property with backing field, set is now public.

--- GConsole/Scripts/GConsole.cs
+++ GConsole/Scripts/GConsole.cs
@@ -23,10 +23,16 @@
     public static event GConsoleListener OnOutput;

     /// <summary>
-    /// <para>Color code, used to color any text. Set color in <see cref="SetColorCode"/></para>
+    /// <para>Color code, used to color any text. Set color code that your GUI use.</para>
     /// <para>arg1 = text, arg2 = color.</para>
     /// </summary>
-    public static Func<string, string, string> Color { get; private set; }
+    public static Func<string, string, string> Color {
+       get { return _color; }
+       set {
+           _color = value;
+           updateDefaultMessages();
+       }
+    }

    #region Default Output

@@ -39,12 +45,13 @@
     private static string LOG_STRING;
     private static string EXCEPTION_STRING;
     private static string ASSERT_STRING;
-
-    #endregion
+   private static Func<string, string, string> _color;
+
+   #endregion

     static GConsole()
     {
-       SetColorCode((text, color) => text);
+       Color = (text, color) => text;
     }

     #region Unity Callbacks
@@ -187,16 +194,6 @@
     #endregion

     #region Utility Methods
-
-    /// <summary>
-    /// Set the <see cref="Color"/> code that your GUI use.
-    /// </summary>
-    /// <param name="code">arg1 is text, arg2 is color</param>
-    public static void SetColorCode(Func<string, string, string> code)
-    {
-       Color = code;
-       updateDefaultMessages();
-    }

     //Extract the parameters from a command (removing the first word and trimming the rest).
     private static string ExtractParameters(string command, string root)


Switched to using SQL Server for locations

--- GPSLogger/CompositionRoot.cs
+++ GPSLogger/CompositionRoot.cs
@@ -16,6 +16,8 @@
 using System.Reflection;
 using Microsoft.AspNetCore.Mvc;
 using Common.Utilities;
+using Common.RemoteStorage.Command;
+using Common.RemoteStorage.Query;

 namespace GPSLogger
 {
@@ -77,12 +79,32 @@
             builder.RegisterType<PersistentStoreManager>().SingleInstance();

             { // Controllers
-                // Location storage
-                var locations = new ConcurrentDictionary<string, ConcurrentQueue<Location>>();
-                var listGetter = new Func<string, ConcurrentQueue<Location>>(id => locations.GetOrAdd(id, x => new ConcurrentQueue<Location>()));
-                builder.RegisterInstance(new LocationController.HandleLocationPost((id, location) => listGetter(id.ToHexString()).Enqueue(location))).SingleInstance();
-                builder.RegisterInstance(new LocationController.LocationProvider(id => listGetter(id.ToHexString()))).SingleInstance();
-
+                // Location storage and retrieval
+                builder.Register(c =>
+                {
+                    var locationPoster = c.Resolve<ILocationPoster>();
+
+                    return new LocationController.HandleLocationPost((id, location) =>
+                    {
+                        locationPoster.PostLocationAsync(id, new Common.RemoteStorage.Models.Location
+                        {
+                            Latitude = location.Latitude,
+                            Longitude = location.Longitude
+                        }).Wait();
+                    });
+                });
+                builder.Register(c =>
+                {
+                    var locationProvider = c.Resolve<ILocationProvider>();
+
+                    return new LocationController.LocationProvider(id =>
+                    {
+                        var identifiedLocations = locationProvider.GetAllLocationsAsync(id).WaitAndGet();
+                        var locations = identifiedLocations.Select(x => new Location { Latitude = x.Latitude, Longitude = x.Longitude });
+                        return locations;
+                    });
+                });
+
                 // Location serializer
                 builder.Register(c =>
                 {


Document UshortExtensions

Document UshortExtensions

--- JAGBE/GB/UShortExtensions.cs
+++ JAGBE/GB/UShortExtensions.cs
@@ -1,7 +1,16 @@
 namespace JAGBE.GB
 {
+    /// <summary>
+    /// Provides extension methods for <see cref="ushort"/>
+    /// </summary>
     internal static class UShortExtensions
     {
-        public static bool GetHalfCarry(this ushort a, ushort b) => (((a & 0xFFF) + (b & 0xFFF)) & 0x1000) == 0x1000;
+        /// <summary>
+        /// determines weather adding two ushorts would produce a half carry.
+        /// </summary>
+        /// <param name="u">The first value.</param>
+        /// <param name="val">The second value.</param>
+        /// <returns></returns>
+        public static bool GetHalfCarry(this ushort u, ushort val) => (((u & 0xFFF) + (val & 0xFFF)) & 0x1000) == 0x1000;
     }
 }


remove duplicate blank line

remove duplicate blank line

--- JsonSubTypes/JsonSubtypes.cs
+++ JsonSubTypes/JsonSubtypes.cs
@@ -200,7 +200,6 @@
             return jObjectReader;
         }

-
         private Type GetType(JObject jObject, Type parentType)
         {
             if (JsonDiscriminatorPropertyName == null)
@@ -218,7 +217,7 @@
             JsonSubtypes currentTypeResolver = this;

             var jsonConverterCollection = serializer.Converters.OfType<JsonSubtypesConverter>();
-            while (currentTypeResolver != null && currentTypeResolver != lastTypeResolver)
+            while (currentTypeResolver != null && currentTypeResolver != lastTypeResolver)
             {
                 targetType = currentTypeResolver.GetType(jObject, targetType);
                 lastTypeResolver = currentTypeResolver;


Fixed SetStatus

Fixed SetStatus

--- src/Discord.Net/DiscordClient.API.cs
+++ src/Discord.Net/DiscordClient.API.cs
@@ -664,7 +664,7 @@
 		}
 		private Task SendStatus()
 		{
-			_dataSocket.SendStatus(_status == UserStatus.Away ? EpochTime.GetMilliseconds() : (ulong?)null, _gameId);
+			_dataSocket.SendStatus(_status == UserStatus.Away ? EpochTime.GetMilliseconds() - (10 * 60 * 1000) : (ulong?)null, _gameId);
 			return TaskHelper.CompletedTask;
 		}


Code style tweak.

Code style tweak.

--- src/Faithlife.Parsing/ParseResult.cs
+++ src/Faithlife.Parsing/ParseResult.cs
@@ -35,8 +35,8 @@
 	/// <summary>
 	/// Maps a successful parse result into another parse result (success or failure).
 	/// </summary>
-	public static IParseResult<TAfter> MapSuccess<TBefore, TAfter>(this IParseResult<TBefore> result, Func<IParseResult<TBefore>, IParseResult<TAfter>> convert)
-		=> result.Success ? convert(result) : Failure<TAfter>(result.NextPosition);
+	public static IParseResult<TAfter> MapSuccess<TBefore, TAfter>(this IParseResult<TBefore> result, Func<IParseResult<TBefore>, IParseResult<TAfter>> convert) =>
+		result.Success ? convert(result) : Failure<TAfter>(result.NextPosition);

 	/// <summary>
 	/// Creates a message for the parse result.


Improve the PrimaryConvention's diff tool launch behavior so that the diff tool can be launched any time that the run contains a single failure and that single failure has no compact representation. This allows the behavior to run even when the full suite is executed, rather than forcing the developer to run the single failure a second time in order to get the behavior.

--- src/Fixie.Tests/PrimaryConvention.cs
+++ src/Fixie.Tests/PrimaryConvention.cs
@@ -1,5 +1,6 @@
 namespace Fixie.Tests
 {
+    using System;
     using System.Diagnostics;
     using System.IO;
     using System.Linq;
@@ -13,6 +14,9 @@
     {
         public async Task RunAsync(TestAssembly testAssembly)
         {
+            int failures = 0;
+            Exception? singleFailure = null;
+
             foreach (var testClass in testAssembly.TestClasses)
             {
                 foreach (var test in testClass.Tests)
@@ -20,12 +24,17 @@
                     var result = await test.RunAsync();

                     if (result is CaseFailed failure)
-                        if (failure.Exception is AssertException exception)
-                            if (!exception.HasCompactRepresentations)
-                                if (testClass.TestAssembly.SelectedTests.Count == 1)
-                                    LaunchDiffTool(exception);
+                    {
+                        failures++;
+
+                        singleFailure = failures == 1 ? failure.Exception : null;
+                    }
                 }
             }
+
+            if (failures == 1 && singleFailure is AssertException exception)
+                if (!exception.HasCompactRepresentations)
+                    LaunchDiffTool(exception);
         }

         static void LaunchDiffTool(AssertException exception)


Fixes dotnet executable path for MacOs

Fixes dotnet executable path for MacOs

--- src/FlubuCore.Tests/FlubuTestBase.cs
+++ src/FlubuCore.Tests/FlubuTestBase.cs
@@ -8,6 +8,7 @@
 using FlubuCore.Scripting;
 using FlubuCore.Targeting;
 using FlubuCore.Tasks;
+using FlubuCore.Tasks.NetCore;
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.Logging;

@@ -47,13 +48,7 @@

         protected ILoggerFactory LoggerFactory { get; }

-        public string PathToDotnetExecutable
-        {
-            get
-            {
-                return GetOsPlatform() == OSPlatform.Windows ? "C:\\Program Files\\dotnet\\dotnet.exe" : "/usr/bin/dotnet";
-            }
-        }
+        public string PathToDotnetExecutable => ExecuteDotnetTask.FindDotnetExecutable();

         public static OSPlatform GetOsPlatform()
         {


finishing up plotly with extension method

--- src/ICSharp.Console/XPlot.Plotly.csx
+++ src/ICSharp.Console/XPlot.Plotly.csx
@@ -48,5 +48,30 @@
 script = script.Replace("%s", plotly_min_js);
 App.Display(script.AsHtml());

-// more to come...
+public static string GetPngHtml(this PlotlyChart chart)
+{
+    string html = chart.GetInlineHtml();
+    return html
+        .Replace("Plotly.newPlot(", "Plotly.plot(")
+        .Replace("data, layout);", "data, layout).then(ifsharpMakePng);");
+}

+public static string GetSvgHtml(this PlotlyChart chart)
+{
+    string html = chart.GetInlineHtml();
+    return html
+        .Replace("Plotly.newPlot(", "Plotly.plot(")
+        .Replace(
+            "data, layout);",
+            "data, layout).then(ifsharpMakeSvg);");
+}
+
+// TODO: This is not working need to understand this error...
+// (9,1): error CS1929: 'PlotlyChart' does not contain a definition for 'Png' and the best extension method overload 'Png(PlotlyChart)' requires a receiver of type 'PlotlyChart'
+public static BinaryOutput Png(this PlotlyChart chart) =>
+    new BinaryOutput() { ContentType = "text/html", Data = chart.GetPngHtml() };
+
+// TODO: This is not working need to understand this error...
+// (9,1): error CS1929: 'PlotlyChart' does not contain a definition for 'Svg' and the best extension method overload 'Svg(PlotlyChart)' requires a receiver of type 'PlotlyChart'
+public static BinaryOutput Svg(this PlotlyChart chart) =>
+    new BinaryOutput() { ContentType = "text/html", Data = chart.GetSvgHtml() };


publish all installers on all platforms

publish all installers on all platforms

--- build_projects/dotnet-host-build/PublishTargets.cs
+++ build_projects/dotnet-host-build/PublishTargets.cs
@@ -231,7 +231,6 @@
         }

         [Target]
-        [BuildPlatforms(BuildPlatform.Ubuntu, BuildPlatform.Windows)]
         public static BuildTargetResult PublishSharedHostInstallerFileToAzure(BuildTargetContext c)
         {
             var version = SharedHostNugetVersion;
@@ -248,7 +247,6 @@
         }

         [Target]
-        [BuildPlatforms(BuildPlatform.Ubuntu)]
         public static BuildTargetResult PublishSharedFrameworkInstallerFileToAzure(BuildTargetContext c)
         {
             var version = SharedFrameworkNugetVersion;
@@ -260,7 +258,6 @@
         }

         [Target]
-        [BuildPlatforms(BuildPlatform.Windows, BuildPlatform.OSX)]
         public static BuildTargetResult PublishCombinedFrameworkHostInstallerFileToAzure(BuildTargetContext c)
         {
             var version = SharedFrameworkNugetVersion;


Minor compile issue with older versions (#469)

--- targets/unity-v2/source/Shared/Internal/PlayFabHttp/OneDsWwwPlugin.cs
+++ targets/unity-v2/source/Shared/Internal/PlayFabHttp/OneDsWwwPlugin.cs
@@ -58,7 +58,7 @@
             www.chunkedTransfer = false;
             yield return www.SendWebRequest();
 #else
-            yield return webRequest.Send();
+            yield return www.Send();
 #endif

             using (www)


extra test

extra test

--- test/Ocelot.UnitTests/Configuration/HttpHandlerOptionsCreatorTests.cs
+++ test/Ocelot.UnitTests/Configuration/HttpHandlerOptionsCreatorTests.cs
@@ -175,6 +175,25 @@
                 .BDDfy();
         }

+        [Fact]
+        public void should_create_options_fixing_specified_MaxConnectionsPerServer_range_when_zero()
+        {
+            var fileReRoute = new FileReRoute
+            {
+                HttpHandlerOptions = new FileHttpHandlerOptions
+                {
+                    MaxConnectionsPerServer = 0
+                }
+            };
+
+            var expectedOptions = new HttpHandlerOptions(false, false, false, true, int.MaxValue);
+
+            this.Given(x => GivenTheFollowing(fileReRoute))
+                .When(x => WhenICreateHttpHandlerOptions())
+                .Then(x => ThenTheFollowingOptionsReturned(expectedOptions))
+                .BDDfy();
+        }
+
         private void GivenTheFollowing(FileReRoute fileReRoute)
         {
             _fileReRoute = fileReRoute;


Delete AssemblyInfo.cs

Delete AssemblyInfo.cs

--- Ext-RegEx-Exercises/queryMess/Properties/AssemblyInfo.cs
+++ Ext-RegEx-Exercises/queryMess/Properties/AssemblyInfo.cs
@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("queryMess")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("queryMess")]
-[assembly: AssemblyCopyright("Copyright ©  2017")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components.  If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("13330bb3-8410-427b-affc-61d8cdd944a3")]
-
-// Version information for an assembly consists of the following four values:
-//
-//      Major Version
-//      Minor Version
-//      Build Number
-//      Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]


#7: cleaned up some tests.

#7: cleaned up some tests.

--- tests/FizzWare.NBuilder.Tests/Integration/ListBuilderNegativeTests.cs
+++ tests/FizzWare.NBuilder.Tests/Integration/ListBuilderNegativeTests.cs
@@ -17,8 +17,10 @@
         {
             Should.Throw<ArgumentNullException>(() =>
             {
-                var builderSetup = new BuilderSettings();
-                new Builder(builderSetup).CreateListOfSize<MyClass>(10).IndexOf(null).With(x => x.StringOne = "Description").Build();
+                new Builder()
+                    .CreateListOfSize<MyClass>(10)
+                    .IndexOf(null)
+                    .With(x => x.StringOne = "Description").Build();
             });
         }

@@ -27,8 +29,11 @@
         {
             Should.Throw<ArgumentException>(() =>
             {
-                var builderSetup = new BuilderSettings();
-                new Builder(builderSetup).CreateListOfSize<MyClass>(10).IndexOf(new int[0]).With(x => x.StringOne = "Description").Build();
+                new Builder()
+                    .CreateListOfSize<MyClass>(10)
+                    .IndexOf()
+                    .With(x => x.StringOne = "Description")
+                    .Build();
             });
         }

@@ -37,8 +42,12 @@
         {
             Should.Throw<ArgumentOutOfRangeException>(() =>
             {
-                var builderSetup = new BuilderSettings();
-                new Builder(builderSetup).CreateListOfSize<MyClass>(10).IndexOf(10).With(x => x.StringOne = "Description").Build();
+                new Builder()
+                    .CreateListOfSize<MyClass>(10)
+                    .IndexOf(10)
+                    .With(x => x.StringOne = "Description")
+                    .Build()
+                    ;
             });
         }

@@ -47,8 +56,12 @@
         {
             Should.Throw<ArgumentOutOfRangeException>(() =>
             {
-                var builderSetup = new BuilderSettings();
-                new Builder(builderSetup).CreateListOfSize<MyClass>(10).IndexOf(2,3,10).With(x => x.StringOne = "Description").Build();
+                new Builder()
+                    .CreateListOfSize<MyClass>(10)
+                    .IndexOf(2, 3, 10)
+                    .With(x => x.StringOne = "Description")
+                    .Build()
+                    ;
             });
         }

@@ -57,8 +70,11 @@
         {
             Should.Throw<ArgumentOutOfRangeException>(() =>
             {
-                var builderSetup = new BuilderSettings();
-                new Builder(builderSetup).CreateListOfSize<MyClass>(10).IndexOf(-1).With(x => x.StringOne = "Description").Build();
+                new Builder()
+                    .CreateListOfSize<MyClass>(10)
+                    .IndexOf(-1)
+                    .With(x => x.StringOne = "Description")
+                    .Build();
             });
         }

@@ -67,13 +83,16 @@
         {
             Should.Throw<ArgumentOutOfRangeException>(() =>
             {
-                var builderSetup = new BuilderSettings();
-                new Builder(builderSetup).CreateListOfSize<MyClass>(10).IndexOf(2,-1,4).With(x => x.StringOne = "Description").Build();
-            });
-        }
-
-        [Fact]
-        public void SectionalOperationsAreAppliedAfterGlobalOperations()
+                new Builder()
+                    .CreateListOfSize<MyClass>(10)
+                    .IndexOf(2, -1, 4)
+                    .With(x => x.StringOne = "Description")
+                    .Build();
+            });
+        }
+
+        [Fact]
+        public void SectionalOperationsAreAppliedAfterGlobalOperations()
         {
             var results = new Builder().CreateListOfSize<MyClass>(10)
                 .TheFirst(1)
@@ -82,7 +101,7 @@
                     .Do(row => row.Bool = false)
                 .Build()
                 ;
-
+
             results.First().Bool.ShouldBe(true);
         }

@@ -92,8 +111,11 @@

             Should.Throw<ArgumentException>(() =>
             {
-                var builderSetup = new BuilderSettings();
-                new Builder(builderSetup).CreateListOfSize< MyClass>(10).TheFirst(11).With(x => x.StringOne = "Description").Build();
+                new Builder()
+                    .CreateListOfSize<MyClass>(10)
+                    .TheFirst(11)
+                    .With(x => x.StringOne = "Description")
+                    .Build();
             });
         }

@@ -105,7 +127,7 @@
             Should.Throw<BuilderException>(() =>
             {
                 new Builder(builderSetup)
-                     .CreateListOfSize< MyClass>(10)
+                     .CreateListOfSize<MyClass>(10)
                     .TheFirst(5)
                         .With(x => x.StringOne = "Description")
                     .TheNext(10)
@@ -118,43 +140,43 @@
         [Fact]
         public void ShouldComplainIfYouTryToCreateAnInterface()
         {
-            var builderSetup = new BuilderSettings();
-            Should.Throw<BuilderException>(() =>
-            {
-                new Builder(builderSetup).CreateListOfSize< IMyInterface>(10).Build();
+            Should.Throw<BuilderException>(() =>
+            {
+                new Builder()
+                    .CreateListOfSize<IMyInterface>(10)
+                    .Build();
             });
         }

         [Fact]
         public void should_complain_if_you_try_to_create_an_abstract_class()
         {
-            var builderSetup = new BuilderSettings();
-
             Should.Throw<TypeCreationException>(() =>
             {
-                new Builder(builderSetup).CreateNew< MyAbstractClass>().Build();
+                new Builder()
+                    .CreateNew<MyAbstractClass>()
+                    .Build();
             });
         }

         [Fact]
         public void should_complain_if_you_try_to_create_an_interface()
         {
-            var builderSetup = new BuilderSettings();
             Should.Throw<TypeCreationException>(() =>
             {
-                new Builder(builderSetup).CreateNew< IMyInterface>().Build();
+                new Builder()
+                    .CreateNew<IMyInterface>()
+                    .Build();
             });
         }

         [Fact]
         public void ShouldComplainIfAndThePreviousRangeWillBeTooBig()
         {
-            var builderSetup = new BuilderSettings();
-
-            Should.Throw<BuilderException>(() =>
-            {
-                new Builder(builderSetup)
-                     .CreateListOfSize< MyClass>(10)
+            Should.Throw<BuilderException>(() =>
+            {
+                new Builder()
+                     .CreateListOfSize<MyClass>(10)
                     .TheLast(5)
                         .With(x => x.StringOne = "test")
                     .ThePrevious(6)
@@ -167,12 +189,10 @@
         [Fact]
         public void ShouldComplainIfRandomAmountTooBig()
         {
-            var builderSetup = new BuilderSettings();
-
-            Should.Throw<ArgumentException>(() =>
-            {
-                new Builder(builderSetup)
-                    .CreateListOfSize< MyClass>(10)
+            Should.Throw<ArgumentException>(() =>
+            {
+                new Builder()
+                    .CreateListOfSize<MyClass>(10)
                     .Random(11)
                     .With(x => x.StringOne = "test")
                     .Build();
@@ -182,12 +202,10 @@
         [Fact]
         public void ShouldComplainIfRandomAmountTooBigForRange()
         {
-            var builderSetup = new BuilderSettings();
-
-            Should.Throw<ArgumentException>(() =>
-            {
-                new Builder(builderSetup)
-                     .CreateListOfSize< MyClass>(10)
+            Should.Throw<ArgumentException>(() =>
+            {
+                new Builder()
+                     .CreateListOfSize<MyClass>(10)
                     .Random(5, 0, 3)
                         .With(x => x.StringOne = "test")
                     .Build();
@@ -197,12 +215,10 @@
         [Fact]
         public void ShouldComplainIfRandomRangeTooBig()
         {
-            var builderSetup = new BuilderSettings();
-
-            Should.Throw<BuilderException>(() =>
-            {
-                new Builder(builderSetup)
-                    .CreateListOfSize< MyClass>(10)
+            Should.Throw<BuilderException>(() =>
+            {
+                new Builder()
+                    .CreateListOfSize<MyClass>(10)
                     .Random(5, 0, 11)
                         .With(x => x.StringOne = "test")
                     .Build();
@@ -212,23 +228,19 @@
         [Fact]
         public void ShouldComplainIfSizeOfListLessThanOne()
         {
-            var builderSetup = new BuilderSettings();
-
-            Should.Throw<ArgumentException>(() =>
-            {
-                new Builder(builderSetup).CreateListOfSize< MyClass>(0).Build();
+            Should.Throw<ArgumentException>(() =>
+            {
+                new Builder().CreateListOfSize<MyClass>(0).Build();
             });
         }

         [Fact]
         public void ShouldComplainIfSectionGreaterThanListSize()
         {
-            var builderSetup = new BuilderSettings();
-
-            Should.Throw<ArgumentException>(() =>
-            {
-                new Builder(builderSetup)
-                    .CreateListOfSize< MyClass>(10)
+            Should.Throw<ArgumentException>(() =>
+            {
+                new Builder()
+                    .CreateListOfSize<MyClass>(10)
                     .Section(0, 10)
                         .With(x => x.StringOne = "test")
                     .Build();
@@ -238,12 +250,10 @@
         [Fact]
         public void CanOnlyUseAndTheNextAfterAnotherDeclaration()
         {
-            var builderSetup = new BuilderSettings();
-
-            Should.Throw<BuilderException>(() =>
-            {
-                new Builder(builderSetup)
-                    .CreateListOfSize< MyClass>(10)
+            Should.Throw<BuilderException>(() =>
+            {
+                new Builder()
+                    .CreateListOfSize<MyClass>(10)
                     .TheNext(5)
                         .With(x => x.StringOne = "test")
                     .Build();
@@ -253,12 +263,10 @@
         [Fact]
         public void CanOnlyUseAndThePreviousAfterAnotherDeclaration()
         {
-            var builderSetup = new BuilderSettings();
-
-            Should.Throw<BuilderException>(() =>
-            {
-                new Builder(builderSetup)
-                    .CreateListOfSize< MyClass>(10)
+            Should.Throw<BuilderException>(() =>
+            {
+                new Builder()
+                    .CreateListOfSize<MyClass>(10)
                     .ThePrevious(5)
                         .With(x => x.StringOne = "test")
                     .Build();


ajustes repo usuario

ajustes repo usuario

--- Fatec.Treinamento.Data/Repositories/UsuarioRepository.cs
+++ Fatec.Treinamento.Data/Repositories/UsuarioRepository.cs
@@ -26,9 +26,7 @@
 	                Usuario
 	                INNER JOIN Perfil on Usuario.IdPerfil = Perfil.Id ";

-
-
-
+
         public Usuario Inserir(Usuario usuario)
         {
             var id = Connection.ExecuteScalar<int>(


Move configs to static properties, single init

--- GenericFunctionExternalConfig/OMSToSlack/ConfigHelper.cs
+++ GenericFunctionExternalConfig/OMSToSlack/ConfigHelper.cs
@@ -8,6 +8,11 @@
 {
     public static class ConfigHelper
     {
+        private static List<DefaultAlertConfig> __defaultAlertConfigs;
+        private static List<OverrideAlertConfig> __overrideAlertConfigs;
+        private static List<DefaultAlertNotificationConfig> __defaultAlertNotificationConfigs;
+        private static List<OverrideAlertNotificationConfig> __overrideAlertNotificationConfigs;
+
         public static AlertConfig GetAlertConfig(Alert alert)
         {
             var defaultConfig = GetDefaultAlertConfigs().Single(c => c.MetricName == alert.MetricName);
@@ -21,30 +26,6 @@
                 , overrideConfig?.MinimumViolationsToAlert ?? defaultConfig.MinimumViolationsToAlert
                 , defaultConfig.ValueMultiplier
                 );
-        }
-
-        private static List<DefaultAlertConfig> GetDefaultAlertConfigs()
-        {
-            // TODO: Unique on metricName
-            var configs = new List<DefaultAlertConfig>
-            {
-                new DefaultAlertConfig("Processor Usage %", 0.35, 0.5, false, 3, 0.01),
-                new DefaultAlertConfig("Free Space %", 0.2, 0.1, true, 1, 0.01),
-                new DefaultAlertConfig("Free Megabytes", 10000, 5000, true, 1, 1)
-            };
-
-            return configs;
-        }
-
-        private static List<OverrideAlertConfig> GetOverrideAlertConfigs()
-        {
-            // TODO: Unique on metric + machine names
-            var configs = new List<OverrideAlertConfig>
-            {
-                new OverrideAlertConfig("Processor Usage %", "Server2", 0.2, 0.4, 3)
-            };
-
-            return configs;
         }

         public static AlertNotificationConfig GetAlertNotificationConfig(Alert alert)
@@ -112,40 +93,76 @@
             );
         }

+        private static List<DefaultAlertConfig> GetDefaultAlertConfigs()
+        {
+            if(__defaultAlertConfigs == null)
+            {
+                // TODO: Unique on metricName
+                __defaultAlertConfigs = new List<DefaultAlertConfig>
+                {
+                    new DefaultAlertConfig("Processor Usage %", 0.35, 0.5, false, 3, 0.01),
+                    new DefaultAlertConfig("Free Space %", 0.2, 0.1, true, 1, 0.01),
+                    new DefaultAlertConfig("Free Megabytes", 10000, 5000, true, 1, 1)
+                };
+            }
+
+            return __defaultAlertConfigs;
+        }
+
+        private static List<OverrideAlertConfig> GetOverrideAlertConfigs()
+        {
+            if(__overrideAlertConfigs == null)
+            {
+                // TODO: Unique on metric + machine names
+                __overrideAlertConfigs = new List<OverrideAlertConfig>
+                {
+                    new OverrideAlertConfig("Processor Usage %", "Server2", 0.2, 0.4, 3)
+                };
+            }
+
+            return __overrideAlertConfigs;
+        }
+
         private static List<DefaultAlertNotificationConfig> GetDefaultAlertNotificationConfigs()
         {
-            var defaultChannels = new List<string> { "#alerts" };
+            if( __defaultAlertNotificationConfigs is null)
+            {
+                var defaultChannels = new List<string> { "#alerts" };

-            var configs = new List<DefaultAlertNotificationConfig>
-            {
-                new DefaultAlertNotificationConfig("Processor Usage %", defaultChannels, "P0", "Infra - CPU"),
-                new DefaultAlertNotificationConfig("Free Space %", defaultChannels, "P0", "Infra - Drive Space"),
-                new DefaultAlertNotificationConfig("Free Megabytes", defaultChannels, "N0", "Infra - Memory")
-            };
+                __defaultAlertNotificationConfigs = new List<DefaultAlertNotificationConfig>
+                {
+                    new DefaultAlertNotificationConfig("Processor Usage %", defaultChannels, "P0", "Infra - CPU"),
+                    new DefaultAlertNotificationConfig("Free Space %", defaultChannels, "P0", "Infra - Drive Space"),
+                    new DefaultAlertNotificationConfig("Free Megabytes", defaultChannels, "N0", "Infra - Memory")
+                };
+            }

-            return configs;
+            return __defaultAlertNotificationConfigs;
         }

         private static List<OverrideAlertNotificationConfig> GetOverrideAlertNotificationConfigs()
         {
-            var configs = new List<OverrideAlertNotificationConfig>
+            if(__overrideAlertNotificationConfigs == null)
             {
-                new OverrideAlertNotificationConfig(
-                    machineName: "Server1"
-                    ,channels: new List<string> { "#Server1Team" }
-                ),
-                new OverrideAlertNotificationConfig(
-                    metricName: "Free Space %"
-                    ,channels: new List<string> { "#memory-monitors" }
-                ),
-                new OverrideAlertNotificationConfig(
-                    metricName: "Processor Usage %"
-                    ,machineName: "Server2"
-                    ,channels: new List<string> { "#server2-cpu" }
-                )
-            };
+                __overrideAlertNotificationConfigs= new List<OverrideAlertNotificationConfig>
+                {
+                    new OverrideAlertNotificationConfig(
+                        machineName: "Server1"
+                        ,channels: new List<string> { "#Server1Team" }
+                    ),
+                    new OverrideAlertNotificationConfig(
+                        metricName: "Free Space %"
+                        ,channels: new List<string> { "#memory-monitors" }
+                    ),
+                    new OverrideAlertNotificationConfig(
+                        metricName: "Processor Usage %"
+                        ,machineName: "Server2"
+                        ,channels: new List<string> { "#server2-cpu" }
+                    )
+                };
+            }

-            return configs;
+            return __overrideAlertNotificationConfigs;
         }
     }
 }


small equation fix

small equation fix

--- GerberLibrary/Core/Primitives/GerberApertureMacroPart.cs
+++ GerberLibrary/Core/Primitives/GerberApertureMacroPart.cs
@@ -94,6 +94,7 @@
                     srccopy = srccopy.Replace("$" + i.ToString(), "V" + i.ToString());
                 }
                 srccopy = srccopy.Replace("X", " * ");
+                srccopy = srccopy.Replace("x", " * ");
                 // srccopy = srccopy.Replace('.', ',');
                 MacroExpressionEvaluator E = new MacroExpressionEvaluator();


Arreglando búsqueda de eventos

Arreglando búsqueda de eventos

--- GlobalEvents/GlobalEvents/Controllers/UsersController.cs
+++ GlobalEvents/GlobalEvents/Controllers/UsersController.cs
@@ -54,7 +54,7 @@
                 Usuario = u.Usuario,
                 Estado = u.Estado,
                 Comentarios = CommentsService.ObtenerComentarios((int)id).Count,
-                Eventos = EventsService.ObtenerEventos((long)id).Count,
+                Eventos = EventsService.ObtenerEventos(null).Where(z => z.IdUser == id).ToList().Count,
                 EventosAsistidos = EventsService.ObtenerEventosAsistidos((int)id).Count,
                 ListaDeDeseos = EventsService.ObtenerEventosDeseados((int)id).Count,
                 Rank = Rolls.ObtenerRankPorUsuario((int)id)


fix the insertion adorner after last grouped item

--- GongSolutions.Wpf.DragDrop/DropTargetInsertionAdorner.cs
+++ GongSolutions.Wpf.DragDrop/DropTargetInsertionAdorner.cs
@@ -1,8 +1,10 @@
 using System;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
 using System.Linq;
 using System.Text;
 using System.Windows;
+using System.Windows.Data;
 using System.Windows.Media;
 using System.Windows.Controls;
 using System.Collections;
@@ -33,6 +35,17 @@
         }

         var index = Math.Min(this.DropInfo.InsertIndex, itemParent.Items.Count - 1);
+
+        var lastItemInGroup = false;
+        var targetGroup = this.DropInfo.TargetGroup;
+        if (targetGroup != null && targetGroup.IsBottomLevel && this.DropInfo.InsertPosition.HasFlag(RelativeInsertPosition.AfterTargetItem)) {
+          var indexOf = targetGroup.Items.IndexOf(this.DropInfo.TargetItem);
+          lastItemInGroup = indexOf == targetGroup.ItemCount - 1;
+          if (lastItemInGroup) {
+            index--;
+          }
+        }
+
         var itemContainer = (UIElement)itemParent.ItemContainerGenerator.ContainerFromIndex(index);

         if (itemContainer != null) {
@@ -41,7 +54,7 @@
           double rotation = 0;

           if (this.DropInfo.VisualTargetOrientation == Orientation.Vertical) {
-            if (this.DropInfo.InsertIndex == itemParent.Items.Count) {
+            if (this.DropInfo.InsertIndex == itemParent.Items.Count || lastItemInGroup) {
               itemRect.Y += itemContainer.RenderSize.Height;
             }


Removed dead code, thanks to fantix.king

--- Lidgren.Network/NetBuffer.cs
+++ Lidgren.Network/NetBuffer.cs
@@ -72,8 +72,6 @@

 		static NetBuffer()
 		{
-			Type[] integralTypes = typeof(Byte).Assembly.GetTypes();
-
 			s_readMethods = new Dictionary<Type, MethodInfo>();
 			MethodInfo[] methods = typeof(NetIncomingMessage).GetMethods(BindingFlags.Instance | BindingFlags.Public);
 			foreach (MethodInfo mi in methods)


poprawki usuwania i submit

poprawki usuwania i submit

--- RedmineLog/frmMain.cs
+++ RedmineLog/frmMain.cs
@@ -95,7 +95,7 @@
             if (!string.IsNullOrWhiteSpace(cbIssues.Text)
                 && ContainIssue(cbIssues.Text))
             {
-                Settings.Default.WorkingIssueList = Settings.Default.WorkingIssueList.Replace(";" + cbIssues.Text + ";", ";");
+                Settings.Default.WorkingIssueList = Settings.Default.WorkingIssueList.Replace(cbIssues.Text + ";", ";");
                 var item = cbIssues.SelectedItem;
                 cbIssues.SelectedItem = cbIssues.Items[0];
                 cbIssues.Items.Remove(item);
@@ -381,8 +381,6 @@
                     return;
                 }

-                clockMode = ClockMode.Stop;
-                WorkTimer.Stop();

                 DateTime time = submitMode == SubmitMode.Work ? startTime : idleTime;

@@ -403,8 +401,7 @@

                 if (submitMode == SubmitMode.Work)
                 {
-                    startTime = DateTime.MinValue;
-                    lblClockActive.Text = startTime.ToString("HH:mm:ss");
+                    OnStopClick(btnStop, null);
                 }
                 else
                 {
@@ -444,8 +441,11 @@

         private void OnWorkTimeElapsed(object sender, System.Timers.ElapsedEventArgs e)
         {
-            startTime = startTime.AddSeconds(1);
-            lblClockActive.Text = startTime.ToString("HH:mm:ss");
+            if (clockMode == ClockMode.Play)
+            {
+                startTime = startTime.AddSeconds(1);
+                lblClockActive.Text = startTime.ToString("HH:mm:ss");
+            }
         }

         private void OnIssueIDChanged(object sender, EventArgs e)


Passing all dev tests, but fails on production test 5 stops, 2 routes

--- TANNetwork/Program.cs
+++ TANNetwork/Program.cs
@@ -33,7 +33,8 @@

 		// Write an action using Console.WriteLine()
 		// To debug: Console.Error.WriteLine("Debug messages...");
-		var bfs = new Dijkstra(links);
+		build(links, addresses);
+		var bfs = new Dijkstra(addresses);
 		var path = bfs.Path(startPoint, endPoint);

 		if (path == null)
@@ -42,27 +43,59 @@
 		}
 		else
 		{
-			var addressDictionary = addresses.ToDictionary(x => x.StopArea);
+			var addressDictionary = addresses.ToDictionary(x => x.Name);
 			foreach (var stopArea in path)
 			{
 				var address = addressDictionary[stopArea];
-				Console.WriteLine(address.Name);
+				Console.WriteLine(address.Fullname);
 			}
 		}

 	}
-}
-
-class Address
-{
-	public string StopArea { get; set; }
-	public string Name { get; set; }
+
+	private static void build(Link[] links, Address[] addresses)
+	{
+		var nodes = addresses.ToDictionary(x => x.Name);
+
+		foreach (var link in links.GroupBy(x=>x.A))
+		{
+			var node = nodes[link.Key];
+			node.Neighbours = link.Select(x => nodes[x.B]).ToArray();
+		}
+	}
+}
+
+public class Address : Dijkstra.Node
+{
+	public string Fullname { get; set; }
+	public double Longitude { get; set; }
+	public double Latitude { get; set; }

 	public Address(string addressLine)
 	{
 		var parts = addressLine.Split(new[] { ',' });
-		StopArea = parts[0].Substring(9);
-		Name = parts[1].Substring(1, parts[1].Length - 2);
+		this.Name = parts[0].Substring(9);
+		Fullname = parts[1].Substring(1, parts[1].Length - 2);
+
+		Latitude = double.Parse(parts[3], System.Globalization.CultureInfo.InvariantCulture);
+		Longitude = double.Parse(parts[4], System.Globalization.CultureInfo.InvariantCulture);
+	}
+
+	public override double DistanceTo(Dijkstra.Node neighbour)
+	{
+		var node2 = neighbour as Address;
+
+
+
+		var x = radians(node2.Longitude - this.Longitude) * Math.Cos(radians(this.Latitude + node2.Latitude) / 2);
+		var y = radians(node2.Latitude - this.Latitude);
+		var d = Math.Sqrt(x * x + y * y) * 6371;
+		return d;
+	}
+
+	private double radians(double degrees)
+	{
+		return Math.PI / 180.0 * degrees;
 	}
 }

@@ -70,40 +103,39 @@
 #region Helpers

-class Dijkstra
-{
-	class Node
-	{
+public class Dijkstra
+{
+	public class Node
+	{
+		protected Node()
+		{
+			Distance = int.MaxValue;
+
+		}
+
 		public Node(string name)
+			: base()
 		{
 			Name = name;
-			Distance = int.MaxValue;
-		}
-
-		public string Name { get; private set; }
+		}
+
+		public string Name { get; protected set; }
 		public Node[] Neighbours { get; set; }
 		public string ShortestPath { get; set; }
-		public int Distance { get; set; }
+		public double Distance { get; set; }
 		public bool Visited { get; set; }
+
+		public virtual double DistanceTo(Node neighbour)
+		{
+			return 1.0;
+		}
 	}

 	IDictionary<string, Node> _nodes;

-	public Dijkstra(IEnumerable<Link> links)
-	{
-		_nodes = links
-			.SelectMany(link => link.Nodes)
-			.Distinct()
-			.Select(name => new Node(name))
-			.ToDictionary(x => x.Name);
-
-		foreach (var node in _nodes.Values)
-		{
-			node.Neighbours = links.Where(link => link.A == node.Name).Select(link => link.B)
-					.Union(links.Where(link => link.B == node.Name).Select(link => link.A))
-					.Select(name => _nodes[name])
-					.ToArray();
-		}
+	public Dijkstra(IEnumerable<Node> nodes)
+	{
+		_nodes = nodes.ToDictionary(x => x.Name);
 	}

 	public string[] Path(string from, string to)
@@ -122,11 +154,10 @@

 		do
 		{
-			var tentativeDistance = currentNode.Distance + 1;
 			var unvisitedNeighbours = currentNode.Neighbours.Where(x => !x.Visited);
-
 			foreach (var neighbour in unvisitedNeighbours)
 			{
+				var tentativeDistance = currentNode.Distance + currentNode.DistanceTo(neighbour);
 				if (neighbour.Distance > tentativeDistance)
 				{
 					neighbour.Distance = tentativeDistance;
@@ -166,18 +197,5 @@
 	}
 }

-public class Node
-{
-	public string Name { get; set; }
-	public Link[] Links { get; set; }
-	public string[] Path { get; set; }
-	public double Score { get; set; }
-
-	public override string ToString()
-	{
-		return string.Format("{0} ({1} pts)", Name, Score);
-	}
-}
-
 #endregion Helpers


reformat code

reformat code

--- Joinrpg/Controllers/CharacterController.cs
+++ Joinrpg/Controllers/CharacterController.cs
@@ -15,182 +15,215 @@

 namespace JoinRpg.Web.Controllers
 {
-  public class CharacterController : Common.ControllerGameBase
-  {
-    private IPlotRepository PlotRepository { get; }
-    private ICharacterRepository CharacterRepository { get; }
+    public class CharacterController : Common.ControllerGameBase
+    {
+        private IPlotRepository PlotRepository { get; }
+        private ICharacterRepository CharacterRepository { get; }
         private IUriService UriService { get; }

-      public CharacterController(ApplicationUserManager userManager,
-          IProjectRepository projectRepository,
-          IProjectService projectService,
-          IPlotRepository plotRepository,
-          IExportDataService exportDataService,
-          ICharacterRepository characterRepository,
-          IUriService uriService)
-          : base(userManager, projectRepository, projectService, exportDataService)
-      {
-          PlotRepository = plotRepository;
-          CharacterRepository = characterRepository;
-          UriService = uriService;
-      }
-
-      [HttpGet]
-    public async Task<ActionResult> Details(int projectid, int characterid)
-    {
-      var field = await CharacterRepository.GetCharacterWithGroups(projectid, characterid);
-      return (field?.Project == null ? HttpNotFound() : null) ?? await ShowCharacter(field);
+        public CharacterController(ApplicationUserManager userManager,
+            IProjectRepository projectRepository,
+            IProjectService projectService,
+            IPlotRepository plotRepository,
+            IExportDataService exportDataService,
+            ICharacterRepository characterRepository,
+            IUriService uriService)
+            : base(userManager, projectRepository, projectService, exportDataService)
+        {
+            PlotRepository = plotRepository;
+            CharacterRepository = characterRepository;
+            UriService = uriService;
+        }
+
+        [HttpGet]
+        public async Task<ActionResult> Details(int projectid, int characterid)
+        {
+            var field = await CharacterRepository.GetCharacterWithGroups(projectid, characterid);
+            return (field?.Project == null ? HttpNotFound() : null) ?? await ShowCharacter(field);
+        }
+
+        private async Task<ActionResult> ShowCharacter(Character character)
+        {
+            var plots = character.HasPlotViewAccess(CurrentUserIdOrDefault)
+                ? await ShowPlotsForCharacter(character)
+                : Enumerable.Empty<PlotElement>();
+            return View("Details",
+                new CharacterDetailsViewModel(CurrentUserIdOrDefault,
+                    character,
+                    plots.ToList(),
+                    UriService));
+        }
+
+        private async Task<IReadOnlyList<PlotElement>> ShowPlotsForCharacter(Character character) =>
+            character.GetOrderedPlots(await PlotRepository.GetPlotsForCharacter(character));
+
+        [HttpGet, MasterAuthorize(Permission.CanEditRoles)]
+        public async Task<ActionResult> Edit(int projectId, int characterId)
+        {
+            var field = await CharacterRepository.GetCharacterWithDetails(projectId, characterId);
+            return View(new EditCharacterViewModel()
+            {
+                ProjectId = field.ProjectId,
+                CharacterId = field.CharacterId,
+                Description = field.Description.Contents,
+                IsPublic = field.IsPublic,
+                ProjectName = field.Project.ProjectName,
+                IsAcceptingClaims = field.IsAcceptingClaims,
+                HidePlayerForCharacter = field.HidePlayerForCharacter,
+                Name = field.CharacterName,
+                ParentCharacterGroupIds = field.GetParentGroupsForEdit(),
+                IsHot = field.IsHot,
+            }.Fill(field, CurrentUserId));
+        }
+
+        [HttpPost, MasterAuthorize(Permission.CanEditRoles), ValidateAntiForgeryToken]
+        public async Task<ActionResult> Edit(EditCharacterViewModel viewModel)
+        {
+            var field =
+                await CharacterRepository.GetCharacterAsync(viewModel.ProjectId,
+                    viewModel.CharacterId);
+            try
+            {
+                if (!ModelState.IsValid)
+                {
+                    return View(viewModel.Fill(field, CurrentUserId));
+                }
+
+                await ProjectService.EditCharacter(
+                    CurrentUserId,
+                    viewModel.CharacterId,
+                    viewModel.ProjectId,
+                    viewModel.Name,
+                    viewModel.IsPublic,
+                    viewModel.ParentCharacterGroupIds.GetUnprefixedGroups(),
+                    viewModel.IsAcceptingClaims &&
+                    field.ApprovedClaim == null, //Force this field to false if has approved claim
+                    viewModel.Description,
+                    viewModel.HidePlayerForCharacter,
+                    GetCustomFieldValuesFromPost(),
+                    viewModel.IsHot);
+
+                return RedirectToAction("Details",
+                    new {viewModel.ProjectId, viewModel.CharacterId});
+            }
+            catch (Exception exception)
+            {
+                ModelState.AddException(exception);
+                return View(viewModel.Fill(field, CurrentUserId));
+            }
+        }
+
+        [HttpGet]
+        [MasterAuthorize(Permission.CanEditRoles)]
+        public async Task<ActionResult> Create(int projectid, int charactergroupid)
+        {
+            var field = await ProjectRepository.GetGroupAsync(projectid, charactergroupid);
+
+            if (field == null) return HttpNotFound();
+
+            return View(new AddCharacterViewModel()
+            {
+                ProjectId = projectid,
+                ProjectName = field.Project.ProjectName,
+                ParentCharacterGroupIds = field.AsPossibleParentForEdit()
+            });
+        }
+
+        [HttpPost]
+        [MasterAuthorize(Permission.CanEditRoles)]
+        [ValidateAntiForgeryToken]
+        public async Task<ActionResult> Create(AddCharacterViewModel viewModel)
+        {
+            try
+            {
+                await ProjectService.AddCharacter(
+                    viewModel.ProjectId,
+                    CurrentUserId,
+                    viewModel.Name,
+                    viewModel.IsPublic,
+                    viewModel.ParentCharacterGroupIds.GetUnprefixedGroups(),
+                    viewModel.IsAcceptingClaims,
+                    viewModel.Description,
+                    viewModel.HidePlayerForCharacter,
+                    viewModel.IsHot);
+
+                return RedirectToIndex(viewModel.ProjectId,
+                    viewModel.ParentCharacterGroupIds.GetUnprefixedGroups().First());
+            }
+            catch
+            {
+                return View(viewModel);
+            }
+        }
+
+        [HttpGet, MasterAuthorize(Permission.CanEditRoles)]
+        public async Task<ActionResult> Delete(int projectid, int characterid)
+        {
+            var field = await CharacterRepository.GetCharacterAsync(projectid, characterid);
+            if (field == null) return HttpNotFound();
+            return View(field);
+        }
+
+        [HttpPost, MasterAuthorize(Permission.CanEditRoles), ValidateAntiForgeryToken]
+        public async Task<ActionResult> Delete(int projectId,
+            int characterId,
+            [UsedImplicitly]
+            FormCollection form)
+        {
+            var field = await CharacterRepository.GetCharacterAsync(projectId, characterId);
+            try
+            {
+                await ProjectService.DeleteCharacter(projectId, characterId, CurrentUserId);
+
+                return RedirectToIndex(field.Project);
+            }
+            catch
+            {
+                return View(field);
+            }
+        }
+
+        [HttpGet, MasterAuthorize(Permission.CanEditRoles)]
+        public Task<ActionResult> MoveUp(int projectid,
+            int characterid,
+            int parentcharactergroupid,
+            int currentrootgroupid) => MoveImpl(projectid,
+            characterid,
+            parentcharactergroupid,
+            currentrootgroupid,
+            direction: -1);
+
+        [HttpGet, MasterAuthorize(Permission.CanEditRoles)]
+        public Task<ActionResult> MoveDown(int projectid,
+            int characterid,
+            int parentcharactergroupid,
+            int currentrootgroupid) => MoveImpl(projectid,
+            characterid,
+            parentcharactergroupid,
+            currentrootgroupid,
+            direction: +1);
+
+        private async Task<ActionResult> MoveImpl(int projectId,
+            int characterId,
+            int parentCharacterGroupId,
+            int currentRootGroupId,
+            short direction)
+        {
+            try
+            {
+                await ProjectService.MoveCharacter(CurrentUserId,
+                    projectId,
+                    characterId,
+                    parentCharacterGroupId,
+                    direction);
+
+                return RedirectToIndex(projectId, currentRootGroupId);
+            }
+            catch
+            {
+                //TODO Show Error
+                return RedirectToIndex(projectId, currentRootGroupId);
+            }
+        }
     }
-
-    private async Task<ActionResult> ShowCharacter(Character character)
-    {
-      var plots = character.HasPlotViewAccess(CurrentUserIdOrDefault)
-        ? await ShowPlotsForCharacter(character)
-        : Enumerable.Empty<PlotElement>();
-      return View("Details",
-        new CharacterDetailsViewModel(CurrentUserIdOrDefault, character, plots.ToList(), UriService));
-    }
-
-    private async Task<IReadOnlyList<PlotElement>> ShowPlotsForCharacter(Character character)
-    {
-      return character.GetOrderedPlots(await PlotRepository.GetPlotsForCharacter(character));
-    }
-
-    [HttpGet, MasterAuthorize(Permission.CanEditRoles)]
-    public async Task<ActionResult> Edit(int projectId, int characterId)
-    {
-      var field = await CharacterRepository.GetCharacterWithDetails(projectId, characterId);
-      return View(new EditCharacterViewModel()
-      {
-        ProjectId = field.ProjectId,
-        CharacterId = field.CharacterId,
-        Description = field.Description.Contents,
-        IsPublic = field.IsPublic,
-        ProjectName = field.Project.ProjectName,
-        IsAcceptingClaims = field.IsAcceptingClaims,
-        HidePlayerForCharacter = field.HidePlayerForCharacter,
-        Name = field.CharacterName,
-        ParentCharacterGroupIds = field.GetParentGroupsForEdit(),
-        IsHot = field.IsHot,
-      }.Fill(field, CurrentUserId));
-    }
-
-    [HttpPost, MasterAuthorize(Permission.CanEditRoles), ValidateAntiForgeryToken]
-    public async Task<ActionResult> Edit(EditCharacterViewModel viewModel)
-    {
-      var field = await CharacterRepository.GetCharacterAsync(viewModel.ProjectId, viewModel.CharacterId);
-      try
-      {
-        if (!ModelState.IsValid)
-        {
-          return View(viewModel.Fill(field, CurrentUserId));
-        }
-        await ProjectService.EditCharacter(
-          CurrentUserId,
-          viewModel.CharacterId,
-          viewModel.ProjectId,
-          viewModel.Name, viewModel.IsPublic,
-          viewModel.ParentCharacterGroupIds.GetUnprefixedGroups(),
-          viewModel.IsAcceptingClaims && field.ApprovedClaim == null, //Force this field to false if has approved claim
-          viewModel.Description,
-          viewModel.HidePlayerForCharacter,
-          GetCustomFieldValuesFromPost(),
-          viewModel.IsHot);
-
-        return RedirectToAction("Details", new {viewModel.ProjectId, viewModel.CharacterId});
-      }
-      catch (Exception exception)
-      {
-        ModelState.AddException(exception);
-        return View(viewModel.Fill(field, CurrentUserId));
-      }
-    }
-
-    [HttpGet]
-    [MasterAuthorize(Permission.CanEditRoles)]
-    public async Task<ActionResult> Create(int projectid, int charactergroupid)
-    {
-      var field = await ProjectRepository.GetGroupAsync(projectid, charactergroupid);
-
-      if (field == null) return HttpNotFound();
-
-      return View(new AddCharacterViewModel()
-      {
-        ProjectId = projectid,
-        ProjectName = field.Project.ProjectName,
-        ParentCharacterGroupIds = field.AsPossibleParentForEdit()
-      });
-    }
-
-    [HttpPost]
-    [MasterAuthorize(Permission.CanEditRoles)]
-    [ValidateAntiForgeryToken]
-    public async Task<ActionResult> Create(AddCharacterViewModel viewModel)
-    {
-      try
-      {
-        await ProjectService.AddCharacter(
-          viewModel.ProjectId, CurrentUserId,
-          viewModel.Name, viewModel.IsPublic, viewModel.ParentCharacterGroupIds.GetUnprefixedGroups(), viewModel.IsAcceptingClaims,
-          viewModel.Description, viewModel.HidePlayerForCharacter, viewModel.IsHot);
-
-        return RedirectToIndex(viewModel.ProjectId, viewModel.ParentCharacterGroupIds.GetUnprefixedGroups().First());
-      }
-      catch
-      {
-        return View(viewModel);
-      }
-    }
-
-    [HttpGet, MasterAuthorize(Permission.CanEditRoles)]
-    public async Task<ActionResult> Delete(int projectid, int characterid)
-    {
-      var field = await CharacterRepository.GetCharacterAsync(projectid, characterid);
-      if (field == null) return HttpNotFound();
-      return View(field);
-    }
-
-    [HttpPost, MasterAuthorize(Permission.CanEditRoles), ValidateAntiForgeryToken]
-    public async Task<ActionResult> Delete(int projectId, int characterId, [UsedImplicitly] FormCollection form)
-    {
-      var field = await CharacterRepository.GetCharacterAsync(projectId, characterId);
-      try
-      {
-        await ProjectService.DeleteCharacter(projectId, characterId, CurrentUserId);
-
-        return RedirectToIndex(field.Project);
-      }
-      catch
-      {
-        return View(field);
-      }
-    }
-
-    [HttpGet, MasterAuthorize(Permission.CanEditRoles)]
-    public Task<ActionResult> MoveUp(int projectid, int characterid, int parentcharactergroupid, int currentrootgroupid)
-    {
-      return MoveImpl(projectid, characterid, parentcharactergroupid, currentrootgroupid, -1);
-    }
-
-    [HttpGet, MasterAuthorize(Permission.CanEditRoles)]
-    public Task<ActionResult> MoveDown(int projectid, int characterid, int parentcharactergroupid, int currentrootgroupid)
-    {
-      return MoveImpl(projectid, characterid, parentcharactergroupid, currentrootgroupid, +1);
-    }
-
-    private async Task<ActionResult> MoveImpl(int projectId, int characterId, int parentCharacterGroupId, int currentRootGroupId, short direction)
-    {
-      try
-      {
-        await ProjectService.MoveCharacter(CurrentUserId, projectId, characterId, parentCharacterGroupId, direction);
-
-        return RedirectToIndex(projectId, currentRootGroupId);
-      }
-      catch
-      {
-        //TODO Show Error
-        return RedirectToIndex(projectId, currentRootGroupId);
-      }
-    }
-  }
 }


Fixed font size being able to be zero

Fixed font size being able to be zero

--- Templater/FormMain.cs
+++ Templater/FormMain.cs
@@ -419,7 +419,7 @@
         }

         /// <summary>
-        /// Increases the code font size in the output.
+        /// Increases the code font size in the output, disables the buttons in the UI if it gets too large.
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
@@ -429,10 +429,21 @@
             richTextBoxOutput.SelectAll();
             richTextBoxOutput.SelectionFont = new Font(HTMLHelper.HTML_CODE_FONT, page.FontSize);
             labelFontSizeCaption.Text = HTMLHelper.HTML_CODE_FONT_CAPTION + page.FontSize;
-        }
-
-        /// <summary>
-        /// Decreases the code font size in the output.
+
+            if (page.FontSize >= 20F)
+            {
+                buttonIncreaseFontSize.Enabled = false;
+            }
+
+            // Re-enable decrease button if it's disabled.
+            if (!buttonDecreaseFontSize.Enabled)
+            {
+                buttonDecreaseFontSize.Enabled = true;
+            }
+        }
+
+        /// <summary>
+        /// Decreases the code font size in the output, disables the buttons in the UI if it gets too small.
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
@@ -442,6 +453,17 @@
             richTextBoxOutput.SelectAll();
             richTextBoxOutput.SelectionFont = new Font(HTMLHelper.HTML_CODE_FONT, page.FontSize);
             labelFontSizeCaption.Text = HTMLHelper.HTML_CODE_FONT_CAPTION + page.FontSize;
+
+            if (page.FontSize <= 9F)
+            {
+                buttonDecreaseFontSize.Enabled = false;
+            }
+
+            // Re-enable increase button if it's disabled.
+            if (!buttonIncreaseFontSize.Enabled)
+            {
+                buttonIncreaseFontSize.Enabled = true;
+            }
         }
     }
 }


Removed compiler warning.

Removed compiler warning.

--- Logging/ConsoleLogService.cs
+++ Logging/ConsoleLogService.cs
@@ -32,7 +32,7 @@
 				{
 					_severity = (LogMessage.SeverityType) Enum.Parse(typeof(LogMessage.SeverityType), logLevel, true);
 				}
-				catch (Exception ex)
+				catch (Exception)
 				{
 					Console.WriteLine( "Couldn't parse LogLevel '{0}'. Try Debug, Info, or Error.");
 				}


Fixed typo

Fixed typo

--- Mamesaver/GameListBuilder.cs
+++ Mamesaver/GameListBuilder.cs
@@ -12,7 +12,7 @@
     internal class GameListBuilder
     {
         private readonly Settings _settings;
-        private readonly AdvancedSettings _advancedSetings;
+        private readonly AdvancedSettings _advancedSettings;
         private readonly MameInvoker _invoker;

         /// <summary>
@@ -26,10 +26,10 @@
         /// </summary>
         private readonly XmlReaderSettings _readerSettings;

-        public GameListBuilder(Settings settings, AdvancedSettings advancedSetings, MameInvoker invoker)
+        public GameListBuilder(Settings settings, AdvancedSettings advancedSettings, MameInvoker invoker)
         {
             _settings = settings;
-            _advancedSetings = advancedSetings;
+            _advancedSettings = advancedSettings;
             _invoker = invoker;

             _readerSettings = new XmlReaderSettings { DtdProcessing = DtdProcessing.Parse };
@@ -110,7 +110,7 @@
                     if (driver == null) continue;

                     // Skip games which aren't fully emulated, unless check disabled in configuration
-                    if (!_advancedSetings.SkipGameValidation)
+                    if (!_advancedSettings.SkipGameValidation)
                     {
                         var status = driver.Attribute("status")?.Value;
                         if (status != "good") continue;


Fixed DIGEST-MD5 charset handling (only utf-8 and iso-8859-1 are supported)

--- MailKit/Security/SaslMechanismDigestMd5.cs
+++ MailKit/Security/SaslMechanismDigestMd5.cs
@@ -50,6 +50,8 @@
 	/// </remarks>
 	public class SaslMechanismDigestMd5 : SaslMechanism
 	{
+		static readonly Encoding Latin1;
+
 		enum LoginState {
 			Auth,
 			Final
@@ -58,7 +60,17 @@
 		DigestChallenge challenge;
 		DigestResponse response;
 		internal string cnonce;
+		Encoding encoding;
 		LoginState state;
+
+		static SaslMechanismDigestMd5 ()
+		{
+			try {
+				Latin1 = Encoding.GetEncoding (28591);
+			} catch (NotSupportedException) {
+				Latin1 = Encoding.GetEncoding (1252);
+			}
+		}

 		/// <summary>
 		/// Initializes a new instance of the <see cref="MailKit.Security.SaslMechanismDigestMd5"/> class.
@@ -196,14 +208,16 @@
 					cnonce = Convert.ToBase64String (entropy);
 				}

-				response = new DigestResponse (challenge, Uri.Scheme, Uri.DnsSafeHost, AuthorizationId, Credentials.UserName, Credentials.Password, cnonce);
+				encoding = challenge.Charset != null ? Encoding.UTF8 : Latin1;
+				response = new DigestResponse (challenge, encoding, Uri.Scheme, Uri.DnsSafeHost, AuthorizationId, Credentials.UserName, Credentials.Password, cnonce);
 				state = LoginState.Final;
-				return response.Encode ();
+
+				return response.Encode (encoding);
 			case LoginState.Final:
 				if (token.Length == 0)
 					throw new SaslException (MechanismName, SaslErrorCode.MissingChallenge, "Server response did not contain any authentication data.");

-				var text = Encoding.UTF8.GetString (token, startIndex, length);
+				var text = encoding.GetString (token, startIndex, length);
 				string key, value;

 				if (!DigestChallenge.TryParseKeyValuePair (text, out key, out value))
@@ -212,7 +226,7 @@
 				if (!key.Equals ("rspauth", StringComparison.OrdinalIgnoreCase))
 					throw new SaslException (MechanismName, SaslErrorCode.InvalidChallenge, "Server response contained invalid data.");

-				var expected = response.ComputeHash (Credentials.Password, false);
+				var expected = response.ComputeHash (encoding, Credentials.Password, false);
 				if (value != expected)
 					throw new SaslException (MechanismName, SaslErrorCode.IncorrectHash, "Server response did not contain the expected hash.");

@@ -403,9 +417,9 @@
 					challenge.MaxBuf = maxbuf;
 					break;
 				case "charset":
-					if (challenge.Charset != null)
+					if (challenge.Charset != null || !value.Equals ("utf-8", StringComparison.OrdinalIgnoreCase))
 						throw new SaslException ("DIGEST-MD5", SaslErrorCode.InvalidChallenge, string.Format ("Invalid SASL challenge from the server: {0}", token));
-					challenge.Charset = value;
+					challenge.Charset = "utf-8";
 					break;
 				case "algorithm":
 					if (challenge.Algorithm != null)
@@ -448,7 +462,7 @@
 		public string Cipher { get; private set; }
 		public string AuthZid { get; private set; }

-		public DigestResponse (DigestChallenge challenge, string protocol, string hostName, string authzid, string userName, string password, string cnonce)
+		public DigestResponse (DigestChallenge challenge, Encoding encoding, string protocol, string hostName, string authzid, string userName, string password, string cnonce)
 		{
 			UserName = userName;

@@ -465,15 +479,12 @@
 			Qop = "auth";

 			DigestUri = string.Format ("{0}/{1}", protocol, hostName);
-
-			if (!string.IsNullOrEmpty (challenge.Charset))
-				Charset = challenge.Charset;
-
 			Algorithm = challenge.Algorithm;
+			Charset = challenge.Charset;
 			AuthZid = authzid;
 			Cipher = null;

-			Response = ComputeHash (password, true);
+			Response = ComputeHash (encoding, password, true);
 		}

 		static string HexEncode (byte[] digest)
@@ -486,14 +497,14 @@
 			return hex.ToString ();
 		}

-		public string ComputeHash (string password, bool client)
+		public string ComputeHash (Encoding encoding, string password, bool client)
 		{
 			string text, a1, a2;
 			byte[] buf, digest;

 			// compute A1
 			text = string.Format ("{0}:{1}:{2}", UserName, Realm, password);
-			buf = Encoding.UTF8.GetBytes (text);
+			buf = encoding.GetBytes (text);
 			using (var md5 = MD5.Create ())
 				digest = md5.ComputeHash (buf);

@@ -502,7 +513,7 @@
 				text = string.Format (":{0}:{1}", Nonce, CNonce);
 				if (!string.IsNullOrEmpty (AuthZid))
 					text += ":" + AuthZid;
-				buf = Encoding.ASCII.GetBytes (text);
+				buf = encoding.GetBytes (text);
 				md5.TransformFinalBlock (buf, 0, buf.Length);
 				a1 = HexEncode (md5.Hash);
 			}
@@ -514,14 +525,14 @@
 			if (Qop == "auth-int" || Qop == "auth-conf")
 				text += ":00000000000000000000000000000000";

-			buf = Encoding.ASCII.GetBytes (text);
+			buf = encoding.GetBytes (text);
 			using (var md5 = MD5.Create ())
 				digest = md5.ComputeHash (buf);
 			a2 = HexEncode (digest);

 			// compute KD
 			text = string.Format ("{0}:{1}:{2:x8}:{3}:{4}:{5}", a1, Nonce, Nc, CNonce, Qop, a2);
-			buf = Encoding.ASCII.GetBytes (text);
+			buf = encoding.GetBytes (text);
 			using (var md5 = MD5.Create ())
 				digest = md5.ComputeHash (buf);

@@ -543,15 +554,8 @@
 			return quoted.ToString ();
 		}

-		public byte[] Encode ()
-		{
-			Encoding encoding;
-
-			if (!string.IsNullOrEmpty (Charset))
-				encoding = Encoding.GetEncoding (Charset);
-			else
-				encoding = Encoding.UTF8;
-
+		public byte[] Encode (Encoding encoding)
+		{
 			var builder = new StringBuilder ();
 			builder.AppendFormat ("username={0}", Quote (UserName));
 			builder.AppendFormat (",realm=\"{0}\"", Realm);


removed unused class; code formating

removed unused class; code formating

--- Messim.UI/Controllers/MessageController.cs
+++ Messim.UI/Controllers/MessageController.cs
@@ -66,15 +66,14 @@
                                    Height = image.Height
                                };

-            Message newMessage;
-            newMessage = new Message
-            {
-                Text = messageText,
-                Date = DateTime.Now,
-                LikeAmount = 0,
-                Sender = user,
-                Image = newImage
-            };
+            var newMessage = new Message
+                                     {
+                                         Text = messageText,
+                                         Date = DateTime.Now,
+                                         LikeAmount = 0,
+                                         Sender = user,
+                                         Image = newImage
+                                     };

             if (replyTo != null)
             {
@@ -138,15 +137,4 @@
             return new JsonResult { Data = new { ConsoleMessage = "Message with " + messageId + " unliked" } };
         }
     }
-
-    public class FileUploadJsonResult : JsonResult
-    {
-        public override void ExecuteResult(ControllerContext context)
-        {
-            this.ContentType = "text/html";
-            context.HttpContext.Response.Write("<textarea>");
-            base.ExecuteResult(context);
-            context.HttpContext.Response.Write("</textarea>");
-        }
-    }
 }


Tweaked code to reduce critical speed

Tweaked code to reduce critical speed

--- Marslander_level2/Program.cs
+++ Marslander_level2/Program.cs
@@ -119,12 +119,12 @@
 				if (speed.X>CRITICAL_HORIZONTAL_SPEED)
 				{
 					Console.Error.WriteLine("Reduce speed to right in a safe manner, avoiding obstacles");
-					command = new Tuple<int, int>(15, 4);
+					command = new Tuple<int, int>(MAX_ANGLE_KEEP_VSPEED, 4);
 				}
 				else if (speed.X < -CRITICAL_HORIZONTAL_SPEED)
 				{
 					Console.Error.WriteLine("Reduce speed to left in a safe manner, avoiding obstacles");
-					command = new Tuple<int, int>(15, 4);
+					command = new Tuple<int, int>(MAX_ANGLE_KEEP_VSPEED, 4);
 				}
 				else
 				{


Fix invalid calls to virtual methods when serializing lists

This was the actual error that lead to "Bad IL" errors on mono 6. Now we
can return to treating collections in an optimized way.

--- Migrant/Generators/WriteMethodGenerator.cs
+++ Migrant/Generators/WriteMethodGenerator.cs
@@ -299,16 +299,16 @@

             var getEnumeratorMethod = enumerableType.GetMethod("GetEnumerator");
             context.Generator.PushVariableOntoStack(valueLocal);
-            context.Generator.Emit(OpCodes.Call, getEnumeratorMethod);
+            context.Generator.Emit(OpCodes.Callvirt, getEnumeratorMethod);
             context.Generator.StoreLocalValueFromStack(iteratorLocal);

             context.Generator.MarkLabel(loopBegin);
             context.Generator.PushLocalValueOntoStack(iteratorLocal);
-            context.Generator.Call<IEnumerator>(x => x.MoveNext());
+            context.Generator.Callvirt<IEnumerator>(x => x.MoveNext());
             context.Generator.Emit(OpCodes.Brfalse, finish);

             context.Generator.PushLocalValueOntoStack(iteratorLocal);
-            context.Generator.Emit(OpCodes.Call, enumeratorType.GetProperty("Current").GetGetMethod());
+            context.Generator.Emit(OpCodes.Callvirt, enumeratorType.GetProperty("Current").GetGetMethod());
             context.Generator.StoreLocalValueFromStack(currentElementLocal);

             GenerateWriteField(context, elementVariable, token.FormalElementType);


Improved download code.

Improved download code.

--- ModMyFactory/ModMyFactory/Web/WebHelper.cs
+++ ModMyFactory/ModMyFactory/Web/WebHelper.cs
@@ -140,7 +140,58 @@
         }

         /// <summary>
-        /// Downloads the answer of an HTTP request and saves it as a file.
+        /// Gets the response document of an HTTP request.
+        /// </summary>
+        /// <param name="url">The URL of the request.</param>
+        /// <param name="container">The cookie container used to store cookies in the connection.</param>
+        /// <returns>Returns the received document.</returns>
+        public static string GetDocument(string url, CookieContainer container)
+        {
+            string document;
+            HttpWebRequest request = CreateHttpRequest(url, container);
+            WebResponse response = null;
+            try
+            {
+                response = request.GetResponse();
+                using (var reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
+                    document = reader.ReadToEnd();
+            }
+            finally
+            {
+                response?.Close();
+            }
+
+            return document;
+        }
+
+        /// <summary>
+        /// Gets the response document of an HTTP request.
+        /// </summary>
+        /// <param name="url">The URL of the request.</param>
+        /// <param name="container">The cookie container used to store cookies in the connection.</param>
+        /// <param name="content">The content that gets sent to the server.</param>
+        /// <returns>Returns the received document.</returns>
+        public static string GetDocument(string url, CookieContainer container, byte[] content)
+        {
+            string document;
+            HttpWebRequest request = CreateHttpRequest(url, container, content);
+            WebResponse response = null;
+            try
+            {
+                response = request.GetResponse();
+                using (var reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
+                    document = reader.ReadToEnd();
+            }
+            finally
+            {
+                response?.Close();
+            }
+
+            return document;
+        }
+
+        /// <summary>
+        /// Downloads the response of an HTTP request and saves it as a file.
         /// </summary>
         /// <param name="url">The URL of the request.</param>
         /// <param name="container">The cookie container used to store cookies in the connection.</param>
@@ -167,19 +218,24 @@

                     using (Stream data = await response.Content.ReadAsStreamAsync())
                     {
-                        long fileSize = response.Content.Headers.ContentLength.Value;
+                        long? fileSize = response.Content.Headers.ContentLength;
+
+                        if (file.Directory?.Exists == false) file.Directory.Create();
                         using (Stream fs = file.OpenWrite())
                         {
-                            byte[] buffer = new byte[81920];
+                            byte[] buffer = new byte[8192];
+                            int byteCount;
                             do
                             {
-                                int byteCount = await data.ReadAsync(buffer, 0, buffer.Length, cancellationToken);
-                                await fs.WriteAsync(buffer, 0, byteCount, cancellationToken);
-
-                                progress.Report((double)fs.Length / fileSize);
-                            } while (fs.Length < fileSize);
+                                byteCount = await data.ReadAsync(buffer, 0, buffer.Length, cancellationToken);
+                                if (byteCount > 0) await fs.WriteAsync(buffer, 0, byteCount, cancellationToken);
+
+                                if (fileSize.HasValue) progress.Report((double)fs.Length / fileSize.Value);
+                            } while (byteCount > 0);
                         }
                     }
+
+                    progress.Report(1);
                 }
             }
             catch (TaskCanceledException)


MMILRT: Don't provide a SymbolWriterProvider

--- MonoMod/InlineRT/MMILExec.cs
+++ MonoMod/InlineRT/MMILExec.cs
@@ -32,6 +32,7 @@
                 MissingDependencyResolver = self.MissingDependencyResolver
             };
             wrapperMod.WriterParameters.WriteSymbols = false;
+            wrapperMod.WriterParameters.SymbolWriterProvider = null;

             // Only add a copy of the map - adding the MMILRT asm itself to the map only causes issues.
             wrapperMod.DependencyCache.AddRange(self.DependencyCache);


mistyped Value

mistyped Value

--- MonoTouch.Dialog/Elements.cs
+++ MonoTouch.Dialog/Elements.cs
@@ -532,7 +532,7 @@

 		public override UITableViewCell GetCell (UITableView tv)
 		{
-			var cell = tv.DequeueReusableCell (value == null ? skey : skeyvalue);
+			var cell = tv.DequeueReusableCell (Value == null ? skey : skeyvalue);
 			if (cell == null){
 				cell = new UITableViewCell (Value == null ? UITableViewCellStyle.Default : UITableViewCellStyle.Value1, skey);
 				cell.SelectionStyle = (Tapped != null) ? UITableViewCellSelectionStyle.Blue : UITableViewCellSelectionStyle.None;


Made the EntryElements' KeyboardType into a property so that it supports LINQ

--- MonoTouch.Dialog/Elements.cs
+++ MonoTouch.Dialog/Elements.cs
@@ -1188,7 +1188,17 @@
 		/// this to use this for numeric input, email addressed,
 		/// urls, phones.
 		/// </summary>
-		public UIKeyboardType KeyboardType = UIKeyboardType.Default;
+		public UIKeyboardType KeyboardType {
+			get {
+				return keyboardType;
+			}
+			set {
+				keyboardType = value;
+				if (entry != null)
+					entry.KeyboardType = value;
+			}
+		}
+		public UIKeyboardType keyboardType = UIKeyboardType.Default;

 		static NSString ekey = new NSString ("EntryElement");
 		bool isPassword, becomeResponder;


Fix #CSHARP-36 Replace DateTime.Now with DateTime.UtcNow to avoid daylight saving time issues.

--- MongoDBDriver/Connections/RawConnection.cs
+++ MongoDBDriver/Connections/RawConnection.cs
@@ -25,7 +25,7 @@
                 throw new ArgumentNullException("endPoint");

             EndPoint = endPoint;
-            CreationTime = DateTime.Now;
+            CreationTime = DateTime.UtcNow;

             _client.NoDelay = true;
             _client.ReceiveTimeout = (int)connectionTimeout.TotalMilliseconds;


InputControls.NoteOffOption.holdAll and holdLast

These replace the simple 'hold' option.
The new options have been tested, and are
working in the Assistant Performer.

--- Moritz.Spec/InputControls.cs
+++ Moritz.Spec/InputControls.cs
@@ -157,7 +157,9 @@
         stopNow, // stop immediately, even inside a midiChord
         fade, // fade velocity to end of trk
 		loop, // loop the Seq until a noteOff arrives
-		hold // the final duration in each Trk of the Seq is set to Number.Maxvalue, then the same as stopNow.
+		// Both hold options: The Assistant Performer silences the trk when the performer sends a noteOff.
+		holdLast, // The Assistant Performer removes noteOff messages from the last moment in the trk to contain any.
+		holdAll // The Assistant Performer removes all noteOff messages from the trk.
     };

     /// <summary>


[Session] Fix every source file having a copy of every method instance.

This decreases memory usage by having only methods in a source file being used inside.

Based on my analysis of mdb writers, the mapping is one CompilationUnit
for each SourceFileEntry.

See MdbWriter and SymbolWriterImpl and grep for DefineDocument.

Bug 45792 - Exponential memory usage when loading mdb files

--- Mono.Debugging.Soft/SoftDebuggerSession.cs
+++ Mono.Debugging.Soft/SoftDebuggerSession.cs
@@ -2606,16 +2606,19 @@

 			using(MonoSymbolFile mdb = MonoSymbolFile.ReadSymbolFile(mdbFileName))
 			{
-				foreach (var src in mdb.Sources)
+				foreach (var cu in mdb.CompileUnits)
 				{
 					MdbSourceFileInfo info = new MdbSourceFileInfo ();

+					var src = cu.SourceFile;
 					info.Hash = src.Checksum;
 					info.FileID = src.Index;
 					info.FullFilePath = src.FileName;

-					foreach (var method in mdb.Methods)
-						info.Methods.Add (new MethodMdbInfo{ SequencePoints = method.GetLineNumberTable ().LineNumbers });
+					foreach (var method in mdb.Methods) {
+						if (method.CompileUnitIndex == cu.Index)
+							info.Methods.Add (new MethodMdbInfo { SequencePoints = method.GetLineNumberTable ().LineNumbers });
+					}

 					fileToSourceFileInfos [src.FileName] = new List<MdbSourceFileInfo> ();


Enemies are now part of the level group; Enemies is therefore a set.

--- game/enemies.cs
+++ game/enemies.cs
@@ -1,4 +1,4 @@
-new SimGroup(Enemies);
+new SimSet(Enemies);

 datablock PlayerData(Soldier : KnightBase) {
    melee = false;


Fix fft block size to 256 due to timing considerations.

--- MusicProcess/MusicProcess.cs
+++ MusicProcess/MusicProcess.cs
@@ -24,16 +24,16 @@

         /// <summary>
         /// Delegate for an FFT implementation, which runs FFT on the data buffer in place, block by block.
+        /// Block size is fixed to 256.
         /// </summary>
-        /// <param name="data">Data buffer. Must be in size of a multiple of blockSize.</param>
-        /// <param name="blockSize">Block size for doing FFT. Must be in power of two.</param>
-        public delegate void BlockedFFT(short[] data, int blockSize);
+        /// <param name="data">Data buffer. Must be in size of a multiple of 256.</param>
+        public delegate void FFT256(short[] data);

         /// <summary>
         /// Set this to change the FFT implementation used; default to a managed version FFT implementation.
         /// User may consider provide some optimized or accelerated implementation wrapping MKL, cuFFT or so on.
         /// </summary>
-        public static BlockedFFT FFT = ManagedBlockedFFT;
+        public static FFT256 FFT256Implementation = ManagedFFT256;

         /// <summary>
         /// Process mp3 data for use in training and evaluating the machine learning models.
@@ -78,8 +78,8 @@
             rightFrames.Aggregate(0, (n, frame) => { Buffer.BlockCopy(frame, 0, rightPCM, n, frame.Length * sizeof(short)); return n + frame.Length; });

             // Execute FFT.
-            FFT(leftPCM, 256);
-            FFT(rightPCM, 256);
+            FFT256Implementation(leftPCM);
+            FFT256Implementation(rightPCM);

             // Reshape the result into desired dimension.
             var reshaped = new short[(totalLength + 255) / 256, 512];
@@ -92,7 +92,7 @@
             return reshaped;
         }

-        private static void ManagedBlockedFFT(short[] data, int blockSize)
+        private static void ManagedFFT256(short[] data)
         {
             throw new NotImplementedException();
         }


Revert "Use full pathnames when resolving breakpoints."

This patch broke debugging MonoDroid on Windows.
It also breaks on older Mono versions.

This reverts commit 58c29efbc7930ab1ab702ee992e12f7daab02845.

--- Mono.Debugging.Soft/SoftDebuggerSession.cs
+++ Mono.Debugging.Soft/SoftDebuggerSession.cs
@@ -646,6 +646,7 @@
 		{
 			if (!started)
 				return null;
+			string filename = System.IO.Path.GetFileName (file);

 			// Try the current class first
 			Location target_loc = null;// = GetLocFromType (current_thread.GetFrames()[0].Method.DeclaringType, filename, line);
@@ -654,9 +655,9 @@
 			if (target_loc == null) {
 				List<TypeMirror> types;

-				if (source_to_type.TryGetValue (file, out types)) {
+				if (source_to_type.TryGetValue (filename, out types)) {
 					foreach (TypeMirror t in types) {
-						target_loc = GetLocFromType (t, file, line);
+						target_loc = GetLocFromType (t, filename, line);
 						if (target_loc != null)
 							break;
 					}
@@ -837,7 +838,7 @@
 				);
 				foreach (KeyValuePair<EventRequest,BreakInfo> breakpoint in affectedBreakpoints) {
 					OnDebuggerOutput (false, string.Format ("Re-pending breakpoint at {0}:{1}\n",
-					                                        breakpoint.Value.Location.SourceFile,
+					                                        Path.GetFileName (breakpoint.Value.Location.SourceFile),
 					                                        breakpoint.Value.Location.LineNumber));
 					breakpoints.Remove (breakpoint.Key);
 					pending_bes.Add (breakpoint.Value.BreakEvent);
@@ -1085,7 +1086,7 @@

 			var resolved = new List<BreakEvent> ();

-			foreach (string s in t.GetSourceFiles (true)) {
+			foreach (string s in t.GetSourceFiles ()) {
 				List<TypeMirror> typesList;

 				if (source_to_type.TryGetValue (s, out typesList)) {
@@ -1098,7 +1099,7 @@

 				foreach (var bp in pending_bes.OfType<Breakpoint> ()) {
-					if (bp.FileName == s) {
+					if (System.IO.Path.GetFileName (bp.FileName) == s) {
 						Location l = GetLocFromType (t, s, bp.Line);
 						if (l != null) {
 							OnDebuggerOutput (false, string.Format ("Resolved pending breakpoint at '{0}:{1}' to {2}:{3}.\n",
@@ -1135,7 +1136,7 @@
 			Location target_loc = null;
 			foreach (MethodMirror m in type.GetMethods ()) {
 				foreach (Location l in m.Locations) {
-					if (l.SourceFile == file && l.LineNumber == line) {
+					if (System.IO.Path.GetFileName (l.SourceFile) == file && l.LineNumber == line) {
 						target_loc = l;
 						break;
 						}


Make hit test based on the image optional

--- MonoHaven.Client/UI/Widgets/ImageButton.cs
+++ MonoHaven.Client/UI/Widgets/ImageButton.cs
@@ -15,6 +15,12 @@
 		}

 		public event Action Click;
+
+		public bool ImageHitTest
+		{
+			get;
+			set;
+		}

 		public Drawable Image
 		{
@@ -51,7 +57,9 @@

 		protected override bool CheckHit(int x, int y)
 		{
-			return Image != null && Image.CheckHit(x - X, y - Y);
+			if (ImageHitTest)
+				return Image != null && Image.CheckHit(x - X, y - Y);
+			return base.CheckHit(x, y);
 		}

 		protected override void OnMouseButtonDown(MouseButtonEvent e)


Removed unused class

Removed unused class

--- MyExpenses.IntegrationTests/ApiTestBase.cs
+++ MyExpenses.IntegrationTests/ApiTestBase.cs
@@ -1,39 +0,0 @@
-using Microsoft.Owin.Hosting;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using MyExpenses.Web;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net.Http;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace MyExpenses.IntegrationTests
-{
-    [TestClass]
-    public abstract class ApiTestBase
-    {
-        static string baseAddress = "http://localhost:9001/";
-
-        IDisposable host;
-        HttpClient _client;
-        protected HttpClient Client
-        {
-            get { return _client; }
-        }
-
-        [TestInitialize]
-        public void Init()
-        {
-            host = WebApp.Start<Startup>(url: baseAddress);
-            _client = new HttpClient();
-            _client.BaseAddress = new Uri(baseAddress);
-        }
-
-        [TestCleanup]
-        public void Cleanup()
-        {
-            host.Dispose();
-        }
-    }
-}


New assertions added to compare two IComparable types.
New Assertions added to check if 2 float, double, TimeSpan and DateTime types are closer to each other.

Added assertions for 'should_be_closer_to' for float, double, timespan, and datetime

Removed old int comparer and updated DateTime, TimeSpan assertion message

--- NSpec/AssertionExtensions.cs
+++ NSpec/AssertionExtensions.cs
@@ -41,11 +41,6 @@
             Assert.IsFalse(actual);
         }

-        public static void should_be_greater_than(this int greater, int lesser)
-        {
-            Assert.Greater(greater, lesser);
-        }
-
         public static void should_be(this object actual, object expected)
         {
             actual.Is(expected);
@@ -158,5 +153,59 @@
         {
             Assert.AreNotSame(expected, actual);
         }
+
+        public static void should_be_greater_than(this IComparable arg1, IComparable arg2)
+        {
+            Assert.Greater(arg1, arg2);
+        }
+
+        public static void should_be_greater_or_equal_to(this IComparable arg1, IComparable arg2)
+        {
+            Assert.GreaterOrEqual(arg1, arg2);
+        }
+
+        public static void should_be_less_than(this IComparable arg1, IComparable arg2)
+        {
+            Assert.Less(arg1, arg2);
+        }
+
+        public static void should_be_less_or_equal_to(this IComparable arg1, IComparable arg2)
+        {
+            Assert.LessOrEqual(arg1, arg2);
+        }
+
+        public static void should_be_close_to(this float actual, float expected)
+        {
+            actual.should_be_close_to(expected, 0.0000001f);
+        }
+
+        public static void should_be_close_to(this float actual, float expected, float tolerance)
+        {
+            Assert.LessOrEqual(Math.Abs(actual - expected), tolerance,
+                string.Format("should be close to {0} of {1} but was {2} ", tolerance, expected, actual));
+        }
+
+        public static void should_be_close_to(this double actual, double expected, double tolerance)
+        {
+            Assert.LessOrEqual(Math.Abs(actual - expected), tolerance,
+                string.Format("should be close to {0} of {1} but was {2}", tolerance, expected, actual));
+        }
+
+        public static void should_be_close_to(this double actual, double expected)
+        {
+            actual.should_be_close_to(expected, 0.0000001f);
+        }
+
+        public static void should_be_close_to(this TimeSpan actual, TimeSpan expected, TimeSpan tolerance)
+        {
+            Assert.LessOrEqual(Math.Abs(actual.Ticks - expected.Ticks), tolerance.Ticks,
+                string.Format("should be close to {0} ticks of {1} but was {2}", tolerance, expected, actual));
+        }
+
+        public static void should_be_close_to(this DateTime actual, DateTime expected, DateTime tolerance)
+        {
+            Assert.LessOrEqual(Math.Abs((actual - expected).Ticks), tolerance.Ticks,
+                string.Format("should be close to {0} ticks of {1} but was {2}", tolerance.Ticks, expected, actual));
+        }
     }
 }