Passed CultureInfo to ToString

Passed CultureInfo to ToString

--- ComputerAlgebra/Utils/BigRational.cs
+++ ComputerAlgebra/Utils/BigRational.cs
@@ -98,7 +98,7 @@
         }

         // IFormattable interface.
-        public string ToString(string format, IFormatProvider formatProvider) { return ((double)this).ToString(format); }
+        public string ToString(string format, IFormatProvider formatProvider) { return ((double)this).ToString(format, formatProvider); }
         public string ToString(string format) { return ToString(format, null); }

         // object interface.


no more printing

no more printing

--- Fred/Fred.cs
+++ Fred/Fred.cs
@@ -164,7 +164,6 @@
             {

                 line = file.ReadLine();
-                Console.WriteLine(line);

                 for (int j = 0; j < line.Length; ++j)
                 {


(identity)：修复注册用户时注册失败报空异常 close #69

(identity)：修复注册用户时注册失败报空异常 close #69

--- tests/web/Liuliu.Demo.Web/Controllers/IdentityController.cs
+++ tests/web/Liuliu.Demo.Web/Controllers/IdentityController.cs
@@ -153,9 +153,11 @@
                     + $"{url}<br>"
                     + $"祝您使用愉快！";
                 await SendMailAsync(user.Email, "柳柳软件 注册邮箱激活邮件", body);
-            }
-
-            return result.ToAjaxResult(m => new { m.UserName, m.NickName, m.Email });
+
+                return result.ToAjaxResult(m => new { m.UserName, m.NickName, m.Email });
+            }
+
+            return result.ToAjaxResult();
         }

         /// <summary>


Added overloads for ParseObject.RegisterSubclass and ParseObject.UnregisterSubclass methods, which take a reference to Type and un-/ register it as parse subclass

--- Parse/Public/ParseObject.cs
+++ Parse/Public/ParseObject.cs
@@ -218,7 +218,18 @@
         /// <typeparam name="T">The ParseObject subclass type to register.</typeparam>
         public static void RegisterSubclass<T>() where T : ParseObject, new() => SubclassingController.RegisterSubclass(typeof(T));

+        /// <summary>
+        /// Registers a custom subclass type with the Parse SDK, enabling strong-typing of those ParseObjects whenever
+        /// they appear. Subclasses must specify the ParseClassName attribute, have a default constructor, and properties
+        /// backed by ParseObject fields should have ParseFieldName attributes supplied.
+        /// </summary>
+        /// <param name="type">The ParseObject subclass type to register.</param>
+        public static void RegisterSubclass(Type type) { if (typeof(ParseObject).IsAssignableFrom(type)) SubclassingController.RegisterSubclass(type); }
+
         internal static void UnregisterSubclass<T>() where T : ParseObject, new() => SubclassingController.UnregisterSubclass(typeof(T));
+        internal static void UnregisterSubclass(Type type) { if (typeof(ParseObject).IsAssignableFrom(type)) SubclassingController.UnregisterSubclass(type); }
+
+

         /// <summary>
         /// Clears any changes to this object made since the last call to <see cref="SaveAsync()"/>.


Added some color table tests

Added some color table tests

--- tests/Tests/SKColorTableTest.cs
+++ tests/Tests/SKColorTableTest.cs
@@ -1,5 +1,6 @@
 using System;
 using System.IO;
+using System.Linq;
 using System.Runtime.InteropServices;
 using NUnit.Framework;

@@ -26,6 +27,16 @@
 			(SKPMColor)SKColors.Green,
 			(SKPMColor)SKColors.Blue
 		};
+
+		[Test]
+		public void CreateIndex8Bitmap()
+		{
+			var info = new SKImageInfo(320, 240, SKColorType.Index8, SKAlphaType.Opaque);
+			var ct = new SKColorTable(Colors);
+			var bitmap = new SKBitmap(info, ct);
+			Assert.IsNotNull(bitmap);
+			Assert.AreEqual(ct, bitmap.ColorTable);
+		}

 		[Test]
 		public void MembersRetrieveSingleColorWithAlpha()
@@ -134,5 +145,30 @@
 			}
 			Assert.AreEqual((SKColor)0x7EA4C639, bitmap.GetPixel(182, 348));
 		}
+
+		[Test]
+		public void Index8ImageCanChangeColorTable()
+		{
+			var path = Path.Combine(PathToImages, "index8.png");
+
+			var codec = SKCodec.Create(new SKFileStream(path));
+			var info = new SKImageInfo(codec.Info.Width, codec.Info.Height, SKColorType.Index8, SKAlphaType.Premul);
+			var bitmap = SKBitmap.Decode(codec, info);
+
+			var colorTable = bitmap.ColorTable;
+			Assert.AreEqual((SKColor)0xFFA4C639, colorTable.GetUnPreMultipliedColor(255));
+
+			var invertedColors = colorTable.Colors.Select(c =>
+			{
+				var c2 = (SKColor)c;
+				var inv = new SKColor((byte)(255 - c2.Red), (byte)(255 - c2.Green), (byte)(255 - c2.Blue), c2.Alpha);
+				return (SKPMColor)inv;
+			}).ToArray();
+
+			colorTable = new SKColorTable(invertedColors);
+			bitmap.SetColorTable(colorTable);
+
+			Assert.AreEqual((SKColor)0xFF5B39C6, colorTable.GetUnPreMultipliedColor(255));
+		}
 	}
 }


JSIL will now find Foo.exe.jsilconfig/Foo.dll.jsilconfig files in parent directories in addition to the directory containing the file. This lets you shove the config file in, say, the project directory instead of the build directory.

--- Compiler/Program.cs
+++ Compiler/Program.cs
@@ -127,7 +127,7 @@
                     // If an executable references a DLL, we can be sure the DLL is going to get built anyway.
                     foreach (var anr in kvpInner.AllReferencesRecursive) {
                         if (anr.FullName == kvpOuter.Assembly.FullName) {
-                            Debug.WriteLine("Pruning '" + kvpOuter.Filename + "' from build list because '" + kvpInner.Filename + "' references it.");
+                            Console.Error.WriteLine("// Not translating '{0}' directly because '{1}' references it.", Path.GetFileName(kvpOuter.Filename), Path.GetFileName(kvpInner.Filename));
                             goto skip;
                         }
                     }
@@ -553,10 +553,22 @@
                         continue;
                     }

-                    var fileConfigPath = Path.Combine(
-                        Path.GetDirectoryName(filename),
-                        String.Format("{0}.jsilconfig", Path.GetFileName(filename))
-                    );
+                    string fileConfigPath = null;
+                    var fileConfigSearchDir = Path.GetDirectoryName(filename);
+                    var separators = new char[] { '/', '\\' };
+
+                    do {
+                        fileConfigPath = Path.Combine(
+                            fileConfigSearchDir,
+                            String.Format("{0}.jsilconfig", Path.GetFileName(filename))
+                        );
+
+                        if (!File.Exists(fileConfigPath))
+                            fileConfigSearchDir = Path.GetFullPath(Path.Combine(fileConfigSearchDir, ".."));
+                        else
+                            break;
+                    } while (fileConfigSearchDir.IndexOfAny(separators, 3) > 0);
+
                     var fileConfig = File.Exists(fileConfigPath)
                         ? new Configuration[] { LoadConfiguration(fileConfigPath), commandLineConfiguration }
                         : new Configuration[] { commandLineConfiguration };


commented method Reduce()

commented method Reduce()

--- Dragon/Source/Expr.cs
+++ Dragon/Source/Expr.cs
@@ -22,6 +22,8 @@
             return this;
         }

+        //Computes or "reduce" an expression down to a single address;
+        //That is, it returns a constant, an identifier, or a temproary name.
         public virtual Expr Reduce()
         {
             return this;
@@ -95,6 +97,8 @@
             : base(op, type)
         { }

+        //Computes or "reduce" an expression down to a single address;
+        //That is, it returns a constant, an identifier, or a temproary name.
         public override Expr Reduce()
         {
             Expr expr = this.Gen();  //Note: the method Gen is virtual, so polymorphism will happen here.


Removed app name definition from MainActivity.cs. Leaving it up to the AndroidManifest.xml instead.

--- Droid/MainActivity.cs
+++ Droid/MainActivity.cs
@@ -6,7 +6,7 @@

 namespace Customers.Droid
 {
-    [Activity(Label = "Customers.Droid", Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
+    [Activity(Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
     public class MainActivity : FormsAppCompatActivity // inhertiting from FormsAppCompatActivity is imperative to taking advantage of Android AppCompat libraries
     {
         protected override void OnCreate(Bundle bundle)


Fix test unit

Fix test unit

--- test/Unosquare.Swan.Test/TerminalTest.cs
+++ test/Unosquare.Swan.Test/TerminalTest.cs
@@ -1,7 +1,6 @@
 using NUnit.Framework;
 using System;
 using System.Collections.Generic;
-using System.IO;
 using System.Linq;
 using System.Threading.Tasks;
 using Unosquare.Swan.Test.Mocks;
@@ -57,7 +56,7 @@

             Assert.IsTrue(messages.Any(x => x.Exception != null));
             Assert.IsTrue(messages.Any(x => x.Source == nameof(TerminalTest)));
-            Assert.AreEqual($"[{nameof(TerminalTest)}] {nameof(LoggingTest)}", messages.First(x => x.Source == nameof(TerminalTest)).Message);
+            Assert.AreEqual(nameof(LoggingTest), messages.First(x => x.Source == nameof(TerminalTest)).Message);

             nameof(LogMessageType.Info).Info(properties: new Dictionary<string, object> { { "Test", new { } } });
             Task.Delay(150).Wait();


Include location in testrun operation message

ARKADE-223

--- src/Arkivverket.Arkade/Core/Noark5/Noark5TestEngine.cs
+++ src/Arkivverket.Arkade/Core/Noark5/Noark5TestEngine.cs
@@ -113,7 +113,7 @@
                         var message = new StringBuilder();

                         foreach (var result in errorTestResults)
-                            message.AppendLine().AppendLine(result.Message);
+                            message.AppendLine().AppendLine(result.Location + " - " + result.Message);

                         _statusEventHandler.RaiseEventOperationMessage(test.GetName(), message.ToString(),
                             OperationMessageStatus.Error);


DataGrid minimum distance threshold when dragging headers

--- src/Avalonia.Controls.DataGrid/DataGridColumnHeader.cs
+++ src/Avalonia.Controls.DataGrid/DataGridColumnHeader.cs
@@ -35,6 +35,7 @@

         private const int DATAGRIDCOLUMNHEADER_resizeRegionWidth = 5;
         private const double DATAGRIDCOLUMNHEADER_separatorThickness = 1;
+        private const int DATAGRIDCOLUMNHEADER_columnsDragTreshold = 5;

         private bool _areHandlersSuspended;
         private static DragMode _dragMode;
@@ -448,19 +449,6 @@

             OnMouseMove_Reorder(ref handled, mousePosition, mousePositionHeaders, distanceFromLeft, distanceFromRight);

-            // if we still haven't done anything about moving the mouse while
-            // the button is down, we remember that we're dragging, but we don't
-            // claim to have actually handled the event
-            if (_dragMode == DragMode.MouseDown)
-            {
-                _dragMode = DragMode.Drag;
-            }
-
-            _lastMousePositionHeaders = mousePositionHeaders;
-
-            if (args.Pointer.Captured != this && _dragMode == DragMode.Drag)
-                args.Pointer.Capture(this);
-
             SetDragCursor(mousePosition);
         }

@@ -732,15 +720,19 @@
             {
                 return;
             }
-
+
             //handle entry into reorder mode
-            if (_dragMode == DragMode.MouseDown && _dragColumn == null && (distanceFromRight > DATAGRIDCOLUMNHEADER_resizeRegionWidth && distanceFromLeft > DATAGRIDCOLUMNHEADER_resizeRegionWidth))
-            {
-                handled = CanReorderColumn(OwningColumn);
-
-                if (handled)
-                {
-                    OnMouseMove_BeginReorder(mousePosition);
+            if (_dragMode == DragMode.MouseDown && _dragColumn == null && _lastMousePositionHeaders != null && (distanceFromRight > DATAGRIDCOLUMNHEADER_resizeRegionWidth && distanceFromLeft > DATAGRIDCOLUMNHEADER_resizeRegionWidth))
+            {
+                var distanceFromInitial = (Vector)(mousePositionHeaders - _lastMousePositionHeaders);
+                if (distanceFromInitial.Length > DATAGRIDCOLUMNHEADER_columnsDragTreshold)
+                {
+                    handled = CanReorderColumn(OwningColumn);
+
+                    if (handled)
+                    {
+                        OnMouseMove_BeginReorder(mousePosition);
+                    }
                 }
             }


Create instance of http context.

Create instance of http context.

--- src/Bibliotheca.Server.Gateway.Api/Jobs/UploaderJob.cs
+++ src/Bibliotheca.Server.Gateway.Api/Jobs/UploaderJob.cs
@@ -69,6 +69,7 @@
         {
             try
             {
+                _httpContextAccessor.HttpContext = new DefaultHttpContext();
                 _httpContextAccessor.HttpContext.Request.Headers.Add("Authorization", $"SecureToken {_applicationParameters.SecureToken}");

                 _logger.LogInformation($"[Uploading] Getting branch information ({projectId}/{branchName}).");


Upload asset with same name

Upload asset with same name

--- src/Blogifier.Core/Controllers/Api/AssetsController.cs
+++ src/Blogifier.Core/Controllers/Api/AssetsController.cs
@@ -27,7 +27,7 @@
             _logger = logger;
         }

-        // GET: api/assets/2?type=editor
+        // GET: api/assets/2?search=foo&filter=filterImages
         [HttpGet("{page:int?}")]
         public AdminAssetList Get(int page, string search, string filter)
         {
@@ -37,27 +37,6 @@

             var term = search == null || search == "null" ? "" : search;
             var fltr = filter == null || filter == "null" ? "" : filter;
-
-            //if (Request.Query.ContainsKey("type") && Request.Query["type"] == "editor")
-            //{
-            //    if(filter == "filterImages")
-            //    {
-            //        assets = _db.Assets.Find(a => a.ProfileId == profile.Id && a.Title.Contains(term) && a.AssetType == AssetType.Image, pager);
-            //    }
-            //    else if (filter == "filterAttachments")
-            //    {
-            //        assets = _db.Assets.Find(a => a.ProfileId == profile.Id && a.Title.Contains(term) && a.AssetType == AssetType.Attachment, pager);
-            //    }
-            //    else
-            //    {
-            //        assets = _db.Assets.Find(a => a.ProfileId == profile.Id && a.Title.Contains(term), pager);
-            //    }
-            //}
-            //else
-            //{
-            //    assets = _db.Assets.Find(a => a.ProfileId == profile.Id && a.AssetType == 0 && a.Title.Contains(term), pager);
-            //}
-

             if (filter == "filterImages")
             {
@@ -220,21 +199,30 @@
             var path = string.Format("{0}/{1}", DateTime.Now.Year, DateTime.Now.Month);

             var asset = await storage.UploadFormFile(file, Url.Content("~/"), path);
-            asset.ProfileId = profile.Id;
-            asset.LastUpdated = SystemClock.Now();
-
-            if (IsImageFile(asset.Url))
-            {
-                asset.AssetType = AssetType.Image;
+
+            // sometimes we just want to override uploaded file
+            // only add DB record if asset does not exist yet
+            var existingAsset = _db.Assets.Find(a => a.Path == asset.Path).FirstOrDefault();
+            if (existingAsset == null)
+            {
+                asset.ProfileId = profile.Id;
+                asset.LastUpdated = SystemClock.Now();
+
+                if (IsImageFile(asset.Url))
+                {
+                    asset.AssetType = AssetType.Image;
+                }
+                else
+                {
+                    asset.AssetType = AssetType.Attachment;
+                }
+                _db.Assets.Add(asset);
             }
             else
             {
-                asset.AssetType = AssetType.Attachment;
-            }
-
-            _db.Assets.Add(asset);
-            _db.Complete();
-
+                existingAsset.LastUpdated = SystemClock.Now();
+            }
+            _db.Complete();
             return asset;
         }


Force IncludeEvaluationPropertiesAndItems if escape hatch is set (#7217)

If there's an environment variable MSBUILDLOGPROPERTIESANDITEMSAFTEREVALUATION, it should take precedence over the logic that sets it to false if any logger hasn't opted in.

--- src/Build/BackEnd/Components/Logging/LoggingService.cs
+++ src/Build/BackEnd/Components/Logging/LoggingService.cs
@@ -525,9 +525,17 @@
             {
                 if (_includeEvaluationPropertiesAndItems == null)
                 {
-                    var sinks = _eventSinkDictionary.Values.OfType<EventSourceSink>();
-                    // .All() on an empty list defaults to true, we want to default to false
-                    _includeEvaluationPropertiesAndItems = sinks.Any() && sinks.All(sink => sink.IncludeEvaluationPropertiesAndItems);
+                    var escapeHatch = Traits.Instance.EscapeHatches.LogPropertiesAndItemsAfterEvaluation;
+                    if (escapeHatch.HasValue)
+                    {
+                        _includeEvaluationPropertiesAndItems = escapeHatch.Value;
+                    }
+                    else
+                    {
+                        var sinks = _eventSinkDictionary.Values.OfType<EventSourceSink>();
+                        // .All() on an empty list defaults to true, we want to default to false
+                        _includeEvaluationPropertiesAndItems = sinks.Any() && sinks.All(sink => sink.IncludeEvaluationPropertiesAndItems);
+                    }
                 }

                 return _includeEvaluationPropertiesAndItems ?? false;


Try removing the async call

Try removing the async call

--- src/Cash-Flow-Projection/Controllers/HomeController.cs
+++ src/Cash-Flow-Projection/Controllers/HomeController.cs
@@ -91,7 +91,7 @@
                 entry.Date = entry.Date.AddDays(1);
             }

-            await db.SaveChangesAsync();
+            db.SaveChanges();

             return RedirectToAction(nameof(Index));
         }


Démarrage du code de déplacement pour l'UserRoad.

--- EnVoiture/RoadUser.cs
+++ EnVoiture/RoadUser.cs
@@ -157,5 +157,26 @@
         {
             return bounds.IntersectsWith(other.bounds);
         }
+        int x, y;
+        public void Avancer()
+        {
+            Point p = new Point(x++, ys);
+
+            Location = p;
+        }
+        public void Gauche()
+        {
+
+        }
+        public void Droite()
+        {
+
+        }
+        /*
+        public bool Reculer()
+        {
+
+        }
+         * */
     }
 }


Fix comment

Fix comment

--- src/Core2D.UI/Behaviors/DocumentTextBindingBehavior.cs
+++ src/Core2D.UI/Behaviors/DocumentTextBindingBehavior.cs
@@ -15,7 +15,7 @@
         private TextEditor _textEditor = null;

         /// <summary>
-        /// Define <see cref="Context"/> property.
+        /// Define <see cref="Text"/> property.
         /// </summary>
         public static readonly StyledProperty<string> TextProperty =
             AvaloniaProperty.Register<DocumentTextBindingBehavior, string>(nameof(Text));


fix build

fix build

--- src/CorvusAlba.MyLittleLispy.Runtime/BuiltinsModule.cs
+++ src/CorvusAlba.MyLittleLispy.Runtime/BuiltinsModule.cs
@@ -173,7 +173,7 @@
             context.CurrentFrame.Bind("system-is-windows?", new Bool(GetRunningPlatform() == Platform.Windows));
             context.CurrentFrame.Bind("system-is-linux?", new Bool(GetRunningPlatform() == Platform.Linux));
             context.CurrentFrame.Bind("system-is-macos?", new Bool(GetRunningPlatform() == Platform.Mac));
-            context.CurrentFrame.Bind("my-little-lispy-runtime-version", new String(Assembly.GetAssembly().GetName().Version.ToString()));
+            context.CurrentFrame.Bind("my-little-lispy-runtime-version", new String(Assembly.GetAssembly(typeof(Context)).GetName().Version.ToString()));

             foreach (var define in _builtins)
             {


Fix not listening when call Listen(port)

--- Expresharp/Express.cs
+++ Expresharp/Express.cs
@@ -567,7 +567,7 @@
                 host= pricipal.IsInRole(WindowsBuiltInRole.Administrator) ? "*" : "localhost";
             HttpListener listener = new HttpListener();
             listener.Prefixes.Add(String.Format("http://{0}:{1}/", host, port));
-            listener.Start();
+            Listen(listener);
             return listener;
         }


Added missing xml doc element.

Added missing xml doc element.

--- src/ExcelDataReader/Core/BinaryFormat/XlsBiffRecord.cs
+++ src/ExcelDataReader/Core/BinaryFormat/XlsBiffRecord.cs
@@ -41,12 +41,13 @@
         internal int RecordContentOffset { get; }

         internal int Offset => RecordContentOffset - ContentOffset;
-
+
         /// <summary>
         /// Returns record at specified offset
         /// </summary>
         /// <param name="bytes">byte array</param>
         /// <param name="offset">position in array</param>
+        /// <param name="biffVersion">The biff version.</param>
         /// <returns>The record -or- null.</returns>
         public static XlsBiffRecord GetRecord(byte[] bytes, uint offset, int biffVersion)
         {


search for links by text both html escaped and not

--- src/FluentWebUITesting/Extensions/BrowserExtensions.cs
+++ src/FluentWebUITesting/Extensions/BrowserExtensions.cs
@@ -170,7 +170,7 @@
 			var link = browser.FindElements(By.LinkText(text)).FirstOrDefault() ?? browser.GetElementsByTagType("a").FirstOrDefault(x =>
 				{
 					var attribute = x.GetAttribute("innerHTML");
-					return attribute == htmlEscapedText;
+					return attribute == htmlEscapedText || attribute == text;
 				});
 			return new LinkWrapper(link, String.Format(howFound, text), browser);
 		}


Update swagger-ui

Update swagger-ui

Updates swagger-ui to version 4.14.0.

---
updated-dependencies:
- dependency-name: swagger-ui
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

--- src/API/Pages/Docs/Index.cshtml
+++ src/API/Pages/Docs/Index.cshtml
@@ -40,11 +40,11 @@
 }

 @section scripts {
-    <script src="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/4.13.2/swagger-ui-bundle.min.js" integrity="sha512-7A1uEzdMT1hteOR1s3zBGzdVbhLAaKnKz1N8dGEvViUmeoec7UEyyLVRpVezYer0u9m0wJMtLQpBpGpc+X0tXQ==" crossorigin="anonymous" referrerpolicy="no-referrer" defer></script>
-    <script src="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/4.13.2/swagger-ui-standalone-preset.min.js" integrity="sha512-OODuIoKisl5o35O0UGldXg3FhPVY3MTpS+wtYTTCSHHVlZUtt52cVYkIVUirBkclFa0LMITLGwOAR/yHBu3DgA==" crossorigin="anonymous" referrerpolicy="no-referrer" defer></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/4.14.0/swagger-ui-bundle.min.js" integrity="sha512-rljpFFNcMtssUFVYC/iQc1lb3z+eSWvX1BcRw/N7czgZXRZ7Pz9gAJHjbt+dvweNHzIK0nVwSAbM9Dm4H2rmPg==" crossorigin="anonymous" referrerpolicy="no-referrer" defer></script>
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/4.14.0/swagger-ui-standalone-preset.min.js" integrity="sha512-OODuIoKisl5o35O0UGldXg3FhPVY3MTpS+wtYTTCSHHVlZUtt52cVYkIVUirBkclFa0LMITLGwOAR/yHBu3DgA==" crossorigin="anonymous" referrerpolicy="no-referrer" defer></script>
 }

 @section styles {
     <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Source+Code+Pro:300,600|Titillium+Web:400,600,700" crossorigin="anonymous" />
-    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/4.13.2/swagger-ui.min.css" integrity="sha512-UoU6tKyF/ag2rLaiNmCqxNT+vAnxaTGRu7UdQv69kX3u7ZNY2W2RTx/ITk67YC3bfj0p5LPy0YOgbGjBQLXEGg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
+    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/swagger-ui/4.14.0/swagger-ui.min.css" integrity="sha512-5HhuoYx4ezQ+RZ5r7TehN/ssx9UQdW13kZJVO/NZ9mG78wknsQegqr6lhvVKgmqyh+S+6lYCwja6ayNuXt/Mvg==" crossorigin="anonymous" referrerpolicy="no-referrer" />
 }


use disposable handler instead.

use disposable handler instead.

--- src/Avalonia.Controls/Slider.cs
+++ src/Avalonia.Controls/Slider.cs
@@ -83,7 +83,8 @@
         private IDisposable _increaseButtonSubscription;
         private IDisposable _increaseButtonReleaseDispose;
         private IDisposable _pointerMovedDispose;
-
+        private IDisposable _trackOnKeyDownDispose;
+
         private const double Tolerance = 0.0001;

         /// <summary>
@@ -164,16 +165,16 @@
             _increaseButtonSubscription?.Dispose();
             _increaseButtonReleaseDispose?.Dispose();
             _pointerMovedDispose?.Dispose();
-
+            _trackOnKeyDownDispose?.Dispose();
+
             _decreaseButton = e.NameScope.Find<Button>("PART_DecreaseButton");
             _track = e.NameScope.Find<Track>("PART_Track");
             _increaseButton = e.NameScope.Find<Button>("PART_IncreaseButton");

-
             if (_track != null)
             {
                 _track.IsThumbDragHandled = true;
-                _track.KeyDown += TrackOnKeyDown;
+                _trackOnKeyDownDispose = _track.AddDisposableHandler(KeyDownEvent, TrackOnKeyDown);
             }

             if (_decreaseButton != null)
@@ -184,8 +185,10 @@

             if (_increaseButton != null)
             {
-                _increaseButtonSubscription = _increaseButton.AddDisposableHandler(PointerPressedEvent, TrackPressed, RoutingStrategies.Tunnel);
-                _increaseButtonReleaseDispose = _increaseButton.AddDisposableHandler(PointerReleasedEvent, TrackReleased, RoutingStrategies.Tunnel);
+                _increaseButtonSubscription =
+                    _increaseButton.AddDisposableHandler(PointerPressedEvent, TrackPressed, RoutingStrategies.Tunnel);
+                _increaseButtonReleaseDispose = _increaseButton.AddDisposableHandler(PointerReleasedEvent,
+                    TrackReleased, RoutingStrategies.Tunnel);
             }

             _pointerMovedDispose = this.AddDisposableHandler(PointerMovedEvent, TrackMoved, RoutingStrategies.Tunnel);


a5 --> A5 in unit test

a5 --> A5 in unit test

--- src/BloomTests/PdfMakerTests.cs
+++ src/BloomTests/PdfMakerTests.cs
@@ -36,7 +36,7 @@
 			{
 				File.WriteAllText(input.Path, "Hello");
 				File.Delete(output.Path);
-				maker.MakePdf(input.Path, output.Path, "a5", false, PublishModel.BookletLayoutMethod.SideFold,  PublishModel.BookletPortions.BookletPages);
+				maker.MakePdf(input.Path, output.Path, "A5", false, PublishModel.BookletLayoutMethod.SideFold,  PublishModel.BookletPortions.BookletPages);
 				//we don't actually have a way of knowing it did a booklet
 				Assert.IsTrue(File.Exists(output.Path));
 			}


fix mvc template

fix mvc template

--- templates/MVC/content/Audit.Mvc.Template/AuditStartup.cs
+++ templates/MVC/content/Audit.Mvc.Template/AuditStartup.cs
@@ -3,6 +3,7 @@
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.Extensions.DependencyInjection;
+using Audit.Mvc;

 namespace Audit.Mvc.Template
 {


sun flare is better at hiding the sprites

--- Demos/DemosCommon/SSunFlareEffect.cs
+++ Demos/DemosCommon/SSunFlareEffect.cs
@@ -74,20 +74,28 @@

         protected override void _prepareSpritesData ()
         {
+            int numElements = instanceData.activeBlockLength;
+            if (_sunDiskOccIntensity <= 0f) {
+                for (int i = 0; i < numElements; ++i) {
+                    instanceData.writePosition(i, new Vector2(float.NaN)); // hide all sprites
+                }
+                return;
+            }
+
             var color4 = _sunDiskOccObj.MainColor;
             color4.A = _sunDiskOccIntensity;
             instanceData.writeColor(0, color4);

-            Vector2 compScale = new Vector2(
-                Math.Max (_sunDiskOccSize.X, _sunDiskOccSize.Y) * Math.Min (1.5f, 1f / (1f - _sunDiskOccIntensity)));
+            Vector2 compScale = new Vector2(Math.Max (_sunDiskOccSize.X, _sunDiskOccSize.Y)
+                * Math.Min (1.5f, 1f / (1f - _sunDiskOccIntensity)));
             instanceData.writeComponentScale(0, compScale);

             Vector2 center = new Vector2 (_clientRect.X, _clientRect.Y)
                            + new Vector2 (_clientRect.Width, _clientRect.Width) / 2f;
             Vector2 towardsCenter = center - _sunDiskOccPos;
-            int numElements = instanceData.activeBlockLength;
             for (int i = 0; i < numElements; ++i) {
-                Vector2 spriteCenter = _sunDiskOccPos + towardsCenter * 2.5f / (float)numElements * (float)i;
+                Vector2 spriteCenter = _sunDiskOccPos + towardsCenter * 2.5f
+                    / (float)numElements * (float)i;
                 instanceData.writePosition(i, spriteCenter);
             }
         }


exceptions should be marked as serializable

--- src/Cassette/TinyIoC/TinyIoC.cs
+++ src/Cassette/TinyIoC/TinyIoC.cs
@@ -317,6 +317,7 @@
     #endregion

     #region TinyIoC Exception Types
+    [Serializable]
     public class TinyIoCResolutionException : Exception
     {
         private const string ERROR_TEXT = "Unable to resolve type: {0}";
@@ -332,6 +333,7 @@
         }
     }

+    [Serializable]
     public class TinyIoCRegistrationTypeException : Exception
     {
         private const string REGISTER_ERROR_TEXT = "Cannot register type {0} - abstract classes or interfaces are not valid implementation types for {1}.";
@@ -347,6 +349,7 @@
         }
     }

+    [Serializable]
     public class TinyIoCRegistrationException : Exception
     {
         private const string CONVERT_ERROR_TEXT = "Cannot convert current registration of {0} to {1}";
@@ -373,6 +376,7 @@
         }
     }

+    [Serializable]
     public class TinyIoCWeakReferenceException : Exception
     {
         private const string ERROR_TEXT = "Unable to instantiate {0} - referenced object has been reclaimed";
@@ -388,6 +392,7 @@
         }
     }

+    [Serializable]
     public class TinyIoCConstructorResolutionException : Exception
     {
         private const string ERROR_TEXT = "Unable to resolve constructor for {0} using provided Expression.";
@@ -413,6 +418,7 @@
         }
     }

+    [Serializable]
     public class TinyIoCAutoRegistrationException : Exception
     {
         private const string ERROR_TEXT = "Duplicate implementation of type {0} found ({1}).";


Found bug in mono's IPAdress parsing. This should fix it.

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

--- src/MonoTorrent/Tracker/Frontend/AnnounceParameters.cs
+++ src/MonoTorrent/Tracker/Frontend/AnnounceParameters.cs
@@ -140,7 +140,7 @@
             /* If the user has supplied an IP address, we use that instead of
              * the IP address we read from the announce request connection. */
             IPAddress supplied;
-            if (IPAddress.TryParse(Parameters["ip"] ?? "", out supplied))
+            if (IPAddress.TryParse(Parameters["ip"] ?? "", out supplied) && !supplied.Equals(IPAddress.Any))
                 clientAddress = new IPEndPoint(supplied, Port);
             else
                 clientAddress = new IPEndPoint(address, Port);


Tweaked scanning code

Tweaked scanning code

--- src/Nancy/Bootstrapper/AppDomainAssemblyTypeScanner.cs
+++ src/Nancy/Bootstrapper/AppDomainAssemblyTypeScanner.cs
@@ -229,8 +229,6 @@

                 foreach (var unloadedAssembly in unloadedAssemblies)
                 {
-                    Debug.WriteLine(unloadedAssembly);
-
                     var inspectedAssembly =
                         Assembly.ReflectionOnlyLoadFrom(unloadedAssembly);

@@ -238,8 +236,7 @@
                     {
                         try
                         {
-                            Debug.WriteLine(" - Adding it");
-                            Assembly.Load(AssemblyName.GetAssemblyName(unloadedAssembly));
+                            Assembly.Load(inspectedAssembly.GetName());
                         }
                         catch
                         {


Unit test for issue 8.

Unit test for issue 8.

--- src/NodaTime.Test/TimeZones/MiscellaneousBugReports.cs
+++ src/NodaTime.Test/TimeZones/MiscellaneousBugReports.cs
@@ -52,5 +52,22 @@
             var offset = pyongyang.GetOffsetFromUtc(new ZonedDateTime(2010, 1, 1, 0, 0, 0, pyongyang).ToInstant());
             Assert.AreEqual(Offset.ForHours(9), offset);
         }
+
+        [Test]
+        public void Khartoum()
+        {
+            DateTimeZone khartoum = DateTimeZone.ForId("Africa/Khartoum");
+            Assert.IsNotNull(khartoum);
+            Instant utc = Instant.FromUtc(2000, 1, 1, 0, 0, 0);
+            ZonedDateTime inKhartoum = new ZonedDateTime(utc, khartoum);
+            LocalDateTime expectedLocal = new LocalDateTime(2000, 1, 1, 2, 0);
+            Assert.AreEqual(expectedLocal, inKhartoum.LocalDateTime);
+
+            // Khartoum changed from +2 to +3 on January 15th 2000
+            utc = Instant.FromUtc(2000, 1, 16, 0, 0, 0);
+            inKhartoum = new ZonedDateTime(utc, khartoum);
+            expectedLocal = new LocalDateTime(2000, 1, 16, 3, 0);
+            Assert.AreEqual(expectedLocal, inKhartoum.LocalDateTime);
+        }
     }
 }


Random matrices with single solution now have lots of zero rows too

--- DlxLibPropertyTests/PropertyTests.cs
+++ DlxLibPropertyTests/PropertyTests.cs
@@ -80,14 +80,27 @@
         private static Gen<int[,]> GenMatrixOfIntWithSingleSolution()
         {
             return
-                from numCols in Any.IntBetween(2, 100)
+                from numCols in Any.IntBetween(2, 20)
                 from numPieces in Any.IntBetween(1, Math.Min(5, numCols))
+                from numRows in Any.IntBetween(numPieces, 20)
                 from partialSolutionRows in GenPartialSolutionRows(numCols, numPieces)
-                // TODO: need to generate a mix of 90% rows of all 0s, 10% partial solution rows
-                select partialSolutionRows.To2DArray();
+                let genZeroRow = Any.Value(Enumerable.Repeat(0, numCols).ToList())
+                from zeroRows in genZeroRow.MakeListOfLength(numRows)
+                from overrideIdxs in GenExtensions.PickValues(numPieces, Enumerable.Range(0, numRows))
+                select OverrideSomeRows(zeroRows, partialSolutionRows, overrideIdxs).To2DArray();
         }

-        // TODO: add an FsCheckUtils method to shuffle a list of items...
+        //private static Gen<int[,]> GenMatrixOfIntWithMultipleSolutions(int n)
+        //{
+        //    return Any.OfType<int[,]>();
+        //}
+
+        private static List<List<int>> OverrideSomeRows(List<List<int>> rows, IReadOnlyList<List<int>> overrideRows, IEnumerable<int> overrideIdxs)
+        {
+            var fromIdx = 0;
+            foreach (var toIdx in overrideIdxs) rows[toIdx] = overrideRows[fromIdx++];
+            return rows;
+        }

         private static Gen<List<int>> GenPieceLengths(int numCols, int numPieces)
         {
@@ -136,11 +149,6 @@
             return partialSolutionRow;
         }

-        //private static Gen<int[,]> GenMatrixOfIntWithMultipleSolutions(int n)
-        //{
-        //    return Any.OfType<int[,]>();
-        //}
-
         private static IEnumerable<int> RemoveSelectedIdxs(IEnumerable<int> remainingIdxs, IEnumerable<int> selectedIdxs)
         {
             return remainingIdxs.Except(selectedIdxs);


Reverts conversion of using declaration

Reverts conversion of using declaration

--- test/DbfDataReader.Benchmarks/DbfDataReaderBenchmarks.cs
+++ test/DbfDataReader.Benchmarks/DbfDataReaderBenchmarks.cs
@@ -10,16 +10,18 @@
         [Benchmark]
         public void DbfDataReader()
         {
-            using var dbfDataReader = new DbfDataReader(FixturePath);
-            var cols = dbfDataReader.GetColumnSchema();
-            var allowDbNull = cols.Select(c => c.AllowDBNull != false).ToArray();
-            while (dbfDataReader.Read())
+            using (var dbfDataReader = new DbfDataReader(FixturePath))
             {
-                for (var ordinal = 0; ordinal < dbfDataReader.FieldCount; ordinal++)
+                var cols = dbfDataReader.GetColumnSchema();
+                var allowDbNull = cols.Select(c => c.AllowDBNull != false).ToArray();
+                while (dbfDataReader.Read())
                 {
-                    if (allowDbNull[ordinal] && dbfDataReader.IsDBNull(ordinal))
-                        continue;
-                    dbfDataReader.ReadField(ordinal);
+                    for (var ordinal = 0; ordinal < dbfDataReader.FieldCount; ordinal++)
+                    {
+                        if (allowDbNull[ordinal] && dbfDataReader.IsDBNull(ordinal))
+                            continue;
+                        dbfDataReader.ReadField(ordinal);
+                    }
                 }
             }
         }


简单的调整了下代码。 :signal_strength:

简单的调整了下代码。 :signal_strength:

--- src/Data/ConditionCollection.cs
+++ src/Data/ConditionCollection.cs
@@ -50,7 +50,8 @@
 			{
 				foreach(var item in items)
 				{
-					this.Add(item);
+					if(item != null)
+						this.Add(item);
 				}
 			}
 		}
@@ -63,7 +64,8 @@
 			{
 				foreach(var item in items)
 				{
-					this.Add(item);
+					if(item != null)
+						this.Add(item);
 				}
 			}
 		}


Fixed a couple Optional errors

Fixed a couple Optional errors

--- src/Discord.Net/API/Optional.cs
+++ src/Discord.Net/API/Optional.cs
@@ -9,7 +9,7 @@
     {
         private readonly T _value;

-        /// <summary> Gets the value for this paramter, or default(T) if unspecified. </summary>
+        /// <summary> Gets the value for this paramter. </summary>
         public T Value
         {
             get
@@ -21,8 +21,6 @@
         }
         /// <summary> Returns true if this value has been specified. </summary>
         public bool IsSpecified { get; }
-
-        object IOptional.Value => _value;

         /// <summary> Creates a new Parameter with the provided value. </summary>
         public Optional(T value)
@@ -40,12 +38,14 @@
             if (other == null) return false;
             return _value.Equals(other);
         }
+        public override int GetHashCode() => IsSpecified ? _value.GetHashCode() : 0;

-        public override int GetHashCode() => IsSpecified ? _value.GetHashCode() : 0;
         public override string ToString() => IsSpecified ? _value?.ToString() : null;
         private string DebuggerDisplay => IsSpecified ? _value.ToString() : "<unspecified>";

         public static implicit operator Optional<T>(T value) => new Optional<T>(value);
         public static explicit operator T(Optional<T> value) => value.Value;
+
+        object IOptional.Value => Value;
     }
 }


Cleanup

Cleanup

--- src/Discord.Net/Helpers/Http.cs
+++ src/Discord.Net/Helpers/Http.cs
@@ -1,17 +1,14 @@
-using Newtonsoft.Json;
+using Discord.API;
+using Newtonsoft.Json;
 using System;
+using System.Diagnostics;
+using System.IO;
+using System.Globalization;
+using System.Net.Http;
+using System.Net;
+using System.Reflection;
 using System.Text;
 using System.Threading.Tasks;
-using System.Net.Http;
-using System.Reflection;
-using System.Net;
-using System.IO;
-using System.Globalization;
-using Discord.API;
-
-#if TEST_RESPONSES
-using System.Diagnostics;
-#endif

 namespace Discord.Helpers
 {


Update version number.

Update version number.

--- editor/Properties/AssemblyInfo.cs
+++ editor/Properties/AssemblyInfo.cs
@@ -31,4 +31,4 @@
 // 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.57.*")]
+[assembly: AssemblyVersion("1.58.*")]


Fixed tests

Fixed tests

--- src/Hades.Testing/ParserTest.cs
+++ src/Hades.Testing/ParserTest.cs
@@ -13,7 +13,7 @@
         private void FailTest(string code, bool fail)
         {
             var lexer = new Lexer();
-            var parser = new Parser(lexer.LexFile(code));
+            var parser = new Parser(lexer.LexFile(code), false);

             if (fail)
             {
@@ -126,7 +126,7 @@
         public void EnsureWith(string code, string source, string target, string name, bool native, string nativePackage)
         {
             var lexer = new Lexer();
-            var parser = new Parser(lexer.LexFile(code));
+            var parser = new Parser(lexer.LexFile(code), false);
             var root = parser.Parse();
             var node = root.Children.First();
             Assert.IsTrue(node is WithNode);


Resolve ordering problem with HtmlNode.RemoveChild(oldchild,keepGrandChildren)

Related: https://htmlagilitypack.codeplex.com/workitem/9113

--- src/HtmlAgilityPack/HtmlNode.cs
+++ src/HtmlAgilityPack/HtmlNode.cs
@@ -1378,7 +1378,7 @@
 				// reroute grand children to ourselves
 				foreach (HtmlNode grandchild in oldChild._childnodes)
 				{
-					InsertAfter(grandchild, prev);
+					prev = InsertAfter(grandchild, prev);
 				}
 			}
 			RemoveChild(oldChild);


Updating documentation comment. No functional changes

--- dotnet/src/webdriver/Chrome/ChromeOptions.cs
+++ dotnet/src/webdriver/Chrome/ChromeOptions.cs
@@ -49,9 +49,7 @@
     /// <para>For use with RemoteWebDriver:</para>
     /// <para></para>
     /// <code>
-    /// DesiredCapabilities capabilities = DesiredCapabilities.Chrome();
-    /// capabilities.SetCapability(ChromeOptions.Capability, options);
-    /// RemoteWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), capabilities);
+    /// RemoteWebDriver driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), options.ToCapabilities());
     /// </code>
     /// </example>
     public class ChromeOptions


Removed configuration test code

Removed configuration test code

--- src/SFA.DAS.EmployerFinance.MessageHandlers/Program.cs
+++ src/SFA.DAS.EmployerFinance.MessageHandlers/Program.cs
@@ -21,7 +21,6 @@
             {
                 var config = new JobHostConfiguration();
                 var startup = container.GetInstance<IStartup>();
-                var configtest = container.GetInstance<EmployerFinanceConfiguration>();

                 if (ConfigurationHelper.IsEnvironmentAnyOf(Environment.Local))
                 {


Fix bug: "Copy" button don't show in TextView during saving

--- src/SharpGraphEditor/ViewModels/TextViewerViewModel.cs
+++ src/SharpGraphEditor/ViewModels/TextViewerViewModel.cs
@@ -17,7 +17,7 @@
         public TextViewerViewModel(string text, bool canCopy, bool canCancel, bool isReadOnly)
         {
             Text = text;
-            CanCopy = CanCopy;
+            CanCopy = canCopy;
             CanCancel = canCancel;
             IsReadOnly = isReadOnly;
         }


Instagram: Added comment regarding the "attribution" property for media

--- src/Skybrud.Social/Instagram/Objects/InstagramMedia.cs
+++ src/Skybrud.Social/Instagram/Objects/InstagramMedia.cs
@@ -7,6 +7,16 @@
     public abstract class InstagramMedia : SocialJsonObject, ISocialTimelineEntry {

         #region Properties
+
+        // A photo/media may specify an attribution property, but the Instagram documentation has
+        // no information regarding this property. However this Google Groups discussion sheds a
+        // little light on what attribution is:
+        //
+        // https://groups.google.com/forum/#!topic/instagram-api-developers/KvGH1cnjljQ
+        //
+        // However since I haven't been able to find any media with the attribution property, and
+        // that the official documentation doesn't have any information about this property, it is
+        // currently not supported in Skybrud.Social.

         /// <summary>
         /// The ID of the media.


Fixed hardcode

Fixed hardcode

--- src/SnakeBattleNet.Web/Views/Shared/_HeaderMenu.cshtml
+++ src/SnakeBattleNet.Web/Views/Shared/_HeaderMenu.cshtml
@@ -1,4 +1,5 @@
 @using Microsoft.AspNet.Identity
+@using SnakeBattleNet.Web.Core.Auth

@@ -23,7 +24,7 @@
                     @Html.AntiForgeryToken()

-                        @if (User.IsInRole("Admin"))
+                        @if (User.IsInRole(RolesProvider.Admin))
                         {

@Html.ActionLink("Admin", "Index", "Admin")

                         }


Updated contract and exposed GetSchema and GetSchemaTable methods (#26762)

* Updated contract and exposed GetSchema and GetSchemaTable methods via concrete classes SqlConnection and SqlDataReader respectively

* Updated DataTable to fully qualified name

--- src/System.Data.SqlClient/ref/System.Data.SqlClient.cs
+++ src/System.Data.SqlClient/ref/System.Data.SqlClient.cs
@@ -478,6 +478,9 @@
         public override void Close() { }
         public new System.Data.SqlClient.SqlCommand CreateCommand() { throw null; }
         protected override System.Data.Common.DbCommand CreateDbCommand() { throw null; }
+        public override System.Data.DataTable GetSchema() { throw null; }
+        public override System.Data.DataTable GetSchema(string collectionName) { throw null; }
+        public override System.Data.DataTable GetSchema(string collectionName, string[] restrictionValues) { throw null; }
         public override void Open() { }
         public override System.Threading.Tasks.Task OpenAsync(System.Threading.CancellationToken cancellationToken) { throw null; }
         public void ResetStatistics() { }
@@ -681,6 +684,7 @@
         public virtual object GetSqlValue(int i) { throw null; }
         public virtual int GetSqlValues(object[] values) { throw null; }
         public virtual System.Data.SqlTypes.SqlXml GetSqlXml(int i) { throw null; }
+        public override System.Data.DataTable GetSchemaTable() { throw null; }
         public override System.IO.Stream GetStream(int i) { throw null; }
         public override string GetString(int i) { throw null; }
         public override System.IO.TextReader GetTextReader(int i) { throw null; }


Rollback of changes not related to this issue

--- src/Umbraco.Web/Install/InstallSteps/NewInstallStep.cs
+++ src/Umbraco.Web/Install/InstallSteps/NewInstallStep.cs
@@ -56,7 +56,22 @@
                 throw new InvalidOperationException("Could not find the super user!");
             }

-            await ResetAdminPassword(user.Password);
+            var userManager = _httpContextAccessor.GetRequiredHttpContext().GetOwinContext().GetBackOfficeUserManager();
+            var membershipUser = await userManager.FindByIdAsync(Constants.Security.SuperUserId);
+            if (membershipUser == null)
+            {
+                throw new InvalidOperationException(
+                    $"No user found in membership provider with id of {Constants.Security.SuperUserId}.");
+            }
+
+            //To change the password here we actually need to reset it since we don't have an old one to use to change
+            var resetToken = await userManager.GeneratePasswordResetTokenAsync(membershipUser.Id);
+            var resetResult =
+                await userManager.ChangePasswordWithResetAsync(membershipUser.Id, resetToken, user.Password.Trim());
+            if (!resetResult.Succeeded)
+            {
+                throw new InvalidOperationException("Could not reset password: " + string.Join(", ", resetResult.Errors));
+            }

             admin.Email = user.Email.Trim();
             admin.Name = user.Name.Trim();
@@ -80,26 +95,6 @@
             }

             return null;
-        }
-
-        private async Task ResetAdminPassword(string clearTextPassword)
-        {
-            var userManager = _httpContextAccessor.GetRequiredHttpContext().GetOwinContext().GetBackOfficeUserManager();
-            var membershipUser = await userManager.FindByIdAsync(Constants.Security.SuperUserId);
-            if (membershipUser == null)
-            {
-                throw new InvalidOperationException(
-                    $"No user found in membership provider with id of {Constants.Security.SuperUserId}.");
-            }
-
-            //To change the password here we actually need to reset it since we don't have an old one to use to change
-            var resetToken = await userManager.GeneratePasswordResetTokenAsync(membershipUser.Id);
-            var resetResult =
-                await userManager.ChangePasswordWithResetAsync(membershipUser.Id, resetToken, clearTextPassword.Trim());
-            if (!resetResult.Succeeded)
-            {
-                throw new InvalidOperationException("Could not reset password: " + string.Join(", ", resetResult.Errors));
-            }
         }

         /// <summary>


Fixed obsolete method-call

Fixed obsolete method-call

--- src/WebApp/Controllers/WorkshopManagementController.cs
+++ src/WebApp/Controllers/WorkshopManagementController.cs
@@ -135,7 +135,7 @@
                         if (ex.StatusCode == HttpStatusCode.Conflict)
                         {
                             // add errormessage from API exception to model
-                            var content = ex.GetContentAs<BusinessRuleViolation>();
+                            var content = await ex.GetContentAsAsync<BusinessRuleViolation>();
                             inputModel.Error = content.ErrorMessage;

                             // repopulate list of available vehicles in the model


Update assert to have a better message of actually what is wrong

--- src/Workspaces/Remote/Core/Services/SolutionCreator.cs
+++ src/Workspaces/Remote/Core/Services/SolutionCreator.cs
@@ -621,37 +621,36 @@

         private async Task ValidateChecksumAsync(Checksum givenSolutionChecksum, Solution solution)
         {
+#if DEBUG
+            var currentSolutionChecksum = await solution.State.GetChecksumAsync(_cancellationToken).ConfigureAwait(false);
+
+            if (givenSolutionChecksum == currentSolutionChecksum)
+            {
+                return;
+            }
+
+            var map = await solution.GetAssetMapAsync(_cancellationToken).ConfigureAwait(false);
+            await RemoveDuplicateChecksumsAsync(givenSolutionChecksum, map).ConfigureAwait(false);
+
+            foreach (var kv in map.Where(kv => kv.Value is ChecksumWithChildren).ToList())
+            {
+                map.Remove(kv.Key);
+            }
+
+            var sb = new StringBuilder();
+            foreach (var kv in map)
+            {
+                sb.AppendLine($"{kv.Key.ToString()}, {kv.Value.ToString()}");
+            }
+
+            Logger.Log(FunctionId.SolutionCreator_AssetDifferences, sb.ToString());
+
+            Debug.Fail("Differences detected in solution checksum: " + sb.ToString());
+#else
+
             // have this to avoid error on async
             await Task.CompletedTask.ConfigureAwait(false);
-
-#if DEBUG
-            var currentSolutionChecksum = await solution.State.GetChecksumAsync(_cancellationToken).ConfigureAwait(false);
-
-            if (givenSolutionChecksum == currentSolutionChecksum)
-            {
-                return;
-            }
-
-            Debug.Assert(false, "checksum not same");
-
-            var map = await solution.GetAssetMapAsync(_cancellationToken).ConfigureAwait(false);
-            await RemoveDuplicateChecksumsAsync(givenSolutionChecksum, map).ConfigureAwait(false);
-
-            foreach (var kv in map.Where(kv => kv.Value is ChecksumWithChildren).ToList())
-            {
-                map.Remove(kv.Key);
-            }
-
-            var sb = new StringBuilder();
-            foreach (var kv in map)
-            {
-                sb.AppendLine($"{kv.Key.ToString()}, {kv.Value.ToString()}");
-            }
-
-            Logger.Log(FunctionId.SolutionCreator_AssetDifferences, sb.ToString());
 #endif
-
-            return;
         }

         private async Task RemoveDuplicateChecksumsAsync(Checksum givenSolutionChecksum, Dictionary<Checksum, object> map)


don't hold onto tree in memory

don't hold onto tree in memory

--- src/Workspaces/Remote/Core/Services/SolutionService.cs
+++ src/Workspaces/Remote/Core/Services/SolutionService.cs
@@ -1,9 +1,11 @@
 // Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

+using System;
 using System.Collections.Generic;
 using System.Threading;
 using System.Threading.Tasks;
 using Microsoft.CodeAnalysis.Diagnostics;
+using Microsoft.CodeAnalysis.Host;
 using Microsoft.CodeAnalysis.Options;
 using Microsoft.CodeAnalysis.Serialization;
 using Microsoft.CodeAnalysis.Text;
@@ -80,6 +82,10 @@
             var solutionChecksumObject = await _assetService.GetAssetAsync<SolutionStateChecksums>(solutionChecksum, cancellationToken).ConfigureAwait(false);

             var workspace = new AdhocWorkspace(RoslynServices.HostServices, workspaceKind: WorkspaceKind_RemoteWorkspace);
+
+            // never cache any tree in memory
+            workspace.Options = workspace.Options.WithChangedOption(CacheOptions.RecoverableTreeLengthThreshold, 0);
+
             var solutionInfo = await _assetService.GetAssetAsync<SolutionInfo.SolutionAttributes>(solutionChecksumObject.Info, cancellationToken).ConfigureAwait(false);

             var projects = new List<ProjectInfo>();


Added krystalName analysers to KrystalStatics.cs

--- Krystals4ObjectLibrary/KrystalStatics.cs
+++ Krystals4ObjectLibrary/KrystalStatics.cs
@@ -234,57 +234,87 @@
         }
         #endregion

-        public static uint KrystalMaxValue(string krystalName)
-        {
-            string maxValueString = "0";
-            int firstBracketIndex = krystalName.IndexOf('(');
-            int secondBracketIndex = krystalName.IndexOf(')');
-            string bracketContentString = krystalName.Substring(firstBracketIndex + 1, secondBracketIndex - firstBracketIndex - 1);
-
-            if(IsConstantKrystalFilename(krystalName)
-            || IsLineKrystalFilename(krystalName)
-            || IsModulationKrystalFilename(krystalName)
-            || IsPermutationKrystalFilename(krystalName))
-            {
-                maxValueString = bracketContentString;
-            }
-            else if(IsExpansionKrystalFilename(krystalName) || IsShapedExpansionKrystalFilename(krystalName))
-            {
-                string[] substrings = bracketContentString.Split(new char[] { '.' });
-                maxValueString = substrings[1];
-            }
-
-            return uint.Parse(maxValueString);
-        }
-
-        public static uint KrystalLevel(string krystalName)
-        {
-            uint level = 0;
-            string head = krystalName.Substring(0, 2);
-            switch(head)
-            {
-                case "ck":
+        #region krystalName information
+        public static int KrystalMaxValue(string krystalName)
+        {
+            char[] dot = new char[] { '.' };
+
+            var components = krystalName.Split(dot);
+
+            return int.Parse(components[0]);
+        }
+
+        public static List<int> KrystalShape(string krystalName)
+        {
+            char[] dot = new char[] { '.' };
+            char[] underline = new char[] { '_' };
+
+            var components = krystalName.Split(dot);
+            var shapeComponents = components[1].Split(underline);
+
+            var rval = new List<int>();
+            foreach(var value in shapeComponents)
+            {
+                rval.Add(int.Parse(value));
+            }
+
+            return rval;
+        }
+
+        public static int KrystalLevel(string krystalName)
+        {
+            char[] dot = new char[] { '.' };
+            char[] underline = new char[] { '_' };
+
+            var components = krystalName.Split(dot);
+            var shapeComponents = components[1].Split(underline);
+            int level;
+
+            switch(shapeComponents.Length)
+            {
+                case 1:
                     level = 0;
                     break;
-                case "lk":
-                    level = 1;
-                    break;
-                case "mk":
-                case "pk":
-                case "sk":
-                case "xk":
-                    string levelString = krystalName.Substring(2);
-                    int index = 0;
-                    while(Char.IsDigit(levelString[index]))
-                        index++;
-                    levelString = levelString.Substring(0, index);
-                    level = uint.Parse(levelString);
+                case 2:
+                    level = int.Parse(shapeComponents[0]); // 1 or 2
                     break;
                 default:
+                    level = shapeComponents.Length;
                     break;
             }
             return level;
         }
+
+        public static int KrystalNameIndex(string krystalName)
+        {
+            char[] dot = new char[] { '.' };
+
+            var components = krystalName.Split(dot);
+
+            return int.Parse(components[3]);
+        }
+
+        public static string KrystalTypeString(string krystalName)
+        {
+            char[] dot = new char[] { '.' };
+
+            var components = krystalName.Split(dot);
+
+            return components[4];
+        }
+
+        public static KrystalType KrystalTypeEnum(string krystalName)
+        {
+            char[] dot = new char[] { '.' };
+
+            var components = krystalName.Split(dot);
+
+            Enum.TryParse(components[4], out KrystalType krystalType);
+
+            return krystalType;
+        }
+
+        #endregion

         /// <summary>
         /// If krystalNameList is a list of krystal names, it can be sorted into ascending order by calling


Ya no se hace snap all a todos los objetos del mundo, sino a los objetos del grid seleccionado. También reordené el nombre de los items del menú y agregué un contador de los objetos del grid.

--- GhostGrid.cs
+++ GhostGrid.cs
@@ -17,6 +17,7 @@
 public class GhostGrid : MonoBehaviour
 {
     public float gridSize = 1f;
+    public int quantity = 0;

     [HideInInspector]
     public bool autoSnapEnabled = false;
@@ -66,8 +67,9 @@
         if (gridSize > 0)
         {
             children = GetComponentsInChildren<Transform>();
+            quantity = children.Length;

-            for (int i = 0; i < children.Length; i++)
+            for (int i = 0; i < quantity; i++)
             {
                 Vector3 pos = children[i].position;
                 Vector3 snapped = new Vector3(
@@ -82,17 +84,49 @@

 #if UNITY_EDITOR
     /// <summary>
-    /// Menu item to enable the grid for the selected transform.
+    /// Menu item to snap all to the grids.
+    /// Shortcut: Shift + S
     /// </summary>
-    [MenuItem("Jam Tools/GhostGrid/Enable autosnap &a")]
-    private static void LogSelectedTransformName()
+    [MenuItem("Jam Tools/GhostGrid/Snap grid &s")]
+    private static void SnapSelectedGrid()
     {
         GhostGrid grid = Selection.activeTransform.GetComponentInParent<GhostGrid>();

         if (grid != null)
         {
+            grid.SnapAll();
+
+            Debug.Log("GhostGrid :: Grid snapped!");
+        }
+        else
+        {
+            Debug.Log("GhostGrid :: Selected grid doesn't know GhostGrid. Just add the component!");
+        }
+    }
+
+
+    /// <summary>
+    /// Disable the previous menu item if no transform is selected.
+    /// </summary>
+    [MenuItem("Jam Tools/GhostGrid/Snap grid &s", true)]
+    private static bool ValidateSnapSelectedGrid()
+    {
+        return Selection.activeTransform != null;
+    }
+
+
+    /// <summary>
+    /// Menu item to enable the grid for the selected transform.
+    /// </summary>
+    [MenuItem("Jam Tools/GhostGrid/Enable grid autosnap &a")]
+    private static void EnableGridAutosnap()
+    {
+        GhostGrid grid = Selection.activeTransform.GetComponentInParent<GhostGrid>();
+
+        if (grid != null)
+        {
+            grid.SnapAll();
             grid.autoSnapEnabled = true;
-            grid.SnapAll();

             Debug.Log("GhostGrid :: Grid enabled for selected transform!");
         }
@@ -106,29 +140,10 @@
     /// <summary>
     /// Disable the previous menu item if no transform is selected.
     /// </summary>
-    [MenuItem("Jam Tools/GhostGrid/Enable autosnap &a", true)]
-    private static bool ValidateLogSelectedTransformName()
+    [MenuItem("Jam Tools/GhostGrid/Enable grid autosnap &a", true)]
+    private static bool ValidateEnableGridAutosnap()
     {
         return Selection.activeTransform != null;
-    }
-
-
-    /// <summary>
-    /// Menu item to snap all to the grids.
-    /// Shortcut: Shift + S
-    /// </summary>
-    [MenuItem("Jam Tools/GhostGrid/Snap everything &s")]
-    private static void SnapEverything()
-    {
-        Debug.Log("GhostGrid :: Everything was snapped!");
-
-        if (brothers == null)
-            return;
-
-        for (int i = 0; i < brothers.Count; i++)
-        {
-            brothers[i].SnapAll();
-        }
     }


Added sweep to ExportDataEventArgs

Added sweep to ExportDataEventArgs

--- SpiceSharp/Simulations/ExportDataEventArgs.cs
+++ SpiceSharp/Simulations/ExportDataEventArgs.cs
@@ -56,6 +56,19 @@
                 if (_simulation is FrequencySimulation frequencySimulation && frequencySimulation.ComplexState != null)
                     return frequencySimulation.ComplexState.Laplace;
                 throw new CircuitException("Simulation {0} does not simulate in the complex plain".FormatString(_simulation));
+            }
+        }
+
+        /// <summary>
+        /// Gets the current sweep value if the simulation is a <see cref="Dc"/> analysis
+        /// </summary>
+        public double SweepValue
+        {
+            get
+            {
+                if (_simulation is Dc dc && dc.Sweeps.Count > 0)
+                    return dc.Sweeps[dc.Sweeps.Count - 1].CurrentValue;
+                throw new CircuitException("Simulation {0} is not a DC analysis".FormatString(_simulation));
             }
         }


Check for internet connection before performing an http request.

--- Src/Kit.Core45/Channels/Persistence/Sender.cs
+++ Src/Kit.Core45/Channels/Persistence/Sender.cs
@@ -10,8 +10,8 @@
     using System.Threading;
     using System.Threading.Tasks;
     using Extensibility.Implementation.Tracing;
-    using Services;
-
+    using Services;
+    using System.Net.NetworkInformation;
     /// <summary>
     /// Fetch transmissions from the storage and sends it.
     /// </summary>
@@ -217,13 +217,19 @@
         /// </summary>
         /// <param name="transmission">The transmission to send.</param>
         /// <param name="nextSendInterval">When this value returns it will hold a recommendation for when to start the next sending iteration.</param>
-        /// <returns>A boolean value that indicates if there was a retriable error.</returns>
+        /// <returns>True, if there was sent error and we need to retry sending, otherwise false.</returns>
         protected virtual bool Send(StorageTransmission transmission, ref TimeSpan nextSendInterval)
         {
             try
             {
                 if (transmission != null)
                 {
+                    bool isConnected = NetworkInterface.GetIsNetworkAvailable();
+
+                    // there is no internet connection available, return than.
+                    if (!isConnected)
+                        return true;
+
                     transmission.SendAsync().ConfigureAwait(false).GetAwaiter().GetResult();

                     // After a successful sending, try immeidiately to send another transmission.


[fix]桁の総和の取得メソッドで加算されない不具合の修正

[fix]桁の総和の取得メソッドで加算されない不具合の修正

--- Src/LoveWholeNumber/LoveWholeNumber/Class1.cs
+++ Src/LoveWholeNumber/LoveWholeNumber/Class1.cs
@@ -775,7 +775,7 @@
             while (n / divNum != 0)
             {
                 n /= divNum;
-                sum = n % 10;
+                sum += n % 10;
                 divNum *= 10;
             }


Amend InsertTransactions and RemoveTransaction

--- Stratis.Bitcoin/BlockStore/BlockRepository.cs
+++ Stratis.Bitcoin/BlockStore/BlockRepository.cs
@@ -255,7 +255,8 @@
                     var address = kv.Key;
                     var transactions = kv.Value;

-                    this.InsertTransactions(address, transactions);
+                    this.PerformanceCounter.AddRepositoryInsertCount(1);
+                    this.InsertAddressTransactions(address, transactions);
                 }

                 // Commit additions
@@ -449,7 +450,7 @@
             }
         }

-        private void InsertTransactions(uint160 addr, HashSet<uint256> list)
+        private void InsertAddressTransactions(uint160 addr, HashSet<uint256> list)
         {
             uint cnt = 0;
             var addrRow = this.session.Transaction.Select<byte[], byte[]>("Address", addr.ToBytes());
@@ -463,9 +464,9 @@
             }

             // Force the value to a power of 2 that will fit all the additional transaction hashes
-            if (addrRow.Value == null || (cnt + list.Count) > addrRow.Value.Length)
-            {
-                uint growCnt = 1;
+            if ((cnt + list.Count) >= 2 && (addrRow.Value == null || (sizeof(uint) + (cnt + list.Count) * 32) > addrRow.Value.Length))
+            {
+                uint growCnt = 2;
                 for (; growCnt < (cnt + list.Count); growCnt *= 2) { }
                 uint growSize = sizeof(uint) + growCnt * 32;
                 this.session.Transaction.InsertPart<byte[], byte[]>("Address", addr.ToBytes(), new byte[] { 0 /* Dummy */}, growSize - 1);
@@ -478,7 +479,7 @@
             // Update the number of transaction hashes
             var cntBytes = BitConverter.GetBytes(cnt);
             if (!BitConverter.IsLittleEndian) Array.Reverse(cntBytes);
-            this.PerformanceCounter.AddRepositoryInsertCount(1);
+
             this.session.Transaction.InsertPart<byte[], byte[]>("Address", addr.ToBytes(), cntBytes, 0);
         }

@@ -506,7 +507,7 @@

                 // Traverse in reverse order
                 int i = listBytes.Length - trxid.Length;
-                for (; i >= 0 && !found; i -= trxid.Length)
+                for (; i >= 0; i -= trxid.Length)
                 {
                     int j = 0;
                     // trxid found?
@@ -514,6 +515,7 @@
                         if (listBytes[i + j] != trxid[j])
                             break;
                     found = (j == trxid.Length);
+                    if (found) break;
                 }

                 // Transaction was not found


Fixed storing gitversion information

Fixed storing gitversion information

--- .build/buildData.cake
+++ .build/buildData.cake
@@ -53,11 +53,10 @@
       OutputType = GitVersionOutput.Json,
     });

-    using (var file = System.IO.File.OpenWrite(filePath))
-    using (var writer = System.Xml.XmlWriter.Create(file))
+    using (var file = System.IO.File.Create(filePath))
     {
       var serializer = new System.Xml.Serialization.XmlSerializer(typeof(GitVersion));
-      serializer.Serialize(writer, version);
+      serializer.Serialize(file, version);
     }
   }


Check if user input can correctly be parsed into int.

--- GameOfLife/Program.cs
+++ GameOfLife/Program.cs
@@ -148,28 +148,49 @@
     {
         static void Main(string[] args)
         {
-            var culture = new CultureInfo("");
+            int rows, columns, liveCells;
             Console.Write("Number of rows: ");
-            var rows = ((IConvertible)Console.ReadLine()).ToInt32(culture.NumberFormat);
+            var parseRows = Int32.TryParse(Console.ReadLine(), out rows);
             Console.Write("Number of columns: ");
-            var columns = ((IConvertible)Console.ReadLine()).ToInt32(culture.NumberFormat);
+            var parseColumns = Int32.TryParse(Console.ReadLine(), out columns);
             Console.Write("Initial number of live cells: ");
-            var liveCells = ((IConvertible)Console.ReadLine()).ToInt32(culture.NumberFormat);
+            var parseLiveCells = Int32.TryParse(Console.ReadLine(), out liveCells);

-            var world = new World(rows, columns);
-            world.Randomise(liveCells: liveCells);
-            var maxIterations = 100;
+            if (!parseRows)
+            {
+                Console.Write("ERROR! Number of rows needs to be an integer.");
+                Console.ReadKey();
+                return;
+            }
+            else if (!parseColumns)
+            {
+                Console.Write("ERROR! Number of columns needs to be an integer.");
+                Console.ReadKey();
+                return;
+            }
+            else if (!parseLiveCells)
+            {
+                Console.Write("ERROR! Initial number of live cells needs to be an integer.");
+                Console.ReadKey();
+                return;
+            }
+            else
+            {
+                var world = new World(rows, columns);
+                world.Randomise(liveCells: liveCells);
+                var maxIterations = 100;

-            for (int i = 0; i < maxIterations; i++)
-            {
-                Console.Clear();
-                Console.Write(world);
-                if (world.Evolve())
-                    break;
-                Thread.Sleep(1000);
+                for (int i = 0; i < maxIterations; i++)
+                {
+                    Console.Clear();
+                    Console.Write(world);
+                    if (world.Evolve())
+                        break;
+                    Thread.Sleep(1000);
+                }
+                Console.WriteLine("\nSimulation finished.");
+                Console.ReadKey();
             }
-            Console.WriteLine("\nSimulation finished.");
-            Console.ReadKey();
         }
     }
 }


Default scheme switcher added;

Default scheme switcher added;

--- Editor/MenuItems.cs
+++ Editor/MenuItems.cs
@@ -19,5 +19,10 @@
 		static void Scheme() {
 			SchemesTool.UpdateSchemes();
 		}
+
+		[MenuItem("UDBase/Schemes/Default")]
+		static void SwitchToScheme_Default() {
+			SchemesTool.SwitchScheme("Default");
+		}
 	}
 }


Avoid finalise crash on 2k8 by setting HOMEPATH and HOMEDRIVE environment variables explicitly.

Should also mean we never pick up a users git settings by mistake.

--- Ensconce/Program.cs
+++ Ensconce/Program.cs
@@ -59,6 +59,10 @@

         private static void MainLogic(string[] args)
         {
+            // Set up some environment variables required on 2k8 servers: as a bonus, ensure NGit doesn't find any actual users settings...
+            Environment.SetEnvironmentVariable("HOMEDRIVE", Path.GetPathRoot(Directory.GetCurrentDirectory()));
+            Environment.SetEnvironmentVariable("HOMEPATH", Directory.GetCurrentDirectory());
+
             SetUpAndParseOptions(args);

             if (readFromStdIn)


[Modify] Polish it

[Modify] Polish it

--- Example/Notifier.cs
+++ Example/Notifier.cs
@@ -26,6 +26,7 @@
         state => {
           while (_enabled || Count > 0) {
             var msg = dequeue ();
+
             if (msg != null) {
 #if UBUNTU
               var nf = new Notification (msg.Summary, msg.Body, msg.Icon);


Freelancer's Guild was also only added in AB as a map object

--- H3Mapper/MapReader.cs
+++ H3Mapper/MapReader.cs
@@ -301,6 +301,10 @@
                         break;
                     case ObjectId.Building2:
                         mo = new MapObject<Building2Type>(template.SubId);
+                        break;
+                    case ObjectId.FreelancersGuild:
+                        RequireVersionAtLeast(info, MapFormat.AB);
+                        mo = new MapObject();
                         break;
                     default:
                         mo = new MapObject();


Function "fakulty" is working

Function "fakulty" is working

git-svn-id: a19970c34a6d245b7676a95e088c32601af4e48b@4563 c0adb3ac-85ad-b347-9a16-a660ac379d24

--- Helper/SimpleCache.cs
+++ Helper/SimpleCache.cs
@@ -48,5 +48,7 @@
             _isValid = false;
             _isBusy = false;
         }
+
+        public bool IsValid { get { return _isValid; } }
     }
 }


Update UndoFactory.cs

Update UndoFactory.cs

Add null checks when adding actions.

--- Helper/UndoFactory.cs
+++ Helper/UndoFactory.cs
@@ -52,6 +52,16 @@

         public void Add(Action undo, Action redo)
         {
+            if (undo == null)
+            {
+                throw new ArgumentNullException(nameof(undo));
+            }
+
+            if (redo == null)
+            {
+                throw new ArgumentNullException(nameof(redo));
+            }
+
             if (Index < Count)
             {
                 History.RemoveRange(Index, Count - Index);


Revert "Prep pre 3.0 upgrade demo"

Revert "Prep pre 3.0 upgrade demo"

This reverts commit eecb106678b75ce18e4c6865e7c91f2f508491fb.

--- Recipe.Xunit/RecipeTests.cs
+++ Recipe.Xunit/RecipeTests.cs
@@ -152,8 +152,8 @@
                            {
                                r.Title,
                                Categories = r.RecipeCategories.Select(rc => rc.Category.Description).ToList(),
-                               Ingredients = r.Ingredients.OrderBy(i => i.SortOrder),
-                               Directions = r.Directions.OrderBy(d => d.LineNumber).Select(d => d.Description)
+                               Ingredients = r.Ingredients.OrderBy(i => i.SortOrder).ToList(),
+                               Directions = r.Directions.OrderBy(d => d.LineNumber).Select(d => d.Description).ToList()
                            };

             foreach (var recipe in salmon.Take(50).ToList())


Add demo for lack of lazy loading

Add demo for lack of lazy loading

--- Recipe.Xunit/RecipeTests.cs
+++ Recipe.Xunit/RecipeTests.cs
@@ -10,171 +10,176 @@

 namespace Recipe.Xunit
 {
-        public class RecipeTests
+    public class RecipeTests
+    {
+        private readonly ITestOutputHelper output;
+        private RecipeContext dc = RecipeContext.RecipeContextFactory();
+
+        public RecipeTests(ITestOutputHelper output)
         {
-            private readonly ITestOutputHelper output;
-            private RecipeContext dc = RecipeContext.RecipeContextFactory();
+            this.output = output;
+        }

-            public RecipeTests(ITestOutputHelper output)
+        [Fact]
+        public void Recipe_Load()
+        {
+            var items = dc.Recipes.Take(5);
+            Assert.True(items.Any());
+            foreach (var recipe in items)
             {
-                this.output = output;
+                output.WriteLine(recipe.Title);
+                foreach (var ingredient in recipe.Ingredients)
+                {
+                    output.WriteLine($"{ingredient.Units} {ingredient.UnitType} - {ingredient.Description}");
+                }
+                output.WriteLine("-----");
             }
+        }

-            [Fact]
-            public void Recipe_Load()
+        [Fact]
+        public void Category_Create()
+        {
+            var newCategory = new Category { Description = $"Test {DateTime.Now.Ticks}" };
+            dc.Categories.Add(newCategory);
+            dc.SaveChanges();
+            Assert.True(newCategory.Id > 0);
+
+            // Cleanup
+            dc.Categories.Remove(newCategory);
+            dc.SaveChanges();
+        }
+
+        [Fact]
+        public async Task Recipe_CanCreateBatch()
+        {
+            var recipe = new Recipe.Dal.Models.Recipe
             {
-                var items = dc.Recipes.Take(5);
-                Assert.True(items.Any());
-                foreach (var recipe in items)
+                Title = "Add Test",
+                ServingMeasure = "Bites",
+                ServingQuantity = 42
+            };
+            dc.Recipes.Add(recipe);
+            for (int i = 0; i < 10; i++)
+            {
+                recipe.Ingredients.Add(new Ingredient { Description = $"Ing {i}", SortOrder = i, Units = i.ToString(), UnitType = "pn" });
+                recipe.Directions.Add(new Direction { Description = $"Step {i} - Stir", LineNumber = i });
+            }
+            await dc.SaveChangesAsync();
+            Assert.True(recipe.Id > 0);
+
+            // Cleanup
+            dc.Ingredients.RemoveRange(recipe.Ingredients);
+            dc.Directions.RemoveRange(recipe.Directions);
+            dc.Recipes.Remove(recipe);
+            await dc.SaveChangesAsync();
+        }
+        [Fact]
+        public async Task StoredProcs()
+        {
+            var brownies = await dc.SearchRecipeAsync("Brownie");
+            Assert.NotEqual(0, brownies.Count());
+        }
+        [Fact]
+        public async Task StoredProcs_CanExtend()
+        {
+            // Note, this version lies because stored procs aren't extendable
+            // so the additional query portions are done client side.
+            var brownies = await dc.SearchRecipeOrderedAsync("Brownie");
+            Assert.True(brownies.Any());
+        }
+
+        [Fact]
+        public void Recipe_EagerLoading()
+        {
+            var brownies = from r in dc.Recipes
+                                .Include(rec => rec.RecipeCategories).ThenInclude(rc => rc.Category)
+                                .Include(rec => rec.Ingredients)
+                                .Include(rec => rec.Directions)
+                           where r.Title.Contains("brownie")
+                           select r;
+
+            foreach (var recipe in brownies.Take(5).ToList())
+            {
+                output.WriteLine(recipe.Title);
+                output.WriteLine($"    Category: " + recipe.RecipeCategories.FirstOrDefault()?.Category?.Description);
+
+                foreach (var ingredient in recipe.Ingredients.OrderBy(i => i.SortOrder))
                 {
-                    output.WriteLine(recipe.Title);
+                    output.WriteLine($"{ingredient.Units} {ingredient.UnitType}: {ingredient.Description}");
+                }
+
+                foreach (var directionLine in recipe.Directions.OrderBy(d => d.LineNumber))
+                {
+                    output.WriteLine(directionLine.Description);
                 }
             }
+        }

-            [Fact]
-            public void Category_Create()
+        [Fact]
+        public void Recipe_Projections()
+        {
+            var brownies = from r in dc.Recipes
+                           where r.Title.Contains("Brownie")
+                           select new
+                           {
+                               r.Title,
+                               Categories = r.RecipeCategories.Select(rc => rc.Category.Description),
+                               Ingredients = r.Ingredients.OrderBy(i => i.SortOrder),
+                               Directions = r.Directions.OrderBy(d => d.LineNumber).Select(d => d.Description)
+                           };
+
+            foreach (var recipe in brownies.Take(5).ToList())
             {
-                var newCategory = new Category { Description = $"Test {DateTime.Now.Ticks}" };
-                dc.Categories.Add(newCategory);
-                dc.SaveChanges();
-                Assert.True(newCategory.Id > 0);
+                output.WriteLine(recipe.Title);
+                foreach (var category in recipe.Categories)
+                {
+                    output.WriteLine($"    Category: " + category);
+                }

-                // Cleanup
-                dc.Categories.Remove(newCategory);
-                dc.SaveChanges();
-            }
+                foreach (var ingredient in recipe.Ingredients)
+                {
+                    output.WriteLine($"{ingredient.Units} {ingredient.UnitType}: {ingredient.Description}");
+                }

-            [Fact]
-            public async Task Recipe_CanCreateBatch()
-            {
-                var recipe = new Recipe.Dal.Models.Recipe
+                foreach (var directionLine in recipe.Directions)
                 {
-                    Title = "Add Test",
-                    ServingMeasure = "Bites",
-                    ServingQuantity = 42
-                };
-                dc.Recipes.Add(recipe);
-                for (int i = 0; i < 10; i++)
-                {
-                    recipe.Ingredients.Add(new Ingredient { Description = $"Ing {i}", SortOrder = i, Units = i.ToString(), UnitType = "pn" });
-                    recipe.Directions.Add(new Direction { Description = $"Step {i} - Stir", LineNumber = i });
-                }
-                await dc.SaveChangesAsync();
-                Assert.True(recipe.Id > 0);
-
-                // Cleanup
-                dc.Ingredients.RemoveRange(recipe.Ingredients);
-                dc.Directions.RemoveRange(recipe.Directions);
-                dc.Recipes.Remove(recipe);
-                await dc.SaveChangesAsync();
-            }
-            [Fact]
-            public async Task StoredProcs()
-            {
-                var brownies = await dc.SearchRecipeAsync("Brownie");
-                Assert.NotEqual(0, brownies.Count());
-            }
-            [Fact]
-            public async Task StoredProcs_CanExtend()
-            {
-                // Note, this version lies because stored procs aren't extendable
-                // so the additional query portions are done client side.
-                var brownies = await dc.SearchRecipeOrderedAsync("Brownie");
-                Assert.True(brownies.Any());
-            }
-
-            [Fact]
-            public void Recipe_EagerLoading()
-            {
-                var brownies = from r in dc.Recipes
-                                    .Include(rec => rec.RecipeCategories).ThenInclude(rc => rc.Category)
-                                    .Include(rec => rec.Ingredients)
-                                    .Include(rec => rec.Directions)
-                               where r.Title.Contains("brownie")
-                               select r;
-
-                foreach (var recipe in brownies.Take(5).ToList())
-                {
-                    output.WriteLine(recipe.Title);
-                    output.WriteLine($"    Category: " + recipe.RecipeCategories.FirstOrDefault()?.Category?.Description);
-
-                    foreach (var ingredient in recipe.Ingredients.OrderBy(i => i.SortOrder))
-                    {
-                        output.WriteLine($"{ingredient.Units} {ingredient.UnitType}: {ingredient.Description}");
-                    }
-
-                    foreach (var directionLine in recipe.Directions.OrderBy(d => d.LineNumber))
-                    {
-                        output.WriteLine(directionLine.Description);
-                    }
+                    output.WriteLine(directionLine);
                 }
             }
+        }

-            [Fact]
-            public void Recipe_Projections()
+        [Fact]
+        public void Recipe_WithoutNavigationProperties()
+        {
+            var brownies = from r in dc.Recipes
+                           where r.Title.Contains("Brownie")
+                           select new
+                           {
+                               r.Title,
+                               Categories = dc.RecipeCategory.Where(rc => rc.RecipeId == r.Id).Select(rc => rc.Category.Description),
+                               Ingredients = dc.Ingredients.Where(i => i.RecipeId == r.Id).OrderBy(i => i.SortOrder),
+                               Directions = dc.Directions.Where(d => d.RecipeId == r.Id).OrderBy(d => d.LineNumber).Select(d => d.Description)
+                           };
+
+            foreach (var recipe in brownies.Take(5).ToList())
             {
-                var brownies = from r in dc.Recipes
-                               where r.Title.Contains("Brownie")
-                               select new
-                               {
-                                   r.Title,
-                                   Categories = r.RecipeCategories.Select(rc => rc.Category.Description),
-                                   Ingredients = r.Ingredients.OrderBy(i => i.SortOrder),
-                                   Directions = r.Directions.OrderBy(d => d.LineNumber).Select(d => d.Description)
-                               };
+                output.WriteLine(recipe.Title);
+                foreach (var category in recipe.Categories)
+                {
+                    output.WriteLine($"    Category: " + category);
+                }

-                foreach (var recipe in brownies.Take(5).ToList())
+                foreach (var ingredient in recipe.Ingredients)
                 {
-                    output.WriteLine(recipe.Title);
-                    foreach (var category in recipe.Categories)
-                    {
-                        output.WriteLine($"    Category: " + category);
-                    }
+                    output.WriteLine($"{ingredient.Units} {ingredient.UnitType}: {ingredient.Description}");
+                }

-                    foreach (var ingredient in recipe.Ingredients)
-                    {
-                        output.WriteLine($"{ingredient.Units} {ingredient.UnitType}: {ingredient.Description}");
-                    }
-
-                    foreach (var directionLine in recipe.Directions)
-                    {
-                        output.WriteLine(directionLine);
-                    }
+                foreach (var directionLine in recipe.Directions)
+                {
+                    output.WriteLine(directionLine);
                 }
             }
+        }

-            //[Fact]
-            public void Recipe_WithoutNavigationProperties()
-            {
-                var brownies = from r in dc.Recipes
-                               where r.Title.Contains("Brownie")
-                               select new
-                               {
-                                   r.Title,
-                                   Categories = dc.RecipeCategory.Where(rc => rc.RecipeId == r.Id).Select(rc => rc.Category.Description),
-                                   Ingredients = dc.Ingredients.Where(i => i.RecipeId == r.Id).OrderBy(i => i.SortOrder),
-                                   Directions = dc.Directions.Where(d => d.RecipeId == r.Id).OrderBy(d => d.LineNumber).Select(d => d.Description)
-                               };
-
-                foreach (var recipe in brownies.Take(5).ToList())
-                {
-                    output.WriteLine(recipe.Title);
-                    foreach (var category in recipe.Categories)
-                    {
-                        output.WriteLine($"    Category: " + category);
-                    }
-
-                    foreach (var ingredient in recipe.Ingredients)
-                    {
-                        output.WriteLine($"{ingredient.Units} {ingredient.UnitType}: {ingredient.Description}");
-                    }
-
-                    foreach (var directionLine in recipe.Directions)
-                    {
-                        output.WriteLine(directionLine);
-                    }
-                }
-            }
-
-        }
     }
+}


Camel case formatter

Camel case formatter

--- MinaGlosor.Web/App_Start/WebApiConfig.cs
+++ MinaGlosor.Web/App_Start/WebApiConfig.cs
@@ -1,4 +1,5 @@
 using System.Web.Http;
+using Newtonsoft.Json.Serialization;

 namespace MinaGlosor.Web.App_Start
 {
@@ -9,8 +10,11 @@
             config.Routes.MapHttpRoute(
                 name: "DefaultApi",
                 routeTemplate: "api/{controller}/{id}",
-                defaults: new { id = RouteParameter.Optional }
-            );
+                defaults: new { id = RouteParameter.Optional });
+
+            // camelCase by default
+            var formatter = config.Formatters.JsonFormatter;
+            formatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
         }
     }
 }


added bain archive handling

added bain archive handling

--- ModAnalyzer/Domain/ModAnalyzerService.cs
+++ ModAnalyzer/Domain/ModAnalyzerService.cs
@@ -7,6 +7,7 @@
 using System.ComponentModel;
 using System.IO;
 using System.Linq;
+using System.Windows.Forms;

 namespace ModAnalyzer.Domain {
     public class ModAnalyzerService {
@@ -16,6 +17,11 @@
         private ModAnalysis _modAnalysis;
         private List<EntryAnalysisJob> entryAnalysisJobs;
         private readonly string[] entryJobExtensions = { ".BA2", ".BSA", ".ESP", ".ESM" };
+        private readonly string[] dataDirectories = {
+            "distantlod", "facegen", "fonts", "interface", "menus", "meshes", "music", "scripts", "shaders", "sound", "strings",
+            "textures", "trees", "video", "skse", "obse", "nvse", "fose", "asi", "SkyProc Patchers", "Docs", "INI Tweaks"
+        };
+        private readonly string[] dataExtensions = { ".BA2", ".BSA", ".ESP", ".ESM" };

         public event EventHandler<MessageReportedEventArgs> MessageReported;

@@ -119,16 +125,119 @@
                 fomodOptions.ForEach(mo => { mo.MD5Hash = modOption.MD5Hash; });
                 _modAnalysis.ModOptions.Add(modOption);
                 _modAnalysis.ModOptions.AddRange(fomodOptions);
+            } else if (IsBainArchive(archive)) {
+                List<ModOption> bainOptions = AnalyzeBainArchive(archive);
+                bainOptions.ForEach(mo => { mo.MD5Hash = modOption.MD5Hash; });
+                _modAnalysis.ModOptions.Add(modOption);
+                _modAnalysis.ModOptions.AddRange(bainOptions);
             } else {
                 AnalyzeNormalArchive(archive, modOption);
             }
         }

+        private int GetLevel(string path) {
+            return path.Split('\\').Length;
+        }
+
+        private List<string> GetArchiveEntryPaths(IArchive archive) {
+            return archive.Entries.Select(x => x.GetEntryPath()).ToList();
+        }
+
+        private List<string> GetArchiveDirectories(IArchive archive) {
+            HashSet<string> directories = new HashSet<string>();
+            List<string> entryPaths = GetArchiveEntryPaths(archive);
+            entryPaths.ForEach(x => {
+                string path = Path.GetDirectoryName(x);
+                while (path != "") {
+                    directories.Add(path);
+                    path = Path.GetDirectoryName(path);
+                }
+            });
+            return directories.ToList();
+        }
+
+        private List<string> GetTopLevelDirectories(IArchive archive) {
+            List<string> topLevelDirectories = new List<string>();
+            foreach (string dirPath in GetArchiveDirectories(archive)) {
+                if (GetLevel(dirPath) == 1) {
+                    topLevelDirectories.Add(dirPath);
+                }
+            }
+            return topLevelDirectories;
+        }
+
+        private List<string> GetImmediateChildren(IArchive archive, string path, bool targetDirectories) {
+            List<string> children = new List<string>();
+            int targetLevel = GetLevel(path) + 1;
+            List<string> searchPaths = targetDirectories ? GetArchiveDirectories(archive) : GetArchiveEntryPaths(archive);
+            foreach (string searchPath in searchPaths) {
+                if (searchPath.StartsWith(path) && GetLevel(searchPath) == targetLevel) {
+                    children.Add(searchPath);
+                }
+            }
+            return children;
+        }
+
+        private bool IsValidDataDirectory(IArchive archive, string directory) {
+            List<string> childrenDirectories = GetImmediateChildren(archive, directory, true);
+            foreach (string childDirectory in childrenDirectories) {
+                if (dataDirectories.Contains(Path.GetFileName(childDirectory))) {
+                    return true;
+                }
+            }
+
+            List<string> childrenFiles = GetImmediateChildren(archive, directory, false);
+            foreach (string childFile in childrenFiles) {
+                if (dataExtensions.Contains(Path.GetExtension(childFile), StringComparer.OrdinalIgnoreCase)) {
+                    return true;
+                }
+            }
+
+            return false;
+        }
+
+        private bool ResolveBain(IArchive archive, int validDirectories, int invalidDirectories) {
+            if (validDirectories < 2) {
+                return false;
+            } else if (invalidDirectories == 0) {
+                return true;
+            } else {
+                string message = "This archive looks like it may be a BAIN installer.  Analyze as a BAIN installer?";
+                return MessageBox.Show(message, "Is this a BAIN installer?", MessageBoxButtons.YesNo) == DialogResult.Yes;
+            }
+        }
+
+        private bool SkipBainDirectory(string dirName) {
+            return dirName == "fomod" || dirName == "omod conversion data" || dirName.StartsWith("--");
+        }
+
+        private bool IsBainArchive(IArchive archive) {
+            int validDirectories = 0;
+            int invalidDirectories = 0;
+            foreach (string topLevelDirectory in GetTopLevelDirectories(archive)) {
+                if (SkipBainDirectory(topLevelDirectory)) continue;
+                if (IsValidDataDirectory(archive, topLevelDirectory)) {
+                    validDirectories++;
+                } else {
+                    invalidDirectories++;
+                }
+            }
+
+            return ResolveBain(archive, validDirectories, invalidDirectories);
+        }
+
+        private List<string> GetValidBainDirectories(IArchive archive) {
+            List<string> topLevelDirectories = GetTopLevelDirectories(archive);
+            return topLevelDirectories.FindAll(d => {
+                return !SkipBainDirectory(Path.GetFileName(d)) && IsValidDataDirectory(archive, d);
+            });
+        }
+
         private bool IsFomodArchive(IArchive archive) {
             return FindArchiveEntry(archive, "fomod/ModuleConfig.xml") != null;
         }

-        private void MapEntryToOptionAssets(List<Tuple<FomodFile, ModOption>> map, IArchiveEntry entry, string fomodBasePath) {
+        private void MapEntryToFomodOption(List<Tuple<FomodFile, ModOption>> map, IArchiveEntry entry, string fomodBasePath) {
             string entryPath = entry.GetEntryPath();
             if (fomodBasePath.Length > 0) {
                 entryPath = entryPath.Replace(fomodBasePath, "");
@@ -139,6 +248,24 @@

                 if (fileNode.MatchesPath(entryPath)) {
                     string mappedPath = fileNode.MappedPath(entryPath);
+                    option.Assets.Add(mappedPath);
+                    option.Size += entry.Size;
+                    _backgroundWorker.ReportMessage("  " + option.Name + " -> " + mappedPath, false);
+
+                    // enqueue jobs for analyzing archives and plugins
+                    EnqueueAnalysisJob(entry, option);
+                }
+            }
+        }
+
+        private void MapEntryToBainOption(List<Tuple<string, ModOption>> map, IArchiveEntry entry) {
+            string entryPath = entry.GetEntryPath();
+            foreach (Tuple<string, ModOption> mapping in map) {
+                string bainPath = mapping.Item1;
+                ModOption option = mapping.Item2;
+
+                if (entryPath.StartsWith(bainPath)) {
+                    string mappedPath = entryPath.Replace(bainPath + "\\", "");
                     option.Assets.Add(mappedPath);
                     option.Size += entry.Size;
                     _backgroundWorker.ReportMessage("  " + option.Name + " -> " + mappedPath, false);
@@ -159,6 +286,30 @@
             }
         }

+        private List<ModOption> AnalyzeBainArchive(IArchive archive) {
+            _backgroundWorker.ReportMessage("Parsing BAIN Options", true);
+            List<ModOption> bainOptions = new List<ModOption>();
+            List<Tuple<string, ModOption>> bainMap = new List<Tuple<string, ModOption>>();
+
+            // STEP 1. Find BAIN directories and build mod options for them
+            foreach (string bainDirectory in GetValidBainDirectories(archive)) {
+                _backgroundWorker.ReportMessage("Found BAIN Option " + bainDirectory, false);
+                ModOption bainOption = new ModOption(bainDirectory, false, true);
+                bainMap.Add(new Tuple<string, ModOption>(bainDirectory, bainOption));
+                bainOptions.Add(bainOption);
+            }
+
+            // STEP 2: Map entries to bain options
+            _backgroundWorker.ReportMessage(Environment.NewLine + "Mapping assets to BAIN Options", true);
+            foreach (IArchiveEntry entry in archive.Entries) {
+                MapEntryToBainOption(bainMap, entry);
+            }
+
+            // Return the mod options we built
+            _backgroundWorker.ReportMessage("Done.  " + bainOptions.Count + " BAIN Options found.", true);
+            return bainOptions.OrderBy(x => x.Name).ToList();
+        }
+
         private List<ModOption> AnalyzeFomodArchive(IArchive archive) {
             _backgroundWorker.ReportMessage("Parsing FOMOD Options", true);
             List<ModOption> fomodOptions = new List<ModOption>();
@@ -179,7 +330,7 @@
             // STEP 3: Loop through the archive's assets appending them to mod options per mapping
             _backgroundWorker.ReportMessage(Environment.NewLine + "Mapping assets to FOMOD Options", true);
             foreach (IArchiveEntry entry in archive.Entries) {
-                MapEntryToOptionAssets(fomodConfig.FileMap, entry, fomodBasePath);
+                MapEntryToFomodOption(fomodConfig.FileMap, entry, fomodBasePath);
             }

             // STEP 4: Delete any options that have no assets or plugins in them