DiagramStyle

DiagramStyle

--- Util/Diagram/DiagramStyle.cs
+++ Util/Diagram/DiagramStyle.cs
@@ -6,7 +6,6 @@
 using EA;
 using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
-using File = System.IO.File;
 using hoTools.Utils.COM;

 // ReSharper disable MemberCanBePrivate.Global
@@ -115,7 +114,7 @@
                     if (searchResult == null) continue;
                     resultsDiaObject.Add(searchResult);
                 }
-                DiagramObjectStyleItems = resultsDiaObject.ToList<DiagramObjectStyleItem>();
+                DiagramObjectStyleItems = resultsDiaObject.ToList();

@@ -216,24 +215,28 @@

             string propertyName = match.Groups[1].Value;
             string propertyValue = match.Groups[2].Value;
-
-            var p = diaObj.GetType().GetProperty(propertyName);
-            if (p == null)
-            {
-                MessageBox.Show($"PropertyStyle='{style}'",
-                    $@"No valid DiagramObject Property '{propertyName}'");
-                return;
-            }
-            string propertyTyp = p.PropertyType.Name;
-            if (!(propertyTyp == "Boolean" ||
-                  propertyTyp == "String" ||
-                  propertyTyp == "Int32"))
-            {
-                //MessageBox.Show($"PropertyType '{propertyTyp}' not supported.\r\nOnly: Int32=long, Boolean, String\r\nPropertyStyle='{style}'",
-                //    $@"No valid DiagramObject Property Type '{propertyName}:{propertyTyp}'");
-                // Most things works well with Int32
-                propertyTyp = "Int32";
+            string propertyTyp;
+
+            var propertyInfo = diaObj.GetType().GetProperty(propertyName);
+            if (propertyInfo == null)
+            {
+                // don't know why it doesn't work
+                propertyTyp = "Boolean";
+                //MessageBox.Show($"PropertyStyle='{style}'",
+                //    $@"No valid DiagramObject Property '{propertyName}'");
                 //return;
+            }
+            else
+            {
+                propertyTyp = propertyInfo.PropertyType.Name;
+                if (!(propertyTyp == "Boolean" ||
+                      propertyTyp == "String" ||
+                      propertyTyp == "Int32"))
+                {
+                    // Most things works well with Int32
+                    propertyTyp = "Int32";
+                    //return;
+                }
             }

@@ -251,6 +254,7 @@
                                 "Property DiagramObject Style isn't Bool");
                             return;
                         }
+
                         // Com.SetProperty(diaObj, propertyName, boolProperty);
                         switch (propertyName)
                         {
@@ -289,6 +293,9 @@
                                 break;
                             case "ShowInheritedTags":
                                 diaObj.ShowInheritedTags = boolProperty;
+                                break;
+                            case "ShowNotes":
+                                diaObj.ShowNotes = boolProperty;
                                 break;
                             case "ShowPortType":
                                 diaObj.ShowPortType = boolProperty;
@@ -387,7 +394,6 @@

             string[] styleEx = styles.Split(';');
-            string[] propertyL = properties.Split(';');
             string diaStyle = dia.StyleEx;
             string diaExtendedStyle = dia.ExtendedStyle.Trim();
             if (!DiagramIsToChange(dia, dStyles)) return;
@@ -604,7 +610,7 @@
                         //dia.Update();
                         //rep.ReloadDiagram(dia.DiagramID);
                         bool showBorder;
-                        if (Boolean.TryParse(value.Trim(), out showForeign))
+                        if (Boolean.TryParse(value.Trim(), out showBorder))
                         {
                             string updateStr = $@"update t_diagram set ShowBorder = {value.Trim()}
                                                                           where Diagram_ID = {dia.DiagramID}";
@@ -648,9 +654,12 @@
                     string duid = "";
                     if (match.Success) duid = match.Groups[0].Value;

-                    diaObject.Style = duid + style.Replace(",", ";").Replace("   ", "").Replace("  ", "")
+                    s = duid + style.Replace(",", ";").Replace("   ", "").Replace("  ", "")
                                           .Replace(" ", "")
                                           .Trim();
+                    // ensure string ends with ";"
+                    if (s.Trim() != "" & (! s.EndsWith(";")) ) {s = s + ";";}
+                    diaObject.Style = s;
                     try
                     {
                         diaObject.Update();


Document special cases of parsing identifiers and literals

--- Json5/Parsing/Json5Parser.cs
+++ Json5/Parsing/Json5Parser.cs
@@ -74,6 +74,10 @@
               throw UnexpectedToken(token);

             case Json5TokenType.Identifier:
+              // Since these are literal tokens, check token.Input
+              // instead of token.String. Whereas `true` and `\x74rue`
+              // are both valid identifiers that represent the same
+              // thing, only `true` is a boolean literal.
               switch(token.Input)
               {
                 case "true":
@@ -143,6 +147,9 @@

             case Json5TokenType.Identifier:
             case Json5TokenType.String:
+              // All identifiers are valid as keys
+              // even if they are literals like
+              // `true`, `null`, or `Infinity`.
               key = token.String;
               this.state = State.AfterObjectKey;
               goto start;


small change to FormItemModel

small change to FormItemModel

--- FormsGeneratorWebApplication/Models/FormItemModel.cs
+++ FormsGeneratorWebApplication/Models/FormItemModel.cs
@@ -27,7 +27,7 @@
         [Display(Name = "options")]
         public virtual IList<OptionsModel> options { get; set; }

-        public virtual IList<string> selected { get; set; }
+        public virtual IList<SelectedModel> selected { get; set; }

         public int selectedOption { get; set; }


Updated the LocalizedFormat() method to prevent the runtime error on x86_64 systems

--- Utilities/NSStringUtility.cs
+++ Utilities/NSStringUtility.cs
@@ -34,6 +34,10 @@

             if (args == null)
                 throw new ArgumentNullException(nameof(args));
+
+            // Falls back to return the format itself to prevent runtime error on x86_64 systems
+            if (Runtime.Arch == Arch.SIMULATOR && IntPtr.Size == 8)
+                return format;

             using (var str = NSObject.Alloc(new Class(typeof(NSString))))
             using (var varargs = new VariadicArgumentList(args))


update

update

--- Applications/fm/Program.cs
+++ Applications/fm/Program.cs
@@ -37,8 +37,15 @@
             string tt = "                              File Functions                                   ".Replace(" ", "\u2500");
             win5.Text = tt;

+            //path
+            DosWindow win6 = new DosWindow(0, 2, 80, 1, "");
+            win6.SetColors(ConsoleColor.Black, ConsoleColor.White);
+            win6.showBorder = false;
+            win6.Draw();
+            win6.Text = @"Path=C:\*.*";
+
             //top green line
-            DosWindow win3 = new DosWindow(0, 4, 80, 1, "");
+            DosWindow win3 = new DosWindow(0, 3, 80, 1, "");
             win3.SetColors(ConsoleColor.Green, ConsoleColor.White);
             win3.showBorder = false;
             win3.Draw();


Updated Classification of Configured Part to NoTemplate

--- Aras.Model.Design/Order.cs
+++ Aras.Model.Design/Order.cs
@@ -181,7 +181,7 @@

                     // Update Properties of Configured Part
                     this.ConfiguredPart.Update(this.Transaction);
-                    this.ConfiguredPart.Class = this.ConfiguredPart.ItemType.GetClassName("Assembly");
+                    this.ConfiguredPart.Class = this.ConfiguredPart.ItemType.GetClassName("NoTemplate");
                     this.ConfiguredPart.Property("name").Value = this.Property("name").Value;
                     this.ConfiguredPart.Property("description").Value = this.Property("description").Value;


Fixed movement - no more walking on water

--- Assets/AnimalController.cs
+++ Assets/AnimalController.cs
@@ -150,8 +150,8 @@
 						}
 					}
 				}
-				else
-				{
+				//else
+				//{
 					// If there would be a collision, probabilistically change the animal's direction (can't stay in same direction)
 					// For now, all objects are treated as walls
 					getAdjacentTileCoords(ref tileCoords, direction);
@@ -223,7 +223,7 @@
 							break;
 						}
 					}
-				}
+				//}
 			}

 			// Regardless of whether or not the velocity has changed, update the position


fix mark parsing

fix mark parsing

--- IPTables.Net/Iptables/Modules/TProxy/TProxyModule.cs
+++ IPTables.Net/Iptables/Modules/TProxy/TProxyModule.cs
@@ -63,7 +63,7 @@

                     SetMark(FlexibleInt32.Parse(s1[0]), s1.Length == 1 ? DefaultMask : FlexibleInt32.Parse(s1[1]));

-                    return 0;
+                    return 1;
             }

             return 0;


adding Entry Update

adding Entry Update

--- src/ImTools/ImTools.cs
+++ src/ImTools/ImTools.cs
@@ -1663,7 +1663,11 @@
             var sourceCount = source.Length;
             index = index < 0 ? sourceCount : index;
             var result = new T[index < sourceCount ? sourceCount : sourceCount + 1];
-            Array.Copy(source, result, sourceCount);
+            if (sourceCount < 6)
+                for (var i = 0; i < sourceCount; ++i)
+                    result[i] = source[i];
+            else
+                Array.Copy(source, 0, result, 0, sourceCount);
             result[index] = value;
             return result;
         }
@@ -3031,6 +3035,10 @@
         public override Entry GetEntryOrNull(int hash, K key) =>
             Hash == hash && Key.Equals(key) ? this : null;

+        /// <inheritdoc />
+        public override Entry Update(ImHashMapEntry<K, V> newEntry) =>
+            Key.Equals(newEntry.Key) ? newEntry : this.WithConflicting(newEntry);
+
 #if !DEBUG
         /// <inheritdoc />
         public override string ToString() => "{H: " + Hash + ", K: " + Key + ", V: " + Value + "}";
@@ -3052,6 +3060,17 @@
             var i = cs.Length - 1;
             while (i != -1 && !key.Equals(cs[i].Key)) --i;
             return i != -1 ? this : null;
+        }
+
+        /// <inheritdoc />
+        public override Entry Update(ImHashMapEntry<K, V> newEntry)
+        {
+            var key = newEntry.Key;
+            var cs = Conflicts;
+            var n = cs.Length;
+            var i = n - 1;
+            while (i != -1 && !key.Equals(cs[i].Key)) --i;
+            return new HashConflictingEntry<K, V>(Hash, cs.AppendOrUpdate(newEntry, i));
         }

 #if !DEBUG
@@ -3127,6 +3146,9 @@

             /// Lookup for the entry by Hash and Key
             public abstract Entry GetEntryOrNull(int hash, K key);
+
+            /// Updating the entry with the new one
+            public abstract Entry Update(ImHashMapEntry<K, V> newEntry);

             /// <inheritdoc />
             public sealed override ImHashMap<K, V> AddOrGetEntry(int hash, Entry entry) =>
@@ -5272,6 +5294,11 @@
         [MethodImpl((MethodImplOptions)256)]
         public static ImHashMapEntry<K, V> Entry<K, V>(int hash, K key, V value) => new ImHashMapEntry<K, V>(hash, key, value);

+        /// Creates the conflicting entry out of two entries
+        [MethodImpl((MethodImplOptions)256)]
+        internal static ImHashMap<K, V>.Entry WithConflicting<K, V>(this ImHashMapEntry<K, V> one, ImHashMapEntry<K, V> two) =>
+            new HashConflictingEntry<K, V>(one.Hash, one, two);
+
         private sealed class GoRightInBranch3<K, V>
         {
             public ImHashMap<K, V>.Branch3 Br3;
@@ -6296,7 +6323,7 @@

             var oldEntryOrMap = map.AddOrGetEntry(hash, newEntry);
             if (oldEntryOrMap is ImHashMap<K, V>.Entry oldEntry)
-                return map.ReplaceEntry(hash, oldEntry, UpdateEntry(oldEntry, newEntry));
+                return map.ReplaceEntry(hash, oldEntry, oldEntry.Update(newEntry));

             return oldEntryOrMap;
         }
@@ -6311,28 +6338,9 @@
             var hash = newEntry.Hash;
             var oldEntryOrMap = map.AddOrGetEntry(hash, newEntry);
             if (oldEntryOrMap is ImHashMap<K, V>.Entry oldEntry)
-                return map.ReplaceEntry(hash, oldEntry, UpdateEntry(oldEntry, newEntry));
+                return map.ReplaceEntry(hash, oldEntry, oldEntry.Update(newEntry));

             return oldEntryOrMap;
-        }
-
-        private static ImHashMap<K, V>.Entry UpdateEntry<K, V>(ImHashMap<K, V>.Entry oldEntry, ImHashMapEntry<K, V> newEntry)
-        {
-            if (oldEntry is ImHashMapEntry<K, V> kv)
-                return kv.Key.Equals(newEntry.Key) ? newEntry
-                     : (ImHashMap<K, V>.Entry)new HashConflictingEntry<K, V>(oldEntry.Hash, kv, newEntry);
-
-            var hc = (HashConflictingEntry<K, V>)oldEntry;
-            var key = newEntry.Key;
-            var cs = hc.Conflicts;
-            var n = cs.Length;
-            var i = n - 1;
-            while (i != -1 && !key.Equals(cs[i].Key)) --i;
-            var newConflicts = new ImHashMapEntry<K, V>[i != -1 ? n : n + 1];
-            Array.Copy(cs, 0, newConflicts, 0, n);
-            newConflicts[i != -1 ? i : n] = newEntry;
-
-            return new HashConflictingEntry<K, V>(oldEntry.Hash, newConflicts);
         }

         /// Adds or updates (no in-place mutation) the map with value by the passed key, always returning the NEW map!


Event class utility functions

Event class utility functions

Most notably, added AreEventSchedulesEqual().

--- ScheduleWidget/ScheduleWidget/ScheduledEvents/Event.cs
+++ ScheduleWidget/ScheduleWidget/ScheduledEvents/Event.cs
@@ -183,6 +183,7 @@
         /// Returns the start and end date for this event as a date range instance.
         /// If the event does not have a start date or end date, the date range values will be
         /// DateTime.MinValue and DateTime.MaxValue, respectively.
+        /// The dates included in this range will never be null.
         /// </summary>
         public DateRange GetEventLimitsAsDateRange()
         {
@@ -252,25 +253,140 @@
         }

         /// <summary>
-        /// HasOccurrences,
+        /// CanProduceOccurrences,
         /// This will return true if this event is capable of generating occurrences, otherwise false.
         /// </summary>
-        public bool HasOccurrences()
-        {
-            if (FrequencyTypeOptions == FrequencyTypeEnum.Weekly && DaysOfWeekOptions == 0)
+        public bool CanProduceOccurrences()
+        {
+            if (HasBrokenZeroOccurrenceConfiguration())
                 return false;
-            if (FrequencyTypeOptions == FrequencyTypeEnum.Yearly && Anniversary == null)
-                return false;
-            if (StartDateTime == null || EndDateTime == null)
-                return true;
-            if (StartDateTime == DateTime.MinValue || EndDateTime == DateTime.MaxValue)
+            int manyYears = 210;
+            int largeRepeatInterval = 100;
+            DateRange eventLimits = GetEventLimitsAsDateRange();
+            if (RepeatInterval < largeRepeatInterval &&
+                (eventLimits.EndDateTime.Year - eventLimits.StartDateTime.Year) > manyYears)
                 return true;
             Schedule schedule = new Schedule(this);
-            DateRange occurrenceRange = schedule.DateRangeForPreviousOrNextOccurrence(
-                (DateTime)StartDateTime, false, null);
-            IEnumerable<DateTime> occurrences = schedule.Occurrences(occurrenceRange);
-            foreach (DateTime date in occurrences) { return true; }
+            DateTime? occurrence = schedule.NextOccurrence(eventLimits.StartDateTime);
+            if (occurrence != null) { return true; }
             return false;
+        }
+
+        /// <summary>
+        /// RoughlyEstimateMinimumEventOccurrences,
+        /// This will return a very rough, and conservative, guess of the minimum number of occurrences
+        /// that should be generated by a particular event.
+        /// </summary>
+        static public int RoughlyEstimateMinimumEventOccurrences(Event eventInstance)
+        {
+            if (eventInstance.HasBrokenZeroOccurrenceConfiguration()) { return 0; }
+            int repeatInterval = eventInstance.RepeatInterval;
+            DateRange eventLimits = eventInstance.GetEventLimitsAsDateRange();
+            TimeSpan timeSpan = eventLimits.EndDateTime - eventLimits.StartDateTime;
+            int spanDays = timeSpan.Days;
+            int spanWeeks = timeSpan.Days / 7;
+            int result = 0;
+            switch (eventInstance.FrequencyTypeOptions)
+            {
+                case FrequencyTypeEnum.None:
+                    result = 1;
+                    break;
+                case FrequencyTypeEnum.Daily:
+                    result = (spanDays / repeatInterval) - 1;
+                    break;
+                case FrequencyTypeEnum.Weekly:
+                    int includedDays = 0;
+                    includedDays += eventInstance.DaysOfWeekOptions.HasFlag(DayOfWeekEnum.Mon) ? 1 : 0;
+                    includedDays += eventInstance.DaysOfWeekOptions.HasFlag(DayOfWeekEnum.Tue) ? 1 : 0;
+                    includedDays += eventInstance.DaysOfWeekOptions.HasFlag(DayOfWeekEnum.Wed) ? 1 : 0;
+                    includedDays += eventInstance.DaysOfWeekOptions.HasFlag(DayOfWeekEnum.Thu) ? 1 : 0;
+                    includedDays += eventInstance.DaysOfWeekOptions.HasFlag(DayOfWeekEnum.Fri) ? 1 : 0;
+                    includedDays += eventInstance.DaysOfWeekOptions.HasFlag(DayOfWeekEnum.Sat) ? 1 : 0;
+                    includedDays += eventInstance.DaysOfWeekOptions.HasFlag(DayOfWeekEnum.Sun) ? 1 : 0;
+                    result = ((spanWeeks / repeatInterval) * includedDays) - 1;
+                    break;
+                case FrequencyTypeEnum.EveryWeekDay:
+                    result = ((spanWeeks / repeatInterval) * 5) - 1;
+                    break;
+                case FrequencyTypeEnum.EveryMonWedFri:
+                    result = ((spanWeeks / repeatInterval) * 3) - 1;
+                    break;
+                case FrequencyTypeEnum.EveryTuTh:
+                    result = ((spanWeeks / repeatInterval) * 2) - 1;
+                    break;
+                case FrequencyTypeEnum.Monthly:
+                    int spanMonths = spanDays / 31;
+                    result = (spanMonths / repeatInterval) - 1;
+                    break;
+                case FrequencyTypeEnum.Quarterly:
+                    int spanQuarters = spanDays / 92;
+                    result = (spanQuarters / repeatInterval) - 1;
+                    break;
+                case FrequencyTypeEnum.Yearly:
+                    int spanYears = spanDays / 365;
+                    result = (spanYears / repeatInterval) - 1;
+                    break;
+            }
+            return (result > 0) ? result : 0;
+        }
+
+        /// <summary>
+        /// HasBrokenZeroOccurrenceConfiguration,
+        /// This will return true if this event has certain invalid, broken configurations that will
+        /// generate zero occurrences.
+        /// </summary>
+        private bool HasBrokenZeroOccurrenceConfiguration()
+        {
+            if (FrequencyTypeOptions == FrequencyTypeEnum.Weekly && DaysOfWeekOptions == 0)
+                return true;
+            if (FrequencyTypeOptions == FrequencyTypeEnum.Yearly && Anniversary == null)
+                return true;
+            return false;
+        }
+
+        /// <summary>
+        /// AreEventSchedulesEqual,
+        /// This will return true if the two supplied event instances have equivalent scheduling information.
+        /// For example, if both schedules occur every 3 months on day 7, then this will return true.
+        /// This only compares the scheduling details.
+        /// It specifically does not compare the following fields for equality:
+        /// ID, Title, NumberOfOccurrencesThatWasLastSet.
+        /// </summary>
+        static public bool AreEventSchedulesEqual(Event first, Event second)
+        {
+            // Return false if either event is null.
+            if (first == null || second == null)
+                return false;
+            // Compare simple fields in alphabetical order.
+            if (first.DayOfMonth != second.DayOfMonth) return false;
+            if (first.DaysOfWeek != second.DaysOfWeek) return false;
+            if (first.EndDateTime != second.EndDateTime) return false;
+            if (first.Frequency != second.Frequency) return false;
+            if (first.MonthlyInterval != second.MonthlyInterval) return false;
+            if (first.OneTimeOnlyEventDate != second.OneTimeOnlyEventDate) return false;
+            if (first.QuarterInterval != second.QuarterInterval) return false;
+            if (first.QuarterlyInterval != second.QuarterlyInterval) return false;
+            if (first.RepeatInterval != second.RepeatInterval) return false;
+            if (first.StartDateTime != second.StartDateTime) return false;
+            // Compare subclasses.
+            if (first.Anniversary == null && second.Anniversary != null) return false;
+            if (first.Anniversary != null)
+            {
+                if (second.Anniversary == null) return false;
+                if (first.Anniversary.Day != second.Anniversary.Day) return false;
+                if (first.Anniversary.Month != second.Anniversary.Month) return false;
+            }
+            if (first.RangeInYear == null && second.RangeInYear != null) return false;
+            if (first.RangeInYear != null)
+            {
+                if (second.RangeInYear == null) return false;
+                if (first.RangeInYear.EndDayOfMonth != second.RangeInYear.EndDayOfMonth) return false;
+                if (first.RangeInYear.EndMonth != second.RangeInYear.EndMonth) return false;
+                if (first.RangeInYear.StartDayOfMonth != second.RangeInYear.StartDayOfMonth) return false;
+                if (first.RangeInYear.StartMonth != second.RangeInYear.StartMonth) return false;
+            }
+            // If we got this far, it means all the compared fields were equal.
+            return true;
         }
     }
 }


Add missing CharSet

Add missing CharSet

--- src/Msi.Desktop/Msi.cs
+++ src/Msi.Desktop/Msi.cs
@@ -23,7 +23,7 @@
         /// To perform an administrative installation, include ACTION=ADMIN in szCommandLine. For more information, see the ACTION property.
         /// </param>
         /// <returns><see cref="Win32ErrorCode.ERROR_SUCCESS"/> when the function completes successfully. Otherwise an error code.</returns>
-        [DllImport(nameof(Msi))]
+        [DllImport(nameof(Msi), CharSet = CharSet.Unicode)]
         public static extern Win32ErrorCode MsiInstallProduct(string szPackagePath, string szCommandLine);
     }
 }


add missing services

add missing services

--- src/Namster/Startup.cs
+++ src/Namster/Startup.cs
@@ -6,6 +6,7 @@
 using Microsoft.Extensions.Configuration;
 using Microsoft.Extensions.DependencyInjection;
 using Microsoft.Extensions.Logging;
+using Namster.Services;

 namespace Namster
 {
@@ -36,7 +37,11 @@
         // This method gets called by the runtime. Use this method to add services to the container.
         public void ConfigureServices(IServiceCollection services)
         {
+            services.AddSingleton<IConfiguration>(_ => Configuration);
+
             services.AddAuthentication(sharedOptions => sharedOptions.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme);
+
+            services.AddTransient<ISearchService, SearchService>();

             // Add framework services.
             services.AddMvc();


Remove locks from RenderedViewport class to fix RH-70028

--- Viewport/RenderedViewport.cs
+++ Viewport/RenderedViewport.cs
@@ -171,7 +171,7 @@
 		}

 		private Thread _modalThread;
-		private readonly object timerLock = new object();
+		//private readonly object timerLock = new object();
 		IAllSettings eds;

 		public override bool StartRenderer(int w, int h, RhinoDoc doc, ViewInfo rhinoView, ViewportInfo viewportInfo, bool forCapture, RenderWindow renderWindow)
@@ -314,7 +314,7 @@
 		{
 			if (_cycles?.IsRendering ?? false)
 			{
-				lock (timerLock)
+				//lock (timerLock)
 				{
 					if (!IsSynchronizing)
 					{
@@ -336,16 +336,19 @@

 		void CyclesStartSynchronizing(object sender, EventArgs e)
 		{
-			lock (timerLock)
-			{
+			//ALB 2022/09/14
+			//https://mcneel.myjetbrains.com/youtrack/issue/RH-70028/Raytraced-crash-when-switching-to-other-display-mode
+			//write operation for bool is atomic in C#
+			//lock (timerLock)
+			//{
 				IsSynchronizing = true;
-			}
+			//}
 		}

 		void CyclesSynchronized(object sender, EventArgs e)
 		{
 			_startTime = DateTime.UtcNow;
-			lock (timerLock)
+			//lock (timerLock)
 			{
 				_samples = -1;
 				_frameAvailable = false;
@@ -478,7 +481,7 @@
 		public override bool IsCompleted()
 		{
 			bool rc = false;
-			lock (timerLock)
+			//lock (timerLock)
 			{
 				if (_forCapture)
 				{
@@ -520,8 +523,11 @@

 		public override int LastRenderedPass()
 		{
-			int samplesLocal;
-			lock(timerLock)
+			//ALB 2022/09/14
+			//https://mcneel.myjetbrains.com/youtrack/issue/RH-70028/Raytraced-crash-when-switching-to-other-display-mode
+			//read operation for int is atomic in C#
+			int samplesLocal = _samples;
+			//lock(timerLock)
 			{
 				samplesLocal = _samples;
 			}


new call format

new call format

--- src/Namster/Startup.cs
+++ src/Namster/Startup.cs
@@ -67,11 +67,11 @@

             app.UseStaticFiles();

-            app.UseCookieAuthentication(options =>
+            app.UseCookieAuthentication(new CookieAuthenticationOptions()
             {
-                options.AutomaticAuthenticate = true;
-                options.AutomaticChallenge = true;
-                options.LoginPath = new PathString("/home/caslogin");
+                AutomaticAuthenticate = true,
+                AutomaticChallenge = true,
+                LoginPath = new PathString("/home/caslogin")
             });


added optional logging to configuration manager

--- Infrastructure/Configuration/ConfigurationManager.cs
+++ Infrastructure/Configuration/ConfigurationManager.cs
@@ -1,7 +1,10 @@
 namespace SexyFishHorse.CitiesSkylines.Infrastructure.Configuration
 {
+    using System;
     using System.Collections.Generic;
     using System.Linq;
+    using JetBrains.Annotations;
+    using SexyFishHorse.CitiesSkylines.Logger;

     public class ConfigurationManager
     {
@@ -14,39 +17,36 @@
             configStore = new ConfigStore(modName, modName + ".xml");
         }

+        public ILogger Logger { get; set; }
+
         public T GetSetting<T>(string settingKey)
         {
             EnsureConfigLoaded();

             if (configuration.Settings.Any(x => x.Key == settingKey))
             {
-                return (T)configuration.Settings.Single(x => x.Key == settingKey).Value;
+                var value = configuration.Settings.Single(x => x.Key == settingKey).Value;
+                try
+                {
+                    return (T)value;
+                }
+                catch (InvalidCastException ex)
+                {
+                    var message = string.Format(
+                        "Tried to cast value '{0}' of type '{1}' to '{2}'.",
+                        value,
+                        value.GetType().Name,
+                        typeof(T).Name);
+
+                    TryLogError(message);
+
+                    throw new InvalidCastException(message, ex);
+                }
             }

+            TryLog("No setting found for {0}", settingKey);
+
             return default(T);
-        }
-
-        public void SaveSetting(string settingKey, object value)
-        {
-            EnsureConfigLoaded();
-
-            if (configuration.Settings.Any(x => x.Key == settingKey))
-            {
-                configuration.Settings.Remove(configuration.Settings.Single(x => x.Key == settingKey));
-            }
-
-            var newKeyValuePair = new KeyValuePair<string, object>(settingKey, value);
-            configuration.Settings.Add(newKeyValuePair);
-
-            configStore.SaveConfigToFile(configuration);
-        }
-
-        private void EnsureConfigLoaded()
-        {
-            if (configuration == null)
-            {
-                configuration = configStore.LoadConfigFromFile();
-            }
         }

         public void Migrate<T>(string oldSettingKey, string newSettingKey)
@@ -64,6 +64,35 @@
             SaveSetting(newSettingKey, (T)settingValue.Value);

             configStore.SaveConfigToFile(configuration);
+
+            TryLog("Migrated {0} to {1}", oldSettingKey, newSettingKey);
+        }
+
+        public void SaveSetting(string settingKey, object value)
+        {
+            EnsureConfigLoaded();
+
+            if (configuration.Settings.Any(x => x.Key == settingKey))
+            {
+                configuration.Settings.Remove(configuration.Settings.Single(x => x.Key == settingKey));
+            }
+
+            var newKeyValuePair = new KeyValuePair<string, object>(settingKey, value);
+            configuration.Settings.Add(newKeyValuePair);
+
+            configStore.SaveConfigToFile(configuration);
+
+            TryLog("Saved setting " + settingKey + " with value " + value);
+        }
+
+        private void EnsureConfigLoaded()
+        {
+            if (configuration == null)
+            {
+                configuration = configStore.LoadConfigFromFile();
+
+                TryLog("Loaded config from file");
+            }
         }

         private void RemoveSetting(string settingKey)
@@ -72,6 +101,25 @@
             configuration.Settings.Remove(setting);

             configStore.SaveConfigToFile(configuration);
+
+            TryLog("Removed setting for {0}", settingKey);
+        }
+
+        [StringFormatMethod("format")]
+        private void TryLog(string format, params object[] args)
+        {
+            if (Logger != null)
+            {
+                Logger.Info(format, args);
+            }
+        }
+
+        private void TryLogError(string message)
+        {
+            if (Logger != null)
+            {
+                Logger.Error(message);
+            }
         }
     }
-}+}


Delete AssemblyInfo.cs

Delete AssemblyInfo.cs

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


Some 'optimization' stuff in Graph.cs

Some 'optimization' stuff in Graph.cs

--- src/PowerPing/Graph.cs
+++ src/PowerPing/Graph.cs
@@ -62,7 +62,7 @@
         private int m_NormalLegendLeftPadding = 13;
         private int m_NormalYAxisLeftPadding = 11;
         private int m_NormalYAxisLength = 20;
-        private int m_NormalXAxisLength = 40;
+        private int m_NormalXAxisLength = 70;
         private int m_CompactLegendLeftPadding = 2;
         private int m_CompactYAxisLeftPadding = 5;
         private int m_CompactYAxisLength = 10;
@@ -243,20 +243,17 @@
                 // This causes us to draw a continous lower line of red when we are continously timing out
                 // Instead of always drawing big red lines, we draw them at either end of the continous zone
                 // I think it will just look nicer, it will cause slightly hackier code but oh well
-                bool drawTimeoutSegment = false;
-
-                // Alternate colour between columns for clarity
-                if (x % 2 == 0) {
-                    color = ConsoleColor.Gray;
-                } else {
-                    color = ConsoleColor.DarkGray;
-                }
+                bool drawTimeoutSegment = false;
+
+                // Column type
+                bool timeout = false;
+                bool current = false;
+
                 if (x == m_ResponseTimes.Count - 1) {
-                    color = ConsoleColor.Green;
-                }
-                if (m_ResponseTimes[x] == 0)
-                {
-                    color = ConsoleColor.DarkRed;
+                    current = true;
+                }
+                if (m_ResponseTimes[x] == 0) {
+                    timeout = true;
                 }

                 // So to get a timeout segment we peak at the elements ahead and behind to check they are timeouts
@@ -269,7 +266,7 @@
                     drawTimeoutSegment = true;
                 }

-                DrawSingleColumn(CreateColumn(m_ResponseTimes[x]), color, drawTimeoutSegment);
+                DrawSingleColumn(CreateColumn(m_ResponseTimes[x]), current, timeout, drawTimeoutSegment);

                 Console.CursorLeft++;
             }
@@ -370,12 +367,11 @@
         /// <summary>
         /// Draw graph bar
         /// </summary>
-        /// <param name="column">Column segments in array</param>
-        private void DrawSingleColumn(string[] column, ConsoleColor color, bool timeoutSegment)
+        private void DrawSingleColumn(string[] column, bool current, bool timeout, bool timeoutSegment)
         {
             // save cursor location
-            int cursorPositionX = Console.CursorLeft;
-            int cursorPositionY = Console.CursorTop;
+            int startingCursorPositionX = Console.CursorLeft;
+            int startingCursorPositionY = Console.CursorTop;

             if (timeoutSegment)
             {
@@ -388,42 +384,52 @@
             bool inverting = false;
             foreach (string segment in column)
             {
-                if (color != ConsoleColor.DarkGray && color != ConsoleColor.Gray)
-                {
-
-                    Console.ForegroundColor = color;
+
+                // Determine colour of segment
+                if (timeout)
+                {
+                    Console.ForegroundColor = ConsoleColor.DarkRed;
+                }
+                else if (current)
+                {
+                    Console.ForegroundColor = ConsoleColor.Green;
+                }
+                else if (inverting)
+                {
+                    Console.ForegroundColor = ConsoleColor.Gray;
+                    inverting = false;
                 }
                 else
                 {
-                    if (inverting)
-                    {
-                        Console.ForegroundColor = ConsoleColor.Gray;
-                        inverting = false;
-                    }
-                    else
-                    {
-                        inverting = true;
-                        Console.ForegroundColor = ConsoleColor.DarkGray;
-                    }
+                    Console.ForegroundColor = ConsoleColor.DarkGray;
+                    inverting = true;
                 }

                 Console.Write(segment);

+                // in an attempt to save time by not always accessing
+                // Console.Cursor positions too many times (doesn't really
+                // make that much of a difference)
+                int cursorPositionLeft = Console.CursorLeft;
+                int cursorPositionTop = Console.CursorTop;
+
                 // Stop over drawing at the top of the graph
-                if (Console.CursorTop == m_yAxisStart)
+                if (cursorPositionTop == m_yAxisStart)
                 {
                     break;
                 }

-                if (Console.CursorTop != 0)
-                {
-                    Console.CursorTop--;
-                    Console.CursorLeft--;
+                if (cursorPositionTop != 0)
+                {
+                    cursorPositionTop--;
+                    cursorPositionLeft--;
+
+                    Console.SetCursorPosition(cursorPositionLeft, cursorPositionTop);
                 }
             }

             // Reset cursor to starting position
-            Console.SetCursorPosition(cursorPositionX, cursorPositionY);
+            Console.SetCursorPosition(startingCursorPositionX, startingCursorPositionY);
         }
         public void DrawYAxisLabels()
         {


renaming from the evil and marking some lambdas as static!

--- playground/ImTools.Benchmarks/ZIO.cs
+++ playground/ImTools.Benchmarks/ZIO.cs
@@ -23,151 +23,151 @@
 using NUnit.Framework;
 //using System.Runtime.CompilerServices;
 using static System.Console;
-using static ImTools.UnitTests.Playground.Z;
+using static ImTools.UnitTests.Playground.S;

 namespace ImTools.UnitTests.Playground
 {
-    public interface ZErased { }
-
-    public interface Z<out A> : ZErased
+    public interface SErased { }
+
+    public interface S<out A> : SErased
     {
         void Run(Action consume);
     }

-    public abstract record ZImpl : Z
+    public abstract record SImpl : S
     {
         public void Run(Action consume)
         {
-            var z = this.Then(consume, (consume_, a) => Z.Do(a, consume_));
+            var s = this.Then(consume, static (consume_, a) => S.Do(a, consume_));

             // todo: @api await the fiber context - so make it awaitable
-            new ZFiberContext<Empty>(z, Z.DefaultFiberRunner);
-        }
-    }
-
-    interface ZVal
+            new SFiberContext<Empty>(s, S.DefaultFiberRunner);
+        }
+    }
+
+    interface SVal
     {
         object Value { get; }
     }

-    public sealed record ZVal(A Value) : ZImpl, ZVal
-    {
-        object ZVal.Value => Value;
-    }
-
-    interface ZLazy
+    public sealed record SVal(A Value) : SImpl, SVal
+    {
+        object SVal.Value => Value;
+    }
+
+    interface SLazy
     {
         object GetValue();
     }

-    public sealed record ZLazy(Func GetValue) : ZImpl, ZLazy
-    {
-        object ZLazy.GetValue() => GetValue();
-    }
-
-    public sealed record ZLazy<S, A>(S State, Func<S, A> GetValue) : ZImpl, ZLazy
-    {
-        object ZLazy.GetValue() => GetValue(State);
-    }
-
-    public sealed record ZLazyDo(Action Act) : ZImpl<Empty>, ZLazy
-    {
-        object ZLazy.GetValue() { Act(); return empty; }
-    }
-
-    public sealed record ZLazyDo<S>(S State, Action<S> Act) : ZImpl<Empty>, ZLazy
-    {
-        object ZLazy.GetValue() { Act(State); return empty; }
-    }
-
-    public sealed record ZLazyDo<S1, S2>(S1 State1, S2 State2, Action<S1, S2> Act) : ZImpl<Empty>, ZLazy
-    {
-        object ZLazy.GetValue() { Act(State1, State2); return empty; }
-    }
-
-    interface ZFork
+    public sealed record SLazy(Func GetValue) : SImpl, SLazy
+    {
+        object SLazy.GetValue() => GetValue();
+    }
+
+    public sealed record SLazy<S, A>(S State, Func<S, A> GetValue) : SImpl, SLazy
+    {
+        object SLazy.GetValue() => GetValue(State);
+    }
+
+    public sealed record SLazyDo(Action Act) : SImpl<Empty>, SLazy
+    {
+        object SLazy.GetValue() { Act(); return empty; }
+    }
+
+    public sealed record SLazyDo<S>(S State, Action<S> Act) : SImpl<Empty>, SLazy
+    {
+        object SLazy.GetValue() { Act(State); return empty; }
+    }
+
+    public sealed record SLazyDo<S1, S2>(S1 State1, S2 State2, Action<S1, S2> Act) : SImpl<Empty>, SLazy
+    {
+        object SLazy.GetValue() { Act(State1, State2); return empty; }
+    }
+
+    interface SFork
     {
         object GetFiber(Func<Action, object> runner);
     }

-    public sealed record ZFork(Z Za, Func<Z, Func<Action, object>, ZFiber> GetFiber) : ZImpl<ZFiber>, ZFork
-    {
-        object ZFork.GetFiber(Func<Action, object> runner) => GetFiber(Za, runner);
-    }
-
-    public sealed record ZShift(Func<Action, object> Runner) : ZImpl<Empty> { }
-
-    interface ZThen
-    {
-        ZErased Za { get; }
-        ZErased Cont(object a);
-    }
-
-    public sealed record ZThen(Z Za, Func<A, Z> Cont) : ZImpl, ZThen
-    {
-        ZErased ZThen.Za => Za;
-        ZErased ZThen.Cont(object a) => Cont((A)a);
-    }
-
-    public sealed record ZThen<S, A, B>(Z Za, S State, Func<S, A, Z> Cont) : ZImpl, ZThen
-    {
-        ZErased ZThen.Za => Za;
-        ZErased ZThen.Cont(object a) => Cont(State, (A)a);
-    }
-
-    public sealed record ZThen<S1, S2, A, B>(Z Za, S1 State1, S2 State2, Func<S1, S2, A, Z> Cont) : ZImpl, ZThen
-    {
-        ZErased ZThen.Za => Za;
-        ZErased ZThen.Cont(object a) => Cont(State1, State2, (A)a);
-    }
-
-    interface ZAsync
+    public sealed record SFork(S Za, Func<S, Func<Action, object>, SFiber> GetFiber) : SImpl<SFiber>, SFork
+    {
+        object SFork.GetFiber(Func<Action, object> runner) => GetFiber(Za, runner);
+    }
+
+    public sealed record SShift(Func<Action, object> Runner) : SImpl<Empty> { }
+
+    interface SThen
+    {
+        SErased Sa { get; }
+        SErased Cont(object a);
+    }
+
+    public sealed record SThen(S Sa, Func<A, S> Cont) : SImpl, SThen
+    {
+        SErased SThen.Sa => Sa;
+        SErased SThen.Cont(object a) => Cont((A)a);
+    }
+
+    public sealed record SThen<S, A, B>(S Sa, S State, Func<S, A, S> Cont) : SImpl, SThen
+    {
+        SErased SThen.Sa => Sa;
+        SErased SThen.Cont(object a) => Cont(State, (A)a);
+    }
+
+    public sealed record SThen<S1, S2, A, B>(S Sa, S1 State1, S2 State2, Func<S1, S2, A, S> Cont) : SImpl, SThen
+    {
+        SErased SThen.Sa => Sa;
+        SErased SThen.Cont(object a) => Cont(State1, State2, (A)a);
+    }
+
+    interface SAsync
     {
         void Schedule(object state, Action<object, object> run);
     }

-    public sealed record ZAsyncFriendly<S, A>(S State, Action<S, Action> Schedule) : ZImpl, ZAsync
-    {
-        void ZAsync.Schedule(object state, Action<object, object> run) => Schedule(State, a => run(state, a));
-    }
-
-    public sealed record ZAsync(Action<object, object, Action<object, object, A>> Schedule) : ZImpl, ZAsync
-    {
-        void ZAsync.Schedule(object state, Action<object, object> run) => Schedule(run, state, (run_, state_, a) => ((Action<object, object>)run_)(state_, a));
-    }
-
-    public sealed record ZAsync<S, A>(S State, Action<S, object, object, Action<object, object, A>> Schedule) : ZImpl, ZAsync
-    {
-        void ZAsync.Schedule(object state, Action<object, object> run) => Schedule(State, run, state, (run_, state_, a) => ((Action<object, object>)run_)(state_, a));
-    }
-
-    public interface ZFiber<out A>
-    {
-        Z Join();
-        //Z<Empty> Interrupt() => throw new NotImplementedException("todo");
-    }
-
-    sealed record ZFiberContext : ZFiber
-    {
-        public ZErased Za { get; private set; }
+    public sealed record SAsyncFriendly<S, A>(S State, Action<S, Action> Schedule) : SImpl, SAsync
+    {
+        void SAsync.Schedule(object state, Action<object, object> run) => Schedule(State, a => run(state, a));
+    }
+
+    public sealed record SAsync(Action<object, object, Action<object, object, A>> Schedule) : SImpl, SAsync
+    {
+        void SAsync.Schedule(object state, Action<object, object> run) => Schedule(run, state, (run_, state_, a) => ((Action<object, object>)run_)(state_, a));
+    }
+
+    public sealed record SAsync<S, A>(S State, Action<S, object, object, Action<object, object, A>> Schedule) : SImpl, SAsync
+    {
+        void SAsync.Schedule(object state, Action<object, object> run) => Schedule(State, run, state, (run_, state_, a) => ((Action<object, object>)run_)(state_, a));
+    }
+
+    public interface SFiber<out A>
+    {
+        S Join();
+        //S<Empty> Interrupt() => throw new NotImplementedException("todo");
+    }
+
+    sealed record SFiberContext : SFiber
+    {
+        public SErased Sa { get; private set; }
         public Func<Action, object> Runner { get; private set; }

         public readonly object _work; // todo: @wip what to do with this?

-        public ZFiberContext(Z za, Func<Action, object> runner)
-        {
-            Za = za;
+        public SFiberContext(S sa, Func<Action, object> runner)
+        {
+            Sa = sa;
             Runner = runner;
             _work = Runner(RunLoop);
         }

-        sealed record ContStack(ZThen Cont, ContStack Rest);
+        sealed record ContStack(SThen Cont, ContStack Rest);
         ContStack _stack;

-        abstract record EvalState;
-        sealed record Done(A Value) : EvalState;
-        sealed record Callbacks(Action<object, object, A> Act, object P0, object P1, Callbacks Rest) : EvalState;
-        EvalState _state;
+        abstract record EvilState;
+        sealed record Done(A Value) : EvilState;
+        sealed record Callbacks(Action<object, object, A> Act, object P0, object P1, Callbacks Rest) : EvilState;
+        EvilState _state;

         void Complete(A a)
         {
@@ -179,7 +179,7 @@
             }
         }

-        public Z Join() => Z.Async<ZFiberContext, A>(this, (f, s1, s2, run) =>
+        public S Join() => S.Async<SFiberContext, A>(this, (f, s1, s2, run) =>
         {
             if (f._state is Done doneFast)
                 run(s1, s2, doneFast.Value);
@@ -209,7 +209,7 @@
         {
             if (_stack is ContStack(var cont, var rest))
             {
-                Za = cont.Cont(val);
+                Sa = cont.Cont(val);
                 _stack = rest;
                 return true;
             }
@@ -217,9 +217,9 @@
             return false;
         }

-        void Resume(ZErased za)
-        {
-            Za = za;
+        void Resume(SErased sa)
+        {
+            Sa = sa;
             RunLoop();
         }

@@ -228,36 +228,36 @@
             var loop = true;
             while (loop)
             {
-                switch (Za)
+                switch (Sa)
                 {
-                    case ZVal v:
+                    case SVal v:
                         loop = Continue(v.Value);
                         break;

-                    case ZLazy l:
+                    case SLazy l:
                         loop = Continue(l.GetValue());
                         break;

-                    case ZFork f:
+                    case SFork f:
                         loop = Continue(f.GetFiber(Runner));
                         break;

-                    case ZShift s:
+                    case SShift s:
                         Runner = s.Runner;
                         loop = Continue(empty);
                         break;

-                    case ZThen t:
-                        Za = t.Za;
+                    case SThen t:
+                        Sa = t.Sa;
                         _stack = new ContStack(t, _stack);
                         break;

-                    case ZAsync a:
+                    case SAsync a:
                         loop = false;
                         if (_stack == null)
-                            a.Schedule(this, (f, x) => ((ZFiberContext)f).Complete((A)x));
+                            a.Schedule(this, (f, x) => ((SFiberContext)f).Complete((A)x));
                         else
-                            a.Schedule(this, (f, x) => ((ZFiberContext)f).Resume(x.Val()));
+                            a.Schedule(this, (f, x) => ((SFiberContext)f).Resume(x.Val()));
                         break;

                     case var unknown:
@@ -267,21 +267,21 @@
         }
     }

-    public static class Z
+    public static class S
     {
         public static readonly Func<Action, object> DefaultFiberRunner = Task.Run;

-        public static ZFiber RunUnsafeFiber(this Z za) => new ZFiberContext(za, DefaultFiberRunner);
+        public static SFiber RunUnsafeFiber(this S sa) => new SFiberContext(sa, DefaultFiberRunner);

         sealed class Box { public A Ab; public Box(A a) => Ab = a; }
         sealed class Box { public A Ab; public B Bb; public Box(A a, B b) { Ab = a; Bb = b; } }

-        public static A RunUnsafe(this Z za)
+        public static A RunUnsafe(this S sa)
         {
             using var e = new AutoResetEvent(false);
             var res = new Box(default, e);

-            RunUnsafeFiber(za.Then(res, (res1, a) => Z.Do(a, res1, (a1, res2) =>
+            RunUnsafeFiber(sa.Then(res, static (res1, a) => S.Do(a, res1, static (a1, res2) =>
             {
                 res2.Ab = a1;
                 res2.Bb.Set();
@@ -290,52 +290,53 @@
             return res.Ab;
         }

-        public static Z Val(this A a) => new ZVal(a);
-
-        public static Z Get(Func getA) => new ZLazy(getA);
-        public static Z Get<S, A>(in S state, Func<S, A> getA) => new ZLazy<S, A>(state, getA);
-
-        public static Z<Empty> Do(Action act) => new ZLazyDo(act);
-        public static Z<Empty> Do<S>(in S state, Action<S> act) => new ZLazyDo<S>(state, act);
-        public static Z<Empty> Do<S1, S2>(in S1 state1, in S2 state2, Action<S1, S2> act) => new ZLazyDo<S1, S2>(state1, state2, act);
+        public static S Val(this A a) => new SVal(a);
+
+        public static S Get(Func getA) => new SLazy(getA);
+        public static S Get<S, A>(in S state, Func<S, A> getA) => new SLazy<S, A>(state, getA);
+
+        public static S<Empty> Do(Action act) => new SLazyDo(act);
+        public static S<Empty> Do<S>(in S state, Action<S> act) => new SLazyDo<S>(state, act);
+        public static S<Empty> Do<S1, S2>(in S1 state1, in S2 state2, Action<S1, S2> act) => new SLazyDo<S1, S2>(state1, state2, act);

         /// This is Bind, SelectMany or FlatMap... but I want to be unique and go with Then for now as it seems to have a more precise meaning IMHO
-        public static Z Then(this Z za, Func<A, Z> @from) => new ZThen(za, @from);
-        public static Z Then<S, A, B>(this Z za, in S s, Func<S, A, Z> @from) => new ZThen<S, A, B>(za, s, @from);
-        public static Z Then<S1, S2, A, B>(this Z za, in S1 s1, in S2 s2, Func<S1, S2, A, Z> @from) => new ZThen<S1, S2, A, B>(za, s1, s2, @from);
-
-        public static Z To(this Z za, Func map) => za.Then(map, (map_, a) => map_(a).Val());
-
-        public static Z ToVal(this Z za, B b) => za.Then(b, (b_, _) => b_.Val());
-        public static Z ToGet(this Z za, Func getB) => za.Then(getB, (getB_, _) => getB_().Val());
-
-        public static Z<(A, B)> Zip(this Z za, Z zb) => za.Then(zb, (zb_, a) => zb_.Then(a, (a_, b) => Val((a_, b))));
-
-        public static Z<C> ZipWith(this Z za, Z zb, Func zip) => za.Then(zip, zb, (zip_, zb_, a) => zb.Then(zip_, a, (zip__, a_, b) => zip__(a_, b).Val()));
-
-        public static Z And(this Z za, Z zb) => za.Then(zb, (zb_, a) => zb_.Then(a, (a_, _) => a_.Val()));
-
-        public static Z RepeatN(this Z za, int n) => n <= 1 ? za : za.And(za.RepeatN(n - 1));
-
-        public static Z Async(Action<object, object, Action<object, object, A>> schedule) => new ZAsync(schedule);
-        public static Z Async<S, A>(in S state, Action<S, object, object, Action<object, object, A>> schedule) => new ZAsync<S, A>(state, schedule);
-
-        public static Z Async<S, A>(in S state, Action<S, Action> schedule) => new ZAsyncFriendly<S, A>(state, schedule);
+        public static S Then(this S sa, Func<A, S> @from) => new SThen(sa, @from);
+        public static S Then<S, A, B>(this S sa, in S s, Func<S, A, S> @from) => new SThen<S, A, B>(sa, s, @from);
+        public static S Then<S1, S2, A, B>(this S sa, in S1 s1, in S2 s2, Func<S1, S2, A, S> @from) => new SThen<S1, S2, A, B>(sa, s1, s2, @from);
+
+        public static S To(this S sa, Func map) => sa.Then(map, (map_, a) => map_(a).Val());
+
+        public static S ToVal(this S sa, B b) => sa.Then(b, (b_, _) => b_.Val());
+        public static S ToGet(this S sa, Func getB) => sa.Then(getB, (getB_, _) => getB_().Val());
+
+        public static S<(A, B)> Zip(this S sa, S zb) => sa.Then(zb, (zb_, a) => zb_.Then(a, (a_, b) => Val((a_, b))));
+
+        public static S<C> ZipWith(this S sa, S zb, Func zip) => sa.Then(zip, zb, (zip_, zb_, a) =>
+            zb.Then(zip_, a, static (zip__, a_, b) => zip__(a_, b).Val()));
+
+        public static S And(this S sa, S zb) => sa.Then(zb, static (zb_, a) => zb_.Then(a, static (a_, _) => a_.Val()));
+
+        public static S RepeatN(this S sa, int n) => n <= 1 ? sa : sa.And(sa.RepeatN(n - 1));
+
+        public static S Async(Action<object, object, Action<object, object, A>> schedule) => new SAsync(schedule);
+        public static S Async<S, A>(in S state, Action<S, object, object, Action<object, object, A>> schedule) => new SAsync<S, A>(state, schedule);
+
+        public static S Async<S, A>(in S state, Action<S, Action> schedule) => new SAsyncFriendly<S, A>(state, schedule);

         // todo: @perf @mem we may potentially reuse FiberContext when the RunLoop done or on Join?
-        public static Z<ZFiber> Fork(this Z za) => new ZFork(za, (z, runner) => new ZFiberContext(z, runner));
-
-        public static Z<Empty> Shift(Func<Action, object> runner) => new ZShift(runner);
+        public static S<SFiber> Fork(this S sa) => new SFork(sa, (z, runner) => new SFiberContext(z, runner));
+
+        public static S<Empty> Shift(Func<Action, object> runner) => new SShift(runner);

         // Here is the reference implementation of ZipPar with Linq paying the memory allocations and performance for the sugar clarity
-        // public static Z<(A, B)> ZipPar2(this Z za, Z zb) =>
-        //     from zaForked in za.Fork()
+        // public static Z<(A, B)> ZipPar2(this Z sa, Z zb) =>
+        //     from zaForked in sa.Fork()
         //     from b in zb
         //     from a in zaForked.Join()
         //     select (a, b);
         //
-        public static Z<(A, B)> ZipPar(this Z za, Z zb) =>
-            za.Fork().Then(zb, (zb_, zaForked) =>
+        public static S<(A, B)> ZipPar(this S sa, S zb) =>
+            sa.Fork().Then(zb, (zb_, zaForked) =>
             zb_.Then(zaForked, (zaForked_, b) =>
             zaForked_.Join().Then(b, (b_, a) =>
             Val((a, b_)))));
@@ -348,12 +349,13 @@

     }

-    public static class ZLinq
-    {
-        public static Z<R> Select(this Z za, Func selector) => za.To(selector);
-        public static Z<R> SelectMany(this Z za, Func<A, Z<R>> next) => za.Then(next);
-        public static Z<R> SelectMany(this Z za, Func<A, Z> getZb, Func project) =>
-            za.Then(getZb, project, (getZb_, project_, a) => getZb_(a).Then(project_, a, (project__, a_, b) => project__(a_, b).Val()));
+    public static class SLinq
+    {
+        public static S<R> Select(this S sa, Func selector) => sa.To(selector);
+        public static S<R> SelectMany(this S sa, Func<A, S<R>> next) => sa.Then(next);
+        public static S<R> SelectMany(this S sa, Func<A, S> getSb, Func project) =>
+            sa.Then(getSb, project, (getSb_, project_, a) =>
+                getSb_(a).Then(project_, a, (project__, a_, b) => project__(a_, b).Val()));
     }

     public class Tests
@@ -361,10 +363,10 @@
         int _id;
         int Id() => Interlocked.Increment(ref _id);

-        public Z<string> Map_small() =>
-               Z.Val(42).To(x => x + "!");
-
-        public Z<int> Async_sleep() =>
+        public S<string> Map_small() =>
+               S.Val(42).To(x => x + "!");
+
+        public S<int> Async_sleep() =>
             Async<int, int>(Id(), (id, run) =>
             {
                 WriteLine($"Sleep for 50ms - {id}");
@@ -373,7 +375,7 @@
                 run(42);
             });

-        public Z<int> Get_sleep() =>
+        public S<int> Get_sleep() =>
             Get(Id(), id =>
             {
                 WriteLine($"Sleep for 50ms - {id}");
@@ -382,50 +384,50 @@
                 return 43;
             });

-        public Z<int> Async_seq() =>
-            from _ in Z.Do(() => WriteLine("Before Async_seq.."))
+        public S<int> Async_seq() =>
+            from _ in S.Do(() => WriteLine("Before Async_seq.."))
             from a in Async_sleep()
             from b in Async_sleep()
-            from _1 in Z.Do(() => WriteLine("After Async_seq"))
+            from _1 in S.Do(() => WriteLine("After Async_seq"))
             select a + b;

-        public Z<int> Get_seq() =>
-            from _ in Z.Do(() => WriteLine("Before Get_seq.."))
+        public S<int> Get_seq() =>
+            from _ in S.Do(() => WriteLine("Before Get_seq.."))
             from a in Get_sleep()
             from b in Get_sleep()
-            from _1 in Z.Do(() => WriteLine("After Get_seq"))
+            from _1 in S.Do(() => WriteLine("After Get_seq"))
             select a + b + 1;

-        public Z<int> Async_fork() =>
-            from _ in Z.Do(() => WriteLine("Before Async_fork.."))
+        public S<int> Async_fork() =>
+            from _ in S.Do(() => WriteLine("Before Async_fork.."))
             from fa in Async_sleep().Fork()
             from fb in Async_sleep().Fork()
             from a in fa.Join()
             from b in fb.Join()
-            from _1 in Z.Do(() => WriteLine("After Async_fork"))
+            from _1 in S.Do(() => WriteLine("After Async_fork"))
             select a + b + 2;

-        public Z<int> Zip_par() =>
-            from _ in Z.Do(() => WriteLine("Before ZipPar.."))
-            from x in Z.ZipPar(Async_sleep(), Async_sleep())
-            from _1 in Z.Do(() => WriteLine("After ZipPar"))
+        public S<int> Zip_par() =>
+            from _ in S.Do(() => WriteLine("Before ZipPar.."))
+            from x in S.ZipPar(Async_sleep(), Async_sleep())
+            from _1 in S.Do(() => WriteLine("After ZipPar"))
             select x.Item1 + x.Item2 + 3;

-        public Z<int> Async_counter()
+        public S<int> Async_counter()
         {
             var i = 0;
             return
-                from b in Z.Do(() => WriteLine("Before Async_counter.."))
-                from x in Z.Do(() => Interlocked.Increment(ref i)).Fork().RepeatN(100)
-                from w in Z.Do(() => Thread.Sleep(50))
-                from a in Z.Do(() => WriteLine("After Async_counter and sleep for 50ms"))
+                from b in S.Do(() => WriteLine("Before Async_counter.."))
+                from x in S.Do(() => Interlocked.Increment(ref i)).Fork().RepeatN(100)
+                from w in S.Do(() => Thread.Sleep(50))
+                from a in S.Do(() => WriteLine("After Async_counter and sleep for 50ms"))
                 select i;
         }

-        public Z<Empty> Repeat(int n)
+        public S<Empty> Repeat(int n)
         {
             var i = 0;
-            return Z.Do(() => WriteLine("HOWDY " + (++i))).RepeatN(n);
+            return S.Do(() => WriteLine("HOWDY " + (++i))).RepeatN(n);
         }
     }

@@ -433,15 +435,15 @@
     public class Program
     {
         [Test]
-        public void ZMain()
+        public void SMain()
         // public static void Main()
         {
             var t = new Tests();

-            void run(Z za, string name = "")
+            void run(S sa, string name = "")
             {
                 WriteLine(name + " >> ");
-                var a = za.RunUnsafe();
+                var a = sa.RunUnsafe();
                 WriteLine(a);
                 WriteLine();
             }


Lucene.Net.Core.Index.MergeState refactor: Changed DocMaps, DocBase and MatchingSegmentReaders public fields into properties and decorated with WritableArray attribute

--- src/Lucene.Net.Core/Index/MergeState.cs
+++ src/Lucene.Net.Core/Index/MergeState.cs
@@ -1,3 +1,4 @@
+using Lucene.Net.Support;
 using System.Collections.Generic;
 using System.Diagnostics;

@@ -178,11 +179,13 @@

         /// <summary>
         /// Maps docIDs around deletions. </summary>
-        public DocMap[] DocMaps; // LUCENENET TODO: Make property ? arrays shouldn't be properties - perhaps leave a field?
+        [WritableArray]
+        public DocMap[] DocMaps { get; set; }

         /// <summary>
         /// New docID base per reader. </summary>
-        public int[] DocBase; // LUCENENET TODO: Make property ?
+        [WritableArray]
+        public int[] DocBase { get; set; }

         /// <summary>
         /// Holds the CheckAbort instance, which is invoked
@@ -202,7 +205,8 @@
         /// name/number mapping, so their stored fields and term
         /// vectors may be bulk merged.
         /// </summary>
-        public SegmentReader[] MatchingSegmentReaders; // LUCENENET TODO: Make property ?
+        [WritableArray]
+        public SegmentReader[] MatchingSegmentReaders { get; set; }

         /// <summary>
         /// How many <seealso cref="#matchingSegmentReaders"/> are set. </summary>


Allow the patterns to be updated and our regex cache is rebuilt.

--- src/Manos/Manos.Routing/RouteHandler.cs
+++ src/Manos/Manos.Routing/RouteHandler.cs
@@ -15,7 +15,7 @@

 	public class RouteHandler : IEnumerable<RouteHandler> {

-		private List<string> patterns;
+		private ObservableCollection<string> patterns;
 		private List<string> methods;

 		private IMatchOperation [] match_ops;
@@ -77,20 +77,21 @@
 		public IList<string> Patterns {
 			get { return patterns; }
 			set {
-
-				//
-				// TODO: This needs to be an observablecollection so
-				// I can raise an event when its changed and rebuild the
-				// regex cache.
-				//
-				// Only reason it isn't now is because i don't have a 4.0
-				// profile installed in monodevelop
-				//
-
 				if (value == null)
 					patterns = null;
-				else
-					patterns = new List<string> (value);
+				else {
+					patterns = new ObservableCollection<string> ();
+
+					//
+					// TODO: ObservableCollection (IList) isn't implemented yet.
+					//
+					foreach (string s in value)
+						patterns.Add (s);
+					patterns.CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs e) {
+						UpdateMatchOps ();
+					};
+				}
+
 				UpdateMatchOps ();
 			}
 		}


Make sure to log the name of the branch instead of the object

--- Ylp.GitDb.Watcher/Watcher.cs
+++ Ylp.GitDb.Watcher/Watcher.cs
@@ -93,7 +93,7 @@
         {
             try
             {
-                _logger.Info($"Detected a new branch {branch}");
+                _logger.Info($"Detected a new branch {branch.Name}");
                 var currentCommit = _repo.Lookup<Commit>(branch.Commit);
                 var previousCommit = currentCommit;
                 string baseBranch;
@@ -108,7 +108,7 @@

                 if (previousCommit == null)
                 {
-                    var otherBranch = _repo.Branches.FirstOrDefault(b => b.FriendlyName != branch.Name);
+                    var otherBranch = _repo.Branches.FirstOrDefault(b => b.FriendlyName != branch.Name && !b.IsRemote);
                     if (otherBranch != null)
                     {
                         previousCommit = otherBranch.Tip;
@@ -123,7 +123,7 @@
                 }
                 else
                 {
-                    _logger.Trace($"Found base branch {baseBranch} for {branch}, starting diff between {previousCommit.Sha} and {currentCommit.Sha}");
+                    _logger.Trace($"Found base branch {baseBranch} for {branch.Name}, starting diff between {previousCommit.Sha} and {currentCommit.Sha}");
                 }

                 var result = _repo.Diff.Compare<TreeChanges>(previousCommit.Tree, currentCommit.Tree);


Null Ref

Null Ref

--- src/MiningCore/Stratum/StratumClient.cs
+++ src/MiningCore/Stratum/StratumClient.cs
@@ -71,7 +71,7 @@
             ConnectionId = connectionId;
             RemoteEndpoint = tcp.GetPeerEndPoint();

-            expectingProxyProtocolHeader = endpointConfig.ProxyProtocol.Enable;
+            expectingProxyProtocolHeader = endpointConfig.ProxyProtocol?.Enable == true;

             // initialize send queue
             sendQueue = new ConcurrentQueue<PooledArraySegment<byte>>();


ISS-34 Adding one more missed dispose

ISS-34 Adding one more missed dispose

--- src/MorseL.Common/Serialization/Json.cs
+++ src/MorseL.Common/Serialization/Json.cs
@@ -21,32 +21,37 @@
         public static InvocationDescriptor DeserializeInvocationDescriptor(
             string jsonString, ConcurrentDictionary<string, InvocationHandler> handlers)
         {
-            var stringReader = new StringReader(jsonString);
-            var json = _serializer.Deserialize<JObject>(new JsonTextReader(stringReader));
-            if (json == null) return null;
+            using (var stringReader = new StringReader(jsonString))
+            {
+                using (var textReader = new JsonTextReader(stringReader))
+                {
+                    var json = _serializer.Deserialize<JObject>(textReader);
+                    if (json == null) return null;

-            var invocationDescriptor = new InvocationDescriptor
-            {
-                Id = json.Value<string>("Id"),
-                MethodName = json.Value<string>("MethodName")
-            };
+                    var invocationDescriptor = new InvocationDescriptor
+                    {
+                        Id = json.Value<string>("Id"),
+                        MethodName = json.Value<string>("MethodName")
+                    };

-            if (!handlers.ContainsKey(invocationDescriptor.MethodName))
-            {
-                return null;
+                    if (!handlers.ContainsKey(invocationDescriptor.MethodName))
+                    {
+                        return null;
+                    }
+
+                    var argTypes = handlers[invocationDescriptor.MethodName].ParameterTypes;
+                    invocationDescriptor.Arguments = new object[argTypes.Length];
+
+                    var args = json.Value<JArray>("Arguments");
+                    for (var i = 0; i < argTypes.Length; ++i)
+                    {
+                        var argType = argTypes[i];
+                        invocationDescriptor.Arguments[i] = args[i].ToObject(argType, _serializer);
+                    }
+
+                    return invocationDescriptor;
+                }
             }
-
-            var argTypes = handlers[invocationDescriptor.MethodName].ParameterTypes;
-            invocationDescriptor.Arguments = new object[argTypes.Length];
-
-            var args = json.Value<JArray>("Arguments");
-            for (var i = 0; i < argTypes.Length; ++i)
-            {
-                var argType = argTypes[i];
-                invocationDescriptor.Arguments[i] = args[i].ToObject(argType, _serializer);
-            }
-
-            return invocationDescriptor;
         }

         public static InvocationDescriptor DeserializeInvocationDescriptor(


Eanble DROP TABLE IF EXIST Foo for SQLite.

SVN: 488784591515bd4cdaa016be4ec9b172dc4e7caf@2797

--- src/NHibernate/Dialect/SQLiteDialect.cs
+++ src/NHibernate/Dialect/SQLiteDialect.cs
@@ -77,5 +77,10 @@
 		{
 			get { return false; }
 		}
+
+		protected override bool SupportsIfExistsBeforeTableName
+		{
+			get { return true; }
+		}
 	}
 }


added better global error handling for preprocessing task

--- src/NPolyglot.Core/PreprocessDslCode.cs
+++ src/NPolyglot.Core/PreprocessDslCode.cs
@@ -18,21 +18,29 @@

         public override bool Execute()
         {
-            DslCodeWithMetadata = DslCodeFiles.Select(x => x.Clone()).ToArray();
-            foreach (var code in DslCodeWithMetadata)
+            try
             {
-                var fullPath = Path.GetFullPath(code.ItemSpec);
-                var content = File.ReadAllLines(fullPath);
+                DslCodeWithMetadata = DslCodeFiles.Select(x => x.Clone()).ToArray();
+                foreach (var code in DslCodeWithMetadata)
+                {
+                    var fullPath = Path.GetFullPath(code.ItemSpec);
+                    var content = File.ReadAllLines(fullPath);

-                int i = 0;
-                for (; i > content.Length && ReadMetadataDirective(content[i], code); ++i) {}
+                    int i = 0;
+                    for (; i < content.Length && ReadMetadataDirective(content[i], code); ++i) {}

-                var contentLines = content.Skip(i).SkipWhile(string.IsNullOrWhiteSpace);
-                var fullContent = string.Join(Environment.NewLine, contentLines);
-                code.SetContent(fullContent);
+                    var contentLines = content.Skip(i).SkipWhile(string.IsNullOrWhiteSpace);
+                    var fullContent = string.Join(Environment.NewLine, contentLines);
+                    code.SetContent(fullContent);
+                }
+
+                return true;
             }
-
-            return true;
+            catch (Exception e)
+            {
+                Log.LogError("Failed to preprocess DSL files: {0}", e);
+                return false;
+            }
         }

         private bool ReadMetadataDirective(string directiveLine, ITaskItem resultFile)


Fix bug introduced in 18a88549f6ca61e9615c1bd58c5d1304c57dafde

--- src/OmniSharp.MSBuild/ProjectManager.cs
+++ src/OmniSharp.MSBuild/ProjectManager.cs
@@ -139,6 +139,9 @@

                     // TODO: Handle removing project

+                    projectByFilePathMap.Add(currentProject.FilePath, currentProject);
+                    projectList.Add(currentProject);
+
                     // update or add project
                     if (_projectFiles.TryGetValue(currentProject.FilePath, out var projectFileInfo))
                     {


Correct resource URL in comment (#1290)

Correct resource URL in comment (#1290)

Co-authored-by: Mikel Blanchard <0fd463528119291ca984c06c6fa5d0ed3390e68b@macrosssoftware.com>

--- src/OpenTelemetry/Resources/Resource.cs
+++ src/OpenTelemetry/Resources/Resource.cs
@@ -33,7 +33,7 @@
         public const string LibraryNameKey = "name";
         public const string LibraryVersionKey = "version";

-        // this implementation follows https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/sdk-resource.md
+        // this implementation follows https://github.com/open-telemetry/opentelemetry-specification/blob/master/specification/resource/sdk.md

         /// <summary>
         /// Initializes a new instance of the <see cref="Resource"/> class.


Remove some code committed by mistake.

Remove some code committed by mistake.

--- src/SharpLang.Compiler/Compiler.Class.cs
+++ src/SharpLang.Compiler/Compiler.Class.cs
@@ -261,8 +261,14 @@
                         fieldTypes.Add(parentClass.Type.DataType);
                     }

-                    // Special cases: Array
-                    if (typeReference.MetadataType == MetadataType.Array)
+                    // Special cases: Array and String
+                    if (typeReference.MetadataType == MetadataType.String)
+                    {
+                        // String: length (int32) + char pointer
+                        fieldTypes.Add(int32Type);
+                        fieldTypes.Add(intPtrType);
+                    }
+                    else if (typeReference.MetadataType == MetadataType.Array)
                     {
                         // String: length (native int) + first element pointer
                         var arrayType = (ArrayType)typeReference;
@@ -294,8 +300,6 @@
         {
             if (@class.IsEmitted)
                 return;
-
-            Console.WriteLine("Build type {0}", @class);

             @class.IsEmitted = true;


fix capitalization error

fix capitalization error

--- Snowflake.API/Information/MediaStore/FileMediaStore.cs
+++ Snowflake.API/Information/MediaStore/FileMediaStore.cs
@@ -32,7 +32,7 @@
            if (!Directory.Exists(mediastoreRoot)) Directory.CreateDirectory(mediastoreRoot);
            if (!Directory.Exists(Path.Combine(mediastoreRoot, mediastoreKey))) Directory.CreateDirectory(Path.Combine(mediastoreRoot, mediastoreKey));
            this.MediaStoreKey = mediastoreKey;
-           this.MediaStoreRoot = mediaStoreRoot;
+           this.MediaStoreRoot = mediastoreRoot;
            this.sections = new Dictionary<string, IMediaStoreSection>()
            {
                {"Images", new FileMediaStoreSection("Images", this) },


Fixed UpdateToPrerelease with strange github API responses

--- Source/AlephNote.Common/Operations/GithubConnection.cs
+++ Source/AlephNote.Common/Operations/GithubConnection.cs
@@ -11,38 +11,25 @@
 #pragma warning disable 0649
 // ReSharper disable All
 		private class JsonResponseAsset { public string browser_download_url; }
-		private class JsonResponse { public string tag_name; public DateTime published_at; public List<JsonResponseAsset> assets; }
+		private class JsonResponse { public string tag_name; public DateTime published_at; public List<JsonResponseAsset> assets; public bool prerelease; }
 // ReSharper restore All
 #pragma warning restore 0649

 		public Tuple<Version, DateTime, string> GetLatestRelease(bool includeBeta)
 		{
-			if (includeBeta)
-			{
-				var rest = new SimpleJsonRest(null, @"https://api.github.com");
+			var rest = new SimpleJsonRest(null, @"https://api.github.com");
+			var responses = rest
+				.Get<List<JsonResponse>>("repos/Mikescher/AlephNote/releases")
+				.OrderByDescending(p => Version.TryParse(p.tag_name.Trim('V', 'v', ' '), out var v) ? v : new Version(0, 0, 0))
+				.ToList();

-				var response = rest.Get<List<JsonResponse>>("repos/Mikescher/AlephNote/releases").First();
+			var response = includeBeta ? responses.First() : responses.First(p => !p.prerelease);
+
+			var url     = response.assets.First(a => a.browser_download_url.EndsWith(".zip")).browser_download_url;
+			var date    = response.published_at;
+			var version = ParseVersion(response.tag_name);

-				var url = response.assets.First(a => a.browser_download_url.EndsWith(".zip")).browser_download_url;
-				var date = response.published_at;
-				var version = ParseVersion(response.tag_name);
-
-				return Tuple.Create(version, date, url);
-			}
-			else
-			{
-				var rest = new SimpleJsonRest(null, @"https://api.github.com");
-
-				var response = rest.Get<JsonResponse>("repos/Mikescher/AlephNote/releases/latest");
-
-				var url = response.assets.First(a => a.browser_download_url.EndsWith(".zip")).browser_download_url;
-				var date = response.published_at;
-				var version = ParseVersion(response.tag_name);
-
-				return Tuple.Create(version, date, url);
-			}
-
-
+			return Tuple.Create(version, date, url);
 		}

 		private static Version ParseVersion(string dat)


fix #266

fix #266

--- Source/EasyNetQ.DI.Autofac/AutofacMessageDispatcher.cs
+++ Source/EasyNetQ.DI.Autofac/AutofacMessageDispatcher.cs
@@ -27,9 +27,20 @@
         {
             var scope = component.BeginLifetimeScope("async-message");
             var consumer = scope.Resolve<TConsumer>();
-            return consumer
+            var tsc = new TaskCompletionSource<object>();
+            consumer
                 .Consume(message)
-                .ContinueWith(task => scope.Dispose());
+                .ContinueWith(task =>
+                {
+                    scope.Dispose();
+
+                    if (task.IsFaulted && task.Exception != null)
+                    {
+                        tsc.SetException(task.Exception);
+                    }
+                });
+
+            return tsc.Task;
         }
     }
 }


Resolved merge conflict

Resolved merge conflict

--- Source/Hatfield.EnviroData.MVC/Views/Home/Index.cshtml
+++ Source/Hatfield.EnviroData.MVC/Views/Home/Index.cshtml
@@ -159,11 +159,6 @@

-<<<<<<>>>>>> upstream/master

Management tools


git-svn-id: https://extensionoverflow.svn.codeplex.com/svn@22350 81fbe566-5dc4-48c1-bdea-7421811ca204

--- ExtensionMethods/LinqExtensions.cs
+++ ExtensionMethods/LinqExtensions.cs
@@ -1,136 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
-namespace ExtensionOverflow
-{
-    /// <summary>
-    /// LinQ  Extentensions
-    /// </summary>
-    public static class LinqExtensions
-    {
-
-        #region ToCSVString
-
-        /// <summary>
-        /// Converts the Linq data to a commaseperated string including header.
-        /// </summary>
-        /// <param name="data">The data.</param>
-        /// <returns></returns>
-        public static string ToCSVString(this System.Linq.IOrderedQueryable data)
-        {
-            return ToCSVString(data, "; ");
-        }
-
-        /// <summary>
-        /// Converts the Linq data to a commaseperated string including header.
-        /// </summary>
-        /// <param name="data">The data.</param>
-        /// <param name="delimiter">The delimiter.</param>
-        /// <returns></returns>
-        public static string ToCSVString(this System.Linq.IOrderedQueryable data, string delimiter)
-        {
-            return ToCSVString(data, delimiter, null);
-        }
-
-        /// <summary>
-        /// Converts the Linq data to a commaseperated string including header.
-        /// </summary>
-        /// <param name="data">The data.</param>
-        /// <param name="delimiter">The delimiter.</param>
-        /// <param name="nullvalue">The nullvalue.</param>
-        /// <returns></returns>
-        public static string ToCSVString(this System.Linq.IOrderedQueryable data, string delimiter, string nullvalue)
-        {
-            StringBuilder csvdata = new StringBuilder();
-            string replaceFrom = delimiter.Trim();
-            string replaceDelimiter = ";";
-            System.Reflection.PropertyInfo[] headers = data.ElementType.GetProperties();
-            switch (replaceFrom) {
-                case ";":
-                    replaceDelimiter = ":";
-                    break;
-                case ",":
-                    replaceDelimiter = "¸";
-                    break;
-                case "\t":
-                    replaceDelimiter = "    ";
-                    break;
-                default:
-                    break;
-            }
-            if (headers.Length > 0) {
-                foreach (var head in headers) {
-                    csvdata.Append(head.Name.Replace("_", " ") + delimiter);
-                }
-                csvdata.Append("\n");
-            }
-            foreach (var row in data) {
-                var fields = row.GetType().GetProperties();
-                for (int i = 0; i < fields.Length; i++) {
-                    object value = null;
-                    try {
-                        value = fields[i].GetValue(row, null);
-                    } catch { }
-                    if (value != null) {
-                        csvdata.Append(value.ToString().Replace("\n", " \f").Replace("_", " ").Replace(replaceFrom, replaceDelimiter) + delimiter);
-                    } else {
-                        csvdata.Append(nullvalue);
-                        csvdata.Append(delimiter);
-                    }
-                }
-                csvdata.Append("\n");
-            }
-            return csvdata.ToString();
-        }
-
-        #endregion
-
-        #region ForEach
-
-        /// <summary>
-        /// Runs an action against each of the element in the IEnumerable collection.
-        /// </summary>
-        /// <param name="enum">The source IEnumerable collection.</param>
-        /// <param name="act">The action to perform on each element.</param>
-        /// <returns>The IEnumerable collection itself, to allow chaining.</returns>
-        public static IEnumerable<T> ForEach<T>(this IEnumerable<T> @enum, Action<T> act)
-        {
-            @enum.ThrowIfArgumentIsNull("@enum");
-            act.ThrowIfArgumentIsNull("act");
-
-            // yield return may not be used here due to the fact that
-            // ForEach calls are expected to be run immediatly
-            foreach (var item in @enum) act(item);
-
-            return @enum;
-        }
-
-        /// <summary>
-        /// Runs a function against each of the element in the IEnumerable collection.
-        /// Discarding any return values.
-        /// </summary>
-        /// <param name="enum">The source IEnumerable collection.</param>
-        /// <param name="func">The function to run on each element.</param>
-        /// <returns>The IEnumerable collection itself, unmodified, to allow chaining.</returns>
-        /// <remarks>
-        /// This is unlike Select because the IEnumerable collection itself is left unmodified
-        /// and the return value is the same IEnumerable collection passed in.
-        /// </remarks>
-        public static IEnumerable<T> ForEach<T, _>(this IEnumerable<T> @enum, Func<T, _> func)
-        {
-            @enum.ThrowIfArgumentIsNull("@enum");
-            func.ThrowIfArgumentIsNull("func");
-
-            // yield return may not be used here due to the fact that
-            // ForEach calls are expected to be run immediatly
-            foreach (var item in @enum) func(item);
-
-            return @enum;
-        }
-
-        #endregion
-
-    }
-}


code format

code format

--- src/Peachpie.Library.Graphics/PhpGd2.cs
+++ src/Peachpie.Library.Graphics/PhpGd2.cs
@@ -1978,7 +1978,7 @@
         /// <param name="image">An image resource, returned by one of the image creation functions, such as imagecreatetruecolor().</param>
         /// <param name="mode">Flip mode, this can be one of the IMG_FLIP_* constants:</param>
         /// <returns>Returns TRUE on success or FALSE on failure.</returns>
-        public static bool imageflip(PhpResource image , int mode)
+        public static bool imageflip(PhpResource image, int mode)
         {
             var img = PhpGdImageResource.ValidImage(image);
             if (img == null)
@@ -2009,7 +2009,7 @@
         /// <param name="image">An image resource, returned by one of the image creation functions, such as imagecreatetruecolor().</param>
         /// <param name="rect">The cropping rectangle as array with keys x, y, width and height.</param>
         /// <returns>Return cropped image resource on success or FALSE on failure.</returns>
-        [return:CastToFalse]
+        [return: CastToFalse]
         public static PhpResource imagecrop(PhpResource image, PhpArray rect)
         {
             var img = PhpGdImageResource.ValidImage(image);
@@ -2032,7 +2032,7 @@

             // Makes bigger image and then crops it.
             if (rectangle.X + rectangle.Width > img.Image.Width || rectangle.Y + rectangle.Height > img.Image.Height)
-            {
+            {
                 var resized = new PhpGdImageResource(new Image<Rgba32>(
                     Math.Max(rectangle.X + rectangle.Width, img.Image.Width), Math.Max(rectangle.Y + rectangle.Height, img.Image.Height)), img.Format);
                 resized.Image.Mutate(o => o.DrawImage(img.Image, 1).Crop(rectangle));
@@ -2050,7 +2050,7 @@
         /// <param name="new_height">The height to scale the image to.If omitted or negative, the aspect ratio will be preserved.</param>
         /// <param name="mode"></param>
         /// <returns>Return the scaled image resource on success or FALSE on failure.</returns>
-        [return:CastToFalse]
+        [return: CastToFalse]
         public static PhpResource imagescale(PhpResource image, int new_width, int new_height = -1, int mode = IMG_BILINEAR_FIXED)
         {
             // TODO: Description mode
@@ -2081,7 +2081,7 @@
                     throw new NotSupportedException();
                 default:
                     return null;
-            }
+            }

             return new PhpGdImageResource(img.Image.Clone(o => o.Resize(new_width, new_height, res)), img.Format);
         }
@@ -2093,7 +2093,7 @@
         /// <param name="affine">Array with keys 0 to 5.</param>
         /// <param name="clip">Array with keys "x", "y", "width" and "height".</param>
         /// <returns>Return affined image resource on success or FALSE on failure.</returns>
-        [return:CastToFalse]
+        [return: CastToFalse]
         public static PhpResource imageaffine(PhpResource image, PhpArray affine, PhpArray clip = null)
         {
             var img = PhpGdImageResource.ValidImage(image);
@@ -2101,15 +2101,15 @@
                 return null;

             // Check Arguments
-            if (!affine.TryGetItemValue("0", out PhpValue n_1) | !affine.TryGetItemValue("1", out PhpValue n_2) |
-                !affine.TryGetItemValue("2", out PhpValue n_3) | !affine.TryGetItemValue("3", out PhpValue n_4) |
+            if (!affine.TryGetItemValue("0", out PhpValue n_1) | !affine.TryGetItemValue("1", out PhpValue n_2) |
+                !affine.TryGetItemValue("2", out PhpValue n_3) | !affine.TryGetItemValue("3", out PhpValue n_4) |
                 !affine.TryGetItemValue("4", out PhpValue n_5) | !affine.TryGetItemValue("5", out PhpValue n_6))
             {
                 PhpException.Throw(PhpError.Warning, Resources.affine_array_number_of_params);
                 return null;
             }

-            if (!n_1.IsDouble() || !n_2.IsDouble() || !n_3.IsDouble() ||
+            if (!n_1.IsDouble() || !n_2.IsDouble() || !n_3.IsDouble() ||
                 !n_4.IsDouble() || !n_5.IsDouble() || !n_6.IsDouble())
             {
                 PhpException.Throw(PhpError.Warning, Resources.wrong_type);
@@ -2123,19 +2123,19 @@

             if (clip != null) // Check Arguments if clip exists
             {
-                if (!clip.TryGetItemValue("x", out PhpValue xValue) | !clip.TryGetItemValue("y", out PhpValue yValue) |
+                if (!clip.TryGetItemValue("x", out PhpValue xValue) | !clip.TryGetItemValue("y", out PhpValue yValue) |
                     !clip.TryGetItemValue("width", out PhpValue widthValue) |
                     !clip.TryGetItemValue("height", out PhpValue heightValue))
-                    {
-                        PhpException.Throw(PhpError.Warning, Resources.missing_params);
-                        return null;
-                    }
+                {
+                    PhpException.Throw(PhpError.Warning, Resources.missing_params);
+                    return null;
+                }

                 if (!xValue.IsInteger() || !yValue.IsInteger() || !widthValue.IsInteger() || !heightValue.IsInteger())
-                    {
-                        PhpException.Throw(PhpError.Warning, Resources.wrong_type);
-                        return null;
-                    }
+                {
+                    PhpException.Throw(PhpError.Warning, Resources.wrong_type);
+                    return null;
+                }
                 else
                 {
                     sourceBox.X = xValue.ToInt();
@@ -2153,7 +2153,8 @@
                 extent[i] = ApplyAffineToPointF(extent[i], affineMatrix);

             PointF min = extent[0];
-            for(int i = 1; i < 4; i++) {
+            for (int i = 1; i < 4; i++)
+            {
                 if (min.X > extent[i].X)
                     min.X = extent[i].X;
                 if (min.Y > extent[i].Y)
@@ -2162,12 +2163,12 @@

             var translationMatrix = new Matrix3x2(1, 0, 0, 1, -min.X, -min.Y);

-            AffineTransformBuilder builder =
+            AffineTransformBuilder builder =
                 new AffineTransformBuilder().AppendMatrix(affineMatrix).AppendMatrix(translationMatrix);

-            var transformed = img.Image.Clone(o => o.Transform(sourceBox, builder,new TriangleResampler()));
-
-            return new PhpGdImageResource(transformed,img.Format);
+            var transformed = img.Image.Clone(o => o.Transform(sourceBox, builder, new TriangleResampler()));
+
+            return new PhpGdImageResource(transformed, img.Format);
         }

         private static PointF ApplyAffineToPointF(PointF point, Matrix3x2 affine)


SplFileInfo.getPerms()

SplFileInfo.getPerms()

--- src/Peachpie.Library/Spl/SplFileInfo.cs
+++ src/Peachpie.Library/Spl/SplFileInfo.cs
@@ -131,7 +131,7 @@
         public virtual SplFileInfo getPathInfo(Context ctx, string class_name = null) => CreateFileInfo(ctx, class_name ?? _info_class, PhpPath.dirname(_fullpath));
         /// Gets the path to the file
         public virtual string getPathname() => _originalPath;
-        public virtual long getPerms() => throw new NotImplementedException();
+        public virtual long getPerms() => (long)Stat.st_mode;

         /// This method expands all symbolic links, resolves relative references and returns the real path to the file.
         [return: CastToFalse]


Added username to auth event base

Added username to auth event base

--- source/Core/Events/Authentication/AuthenticationEventBase.cs
+++ source/Core/Events/Authentication/AuthenticationEventBase.cs
@@ -43,6 +43,14 @@
         public string SubjectId { get; set; }

         /// <summary>
+        /// Gets or sets the username that the user used when trying to authenticate.
+        /// </summary>
+        /// <value>
+        /// The username.
+        /// </value>
+        public string UserName { get; set; }
+
+        /// <summary>
         /// Gets or sets the user's name.
         /// </summary>
         /// <value>


Revert "Change ProcessorInfo to CPU"

Revert "Change ProcessorInfo to CPU"

This reverts commit 0b6b557a5a2ef96672b8924bc666913cab20e788.

--- source/Cosmos.Core_Plugs/System/Diagnostics/StopwatchImpl.cs
+++ source/Cosmos.Core_Plugs/System/Diagnostics/StopwatchImpl.cs
@@ -13,7 +13,7 @@
         {
             if (Stopwatch.IsHighResolution)
                 // see https://msdn.microsoft.com/en-us/library/windows/desktop/dn553408(v=vs.85).aspx for more details
-                return (long)(CPU.GetCPUUptime() / (double)CPU.GetCPUCycleSpeed() * 1000000d);
+                return (long)(ProcessorInformation.GetCycleCount() / (double)ProcessorInformation.GetCycleRate() * 1000000d);
             else
                 return DateTime.UtcNow.Ticks;
         }


Added additional logging to Open Log File service.

--- source/Drey.Configuration/ServiceModel/OpenLogFileService.cs
+++ source/Drey.Configuration/ServiceModel/OpenLogFileService.cs
@@ -1,4 +1,5 @@
 using Drey.Nut;
+using Drey.Logging;
 using Drey.Utilities;

 using System.IO;
@@ -19,15 +20,21 @@
         {
             var relativePath = request.Message.RelativeOrAbsolutePath;

-            while (relativePath.StartsWith("\\"))
+            Log.InfoFormat("Read Log File Request received for: '{relativePath}'", relativePath);
+
+            while (relativePath.StartsWith("\\") || relativePath.StartsWith("/"))
             {
                 relativePath = relativePath.Substring(1);
             }

+            Log.DebugFormat("After removing starting slash(es), relative path looks like '{relativePath}'", relativePath);
+
             var logFile = Drey.Utilities.PathUtilities.MapPath(Path.Combine(_configurationManager.LogsDirectory, relativePath));
+            Log.DebugFormat("Absolute path for log file is: {absoluteLogPath}", logFile);

             if (File.Exists(logFile))
             {
+                Log.Info("Log file found.  Compressing and returning to consumer.");
                 var ms = new MemoryStream();

                 using (var zip = new GZipStream(ms, CompressionLevel.Optimal))
@@ -38,6 +45,8 @@

                 return DomainModel.Response<byte[]>.Success(request.Token, ms.ToArray());
             }
+
+            Log.Warn("Log file does not exist.");
             return DomainModel.Response<byte[]>.Failure(request.Token, "File does not exist.", 1M, default(byte[]));

         }


Implement LogSocial

Implement LogSocial

--- source/Plugins/GoogleAnalyticsV4/GoogleAnalyticsAndroidV4.cs
+++ source/Plugins/GoogleAnalyticsV4/GoogleAnalyticsAndroidV4.cs
@@ -141,6 +141,13 @@
   }

   public void LogSocial(SocialHitBuilder builder) {
+    AndroidJavaObject socialBuilder = new AndroidJavaObject("com.google.android.gms.analytics.HitBuilders$SocialBuilder");
+    socialBuilder.Call<AndroidJavaObject>("setAction", new object[] { builder.GetSocialAction() });
+    socialBuilder.Call<AndroidJavaObject>("setNetwork", new object[] { builder.GetSocialNetwork() });
+    socialBuilder.Call<AndroidJavaObject>("setTarget", new object[] { builder.GetSocialTarget() });
+
+    object[] builtSocial = new object[] { socialBuilder.Call<AndroidJavaObject>("build") };
+    tracker.Call("send", builtSocial);
   }

   public void LogTiming(TimingHitBuilder builder) {


Update ResolutionScope.AsyncInitializer.cs

--- src/ResolutionScope.AsyncInitializer.cs
+++ src/ResolutionScope.AsyncInitializer.cs
@@ -8,7 +8,7 @@
 {
     internal sealed partial class ResolutionScope
     {
-        private class AsyncInitializable
+        private sealed class AsyncInitializable
         {
             private readonly object item;
             private readonly Func<object, IDependencyResolver, CancellationToken, Task> initializer;


Small optimization that isn't really needed.

--- src/SQLHelper.DB/HelperClasses/Batch.cs
+++ src/SQLHelper.DB/HelperClasses/Batch.cs
@@ -451,16 +451,18 @@
                                             return x.Value;
                                         }) + Environment.NewLine;

-                    foreach (IParameter TempParameter in Command.Parameters)
-                    {
+                    for (int i = 0, CommandParametersLength = Command.Parameters.Length; i < CommandParametersLength; i++)
+                    {
+                        IParameter TempParameter = Command.Parameters[i];
                         FinalParameters.Add(TempParameter.CreateCopy(Suffix));
                     }
                 }
                 else
                 {
                     FinalSQLCommand += Command.SQLCommand + Environment.NewLine;
-                    foreach (IParameter TempParameter in Command.Parameters)
-                    {
+                    for (int i = 0, CommandParametersLength = Command.Parameters.Length; i < CommandParametersLength; i++)
+                    {
+                        IParameter TempParameter = Command.Parameters[i];
                         FinalParameters.Add(TempParameter.CreateCopy(""));
                     }
                 }


TabControl is now passing Tab options

TabControl is now passing Tab options

--- Sources/Silphid.Showzup/Sources/Controls/TabControl.cs
+++ Sources/Silphid.Showzup/Sources/Controls/TabControl.cs
@@ -23,6 +23,7 @@
         public TabPlacement TabPlacement = TabPlacement.Top;

         private readonly MoveHandler _moveHandler = new MoveHandler();
+        private Options _lastOptions;

         public void Start()
         {
@@ -33,7 +34,8 @@

             TabSelectionControl.SelectedView
                 .Select(x => x?.ViewModel?.Model)
-                .BindTo(ContentTransitionControl);
+                .Subscribe(x => ContentTransitionControl.Present(x, _lastOptions).SubscribeAndForget())
+                .AddTo(this);

             _moveHandler.BindBidirectional(
                 ContentTransitionControl,
@@ -45,11 +47,11 @@
             TabSelectionControl.CanPresent(input, options);

         public IObservable<IView> Present(object input, Options options = null) =>
-            TabSelectionControl.Present(input, options);
+            TabSelectionControl.Present(input, _lastOptions = options);

         public void OnSelect(BaseEventData eventData)
         {
-            TabSelectionControl.Select();
+            TabSelectionControl.SelectFirst();
         }

         public void OnMove(AxisEventData eventData)


fix cd duplication issue, fix skills config window not showing

--- TCC.Core/ViewModels/Widgets/CooldownWindowViewModel.cs
+++ TCC.Core/ViewModels/Widgets/CooldownWindowViewModel.cs
@@ -496,6 +496,7 @@
         protected override void OnEnabledChanged(bool enabled)
         {
             base.OnEnabledChanged(enabled);
+            ClearSkills();
             LoadConfig(Game.Me.Class);
         }

@@ -525,7 +526,7 @@
                 if(SkillConfigWindow.Instance.IsVisible)
                     SkillConfigWindow.Instance.HideWindow();
                 else
-                    SkillConfigWindow.Instance.HideWindow();
+                    SkillConfigWindow.Instance.ShowWindow();

             }, DispatcherPriority.Background);


remove not using reference

remove not using reference


converted edgecounter to a more generic class

--- TCC.Core/Windows/ClassSpecificBars/EdgeControl.xaml.cs
+++ TCC.Core/Windows/ClassSpecificBars/EdgeControl.xaml.cs
@@ -54,20 +54,20 @@
             _currentEdge = newEdge;
         }

-        EdgeCounter _context;
+        Counter _context;

         private void UserControl_Loaded(object sender, RoutedEventArgs e)
         {
             if (DesignerProperties.GetIsInDesignMode(this)) return;
-            _context = (EdgeCounter)DataContext;
+            _context = (Counter)DataContext;
             _context.PropertyChanged += _context_PropertyChanged;
         }

         private void _context_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
         {
-            if(e.PropertyName == "Edge")
+            if(e.PropertyName == "Val")
             {
-                SetEdge(_context.Edge);
+                SetEdge(_context.Val);
             }
             else if(e.PropertyName == "Maxed")
             {


v4.2.0 * Added properties to EntityData outputs


Updates summary comments for Extension methods

Former-commit-id: 01e8a5e26b43f4588c277832f88996c6cd7ad085


added unit test for addresscheck

added unit test for addresscheck

--- MaileonTests/Mailings/MaileonMailingsServiceTests.cs
+++ MaileonTests/Mailings/MaileonMailingsServiceTests.cs
@@ -90,9 +90,10 @@
         [TestMethod()]
         public void GetArchiveUrlTest()
         {
-            string url = service.GetArchiveUrl(MaileonTests.Properties.Settings.Default.mailingIdExistingRegular);
-
-            Assert.AreEqual("http://sandbox.maileon.com/u/archive/z6SQtk30DaM", url);
+            /*string url = service.GetArchiveUrl(MaileonTests.Properties.Settings.Default.mailingIdExistingRegular);
+
+            Assert.AreEqual("http://sandbox.maileon.com/u/archive/z6SQtk30DaM", url);*/
+            Assert.Fail();
         }

         [TestMethod()]


CI: updated AssemblyInfo version to 2.6.105.1


Renamed local variable and reorganize the logic a bit