Datahub: Update MeterActivity tab to only query meters a user has access to.

--- src/PQDashboard/DataHub.cs
+++ src/PQDashboard/DataHub.cs
@@ -1683,6 +1683,10 @@

         public IEnumerable<MeterActivity> QueryMeterActivity(DateTime startTime, string orderBy, int numberOfResults, bool ascending = false)
         {
+            string userSID = UserInfo.UserNameToSID(Context.User.Identity.Name);
+            if (DataContext.Connection.ExecuteScalar<int>("SELECT COUNT(*) FROM UserAccount WHERE Name = {0}", userSID) == 0)
+                userSID = "External";
+
             string order;
             order = ascending ? "ASC" : "DESC";

@@ -1708,7 +1712,10 @@
 		                                    (CASE WHEN E180D.EventCount IS NULL THEN 0 ELSE E180D.EventCount END) AS Events180Days,
                                             FirstEvent.EventID AS FirstEventID

-                                    FROM	Meter AS m LEFT OUTER JOIN
+                                    FROM	(SELECT me.*
+                                            FROM UserMeter u JOIN Meter me ON u.MeterID=me.ID
+                                            WHERE u.UserName=@userSID) AS m LEFT OUTER JOIN
+
 		                                    (SELECT m.ID, COUNT(e.ID) AS EventCount
 		                                    FROM Meter m LEFT OUTER JOIN Event e on m.ID=e.MeterID
 		                                    WHERE e.StartTime <= @StartTime AND e.StartTime >= DATEADD(HH,-24,@StartTime)
@@ -1717,22 +1724,22 @@
 	                                        (SELECT m.ID, COUNT(e.ID) AS EventCount
 		                                    FROM Meter m LEFT OUTER JOIN Event e on m.ID=e.MeterID
 		                                    WHERE e.StartTime <= @StartTime AND e.StartTime >= DATEADD(DD,-7,@StartTime)
-		                                    GROUP BY m.ID) AS E7D ON E24H.ID=E7D.ID LEFT OUTER JOIN
+		                                    GROUP BY m.ID) AS E7D ON m.ID=E7D.ID LEFT OUTER JOIN

                                         	(SELECT m.ID, COUNT(e.ID) AS EventCount
 		                                    FROM Meter m LEFT OUTER JOIN Event e on m.ID=e.MeterID
 		                                    WHERE e.StartTime <= @StartTime AND e.StartTime >= DATEADD(DD,-30,@StartTime)
-		                                    GROUP BY m.ID) AS E30D ON E24H.ID=E30D.ID LEFT OUTER JOIN
+		                                    GROUP BY m.ID) AS E30D ON m.ID=E30D.ID LEFT OUTER JOIN

 	                                        (SELECT m.ID, COUNT(e.ID) AS EventCount
 		                                    FROM Meter m LEFT OUTER JOIN Event e on m.ID=e.MeterID
 		                                    WHERE e.StartTime <= @StartTime AND e.StartTime >= DATEADD(DD,-90,@StartTime)
-		                                    GROUP BY m.ID) AS E90D ON E30D.ID=E90D.ID LEFT OUTER JOIN
+		                                    GROUP BY m.ID) AS E90D ON m.ID=E90D.ID LEFT OUTER JOIN

                                         	(SELECT m.ID, COUNT(e.ID) AS EventCount
 		                                    FROM Meter m LEFT OUTER JOIN Event e on m.ID=e.MeterID
 		                                    WHERE e.StartTime <= @StartTime AND e.StartTime >= DATEADD(DD,-180,@StartTime)
-		                                    GROUP BY m.ID) AS E180D ON E30D.ID=E180D.ID LEFT OUTER JOIN
+		                                    GROUP BY m.ID) AS E180D ON m.ID=E180D.ID LEFT OUTER JOIN

                                             (SELECT Meter.ID, FirstEvent.EventID
                                             FROM Meter LEFT OUTER JOIN
@@ -1752,6 +1759,11 @@
                 param1.ParameterName = "@StartTime";
                 param1.Value = startTime;
                 sc.Parameters.Add(param1);
+
+                IDbDataParameter param2 = sc.CreateParameter();
+                param2.ParameterName = "@userSID";
+                param2.Value = userSID;
+                sc.Parameters.Add(param2);

                 IDataReader rdr = sc.ExecuteReader();
                 table.Load(rdr);


Offer more overridable flexibility in Command

--- src/Peasy/Peasy/Command.cs
+++ src/Peasy/Peasy/Command.cs
@@ -13,13 +13,13 @@
         /// <summary>
         /// Synchronously orchestrates command initialization, rule execution, and command execution
         /// </summary>
-        public ExecutionResult Execute()
+        public virtual ExecutionResult Execute()
         {
             OnInitialization();

             var validationResults = GetErrors().ToArray();
             if (validationResults.Any())
-                return new ExecutionResult { Success = false, Errors = validationResults };
+                return OnFailedExecution(validationResults);

             try
             {
@@ -27,22 +27,32 @@
             }
             catch (ServiceException ex)
             {
-                return new ExecutionResult { Success = false, Errors = new ValidationResult[] { new ValidationResult(ex.Message) }};
-            }
-
+                return OnFailedExecution(new [] { new ValidationResult(ex.Message) });
+            }
+
+            return OnSuccessfulExecution();
+        }
+
+        protected virtual ExecutionResult OnFailedExecution(ValidationResult[] validationResults)
+        {
+            return new ExecutionResult { Success = false, Errors = validationResults };
+        }
+
+        protected virtual ExecutionResult OnSuccessfulExecution()
+        {
             return new ExecutionResult { Success = true };
         }

         /// <summary>
         /// Asynchronously orchestrates command initialization, rule execution, and command execution
         /// </summary>
-        public async Task<ExecutionResult> ExecuteAsync()
+        public virtual async Task<ExecutionResult> ExecuteAsync()
         {
             await OnInitializationAsync();

-            var validationResults = await GetErrorsAsync();
-            if (validationResults.ToArray().Any())
-                return new ExecutionResult { Success = false, Errors = validationResults };
+            var validationResults = (await GetErrorsAsync()).ToArray();
+            if (validationResults.Any())
+                return OnFailedExecution(validationResults);

             try
             {
@@ -50,10 +60,10 @@
             }
             catch (ServiceException ex)
             {
-                return new ExecutionResult { Success = false, Errors = new ValidationResult[] { new ValidationResult(ex.Message) }};
-            }
-
-            return new ExecutionResult { Success = true };
+                return OnFailedExecution(new [] { new ValidationResult(ex.Message) });
+            }
+
+            return OnSuccessfulExecution();
         }

         /// <summary>
@@ -101,13 +111,13 @@
         /// <summary>
         /// Synchronously orchestrates command initialization, rule execution, and command execution
         /// </summary>
-        public ExecutionResult<T> Execute()
+        public virtual ExecutionResult<T> Execute()
         {
             OnInitialization();

             var validationResults = GetErrors().ToArray();
             if (validationResults.Any())
-                return new ExecutionResult<T> { Success = false, Errors = validationResults };
+                return OnFailedExecution(validationResults);

             T result;
             try
@@ -116,22 +126,22 @@
             }
             catch (ServiceException ex)
             {
-                return new ExecutionResult<T> { Success = false, Errors = new ValidationResult[] { new ValidationResult(ex.Message) }};
-            }
-
-            return new ExecutionResult<T> { Success = true, Value = result };
+                return OnFailedExecution(new [] { new ValidationResult(ex.Message) });
+            }
+
+            return OnSuccessfulExecution(result);
         }

         /// <summary>
         /// Asynchronously orchestrates command initialization, rule execution, and command execution
         /// </summary>
-        public async Task<ExecutionResult<T>> ExecuteAsync()
+        public virtual async Task<ExecutionResult<T>> ExecuteAsync()
         {
             await OnInitializationAsync();

-            var validationResults = await GetErrorsAsync();
-            if (validationResults.ToArray().Any())
-                return new ExecutionResult<T> { Success = false, Errors = validationResults };
+            var validationResults = (await GetErrorsAsync()).ToArray();
+            if (validationResults.Any())
+                return OnFailedExecution(validationResults);

             T result;
             try
@@ -140,10 +150,20 @@
             }
             catch (ServiceException ex)
             {
-                return new ExecutionResult<T> { Success = false, Errors = new ValidationResult[] { new ValidationResult(ex.Message) }};
-            }
-
-            return new ExecutionResult<T> { Success = true, Value = result };
+                return OnFailedExecution(new [] { new ValidationResult(ex.Message) } );
+            }
+
+            return OnSuccessfulExecution(result);
+        }
+
+        protected virtual ExecutionResult<T> OnFailedExecution(ValidationResult[] validationResults)
+        {
+            return new ExecutionResult<T> { Success = false, Errors = validationResults };
+        }
+
+        protected virtual ExecutionResult<T> OnSuccessfulExecution(T value)
+        {
+            return new ExecutionResult<T> { Success = true, Value = value };
         }

         /// <summary>


Delete QueryableExtensions.cs

Delete QueryableExtensions.cs

no longer needed as EnumerableExtensions optimises for IQueryable, saves duplicated code

--- src/QueryableExtensions.cs
+++ src/QueryableExtensions.cs
@@ -1,54 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-
-namespace HallLibrary.Extensions
-{
-	/// <summary>
-	/// Contains static methods for working with queryables.
-	/// </summary>
-	public static class QueryableExtensions
-	{
-		#region Count
-			/// <summary>
-			/// Returns <c>true</c> if the number of elements in the <paramref name="queryable"/> exceeds the specified <paramref name="count"/>, querying only the minimum number of elements in the source necessary to determine the answer.
-			/// </summary>
-			/// <typeparam name="T">The type of elements in the queryable.</typeparam>
-			/// <param name="queryable">The queryable source to check.</param>
-			/// <param name="count">The count to exceed.</param>
-			/// <returns>Returns <c>true</c> if the number of elements in the <paramref name="queryable"/> exceeds the specified <paramref name="count"/>.</returns>
-			public static bool CountExceeds<T>(this IQueryable<T> queryable, int count)
-			{
-				return queryable.Take(count + 1).Count() > count;
-			}
-
-			/// <summary>
-			/// Returns <c>true</c> if the number of elements in the <paramref name="queryable"/> equals the specified <paramref name="count"/>, querying only the minimum number of elements in the source necessary to determine the answer.
-			/// </summary>
-			/// <typeparam name="T">The type of elements in the queryable.</typeparam>
-			/// <param name="queryable">The queryable source to check.</param>
-			/// <param name="count">The count to match.</param>
-			/// <returns>Returns <c>true</c> if the number of elements in the <paramref name="queryable"/> equals the specified <paramref name="count"/>.</returns>
-			public static bool CountEquals<T>(this IQueryable<T> queryable, int count)
-			{
-				// note that this works because if there are more items than count, we just take one extra and compare it, which will return false
-				// if there are less items, it will return false
-				// and if there are count items, it can only take count, so the comparison will succeed
-				return queryable.Take(count + 1).Count() == count;
-			}
-
-
-			/// <summary>
-			/// Returns <c>true</c> if the number of elements in the <paramref name="queryable"/> is less than the specified <paramref name="count"/>, querying only the minimum number of elements in the source necessary to determine the answer.
-			/// </summary>
-			/// <typeparam name="T">The type of elements in the queryable.</typeparam>
-			/// <param name="queryable">The queryable source to check.</param>
-			/// <param name="count">The count to compare.</param>
-			/// <returns>Returns <c>true</c> if the number of elements in the <paramref name="queryable"/> is less than the specified <paramref name="count"/>.</returns>
-			public static bool CountIsLessThan<T>(this IEnumerable<T> queryable, int count)
-			{
-				return queryable.Take(count).Count() < count;
-			}
-		#endregion
-	}
-}


Fix BatchUpdate for Pomelo.MySql

Fix BatchUpdate for Pomelo.MySql

--- src/shared/Z.EF.Plus.BatchUpdate.Shared/BatchUpdate.cs
+++ src/shared/Z.EF.Plus.BatchUpdate.Shared/BatchUpdate.cs
@@ -1459,11 +1459,15 @@
                     valueSql = valueSql.Trim();

 					if (updateFactory.Parameters != null && updateFactory.Parameters.Count == 1)
-					{
-						valueSql = valueSql.Replace("[" +updateFactory.Parameters.First().Name +"]", "B");
+					{
+                        string name = updateFactory.Parameters.First().Name;
+                        valueSql = valueSql.Replace($"`{name}`", "B");
+                        valueSql = valueSql.Replace($"[{name}]", "B");
 					}

 					// Add the destination name
+					valueSql = valueSql.Replace("`x`", "B");
+					valueSql = valueSql.Replace("`c`", "B");
 					valueSql = valueSql.Replace("[x]", "B");
                     valueSql = valueSql.Replace("[c]", "B");


factored

factored

--- ksp_plugin_adapter/ksp_plugin_adapter.cs
+++ ksp_plugin_adapter/ksp_plugin_adapter.cs
@@ -379,16 +379,6 @@
   }

   private void DrawMainWindow(int window_id) {
-    UnityEngine.GUIStyle style = new UnityEngine.GUIStyle(
-        UnityEngine.GUI.skin.button);
-    style.normal.textColor = style.focused.textColor = UnityEngine.Color.white;
-    style.hover.textColor = style.active.textColor = UnityEngine.Color.yellow;
-    style.onNormal.textColor  = UnityEngine.Color.green;
-    style.onFocused.textColor = UnityEngine.Color.green;
-    style.onHover.textColor   = UnityEngine.Color.green;
-    style.onActive.textColor  = UnityEngine.Color.green;
-    style.padding             = new UnityEngine.RectOffset(8, 8, 8, 8);
-
     UnityEngine.GUILayout.BeginVertical();
     String plugin_state;
     if (PluginRunning()) {
@@ -419,34 +409,34 @@
           last_plugin_reset_.ToUniversalTime().ToString("O");
     }
     UnityEngine.GUILayout.TextArea(last_reset_information);
-    String reference_frame_selection_toggle =
-        show_reference_frame_selection_ ? "↑ Reference Frame Selection ↑"
-                                        : "↓ Reference Frame Selection ↓";
-    if (UnityEngine.GUILayout.Button(reference_frame_selection_toggle)) {
-      show_reference_frame_selection_ = !show_reference_frame_selection_;
-      if (!show_reference_frame_selection_) {
-        ShrinkMainWindow();
-      }
-    }
-    if (show_reference_frame_selection_) {
-      ReferenceFrameSelection();
-    }
-    String logging_settings_toggle =
-        show_logging_settings_ ? "↑ Logging Settings ↑"
-                               : "↓ Logging Settings ↓";
-    if (UnityEngine.GUILayout.Button(logging_settings_toggle)) {
-      show_logging_settings_ = !show_logging_settings_;
-      if (!show_logging_settings_) {
-        ShrinkMainWindow();
-      }
-    }
-    if (show_logging_settings_) {
-      LoggingSettings();
-    }
+    ToggleableSection(name   : "Reference Frame Selection",
+                      show   : ref show_reference_frame_selection_,
+                      render : ReferenceFrameSelection);
+    ToggleableSection(name   : "Logging Settings",
+                      show   : ref show_logging_settings_,
+                      render : LoggingSettings);
     UnityEngine.GUILayout.EndVertical();
     UnityEngine.GUI.DragWindow(
         position : new UnityEngine.Rect(left : 0f, top : 0f, width : 10000f,
-                                        height : 20f));
+                                        height : 10000f));
+  }
+
+  delegate void GUIRenderer();
+
+  private void ToggleableSection(String name,
+                                 ref bool show,
+                                 GUIRenderer render) {
+    String toggle = show ? "↑ " + name + " ↑"
+                         : "↓ " + name + " ↓";
+    if (UnityEngine.GUILayout.Button(toggle)) {
+      show = !show;
+      if (!show) {
+        ShrinkMainWindow();
+      }
+    }
+    if (show) {
+      render();
+    }
   }

   private void ReferenceFrameSelection() {
@@ -466,8 +456,9 @@
           "the nonrotating reference frame fixing the centre of " +
           FlightGlobals.Bodies[first_selected_celestial_].theName + ".";
     }
-    UnityEngine.GUILayout.TextArea(text: reference_frame_description);
-    UnityEngine.GUILayout.Label(text : "Reference frame selection:");
+    UnityEngine.GUILayout.TextArea(
+        text    : reference_frame_description,
+        options : UnityEngine.GUILayout.Height(100));
     foreach (CelestialBody celestial in FlightGlobals.Bodies) {
       bool changed_rendering = false;
       UnityEngine.GUILayout.BeginHorizontal();


add readonly to SdmapTagger.cs

add readonly to SdmapTagger.cs

--- sdmap/src/sdmap.vstool/Tagger/SdmapTagger.cs
+++ sdmap/src/sdmap.vstool/Tagger/SdmapTagger.cs
@@ -15,11 +15,12 @@
 {
     sealed class SdmapTagger : ITagger<ClassificationTag>
     {
-        private ISdmapLexer lexer;
-        private ITextBuffer buffer;
-        private IStandardClassificationService standardClassificationService;
+        private readonly ISdmapLexer lexer;
+        private readonly ITextBuffer buffer;
+        private readonly IStandardClassificationService standardClassificationService;
+        private readonly SortedList<int, TagSpan<ClassificationTag>> tokenBuffer = new SortedList<int, TagSpan<ClassificationTag>>();
+
         public event EventHandler<SnapshotSpanEventArgs> TagsChanged;
-        private SortedList<int, TagSpan<ClassificationTag>> tokenBuffer = new SortedList<int, TagSpan<ClassificationTag>>();

         public SdmapTagger(ISdmapLexer lexer, ITextBuffer buffer, IStandardClassificationService standardClassificationService)
         {


Add basic unit test for feature report

Add basic unit test for feature report

--- source/Htc.Vita.Core.Tests/UsbManagerTest.cs
+++ source/Htc.Vita.Core.Tests/UsbManagerTest.cs
@@ -46,5 +46,45 @@
                 }
             }
         }
+
+        [Fact]
+        public void Default_1_GetHidFeatureReport()
+        {
+            if (!Platform.IsWindows)
+            {
+                return;
+            }
+            var deviceInfos = UsbManager.GetHidDevices();
+            Assert.NotNull(deviceInfos);
+            foreach (var deviceInfo in deviceInfos)
+            {
+                _output.WriteLine("deviceInfo.Path: \"" + deviceInfo.Path + "\"");
+                _output.WriteLine("deviceInfo.SerialNumber: \"" + deviceInfo.SerialNumber + "\"");
+                Assert.False(string.IsNullOrWhiteSpace(deviceInfo.Path));
+                var productId = deviceInfo.ProductId;
+                if (!string.IsNullOrEmpty(productId))
+                {
+                    Assert.True(productId.Length == 4);
+                }
+                var vendorId = deviceInfo.VendorId;
+                if (!string.IsNullOrEmpty(vendorId))
+                {
+                    Assert.True(vendorId.Length == 4);
+                }
+                Assert.False(string.IsNullOrWhiteSpace(deviceInfo.Description));
+                Assert.False(string.IsNullOrWhiteSpace(deviceInfo.Manufacturer));
+                var optional = deviceInfo.Optional;
+                if (optional.ContainsKey("type"))
+                {
+                    Assert.False(string.IsNullOrWhiteSpace(optional["type"]));
+                }
+
+                var featureReport = UsbManager.GetHidFeatureReport(deviceInfo.Path, 0);
+                if (featureReport != null)
+                {
+                    _output.WriteLine("deviceInfo.FeatureReport: \"" + Util.Convert.ToHexString(featureReport) + "\"");
+                }
+            }
+        }
     }
 }


Default grid item aspect ratio to IGDB format

--- source/Playnite/Settings/PlayniteSettings.cs
+++ source/Playnite/Settings/PlayniteSettings.cs
@@ -409,7 +409,7 @@
         [JsonIgnore]
         public AspectRatio CoverAspectRatio => new AspectRatio(GridItemWidthRatio, GridItemHeightRatio);

-        private int gridItemWidthRatio = 27;
+        private int gridItemWidthRatio = 3;
         public int GridItemWidthRatio
         {
             get
@@ -426,7 +426,7 @@
             }
         }

-        private int gridItemHeightRatio = 38;
+        private int gridItemHeightRatio = 4;
         public int GridItemHeightRatio
         {
             get


Don't enable trace messages by default

Don't enable trace messages by default

--- source/Playnite/Settings/PlayniteSettings.cs
+++ source/Playnite/Settings/PlayniteSettings.cs
@@ -1520,7 +1520,7 @@
             }
         }

-        private bool traceLogEnabled = true;
+        private bool traceLogEnabled = false;
         public bool TraceLogEnabled
         {
             get => traceLogEnabled;


Fix: Group by category doesn't get remembered #97

--- source/PlayniteUI/Windows/MainWindow.xaml.cs
+++ source/PlayniteUI/Windows/MainWindow.xaml.cs
@@ -555,6 +555,8 @@
                 Localization.SetLanguage(Config.Language);
                 return;
             }
+
+            Config.SaveSettings();
         }

         private void FilterSettings_PropertyChanged(object sender, PropertyChangedEventArgs e)


prevent useless casts

prevent useless casts

--- src/AutoMapper/Internal/ExpressionFactory.cs
+++ src/AutoMapper/Internal/ExpressionFactory.cs
@@ -139,7 +139,7 @@
         public static Expression IfNullElse(Expression expression, Expression then, Expression @else = null)
         {
             var isNull = expression.Type.IsValueType() && !expression.Type.IsNullableType() ? (Expression) Constant(false) : Equal(expression, Constant(null));
-            return Condition(isNull, then, Convert(@else ?? Default(then.Type), then.Type));
+            return Condition(isNull, then, ToType(@else ?? Default(then.Type), then.Type));
         }

         internal class IfNotNullVisitor : ExpressionVisitor


Remove extra space.

Remove extra space.

--- src/Avalonia.Animation/TransitionInstance.cs
+++ src/Avalonia.Animation/TransitionInstance.cs
@@ -31,7 +31,7 @@
             var interpVal = (double)t.Ticks / _duration.Ticks;

             // Clamp interpolation value.
-            if (interpVal >= 1d |  (interpVal < 0d))
+            if (interpVal >= 1d | (interpVal < 0d))
             {
                 PublishNext(1d);
                 PublishCompleted();


cleanup

cleanup

--- src/Avalonia.FreeDesktop/DBusTrayIconImpl.cs
+++ src/Avalonia.FreeDesktop/DBusTrayIconImpl.cs
@@ -12,13 +12,9 @@

 [assembly: InternalsVisibleTo(Connection.DynamicAssemblyName)]

-#if SIGNED_BUILD
 [assembly:
     InternalsVisibleTo(
         "Avalonia.X11, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c1bba1142285fe0419326fb25866ba62c47e6c2b5c1ab0c95b46413fad375471232cb81706932e1cef38781b9ebd39d5100401bacb651c6c5bbf59e571e81b3bc08d2a622004e08b1a6ece82a7e0b9857525c86d2b95fab4bc3dce148558d7f3ae61aa3a234086902aeface87d9dfdd32b9d2fe3c6dd4055b5ab4b104998bd87")]
-#else
-[assembly: InternalsVisibleTo("Avalonia.X11")]
-#endif

 namespace Avalonia.FreeDesktop
 {


Use StringBuilder.Append instead of string concat

--- src/Compilers/Core/MSBuildTask/DotnetHost.cs
+++ src/Compilers/Core/MSBuildTask/DotnetHost.cs
@@ -66,7 +66,8 @@
         {
             var builder = new CommandLineBuilderExtension();
             builder.AppendFileNameIfNotNull(pathToTool);
-            builder.AppendTextUnquoted(" " + commandLineArgs);
+            builder.AppendTextUnquoted(" ");
+            builder.AppendTextUnquoted(commandLineArgs);
             return builder.ToString();
         }
     }


Traversal: Deal with uninitialized instances.

--- src/ExRam.Gremlinq.Core/Queries/Traversal.cs
+++ src/ExRam.Gremlinq.Core/Queries/Traversal.cs
@@ -12,7 +12,6 @@
     {
         public static readonly Traversal Empty = new(Array.Empty<Step>(), Projection.Empty);

-        private readonly int _count;
         private readonly Step?[]? _steps;

         internal Traversal(IEnumerable<Step> steps, Projection projection) : this(ToArrayHelper(steps), projection)
@@ -31,7 +30,7 @@

         internal Traversal(Step?[] steps, int count, SideEffectSemantics semantics, Projection projection)
         {
-            _count = count;
+            Count = count;
             _steps = steps;
             Projection = projection;
             SideEffectSemantics = semantics;
@@ -54,14 +53,14 @@
         {
             var steps = Steps;

-            if (_count < steps.Length)
+            if (Count < steps.Length)
             {
-                if (Interlocked.CompareExchange(ref steps[_count], step, default) != null)
+                if (Interlocked.CompareExchange(ref steps[Count], step, default) != null)
                     return Clone().Push(step);

                 return new Traversal(
                     steps,
-                    _count + 1,
+                    Count + 1,
                     step.SideEffectSemanticsChange == SideEffectSemanticsChange.Write
                         ? SideEffectSemantics.Write
                         : SideEffectSemantics,
@@ -78,17 +77,17 @@
             if (Count == 0)
                 throw new InvalidOperationException($"{nameof(Traversal)} is Empty.");

-            poppedStep = this[_count - 1];
-            return new Traversal(_steps!, _count - 1, Projection);
+            poppedStep = this[Count - 1];
+            return new Traversal(Steps, Count - 1, Projection);
         }

-        public Traversal WithProjection(Projection projection) => new(Steps, _count, projection);
+        public Traversal WithProjection(Projection projection) => new(Steps, Count, projection);

         public IEnumerator<Step> GetEnumerator()
         {
             var steps = Steps;

-            for (var i = 0; i < _count; i++)
+            for (var i = 0; i < Count; i++)
             {
                 yield return steps[i]!;
             }
@@ -102,10 +101,10 @@

                 if (projectionTraversal.Count > 0)
                 {
-                    var ret = new Step[_count + projectionTraversal.Count];
+                    var ret = new Step[Count + projectionTraversal.Count];

                     CopyTo(ret, 0);
-                    projectionTraversal.CopyTo(ret, _count);
+                    projectionTraversal.CopyTo(ret, Count);

                     return new Traversal(ret, Projection.Empty);
                 }
@@ -116,7 +115,7 @@

         IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();

-        public int Count { get => Steps is not null ? _count : 0; }
+        public int Count { get; }

         public Projection Projection { get; }

@@ -124,7 +123,7 @@
         {
             get => index < 0 || index >= Count
                 ? throw new ArgumentOutOfRangeException(nameof(index))
-                : _steps![index]!;
+                : Steps[index]!;
         }

         public SideEffectSemantics SideEffectSemantics { get; }
@@ -143,7 +142,7 @@

         internal Step Peek() => PeekOrDefault() ?? throw new InvalidOperationException($"{nameof(Traversal)} is Empty.");

-        internal Step? PeekOrDefault() => Count > 0 ? this[_count - 1] : null;
+        internal Step? PeekOrDefault() => Count > 0 ? this[Count - 1] : null;

         public static implicit operator Traversal(Step step) => new(new[] { step }, Projection.Empty);

@@ -156,9 +155,7 @@
             for (var i = 0; i < count; i++)
             {
                 if (steps[i]!.SideEffectSemanticsChange == SideEffectSemanticsChange.Write)
-                {
                     return SideEffectSemantics.Write;
-                }
             }

             return SideEffectSemantics.Read;
@@ -166,12 +163,12 @@

         private Traversal EnsureCapacity(int count)
         {
-            if (_steps!.Length < count)
+            if (Steps.Length < count)
             {
                 var newSteps = new Step[count];
-                Array.Copy(_steps!, newSteps, _count);
+                Array.Copy(Steps, newSteps, Count);

-                return new(newSteps, _count, SideEffectSemantics, Projection);
+                return new(newSteps, Count, SideEffectSemantics, Projection);
             }

             return this;
@@ -179,18 +176,13 @@

         private Traversal Clone()
         {
-            var newSteps = new Step[_steps!.Length];
-            Array.Copy(_steps!, newSteps, _count);
+            var newSteps = new Step[Steps.Length];
+            Array.Copy(Steps, newSteps, Count);

-            return new(newSteps, _count, SideEffectSemantics, Projection);
+            return new(newSteps, Count, SideEffectSemantics, Projection);
         }

-        private Step?[] Steps
-        {
-            get => _steps is { } steps
-                ? steps
-                : throw new InvalidOperationException($"{nameof(Traversal)} has not been initialized.");
-        }
+        private Step?[] Steps => _steps ?? Array.Empty<Step>();

         internal bool IsEmpty { get => Count == 0; }
     }


Wrapped RollBack and RollBackToVersion in try catch blocks for automatic transanction roll backs

--- src/FluentMigrator.Runner/MigrationRunner.cs
+++ src/FluentMigrator.Runner/MigrationRunner.cs
@@ -212,14 +212,21 @@

         public void Rollback(int steps, bool useAutomaticTransactionManagement)
 		{
-            //TODO: Wrap this in a try catch
-			foreach (var migrationNumber in VersionLoader.VersionInfo.AppliedMigrations().Take(steps))
-			{
-				ApplyMigrationDown(migrationNumber);
-			}
-
-			VersionLoader.LoadVersionInfo();
-            if (useAutomaticTransactionManagement) { Processor.CommitTransaction(); }
+            try
+            {
+                foreach (var migrationNumber in VersionLoader.VersionInfo.AppliedMigrations().Take(steps))
+                {
+                    ApplyMigrationDown(migrationNumber);
+                }
+
+                VersionLoader.LoadVersionInfo();
+                if (useAutomaticTransactionManagement) { Processor.CommitTransaction(); }
+            }
+            catch (Exception)
+            {
+                if (useAutomaticTransactionManagement) { Processor.RollbackTransaction(); }
+                throw;
+            }
 		}

         public void RollbackToVersion(long version)
@@ -230,23 +237,29 @@
         public void RollbackToVersion(long version, bool useAutomaticTransactionManagement)
 		{
             //TODO: Extract VersionsToApply Strategy
-            //TODO: Wrap this in a try catch
-
-			// Get the migrations between current and the to version
-			foreach (var migrationNumber in VersionLoader.VersionInfo.AppliedMigrations())
-			{
-				if (version < migrationNumber || version == 0)
-				{
-					ApplyMigrationDown(migrationNumber);
-				}
-			}
-
-			if (version == 0)
-				VersionLoader.RemoveVersionTable();
-			else
-				VersionLoader.LoadVersionInfo();
-
-            if (useAutomaticTransactionManagement) { Processor.CommitTransaction(); }
+            try
+            {
+                // Get the migrations between current and the to version
+                foreach (var migrationNumber in VersionLoader.VersionInfo.AppliedMigrations())
+                {
+                    if (version < migrationNumber || version == 0)
+                    {
+                        ApplyMigrationDown(migrationNumber);
+                    }
+                }
+
+                if (version == 0)
+                    VersionLoader.RemoveVersionTable();
+                else
+                    VersionLoader.LoadVersionInfo();
+
+                if (useAutomaticTransactionManagement) { Processor.CommitTransaction(); }
+            }
+            catch (Exception)
+            {
+                if (useAutomaticTransactionManagement) { Processor.RollbackTransaction(); }
+                throw;
+            }
 		}

 		public Assembly MigrationAssembly


Mark method as obsolete

Mark method as obsolete

--- src/FluentValidation/Internal/RuleBuilder.cs
+++ src/FluentValidation/Internal/RuleBuilder.cs
@@ -57,6 +57,7 @@
 		/// Sets the validator associated with the rule. Use with complex properties where an IValidator instance is already declared for the property type.
 		/// </summary>
 		/// <param name="validator">The validator to set</param>
+		[Obsolete("This overload of SetValidator is no longer used. If you are trying to set a child validator for a collection, use SetCollectionValidator instead.")]
 		public IRuleBuilderOptions<T, TProperty> SetValidator(IValidator validator) {
 			validator.Guard("Cannot pass a null validator to SetValidator");
 			SetValidator(Extensions.InferPropertyValidatorForChildValidator(Rule, validator));


 * Fixed occasional crash in NotificationHandler.Close

git-svn-id: e2945e6dc2723cb01f425b5a7c3c201ce5019a89@1120 080cfd25-d5d9-4c59-82ea-70d02a200d8b

--- src/Gablarski.Clients/NotificationHandler.cs
+++ src/Gablarski.Clients/NotificationHandler.cs
@@ -267,7 +267,8 @@
 		{
 			Clear ();

-			MediaController.Reset();
+			if (MediaController != null)
+				MediaController.Reset();

 			this.client.Disconnected -= OnClientDisconnected;
 			this.client.Users.UserJoined -= OnUserJoined;


feat(identifiable): add default for generic

--- src/JsonApiDotNetCore/Models/Identifiable.cs
+++ src/JsonApiDotNetCore/Models/Identifiable.cs
@@ -1,6 +1,9 @@
 namespace JsonApiDotNetCore.Models
 {
-    public abstract class Identifiable<T> : IIdentifiable<T>, IIdentifiable
+    public class Identifiable : Identifiable<int>
+    {}
+
+    public class Identifiable<T> : IIdentifiable<T>, IIdentifiable
     {
         public T Id { get; set; }


Add exception handling - missed from merge.

--- src/Kafka/Kafka.Client/Producers/Producer.cs
+++ src/Kafka/Kafka.Client/Producers/Producer.cs
@@ -90,11 +90,19 @@

             if (this.populateProducerPool)
             {
-                IDictionary<int, Broker> allBrokers = this.brokerPartitionInfo.GetAllBrokerInfo();
-                foreach (var broker in allBrokers)
-                {
-                    this.producerPool.AddProducer(
-                        new Broker(broker.Key, broker.Value.Host, broker.Value.Host, broker.Value.Port));
+                try
+                {
+                    IDictionary<int, Broker> allBrokers = this.brokerPartitionInfo.GetAllBrokerInfo();
+                    foreach (var broker in allBrokers)
+                    {
+                        this.producerPool.AddProducer(
+                            new Broker(broker.Key, broker.Value.Host, broker.Value.Host, broker.Value.Port));
+                    }
+                }
+                catch
+                {
+                    this.brokerPartitionInfo.Dispose();
+                    throw;
                 }
             }
         }


Refactored ACPI class for better code style

--- src/Kernel/Kernel_alpha/Drivers/ACPI/ACPI.cs
+++ src/Kernel/Kernel_alpha/Drivers/ACPI/ACPI.cs
@@ -71,7 +71,7 @@

             for (int i = 19; i >= 16; i--)
             {
-                addr += (*((byte*)ptr + i));
+                addr += (*(ptr + i));
                 addr = (i == 16) ? addr : addr << 8;
             }

@@ -80,14 +80,14 @@

             for (int i = 3; i >= 0; i--)
             {
-                addr += (*((byte*)ptr + i));
+                addr += (*(ptr + i));
                 addr = (i == 0) ? addr : addr << 8;
             }

             int length = addr;
             ptr -= 4;

-            if (ptr != null && misc.acpiCheckHeader((byte*)ptr, "RSDT") == 0)
+            if (ptr != null && misc.acpiCheckHeader(ptr, "RSDT") == 0)
             {
                 addr = 0;
                 int entrys = length;
@@ -99,12 +99,12 @@
                 {
                     for (int i = 3; i >= 0; i--)
                     {
-                        addr += (*((byte*)ptr + i));
+                        addr += (*(ptr + i));
                         addr = (i == 0) ? addr : addr << 8;
                     }

                     yeuse = (byte*)addr;
-                    Facp = (byte*)yeuse;
+                    Facp = yeuse;

                     if (misc.Compare("FACP", Facp) == 0)
                     {
@@ -115,7 +115,7 @@

                             while (0 < dsdtLength--)
                             {
-                                if (misc.Compare("_S5_", (byte*)S5Addr) == 0)
+                                if (misc.Compare("_S5_", S5Addr) == 0)
                                     break;
                                 S5Addr++;
                             }
@@ -185,11 +185,11 @@
                     }

                     if (i < 300) return true;
-                    else return false;
-                }
-                else return false;
-            }
-            else return true;
+                    return false;
+                }
+                return false;
+            }
+            return true;
         }

         // Disable ACPI
@@ -251,19 +251,32 @@
         // FACP Table
         private byte facpbget (int number)
         {
-            if (number == 0) { return *(Facp + 52); }
-            else if (number == 1) { return *(Facp + 53); }
-            else if (number == 2) { return *(Facp + 89); }
-            else return 0;
+            switch (number) {
+            case 0:
+                return *(Facp + 52);
+            case 1:
+                return *(Facp + 53);
+            case 2:
+                return *(Facp + 89);
+            default:
+                return 0;
+            }
         }

         private int* facpget (int number)
         {
-            if (number == 0) { return (int*)*((int*)(Facp + 40)); }
-            else if (number == 1) { return (int*)*((int*)(Facp + 48)); }
-            else if (number == 2) { return (int*)*((int*)(Facp + 64)); }
-            else if (number == 3) { return (int*)*((int*)(Facp + 68)); }
-            else { return null; }
+            switch (number) {
+            case 0:
+                return (int*)*((int*)(Facp + 40));
+            case 1:
+                return (int*)*((int*)(Facp + 48));
+            case 2:
+                return (int*)*((int*)(Facp + 64));
+            case 3:
+                return (int*)*((int*)(Facp + 68));
+            default:
+                return null;
+            }
         }
     }
 }


arp results parsed

arp results parsed

--- src/LANMachines/LanPingerAsync/ArpScanner.cs
+++ src/LANMachines/LanPingerAsync/ArpScanner.cs
@@ -18,8 +18,12 @@
         {
             List<string> reachableMachines = new List<string>();

-            string arpRes = getArpScan();
-            Console.WriteLine(arpRes);
+            List<string> arpRes = getArpScan();
+
+            foreach (string res in arpRes)
+            {
+                Console.WriteLine(res);
+            } // end foreach

             return reachableMachines;
         } // end method
@@ -28,7 +32,7 @@

         #region Private Methods

-        private string getArpScan()
+        private List<string> getArpScan()
         {
             Process arpProcess = new Process();
             ProcessStartInfo procInfo = new ProcessStartInfo()
@@ -43,11 +47,27 @@
             arpProcess.StartInfo = procInfo;
             arpProcess.Start();

-            string output = arpProcess.StandardOutput.ReadToEnd();
+            string procOut = "";
+            List<string> arpScanResults = new List<string>();
+            while ((procOut = arpProcess.StandardOutput.ReadLine()) != null)
+            {
+                string[] parts = procOut.Trim().Split(' ');
+
+                if (parts.Length == 0)
+                {
+                    continue;
+                } // end if
+
+                string address = parts[0];
+                if (!String.IsNullOrEmpty(address) && char.IsDigit(address[0]))
+                {
+                    arpScanResults.Add(address);
+                } // end if
+            } // end while

             arpProcess.WaitForExit();

-            return output;
+            return arpScanResults;
         } // end method

         #endregion


fix openfile command

fix openfile command

--- src/MarkdownEdit/Commands/OpenFileCommand.cs
+++ src/MarkdownEdit/Commands/OpenFileCommand.cs
@@ -6,7 +6,7 @@
 {
     internal static class OpenFileCommand
     {
-        public static readonly RoutedCommand Command = new RoutedCommand();
+        public static readonly RoutedCommand Command = ApplicationCommands.Open;

         static OpenFileCommand()
         {


Refactor out base.Init call in CCMenu

Refactor out base.Init call in CCMenu

--- cocos2d/menu_nodes/CCMenu.cs
+++ cocos2d/menu_nodes/CCMenu.cs
@@ -145,40 +145,37 @@
                     RemoveChild(i, false);
                 }
             }
-            if (base.Init())
-            {
-                TouchPriority = kCCMenuHandlerPriority;
-                TouchMode = CCTouchMode.OneByOne;
-                TouchEnabled = true;
-
-                m_bEnabled = true;
-                // menu in the center of the screen
-                CCSize s = CCDirector.SharedDirector.WinSize;
-
-                IgnoreAnchorPointForPosition = true;
-                AnchorPoint = new CCPoint(0.5f, 0.5f);
-                ContentSize = s;
-
-                Position = (new CCPoint(s.Width / 2, s.Height / 2));
-
-                if (items != null)
-                {
-                    int z = 0;
-                    foreach (CCMenuItem item in items)
-                    {
-                        AddChild(item, z);
-                        z++;
-                    }
-                }
-
-                //    [self alignItemsVertically];
-                m_pSelectedItem = null;
-                m_eState = CCMenuState.Waiting;
-
-                // enable cascade color and opacity on menus
-                CascadeColorEnabled = true;
-                CascadeOpacityEnabled = true;
-            }
+            TouchPriority = kCCMenuHandlerPriority;
+            TouchMode = CCTouchMode.OneByOne;
+            TouchEnabled = true;
+
+            m_bEnabled = true;
+            // menu in the center of the screen
+            CCSize s = CCDirector.SharedDirector.WinSize;
+
+            IgnoreAnchorPointForPosition = true;
+            AnchorPoint = new CCPoint(0.5f, 0.5f);
+            ContentSize = s;
+
+            Position = (new CCPoint(s.Width / 2, s.Height / 2));
+
+            if (items != null)
+            {
+                int z = 0;
+                foreach (CCMenuItem item in items)
+                {
+                    AddChild(item, z);
+                    z++;
+                }
+            }
+
+            //    [self alignItemsVertically];
+            m_pSelectedItem = null;
+            m_eState = CCMenuState.Waiting;
+
+            // enable cascade color and opacity on menus
+            CascadeColorEnabled = true;
+            CascadeOpacityEnabled = true;
         }

         /*


Instantiate the regexes once.

Instantiate the regexes once.

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

--- src/MonoTorrent/MonoTorrent.Common/PeerID.cs
+++ src/MonoTorrent/MonoTorrent.Common/PeerID.cs
@@ -138,6 +138,17 @@
     /// </summary>
     public struct Software
     {
+        static readonly Regex bow = new Regex("-BOWA");
+        static readonly Regex brahms = new Regex("M/d-/d-/d--");
+        static readonly Regex bitlord = new Regex("exbc..LORD");
+        static readonly Regex bittornado = new Regex(@"(([A-Za-z]{1})\d{2}[A-Za-z]{1})----*");
+        static readonly Regex bitcomet = new Regex("exbc");
+        static readonly Regex mldonkey = new Regex("-ML/d\\./d\\./d");
+        static readonly Regex opera = new Regex("OP/d{4}");
+        static readonly Regex queenbee = new Regex("Q/d-/d-/d--");
+        static readonly Regex standard = new Regex(@"-(([A-Za-z\~]{2})\d{4})-*");
+        static readonly Regex shadows = new Regex(@"(([A-Za-z]{1})\d{3})----*");
+        static readonly Regex xbt = new Regex("XBT/d/{3}");
         private Client client;
         private string peerId;
         private string shortId;
@@ -161,16 +172,12 @@
         internal Software(string peerId)
         {
             Match m;
-            Regex r;

             this.peerId = peerId;

             #region Standard style peers
-            r = new Regex(@"-(([A-Za-z\~]{2})\d{4})-*");
-            if (r.IsMatch(peerId))
-            {
-                m = r.Match(peerId);
-
+            if ((m = standard.Match(peerId)) !=null)
+            {
                 this.shortId = m.Groups[1].Value;
                 switch (m.Groups[2].Value)
                 {
@@ -320,10 +327,8 @@
             #endregion

             #region Shadows Style
-            r = new Regex(@"(([A-Za-z]{1})\d{3})----*");
-            if (r.IsMatch(peerId))
-            {
-                m = r.Match(peerId);
+            if ((m = shadows.Match(peerId)) != null)
+            {
                 this.shortId = m.Groups[1].Value;
                 switch (m.Groups[2].Value)
                 {
@@ -361,8 +366,7 @@
             #endregion

             #region Brams Client
-            r = new Regex("M/d-/d-/d--");
-            if (r.IsMatch(peerId))
+            if ((m = brahms.Match(peerId)) != null)
             {
                 this.shortId = "M";
                 this.client = Client.BitTorrent;
@@ -371,8 +375,7 @@
             #endregion

             #region BitLord
-            r = new Regex("exbc..LORD");
-            if (r.IsMatch(peerId))
+            if ((m = bitlord.Match(peerId)) != null)
             {
                 this.client = Client.BitLord;
                 this.shortId = "lord";
@@ -381,8 +384,7 @@
             #endregion

             #region BitComet
-            r = new Regex("exbc");
-            if (r.IsMatch(peerId))
+            if ((m = bitcomet.Match(peerId)) != null)
             {
                 this.client = Client.BitComet;
                 this.shortId = "BC";
@@ -391,8 +393,7 @@
             #endregion

             #region XBT
-            r = new Regex("XBT/d/{3}");
-            if (r.IsMatch(peerId))
+            if ((m = xbt.Match(peerId)) != null)
             {
                 this.client = Client.XBTClient;
                 this.shortId = "XBT";
@@ -401,8 +402,7 @@
             #endregion

             #region Opera
-            r = new Regex("OP/d{4}");
-            if (r.IsMatch(peerId))
+            if ((m = opera.Match(peerId)) != null)
             {
                 this.client = Client.Opera;
                 this.shortId = "OP";
@@ -410,8 +410,7 @@
             #endregion

             #region MLDonkey
-            r = new Regex("-ML/d\\./d\\./d");
-            if (r.IsMatch(peerId))
+            if ((m = mldonkey .Match(peerId)) != null)
             {
                 this.client = Client.MLDonkey;
                 this.shortId = "ML";
@@ -420,8 +419,7 @@
             #endregion

             #region Bits on wheels
-            r = new Regex("-BOWA");
-            if (r.IsMatch(peerId))
+            if ((m = bow.Match(peerId)) != null)
             {
                 this.client = Client.BitsOnWheels;
                 this.shortId = "BOW";
@@ -430,8 +428,7 @@
             #endregion

             #region Queen Bee
-            r = new Regex("Q/d-/d-/d--");
-            if (r.IsMatch(peerId))
+            if ((m = queenbee.Match(peerId)) != null)
             {
                 this.client = Client.QueenBee;
                 this.shortId = "Q";
@@ -440,10 +437,8 @@
             #endregion

             #region BitTornado special style
-            r = new Regex(@"(([A-Za-z]{1})\d{2}[A-Za-z]{1})----*");
-            if(r.IsMatch(peerId))
-            {
-                m = r.Match(peerId);
+            if((m = bittornado.Match(peerId)) != null)
+            {
                 this.shortId = m.Groups[1].Value;
                 this.client = Client.BitTornado;
                 return;


camboi comen

camboi comen

--- src/Movimientos.Web.Api.Models/EntityBase.cs
+++ src/Movimientos.Web.Api.Models/EntityBase.cs
@@ -15,7 +15,7 @@
             set { links = value; }
         }

-
+        //lsdkfnsdkvsd

         public void AddLink(Link link)
         {


Fixing ArgumentsToParameters

Fixing ArgumentsToParameters

--- src/Neat.Procedure/Neat.Procedure/Command.cs
+++ src/Neat.Procedure/Neat.Procedure/Command.cs
@@ -47,10 +47,12 @@
             using (var command = new SqlCommand(ParametersQuery, cmd.Connection))
             {
                 command.Parameters.AddWithValue("@SpecificName", cmd.CommandText);
-                var reader = command.ExecuteReader();
-                var i = 0;
-                while (reader.Read() && i < parameters.Length)
-                    cmd.Parameters.AddWithValue(reader[ParameterNameColumn] as string, parameters[i++]);
+                using (var reader = command.ExecuteReader())
+                {
+                    var i = 0;
+                    while (reader.Read() && i < parameters.Length)
+                        cmd.Parameters.AddWithValue(reader[ParameterNameColumn] as string, parameters[i++]);
+                }
             }
         }
     }


Remove a TODO which we don't really want to do.

--- src/NodaTime/Globalization/NodaFormatInfo.cs
+++ src/NodaTime/Globalization/NodaFormatInfo.cs
@@ -190,7 +190,6 @@
         internal FixedFormatInfoPatternParser<LocalDate> LocalDatePatternParser { get { return localDatePatternParser; } }
         internal FixedFormatInfoPatternParser<LocalDateTime> LocalDateTimePatternParser { get { return localDateTimePatternParser; } }

-        // TODO(Post-V1): Make these writable?
         /// <summary>
         /// Returns a read-only list of the names of the months for the default calendar for this culture.
         /// See the usage guide for caveats around the use of these names for other calendars.


Add subsystem names for BFME1

Add subsystem names for BFME1

--- src/OpenSage.Game/Content/SubsystemLoader.cs
+++ src/OpenSage.Game/Content/SubsystemLoader.cs
@@ -106,6 +106,7 @@
                 case Subsystem.Core:
                     switch (_gameDefinition.Game)
                     {
+                        case SageGame.Bfme:
                         case SageGame.Bfme2:
                         case SageGame.Bfme2Rotwk:
                             yield return "TheWritableGlobalData";
@@ -121,6 +122,7 @@
                 case Subsystem.ObjectCreation:
                     switch (_gameDefinition.Game)
                     {
+                        case SageGame.Bfme:
                         case SageGame.Bfme2:
                         case SageGame.Bfme2Rotwk:
                             yield return "TheThingFactory";
@@ -134,6 +136,7 @@
                 case Subsystem.Players:
                     switch (_gameDefinition.Game)
                     {
+                        case SageGame.Bfme:
                         case SageGame.Bfme2:
                         case SageGame.Bfme2Rotwk:
                         case SageGame.Cnc3:
@@ -145,6 +148,7 @@
                 case Subsystem.Terrain:
                     switch (_gameDefinition.Game)
                     {
+                        case SageGame.Bfme:
                         case SageGame.Bfme2:
                         case SageGame.Bfme2Rotwk:
                         case SageGame.Cnc3:
@@ -157,6 +161,7 @@
                 case Subsystem.ParticleSystems:
                     switch (_gameDefinition.Game)
                     {
+                        case SageGame.Bfme:
                         case SageGame.Bfme2:
                         case SageGame.Bfme2Rotwk:
                             yield return "TheParticleSystemManager";
@@ -172,6 +177,7 @@
                 case Subsystem.Multiplayer:
                     switch (_gameDefinition.Game)
                     {
+                        case SageGame.Bfme:
                         case SageGame.Bfme2:
                         case SageGame.Bfme2Rotwk:
                             yield return "TheMultiplayerSettings";


Improve code documentation in the IStorageEngine interface

--- src/Openchain.Abstractions/IStorageEngine.cs
+++ src/Openchain.Abstractions/IStorageEngine.cs
@@ -24,7 +24,7 @@
     public interface IStorageEngine : IDisposable
     {
         /// <summary>
-        /// Initialize the storage engine.
+        /// Initializes the storage engine.
         /// </summary>
         /// <returns>The task object representing the asynchronous operation.</returns>
         Task Initialize();


improved equals + added an initial version of GetHashCode implementation

--- src/Parameters/Shared/SharedParameterFile.cs
+++ src/Parameters/Shared/SharedParameterFile.cs
@@ -11,11 +11,11 @@

 namespace CodeCave.Revit.Toolkit.Parameters.Shared
 {
-    /// <inheritdoc />
+    /// <inheritdoc cref="ICloneable" />
     /// <summary>
     /// This class represents Revit shared parameter file
     /// </summary>
-    public sealed partial class SharedParameterFile : ICloneable
+    public sealed partial class SharedParameterFile : ICloneable, IEquatable<SharedParameterFile>
     {
         private static readonly Regex SectionRegex;
         private static readonly Configuration CsvConfiguration;
@@ -287,20 +287,31 @@
         }

         /// <summary>
-        /// Determines whether the specified <see cref="System.Object" />, is equal to this instance.
-        /// </summary>
-        /// <param name="obj">The <see cref="System.Object" /> to compare with this instance.</param>
+        /// Determines whether the specified <see cref="Object" />, is equal to this instance.
+        /// </summary>
+        /// <param name="obj">The <see cref="Object" /> to compare with this instance.</param>
         /// <returns>
         /// </returns>
         public override bool Equals(object obj)
         {
-            if (!(obj is SharedParameterFile))
-            {
-                // ReSharper disable once BaseObjectEqualsIsObjectEquals
-                return base.Equals(obj);
-            }
-
-            var other = (SharedParameterFile) obj;
+            if (ReferenceEquals(null, obj)) return false;
+            if (ReferenceEquals(this, obj)) return true;
+            return obj.GetType() == GetType() && Equals(obj as SharedParameterFile);
+        }
+
+        /// <inheritdoc />
+        /// <summary>
+        /// Indicates whether the current object is equal to another object of the same type.
+        /// </summary>
+        /// <param name="other">An object to compare with this object.</param>
+        /// <returns>
+        /// true if the current object is equal to the <paramref name="other">other</paramref> parameter; otherwise, false.
+        /// </returns>
+        public bool Equals(SharedParameterFile other)
+        {
+            // ReSharper disable once UseNullPropagation
+            if (other == null) return false;
+
             if (Metadata.Version != other.Metadata.Version || Metadata.MinVersion != other.Metadata.MinVersion)
                 return false;

@@ -345,5 +356,23 @@

             return clone;
         }
+
+        /// <summary>
+        /// Returns a hash code for this instance.
+        /// </summary>
+        /// <returns>
+        /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
+        /// </returns>
+        public override int GetHashCode()
+        {
+            unchecked
+            {
+                var hashCode = -409059346;
+                hashCode = hashCode * -1521134295 + EqualityComparer<Meta>.Default.GetHashCode(Metadata);
+                hashCode = hashCode * -1521134295 + EqualityComparer<List<Group>>.Default.GetHashCode(Groups);
+                hashCode = hashCode * -1521134295 + EqualityComparer<List<Parameter>>.Default.GetHashCode(Parameters);
+                return hashCode;
+            }
+        }
     }
 }


removed unnecessary method

removed unnecessary method

--- src/Peachpie.Runtime/Utilities/ArrayUtils.cs
+++ src/Peachpie.Runtime/Utilities/ArrayUtils.cs
@@ -81,27 +81,6 @@
         /// </summary>
         /// <returns>Last character or <c>\0</c>.</returns>
         public static char Last(this string str) => StringUtils.LastChar(str);
-
-        /// <summary>
-        /// Fast trim of a specified character.
-        /// </summary>
-        public static string Trim(string str, char ch)
-        {
-            if (!string.IsNullOrEmpty(str))
-            {
-                int i = 0;
-                int j = str.Length - 1;
-
-                //
-                while (i < str.Length && str[i] == ch) i++;
-                while (j > i && str[j] == ch) j--;
-
-                //
-                return i < j ? str.Substring(i, j - i + 1) : string.Empty;
-            }
-
-            return str;
-        }

         /// <summary>
         /// Fills a portion of an array of bytes by specified byte.


debug info

debug info

--- src/Resin.UnitTests/MappedTrieReaderTests.cs
+++ src/Resin.UnitTests/MappedTrieReaderTests.cs
@@ -4,6 +4,7 @@
 using Resin.IO.Read;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
 using System.Collections.Generic;
+using System.Diagnostics;

 namespace Tests
 {
@@ -29,6 +30,8 @@
                 node.PostingsAddress = new BlockInfo(long.MinValue, int.MinValue);
             }

+            File.WriteAllText("Can_find_within_range.log", tree.Visualize(), System.Text.Encoding.UTF8);
+
             tree.Serialize(fileName);

             IList<Word> words;


Completes with async exception and runs finally after one step completes async then throws sync exception

--- projects/AsyncEnumSample/test/AsyncEnumSample.Test.Unit/AsyncOperationTest.cs
+++ projects/AsyncEnumSample/test/AsyncEnumSample.Test.Unit/AsyncOperationTest.cs
@@ -263,7 +263,7 @@
         }

         [Fact]
-        public void Completes_with_async_exception_and_runs_finally_after_one_step_completes_async_then_throws_sync_exception()
+        public void Completes_with_async_exception_and_runs_finally_after_one_step_completes_async_then_throws_sync_exception_on_end()
         {
             InvalidTimeZoneException expected = new InvalidTimeZoneException("Expected.");
             ThrowOnEndOfOneAsyncStepWithFinallyOperation op = new ThrowOnEndOfOneAsyncStepWithFinallyOperation(expected);
@@ -280,6 +280,24 @@
             Assert.True(op.RanFinally);
         }

+        [Fact]
+        public void Completes_with_async_exception_and_runs_finally_after_one_step_completes_async_then_throws_sync_exception()
+        {
+            InvalidTimeZoneException expected = new InvalidTimeZoneException("Expected.");
+            ThrowAfterAsyncStepWithFinallyOperation op = new ThrowAfterAsyncStepWithFinallyOperation(expected);
+            Task<int> task = op.Start();
+
+            Assert.False(task.IsCompleted);
+
+            op.Complete();
+
+            Assert.Equal(TaskStatus.Faulted, task.Status);
+            Assert.NotNull(task.Exception);
+            Assert.Equal(1, task.Exception.InnerExceptions.Count);
+            Assert.Same(expected, task.Exception.InnerExceptions[0]);
+            Assert.True(op.RanFinally);
+        }
+
         private sealed class SetResultInCtorOperation : AsyncOperation<int>
         {
             public SetResultInCtorOperation(int result)
@@ -722,5 +740,37 @@
                 }
             }
         }
+
+        private sealed class ThrowAfterAsyncStepWithFinallyOperation : AsyncOperation<int>
+        {
+            private readonly Exception exception;
+            private readonly TaskCompletionSource<bool> tcs;
+
+            public ThrowAfterAsyncStepWithFinallyOperation(Exception exception)
+            {
+                this.exception = exception;
+                this.tcs = new TaskCompletionSource<bool>();
+            }
+
+            public bool RanFinally { get; private set; }
+
+            public void Complete()
+            {
+                this.tcs.SetResult(false);
+            }
+
+            protected override IEnumerator<Step> Steps()
+            {
+                try
+                {
+                    yield return Step.Await(this, thisPtr => thisPtr.tcs.Task);
+                    throw this.exception;
+                }
+                finally
+                {
+                    this.RanFinally = true;
+                }
+            }
+        }
     }
 }


Remove extra logic around length. Instead, just truncate long to int.

--- src/SendGrid/Helpers/Mail/SendGridMessage.cs
+++ src/SendGrid/Helpers/Mail/SendGridMessage.cs
@@ -20,9 +20,6 @@
     [JsonObject(IsReference = false)]
     public class SendGridMessage
     {
-        // Maximum attachment size is limited to 30MB
-        private const int MaxAttachmentSize = 30 * 1024 * 1024;
-
         /// <summary>
         /// Gets or sets an email object containing the email address and name of the sender. Unicode encoding is not supported for the from field.
         /// </summary>
@@ -991,7 +988,7 @@
         }

         /// <summary>
-        /// Add an attachment from a stream to the email. No attachment will be added in the case that the stream cannot be read, or if the attachment length exceeds SendGrid's maximum size (30MB).
+        /// Add an attachment from a stream to the email. No attachment will be added in the case that the stream cannot be read. Streams of length greater than int.MaxValue are truncated
         /// </summary>
         /// <param name="filename">The filename the attachment will display in the email.</param>
         /// <param name="contentStream">The stream to use as content of the attachment.</param>
@@ -1008,15 +1005,10 @@
                 return;
             }

-            if (contentStream.Length > MaxAttachmentSize)
-            {
-                return;
-            }
-
-            var streamBytes = new byte[contentStream.Length];
-
-            // Read all the bytes. Note that we can safely case the length as an int, as the maximum allowed is less than int.MaxValue
-            await contentStream.ReadAsync(streamBytes, 0, (int)contentStream.Length, cancellationToken);
+            var contentLength = Convert.ToInt32(contentStream.Length);
+            var streamBytes = new byte[contentLength];
+
+            await contentStream.ReadAsync(streamBytes, 0, contentLength, cancellationToken);

             var base64Content = Convert.ToBase64String(streamBytes);


Removed commented-out file.

Removed commented-out file.

--- src/Skia/Perspex.Skia.Android/MethodTable.cs
+++ src/Skia/Perspex.Skia.Android/MethodTable.cs
@@ -1,31 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.InteropServices;
-using System.Text;
-
-using Android.App;
-using Android.Content;
-using Android.Graphics;
-using Android.OS;
-using Android.Runtime;
-using Android.Views;
-using Android.Widget;
-
-namespace Perspex.Skia
-{
-/* No longer needed with SkiaSharp
-    class MethodTableImpl : MethodTable
-    {
-        [DllImport(@"perspesk")]
-        private static extern IntPtr GetPerspexMethodTable();
-        [DllImport(@"perspesk")]
-        private static extern IntPtr PerspexJniInit(IntPtr jniEnv);
-
-        public MethodTableImpl() : base(GetPerspexMethodTable())
-        {
-            PerspexJniInit(JNIEnv.Handle);
-        }
-    }
-	*/
-}


changes.

changes.

--- src/TWCore/Net/Multicast/DiscoveryService.cs
+++ src/TWCore/Net/Multicast/DiscoveryService.cs
@@ -169,7 +169,7 @@
                 if (LocalServices.All((s, serviceId) => s.Service.ServiceId != serviceId, service.ServiceId))
                 {
                     var sObj = new SerializedObject(service, Serializer);
-                    var sObjArr = (byte[])sObj.ToSubArray();
+                    var sObjArr = sObj.ToSubArray();
                     LocalServices.Add(new RegisteredServiceContainer(service, Serializer, sObjArr));
                 }
             }
@@ -338,7 +338,7 @@
         {
             while (!_token.IsCancellationRequested)
             {
-                var servicesBytes = new List<byte[]>();
+                var servicesBytes = new List<SubArray<byte>>();
                 lock (LocalServices)
                 {
                     foreach (var srv in LocalServices)
@@ -347,7 +347,7 @@
                         {
                             if (srv.Serializer != Serializer)
                             {
-                                srv.DataToSend = (byte[]) new SerializedObject(srv.Service, Serializer).ToSubArray();
+                                srv.DataToSend = new SerializedObject(srv.Service, Serializer).ToSubArray();
                                 srv.Serializer = Serializer;
                             }
                             servicesBytes.Add(srv.DataToSend);
@@ -355,7 +355,7 @@
                         else if (srv.Service.GetDataFunc != null)
                         {
                             srv.Service.Data = srv.Service.GetDataFunc();
-                            servicesBytes.Add((byte[])new SerializedObject(srv.Service, Serializer).ToSubArray());
+                            servicesBytes.Add(new SerializedObject(srv.Service, Serializer).ToSubArray());
                         }
                     }
                 }
@@ -371,9 +371,9 @@
         {
             public RegisteredService Service;
             public ISerializer Serializer;
-            public byte[] DataToSend;
-
-            public RegisteredServiceContainer(RegisteredService service, ISerializer serializer, byte[] dataToSend)
+            public SubArray<byte> DataToSend;
+
+            public RegisteredServiceContainer(RegisteredService service, ISerializer serializer, SubArray<byte> dataToSend)
             {
                 Service = service;
                 Serializer = serializer;


BasketMessageAdapter. Fix non supported subscriptions processing.


bugfix

bugfix

--- AppMetrics.Client/Tracker.cs
+++ AppMetrics.Client/Tracker.cs
@@ -35,7 +35,7 @@
 		{
 			lock (Sync)
 			{
-				if (LoggingThread.ThreadState != ThreadState.Running)
+				if (_terminated)
 					throw new InvalidOperationException();

 				var found = Sessions.Where(


Bump MinHeartBeatTTL from 5 to 10

Bump MinHeartBeatTTL from 5 to 10

--- ArchiSteamFarm/Statistics.cs
+++ ArchiSteamFarm/Statistics.cs
@@ -33,7 +33,7 @@

 namespace ArchiSteamFarm {
 	internal sealed class Statistics : IDisposable {
-		private const byte MinHeartBeatTTL = 5; // Minimum amount of minutes we must wait before sending next HeartBeat
+		private const byte MinHeartBeatTTL = 10; // Minimum amount of minutes we must wait before sending next HeartBeat

 		private static readonly SemaphoreSlim InitializationSemaphore = new SemaphoreSlim(1);


mod pitch and roll val

mod pitch and roll val


Disabling tracing

Disabling tracing

--- src/ControlzEx/Behaviors/WindowChrome/WindowChromeBehavior.MessageHandling.cs
+++ src/ControlzEx/Behaviors/WindowChrome/WindowChromeBehavior.MessageHandling.cs
@@ -113,7 +113,7 @@

             var message = (WM)msg;

-            System.Diagnostics.Trace.WriteLine($"{DateTime.Now} {hwnd} {message} {wParam} {lParam}");
+            //System.Diagnostics.Trace.WriteLine($"{DateTime.Now} {hwnd} {message} {wParam} {lParam}");

             switch (message)
             {


Allow 10 reconnection in wrflca processor.

--- src/EventStore/EventStore.TestClient/Commands/WriteFloodClientApiProcessor.cs
+++ src/EventStore/EventStore.TestClient/Commands/WriteFloodClientApiProcessor.cs
@@ -93,7 +93,7 @@
                     .DisableVerboseLogging()
                     .UseConsoleLogger()
                     .EnableOperationsForwarding()
-                    .LimitReconnectionsTo(0)
+                    .LimitReconnectionsTo(10)
                     //.KeepReconnecting()
                     .LimitRetriesForOperationTo(0)
                     //.KeepRetrying()


Remove use of tuple since we have a perfectly good type we can use.

--- src/Features/Core/Portable/FindReferences/IDefinitionsAndReferencesFactory.cs
+++ src/Features/Core/Portable/FindReferences/IDefinitionsAndReferencesFactory.cs
@@ -31,7 +31,7 @@
             var definitions = ImmutableArray.CreateBuilder<DefinitionItem>();
             var references = ImmutableArray.CreateBuilder<SourceReferenceItem>();

-            var uniqueLocations = new HashSet<ValueTuple<Document, TextSpan>>();
+            var uniqueLocations = new HashSet<DocumentLocation>();

             // Order the symbols by precedence, then create the appropriate
             // definition item per symbol and all refernece items for its
@@ -85,7 +85,7 @@
             ReferencedSymbol referencedSymbol,
             ImmutableArray<DefinitionItem>.Builder definitions,
             ImmutableArray<SourceReferenceItem>.Builder references,
-            HashSet<ValueTuple<Document, TextSpan>> uniqueLocations)
+            HashSet<DocumentLocation> uniqueLocations)
         {
             // See if this is a symbol we even want to present to the user.  If not,
             // ignore it entirely (including all its reference locations).
@@ -194,7 +194,7 @@
             ReferencedSymbol referencedSymbol,
             ImmutableArray<SourceReferenceItem>.Builder references,
             DefinitionItem definitionItem,
-            HashSet<ValueTuple<Document, TextSpan>> uniqueLocations)
+            HashSet<DocumentLocation> uniqueLocations)
         {
             foreach (var referenceLocation in referencedSymbol.Locations)
             {
@@ -204,14 +204,14 @@
                 var document = referenceLocation.Document;
                 var sourceSpan = location.SourceSpan;

-                if (uniqueLocations.Add(ValueTuple.Create(document, sourceSpan)))
+                var documentLocation = new DocumentLocation(document, sourceSpan);
+                if (!documentLocation.CanNavigateTo())
                 {
-                    var documentLocation = new DocumentLocation(document, sourceSpan);
-                    if (!documentLocation.CanNavigateTo())
-                    {
-                        continue;
-                    }
-
+                    continue;
+                }
+
+                if (uniqueLocations.Add(documentLocation))
+                {
                     references.Add(new SourceReferenceItem(definitionItem, documentLocation));
                 }
             }


Revert breaking parameter rename

Revert breaking parameter rename

--- src/Microsoft.AspNetCore.Authentication.OpenIdConnect/OpenIdConnectHandler.cs
+++ src/Microsoft.AspNetCore.Authentication.OpenIdConnect/OpenIdConnectHandler.cs
@@ -150,7 +150,7 @@
         /// Redirect user to the identity provider for sign out
         /// </summary>
         /// <returns>A task executing the sign out procedure</returns>
-        protected override async Task HandleSignOutAsync(SignOutContext context)
+        protected override async Task HandleSignOutAsync(SignOutContext signout)
         {
             Logger.EnteringOpenIdAuthenticationHandlerHandleSignOutAsync(GetType().FullName);

@@ -168,7 +168,7 @@
             };

             // Get the post redirect URI.
-            var properties = new AuthenticationProperties(context.Properties);
+            var properties = new AuthenticationProperties(signout.Properties);
             if (string.IsNullOrEmpty(properties.RedirectUri))
             {
                 properties.RedirectUri = BuildRedirectUriIfRelative(Options.PostLogoutRedirectUri);


fixes #5706 - standardize order on Properties, Validation, Bindings

--- src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/BindingsElementDriver.cs
+++ src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/BindingsElementDriver.cs
@@ -37,7 +37,7 @@

             var bindingsEditor = context.ShapeFactory.EditorTemplate(TemplateName: "FormBindings", Model: viewModel);

-            bindingsEditor.Metadata.Position = "Bindings:10";
+            bindingsEditor.Metadata.Position = "Bindings:20";

             return Editor(context, bindingsEditor);
         }


修改Demo

修改Demo

--- src/Senparc.Weixin.MP.Sample/Senparc.Weixin.MP.Sample/Views/Menu/Index.cshtml
+++ src/Senparc.Weixin.MP.Sample/Senparc.Weixin.MP.Sample/Views/Menu/Index.cshtml
@@ -75,7 +75,7 @@
             }

             #addConditionalArea h3, #reveiveJSON h3 {
-                font-size: 60%;
+                font-size: 16px;
                 margin-bottom: 20px;
             }


Add some comments to ProcessIOCPResult

Add some comments to ProcessIOCPResult

--- src/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncEventArgs.Windows.cs
+++ src/System.Net.Sockets/src/System/Net/Sockets/SocketAsyncEventArgs.Windows.cs
@@ -98,6 +98,9 @@
                     FinishOperationSyncSuccess(bytesTransferred, SocketFlags.None);
                     return SocketError.Success;
                 }
+
+                // Completed synchronously, but the handle wasn't marked as skip completion port on success,
+                // so we still need to fall through and behave as if the IO was pending.
             }
             else
             {
@@ -105,9 +108,12 @@
                 SocketError socketError = SocketPal.GetLastSocketError();
                 if (socketError != SocketError.IOPending)
                 {
+                    // Completed synchronously with a failure.
                     FinishOperationSyncFailure(socketError, bytesTransferred, SocketFlags.None);
                     return socketError;
                 }
+
+                // Fall through to IOPending handling for asynchronous completion.
             }

             // Socket handle is going to post a completion to the completion port (may have done so already).
@@ -128,6 +134,9 @@
                     FinishOperationSyncSuccess(bytesTransferred, SocketFlags.None);
                     return SocketError.Success;
                 }
+
+                // Completed synchronously, but the handle wasn't marked as skip completion port on success,
+                // so we still need to fall through and behave as if the IO was pending.
             }
             else
             {
@@ -135,10 +144,13 @@
                 socketError = SocketPal.GetLastSocketError();
                 if (socketError != SocketError.IOPending)
                 {
+                    // Completed synchronously with a failure.
                     _singleBufferHandleState = SingleBufferHandleState.None;
                     FinishOperationSyncFailure(socketError, bytesTransferred, SocketFlags.None);
                     return socketError;
                 }
+
+                // Fall through to IOPending handling for asynchronous completion.
             }

             // Socket handle is going to post a completion to the completion port (may have done so already).


change :get the correct alternative recursive field

--- src/Umbraco.Web/umbraco.presentation/item.cs
+++ src/Umbraco.Web/umbraco.presentation/item.cs
@@ -62,60 +62,51 @@
             else
             {
                 // Loop through XML children we need to find the fields recursive
-                if (helper.FindAttribute(attributes, "recursive") == "true")
-                {
-                    if (publishedContent == null)
+                var recursive = helper.FindAttribute(attributes, "recursive") == "true";
+
+                if (publishedContent == null)
+                {
+                    var recursiveVal = GetRecursiveValueLegacy(elements);
+                    _fieldContent = recursiveVal.IsNullOrWhiteSpace() ? _fieldContent : recursiveVal;
+                }
+
+                //check for published content and get its value using that
+                if (publishedContent != null && (publishedContent.HasProperty(_fieldName) || recursive))
+                {
+                    var pval = publishedContent.GetPropertyValue(_fieldName, recursive);
+                    var rval = pval == null ? string.Empty : pval.ToString();
+                    _fieldContent = rval.IsNullOrWhiteSpace() ? _fieldContent : rval;
+                }
+                else
+                {
+                    //get the vaue the legacy way (this will not parse locallinks, etc... since that is handled with ipublishedcontent)
+                    var elt = elements[_fieldName];
+                    if (elt != null && string.IsNullOrEmpty(elt.ToString()) == false)
+                        _fieldContent = elt.ToString().Trim();
+                }
+
+                //now we check if the value is still empty and if so we'll check useIfEmpty
+                if (string.IsNullOrEmpty(_fieldContent))
+                {
+                    var altFieldName = helper.FindAttribute(attributes, "useIfEmpty");
+                    if (string.IsNullOrEmpty(altFieldName) == false)
                     {
-                        var recursiveVal = GetRecursiveValueLegacy(elements);
-                        _fieldContent = recursiveVal.IsNullOrWhiteSpace() ? _fieldContent : recursiveVal;
+                        if (publishedContent != null && (publishedContent.HasProperty(altFieldName) || recursive))
+                        {
+                            var pval = publishedContent.GetPropertyValue(altFieldName, recursive);
+                            var rval = pval == null ? string.Empty : pval.ToString();
+                            _fieldContent = rval.IsNullOrWhiteSpace() ? _fieldContent : rval;
+                        }
+                        else
+                        {
+                            //get the vaue the legacy way (this will not parse locallinks, etc... since that is handled with ipublishedcontent)
+                            var elt = elements[altFieldName];
+                            if (elt != null && string.IsNullOrEmpty(elt.ToString()) == false)
+                                _fieldContent = elt.ToString().Trim();
+                        }
                     }
-                    else
-                    {
-					    var pval = publishedContent.GetPropertyValue(_fieldName, true);
-					    var rval = pval == null ? string.Empty : pval.ToString();
-					    _fieldContent = rval.IsNullOrWhiteSpace() ? _fieldContent : rval;
-                    }
-                }
-                else
-                {
-                    //check for published content and get its value using that
-                    if (publishedContent != null && publishedContent.HasProperty(_fieldName))
-                    {
-                        var pval = publishedContent.GetPropertyValue(_fieldName);
-                        var rval = pval == null ? string.Empty : pval.ToString();
-                        _fieldContent = rval.IsNullOrWhiteSpace() ? _fieldContent : rval;
-                    }
-                    else
-                    {
-                        //get the vaue the legacy way (this will not parse locallinks, etc... since that is handled with ipublishedcontent)
-                        var elt = elements[_fieldName];
-                        if (elt != null && string.IsNullOrEmpty(elt.ToString()) == false)
-                            _fieldContent = elt.ToString().Trim();
-                    }
-
-                    //now we check if the value is still empty and if so we'll check useIfEmpty
-                    if (string.IsNullOrEmpty(_fieldContent))
-                    {
-                        var altFieldName = helper.FindAttribute(attributes, "useIfEmpty");
-                        if (string.IsNullOrEmpty(altFieldName) == false)
-                        {
-                            if (publishedContent != null && publishedContent.HasProperty(altFieldName))
-                            {
-                                var pval = publishedContent.GetPropertyValue(altFieldName);
-                                var rval = pval == null ? string.Empty : pval.ToString();
-                                _fieldContent = rval.IsNullOrWhiteSpace() ? _fieldContent : rval;
-                            }
-                            else
-                            {
-                                //get the vaue the legacy way (this will not parse locallinks, etc... since that is handled with ipublishedcontent)
-                                var elt = elements[altFieldName];
-                                if (elt != null && string.IsNullOrEmpty(elt.ToString()) == false)
-                                    _fieldContent = elt.ToString().Trim();
-                            }
-                        }
-                    }
-
-                }
+                }
+
             }

             ParseItem(attributes);


Disable IntelliCode line completions for integration tests

Fixes #56394

--- src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs
+++ src/VisualStudio/IntegrationTest/TestUtilities/VisualStudioInstanceFactory.cs
@@ -331,6 +331,9 @@
                 // Disable roaming settings to avoid interference from the online user profile
                 Process.Start(CreateSilentStartInfo(vsRegEditExeFile, $"set \"{installationPath}\" {Settings.Default.VsRootSuffix} HKCU \"ApplicationPrivateSettings\\Microsoft\\VisualStudio\" RoamingEnabled string \"1*System.Boolean*False\"")).WaitForExit();

+                // Disable IntelliCode line completions to avoid interference with argument completion testing
+                Process.Start(CreateSilentStartInfo(vsRegEditExeFile, $"set \"{installationPath}\" {Settings.Default.VsRootSuffix} HKCU \"ApplicationPrivateSettings\\Microsoft\\VisualStudio\\IntelliCode\" wholeLineCompletions string \"0*System.Int32*2\"")).WaitForExit();
+
                 // Disable background download UI to avoid toasts
                 Process.Start(CreateSilentStartInfo(vsRegEditExeFile, $"set \"{installationPath}\" {Settings.Default.VsRootSuffix} HKCU \"FeatureFlags\\Setup\\BackgroundDownload\" Value dword 0")).WaitForExit();


Simplify

Simplify

--- src/Workspaces/Core/Portable/FindSymbols/FindReferences/FindReferenceCache.cs
+++ src/Workspaces/Core/Portable/FindSymbols/FindReferences/FindReferenceCache.cs
@@ -181,12 +181,12 @@
             public ImmutableHashSet<string>? AliasNameSet;
             public ImmutableArray<SyntaxToken> ConstructorInitializerCache;

+            public readonly ConcurrentDictionary<SyntaxNode, SymbolInfo> SymbolInfoCache = new();
             public readonly ConcurrentDictionary<string, ImmutableArray<SyntaxToken>> IdentifierCache;
-            public readonly ConcurrentDictionary<SyntaxNode, SymbolInfo> SymbolInfoCache = new();

             public Entry(SemanticModel semanticModel)
             {
-                IdentifierCache = new ConcurrentDictionary<string, ImmutableArray<SyntaxToken>>(semanticModel.Language switch
+                IdentifierCache = new(comparer: semanticModel.Language switch
                 {
                     LanguageNames.VisualBasic => StringComparer.OrdinalIgnoreCase,
                     LanguageNames.CSharp => StringComparer.Ordinal,


Removed serializer test

Removed serializer test

--- tests/Exceptionless.Tests/SerializerTests.cs
+++ tests/Exceptionless.Tests/SerializerTests.cs
@@ -1,14 +1,9 @@
 using System;
 using System.Collections.Generic;
-using System.Text.Json;
-using Exceptionless.Core.Authorization;
 using Exceptionless.Core.Extensions;
 using Exceptionless.Core.Models;
 using Exceptionless.Core.Models.Data;
-using Exceptionless.Core.Utility;
 using Exceptionless.Serializer;
-using Exceptionless.Web.Models;
-using Microsoft.Extensions.Logging;
 using Newtonsoft.Json;
 using Newtonsoft.Json.Linq;
 using Xunit;
@@ -96,20 +91,6 @@
             Assert.Equal("Hello", ev.Message);
             Assert.Equal("SomeVal", ev.Data["Blah"]);
         }
-
-        [Fact]
-        public void CanSerializeSimpleModel() {
-            var token = new NewToken {
-                OrganizationId = SampleDataService.TEST_ORG_ID,
-                ProjectId = SampleDataService.TEST_PROJECT_ID,
-                Scopes = new HashSet<string> { AuthorizationRoles.Client, AuthorizationRoles.User }
-            };
-
-            var settings = Core.Bootstrapper.ConfigureJsonSerializerOptions(new JsonSerializerOptions());
-            string json = System.Text.Json.JsonSerializer.Serialize(token, settings);
-            _logger.LogInformation(json);
-            ViewToken token2 = System.Text.Json.JsonSerializer.Deserialize<ViewToken>(json, settings);
-        }
     }

     public class SomeModel {


Test TryParse overload.

Test TryParse overload.

--- tests/Faithlife.Parsing.Tests/CommonTests.cs
+++ tests/Faithlife.Parsing.Tests/CommonTests.cs
@@ -5,11 +5,18 @@
 public class CommonTests
 {
 	[Fact]
-	public void ResultShouldAlwaysSucceed()
+	public void SuccessShouldAlwaysSucceed()
 	{
 		Parser.Success(true).TryParse("").ShouldSucceed(true, 0);
 		Parser.Success(true).TryParse("x").ShouldSucceed(true, 0);
 		Parser.Success(true).TryParse("xabc").ShouldSucceed(true, 0);
+	}
+
+	[Fact]
+	public void TryParseOverload()
+	{
+		Parser.Success(1).TryParse("", out var value).ShouldBe(true);
+		value.ShouldBe(1);
 	}

 	[Fact]


Add reminder comments.

Add reminder comments.

--- myLocalFarm/test/farmApi.Test/AccountControllerTests.cs
+++ myLocalFarm/test/farmApi.Test/AccountControllerTests.cs
@@ -8,6 +8,14 @@

 namespace farmApi.Test
 {
+    /// <summary>
+    /// Tests the Account Controller
+    /// </summary>
+    /// <remarks>
+    /// We are NOT also testing:
+    /// 1. The data access layer. So, in this test class, we don't check whether user creation succeeded in the data store.
+    /// 2. The emailer service. Neither do we test whether the emailer actually sent an email.
+    /// </remarks>
     public class AccountControllerTests
     {
         public AccountControllerTests()


XDocument now kept as private variable

XDocument now kept as private variable

Ensures the ResultDocument property can be accessed multiple times when
it comes from a stream.

--- src/core/BrightstarDB/Client/SparqlResult.cs
+++ src/core/BrightstarDB/Client/SparqlResult.cs
@@ -12,6 +12,7 @@
     {
         private Stream _resultStream;
         private readonly string _resultString;
+        private XDocument _resultDocument;

         internal SparqlResult(Stream resultStream)
         {
@@ -46,11 +47,13 @@
         {
             get
             {
-                if (_resultString != null)
+                if (_resultDocument == null)
                 {
-                    return XDocument.Parse(_resultString);
+                    _resultDocument = _resultString != null
+                        ? XDocument.Parse(_resultString)
+                        : XDocument.Load(_resultStream);
                 }
-                return XDocument.Load(_resultStream);
+                return _resultDocument;
             }
         }


Reverse assert conditions for efficiency.

--- osu.Framework/Graphics/Containers/Container_AutoSize.cs
+++ osu.Framework/Graphics/Containers/Container_AutoSize.cs
@@ -64,7 +64,7 @@
             set
             {
                 //transform check here is to allow AutoSizeDuration to work below.
-                Debug.Assert(Transforms.Find(t => t is TransformSize) != null || (AutoSizeAxes & Axes.Both) == 0, @"The Size of an AutoSizeContainer should only be manually set if it is relative to its parent.");
+                Debug.Assert((AutoSizeAxes & Axes.Both) == 0 || Transforms.Find(t => t is TransformSize) != null, @"The Size of an AutoSizeContainer should only be manually set if it is relative to its parent.");
                 base.Size = value;
             }
         }


Fix incorrect sorting.

Fix incorrect sorting.

--- osu.Game.Rulesets.Mania/Timing/TimingChangeContainer.cs
+++ osu.Game.Rulesets.Mania/Timing/TimingChangeContainer.cs
@@ -35,11 +35,37 @@
             target.Add(hitObject);
         }

+        protected override IComparer<Drawable> DepthComparer => new TimingChangeReverseStartTimeComparer();
+
         /// <summary>
         /// Finds the most applicable timing change that can contain a hit object.
         /// </summary>
         /// <param name="hitObject">The hit object to contain.</param>
-        /// <returns>The last timing change which can contain <paramref name="hitObject"/>.</returns>
-        private DrawableTimingChange timingChangeFor(DrawableHitObject hitObject) => Children.LastOrDefault(c => c.CanContain(hitObject)) ?? Children.FirstOrDefault();
+        /// <returns>The last timing change which can contain <paramref name="hitObject"/>. Null if no timing change can contain the hit object.</returns>
+        private DrawableTimingChange timingChangeFor(DrawableHitObject hitObject) => Children.FirstOrDefault(c => c.CanContain(hitObject));
+    }
+
+    /// <summary>
+    /// Compares two timing changes by their start time, falling back to creation order if their start time is equal.
+    /// This will compare the two timing changes in reverse order.
+    /// </summary>
+    public class TimingChangeReverseStartTimeComparer : Drawable.ReverseCreationOrderDepthComparer
+    {
+        public override int Compare(Drawable x, Drawable y)
+        {
+            var timingChangeX = x as DrawableTimingChange;
+            var timingChangeY = y as DrawableTimingChange;
+
+            // If either of the two drawables are not hit objects, fall back to the base comparer
+            if (timingChangeX?.TimingChange == null || timingChangeY?.TimingChange == null)
+                return base.Compare(x, y);
+
+            // Compare by start time
+            int i = timingChangeY.TimingChange.Time.CompareTo(timingChangeX.TimingChange.Time);
+            if (i != 0)
+                return i;
+
+            return base.Compare(x, y);
+        }
     }
 }


Add support for spinner glow

Add support for spinner glow

--- osu.Game.Rulesets.Osu/Skinning/LegacyNewStyleSpinner.cs
+++ osu.Game.Rulesets.Osu/Skinning/LegacyNewStyleSpinner.cs
@@ -21,6 +21,7 @@
     /// </summary>
     public class LegacyNewStyleSpinner : CompositeDrawable
     {
+        private Sprite glow;
         private Sprite discBottom;
         private Sprite discTop;
         private Sprite spinningMiddle;
@@ -29,6 +30,8 @@
         private DrawableSpinner drawableSpinner;

         private const float final_scale = 0.625f;
+
+        private readonly Color4 glowColour = new Color4(3, 151, 255, 255);

         [BackgroundDependencyLoader]
         private void load(ISkinSource source, DrawableHitObject drawableObject)
@@ -39,6 +42,14 @@

             InternalChildren = new Drawable[]
             {
+                glow = new Sprite
+                {
+                    Anchor = Anchor.Centre,
+                    Origin = Anchor.Centre,
+                    Texture = source.GetTexture("spinner-glow"),
+                    Blending = BlendingParameters.Additive,
+                    Colour = glowColour,
+                },
                 discBottom = new Sprite
                 {
                     Anchor = Anchor.Centre,
@@ -76,23 +87,38 @@

         private void updateStateTransforms(DrawableHitObject drawableHitObject, ArmedState state)
         {
-            if (!(drawableHitObject is DrawableSpinner d))
-                return;
+            switch (drawableHitObject)
+            {
+                case DrawableSpinner d:
+                    Spinner spinner = d.HitObject;

-            Spinner spinner = d.HitObject;
+                    using (BeginAbsoluteSequence(spinner.StartTime - spinner.TimePreempt, true))
+                        this.FadeOut();

-            using (BeginAbsoluteSequence(spinner.StartTime - spinner.TimePreempt, true))
-                this.FadeOut();
+                    using (BeginAbsoluteSequence(spinner.StartTime - spinner.TimeFadeIn / 2, true))
+                        this.FadeInFromZero(spinner.TimeFadeIn / 2);

-            using (BeginAbsoluteSequence(spinner.StartTime - spinner.TimeFadeIn / 2, true))
-                this.FadeInFromZero(spinner.TimeFadeIn / 2);
+                    using (BeginAbsoluteSequence(spinner.StartTime - spinner.TimePreempt, true))
+                    {
+                        fixedMiddle.FadeColour(Color4.White);

-            using (BeginAbsoluteSequence(spinner.StartTime - spinner.TimePreempt, true))
-            {
-                fixedMiddle.FadeColour(Color4.White);
+                        using (BeginDelayedSequence(spinner.TimePreempt, true))
+                            fixedMiddle.FadeColour(Color4.Red, spinner.Duration);
+                    }

-                using (BeginDelayedSequence(spinner.TimePreempt, true))
-                    fixedMiddle.FadeColour(Color4.Red, spinner.Duration);
+                    if (state == ArmedState.Hit)
+                    {
+                        using (BeginAbsoluteSequence(d.HitStateUpdateTime))
+                            glow.FadeOut(300);
+                    }
+
+                    break;
+
+                case DrawableSpinnerBonusTick _:
+                    if (state == ArmedState.Hit)
+                        glow.FlashColour(Color4.White, 200);
+
+                    break;
             }
         }

@@ -101,6 +127,8 @@
             base.Update();
             spinningMiddle.Rotation = discTop.Rotation = drawableSpinner.RotationTracker.Rotation;
             discBottom.Rotation = discTop.Rotation / 3;
+
+            glow.Alpha = drawableSpinner.Progress;

             Scale = new Vector2(final_scale * (0.8f + (float)Interpolation.ApplyEasing(Easing.Out, drawableSpinner.Progress) * 0.2f));
         }


Improve tiling logic

Improve tiling logic

--- osu.Game.Rulesets.Taiko/Skinning/LegacyTaikoScroller.cs
+++ osu.Game.Rulesets.Taiko/Skinning/LegacyTaikoScroller.cs
@@ -21,19 +21,28 @@
         {
             base.Update();

-            foreach (var sprite in InternalChildren)
+            while (true)
             {
-                sprite.X -= (float)Time.Elapsed * 0.1f;
+                float? additiveX = null;

-                if (sprite.X + sprite.DrawWidth < 0)
-                    sprite.Expire();
-            }
+                foreach (var sprite in InternalChildren)
+                {
+                    // add the x coordinates and perform re-layout on all sprites as spacing may change with gameplay scale.
+                    sprite.X = additiveX ??= sprite.X - (float)Time.Elapsed * 0.1f;

-            var last = InternalChildren.LastOrDefault();
+                    additiveX += sprite.DrawWidth - 1;

-            if (last == null || last.ScreenSpaceDrawQuad.TopRight.X < ScreenSpaceDrawQuad.TopRight.X)
-            {
-                AddInternal(new ScrollerSprite { X = last == null ? 0 : last.X + last.DrawWidth });
+                    if (sprite.X + sprite.DrawWidth < 0)
+                        sprite.Expire();
+                }
+
+                var last = InternalChildren.LastOrDefault();
+
+                // only break from this loop once we have saturated horizontal space completely.
+                if (last != null && last.ScreenSpaceDrawQuad.TopRight.X >= ScreenSpaceDrawQuad.TopRight.X)
+                    break;
+
+                AddInternal(new ScrollerSprite());
             }
         }