Added template sessions to Seeding.

Added template sessions to Seeding.

--- QDMSServer/Utils/Seed.cs
+++ QDMSServer/Utils/Seed.cs
@@ -4,6 +4,8 @@
 // </copyright>
 // -----------------------------------------------------------------------

+using System;
+using System.Linq;
 using System.Data.Entity.Migrations;
 using EntityData;
 using QDMS;
@@ -161,10 +163,446 @@
             {
                 context.SessionTemplates.AddOrUpdate(x => x.Name, s);
             }
+
+
             #endregion

             #region templatesessions
-
+            var templatesessions = new[]
+            {
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(9, 30, 0),
+                    ClosingTime = new TimeSpan(16, 0, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Monday,
+                    ClosingDay = DayOfTheWeek.Monday,
+                    Template = sessiontemplates.First(x => x.Name == "U.S. Equities RTH")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(9, 30, 0),
+                    ClosingTime = new TimeSpan(16, 0, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Tuesday,
+                    ClosingDay = DayOfTheWeek.Tuesday,
+                    Template = sessiontemplates.First(x => x.Name == "U.S. Equities RTH")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(9, 30, 0),
+                    ClosingTime = new TimeSpan(16, 0, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Wednesday,
+                    ClosingDay = DayOfTheWeek.Wednesday,
+                    Template = sessiontemplates.First(x => x.Name == "U.S. Equities RTH")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(9, 30, 0),
+                    ClosingTime = new TimeSpan(16, 0, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Thursday,
+                    ClosingDay = DayOfTheWeek.Thursday,
+                    Template = sessiontemplates.First(x => x.Name == "U.S. Equities RTH")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(9, 30, 0),
+                    ClosingTime = new TimeSpan(16, 0, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Friday,
+                    ClosingDay = DayOfTheWeek.Friday,
+                    Template = sessiontemplates.First(x => x.Name == "U.S. Equities RTH")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(9, 30, 0),
+                    ClosingTime = new TimeSpan(20, 0, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Monday,
+                    ClosingDay = DayOfTheWeek.Monday,
+                    Template = sessiontemplates.First(x => x.Name == "U.S. Equities (w/ Post)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(9, 30, 0),
+                    ClosingTime = new TimeSpan(20, 0, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Tuesday,
+                    ClosingDay = DayOfTheWeek.Tuesday,
+                    Template = sessiontemplates.First(x => x.Name == "U.S. Equities (w/ Post)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(9, 30, 0),
+                    ClosingTime = new TimeSpan(20, 0, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Wednesday,
+                    ClosingDay = DayOfTheWeek.Wednesday,
+                    Template = sessiontemplates.First(x => x.Name == "U.S. Equities (w/ Post)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(9, 30, 0),
+                    ClosingTime = new TimeSpan(20, 0, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Thursday,
+                    ClosingDay = DayOfTheWeek.Thursday,
+                    Template = sessiontemplates.First(x => x.Name == "U.S. Equities (w/ Post)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(9, 30, 0),
+                    ClosingTime = new TimeSpan(20, 0, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Friday,
+                    ClosingDay = DayOfTheWeek.Friday,
+                    Template = sessiontemplates.First(x => x.Name == "U.S. Equities (w/ Post)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(8, 0, 0),
+                    ClosingTime = new TimeSpan(16, 0, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Monday,
+                    ClosingDay = DayOfTheWeek.Monday,
+                    Template = sessiontemplates.First(x => x.Name == "U.S. Equities (w/ Pre)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(8, 0, 0),
+                    ClosingTime = new TimeSpan(16, 0, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Tuesday,
+                    ClosingDay = DayOfTheWeek.Tuesday,
+                    Template = sessiontemplates.First(x => x.Name == "U.S. Equities (w/ Pre)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(8, 0, 0),
+                    ClosingTime = new TimeSpan(16, 0, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Wednesday,
+                    ClosingDay = DayOfTheWeek.Wednesday,
+                    Template = sessiontemplates.First(x => x.Name == "U.S. Equities (w/ Pre)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(8, 0, 0),
+                    ClosingTime = new TimeSpan(16, 0, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Thursday,
+                    ClosingDay = DayOfTheWeek.Thursday,
+                    Template = sessiontemplates.First(x => x.Name == "U.S. Equities (w/ Pre)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(8, 0, 0),
+                    ClosingTime = new TimeSpan(16, 0, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Friday,
+                    ClosingDay = DayOfTheWeek.Friday,
+                    Template = sessiontemplates.First(x => x.Name == "U.S. Equities (w/ Pre)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(8, 0, 0),
+                    ClosingTime = new TimeSpan(20, 0, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Monday,
+                    ClosingDay = DayOfTheWeek.Monday,
+                    Template = sessiontemplates.First(x => x.Name == "U.S. Equities (w/ Pre & Post)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(8, 0, 0),
+                    ClosingTime = new TimeSpan(20, 0, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Tuesday,
+                    ClosingDay = DayOfTheWeek.Tuesday,
+                    Template = sessiontemplates.First(x => x.Name == "U.S. Equities (w/ Pre & Post)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(8, 0, 0),
+                    ClosingTime = new TimeSpan(20, 0, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Wednesday,
+                    ClosingDay = DayOfTheWeek.Wednesday,
+                    Template = sessiontemplates.First(x => x.Name == "U.S. Equities (w/ Pre & Post)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(8, 0, 0),
+                    ClosingTime = new TimeSpan(20, 0, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Thursday,
+                    ClosingDay = DayOfTheWeek.Thursday,
+                    Template = sessiontemplates.First(x => x.Name == "U.S. Equities (w/ Pre & Post)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(8, 0, 0),
+                    ClosingTime = new TimeSpan(20, 0, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Friday,
+                    ClosingDay = DayOfTheWeek.Friday,
+                    Template = sessiontemplates.First(x => x.Name == "U.S. Equities (w/ Pre & Post)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(15, 30, 0),
+                    ClosingTime = new TimeSpan(16, 30, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Monday,
+                    ClosingDay = DayOfTheWeek.Monday,
+                    Template = sessiontemplates.First(x => x.Name == "CME: Equity Index Futures (GLOBEX)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(17, 0, 0),
+                    ClosingTime = new TimeSpan(8, 15, 0),
+                    IsSessionEnd = false,
+                    OpeningDay = DayOfTheWeek.Monday,
+                    ClosingDay = DayOfTheWeek.Tuesday,
+                    Template = sessiontemplates.First(x => x.Name == "CME: Equity Index Futures (GLOBEX)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(15, 30, 0),
+                    ClosingTime = new TimeSpan(16, 30, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Tuesday,
+                    ClosingDay = DayOfTheWeek.Tuesday,
+                    Template = sessiontemplates.First(x => x.Name == "CME: Equity Index Futures (GLOBEX)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(17, 0, 0),
+                    ClosingTime = new TimeSpan(8, 15, 0),
+                    IsSessionEnd = false,
+                    OpeningDay = DayOfTheWeek.Tuesday,
+                    ClosingDay = DayOfTheWeek.Wednesday,
+                    Template = sessiontemplates.First(x => x.Name == "CME: Equity Index Futures (GLOBEX)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(15, 30, 0),
+                    ClosingTime = new TimeSpan(16, 30, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Wednesday,
+                    ClosingDay = DayOfTheWeek.Wednesday,
+                    Template = sessiontemplates.First(x => x.Name == "CME: Equity Index Futures (GLOBEX)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(17, 0, 0),
+                    ClosingTime = new TimeSpan(8, 15, 0),
+                    IsSessionEnd = false,
+                    OpeningDay = DayOfTheWeek.Wednesday,
+                    ClosingDay = DayOfTheWeek.Thursday,
+                    Template = sessiontemplates.First(x => x.Name == "CME: Equity Index Futures (GLOBEX)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(15, 30, 0),
+                    ClosingTime = new TimeSpan(16, 30, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Thursday,
+                    ClosingDay = DayOfTheWeek.Thursday,
+                    Template = sessiontemplates.First(x => x.Name == "CME: Equity Index Futures (GLOBEX)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(17, 0, 0),
+                    ClosingTime = new TimeSpan(8, 15, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Thursday,
+                    ClosingDay = DayOfTheWeek.Friday,
+                    Template = sessiontemplates.First(x => x.Name == "CME: Equity Index Futures (GLOBEX)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(17, 0, 0),
+                    ClosingTime = new TimeSpan(8, 15, 0),
+                    IsSessionEnd = false,
+                    OpeningDay = DayOfTheWeek.Sunday,
+                    ClosingDay = DayOfTheWeek.Monday,
+                    Template = sessiontemplates.First(x => x.Name == "CME: Equity Index Futures (GLOBEX)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(8, 30, 0),
+                    ClosingTime = new TimeSpan(15, 15, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Monday,
+                    ClosingDay = DayOfTheWeek.Monday,
+                    Template = sessiontemplates.First(x => x.Name == "CME: Equity Index Futures (Open Outcry)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(8, 30, 0),
+                    ClosingTime = new TimeSpan(15, 15, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Tuesday,
+                    ClosingDay = DayOfTheWeek.Tuesday,
+                    Template = sessiontemplates.First(x => x.Name == "CME: Equity Index Futures (Open Outcry)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(8, 30, 0),
+                    ClosingTime = new TimeSpan(15, 15, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Wednesday,
+                    ClosingDay = DayOfTheWeek.Wednesday,
+                    Template = sessiontemplates.First(x => x.Name == "CME: Equity Index Futures (Open Outcry)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(8, 30, 0),
+                    ClosingTime = new TimeSpan(15, 15, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Thursday,
+                    ClosingDay = DayOfTheWeek.Thursday,
+                    Template = sessiontemplates.First(x => x.Name == "CME: Equity Index Futures (Open Outcry)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(8, 30, 0),
+                    ClosingTime = new TimeSpan(15, 15, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Friday,
+                    ClosingDay = DayOfTheWeek.Friday,
+                    Template = sessiontemplates.First(x => x.Name == "CME: Equity Index Futures (Open Outcry)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(15, 30, 0),
+                    ClosingTime = new TimeSpan(16, 30, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Monday,
+                    ClosingDay = DayOfTheWeek.Monday,
+                    Template = sessiontemplates.First(x => x.Name == "CME: Equity Index Futures [E-Mini] (GLOBEX)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(17, 0, 0),
+                    ClosingTime = new TimeSpan(15, 15, 0),
+                    IsSessionEnd = false,
+                    OpeningDay = DayOfTheWeek.Monday,
+                    ClosingDay = DayOfTheWeek.Tuesday,
+                    Template = sessiontemplates.First(x => x.Name == "CME: Equity Index Futures [E-Mini] (GLOBEX)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(15, 30, 0),
+                    ClosingTime = new TimeSpan(16, 30, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Tuesday,
+                    ClosingDay = DayOfTheWeek.Tuesday,
+                    Template = sessiontemplates.First(x => x.Name == "CME: Equity Index Futures [E-Mini] (GLOBEX)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(17, 0, 0),
+                    ClosingTime = new TimeSpan(15, 15, 0),
+                    IsSessionEnd = false,
+                    OpeningDay = DayOfTheWeek.Tuesday,
+                    ClosingDay = DayOfTheWeek.Wednesday,
+                    Template = sessiontemplates.First(x => x.Name == "CME: Equity Index Futures [E-Mini] (GLOBEX)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(15, 30, 0),
+                    ClosingTime = new TimeSpan(16, 30, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Wednesday,
+                    ClosingDay = DayOfTheWeek.Wednesday,
+                    Template = sessiontemplates.First(x => x.Name == "CME: Equity Index Futures [E-Mini] (GLOBEX)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(17, 0, 0),
+                    ClosingTime = new TimeSpan(15, 15, 0),
+                    IsSessionEnd = false,
+                    OpeningDay = DayOfTheWeek.Wednesday,
+                    ClosingDay = DayOfTheWeek.Thursday,
+                    Template = sessiontemplates.First(x => x.Name == "CME: Equity Index Futures [E-Mini] (GLOBEX)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(15, 30, 0),
+                    ClosingTime = new TimeSpan(16, 30, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Thursday,
+                    ClosingDay = DayOfTheWeek.Thursday,
+                    Template = sessiontemplates.First(x => x.Name == "CME: Equity Index Futures [E-Mini] (GLOBEX)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(17, 0, 0),
+                    ClosingTime = new TimeSpan(15, 15, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Thursday,
+                    ClosingDay = DayOfTheWeek.Friday,
+                    Template = sessiontemplates.First(x => x.Name == "CME: Equity Index Futures [E-Mini] (GLOBEX)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(17, 0, 0),
+                    ClosingTime = new TimeSpan(15, 15, 0),
+                    IsSessionEnd = false,
+                    OpeningDay = DayOfTheWeek.Sunday,
+                    ClosingDay = DayOfTheWeek.Monday,
+                    Template = sessiontemplates.First(x => x.Name == "CME: Equity Index Futures [E-Mini] (GLOBEX)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(17, 0, 0),
+                    ClosingTime = new TimeSpan(16, 0, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Monday,
+                    ClosingDay = DayOfTheWeek.Tuesday,
+                    Template = sessiontemplates.First(x => x.Name == "CME: FX Futures (GLOBEX)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(17, 0, 0),
+                    ClosingTime = new TimeSpan(16, 0, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Tuesday,
+                    ClosingDay = DayOfTheWeek.Wednesday,
+                    Template = sessiontemplates.First(x => x.Name == "CME: FX Futures (GLOBEX)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(17, 0, 0),
+                    ClosingTime = new TimeSpan(16, 0, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Wednesday,
+                    ClosingDay = DayOfTheWeek.Thursday,
+                    Template = sessiontemplates.First(x => x.Name == "CME: FX Futures (GLOBEX)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(17, 0, 0),
+                    ClosingTime = new TimeSpan(16, 0, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Thursday,
+                    ClosingDay = DayOfTheWeek.Friday,
+                    Template = sessiontemplates.First(x => x.Name == "CME: FX Futures (GLOBEX)")
+                },
+                new TemplateSession
+                {
+                    OpeningTime = new TimeSpan(17, 0, 0),
+                    ClosingTime = new TimeSpan(16, 0, 0),
+                    IsSessionEnd = true,
+                    OpeningDay = DayOfTheWeek.Sunday,
+                    ClosingDay = DayOfTheWeek.Monday,
+                    Template = sessiontemplates.First(x => x.Name == "CME: FX Futures (GLOBEX)")
+                }
+            };
             #endregion

             #region exchanges


Fix `GetPayTradeHistoryAsync` (#1098)

Fix `GetPayTradeHistoryAsync` (#1098)

--- Binance.Net/Clients/SpotApi/BinanceClientSpotApiTrading.cs
+++ Binance.Net/Clients/SpotApi/BinanceClientSpotApiTrading.cs
@@ -1058,8 +1058,8 @@
         public async Task<WebCallResult<IEnumerable<BinancePayTrade>>> GetPayTradeHistoryAsync(DateTime? startTime = null, DateTime? endTime = null, int? limit = null, long? receiveWindow = null, CancellationToken ct = default)
         {
             var parameters = new Dictionary<string, object>();
-            parameters.AddOptionalParameter("startTimestamp", DateTimeConverter.ConvertToMilliseconds(startTime));
-            parameters.AddOptionalParameter("endTimestamp", DateTimeConverter.ConvertToMilliseconds(endTime));
+            parameters.AddOptionalParameter("startTime", DateTimeConverter.ConvertToMilliseconds(startTime));
+            parameters.AddOptionalParameter("endTime", DateTimeConverter.ConvertToMilliseconds(endTime));
             parameters.AddOptionalParameter("limit", limit);
             parameters.AddOptionalParameter("recvWindow", receiveWindow?.ToString(CultureInfo.InvariantCulture) ?? _baseClient.Options.ReceiveWindow.TotalMilliseconds.ToString(CultureInfo.InvariantCulture));


Changed to Kuggen from Lindholmen

Changed to Kuggen from Lindholmen

--- Chalmers.ILL/OrderItems/EntityFrameworkOrderItemManager.cs
+++ Chalmers.ILL/OrderItems/EntityFrameworkOrderItemManager.cs
@@ -655,7 +655,7 @@
                     if (currentDeliveryLibrary != deliveryLibraryId)
                     {
                         orderItem.DeliveryLibraryId = deliveryLibraryId;
-                        AddLogItem(orderNodeId, "BIBLIOTEK", "Leveransbibliotek ändrat från " + (currentDeliveryLibrary != -1 ? umbraco.library.GetPreValueAsString(currentDeliveryLibrary).Split(':').Last() : "Odefinierad") + " till " + umbraco.library.GetPreValueAsString(deliveryLibraryId).Split(':').Last(), eventId, false, false);
+                        AddLogItem(orderNodeId, "BIBLIOTEK", "Leveransbibliotek ändrat från " + (currentDeliveryLibrary != -1 ? (umbraco.library.GetPreValueAsString(currentDeliveryLibrary).Split(':').Last()=="Lindholmenbiblioteket"?"Kuggen": umbraco.library.GetPreValueAsString(currentDeliveryLibrary).Split(':').Last()) : "Odefinierad") + " till " + (umbraco.library.GetPreValueAsString(deliveryLibraryId).Split(':').Last() == "Lindholmenbiblioteket" ? "Kuggen" : umbraco.library.GetPreValueAsString(deliveryLibraryId).Split(':').Last()), eventId, false, false);
                     }
                     MaybeSaveToDatabase(doReindex, doSignal ? orderItem : null);
                 }


the events are now fired before each rotation executes

--- Cube.cs
+++ Cube.cs
@@ -184,7 +184,7 @@
 		/// </summary>
 		public void RotateFrontCW()
 		{
-			raiseBeforeCubeFrontCWRotation();
+			raiseBeforeFrontCWRotation();
 			var tempRow = top.GetRow(2);
 			top.SetRow(2, left.GetColumn(2).Reverse().ToArray());
 			left.SetColumn(2, bottom.GetRow(0));
@@ -198,6 +198,7 @@
 		/// </summary>
 		public void RotateFrontCCW()
 		{
+			raiseBeforeFrontCCWRotation();
 			var tempRow = top.GetRow(2);
 			top.SetRow(2, right.GetColumn(0));
 			right.SetColumn(0, bottom.GetRow(0).Reverse().ToArray());
@@ -211,6 +212,7 @@
 		/// </summary>
 		public void RotateBackCW()
 		{
+			raiseBeforeBackCWRotation();
 			var tempRow = top.GetRow(0);
 			top.SetRow(0, right.GetColumn(2));
 			right.SetColumn(2, bottom.GetRow(2).Reverse().ToArray());
@@ -224,6 +226,7 @@
 		/// </summary>
 		public void RotateBackCCW()
 		{
+			raiseBeforeBackCCWRotation();
 			var tempRow = top.GetRow(0);
 			top.SetRow(0, left.GetColumn(0).Reverse().ToArray());
 			left.SetColumn(0, bottom.GetRow(2));
@@ -237,6 +240,7 @@
 		/// </summary>
 		public void RotateLeftCW()
 		{
+			raiseBeforeLeftCWRotation();
 			var tempColumn = top.GetColumn(0);
 			top.SetColumn(0, back.GetColumn(2).Reverse().ToArray());
 			back.SetColumn(2, bottom.GetColumn(0).Reverse().ToArray());
@@ -250,6 +254,7 @@
 		/// </summary>
 		public void RotateLeftCCW()
 		{
+			raiseBeforeLeftCCWRotation();
 			var tempColumn = top.GetColumn(0);
 			top.SetColumn(0, front.GetColumn(0));
 			front.SetColumn(0, bottom.GetColumn(0));
@@ -263,6 +268,7 @@
 		/// </summary>
 		public void RotateRightCW()
 		{
+			raiseBeforeRightCWRotation();
 			var tempColumn = top.GetColumn(2);
 			top.SetColumn(2, front.GetColumn(2));
 			front.SetColumn(2, bottom.GetColumn(2));
@@ -276,6 +282,7 @@
 		/// </summary>
 		public void RotateRightCCW()
 		{
+			raiseBeforeRightCCWRotation();
 			var tempColumn = top.GetColumn(2);
 			top.SetColumn(2, back.GetColumn(0).Reverse().ToArray());
 			back.SetColumn(0, bottom.GetColumn(2).Reverse().ToArray());
@@ -289,6 +296,7 @@
 		/// </summary>
 		public void RotateTopCW()
 		{
+			raiseBeforeTopCWRotation();
 			var tempRow = front.GetRow(0);
 			front.SetRow(0, right.GetRow(0));
 			right.SetRow(0, back.GetRow(0));
@@ -302,6 +310,7 @@
 		/// </summary>
 		public void RotateTopCCW()
 		{
+			raiseBeforeTopCCWRotation();
 			var tempRow = front.GetRow(0);
 			front.SetRow(0, left.GetRow(0));
 			left.SetRow(0, back.GetRow(0));
@@ -315,6 +324,7 @@
 		/// </summary>
 		public void RotateBottomCW()
 		{
+			raiseBeforeBottomCWRotation();
 			var tempRow = front.GetRow(2);
 			front.SetRow(2, left.GetRow(2));
 			left.SetRow(2, back.GetRow(2));
@@ -328,6 +338,7 @@
 		/// </summary>
 		public void RotateBottomCCW()
 		{
+			raiseBeforeBottomCCWRotation();
 			var tempRow = front.GetRow(2);
 			front.SetRow(2, right.GetRow(2));
 			right.SetRow(2, back.GetRow(2));


add table init to bootstrap

add table init to bootstrap

--- XWeather/Shared/Bootstrap.cs
+++ XWeather/Shared/Bootstrap.cs
@@ -1,4 +1,6 @@
-using Microsoft.Azure.Mobile;
+using System.Threading.Tasks;
+
+using Microsoft.Azure.Mobile;
 using Microsoft.Azure.Mobile.Crashes;

 using ModernHttpClient;
@@ -9,7 +11,10 @@

 using SettingsStudio;

+using NomadCode.Azure;
+
 using XWeather.Constants;
+using XWeather.Domain;

 #if __IOS__
@@ -38,6 +43,8 @@
 									typeof (Microsoft.Azure.Mobile.Analytics.Analytics),
 									typeof (Microsoft.Azure.Mobile.Crashes.Crashes));

+			Settings.AzureStoreEnabled = !string.IsNullOrEmpty (PrivateKeys.MobileCenter.ServiceUrl);
+
 			PclExportClient.Configure ();

 			JsonHttpClient.GlobalHttpMessageHandlerFactory = () => new NativeMessageHandler ();
@@ -48,7 +55,19 @@
 			Settings.VersionNumber = CrossVersionTracking.Current.CurrentVersion;

 			Settings.BuildNumber = CrossVersionTracking.Current.CurrentBuild;
+
+			Settings.RandomBackgrounds |= CrossVersionTracking.Current.IsFirstLaunchEver;
 #endif
+		}
+
+		public static async Task InitializeDataStore ()
+		{
+			if (Settings.AzureStoreEnabled)
+			{
+				AzureClient.Shared.RegisterTable<WuAcLocation> ();
+
+				await AzureClient.Shared.InitializeAzync (PrivateKeys.MobileCenter.ServiceUrl);
+			}
 		}
 	}
 }


removed a mono warning

removed a mono warning

--- Code/UnitTests/Epic.Linq.UnitTests/Expressions/Normalization/ExpressionsInspectorQA.cs
+++ Code/UnitTests/Epic.Linq.UnitTests/Expressions/Normalization/ExpressionsInspectorQA.cs
@@ -426,7 +426,6 @@
         public void Visit_aLambdaExpressionWithAVisitorReplacingTheArgumentType_throwsInvalidOperationException()
         {
             Expression<Func<int, int, int>> dummy = (i, j) => i > j ? 1 : 2;
-            Expression<Func<int, int, int>> differentExpression = (a, b) => a == b ? 3 : 4;
             LambdaExpression expressionToVisit = dummy;
             IVisitor<Expression, Expression> interceptor = null;
             IVisitContext context = VisitContext.New;


CA-363819: Fixed issue where VM network usage data were not shown on the Search TabPage.

Signed-off-by: Konstantina Chremmou <a7d1f757a659045fb6db8c1e3849a1c8ad00b97a@citrix.com>

--- XenModel/XenSearch/Common.cs
+++ XenModel/XenSearch/Common.cs
@@ -531,7 +531,7 @@
             if (o is VM vm)
             {
                 return vm.is_a_real_vm() &&
-                       vm.power_state != vm_power_state.Running &&
+                       vm.power_state == vm_power_state.Running &&
                        vm.GetVirtualisationStatus(out _).HasFlag(VM.VirtualisationStatus.IO_DRIVERS_INSTALLED)
                     ? PropertyAccessorHelper.vmNetworkUsageString(vm)
                     : null;


Allow line breaks

Allow line breaks

--- DragonSpark.Application/Components/Validation/Expressions/StandardCharactersPattern.cs
+++ DragonSpark.Application/Components/Validation/Expressions/StandardCharactersPattern.cs
@@ -4,5 +4,5 @@
 {
 	public static StandardCharactersPattern Default { get; } = new StandardCharactersPattern();

-	StandardCharactersPattern() : base(@"([a-zA-Z0-9- _.;'"":!+*&%$#^@=[\]()~`<>\\/,?{}\|]|\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])") {}
+	StandardCharactersPattern() : base(@"([a-zA-Z0-9- _.;'"":!+*&%$#^@=[\]()~`<>\\/,?{}\|]|\n|\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])") {}
 }


GenerationGuts: commonize redundant code

--- YAMLParser/GenerationGuts.cs
+++ YAMLParser/GenerationGuts.cs
@@ -613,6 +613,7 @@

             return GUTS;
         }
+
         /// <summary>
         /// How many 4-space "tabs" to prepend
         /// </summary>
@@ -622,10 +623,7 @@
             string leadingWhitespace = "";
             for (int i = 0; i < LEADING_WHITESPACE + extraTabs; i++)
                 leadingWhitespace += "    ";
-            if (!KnownStuff.KnownTypes.ContainsKey(st.rostype) && !"using Messages.std_msgs;\nusing String=System.String;\nusing Messages.geometry_msgs;\nusing Messages.nav_msgs;".Contains("Messages." + type))
-            {
-                type = "Messages." + st.Package + "." + type;
-            }
+            type = KnownStuff.GetNamespacedType(st, type);
             if (type == "Time" || type == "Duration")
             {
                 return string.Format(@"
@@ -700,11 +698,7 @@
             string ret = string.Format(@"
 {0}//{2}
 {0}hasmetacomponents |= {1};", leadingWhitespace, st.meta.ToString().ToLower(), st.Name);
-            string completetype = st.Type;
-            if (!KnownStuff.KnownTypes.ContainsKey(st.rostype) && !"using Messages.std_msgs;\nusing String=System.String;\nusing Messages.geometry_msgs;\nusing Messages.nav_msgs;".Contains("Messages." + completetype))
-            {
-                completetype = "Messages." + st.Package + "." + completetype;
-            }
+            string completetype = KnownStuff.GetNamespacedType(st);
             ret += string.Format(@"
 {0}if ({1} == null)
 {0}    {1} = new {2}[0];", leadingWhitespace, st.Name, completetype);
@@ -737,11 +731,7 @@
             // after concluding, make sure part of the string is "currentIndex += <amount read while deserializing this thing>"
             // start of deserializing piece referred to by st is currentIndex (its value at time of call to this fn)"

-            string pt = st.Type;
-            if (!KnownStuff.KnownTypes.ContainsKey(st.rostype) && !"using Messages.std_msgs;\nusing String=System.String;\nusing Messages.geometry_msgs;\nusing Messages.nav_msgs;".Contains("Messages." + st.Package))
-            {
-                pt = "Messages." + st.Package + "." + pt;
-            }
+            string pt = KnownStuff.GetNamespacedType(st);
             if(st.Const)
             {
                 return "";
@@ -797,11 +787,7 @@
             string leadingWhitespace = "";
             for (int i = 0; i < LEADING_WHITESPACE + extraTabs; i++)
                 leadingWhitespace += "    ";
-            string pt = st.Type;
-            if (!KnownStuff.KnownTypes.ContainsKey(st.rostype) && !"using Messages.std_msgs;\nusing String=System.String;\nusing Messages.geometry_msgs;\nusing Messages.nav_msgs;".Contains("Messages." + st.Package))
-            {
-                pt = "Messages." + st.Package + "." + pt;
-            }
+            string pt = KnownStuff.GetNamespacedType(st);
             if (type == "Time" || type == "Duration")
             {
                 return string.Format(@"
@@ -889,6 +875,26 @@
     public static class KnownStuff
     {
         private static char[] spliter = {' '};
+
+        /// <summary>
+        /// Message namespaces known to ALL messages (in their header's using lines)
+        /// </summary>
+        private const string STATIC_NAMESPACE_STRING = "using Messages.std_msgs;\nusing String=System.String;\nusing Messages.geometry_msgs;\nusing Messages.nav_msgs;";
+
+        /// <summary>
+        /// Returns the namespaced type name (if neccessary)
+        /// </summary>
+        /// <param name="st">This thing's SingleType</param>
+        /// <param name="type">(optional) the type string</param>
+        /// <returns>duh</returns>
+        public static string GetNamespacedType(SingleType st, string type = null)
+        {
+            if (type == null)
+                type = st.Type;
+            if (!KnownTypes.ContainsKey(st.rostype) && !type.Contains(st.Package) && !STATIC_NAMESPACE_STRING.Contains("Messages." + st.Package))
+                return string.Format("Messages.{0}.{1}", st.Package, type);
+            return type;
+        }

         public static Dictionary<string, string> KnownTypes = new Dictionary<string, string>
         {
@@ -1085,9 +1091,7 @@
                             suffix = " = new " + type + "()";
                     else
                         suffix = KnownStuff.GetConstTypesAffix(type);
-                string t = type;
-                if (!KnownStuff.KnownTypes.ContainsKey(rostype) && !"using Messages.std_msgs;\nusing String=System.String;\nusing Messages.geometry_msgs;\nusing Messages.nav_msgs;".Contains("Messages."+Package))
-                    t = "Messages." + Package + "." + t;
+                string t = KnownStuff.GetNamespacedType(this, type);
                 output = lowestindent + "public " + prefix + t + " " + name + otherstuff + suffix + ";";
             }
             else
@@ -1100,9 +1104,7 @@
                     otherstuff = split[0] + " = (" + type + ")" + split[1];

                 }
-                string t = type;
-                if (!KnownStuff.KnownTypes.ContainsKey(rostype) && !"using Messages.std_msgs;\nusing String=System.String;\nusing Messages.geometry_msgs;\nusing Messages.nav_msgs;".Contains("Messages." + Package))
-                    t = "Messages." + Package + "." + t;
+                string t = KnownStuff.GetNamespacedType(this, type);
                 if (length.Length > 0)
                     output = lowestindent + "public " + t + "[] " + name + otherstuff + " = new " + type + "[" + length + "];";
                 else
@@ -1186,9 +1188,7 @@
                             suffix = " = new " + Type + "()";
                     else
                         suffix = KnownStuff.GetConstTypesAffix(Type);
-                string t = Type;
-                if (!KnownStuff.KnownTypes.ContainsKey(rostype) && !"using Messages.std_msgs;\nusing String=System.String;\nusing Messages.geometry_msgs;\nusing Messages.nav_msgs;".Contains("Messages." + Package))
-                    t = "Messages." + Package + "." + t;
+                string t = KnownStuff.GetNamespacedType(this, Type);
                 output = lowestindent + "public " + prefix + t + " " + name + otherstuff + suffix + ";";
             }
             else
@@ -1200,11 +1200,9 @@
                     string[] split = otherstuff.Split('=');
                     otherstuff = split[0] + " = (" + Type + ")" + split[1];
                 }
-                string t = Type;
-                if (!KnownStuff.KnownTypes.ContainsKey(rostype) && !"using Messages.std_msgs;\nusing String=System.String;\nusing Messages.geometry_msgs;\nusing Messages.nav_msgs;".Contains("Messages." + Package))
-                    t = "Messages." + Package + "." + t;
+                string t = KnownStuff.GetNamespacedType(this, Type);
                 if (length.Length != 0)
-                    output = lowestindent + "public " + t + "[] " + name + otherstuff + " = new " + Type + "[" + length + "];";
+                    output = lowestindent + "public " + t + "[] " + name + otherstuff + " = new " + t + "[" + length + "];";
                 else
                     output = lowestindent + "public " + "" + t + "[] " + name + otherstuff + ";";
             }
@@ -1219,17 +1217,13 @@
         public static string Generate(SingleType members)
         {
             string mt = "MsgTypes.Unknown";
-            string pt = members.Type;
+            string pt = KnownStuff.GetNamespacedType(members);
             if (members.meta)
             {
                 string t = members.Type.Replace("Messages.", "");
                 if (!t.Contains('.'))
                     t = members.Definer.Package + "." + t;
                 mt = "MsgTypes." + t.Replace(".", "__");
-            }
-            if (!KnownStuff.KnownTypes.ContainsKey(members.rostype) && !"using Messages.std_msgs;\nusing String=System.String;\nusing Messages.geometry_msgs;\nusing Messages.nav_msgs;".Contains("Messages." + members.Package))
-            {
-                pt = "Messages." + members.Package + "." + pt;
             }
             return String.Format
                 ("\"{0}\", new MsgFieldInfo(\"{0}\", {1}, {2}, {3}, \"{4}\", {5}, \"{6}\", {7}, {8})",


increasing tests stability

increasing tests stability

--- GridDomain.Tests.Acceptance/Snapshots/Instance_process_Should_recover_from_snapshot.cs
+++ GridDomain.Tests.Acceptance/Snapshots/Instance_process_Should_recover_from_snapshot.cs
@@ -19,6 +19,7 @@
         [Fact]
         public async Task Test()
         {
+            var i = Node.Id; //just start node
             var process  = new SoftwareProgrammingProcess();
             var state = new SoftwareProgrammingState(Guid.NewGuid(), process.Coding.Name, Guid.NewGuid(), Guid.NewGuid());


fixed that databasename is read from connectionstring for mongo

--- Source/SensorDataApi/Ruzzie.SensorData.Web/Repository/SensorItemDataRepositoryMongo.cs
+++ Source/SensorDataApi/Ruzzie.SensorData.Web/Repository/SensorItemDataRepositoryMongo.cs
@@ -1,6 +1,7 @@
 using System.Threading.Tasks;
 using MongoDB.Bson;
 using MongoDB.Driver;
+using MongoDB.Driver.Core.Configuration;

 namespace Ruzzie.SensorData.Web.Repository
 {
@@ -17,8 +18,8 @@
         public SensorItemDataRepositoryMongo(string connectionstring)
         {
             var mongoClient = new MongoClient(connectionstring);
-
-            _mongoDatabase = mongoClient.GetDatabase("sensordatatestdb");
+            var str = new ConnectionString(connectionstring);
+            _mongoDatabase = mongoClient.GetDatabase(str.DatabaseName);
         }

         public IMongoCollection<SensorItemDataDocument> SensorItemDataCollection


review changes

review changes

--- Tests.Unit.Core.ApplicationServices/ApplicationServices/Deltas/TrackingServiceTests.cs
+++ Tests.Unit.Core.ApplicationServices/ApplicationServices/Deltas/TrackingServiceTests.cs
@@ -185,6 +185,24 @@
             Assert.Equal(all.Where(x => x.OccurredAtUtc >= filterByDateTime).ToList(), result.ToList());
         }

+        public static IEnumerable<object[]> GetTrackedEventTypes() => EnumRange.All<TrackedLifeCycleEventType>().Select(x => new object[] { x });
+
+        [Theory, MemberData(nameof(GetTrackedEventTypes))]
+        public void Can_Query_With_EventTypeFilter(TrackedLifeCycleEventType eventType)
+        {
+            //Arrange
+            const int howMany = 10;
+            var all = Many<LifeCycleTrackingEvent>(howMany).ToList();
+            _repositoryMock.Setup(x => x.AsQueryable()).Returns(all.AsQueryable());
+            ExpectCrossLevelOrganizationReadAccess(CrossOrganizationDataReadAccessLevel.All);
+
+            //Act
+            var result = _sut.QueryLifeCycleEvents(eventType:eventType);
+
+            //Assert
+            Assert.Equal(all.Where(x => x.EventType >= eventType).ToList(), result.ToList());
+        }
+
         private IEnumerable<int> CreateUniqueIds(int toCreate)
         {
             var hashSet = new HashSet<int>();


Regenerate Google.Cloud.Translate.V3 (#4058)

Reflects the generator change to use WithGoogleRequestParam.

--- apis/Google.Cloud.Translate.V3/Google.Cloud.Translate.V3/TranslationServiceClient.g.cs
+++ apis/Google.Cloud.Translate.V3/Google.Cloud.Translate.V3/TranslationServiceClient.g.cs
@@ -25,7 +25,6 @@
 using sc = System.Collections;
 using scg = System.Collections.Generic;
 using sco = System.Collections.ObjectModel;
-using sysnet = System.Net;
 using st = System.Threading;
 using stt = System.Threading.Tasks;

@@ -2335,28 +2334,28 @@
             BatchTranslateTextOperationsClient = new lro::OperationsClientImpl(grpcClient.CreateOperationsClient(), effectiveSettings.BatchTranslateTextOperationsSettings);
             CreateGlossaryOperationsClient = new lro::OperationsClientImpl(grpcClient.CreateOperationsClient(), effectiveSettings.CreateGlossaryOperationsSettings);
             DeleteGlossaryOperationsClient = new lro::OperationsClientImpl(grpcClient.CreateOperationsClient(), effectiveSettings.DeleteGlossaryOperationsSettings);
-            _callTranslateText = clientHelper.BuildApiCall<TranslateTextRequest, TranslateTextResponse>(grpcClient.TranslateTextAsync, grpcClient.TranslateText, effectiveSettings.TranslateTextSettings).WithCallSettingsOverlay(request => gaxgrpc::CallSettings.FromHeader("x-goog-request-params", $"parent={(sysnet::WebUtility.UrlEncode(request.Parent))}"));
+            _callTranslateText = clientHelper.BuildApiCall<TranslateTextRequest, TranslateTextResponse>(grpcClient.TranslateTextAsync, grpcClient.TranslateText, effectiveSettings.TranslateTextSettings).WithGoogleRequestParam("parent", request => request.Parent);
             Modify_ApiCall(ref _callTranslateText);
             Modify_TranslateTextApiCall(ref _callTranslateText);
-            _callDetectLanguage = clientHelper.BuildApiCall<DetectLanguageRequest, DetectLanguageResponse>(grpcClient.DetectLanguageAsync, grpcClient.DetectLanguage, effectiveSettings.DetectLanguageSettings).WithCallSettingsOverlay(request => gaxgrpc::CallSettings.FromHeader("x-goog-request-params", $"parent={(sysnet::WebUtility.UrlEncode(request.Parent))}"));
+            _callDetectLanguage = clientHelper.BuildApiCall<DetectLanguageRequest, DetectLanguageResponse>(grpcClient.DetectLanguageAsync, grpcClient.DetectLanguage, effectiveSettings.DetectLanguageSettings).WithGoogleRequestParam("parent", request => request.Parent);
             Modify_ApiCall(ref _callDetectLanguage);
             Modify_DetectLanguageApiCall(ref _callDetectLanguage);
-            _callGetSupportedLanguages = clientHelper.BuildApiCall<GetSupportedLanguagesRequest, SupportedLanguages>(grpcClient.GetSupportedLanguagesAsync, grpcClient.GetSupportedLanguages, effectiveSettings.GetSupportedLanguagesSettings).WithCallSettingsOverlay(request => gaxgrpc::CallSettings.FromHeader("x-goog-request-params", $"parent={(sysnet::WebUtility.UrlEncode(request.Parent))}"));
+            _callGetSupportedLanguages = clientHelper.BuildApiCall<GetSupportedLanguagesRequest, SupportedLanguages>(grpcClient.GetSupportedLanguagesAsync, grpcClient.GetSupportedLanguages, effectiveSettings.GetSupportedLanguagesSettings).WithGoogleRequestParam("parent", request => request.Parent);
             Modify_ApiCall(ref _callGetSupportedLanguages);
             Modify_GetSupportedLanguagesApiCall(ref _callGetSupportedLanguages);
-            _callBatchTranslateText = clientHelper.BuildApiCall<BatchTranslateTextRequest, lro::Operation>(grpcClient.BatchTranslateTextAsync, grpcClient.BatchTranslateText, effectiveSettings.BatchTranslateTextSettings).WithCallSettingsOverlay(request => gaxgrpc::CallSettings.FromHeader("x-goog-request-params", $"parent={(sysnet::WebUtility.UrlEncode(request.Parent))}"));
+            _callBatchTranslateText = clientHelper.BuildApiCall<BatchTranslateTextRequest, lro::Operation>(grpcClient.BatchTranslateTextAsync, grpcClient.BatchTranslateText, effectiveSettings.BatchTranslateTextSettings).WithGoogleRequestParam("parent", request => request.Parent);
             Modify_ApiCall(ref _callBatchTranslateText);
             Modify_BatchTranslateTextApiCall(ref _callBatchTranslateText);
-            _callCreateGlossary = clientHelper.BuildApiCall<CreateGlossaryRequest, lro::Operation>(grpcClient.CreateGlossaryAsync, grpcClient.CreateGlossary, effectiveSettings.CreateGlossarySettings).WithCallSettingsOverlay(request => gaxgrpc::CallSettings.FromHeader("x-goog-request-params", $"parent={(sysnet::WebUtility.UrlEncode(request.Parent))}"));
+            _callCreateGlossary = clientHelper.BuildApiCall<CreateGlossaryRequest, lro::Operation>(grpcClient.CreateGlossaryAsync, grpcClient.CreateGlossary, effectiveSettings.CreateGlossarySettings).WithGoogleRequestParam("parent", request => request.Parent);
             Modify_ApiCall(ref _callCreateGlossary);
             Modify_CreateGlossaryApiCall(ref _callCreateGlossary);
-            _callListGlossaries = clientHelper.BuildApiCall<ListGlossariesRequest, ListGlossariesResponse>(grpcClient.ListGlossariesAsync, grpcClient.ListGlossaries, effectiveSettings.ListGlossariesSettings).WithCallSettingsOverlay(request => gaxgrpc::CallSettings.FromHeader("x-goog-request-params", $"parent={(sysnet::WebUtility.UrlEncode(request.Parent))}"));
+            _callListGlossaries = clientHelper.BuildApiCall<ListGlossariesRequest, ListGlossariesResponse>(grpcClient.ListGlossariesAsync, grpcClient.ListGlossaries, effectiveSettings.ListGlossariesSettings).WithGoogleRequestParam("parent", request => request.Parent);
             Modify_ApiCall(ref _callListGlossaries);
             Modify_ListGlossariesApiCall(ref _callListGlossaries);
-            _callGetGlossary = clientHelper.BuildApiCall<GetGlossaryRequest, Glossary>(grpcClient.GetGlossaryAsync, grpcClient.GetGlossary, effectiveSettings.GetGlossarySettings).WithCallSettingsOverlay(request => gaxgrpc::CallSettings.FromHeader("x-goog-request-params", $"name={(sysnet::WebUtility.UrlEncode(request.Name))}"));
+            _callGetGlossary = clientHelper.BuildApiCall<GetGlossaryRequest, Glossary>(grpcClient.GetGlossaryAsync, grpcClient.GetGlossary, effectiveSettings.GetGlossarySettings).WithGoogleRequestParam("name", request => request.Name);
             Modify_ApiCall(ref _callGetGlossary);
             Modify_GetGlossaryApiCall(ref _callGetGlossary);
-            _callDeleteGlossary = clientHelper.BuildApiCall<DeleteGlossaryRequest, lro::Operation>(grpcClient.DeleteGlossaryAsync, grpcClient.DeleteGlossary, effectiveSettings.DeleteGlossarySettings).WithCallSettingsOverlay(request => gaxgrpc::CallSettings.FromHeader("x-goog-request-params", $"name={(sysnet::WebUtility.UrlEncode(request.Name))}"));
+            _callDeleteGlossary = clientHelper.BuildApiCall<DeleteGlossaryRequest, lro::Operation>(grpcClient.DeleteGlossaryAsync, grpcClient.DeleteGlossary, effectiveSettings.DeleteGlossarySettings).WithGoogleRequestParam("name", request => request.Name);
             Modify_ApiCall(ref _callDeleteGlossary);
             Modify_DeleteGlossaryApiCall(ref _callDeleteGlossary);
             OnConstruction(grpcClient, effectiveSettings, clientHelper);


RoomIO: Added IOErrCode codes; added body to IsValidRoomsFiles

--- RoomIO.cs
+++ RoomIO.cs
@@ -1,6 +1,8 @@
 using System.Collections.Generic;
+using System.Linq;
 using System.IO;
 using System.Xml;
+using System.Xml.Linq;
 using System.Xml.Serialization;
 using System.Xml.Schema;

@@ -8,36 +10,76 @@
 {
     public static class RoomIO
     {
-        public static bool IsValidRoomsFile(string RoomsFilePath, RoomerSettings roomerSettings)
+        public enum IOErrCode
         {
-            // TODO
-            // 2a. The schemas will check that every room/item/exit/etc has a unique ID.
-            // 3. Verify that the file doesn't duplicate any unique IDs (rooms, items, exits, etc).
-            // 4. Check that the file has a single starting Room.
-            // #. [Whatever else?]
-
-            // 1. Check that the file can be accessed and exists.
+            NoError,
+
+            // Rooms file testing errors
+            RoomFileNotFound,
+            RoomFileNotXMLValid,
+            RoomIdsNotUnique,
+            StartRoomMissingOrMulti,
+
+            // Rooms loading errors
+
+        }
+
+        public static string MakePath(string Dir, string Fname)
+        {
+            string path = Path.Combine(Dir, Fname);
+            if (Directory.Exists(path))
+            {
+                return (path);
+            }
+
+            return null;
+        }
+
+        public static IOErrCode IsValidRoomsFile(string RoomsFilePath, RoomerSettings roomerSettings)
+        {
+            XmlSchemaSet roomsSchemas;
+            XmlReader roomsReader;
+            XDocument roomsDoc;
+
+            //// 1. Check that the file can be accessed and exists.
             if (!File.Exists(RoomsFilePath))
             {
-                return (false);
-            }
-
-            // 2. Validate the file against the Rooms schemas.
-            XmlSchemaSet schemas = new XmlSchemaSet();
-            schemas.Add("", Path.Combine(roomerSettings.GetSett("PathSchemas"), roomerSettings.GetSett("RoomsXsdFilename")));
-
-            XmlReaderSettings settings = new XmlReaderSettings();
-            settings.ValidationType = ValidationType.Schema;
-            settings.Schemas = schemas;
-
-            XmlReader xmlReader = XmlReader.Create(RoomsFilePath);
-            if (!xmlReader.Read())
-            {
-                return (false);
+                return (IOErrCode.RoomFileNotFound);
             }

-            // Looks good!
-            return (true);
+            //// Some setup for checking the XML doc against schemas
+
+            string schemaPath = Path.Combine(roomerSettings.GetSett("PathSchemas"), roomerSettings.GetSett("RoomsXsdFilename"));
+
+            roomsSchemas = new XmlSchemaSet();
+            roomsSchemas.Add("", schemaPath);
+
+            roomsReader = XmlReader.Create(RoomsFilePath);
+
+            //// 2. Validate the file against the Rooms schemas.
+            if (!roomsReader.Read())
+            {
+                return (IOErrCode.RoomFileNotXMLValid);
+            }
+
+            //// Now that our XML file is valid, store it off.
+            roomsDoc = XDocument.Load(roomsReader);
+
+            //// 3. Check that all rooms use a unique ID
+            IEnumerable<string> roomIds = roomsDoc.Root.Descendants("id").Select(e => e.Value);
+            if (roomIds.Distinct().Count() != roomIds.Count())
+            {
+                return (IOErrCode.RoomIdsNotUnique);
+            }
+
+            //// 4. Check that exactly one starting room exists
+            if (roomsDoc.Root.Descendants("isStartingRoom").Count() != 1)
+            {
+                return (IOErrCode.StartRoomMissingOrMulti);
+            }
+
+            //// Looks good!
+            return (IOErrCode.NoError);
         }

         public static bool LoadRoomsFromFile(Dictionary<string, Room> outRooms, string RoomsFilePath)


Fixed a possible error in the scheduled job loop.

--- Server.cs
+++ Server.cs
@@ -228,7 +228,9 @@
                     timeout = Math.Min(timeout, (int) Math.Ceiling((first.NextTime - DateTime.Now).TotalMilliseconds));
                 }

-                _scheduledJobHandle.WaitOne(timeout);
+                if (timeout > 0) {
+                    _scheduledJobHandle.WaitOne(timeout);
+                }

                 lock (_scheduledJobs) {
                     first = _scheduledJobs.FirstOrDefault();


Menu no longer crashes if it doesn't have any items

--- UIMenu.cs
+++ UIMenu.cs
@@ -428,8 +428,6 @@
             Function.Call((Hash)0xB8A850F20A067EB6, 76, 84);           // Safezone
             Function.Call((Hash)0xF5A2C681787E579D, 0f, 0f, 0f, 0f);   // stuff

-            _background.Size = Size > MaxItemsOnScreen + 1 ? new Size(431 + WidthOffset, 38*(MaxItemsOnScreen + 1)) : new Size(431 + WidthOffset, 38 * Size);
-            _background.Draw();

             if (String.IsNullOrWhiteSpace(_customBanner))
             {
@@ -443,8 +441,16 @@
                 Point safe = GetSafezoneBounds();
                 Sprite.DrawTexture(_customBanner, new Point(safe.X + _offset.X, safe.Y + _offset.Y), new Size(431 + WidthOffset, 107));
             }
+            _mainMenu.Draw();
+            if (MenuItems.Count == 0)
+            {
+                Function.Call((Hash)0xE3A3DB414A373DAB); // Safezone end
+                return;
+            }
+
+            _background.Size = Size > MaxItemsOnScreen + 1 ? new Size(431 + WidthOffset, 38*(MaxItemsOnScreen + 1)) : new Size(431 + WidthOffset, 38 * Size);
+            _background.Draw();
             MenuItems[_activeItem % (MenuItems.Count)].Selected = true;
-            _mainMenu.Draw();
             if (!String.IsNullOrWhiteSpace(MenuItems[_activeItem%(MenuItems.Count)].Description))
             {
                 _descriptionText.Caption = MenuItems[_activeItem%(MenuItems.Count)].Description;
@@ -788,7 +794,7 @@
         /// </summary>
         public void ProcessMouse()
         {
-            if (!Visible || _justOpened) return;
+            if (!Visible || _justOpened || MenuItems.Count == 0) return;
             Point safezoneOffset = GetSafezoneBounds();
             Function.Call(Hash._SHOW_CURSOR_THIS_FRAME);
             int limit = MenuItems.Count - 1;
@@ -1034,6 +1040,13 @@
                 _justOpened = false;
                 return;
             }
+
+            if (HasControlJustBeenReleaseed(MenuControls.Back, key))
+            {
+                //MenuPool.ControllerUsed = Game.IsControlJustPressed(2, (GTA.Control)45);
+                GoBack();
+            }
+            if (MenuItems.Count == 0) return;
             if (IsControlBeingPressed(MenuControls.Up, key) || Game.IsControlJustPressed(0, Control.CursorScrollUp))
             {
                 //MenuPool.ControllerUsed = Game.IsControlJustPressed(2, (GTA.Control)27);
@@ -1044,7 +1057,9 @@
                     GoUp();
                 UpdateScaleform();
             }
-            else if (IsControlBeingPressed(MenuControls.Down, key) || Game.IsControlJustPressed(0, Control.CursorScrollDown))
+
+            else if (IsControlBeingPressed(MenuControls.Down, key) ||
+                     Game.IsControlJustPressed(0, Control.CursorScrollDown))
             {
                 //MenuPool.ControllerUsed = Game.IsControlJustPressed(2, (GTA.Control)8);
                 MenuPool.ControllerUsed = Game.IsControlJustPressed(2, Control.PhoneDown);
@@ -1055,6 +1070,7 @@
                     GoDown();
                 UpdateScaleform();
             }
+
             else if (IsControlBeingPressed(MenuControls.Left, key))
             {
                 //MenuPool.ControllerUsed = Game.IsControlJustPressed(2, (GTA.Control)34);
@@ -1075,11 +1091,6 @@
                 SelectItem();
             }

-            else if (HasControlJustBeenReleaseed(MenuControls.Back, key))
-            {
-                //MenuPool.ControllerUsed = Game.IsControlJustPressed(2, (GTA.Control)45);
-                GoBack();
-            }
         }


SetValuesFormatCodeOfChartSeries.cs1

--- Examples/CSharp/Charts/SetValuesFormatCodeOfChartSeries.cs
+++ Examples/CSharp/Charts/SetValuesFormatCodeOfChartSeries.cs
@@ -23,7 +23,7 @@
             Workbook wb = new Workbook(sourceDir + "sampleSeries_ValuesFormatCode.xlsx");

             //Access first worksheet
-            Worksheet worksheet = wb.Worksheets[0];
+            Worksheet worksheet = wb.Worksheets[0];

             //Access first chart
             Chart ch = worksheet.Charts[0];


Rearranging some .NET code

Rearranging some .NET code

--- dotnet/src/webdriver/Remote/RemoteWebDriver.cs
+++ dotnet/src/webdriver/Remote/RemoteWebDriver.cs
@@ -526,6 +526,36 @@
         }

         /// <summary>
+        /// Finds an element matching the given mechanism and value.
+        /// </summary>
+        /// <param name="mechanism">The mechanism by which to find the element.</param>
+        /// <param name="value">The value to use to search for the element.</param>
+        /// <returns>The first <see cref="IWebElement"/> matching the given criteria.</returns>
+        public virtual IWebElement FindElement(string mechanism, string value)
+        {
+            Dictionary<string, object> parameters = new Dictionary<string, object>();
+            parameters.Add("using", mechanism);
+            parameters.Add("value", value);
+            Response commandResponse = this.Execute(DriverCommand.FindElement, parameters);
+            return this.GetElementFromResponse(commandResponse);
+        }
+
+        /// <summary>
+        /// Finds all elements matching the given mechanism and value.
+        /// </summary>
+        /// <param name="mechanism">The mechanism by which to find the elements.</param>
+        /// <param name="value">The value to use to search for the elements.</param>
+        /// <returns>A collection of all of the <see cref="IWebElement">IWebElements</see> matching the given criteria.</returns>
+        public virtual ReadOnlyCollection<IWebElement> FindElements(string mechanism, string value)
+        {
+            Dictionary<string, object> parameters = new Dictionary<string, object>();
+            parameters.Add("using", mechanism);
+            parameters.Add("value", value);
+            Response commandResponse = this.Execute(DriverCommand.FindElements, parameters);
+            return this.GetElementsFromResponse(commandResponse);
+        }
+
+        /// <summary>
         /// Finds the first element in the page that matches the ID supplied
         /// </summary>
         /// <param name="id">ID of the element</param>
@@ -801,46 +831,13 @@
         }

         /// <summary>
-        /// Finds an element matching the given mechanism and value.
-        /// </summary>
-        /// <param name="mechanism">The mechanism by which to find the element.</param>
-        /// <param name="value">The value to use to search for the element.</param>
-        /// <returns>The first <see cref="IWebElement"/> matching the given criteria.</returns>
-        public virtual IWebElement FindElement(string mechanism, string value)
-        {
-            Dictionary<string, object> parameters = new Dictionary<string, object>();
-            parameters.Add("using", mechanism);
-            parameters.Add("value", value);
-            Response commandResponse = this.Execute(DriverCommand.FindElement, parameters);
-            return this.GetElementFromResponse(commandResponse);
-        }
-
-        /// <summary>
-        /// Finds all elements matching the given mechanism and value.
-        /// </summary>
-        /// <param name="mechanism">The mechanism by which to find the elements.</param>
-        /// <param name="value">The value to use to search for the elements.</param>
-        /// <returns>A collection of all of the <see cref="IWebElement">IWebElements</see> matching the given criteria.</returns>
-        public virtual ReadOnlyCollection<IWebElement> FindElements(string mechanism, string value)
-        {
-            Dictionary<string, object> parameters = new Dictionary<string, object>();
-            parameters.Add("using", mechanism);
-            parameters.Add("value", value);
-            Response commandResponse = this.Execute(DriverCommand.FindElements, parameters);
-            return this.GetElementsFromResponse(commandResponse);
-        }
-
-        /// <summary>
         /// Gets a <see cref="Screenshot"/> object representing the image of the page on the screen.
         /// </summary>
         /// <returns>A <see cref="Screenshot"/> object containing the image.</returns>
         public Screenshot GetScreenshot()
         {
-            // Get the screenshot as base64.
             Response screenshotResponse = this.Execute(DriverCommand.Screenshot, null);
             string base64 = screenshotResponse.Value.ToString();
-
-            // ... and convert it.
             return new Screenshot(base64);
         }

@@ -857,15 +854,6 @@
         }

         /// <summary>
-        /// Dispose the RemoteWebDriver Instance
-        /// </summary>
-        public void Dispose()
-        {
-            this.Dispose(true);
-            GC.SuppressFinalize(this);
-        }
-
-        /// <summary>
         /// Performs the specified list of actions with this action executor.
         /// </summary>
         /// <param name="actionSequenceList">The list of action sequences to perform.</param>
@@ -893,6 +881,15 @@
         public void ResetInputState()
         {
             this.Execute(DriverCommand.CancelActions, null);
+        }
+
+        /// <summary>
+        /// Dispose the RemoteWebDriver Instance
+        /// </summary>
+        public void Dispose()
+        {
+            this.Dispose(true);
+            GC.SuppressFinalize(this);
         }

         /// <summary>


Fix cast

Fix cast

--- Randomizer/Randomizer.cs
+++ Randomizer/Randomizer.cs
@@ -1,4 +1,6 @@
-namespace System.Collections.Generic
+using System.Linq;
+
+namespace System.Collections.Generic
 {
     public class Randomizer<TItem> : IEnumerable<TItem>
     {
@@ -6,9 +8,9 @@

         public TItem[] Items { get; set; }

-        public Randomizer(IEnumerable items)
+        public Randomizer(IEnumerable<TItem> items)
         {
-            Items = items as TItem[];
+            Items = items.ToArray();
         }

         IEnumerator IEnumerable.GetEnumerator()


Use existing star difficulty if non-local beatmap/ruleset

--- osu.Game/Beatmaps/BeatmapDifficultyManager.cs
+++ osu.Game/Beatmaps/BeatmapDifficultyManager.cs
@@ -209,7 +209,8 @@
             // Difficulty can only be computed if the beatmap and ruleset are locally available.
             if (beatmapInfo.ID == 0 || rulesetInfo.ID == null)
             {
-                existingDifficulty = new StarDifficulty(0);
+                // If not, fall back to the existing star difficulty (e.g. from an online source).
+                existingDifficulty = new StarDifficulty(beatmapInfo.StarDifficulty);
                 key = default;

                 return true;


Remove comment as no longer valid

Remove comment as no longer valid

--- src/15below.Deployment.Update/TagDictionary.cs
+++ src/15below.Deployment.Update/TagDictionary.cs
@@ -197,7 +197,6 @@
                         labelDic.Add(identity, instanceDic);
                     }

-                    //Support Properties being in Properties node, or at root
                     foreach (var prop in propertyGroup.XPathSelectElements(".//Property"))
                     {
                         var key = prop.Attribute("name").Value;


Update ZoomHelper.cs

Update ZoomHelper.cs

--- src/Avalonia.Controls.PanAndZoom/ZoomHelper.cs
+++ src/Avalonia.Controls.PanAndZoom/ZoomHelper.cs
@@ -47,7 +47,7 @@
                     }
                 }
             }
-            else
+            else if (!(width > viewport.Width))
             {
                 width += Abs(transformed.Position.X);
             }
@@ -69,7 +69,7 @@
                     }
                 }
             }
-            else
+            else if (!(height > viewport.Height))
             {
                 height += Abs(transformed.Position.Y);
             }


Span-ification v2. Remove CommandToken and just operate directly on the single span. Memory allocation is now down to less than 5KB.

--- src/Avalonia.Visuals/Media/PathMarkupParser.cs
+++ src/Avalonia.Visuals/Media/PathMarkupParser.cs
@@ -105,92 +105,112 @@

             while(!span.IsEmpty)
             {
-                var commandToken = CommandToken.Parse(ref span);
-                try
+                if(!ReadCommand(ref span, out var command, out var relative))
                 {
-                    do
+                    return;
+                }
+
+                bool initialCommand = true;
+
+                do
+                {
+                    if (!initialCommand)
                     {
-                        switch (commandToken.Command)
-                        {
-                            case Command.None:
-                                break;
-                            case Command.FillRule:
-                                SetFillRule(commandToken);
-                                break;
-                            case Command.Move:
-                                AddMove(commandToken);
-                                break;
-                            case Command.Line:
-                                AddLine(commandToken);
-                                break;
-                            case Command.HorizontalLine:
-                                AddHorizontalLine(commandToken);
-                                break;
-                            case Command.VerticalLine:
-                                AddVerticalLine(commandToken);
-                                break;
-                            case Command.CubicBezierCurve:
-                                AddCubicBezierCurve(commandToken);
-                                break;
-                            case Command.QuadraticBezierCurve:
-                                AddQuadraticBezierCurve(commandToken);
-                                break;
-                            case Command.SmoothCubicBezierCurve:
-                                AddSmoothCubicBezierCurve(commandToken);
-                                break;
-                            case Command.SmoothQuadraticBezierCurve:
-                                AddSmoothQuadraticBezierCurve(commandToken);
-                                break;
-                            case Command.Arc:
-                                AddArc(commandToken);
-                                break;
-                            case Command.Close:
-                                CloseFigure();
-                                break;
-                            default:
-                                throw new NotSupportedException("Unsupported command");
-                        }
-                    } while (commandToken.HasImplicitCommands);
-                }
-                catch (InvalidDataException)
-                {
+                        span = ReadSeparator(span);
+                    }
+
+                    switch (command)
+                    {
+                        case Command.None:
+                            break;
+                        case Command.FillRule:
+                            SetFillRule(ref span);
+                            break;
+                        case Command.Move:
+                            AddMove(ref span, relative);
+                            break;
+                        case Command.Line:
+                            AddLine(ref span, relative);
+                            break;
+                        case Command.HorizontalLine:
+                            AddHorizontalLine(ref span, relative);
+                            break;
+                        case Command.VerticalLine:
+                            AddVerticalLine(ref span, relative);
+                            break;
+                        case Command.CubicBezierCurve:
+                            AddCubicBezierCurve(ref span, relative);
+                            break;
+                        case Command.QuadraticBezierCurve:
+                            AddQuadraticBezierCurve(ref span, relative);
+                            break;
+                        case Command.SmoothCubicBezierCurve:
+                            AddSmoothCubicBezierCurve(ref span, relative);
+                            break;
+                        case Command.SmoothQuadraticBezierCurve:
+                            AddSmoothQuadraticBezierCurve(ref span, relative);
+                            break;
+                        case Command.Arc:
+                            AddArc(ref span, relative);
+                            break;
+                        case Command.Close:
+                            CloseFigure();
+                            break;
+                        default:
+                            throw new NotSupportedException("Unsupported command");
+                    }
+
+                    initialCommand = false;
+                } while (PeekArgument(span));
+
+            }
+
+            if (_isOpen)
+            {
+                _geometryContext.EndFigure(false);
+            }
+        }
+
+        private void CreateFigure()
+        {
+            if (_isOpen)
+            {
+                _geometryContext.EndFigure(false);
+            }
+
+            _geometryContext.BeginFigure(_currentPoint);
+
+            _isOpen = true;
+        }
+
+        private void SetFillRule(ref ReadOnlySpan<char> span)
+        {
+            if (!ReadArgument(ref span, out var fillRule) || fillRule.Length != 1)
+            {
+                throw new InvalidDataException("Invalid fill rule.");
+            }
+
+            FillRule rule;
+
+            switch (fillRule[0])
+            {
+                case '0':
+                    rule = FillRule.EvenOdd;
                     break;
-                }
-                catch (NotSupportedException)
-                {
+                case '1':
+                    rule = FillRule.NonZero;
                     break;
-                }
-            }
-
+                default:
+                    throw new InvalidDataException("Invalid fill rule");
+            }
+
+            _geometryContext.SetFillRule(rule);
+        }
+
+        private void CloseFigure()
+        {
             if (_isOpen)
             {
-                _geometryContext.EndFigure(false);
-            }
-        }
-
-        private void CreateFigure()
-        {
-            if (_isOpen)
-            {
-                _geometryContext.EndFigure(false);
-            }
-
-            _geometryContext.BeginFigure(_currentPoint);
-
-            _isOpen = true;
-        }
-
-        private void SetFillRule(CommandToken commandToken)
-        {
-            var fillRule = commandToken.ReadFillRule();
-
-            _geometryContext.SetFillRule(fillRule);
-        }
-
-        private void CloseFigure()
-        {
-            if (_isOpen)
-            {
                 _geometryContext.EndFigure(true);
             }

@@ -199,21 +219,22 @@
             _isOpen = false;
         }

-        private void AddMove(CommandToken commandToken)
-        {
-            var currentPoint = commandToken.IsRelative
-                                   ? commandToken.ReadRelativePoint(_currentPoint)
-                                   : commandToken.ReadPoint();
+        private void AddMove(ref ReadOnlySpan<char> span, bool relative)
+        {
+            var currentPoint = relative
+                                ? ReadRelativePoint(ref span, _currentPoint)
+                                : ReadPoint(ref span);

             _currentPoint = currentPoint;

             CreateFigure();

-            while (commandToken.HasImplicitCommands)
-            {
-                AddLine(commandToken);
-
-                if (!commandToken.IsRelative)
+            while (PeekArgument(span))
+            {
+                span = ReadSeparator(span);
+                AddLine(ref span, relative);
+
+                if (!relative)
                 {
                     _currentPoint = currentPoint;
                     CreateFigure();
@@ -221,11 +242,11 @@
             }
         }

-        private void AddLine(CommandToken commandToken)
-        {
-            _currentPoint = commandToken.IsRelative
-                                ? commandToken.ReadRelativePoint(_currentPoint)
-                                : commandToken.ReadPoint();
+        private void AddLine(ref ReadOnlySpan<char> span, bool relative)
+        {
+            _currentPoint = relative
+                                ? ReadRelativePoint(ref span, _currentPoint)
+                                : ReadPoint(ref span);

             if (!_isOpen)
             {
@@ -235,11 +256,11 @@
             _geometryContext.LineTo(_currentPoint);
         }

-        private void AddHorizontalLine(CommandToken commandToken)
-        {
-            _currentPoint = commandToken.IsRelative
-                                ? new Point(_currentPoint.X + commandToken.ReadDouble(), _currentPoint.Y)
-                                : _currentPoint.WithX(commandToken.ReadDouble());
+        private void AddHorizontalLine(ref ReadOnlySpan<char> span, bool relative)
+        {
+            _currentPoint = relative
+                                ? new Point(_currentPoint.X + ReadDouble(ref span), _currentPoint.Y)
+                                : _currentPoint.WithX(ReadDouble(ref span));

             if (!_isOpen)
             {
@@ -249,11 +270,11 @@
             _geometryContext.LineTo(_currentPoint);
         }

-        private void AddVerticalLine(CommandToken commandToken)
-        {
-            _currentPoint = commandToken.IsRelative
-                                ? new Point(_currentPoint.X, _currentPoint.Y + commandToken.ReadDouble())
-                                : _currentPoint.WithY(commandToken.ReadDouble());
+        private void AddVerticalLine(ref ReadOnlySpan<char> span, bool relative)
+        {
+            _currentPoint = relative
+                                ? new Point(_currentPoint.X, _currentPoint.Y + ReadDouble(ref span))
+                                : _currentPoint.WithY(ReadDouble(ref span));

             if (!_isOpen)
             {
@@ -263,21 +284,25 @@
             _geometryContext.LineTo(_currentPoint);
         }

-        private void AddCubicBezierCurve(CommandToken commandToken)
-        {
-            var point1 = commandToken.IsRelative
-                             ? commandToken.ReadRelativePoint(_currentPoint)
-                             : commandToken.ReadPoint();
-
-            var point2 = commandToken.IsRelative
-                             ? commandToken.ReadRelativePoint(_currentPoint)
-                             : commandToken.ReadPoint();
+        private void AddCubicBezierCurve(ref ReadOnlySpan<char> span, bool relative)
+        {
+            var point1 = relative
+                    ? ReadRelativePoint(ref span, _currentPoint)
+                    : ReadPoint(ref span);
+
+            span = ReadSeparator(span);
+
+            var point2 = relative
+                    ? ReadRelativePoint(ref span, _currentPoint)
+                    : ReadPoint(ref span);

             _previousControlPoint = point2;

-            var point3 = commandToken.IsRelative
-                             ? commandToken.ReadRelativePoint(_currentPoint)
-                             : commandToken.ReadPoint();
+            span = ReadSeparator(span);
+
+            var point3 = relative
+                    ? ReadRelativePoint(ref span, _currentPoint)
+                    : ReadPoint(ref span);

             if (!_isOpen)
             {
@@ -289,17 +314,19 @@
             _currentPoint = point3;
         }

-        private void AddQuadraticBezierCurve(CommandToken commandToken)
-        {
-            var start = commandToken.IsRelative
-                            ? commandToken.ReadRelativePoint(_currentPoint)
-                            : commandToken.ReadPoint();
+        private void AddQuadraticBezierCurve(ref ReadOnlySpan<char> span, bool relative)
+        {
+            var start = relative
+                    ? ReadRelativePoint(ref span, _currentPoint)
+                    : ReadPoint(ref span);

             _previousControlPoint = start;

-            var end = commandToken.IsRelative
-                          ? commandToken.ReadRelativePoint(_currentPoint)
-                          : commandToken.ReadPoint();
+            span = ReadSeparator(span);
+
+            var end = relative
+                    ? ReadRelativePoint(ref span, _currentPoint)
+                    : ReadPoint(ref span);

             if (!_isOpen)
             {
@@ -311,15 +338,17 @@
             _currentPoint = end;
         }

-        private void AddSmoothCubicBezierCurve(CommandToken commandToken)
-        {
-            var point2 = commandToken.IsRelative
-                             ? commandToken.ReadRelativePoint(_currentPoint)
-                             : commandToken.ReadPoint();
-
-            var end = commandToken.IsRelative
-                          ? commandToken.ReadRelativePoint(_currentPoint)
-                          : commandToken.ReadPoint();
+        private void AddSmoothCubicBezierCurve(ref ReadOnlySpan<char> span, bool relative)
+        {
+            var point2 = relative
+                    ? ReadRelativePoint(ref span, _currentPoint)
+                    : ReadPoint(ref span);
+
+            span = ReadSeparator(span);
+
+            var end = relative
+                    ? ReadRelativePoint(ref span, _currentPoint)
+                    : ReadPoint(ref span);

             if (_previousControlPoint != null)
             {
@@ -338,11 +367,11 @@
             _currentPoint = end;
         }

-        private void AddSmoothQuadraticBezierCurve(CommandToken commandToken)
-        {
-            var end = commandToken.IsRelative
-                          ? commandToken.ReadRelativePoint(_currentPoint)
-                          : commandToken.ReadPoint();
+        private void AddSmoothQuadraticBezierCurve(ref ReadOnlySpan<char> span, bool relative)
+        {
+            var end = relative
+                    ? ReadRelativePoint(ref span, _currentPoint)
+                    : ReadPoint(ref span);

             if (_previousControlPoint != null)
             {
@@ -359,19 +388,25 @@
             _currentPoint = end;
         }

-        private void AddArc(CommandToken commandToken)
-        {
-            var size = commandToken.ReadSize();
-
-            var rotationAngle = commandToken.ReadDouble();
-
-            var isLargeArc = commandToken.ReadBool();
-
-            var sweepDirection = commandToken.ReadBool() ? SweepDirection.Clockwise : SweepDirection.CounterClockwise;
-
-            var end = commandToken.IsRelative
-                          ? commandToken.ReadRelativePoint(_currentPoint)
-                          : commandToken.ReadPoint();
+        private void AddArc(ref ReadOnlySpan<char> span, bool relative)
+        {
+            var size = ReadSize(ref span);
+
+            span = ReadSeparator(span);
+
+            var rotationAngle = ReadDouble(ref span);
+            span = ReadSeparator(span);
+            var isLargeArc = ReadBool(ref span);
+
+            span = ReadSeparator(span);
+
+            var sweepDirection = ReadBool(ref span) ? SweepDirection.Clockwise : SweepDirection.CounterClockwise;
+
+            span = ReadSeparator(span);
+
+            var end = relative
+                    ? ReadRelativePoint(ref span, _currentPoint)
+                    : ReadPoint(ref span);

             if (!_isOpen)
             {
@@ -385,227 +420,134 @@
             _previousControlPoint = null;
         }

-        private class CommandToken
-        {
-            private CommandToken(Command command, bool isRelative, List<string> arguments)
-            {
-                Command = command;
-
-                IsRelative = isRelative;
-
-                Arguments = arguments;
-            }
-
-            public Command Command { get; }
-
-            public bool IsRelative { get; }
-
-            public bool HasImplicitCommands
-            {
-                get
-                {
-                    if (CurrentPosition == 0 && Arguments.Count > 0)
-                    {
-                        return true;
-                    }
-
-                    return CurrentPosition < Arguments.Count - 1;
-                }
-            }
-
-            private int CurrentPosition { get; set; }
-
-            private List<string> Arguments { get; }
+        private static bool PeekArgument(ReadOnlySpan<char> span)
+        {
+            span = SkipWhitespace(span);
+
+            return !span.IsEmpty && (span[0] == ',' || span[0] == '-' || char.IsDigit(span[0]));
+        }
+
+        private static bool ReadArgument(ref ReadOnlySpan<char> remaining, out ReadOnlySpan<char> argument)
+        {
+            remaining = SkipWhitespace(remaining);
+            if (remaining.IsEmpty)
+            {
+                argument = ReadOnlySpan<char>.Empty;
+                return false;
+            }
+
+            var valid = false;
+            int i = 0;
+            if (remaining[i] == '-')
+            {
+                i++;
+            }
+            for (; i < remaining.Length && char.IsNumber(remaining[i]); i++) valid = true;
+
+            if (i < remaining.Length && remaining[i] == '.')
+            {
+                valid = false;
+                i++;
+            }
+            for (; i < remaining.Length && char.IsNumber(remaining[i]); i++) valid = true;
+
+            if (!valid)
+            {
+                argument = ReadOnlySpan<char>.Empty;
+                return false;
+            }
+            argument = remaining.Slice(0, i);
+            remaining = remaining.Slice(i);
+            return true;
+        }
+
+
+        private static ReadOnlySpan<char> ReadSeparator(ReadOnlySpan<char> span)
+        {
+            span = SkipWhitespace(span);
+            if (!span.IsEmpty && span[0] == ',')
+            {
+                span = span.Slice(1);
+            }
+            return span;
+        }
+
+        private static ReadOnlySpan<char> SkipWhitespace(ReadOnlySpan<char> span)
+        {
+            int i = 0;
+            for (; i < span.Length && char.IsWhiteSpace(span[i]); i++) ;
+            return span.Slice(i);
+        }
+
+        private bool ReadBool(ref ReadOnlySpan<char> span)
+        {
+            if (!ReadArgument(ref span, out var boolValue) || boolValue.Length != 1)
+            {
+                throw new InvalidDataException("Invalid bool rule.");
+            }

-            public static CommandToken Parse(ref ReadOnlySpan<char> span)
-            {
-                if (!ReadCommand(ref span, out var command, out var isRelative))
-                {
-                    throw new InvalidDataException("No path command declared.");
-                }
-
-                span = span.Slice(1);
-                span = SkipWhitespace(span);
-
-                var arguments = new List<string>();
-
-                while (ReadArgument(ref span, out var argument))
-                {
-                    arguments.Add(argument.ToString());
-                    span = ReadSeparator(span);
-                }
-
-                return new CommandToken(command, isRelative, arguments);
-            }
-
-            public FillRule ReadFillRule()
-            {
-                if (CurrentPosition == Arguments.Count)
-                {
-                    throw new InvalidDataException("Invalid fill rule");
-                }
-
-                var value = Arguments[CurrentPosition];
-
-                CurrentPosition++;
-
-                switch (value)
-                {
-                    case "0":
-                        {
-                            return FillRule.EvenOdd;
-                        }
-
-                    case "1":
-                        {
-                            return FillRule.NonZero;
-                        }
-
-                    default:
-                        throw new InvalidDataException("Invalid fill rule");
-                }
-            }
-
-            public bool ReadBool()
-            {
-                if (CurrentPosition == Arguments.Count)
-                {
-                    throw new InvalidDataException("Invalid boolean value");
-                }
-
-                var value = Arguments[CurrentPosition];
-
-                CurrentPosition++;
-
-                switch (value)
-                {
-                    case "1":
-                        {
-                            return true;
-                        }
-
-                    case "0":
-                        {
-                            return false;
-                        }
-
-                    default:
-                        throw new InvalidDataException("Invalid boolean value");
-                }
-            }
-
-            public double ReadDouble()
-            {
-                if (CurrentPosition == Arguments.Count)
-                {
-                    throw new InvalidDataException("Invalid double value");
-                }
-
-                var value = Arguments[CurrentPosition];
-
-                CurrentPosition++;
-
-                return double.Parse(value, CultureInfo.InvariantCulture);
-            }
-
-            public Size ReadSize()
-            {
-                var width = ReadDouble();
-
-                var height = ReadDouble();
-
-                return new Size(width, height);
-            }
-
-            public Point ReadPoint()
-            {
-                var x = ReadDouble();
-
-                var y = ReadDouble();
-
-                return new Point(x, y);
-            }
-
-            public Point ReadRelativePoint(Point origin)
-            {
-                var x = ReadDouble();
-
-                var y = ReadDouble();
-
-                return new Point(origin.X + x, origin.Y + y);
-            }
-
-            private static bool ReadCommand(ref ReadOnlySpan<char> span, out Command command, out bool relative)
-            {
-                span = SkipWhitespace(span);
-                if (span.IsEmpty)
-                {
-                    command = default;
-                    relative = false;
+            switch (boolValue[0])
+            {
+                case '0':
                     return false;
-                }
-
-                var c = span[0];
-
-                if (!s_commands.TryGetValue(char.ToUpperInvariant(c), out command))
-                {
-                    throw new InvalidDataException("Unexpected path command '" + c + "'.");
-                }
-
-                relative = char.IsLower(c);
-
-                return true;
-            }
-
-            private static bool ReadArgument(ref ReadOnlySpan<char> remaining, out ReadOnlySpan<char> argument)
-            {
-                if (remaining.IsEmpty)
-                {
-                    argument = ReadOnlySpan<char>.Empty;
-                    return false;
-                }
-
-                var valid = false;
-                int i = 0;
-                if (remaining[i] == '-')
-                {
-                    i++;
-                }
-                for (; i < remaining.Length && char.IsNumber(remaining[i]); i++) valid = true ;
-
-                if (i < remaining.Length && remaining[i] == '.')
-                {
-                    valid = false;
-                    i++;
-                }
-                for (; i < remaining.Length && char.IsNumber(remaining[i]); i++) valid = true ;
-
-                if (!valid)
-                {
-                    argument = ReadOnlySpan<char>.Empty;
-                    return false;
-                }
-                argument = remaining.Slice(0, i);
-                remaining = remaining.Slice(i);
-                return true;
-            }
-
-            private static ReadOnlySpan<char> ReadSeparator(ReadOnlySpan<char> span)
-            {
-                span = SkipWhitespace(span);
-                if (!span.IsEmpty && span[0] == ',')
-                {
-                    span = span.Slice(1);
-                }
-                return SkipWhitespace(span);
-            }
-
-            private static ReadOnlySpan<char> SkipWhitespace(ReadOnlySpan<char> span)
-            {
-                int i = 0;
-                for (; i < span.Length && char.IsWhiteSpace(span[i]); i++) ;
-                return span.Slice(i);
-            }
+                case '1':
+                    return true;
+                default:
+                    throw new InvalidDataException("Invalid bool rule");
+            }
+        }
+
+        private double ReadDouble(ref ReadOnlySpan<char> span)
+        {
+            if (!ReadArgument(ref span, out var doubleValue))
+            {
+                throw new InvalidDataException("Invalid double value");
+            }
+
+            return double.Parse(doubleValue.ToString(), CultureInfo.InvariantCulture);
+        }
+
+        private Size ReadSize(ref ReadOnlySpan<char> span)
+        {
+            var width = ReadDouble(ref span);
+            span = ReadSeparator(span);
+            var height = ReadDouble(ref span);
+            return new Size(width, height);
+        }
+
+        private Point ReadPoint(ref ReadOnlySpan<char> span)
+        {
+            var x = ReadDouble(ref span);
+            span = ReadSeparator(span);
+            var y = ReadDouble(ref span);
+            return new Point(x, y);
+        }
+
+        private Point ReadRelativePoint(ref ReadOnlySpan<char> span, Point origin)
+        {
+            var x = ReadDouble(ref span);
+            span = ReadSeparator(span);
+            var y = ReadDouble(ref span);
+            return new Point(origin.X + x, origin.Y + y);
+        }
+
+        private bool ReadCommand(ref ReadOnlySpan<char> span, out Command command, out bool relative)
+        {
+            span = SkipWhitespace(span);
+            if (span.IsEmpty)
+            {
+                command = default;
+                relative = false;
+                return false;
+            }
+            var c = span[0];
+            if (!s_commands.TryGetValue(char.ToUpperInvariant(c), out command))
+            {
+                throw new InvalidDataException("Unexpected path command '" + c + "'.");
+            }
+            relative = char.IsLower(c);
+            span = span.Slice(1);
+            return true;
         }
     }
 }


Powershell: fix boolean parameters

Powershell: fix boolean parameters

--- src/Certify.Shared.Compat/PowerShellManager.cs
+++ src/Certify.Shared.Compat/PowerShellManager.cs
@@ -20,7 +20,8 @@
             Dictionary<string, object> parameters = null,
             string scriptContent = null,
             Dictionary<string, string> credentials = null,
-            string powershellExecutionPolicy = "Unrestricted"
+            string powershellExecutionPolicy = "Unrestricted",
+            bool autoConvertBoolean = true
             )
         {

@@ -80,8 +81,8 @@

                             return Impersonation.RunAsUser(windowsCredentials, _defaultLogonType, () =>
                           {
-                                // run as current user
-                                return InvokePowershell(result, powershellExecutionPolicy, scriptFile, parameters, scriptContent, shell);
+                              // run as current user
+                              return InvokePowershell(result, powershellExecutionPolicy, scriptFile, parameters, scriptContent, shell);
                           });
                         }
                         else
@@ -101,7 +102,7 @@
             }
         }

-        private static ActionResult InvokePowershell(CertificateRequestResult result, string executionPolicy, string scriptFile, Dictionary<string, object> parameters, string scriptContent, PowerShell shell)
+        private static ActionResult InvokePowershell(CertificateRequestResult result, string executionPolicy, string scriptFile, Dictionary<string, object> parameters, string scriptContent, PowerShell shell, bool autoConvertBoolean = true)
         {
             // ensure execution policy will allow the script to run, default to "Unrestricted", set in service config as "Default" to skip.

@@ -135,7 +136,21 @@
             {
                 foreach (var a in parameters)
                 {
-                    shell.AddParameter(a.Key, a.Value);
+                    var val = a.Value;
+                    if (autoConvertBoolean)
+                    {
+
+                        if (val != null && val?.ToString().ToLower() == "true")
+                        {
+                            val = true;
+                        }
+                        else if (val != null && val?.ToString().ToLower() == "false")
+                        {
+                            val = false;
+                        }
+
+                    }
+                    shell.AddParameter(a.Key, val);
                 }
             }

@@ -147,14 +162,14 @@

             // capture errors
             shell.Streams.Error.DataAdded += (sender, args) =>
-            {
-                var error = shell.Streams.Error[args.Index];
-                var src = error.InvocationInfo.MyCommand?.ToString() ?? error.InvocationInfo.InvocationName;
-                var msg = $"{src}: {error}\n{error.InvocationInfo.PositionMessage}";
-                output.AppendLine(msg);
-
-                errors.Add(msg);
-            };
+                {
+                    var error = shell.Streams.Error[args.Index];
+                    var src = error.InvocationInfo.MyCommand?.ToString() ?? error.InvocationInfo.InvocationName;
+                    var msg = $"{src}: {error}\n{error.InvocationInfo.PositionMessage}";
+                    output.AppendLine(msg);
+
+                    errors.Add(msg);
+                };

             // capture write-* methods (except write-host)
             shell.Streams.Warning.DataAdded += (sender, args) => output.AppendLine(shell.Streams.Warning[args.Index].Message);
@@ -164,14 +179,14 @@
             var outputData = new PSDataCollection<PSObject>();

             outputData.DataAdded += (sender, args) =>
-            {
+                    {
                 // capture all main output
                 var data = outputData[args.Index]?.BaseObject;
-                if (data != null)
-                {
-                    output.AppendLine(data.ToString());
-                }
-            };
+                        if (data != null)
+                        {
+                            output.AppendLine(data.ToString());
+                        }
+                    };

             try


Fixing issue with backslash at the end of a output path.

--- src/Docu.Console/Console/ConsoleApplication.cs
+++ src/Docu.Console/Console/ConsoleApplication.cs
@@ -44,7 +44,7 @@
             }));
             switches.Add(new ParameterSwitch("--output", arg =>
             {
-                documentationGenerator.SetOutputPath(arg);
+                documentationGenerator.SetOutputPath(arg.TrimEnd('\\'));
                 return true;
             }));
             switches.Add(new ParameterSwitch("--templates", arg =>