David/Stephen #1203 - Reverting back to storing as strings and the GetAllKeys filters strings

--- src/StockportContentApi/Utils/DistributedCacheWrapper.cs
+++ src/StockportContentApi/Utils/DistributedCacheWrapper.cs
@@ -32,7 +32,7 @@

         public string GetString(string key)
         {
-            return db.HashGet(key, "ContentApiData");
+            return db.StringGet(key);
         }

         public void Remove(string key)
@@ -42,7 +42,7 @@

         public void SetString(string key, string value, int minutes)
         {
-            db.HashSet(key, "ContentApiData", value);
+            db.StringAppend(key, value);
             db.KeyExpire(key, DateTime.Now.AddMinutes(minutes));
         }

@@ -51,7 +51,7 @@
             var keys = server.Keys();

             var redisValueData = new List<RedisValueData>();
-            keys.ToList().ForEach(k =>
+            keys.Where(k => db.KeyType(k) == RedisType.String).ToList().ForEach(k =>
             {
                 var valueWithExpiry = db.StringGetWithExpiry(k);

@@ -64,7 +64,7 @@

                 var jsonData = JsonConvert.DeserializeObject(valueWithExpiry.Value.ToString()) as JArray;

-                if(jsonData != null) data.NumberOfItems = jsonData.Count;
+                if (jsonData != null) data.NumberOfItems = jsonData.Count;

                 redisValueData.Add(data);
             });


Remove X11 dependency for tests which are enabled on Unix.

--- src/System.Drawing.Common/tests/Imaging/MetafileTests.cs
+++ src/System.Drawing.Common/tests/Imaging/MetafileTests.cs
@@ -135,8 +135,9 @@
         [MemberData(nameof(EmfType_TestData))]
         public void Ctor_IntPtrEmfType_Success(EmfType emfType)
         {
-            using (var bufferGraphics = Graphics.FromHwndInternal(IntPtr.Zero))
-            using (var metafile = new Metafile(bufferGraphics.GetHdc(), emfType))
+            using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb))
+            using (Graphics g = Graphics.FromImage(bmp))
+            using (var metafile = new Metafile(g.GetHdc(), emfType))
             {
                 AssertMetafileIsBlank(metafile);
                 AssertEmfType(metafile.GetMetafileHeader(), emfType);
@@ -155,9 +156,10 @@
         [MemberData(nameof(EmfType_Invalid_TestData))]
         public void Ctor_IntPtrInvalidEmfType_ThrowsArgumentException(EmfType emfType)
         {
-            using (var bufferGraphics = Graphics.FromHwndInternal(IntPtr.Zero))
-            {
-                AssertExtensions.Throws<ArgumentException>(null, () => new Metafile(bufferGraphics.GetHdc(), emfType));
+            using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb))
+            using (Graphics g = Graphics.FromImage(bmp))
+            {
+                AssertExtensions.Throws<ArgumentException>(null, () => new Metafile(g.GetHdc(), emfType));
             }
         }

@@ -392,8 +394,9 @@
         public void Ctor_StringIntPtrEmfType_Success(EmfType emfType)
         {
             string fileName = GetPath("newTestImage.wmf");
-            using (var bufferGraphics = Graphics.FromHwndInternal(IntPtr.Zero))
-            using (var metafile = new Metafile(fileName, bufferGraphics.GetHdc(), emfType))
+            using (Bitmap bmp = new Bitmap(10, 10, PixelFormat.Format32bppArgb))
+            using (Graphics g = Graphics.FromImage(bmp))
+            using (var metafile = new Metafile(fileName, g.GetHdc(), emfType))
             {
                 AssertMetafileIsBlank(metafile);
                 AssertEmfType(metafile.GetMetafileHeader(), emfType);


Removed allocations from DecCalc

Removed allocations from DecCalc

--- src/System.Private.CoreLib/src/System/Decimal.DecCalc.cs
+++ src/System.Private.CoreLib/src/System/Decimal.DecCalc.cs
@@ -2,11 +2,7 @@
 // The .NET Foundation licenses this file to you under the MIT license.
 // See the LICENSE file in the project root for more information.

-using System;
-using System.Globalization;
 using System.Runtime.InteropServices;
-using System.Runtime.CompilerServices;
-using System.Diagnostics.Contracts;

 namespace System
 {
@@ -71,7 +67,7 @@
         /// <summary>
         /// Class that contains all the mathematical calculations for decimal. Most of which have been ported from oleaut32.
         /// </summary>
-        private class DecCalc
+        private static unsafe class DecCalc
         {
             // Constant representing the negative number that is the closest possible
             // Decimal value to -0m.
@@ -250,7 +246,7 @@
              *   None.
              *
              ***********************************************************************/
-            private static uint Div96By32(uint[] rgulNum, uint ulDen)
+            private static uint Div96By32(uint* rgulNum, uint ulDen)
             {
                 Split64 sdlTmp = new Split64();

@@ -301,7 +297,7 @@
              *   None.
              *
              ***********************************************************************/
-            private static uint Div96By64(System.Collections.Generic.IList<uint> rgulNum, Split64 sdlDen)
+            private static uint Div96By64(uint* rgulNum, Split64 sdlDen)
             {
                 Split64 sdlQuo = new Split64();
                 Split64 sdlNum = new Split64();
@@ -389,7 +385,7 @@
              *   None.
              *
              ***********************************************************************/
-            private static uint Div128By96(uint[] rgulNum, uint[] rgulDen)
+            private static uint Div128By96(uint* rgulNum, uint* rgulDen)
             {
                 Split64 sdlQuo = new Split64();
                 Split64 sdlNum = new Split64();
@@ -479,7 +475,7 @@
              *   None.
              *
              ***********************************************************************/
-            private static uint IncreaseScale(uint[] rgulNum, uint ulPwr)
+            private static uint IncreaseScale(uint* rgulNum, uint ulPwr)
             {
                 Split64 sdlTmp = new Split64();

@@ -509,7 +505,7 @@
             *   New scale factor returned, -1 if overflow error.
             *
             ***********************************************************************/
-            private static int ScaleResult(uint[] rgulRes, int iHiRes, int iScale)
+            private static int ScaleResult(uint* rgulRes, int iHiRes, int iScale)
             {
                 int iNewScale;
                 int iCur;
@@ -682,7 +678,7 @@

             // Adjust the quotient to deal with an overflow. We need to divide by 10,
             // feed in the high bit to undo the overflow and then round as required,
-            private static void OverflowUnscale(uint[] rgulQuo, bool fRemainder)
+            private static void OverflowUnscale(uint* rgulQuo, bool fRemainder)
             {
                 Split64 sdlTmp = new Split64();

@@ -812,7 +808,7 @@

             // Add a 32 bit unsigned long to an array of 3 unsigned longs representing a 96 integer
             // Returns false if there is an overflow
-            private static bool Add32To96(uint[] rgulNum, uint ulValue)
+            private static bool Add32To96(uint* rgulNum, uint ulValue)
             {
                 rgulNum[0] += ulValue;
                 if (rgulNum[0] < ulValue)
@@ -832,7 +828,8 @@
             // Returns true if we overflow otherwise false.
             private static bool DecAddSub(ref Decimal d1, ref Decimal d2, bool bSign)
             {
-                uint[] rgulNum = new uint[6];
+                Buf24 bufNum;
+                uint* rgulNum = (uint*)&bufNum;
                 uint ulPwr;
                 int iScale;
                 int iHiProd;
@@ -1082,7 +1079,7 @@
                 return false;
             }

-            private static bool LongSub(ref Decimal value, ref int iHiProd, uint[] rgulNum)
+            private static bool LongSub(ref Decimal value, ref int iHiProd, uint* rgulNum)
             {
                 // If rgulNum has more than 96 bits of precision, then we need to
                 // carry the subtraction into the higher bits.  If it doesn't,
@@ -1104,7 +1101,7 @@
                 return false;
             }

-            private static void LongAdd(ref int iHiProd, uint[] rgulNum)
+            private static void LongAdd(ref int iHiProd, uint* rgulNum)
             {
                 int iCur = 3;
                 do
@@ -1173,7 +1170,7 @@
                 return false;
             }

-            private static void RoundUp(uint[] rgulQuo, ref int iScale)
+            private static void RoundUp(uint* rgulQuo, ref int iScale)
             {
                 if (!Add32To96(rgulQuo, 1))
                 {
@@ -1212,7 +1209,8 @@
 ***********************************************************************/
             private static uint DecFixInt(ref Decimal input, ref Decimal result)
             {
-                uint[] tmpNum = new uint[3];
+                Buf16 bufNum;
+                uint* tmpNum = (uint*)&bufNum;
                 uint remainder;
                 uint power;
                 int scale;
@@ -1435,7 +1433,8 @@
                 uint ulPwr;
                 uint ulRemLo;
                 uint ulRemHi;
-                uint[] rgulProd = new uint[6];
+                Buf24 bufProd;
+                uint* rgulProd = (uint*)&bufProd;

                 pdecRes = new Decimal();
                 iScale = pdecL.Scale + pdecR.Scale;
@@ -1949,10 +1948,11 @@
             // of the operation.
             internal static void VarDecDiv(ref Decimal d1, ref Decimal d2)
             {
-                uint[] rgulQuo = new uint[3];
-                uint[] rgulQuoSave = new uint[3];
-                uint[] rgulRem = new uint[4];
-                uint[] rgulDivisor = new uint[3];
+                Buf16 bufQuo, bufQuoSave, bufRem, bufDivisor;
+                uint* rgulQuo = (uint*)&bufQuo;
+                uint* rgulQuoSave = (uint*)&bufQuoSave;
+                uint* rgulRem = (uint*)&bufRem;
+                uint* rgulDivisor = (uint*)&bufDivisor;
                 uint ulPwr;
                 uint ulTmp;
                 uint ulTmp1;
@@ -2113,7 +2113,7 @@
                         sdlTmp.High32 = rgulRem[3];

                         rgulQuo[2] = 0;
-                        rgulQuo[1] = Div96By64(new ArraySegment<uint>(rgulRem, 1, 3), sdlDivisor);
+                        rgulQuo[1] = Div96By64(rgulRem + 1, sdlDivisor);
                         rgulQuo[0] = Div96By64(rgulRem, sdlDivisor);

                         for (;;)
@@ -2377,7 +2377,8 @@
             //**********************************************************************
             internal static void VarDecRound(ref Decimal input, int decimals, ref Decimal result)
             {
-                uint[] tmpNum = new uint[3];
+                Buf16 bufNum;
+                uint* tmpNum = (uint*)&bufNum;
                 uint remainder;
                 uint sticky;
                 uint power;
@@ -2692,6 +2693,12 @@
                     return s_powerOvfl[(index * 3) + 2];
                 }
             }
+
+            [StructLayout(LayoutKind.Explicit, Size = 16)]
+            private struct Buf16 { }
+
+            [StructLayout(LayoutKind.Explicit, Size = 24)]
+            private struct Buf24 { }
         }
     }
 }


Avoid using double/floats within tests that don't roundtrip on netfx (#40408)

(for G17).

--- src/System.Text.Json/tests/Serialization/OptionsTests.cs
+++ src/System.Text.Json/tests/Serialization/OptionsTests.cs
@@ -384,13 +384,13 @@
             GenericConverterTestHelper<bool>("JsonConverterBoolean", true, "true", options);
             GenericConverterTestHelper<byte>("JsonConverterByte", (byte)128, "128", options);
             GenericConverterTestHelper<char>("JsonConverterChar", 'A', "\"A\"", options);
-            GenericConverterTestHelper<double>("JsonConverterDouble", 3.14d, "3.14", options);
+            GenericConverterTestHelper<double>("JsonConverterDouble", 15.1d, "15.1", options);
             GenericConverterTestHelper<SampleEnum>("JsonConverterEnum`1", SampleEnum.Two, "2", options);
             GenericConverterTestHelper<short>("JsonConverterInt16", (short)5, "5", options);
             GenericConverterTestHelper<int>("JsonConverterInt32", -100, "-100", options);
             GenericConverterTestHelper<long>("JsonConverterInt64", (long)11111, "11111", options);
             GenericConverterTestHelper<sbyte>("JsonConverterSByte", (sbyte)-121, "-121", options);
-            GenericConverterTestHelper<float>("JsonConverterSingle", 3.14f, "3.14", options);
+            GenericConverterTestHelper<float>("JsonConverterSingle", 14.5f, "14.5", options);
             GenericConverterTestHelper<string>("JsonConverterString", "Hello", "\"Hello\"", options);
             GenericConverterTestHelper<ushort>("JsonConverterUInt16", (ushort)1206, "1206", options);
             GenericConverterTestHelper<uint>("JsonConverterUInt32", (uint)3333, "3333", options);


In progress

In progress

--- src/Workspaces/Remote/ServiceHub/Host/RemoteWorkspace.cs
+++ src/Workspaces/Remote/ServiceHub/Host/RemoteWorkspace.cs
@@ -9,7 +9,6 @@
 using Microsoft.CodeAnalysis.ErrorReporting;
 using Microsoft.CodeAnalysis.Host;
 using Microsoft.CodeAnalysis.Serialization;
-using Microsoft.CodeAnalysis.Shared.Collections;
 using Microsoft.CodeAnalysis.SolutionCrawler;
 using Roslyn.Utilities;
 using static Microsoft.VisualStudio.Threading.ThreadingTools;
@@ -139,7 +138,7 @@
             // Actually get the solution, computing it ourselves, or getting the result that another caller was
             // computing. In the event of cancellation, we do not wait here for the refCountedLazySolution to clean up,
             // even if this was the last use of this solution.
-            var newSolution = await refCountedLazySolution.Target.Task.WithCancellation(cancellationToken).ConfigureAwait(false);
+            var newSolution = await refCountedLazySolution.Task.WithCancellation(cancellationToken).ConfigureAwait(false);

             // Now, pass it to the callback to do the work.  Any other callers into us will be able to benefit from
             // using this same solution as well
@@ -148,7 +147,7 @@
             return (newSolution, result);
         }

-        private async ValueTask<ReferenceCountedDisposable<LazySolution>> GetOrCreateSolutionAsync(
+        private async ValueTask<LazyRefCountedSolution> GetOrCreateSolutionAsync(
             AssetProvider assetProvider,
             Checksum solutionChecksum,
             int workspaceVersion,
@@ -183,7 +182,7 @@
             // Ensure we release the ref count on this solution once we're done.
             await using var _ = anyBranchRefCountedSolution.ConfigureAwait(false);

-            var anyBranchSolution = await anyBranchRefCountedSolution.Target.Task.WithCancellation(cancellationToken).ConfigureAwait(false);
+            var anyBranchSolution = await anyBranchRefCountedSolution.Task.WithCancellation(cancellationToken).ConfigureAwait(false);

             return await _primaryBranchSolutionCache.SlowGetOrCreateSolutionAsync(
                 solutionChecksum,
@@ -342,7 +341,7 @@
             /// updates, we can cache and keep the solution around instead of having to recompute it.
             /// </summary>
             private Checksum? _lastRequestedChecksum;
-            private ReferenceCountedDisposable<LazySolution>? _lastRequestedSolution;
+            private LazyRefCountedSolution? _lastRequestedSolution;

             /// <summary>
             /// Mapping from solution-checksum to the solution computed for it.  This is used so that we can hold a
@@ -350,14 +349,14 @@
             /// classification).  As long as we're holding onto it, concurrent feature requests for the same solution
             /// checksum can share the computation of that particular solution and avoid duplicated concurrent work.
             /// </summary>
-            private readonly Dictionary<Checksum, ReferenceCountedDisposable<LazySolution>> _solutionChecksumToLazySolution = new();
+            private readonly Dictionary<Checksum, LazyRefCountedSolution> _solutionChecksumToLazySolution = new();

             public ChecksumToSolutionCache(SemaphoreSlim gate)
             {
                 _gate = gate;
             }

-            public async ValueTask<ReferenceCountedDisposable<LazySolution>?> TryFastGetSolutionAsync(
+            public async ValueTask<LazyRefCountedSolution?> TryFastGetSolutionAsync(
                 Checksum solutionChecksum,
                 CancellationToken cancellationToken)
             {
@@ -385,7 +384,7 @@
                 }
             }

-            public async ValueTask<ReferenceCountedDisposable<LazySolution>> SlowGetOrCreateSolutionAsync(
+            public async ValueTask<LazyRefCountedSolution> SlowGetOrCreateSolutionAsync(
                 Checksum solutionChecksum, Func<CancellationToken, Task<Solution>> getSolutionAsync, CancellationToken cancellationToken)
             {
                 using (await _gate.DisposableWaitAsync(cancellationToken).ConfigureAwait(false))
@@ -403,8 +402,7 @@

                     // We're the first call that is asking about this checksum.  Create a lazy to compute it with a
                     // refcount of 1 (for 'us').
-                    refCountedLazySolution = null;
-                    var lazySolution = new LazySolution(
+                    refCountedLazySolution = new LazyRefCountedSolution(
                         getSolutionAsync,
                         cleanupAsync: async () =>
                         {
@@ -421,18 +419,17 @@
                                 _solutionChecksumToLazySolution.Remove(solutionChecksum);
                             }
                         });
-                    refCountedLazySolution = new ReferenceCountedDisposable<LazySolution>(lazySolution);
                     _solutionChecksumToLazySolution.Add(solutionChecksum, refCountedLazySolution);
                     return refCountedLazySolution;
                 }
             }

-            public async Task SetLastRequestedSolutionAsync(Checksum solutionChecksum, ReferenceCountedDisposable<LazySolution> solution, CancellationToken cancellationToken)
+            public async Task SetLastRequestedSolutionAsync(Checksum solutionChecksum, LazyRefCountedSolution solution, CancellationToken cancellationToken)
             {
                 // Collect the existing solution we're pointing at so we can decrease its ref count.  Do this out of the
                 // lock to prevent deadlocks when DisposeAsync runs and potentally calls back to remove the item from
                 // the dictionary.
-                ReferenceCountedDisposable<LazySolution>? solutionToDispose;
+                LazyRefCountedSolution? solutionToDispose;

                 using (await _gate.DisposableWaitAsync(cancellationToken).ConfigureAwait(false))
                 {
@@ -465,28 +462,50 @@
         /// scenarios.</description></item>
         /// </list>
         /// </summary>
-        private sealed class LazySolution : IAsyncDisposable, IDisposable
+        private sealed class LazyRefCountedSolution : IAsyncDisposable
         {
             private readonly CancellationTokenSource _cancellationTokenSource = new();
             private readonly Func<Task> _cleanupAsync;
             private readonly Task<Solution> _task;

-            public LazySolution(Func<CancellationToken, Task<Solution>> getSolutionAsync, Func<Task> cleanupAsync)
+            private int _refCount;
+
+            public LazyRefCountedSolution(Func<CancellationToken, Task<Solution>> getSolutionAsync, Func<Task> cleanupAsync)
             {
                 _cleanupAsync = cleanupAsync;
                 _task = getSolutionAsync(_cancellationTokenSource.Token);
+                _refCount = 1;
             }

             public Task<Solution> Task => _task;

-            void IDisposable.Dispose()
-            {
-                // This type is only used as IAsyncDisposable, but needs to implement IDisposable for wrapping within
-                // ReferenceCountedDisposable<T>.
-                throw ExceptionUtilities.Unreachable;
+            public LazyRefCountedSolution? TryAddReference()
+            {
+                lock (this)
+                {
+                    if (_refCount == 0)
+                        return null;
+
+                    _refCount++;
+                    return this;
+                }
             }

             public async ValueTask DisposeAsync()
+            {
+                var dispose = false;
+                lock (this)
+                {
+                    Contract.ThrowIfTrue(_refCount == 0);
+                    _refCount--;
+                    dispose = _refCount == 0;
+                }
+
+                if (dispose)
+                    await this.ReleaseResourcesAsync().ConfigureAwait(false);
+            }
+
+            private async ValueTask ReleaseResourcesAsync()
             {
                 _cancellationTokenSource.Cancel();
                 _cancellationTokenSource.Dispose();


Start work on only updating data that has changed

--- MainWindow.xaml.cs
+++ MainWindow.xaml.cs
@@ -43,6 +43,8 @@
         private readonly JToken json;

         private readonly string version;
+
+        private List<TextBox> changed = new List<TextBox>();

         private int itemsFound;

@@ -423,6 +425,12 @@
                 collection = this.items.Where(i => i.Page == 4 || i.Page == 5 || i.Page == 6);
             }

+            // TODO: Only update what has changed to avoid corruption.
+            foreach (var tb in this.changed)
+            {
+                // These text boxes have been edited
+            }
+
             foreach (var item in collection)
             {
                 // Id
@@ -533,8 +541,10 @@
             }

             this.DebugData();
-
             Debug.UpdateLayout();
+
+            // clear changed after save
+            this.changed.Clear();
         }

         private void ExportClick(object sender, RoutedEventArgs e)
@@ -594,6 +604,8 @@
                     IsReadOnly = false,
                     Name = "Name_" + item.NameStartHex
                 };
+
+                id.TextChanged += this.TextChanged;

                 check = (TextBox)this.FindName("Name_" + item.NameStartHex);
                 if (check != null)
@@ -685,6 +697,11 @@
             tab.Content = scroll;
         }

+        private void TextChanged(object sender, TextChangedEventArgs textChangedEventArgs)
+        {
+            this.changed.Add(sender as TextBox);
+        }
+
         private void DebugData()
         {
             // Debug Grid data


Vérifie que le numéro de version est véritablement plus vieille avant de faire la notification.

--- MainWindow.xaml.cs
+++ MainWindow.xaml.cs
@@ -20,15 +20,15 @@

 namespace Nutritia
 {
-	/// <summary>
-	/// Logique d'interaction pour MainWindow.xaml
-	/// </summary>
-	public partial class MainWindow : Window, IApplicationService
-	{
+    /// <summary>
+    /// Logique d'interaction pour MainWindow.xaml
+    /// </summary>
+    public partial class MainWindow : Window, IApplicationService
+    {
         private const int SLEEP_NOTIFICATION_TIME = 10000;

         public MainWindow()
-		{
+        {
             Thread.CurrentThread.CurrentUICulture = new CultureInfo(Properties.Settings.Default.Langue);
             InitializeComponent();
             Configurer();
@@ -52,37 +52,37 @@
             ServiceFactory.Instance.Register<IApplicationService, MainWindow>(this);
         }

-		public void ChangerVue<T>(T vue)
-		{
-			presenteurContenu.Content = vue as UserControl;
-		}
+        public void ChangerVue<T>(T vue)
+        {
+            presenteurContenu.Content = vue as UserControl;
+        }

-		private void btnParam_Click(object sender, RoutedEventArgs e)
-		{
+        private void btnParam_Click(object sender, RoutedEventArgs e)
+        {
             (new FenetreParametres()).ShowDialog();
-		}
+        }

-		private void btnRetour_Click(object sender, RoutedEventArgs e)
-		{
-			if(App.MembreCourant.IdMembre == null)
-				ServiceFactory.Instance.GetService<IApplicationService>().ChangerVue(new MenuPrincipal());
-			else if(App.MembreCourant.EstAdministrateur)
-				ServiceFactory.Instance.GetService<IApplicationService>().ChangerVue(new MenuAdministrateur());
-			else
-				ServiceFactory.Instance.GetService<IApplicationService>().ChangerVue(new MenuPrincipalConnecte());
-		}
+        private void btnRetour_Click(object sender, RoutedEventArgs e)
+        {
+            if (App.MembreCourant.IdMembre == null)
+                ServiceFactory.Instance.GetService<IApplicationService>().ChangerVue(new MenuPrincipal());
+            else if (App.MembreCourant.EstAdministrateur)
+                ServiceFactory.Instance.GetService<IApplicationService>().ChangerVue(new MenuAdministrateur());
+            else
+                ServiceFactory.Instance.GetService<IApplicationService>().ChangerVue(new MenuPrincipalConnecte());
+        }

-		private void btnInfo_Click(object sender, RoutedEventArgs e)
-		{
+        private void btnInfo_Click(object sender, RoutedEventArgs e)
+        {
             (new FenetreAPropos()).ShowDialog();
-			//ServiceFactory.Instance.GetService<IApplicationService>().ChangerVue(new FenetreAPropos());
-		}
+            //ServiceFactory.Instance.GetService<IApplicationService>().ChangerVue(new FenetreAPropos());
+        }

-		private void btnAide_Click(object sender, RoutedEventArgs e)
-		{
-                FenetreAide fenetreAide = new FenetreAide(presenteurContenu.Content.GetType().Name);
-                fenetreAide.Show();
-		}
+        private void btnAide_Click(object sender, RoutedEventArgs e)
+        {
+            FenetreAide fenetreAide = new FenetreAide(presenteurContenu.Content.GetType().Name);
+            fenetreAide.Show();
+        }

         private void Window_Loaded(object sender, RoutedEventArgs e)
         {
@@ -92,18 +92,28 @@

         private void LastestVersionPopUp()
         {
+            bool isOlder = false;
             IVersionLogicielService serviceMembre = ServiceFactory.Instance.GetService<IVersionLogicielService>();

             VersionLogiciel latestVersionLogiciel = serviceMembre.RetrieveLatest();

-            Thread.Sleep(SLEEP_NOTIFICATION_TIME);
-
-            if (latestVersionLogiciel.Version.Equals("0.0.0.0"))
+            if (String.IsNullOrEmpty(latestVersionLogiciel.Version))
             {
                 return;
             }
-
-            if (latestVersionLogiciel.Version.Equals(FileVersionInfo.GetVersionInfo(App.ResourceAssembly.Location).FileVersion) == false )
+
+            Version versionBD = new Version(latestVersionLogiciel.Version);
+            Version versionLocal = new Version(FileVersionInfo.GetVersionInfo(App.ResourceAssembly.Location).FileVersion);
+
+            if (versionBD.Major > versionLocal.Major || versionBD.Minor > versionLocal.Minor || versionBD.Build > versionLocal.Build || versionBD.Revision > versionLocal.Revision)
+            {
+                isOlder = true;
+            }
+
+
+            Thread.Sleep(SLEEP_NOTIFICATION_TIME);
+
+            if (isOlder)
             {
                 string message = "Version: " + latestVersionLogiciel.Version + " disponible.\nLien de téléchargement: " + latestVersionLogiciel.DownloadLink;
                 MessageBox.Show(


interesting how one little missing line can mess up the whole program. Forgot to reset animationCompleted to false

--- MainWindow.xaml.cs
+++ MainWindow.xaml.cs
@@ -116,6 +116,7 @@
 			return Task.Run(() =>
 			{
 				while (!animationCompleted) Task.Delay(10);
+				animationCompleted = false;
 			});
 		}


Change gltf format

Change gltf format

--- Dev/Editor/EffekseerCore/Exporter/glTFExporter.cs
+++ Dev/Editor/EffekseerCore/Exporter/glTFExporter.cs
@@ -18,6 +18,7 @@
 		public glTFExporterFormat Format = glTFExporterFormat.glTF;
 		public bool IsContainedTextureAsBinary = false;
 		public float Scale = 1.0f;
+		public float ExternalScale = 1.0f;

         /// <summary>
         /// if bindingNode is int, an effect is binding with node index.
@@ -55,7 +56,7 @@

 			var effekseerExtention = new EffekseerExtention();

-			var effect = CreateEffect(option.Scale, option.bindingNode, option.IsContainedTextureAsBinary);
+			var effect = CreateEffect(option.Scale, option.ExternalScale, option.bindingNode, option.IsContainedTextureAsBinary);

 			effekseerExtention.effects.Add(effect);

@@ -121,7 +122,7 @@
 			bufferViews.Add(name, bufferView);
 		}

-        EffekseerEffect CreateEffect(float scale, object bindingNode, bool isContainedAsBinary)
+        EffekseerEffect CreateEffect(float scale, float externalScale, object bindingNode, bool isContainedAsBinary)
 		{
 			var effect = new EffekseerEffect();

@@ -130,6 +131,8 @@
 			{
 				name = "effect";
 			}
+
+			effect.Add("scale", externalScale);

 			var bodyName = name + "_body";

@@ -271,6 +274,8 @@
 				}
 			}

+			effect.Add("sounds", sounds);
+
 			List<object> models = new List<object>();

 			if (isContainedAsBinary)
@@ -293,8 +298,31 @@
 				}
 			}

-			effect.Add("sounds", sounds);
 			effect.Add("models", models);
+
+			List<object> materials = new List<object>();
+
+			if (isContainedAsBinary)
+			{
+				foreach (var material in binaryExporter.Materials.ToList().OrderBy(_ => _))
+				{
+					Uri u1 = new Uri(System.IO.Path.GetDirectoryName(Core.FullPath) + System.IO.Path.DirectorySeparatorChar.ToString());
+					Uri u2 = new Uri(u1, material);
+
+					var buf = System.IO.File.ReadAllBytes(u2.LocalPath);
+					AddBufferView(material, buf);
+					materials.Add(CreateAsBufferView(material));
+				}
+			}
+			else
+			{
+				foreach (var material in binaryExporter.Materials.ToList().OrderBy(_ => _))
+				{
+					materials.Add(CreateImageAsURI(material));
+				}
+			}
+
+			effect.Add("materials", materials);

 			return effect;
 		}


Ensure that IndexVolumeWriter is disposed.

--- Duplicati/Library/Main/Operation/RepairHandler.cs
+++ Duplicati/Library/Main/Operation/RepairHandler.cs
@@ -292,7 +292,7 @@
                                 w.SetRemoteFilename(n.Name);

                                 db.WriteFileset(w, filesetId, null);
-
+
                                 w.Close();
                                 if (m_options.Dryrun)
                                     Logging.Log.WriteDryrunMessage(LOGTAG, "WouldReUploadFileset", "would re-upload fileset {0}, with size {1}, previous size {2}", n.Name, Library.Utility.Utility.FormatSizeString(new System.IO.FileInfo(w.LocalFilename).Length), Library.Utility.Utility.FormatSizeString(n.Size));
@@ -304,41 +304,43 @@
                             }
                             else if (n.Type == RemoteVolumeType.Index)
                             {
-                                var w = new IndexVolumeWriter(m_options);
-                                newEntry = w;
-                                w.SetRemoteFilename(n.Name);
-
-                                var h = Library.Utility.HashAlgorithmHelper.Create(m_options.BlockHashAlgorithm);
-
-                                foreach(var blockvolume in db.GetBlockVolumesFromIndexName(n.Name))
-                                {
-                                    w.StartVolume(blockvolume.Name);
-                                    var volumeid = db.GetRemoteVolumeID(blockvolume.Name);
-
-                                    foreach(var b in db.GetBlocks(volumeid))
-                                        w.AddBlock(b.Hash, b.Size);
-
-                                    w.FinishVolume(blockvolume.Hash, blockvolume.Size);
-
-                                    if (m_options.IndexfilePolicy == Options.IndexFileStrategy.Full)
-                                        foreach(var b in db.GetBlocklists(volumeid, m_options.Blocksize, hashsize))
-                                        {
-                                            var bh = Convert.ToBase64String(h.ComputeHash(b.Item2, 0, b.Item3));
-                                            if (bh != b.Item1)
-                                                throw new Exception(string.Format("Internal consistency check failed, generated index block has wrong hash, {0} vs {1}", bh, b.Item1));
-
-                                            w.WriteBlocklist(b.Item1, b.Item2, 0, b.Item3);
-                                        }
-                                }
-
-                                w.Close();
-
-                                if (m_options.Dryrun)
-                                    Logging.Log.WriteDryrunMessage(LOGTAG, "WouldReUploadIndexFile", "would re-upload index file {0}, with size {1}, previous size {2}", n.Name, Library.Utility.Utility.FormatSizeString(new System.IO.FileInfo(w.LocalFilename).Length), Library.Utility.Utility.FormatSizeString(n.Size));
-                                else
-                                {
-                                    db.UpdateRemoteVolume(w.RemoteFilename, RemoteVolumeState.Uploading, -1, null, null);
-                                    backend.Put(w);
+                                using (IndexVolumeWriter w = new IndexVolumeWriter(m_options))
+                                {
+                                    newEntry = w;
+                                    w.SetRemoteFilename(n.Name);
+
+                                    var h = Library.Utility.HashAlgorithmHelper.Create(m_options.BlockHashAlgorithm);
+
+                                    foreach (var blockvolume in db.GetBlockVolumesFromIndexName(n.Name))
+                                    {
+                                        w.StartVolume(blockvolume.Name);
+                                        var volumeid = db.GetRemoteVolumeID(blockvolume.Name);
+
+                                        foreach (var b in db.GetBlocks(volumeid))
+                                            w.AddBlock(b.Hash, b.Size);
+
+                                        w.FinishVolume(blockvolume.Hash, blockvolume.Size);
+
+                                        if (m_options.IndexfilePolicy == Options.IndexFileStrategy.Full)
+                                            foreach (var b in db.GetBlocklists(volumeid, m_options.Blocksize, hashsize))
+                                            {
+                                                var bh = Convert.ToBase64String(h.ComputeHash(b.Item2, 0, b.Item3));
+                                                if (bh != b.Item1)
+                                                    throw new Exception(string.Format("Internal consistency check failed, generated index block has wrong hash, {0} vs {1}", bh, b.Item1));
+
+                                                w.WriteBlocklist(b.Item1, b.Item2, 0, b.Item3);
+                                            }
+                                    }
+
+                                    w.Close();
+
+                                    if (m_options.Dryrun)
+                                        Logging.Log.WriteDryrunMessage(LOGTAG, "WouldReUploadIndexFile", "would re-upload index file {0}, with size {1}, previous size {2}", n.Name, Library.Utility.Utility.FormatSizeString(new System.IO.FileInfo(w.LocalFilename).Length), Library.Utility.Utility.FormatSizeString(n.Size));
+                                    else
+                                    {
+                                        db.UpdateRemoteVolume(w.RemoteFilename, RemoteVolumeState.Uploading, -1, null, null);
+                                        backend.Put(w);
+                                    }
                                 }
                             }
                             else if (n.Type == RemoteVolumeType.Blocks)


Throw on expected value.

Throw on expected value.

--- src/Features/Core/Portable/ConvertTupleToStruct/AbstractConvertTupleToStructCodeRefactoringProvider.cs
+++ src/Features/Core/Portable/ConvertTupleToStruct/AbstractConvertTupleToStructCodeRefactoringProvider.cs
@@ -1,4 +1,4 @@
-// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.
+// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

 using System;
 using System.Collections.Generic;
@@ -345,10 +345,8 @@
                     return await GetDocumentsToUpdateForDependentProjectAsync(
                         document.Project, tupleType, cancellationToken).ConfigureAwait(false);
                 default:
-                    break;
-            }
-
-            throw new NotImplementedException();
+                    throw ExceptionUtilities.UnexpectedValue(scope);
+            }
         }

         private async Task<ImmutableArray<DocumentToUpdate>> GetDocumentsToUpdateForDependentProjectAsync(


[Perf] Optimize EnsuresNotNull

[Perf] Optimize EnsuresNotNull

formatting and creating an adhoc workspace are costly operations. Do basic AST checks.

--- RefactoringEssentials/CSharp/CodeRefactorings/Synced/ContractEnsuresNotNullReturnRefactoringProvider.cs
+++ RefactoringEssentials/CSharp/CodeRefactorings/Synced/ContractEnsuresNotNullReturnRefactoringProvider.cs
@@ -99,18 +99,68 @@
             return SyntaxFactory.ParseStatement($"Contract.Ensures(Contract.Result<{returnType}>() != null);\r\n").WithAdditionalAnnotations(Formatter.Annotation, Simplifier.Annotation);
         }

+        static bool ValidateContractAccess(MemberAccessExpressionSyntax access, string method, string genericTypeName)
+        {
+            if (access == null)
+                return false;
+
+            var className = access.Expression.GetRightmostName() as SimpleNameSyntax;
+            if (className == null || className.Identifier.ValueText != "Contract")
+                return false;
+
+            var ensures = access.GetRightmostName() as SimpleNameSyntax;
+            if (ensures == null || ensures.Identifier.ValueText != method)
+                return false;
+
+            if (genericTypeName!= null)
+            {
+                var generic = ensures as GenericNameSyntax;
+                if (generic == null || generic.Arity != 1)
+                    return false;
+
+                var typeName = generic.TypeArgumentList.Arguments[0].GetRightmostName() as SimpleNameSyntax;
+                if (typeName == null || typeName.Identifier.ValueText != genericTypeName)
+                    return false;
+            }
+            return true;
+        }
+
         static bool HasReturnContract(BlockSyntax bodyStatement, string returnType)
         {
-            var workspace = new AdhocWorkspace();
-
-            var rhsEnsures = $"Contract.Ensures(Contract.Result<{returnType}>() != null);";
-            var lhsEnsures = $"Contract.Ensures(null != Contract.Result<{returnType}>());";
+            var rhsEnsures = SyntaxFactory.ParseStatement($"Contract.Ensures(Contract.Result<{returnType}>() != null);");
+            var lhsEnsures = SyntaxFactory.ParseStatement($"Contract.Ensures(null != Contract.Result<{returnType}>());");
             foreach (var expression in bodyStatement.DescendantNodes().OfType<ExpressionStatementSyntax>())
             {
-                var formatted = Formatter.Format(expression, workspace).ToString();
+                var ies = expression.Expression as InvocationExpressionSyntax;
+                if (ies == null)
+                    continue;

-                if (formatted == rhsEnsures || formatted == lhsEnsures)
-                    return true;
+                var access = ies.Expression as MemberAccessExpressionSyntax;
+                if (access == null)
+                    continue;
+
+                if (!ValidateContractAccess(access, "Ensures", null))
+                    continue;
+
+                if (ies.ArgumentList.Arguments.Count != 1)
+                    continue;
+
+                var arg = ies.ArgumentList.Arguments[0].Expression as BinaryExpressionSyntax;
+                if (arg == null || !arg.OperatorToken.IsKind(SyntaxKind.ExclamationEqualsToken))
+                    continue;
+
+                if (arg.Left.IsKind(SyntaxKind.NullLiteralExpression))
+                {
+                    ies = arg.Right as InvocationExpressionSyntax;
+                }
+                else if (arg.Right.IsKind(SyntaxKind.NullLiteralExpression))
+                {
+                    ies = arg.Left as InvocationExpressionSyntax;
+                }
+                access = ies?.Expression as MemberAccessExpressionSyntax;
+                if (!ValidateContractAccess(access, "Result", returnType))
+                    continue;
+                return true;
             }
             return false;
         }


cleanup usings

cleanup usings

(cherry picked from commit 5ecf1d91a2329a5cf6a41e327ac9eae2c8775644)

--- Test/ServerTelemetryChannel.Test/Shared.Tests/Implementation/SamplingPercentageEstimatorSettingsTest.cs
+++ Test/ServerTelemetryChannel.Test/Shared.Tests/Implementation/SamplingPercentageEstimatorSettingsTest.cs
@@ -1,14 +1,7 @@
 namespace Microsoft.ApplicationInsights.WindowsServer.Channel.Implementation
 {
     using System;
-    using System.Collections.Generic;
-    using System.Globalization;
-
-    using Microsoft.ApplicationInsights.DataContracts;
     using Microsoft.VisualStudio.TestTools.UnitTesting;
-
-
-    using Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.Implementation;

     [TestClass]
     public class SamplingPercentageEstimatorSettingsTest


Добавил описание для EntityMap

Добавил описание для EntityMap

--- src/bgTeam.Core.Esb/ProcessMessages/IEntityMapService.cs
+++ src/bgTeam.Core.Esb/ProcessMessages/IEntityMapService.cs
@@ -2,37 +2,23 @@
 {
     using bgTeam.Extensions;
     using bgTeam.Queues;
-    using Newtonsoft.Json;
-    using Newtonsoft.Json.Linq;
     using System;
     using System.Collections.Generic;
     using System.Linq;

     public interface IEntityMapService
     {
+        /// <summary>
+        /// Конвертирует сообзение из очереди в объект EntityMap
+        /// </summary>
+        /// <param name="message">Сообщение из очереди</param>
+        /// <returns></returns>
         EntityMap CreateEntityMap(IQueueMessage message);
     }

-    ////public class DefaultMapService : IEntityMapService
-    ////{
-    ////    public EntityMap CreateEntityMap(IQueueMessage message)
-    ////    {
-    ////        var settings = new JsonSerializerSettings()
-    ////        {
-    ////            DateParseHandling = DateParseHandling.None,
-    ////            DateFormatHandling = DateFormatHandling.MicrosoftDateFormat
-    ////        };
-
-    ////        var obj = JsonConvert.DeserializeObject<dynamic>(message.Body, settings);
-    ////        var map = ((IDictionary<string, JToken>)obj)
-    ////            .ToDictionary(
-    ////                x => x.Key,
-    ////                x => string.IsNullOrWhiteSpace(x.Value.ToString()) ? null : x.Value.ToObject<object>()
-    ////            );
-    ////        return new EntityMap(map);
-    ////    }
-    ////}
-
+    /// <summary>
+    /// Содержит основную информацию об объекте из очереди
+    /// </summary>
     public class EntityMap
     {
         private const string ENTITY_TYPE_NAME = "EntityType";
@@ -53,14 +39,29 @@
             KeyName = map.ContainsKey(ENTITY_KEY_NAME) ? map[ENTITY_KEY_NAME].ToString() : ENTITY_KEY_NAME_DEFAULT;
         }

+        /// <summary>
+        /// Тип объекта из очереди
+        /// </summary>
         public string TypeName { get; private set; }

+        /// <summary>
+        /// Ключевое поле
+        /// </summary>
         public string KeyName { get; private set; }

+        /// <summary>
+        /// Значение ключевого поля
+        /// </summary>
         public object KeyValue => Properties[KeyName];

+        /// <summary>
+        /// Словарь имя-значение всех полей объекта из очереди
+        /// </summary>
         public Dictionary<string, object> Properties { get; private set; }

+        /// <summary>
+        /// Имена всех свойств объекта из очереди
+        /// </summary>
         public IEnumerable<string> PropertyNames => Properties.Keys.Except(new[] { ENTITY_TYPE_NAME, ENTITY_KEY_NAME }).ToArray();
     }
 }


Removed Entitas namespace from generated Feature class

--- Addons/Entitas.VisualDebugging.CodeGeneration.Plugins/Entitas.VisualDebugging.CodeGeneration.Plugins/Plugins/FeatureClassGenerator.cs
+++ Addons/Entitas.VisualDebugging.CodeGeneration.Plugins/Entitas.VisualDebugging.CodeGeneration.Plugins/Plugins/FeatureClassGenerator.cs
@@ -10,49 +10,45 @@
         public bool runInDryMode { get { return true; } }

         const string FEATURE_TEMPLATE =
-@"namespace Entitas {
+@"#if(!ENTITAS_DISABLE_VISUAL_DEBUGGING && UNITY_EDITOR)

-#if(!ENTITAS_DISABLE_VISUAL_DEBUGGING && UNITY_EDITOR)
+public class Feature : Entitas.VisualDebugging.Unity.DebugSystems {

-    public class Feature : Entitas.VisualDebugging.Unity.DebugSystems {
+    public Feature(string name) : base(name) {
+    }

-        public Feature(string name) : base(name) {
+    public Feature() : base(true) {
+        var typeName = Entitas.Utils.TypeSerializationExtension.ToCompilableString(GetType());
+        var shortType = Entitas.Utils.TypeSerializationExtension.ShortTypeName(typeName);
+        initialize(toSpacedCamelCase(shortType));
+    }
+
+    static string toSpacedCamelCase(string text) {
+        var sb = new System.Text.StringBuilder(text.Length * 2);
+        sb.Append(char.ToUpper(text[0]));
+        for(int i = 1; i < text.Length; i++) {
+            if(char.IsUpper(text[i]) && text[i - 1] != ' ') {
+                sb.Append(' ');
+            }
+            sb.Append(text[i]);
         }

-        public Feature() : base(true) {
-            var typeName = Entitas.Utils.TypeSerializationExtension.ToCompilableString(GetType());
-            var shortType = Entitas.Utils.TypeSerializationExtension.ShortTypeName(typeName);
-            initialize(toSpacedCamelCase(shortType));
-        }
-
-        static string toSpacedCamelCase(string text) {
-            var sb = new System.Text.StringBuilder(text.Length * 2);
-            sb.Append(char.ToUpper(text[0]));
-            for(int i = 1; i < text.Length; i++) {
-                if(char.IsUpper(text[i]) && text[i - 1] != ' ') {
-                    sb.Append(' ');
-                }
-                sb.Append(text[i]);
-            }
-
-            return sb.ToString();
-        }
+        return sb.ToString();
     }
+}

 #else

-    public class Feature : Entitas.Systems {
+public class Feature : Entitas.Systems {

-        public Feature(string name) {
-        }
-
-        public Feature() {
-        }
+    public Feature(string name) {
     }

+    public Feature() {
+    }
+}
+
 #endif
-
-}
 ";

         public CodeGenFile[] Generate(CodeGeneratorData[] data) {


Convert background tasks to async void

Convert background tasks to async void

--- ArchiSteamFarm/Utilities.cs
+++ ArchiSteamFarm/Utilities.cs
@@ -64,7 +64,7 @@
 		public static uint GetUnixTime() => (uint) DateTimeOffset.UtcNow.ToUnixTimeSeconds();

 		[PublicAPI]
-		public static void InBackground(Action action, bool longRunning = false) {
+		public static async void InBackground(Action action, bool longRunning = false) {
 			if (action == null) {
 				ASF.ArchiLogger.LogNullError(nameof(action));

@@ -77,11 +77,11 @@
 				options |= TaskCreationOptions.LongRunning | TaskCreationOptions.PreferFairness;
 			}

-			Task.Factory.StartNew(action, CancellationToken.None, options, TaskScheduler.Default);
-		}
-
-		[PublicAPI]
-		public static void InBackground<T>(Func<T> function, bool longRunning = false) {
+			await Task.Factory.StartNew(action, CancellationToken.None, options, TaskScheduler.Default).ConfigureAwait(false);
+		}
+
+		[PublicAPI]
+		public static async void InBackground<T>(Func<T> function, bool longRunning = false) {
 			if (function == null) {
 				ASF.ArchiLogger.LogNullError(nameof(function));

@@ -94,7 +94,7 @@
 				options |= TaskCreationOptions.LongRunning | TaskCreationOptions.PreferFairness;
 			}

-			Task.Factory.StartNew(function, CancellationToken.None, options, TaskScheduler.Default);
+			await Task.Factory.StartNew(function, CancellationToken.None, options, TaskScheduler.Default).ConfigureAwait(false);
 		}

 		[PublicAPI]


More MonsterAI Commenting

More MonsterAI Commenting

--- Assets/Enemies/MonsterAI.cs
+++ Assets/Enemies/MonsterAI.cs
@@ -93,7 +93,9 @@
 		health = 100;
 	}

-	// Update is called once per frame
+	/**
+	 * Controls how the Monster behaves in the gameworld.
+	 */
 	void Update () {
 		if (health < 100 && !chasing) {
 			chasing = true;
@@ -162,10 +164,17 @@
 		}
 	}

+	/**
+	 * Acquires a new location in the Maze for the Monster to attempt to walk to.
+	 * @return - The Vector3 corresponding to the new position.
+	 */
 	Vector3 GetTarget(){
 		return new Vector3 (Random.Range (0, GridCreator.dimensions), 0, Random.Range (0, GridCreator.dimensions));
 	}

+	/**
+	 * Decides whether or not the Monster should try to path to a new location.
+	 */
 	void NewTarget(){
 		int choice = Random.Range (0, 3);
 		switch (choice) {
@@ -181,6 +190,11 @@
 		}
 	}

+	/**
+	 * Damages the monster, and replaces it with a ragdoll if the damage reduces its health to zero or less.
+	 * @damage - the damage dealth by the incoming attack.
+	 * @return - returns nothing.
+	 */
 	public void damage(int damage) {
 		health -= damage;
 		if (health <= 0) {


add namespace

add namespace

--- Assets/Extra/TargetCount.cs
+++ Assets/Extra/TargetCount.cs
@@ -1,22 +1,26 @@
 using UnityEngine;
 using System.Collections;

-public class TargetCount : MonoBehaviour
+
+namespace AngryChicken2D
 {
-	public int count;
-	GameObject[] objects;
+	public class TargetCount : MonoBehaviour
+	{
+		public int count;
+		GameObject[] objects;

-	public float interval = 3;
+		public float interval = 3;

-	float nextTime;
+		float nextTime;

-	void Update()
-	{
-		if (Time.time > nextTime)
+		void Update()
 		{
-			objects = GameObject.FindGameObjectsWithTag("Target");
-			count = objects.Length;
-			nextTime += interval;
+			if (Time.time > nextTime)
+			{
+				objects = GameObject.FindGameObjectsWithTag("Target");
+				count = objects.Length;
+				nextTime += interval;
+			}
 		}
 	}
-}
+}


やっつけだが画像が大きい場合は縮小してから処理することで高速化した

やっつけだが画像が大きい場合は縮小してから処理することで高速化した

--- iTunesHue/ImageAnalyzer/Analyzer.cs
+++ iTunesHue/ImageAnalyzer/Analyzer.cs
@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Generic;
 using System.Drawing;
+using System.Drawing.Drawing2D;
 using System.Drawing.Imaging;
 using System.Linq;
 using System.Runtime.InteropServices;
@@ -11,11 +12,33 @@
     {
         public static Tuple<Color, Color, Color> GetColors(Bitmap bitmap)
         {
-            var baseColor = FindMainColor(bitmap);
-            var accentColor = FindAccentColor(bitmap, baseColor);
-            var subColorX = FindSubColor(bitmap, baseColor, accentColor);
-
-            return Tuple.Create(baseColor, accentColor, subColorX);
+            // TODO: Dispose ͌ĂяoׂBƂ System.Drawing gȂ悤ɂ
+            try
+            {
+                if (bitmap.Width > 400)
+                {
+                    var resized = new Bitmap(400, (int)(bitmap.Height * 400.0 / bitmap.Width));
+
+                    using (var g = Graphics.FromImage(resized))
+                    {
+                        g.InterpolationMode = InterpolationMode.HighQualityBicubic;
+                        g.DrawImage(bitmap, 0, 0, resized.Width, resized.Height);
+                    }
+
+                    bitmap.Dispose();
+                    bitmap = resized;
+                }
+
+                var baseColor = FindMainColor(bitmap);
+                var accentColor = FindAccentColor(bitmap, baseColor);
+                var subColorX = FindSubColor(bitmap, baseColor, accentColor);
+
+                return Tuple.Create(baseColor, accentColor, subColorX);
+            }
+            finally
+            {
+                bitmap.Dispose();
+            }
         }
         private static Color FindMainColor(Bitmap bitmap)
         {


Update src/Features/Core/Portable/RemoveUnusedParametersAndValues/AbstractRemoveUnusedValuesCodeFixProvider.cs

Co-Authored-By: Manish Vasani <01f5fa50e82e0264ef90a54b019bc69338acfad2@microsoft.com>

--- src/Features/Core/Portable/RemoveUnusedParametersAndValues/AbstractRemoveUnusedValuesCodeFixProvider.cs
+++ src/Features/Core/Portable/RemoveUnusedParametersAndValues/AbstractRemoveUnusedValuesCodeFixProvider.cs
@@ -640,7 +640,7 @@
             bool ShouldRemoveStatement(TLocalDeclarationStatementSyntax localDeclarationStatement, out SeparatedSyntaxList<SyntaxNode> variables)
             {
                 Debug.Assert(removeAssignments);
-                Debug.Assert(localDeclarationStatement != null, "We should never get a null here.");
+                Debug.Assert(localDeclarationStatement != null);

                 // We should remove the entire local declaration statement if all its variables are marked for removal.
                 variables = syntaxFacts.GetVariablesOfLocalDeclarationStatement(localDeclarationStatement);


loop through devices

loop through devices

--- MapWindow/Form1.cs
+++ MapWindow/Form1.cs
@@ -75,14 +75,17 @@

             Reader.Close();

-            Location[] locations = new Location[2];
-            locations[0] = myMap.GetLocation(40, -84, 245);
-            locations[1] = myMap.GetLocation(40, -86, 245);
+            foreach (string deviceId in devices) {
+                Location[] locations = new Location[2];
+                locations[0] = myMap.GetLocation(40, -84, 245);
+                locations[1] = myMap.GetLocation(40, -86, 245);

-            foreach (MapPoint.Shape i in myMap.Shapes) {
-                i.Delete();
+                foreach (MapPoint.Shape i in myMap.Shapes)
+                {
+                    i.Delete();
+                }
+                myMap.Shapes.AddPolyline(locations);
             }
-            myMap.Shapes.AddPolyline(locations);
         }

         private void UpdatePins() {


made sure buttons are always visible for unknown reasons

--- Assets/MixedRealityToolkit/_Core/Inspectors/Profiles/MixedRealityToolkitConfigurationProfileInspector.cs
+++ Assets/MixedRealityToolkit/_Core/Inspectors/Profiles/MixedRealityToolkitConfigurationProfileInspector.cs
@@ -62,6 +62,7 @@
                         "Later"))
                     {
                         var playspace = MixedRealityToolkit.Instance.MixedRealityPlayspace;
+                        Debug.Assert(playspace != null);
                         MixedRealityToolkit.Instance.ActiveProfile = configurationProfile;
                     }
                     else
@@ -118,26 +119,28 @@
                 return;
             }

+            EditorGUILayout.HelpBox("The Mixed Reality Toolkit's core SDK profiles can be used to get up and running quickly.\n\n" +
+                                    "You can use the default profiles provided, copy and customize the default profiles, or create your own.", MessageType.Warning);
+            EditorGUILayout.BeginHorizontal();
+
+            if (GUILayout.Button("Copy & Customize"))
+            {
+                CreateCopyProfileValues();
+            }
+
+            if (GUILayout.Button("Create new profiles"))
+            {
+                ScriptableObject profile = CreateInstance(nameof(MixedRealityToolkitConfigurationProfile));
+                var newProfile = profile.CreateAsset("Assets/MixedRealityToolkit-Generated/CustomProfiles") as MixedRealityToolkitConfigurationProfile;
+                MixedRealityToolkit.Instance.ActiveProfile = newProfile;
+                Selection.activeObject = newProfile;
+            }
+
+            EditorGUILayout.EndHorizontal();
+
+            // We don't call the CheckLock method so won't get a duplicate message.
             if (MixedRealityPreferences.LockProfiles && !((BaseMixedRealityProfile)target).IsCustomProfile)
             {
-                EditorGUILayout.HelpBox("The Mixed Reality Toolkit's core SDK profiles can be used to get up and running quickly.\n\n" +
-                                        "You can use the default profiles provided, copy and customize the default profiles, or create your own.", MessageType.Warning);
-                EditorGUILayout.BeginHorizontal();
-
-                if (GUILayout.Button("Copy & Customize"))
-                {
-                    CreateCopyProfileValues();
-                }
-
-                if (GUILayout.Button("Create new profiles"))
-                {
-                    ScriptableObject profile = CreateInstance(nameof(MixedRealityToolkitConfigurationProfile));
-                    var newProfile = profile.CreateAsset("Assets/MixedRealityToolkit-Generated/CustomProfiles") as MixedRealityToolkitConfigurationProfile;
-                    MixedRealityToolkit.Instance.ActiveProfile = newProfile;
-                    Selection.activeObject = newProfile;
-                }
-
-                EditorGUILayout.EndHorizontal();
                 GUI.enabled = false;
             }


Add GetStream to initial UploadedFile

Add GetStream to initial UploadedFile

--- FormFactory/Mvc/UploadedFiles/AppDataFileStore.cs
+++ FormFactory/Mvc/UploadedFiles/AppDataFileStore.cs
@@ -28,6 +28,9 @@
             var serializer = new JavaScriptSerializer();
             var metadata = serializer.Serialize(uploadedFile);
             File.WriteAllText(Path.Combine(StoreFolderPath, uploadedFile.Id, "metadata.json"), metadata);
+
+            uploadedFile.SetGetStream(() => File.OpenRead(Path.Combine(StoreFolderPath, uploadedFile.Id, uploadedFile.FileName)));
+
             return uploadedFile;
         }


added HRM position

added HRM position

--- Source/Xamarin.Robotics/Xamarin.Robotics.BluetoothLEExplorer.iOS/UI/Screens/Scanner/CharacteristicDetail/CharacteristicDetailScreen.cs
+++ Source/Xamarin.Robotics/Xamarin.Robotics.BluetoothLEExplorer.iOS/UI/Screens/Scanner/CharacteristicDetail/CharacteristicDetailScreen.cs
@@ -58,10 +58,39 @@
 					{
 						// position
 						var position = dataBytes[0];
+						var locationString = "-";
 						Console.WriteLine("----------------------position:" + position);
+						// https://developer.apple.com/library/mac/samplecode/HeartRateMonitor/Listings/HeartRateMonitor_HeartRateMonitorAppDelegate_m.html
+						switch (position) {
+						case 0:
+							locationString = @"Other";
+							break;
+						case 1:
+							locationString = @"Chest";
+							break;
+						case 2:
+							locationString = @"Wrist";
+							break;
+						case 3:
+							locationString = @"Finger";
+							break;
+						case 4:
+							locationString = @"Hand";
+							break;
+						case 5:
+							locationString = @"Ear Lobe";
+							break;
+						case 6:
+							locationString = @"Foot";
+							break;
+						default:
+							locationString = @"Reserved";
+							break;
+						}
+						labelHR.Text = "on " + locationString;
 					} else {
 						// heartrate
-						int bpm = 0;
+	 					int bpm = 0;
 						//http://www.raywenderlich.com/52080/introduction-core-bluetooth-building-heart-rate-monitor
 						//https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.heart_rate_measurement.xml
 						if ( (dataBytes[0] & 0x01) == 0) {


Change Namespace

Change Namespace

--- FuzzyCore/ConcreteCommands/GetPrograms_Command.cs
+++ FuzzyCore/ConcreteCommands/GetPrograms_Command.cs
@@ -3,9 +3,9 @@
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
-using fuzzyControl.Server.Data;
+using FuzzyCore.Server.Data;

-namespace fuzzyControl.Server
+namespace FuzzyCore.Server
 {
     public class GetPrograms_Command : Command
     {


Revert "Fixed possible null reference exception."

This reverts commit 622cece712aec880012153409a04f34011e8dea6.

--- RefactoringEssentials/CSharp/CodeRefactorings/Synced/CheckCollectionIndexValueCodeRefactoringProvider.cs
+++ RefactoringEssentials/CSharp/CodeRefactorings/Synced/CheckCollectionIndexValueCodeRefactoringProvider.cs
@@ -43,7 +43,7 @@
                 return;
             if (!IsCollection(type as INamedTypeSymbol) && !type.AllInterfaces.Any(IsCollection))
                 return;
-            var argument = elementAccess.ArgumentList?.Arguments?.FirstOrDefault();
+            var argument = elementAccess.ArgumentList?.Arguments.FirstOrDefault();
             if (argument == null)
                 return;
             context.RegisterRefactoring(


Unused  fields removed.

Unused  fields removed.

--- SimpleServiceLocator/SimpleInjector.Extensions.ExecutionContextScoping/ExecutionContextScopeLifestyle.cs
+++ SimpleServiceLocator/SimpleInjector.Extensions.ExecutionContextScoping/ExecutionContextScopeLifestyle.cs
@@ -50,9 +50,6 @@
     /// </example>
     public class ExecutionContextScopeLifestyle : ScopedLifestyle
     {
-        internal static readonly ExecutionContextScopeLifestyle WithDisposal = new ExecutionContextScopeLifestyle(true);
-        internal static readonly ExecutionContextScopeLifestyle NoDisposal = new ExecutionContextScopeLifestyle(false);
-
         /// <summary>Initializes a new instance of the <see cref="ExecutionContextScopeLifestyle"/> class.
         /// The created and cached instance will be disposed when the created
         /// <see cref="Scope"/> instance gets disposed and when the created object implements


Fixing unloadScene-observable to wait until AsyncCall is Done (and not signal done on first call of the callback)

--- Unity/Assets/Scripts/Utils.cs
+++ Unity/Assets/Scripts/Utils.cs
@@ -78,8 +78,12 @@
             if (scene.isLoaded) {
                 AsyncOperation async = SceneManager.UnloadSceneAsync(scene.buildIndex);
                 async.completed += (val) => {
-                    observer.OnNext(true);
-                    observer.OnCompleted();
+                    Debug.LogWarning("Unload Scene Progress:" + val.progress);
+                    if (val.isDone) {
+                        observer.OnNext(true);
+                        observer.OnCompleted();
+                    }
+
                 };
             } else {
                 observer.OnNext(true);


backend interface change

backend interface change

--- MinimalBackend2.cs
+++ MinimalBackend2.cs
@@ -120,7 +120,7 @@

         // Event handler for context clicks on relation widgets
         // we ignore those (no context menu)
-        public virtual void OnRelationContextClick(T source, T target, P tag, GenericMenu menu ) { }
+        public virtual void OnRelationContextClick(Relation<T,P> relation, GenericMenu menu ) { }

         public void OnEvent( Event e )
         {


Richiesta assistenza: codici UO di competenza

La classe RichiestaAssistenza è dotata dell'attributo CodiciUOCompetenza
che indicano i codici delle Unità Operative di competenza, in ordine di
preferenza, che possono evadere la richiesta.

--- src/backend/SOVVF/Classi/Soccorso/RichiestaAssistenza.cs
+++ src/backend/SOVVF/Classi/Soccorso/RichiestaAssistenza.cs
@@ -421,6 +421,11 @@
         public virtual string NumeroRichiedente { get; set; }

         /// <summary>
+        /// E' il codice delle unità operative di prima, seconda, terza... competenza, in ordine di preferenza.
+        /// </summary>
+        public virtual string[] CodiciUOCompetenza { get; set; }
+
+        /// <summary>
         ///   Aggiunge un evento alla lista degli eventi. L'evento deve essersi verificato in un
         ///   istante superiore a quello dell'ultimo evento in lista. In caso contrario il metodo
         ///   solleva un'eccezione.


Incrementing version

Incrementing version

--- Helpful.CircuitBreaker/Properties/AssemblyInfo.cs
+++ Helpful.CircuitBreaker/Properties/AssemblyInfo.cs
@@ -33,7 +33,7 @@
 //
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]+// [assembly: AssemblyVersion("1.0.*")]
+
+[assembly: AssemblyVersion("1.1.*")]
+[assembly: AssemblyFileVersion("1.1.*")]


Ensure treeview is built on initial load as well as ReloadAll

- Issue MatterHackers/MCCentral#4518
reload all while in history folder moves away from

--- MatterControlLib/Library/Widgets/LibraryWidget.cs
+++ MatterControlLib/Library/Widgets/LibraryWidget.cs
@@ -74,7 +74,9 @@

 			var allControls = new FlowLayoutWidget(FlowDirection.TopToBottom);

-			libraryView = new LibraryListView(ApplicationController.Instance.Library, theme)
+			var libraryContext = ApplicationController.Instance.Library;
+
+			libraryView = new LibraryListView(libraryContext, theme)
 			{
 				Name = "LibraryView",
 				// Drop containers if ShowContainers != 1
@@ -96,7 +98,7 @@
 			allControls.AddChild(navBar);
 			theme.ApplyBottomBorder(navBar);

-			breadCrumbWidget = new FolderBreadCrumbWidget(libraryView, theme);
+			breadCrumbWidget = new FolderBreadCrumbWidget(libraryContext, theme);
 			navBar.AddChild(breadCrumbWidget);

 			var searchPanel = new SearchInputBox(theme)
@@ -335,21 +337,23 @@
 			};
 			treeView.AddChild(rootColumn);

-			ApplicationController.StartupActions.Add(new ApplicationController.StartupAction()
-			{
-				Title = "Initializing Library".Localize(),
-				Priority = 0,
-				Action = () =>
-				{
-					foreach (var item in ApplicationController.Instance.Library.RootLibaryContainer.ChildContainers)
-					{
-						var rootNode = this.CreateTreeNode(item);
-						rootNode.TreeView = treeView;
-
-						rootColumn.AddChild(rootNode);
-					}
-				}
-			});
+
+			if (AppContext.IsLoading)
+			{
+				ApplicationController.StartupActions.Add(new ApplicationController.StartupAction()
+				{
+					Title = "Initializing Library".Localize(),
+					Priority = 0,
+					Action = () =>
+					{
+						this.LoadRootLibraryNodes(rootColumn);
+					}
+				});
+			}
+			else
+			{
+				this.LoadRootLibraryNodes(rootColumn);
+			}

 			horizontalSplitter.Panel2.AddChild(libraryView);

@@ -366,16 +370,23 @@
 			this.AddChild(allControls);
 		}

+		private void LoadRootLibraryNodes(FlowLayoutWidget rootColumn)
+		{
+			var rootLibraryContainer = ApplicationController.Instance.Library.RootLibaryContainer;
+
+			foreach (var item in rootLibraryContainer.ChildContainers)
+			{
+				var rootNode = this.CreateTreeNode(item, rootLibraryContainer);
+				rootNode.TreeView = treeView;
+
+				rootColumn.AddChild(rootNode);
+			}
+		}
+
 		private async Task GetExpansionItems(ILibraryItem containerItem, ContainerTreeNode treeNode)
 		{
 			if (containerItem is ILibraryContainerLink containerLink)
 			{
-				// Prevent invalid assignment of container.Parent due to overlapping load attempts that
-				// would otherwise result in containers with self referencing parent properties
-				//if (loadingContainerLink != containerLink)
-				//{
-				//	loadingContainerLink = containerLink;
-
 				try
 				{
 					// Container items
@@ -404,23 +415,15 @@
 						treeNode.Expanded = treeNode.Nodes.Count > 0;

 						treeNode.Invalidate();
-
-						//	container.Parent = ActiveContainer;
-						// SetActiveContainer(container);
 					}
 				}
 				catch { }
-				finally
-				{
-					// Clear the loading guard and any completed load attempt
-					// loadingContainerLink = null;
-				}
-			}
-		}
-
-		private TreeNode CreateTreeNode(ILibraryItem containerItem)
-		{
-			var treeNode = new ContainerTreeNode(theme)
+			}
+		}
+
+		private TreeNode CreateTreeNode(ILibraryItem containerItem, ILibraryContainer parentContainer)
+		{
+			var treeNode = new ContainerTreeNode(theme, parentContainer)
 			{
 				Text = containerItem.Name,
 				Tag = containerItem,


Minor cosmetic change

Minor cosmetic change

--- Moritz.Composer/AssistantComposerForm.Designer.cs
+++ Moritz.Composer/AssistantComposerForm.Designer.cs
@@ -507,8 +507,7 @@
             this.StaffGroupsHelpLabel.Name = "StaffGroupsHelpLabel";
             this.StaffGroupsHelpLabel.Size = new System.Drawing.Size(147, 42);
             this.StaffGroupsHelpLabel.TabIndex = 167;
-            this.StaffGroupsHelpLabel.Text = "integer values (total = x).\r\nstaff groups cannot contain\r\nboth input and output s" +
-    "taves.";
+            this.StaffGroupsHelpLabel.Text = "integer values (total = x).\r\nstaff groups cannot contain\r\nboth input and output staves.";
             //
             // StaffGroupsLabel
             //


Correctly set DepType

Correctly set DepType

--- Nodejs/Product/Nodejs/NpmUI/NpmOutputViewModel.cs
+++ Nodejs/Product/Nodejs/NpmUI/NpmOutputViewModel.cs
@@ -366,20 +366,16 @@
         }

         private class QueuedNpmCommandInfo : EventArgs {
-
-            public QueuedNpmCommandInfo(
-                string arguments) {
+            public QueuedNpmCommandInfo(string arguments) {
                 Name = arguments;
                 IsFreeformArgumentCommand = true;
             }

-            public QueuedNpmCommandInfo(
-                string name,
-                string version,
-                DependencyType depType) {
+            public QueuedNpmCommandInfo(string name,string version, DependencyType depType) {
                 Name = name;
                 Version = version;
                 IsFreeformArgumentCommand = false;
+                DependencyType = depType;
             }

             public bool IsFreeformArgumentCommand { get; private set; }


Fix for a missing BiosStubIncomplete attribute

...really just wanted to test and see if the new SVN setup worked!

--- Noxa.Emulation.Psp.Bios.GenericHle/Modules/Rtc.cs
+++ Noxa.Emulation.Psp.Bios.GenericHle/Modules/Rtc.cs
@@ -82,7 +82,7 @@
 		}

 		[BiosStub( 0x029ca3b3, "sceRtc_0x029CA3B3", false, 0 )]
-
+		[BiosStubIncomplete]
 		public int Unknown1( IMemory memory, int a0, int a1, int a2, int a3, int sp )
 		{
 			return 0;


enabled readonly collection

enabled readonly collection

--- Octokit/Models/Response/SearchRepositoryResult.cs
+++ Octokit/Models/Response/SearchRepositoryResult.cs
@@ -10,7 +10,7 @@
     {
         public int TotalCount { get; set; }
         [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
-        public IList<Repository> Items { get; set; }
+        public IReadOnlyList<Repository> Items { get; set; }

         internal string DebuggerDisplay
         {


Small update to make the command line work again

--- OpenSim/Region/Application/ConfigurationLoader.cs
+++ OpenSim/Region/Application/ConfigurationLoader.cs
@@ -160,6 +160,10 @@
                 Environment.Exit(1);
             }

+            // Make sure command line options take precedence
+            //
+            m_config.Source.Merge(argvSource);
+
             ReadConfigSettings();

             return m_config;


Fixes #1. Obvious recursive call overlooked.

--- Owin.Logging.Common/CommonLogFactoryExtensions.cs
+++ Owin.Logging.Common/CommonLogFactoryExtensions.cs
@@ -14,12 +14,12 @@

         public static void UseCommonLogging(this IAppBuilder app, Func<ILog, TraceEventType, bool> isLogEventEnabledFunc)
         {
-            UseCommonLogging(app, isLogEventEnabledFunc);
+            app.SetLoggerFactory(new CommonLoggingFactory(isLogEventEnabledFunc));
         }

         public static void UseCommonLogging(this IAppBuilder app, Action<ILog, TraceEventType, String, Exception> writeLogEventFunc)
         {
-            UseCommonLogging(app, writeLogEventFunc);
+            app.SetLoggerFactory(new CommonLoggingFactory(writeLogEventFunc));
         }

         public static void UseCommonLogging(this IAppBuilder app, Func<ILog, TraceEventType, bool> isLogEventEnabledFunc, Action<ILog, TraceEventType, String, Exception> writeLogEventFunc)


Core AssemblyInfo fix

Core AssemblyInfo fix

--- PortableLeagueApi.Core/Properties/AssemblyInfo.cs
+++ PortableLeagueApi.Core/Properties/AssemblyInfo.cs
@@ -23,5 +23,5 @@
 //
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
-[assembly: AssemblyVersion("2.0.3")]
+[assembly: AssemblyVersion("2.0.4")]
 [assembly: AssemblyFileVersion("1.0.0.0")]


PM103 - PMD sometimes crashes when exiting after creating a new document and not saving it before exiting.

--- ProjectMarkdown/CustomControls/CodeTextboxHost.cs
+++ ProjectMarkdown/CustomControls/CodeTextboxHost.cs
@@ -408,7 +408,7 @@
         {
             try
             {
-                if (!string.IsNullOrEmpty(_innerTextbox.SelectedText))
+                if ( _innerTextbox!= null && !string.IsNullOrEmpty(_innerTextbox.SelectedText))
                 {
                     return true;
                 }


Fixed #70

Fixed #70

--- Providers/EmbeddedResourcesVirtualPathProvider.cs
+++ Providers/EmbeddedResourcesVirtualPathProvider.cs
@@ -10,55 +10,57 @@

 namespace InfoCaster.Umbraco.UrlTracker.Providers
 {
-	public class EmbeddedResourcesVirtualPathProvider : VirtualPathProvider
-	{
-		public EmbeddedResourcesVirtualPathProvider()
-		{
-		}
+    public class EmbeddedResourcesVirtualPathProvider : VirtualPathProvider
+    {
+        public EmbeddedResourcesVirtualPathProvider()
+        {
+        }

-		private bool IsEmbeddedResourcePath(string virtualPath)
-		{
-			var checkPath = VirtualPathUtility.ToAppRelative(virtualPath);
-			return checkPath.StartsWith("~/Umbraco/UrlTracker/", StringComparison.InvariantCultureIgnoreCase);
-		}
+        private bool IsEmbeddedResourcePath(string virtualPath)
+        {
+            var checkPath = VirtualPathUtility.ToAppRelative(virtualPath);
+            return checkPath.StartsWith("~/Umbraco/UrlTracker/", StringComparison.InvariantCultureIgnoreCase);
+        }

-		public override bool FileExists(string virtualPath)
-		{
-			return IsEmbeddedResourcePath(virtualPath) || base.FileExists(virtualPath);
-		}
+        public override bool FileExists(string virtualPath)
+        {
+            return IsEmbeddedResourcePath(virtualPath) || base.FileExists(virtualPath);
+        }

-		public override VirtualFile GetFile(string virtualPath)
-		{
-			if (IsEmbeddedResourcePath(virtualPath))
-				return new EmbeddedResourceVirtualFile(virtualPath);
-			return base.GetFile(virtualPath);
-		}
+        public override VirtualFile GetFile(string virtualPath)
+        {
+            if (IsEmbeddedResourcePath(virtualPath))
+                return new EmbeddedResourceVirtualFile(virtualPath);
+            return base.GetFile(virtualPath);
+        }

-		public override CacheDependency GetCacheDependency(string virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart)
-		{
-			if (IsEmbeddedResourcePath(virtualPath))
-				return null;
-			return base.GetCacheDependency(virtualPath, virtualPathDependencies, utcStart);
-		}
-	}
+        public override CacheDependency GetCacheDependency(string virtualPath, IEnumerable virtualPathDependencies, DateTime utcStart)
+        {
+            if (IsEmbeddedResourcePath(virtualPath))
+                return null;
+            return base.GetCacheDependency(virtualPath, virtualPathDependencies, utcStart);
+        }
+    }

-	public class EmbeddedResourceVirtualFile : VirtualFile
-	{
-		string _path;
+    public class EmbeddedResourceVirtualFile : VirtualFile
+    {
+        readonly string _path;

-		public EmbeddedResourceVirtualFile(string virtualPath)
-			: base(virtualPath)
-		{
-			_path = VirtualPathUtility.ToAppRelative(virtualPath);
-		}
+        public EmbeddedResourceVirtualFile(string virtualPath)
+            : base(virtualPath)
+        {
+            _path = VirtualPathUtility.ToAppRelative(virtualPath);
+        }

-		public override Stream Open()
-		{
-			var resourceName = _path.Split('/').Last();
-			var assembly = GetType().Assembly;
-			if (assembly != null)
-				return assembly.GetManifestResourceStream(resourceName);
-			return null;
-		}
-	}
+        public override Stream Open()
+        {
+            var resourceName = _path.Split('/').Last();
+            var assembly = GetType().Assembly;
+            resourceName = assembly.GetManifestResourceNames()
+                .SingleOrDefault(x => x.Equals(resourceName, StringComparison.OrdinalIgnoreCase));
+            if (string.IsNullOrEmpty(resourceName))
+                return null;
+            return assembly.GetManifestResourceStream(resourceName);
+        }
+    }
 }


Thread safety for SSOManager

Thread safety for SSOManager

--- Yupi.Controller/SSOManager.cs
+++ Yupi.Controller/SSOManager.cs
@@ -33,11 +33,13 @@
 		{
 			UserInfo user;

-			// FIXME Thread safety!
-			Tickets.TryGetByFirst (ssoTicket, out user);
+			lock (Tickets) {
+				Tickets.TryGetByFirst (ssoTicket, out user);
+				Tickets.TryRemoveByFirst (ssoTicket);
+			}

 			if (user != null) {
-				Tickets.TryRemoveByFirst (ssoTicket);
+

 				IList<ISession<Habbo>> toDisconnect = ClientManager.Connections.Where (x => x.UserData?.Info == user).ToList();

@@ -103,14 +105,16 @@
 				return null;
 			}

-			Tickets.TryRemoveBySecond (info);
+			lock (Tickets) {
+				Tickets.TryRemoveBySecond (info);

-			string ticket = Cryptography.GetUniqueKey (20);
+				string ticket = Cryptography.GetUniqueKey (20);

-			if (Tickets.TryAdd (ticket, info)) {
-				return ticket;
-			} else {
-				return null;
+				if (Tickets.TryAdd (ticket, info)) {
+					return ticket;
+				} else {
+					return null;
+				}
 			}
 		}
 	}


Writing greeting msg to log

Writing greeting msg to log

--- Zergatul.Ftp/FtpConnection.cs
+++ Zergatul.Ftp/FtpConnection.cs
@@ -190,6 +190,8 @@
                 throw new Exception("Unknown error");
             CommandStream = _tcpClient.GetStream();
             Greeting = _controlStreamReader.ReadServerReply().Message;
+            if (Log != null)
+                Log.WriteLine(Greeting);
             TransferMode = FtpTransferMode.Stream;
         }


Improve tooltip for Easy File Picker button

--- ZeroMunge/Modules/Tooltips.cs
+++ ZeroMunge/Modules/Tooltips.cs
@@ -22,7 +22,7 @@
 		{
 			public const string Run = "Sequentially execute each file in the file list.";
 			public const string Cancel = "Stop processing files.  \n\nWARNING: Canceling a munge is strongly NOT recommended.";
-			public const string EasyFilePicker = "Open the Easy File Picker, which greatly simplifies the process of adding files to the file list.";
+			public const string EasyFilePicker = "Open the Easy File Picker, which greatly simplifies the process of adding munge files to the file list.";
 			public const string AddFiles = "Open a prompt to add files to the file list.";
 			public const string AddFolders = "Open a prompt to select folders containing munge.bat files to add to the file list.";
 			public const string AddProject = "Open a prompt to select a project folder whose common munge.bat files will be added to the file list.";


Disposing of response in custom API data test.

--- sdk/managed/test/Microsoft.WindowsAzure.MobileServices.Test/FunctionalTests/CustomAPI/CustomAPIsTests.cs
+++ sdk/managed/test/Microsoft.WindowsAzure.MobileServices.Test/FunctionalTests/CustomAPI/CustomAPIsTests.cs
@@ -186,63 +186,72 @@
                 HttpStatusCode expectedStatus;
                 CreateHttpContentTestInput(inputFormat, outputFormat, rndGen, out method, out content, out expectedResult, out headers, out query, out expectedStatus);

-                HttpResponseMessage response;
-                try
-                {
-                    response = await GetClient().InvokeApiAsync(AppApiName, content, method, headers, query);
-                }
-                catch (MobileServiceInvalidOperationException e)
-                {
-                    response = e.Response;
-                }
-
-                ValidateResponseHeader(expectedStatus, headers, response);
-
-                Log("  - All request / response headers validated successfully");
-
-                string responseContent = null;
-                if (response.Content != null)
-                {
-                    responseContent = await response.Content.ReadAsStringAsync();
-                    Log("Response content: {0}", responseContent);
-                }
-
-                JToken jsonResponse = null;
-                if (outputFormat == DataFormat.Json)
-                {
-                    jsonResponse = JToken.Parse(responseContent);
-                }
-                else if (outputFormat == DataFormat.Other)
-                {
-                    string decodedContent = responseContent
-                        .Replace("__{__", "{")
-                        .Replace("__}__", "}")
-                        .Replace("__[__", "[")
-                        .Replace("__]__", "]");
-                    jsonResponse = JToken.Parse(decodedContent);
-                }
-
-                bool contentIsExpected = false;
-                List<string> errors = new List<string>();
-                switch (outputFormat)
-                {
-                    case DataFormat.Json:
-                    case DataFormat.Other:
-                        contentIsExpected = CompareJson(expectedResult, jsonResponse, errors);
-                        break;
-                    case DataFormat.Xml:
-                        string expectedResultContent = JsonToXml(expectedResult);
-
-                        // Normalize CRLF
-                        expectedResultContent = expectedResultContent.Replace("\r\n", "\n");
-                        responseContent = responseContent.Replace("\r\n", "\n");
-
-                        Assert.AreEqual(expectedResultContent, responseContent);
-                        break;
+                using (HttpResponseMessage response = await InvokeApiAsync(AppApiName, content, method, headers, query))
+                {
+                    ValidateResponseHeader(expectedStatus, headers, response);
+
+                    Log("  - All request / response headers validated successfully");
+
+                    string responseContent = null;
+                    if (response.Content != null)
+                    {
+                        responseContent = await response.Content.ReadAsStringAsync();
+                        Log("Response content: {0}", responseContent);
+                    }
+
+                    JToken jsonResponse = null;
+                    if (outputFormat == DataFormat.Json)
+                    {
+                        jsonResponse = JToken.Parse(responseContent);
+                    }
+                    else if (outputFormat == DataFormat.Other)
+                    {
+                        string decodedContent = responseContent
+                            .Replace("__{__", "{")
+                            .Replace("__}__", "}")
+                            .Replace("__[__", "[")
+                            .Replace("__]__", "]");
+                        jsonResponse = JToken.Parse(decodedContent);
+                    }
+
+                    bool contentIsExpected = false;
+                    List<string> errors = new List<string>();
+                    switch (outputFormat)
+                    {
+                        case DataFormat.Json:
+                        case DataFormat.Other:
+                            contentIsExpected = CompareJson(expectedResult, jsonResponse, errors);
+                            break;
+                        case DataFormat.Xml:
+                            string expectedResultContent = JsonToXml(expectedResult);
+
+                            // Normalize CRLF
+                            expectedResultContent = expectedResultContent.Replace("\r\n", "\n");
+                            responseContent = responseContent.Replace("\r\n", "\n");
+
+                            Assert.AreEqual(expectedResultContent, responseContent);
+                            break;
+                    }
                 }

                 Log("  - Validation completed successfully");
             }
+        }
+
+        private async Task<HttpResponseMessage> InvokeApiAsync(string apiName, HttpContent content, HttpMethod method, Dictionary<string, string> headers, Dictionary<string, string> query)
+        {
+            HttpResponseMessage response = null;
+
+            try
+            {
+                response = await GetClient().InvokeApiAsync(apiName, content, method, headers, query);
+            }
+            catch (MobileServiceInvalidOperationException e)
+            {
+                response = e.Response;
+            }
+
+            return response;
         }

         private static void CreateHttpContentTestInput(DataFormat inputFormat, DataFormat outputFormat, Random rndGen, out HttpMethod method, out HttpContent content, out JObject expectedResult, out Dictionary<string, string> headers, out Dictionary<string, string> query, out HttpStatusCode expectedStatus)


Fixes initialization of LocalSnapshotStore directory

Closes #1751

--- src/core/Akka.Persistence/Snapshot/LocalSnapshotStore.cs
+++ src/core/Akka.Persistence/Snapshot/LocalSnapshotStore.cs
@@ -116,7 +116,7 @@

         private IEnumerable<FileInfo> GetSnapshotFiles(SnapshotMetadata metadata)
         {
-            return _dir
+            return GetSnapshotDir()
                 .GetFiles("*", SearchOption.TopDirectoryOnly)
                 .Where(f => SnapshotSequenceNrFilenameFilter(f, metadata));
         }
@@ -210,12 +210,12 @@
         {
             var filename = string.Format("snapshot-{0}-{1}-{2}{3}", Uri.EscapeDataString(metadata.PersistenceId),
                 metadata.SequenceNr, metadata.Timestamp.Ticks, extension);
-            return new FileInfo(Path.Combine(_dir.FullName, filename));
+            return new FileInfo(Path.Combine(GetSnapshotDir().FullName, filename));
         }

         private IEnumerable<SnapshotMetadata> GetSnapshotMetadata(string persistenceId, SnapshotSelectionCriteria criteria)
         {
-            var snapshots = _dir
+            var snapshots = GetSnapshotDir()
                 .EnumerateFiles("snapshot-" + Uri.EscapeDataString(persistenceId) + "-*", SearchOption.TopDirectoryOnly)
                 .Select(ExtractSnapshotMetadata)
                 .Where(metadata => metadata != null && criteria.IsMatch(metadata) && !_saving.Contains(metadata)).ToList();
@@ -244,12 +244,35 @@

         protected override void PreStart()
         {
-            if (!_dir.Exists)
-            {
-                _dir.Create();
-            }
-
+            GetSnapshotDir();
             base.PreStart();
+        }
+
+        private DirectoryInfo GetSnapshotDir()
+        {
+            if (!_dir.Exists || (_dir.Attributes & FileAttributes.Directory) == 0)
+            {
+                // try to create the directory, on failure double check if someone else beat us to it
+                Exception exception;
+                try
+                {
+                    _dir.Create();
+                    exception = null;
+                }
+                catch (Exception e)
+                {
+                    exception = e;
+                }
+                finally
+                {
+                    _dir.Refresh();
+                }
+                if (exception != null || ((_dir.Attributes & FileAttributes.Directory) == 0))
+                {
+                    throw new IOException("Failed to create snapshot directory " + _dir.FullName, exception);
+                }
+            }
+            return _dir;
         }

         private static bool SnapshotSequenceNrFilenameFilter(FileInfo fileInfo, SnapshotMetadata metadata)


disable death timer

disable death timer

--- RiftInfoPlugin.cs
+++ RiftInfoPlugin.cs
@@ -121,7 +121,7 @@
             base.Load(hud);

             ShowClosingTimer = false;
-            ShowDeathTimer = true;
+            ShowDeathTimer = false;
             GreaterRiftCountdown = false;
             ShowGreaterRiftTimer = true;
             ShowGreaterRiftCompletedTimer = true;


Cosmos project upgrader fixes and improvements.

--- source/Cosmos.VS.ProjectSystem/MigrateCosmosProjectFactory.cs
+++ source/Cosmos.VS.ProjectSystem/MigrateCosmosProjectFactory.cs
@@ -147,7 +147,7 @@

             MigrateProject(bstrFileName, codeProjectPath);

-            pbstrUpgradedFullyQualifiedFileName = codeProjectPath;
+            pbstrUpgradedFullyQualifiedFileName = null;
             return VSConstants.S_OK;
         }

@@ -161,24 +161,7 @@

             if (isCosmos)
             {
-                string projectTypeGuid = null;
-
-                if (Directory.GetFiles(Path.GetDirectoryName(bstrFileName), "*.cs", SearchOption.AllDirectories).Any())
-                {
-                    projectTypeGuid = CSharpProjectTypeGuid;
-                }
-
-                if (Directory.GetFiles(Path.GetDirectoryName(bstrFileName), "*.fs", SearchOption.AllDirectories).Any())
-                {
-                    projectTypeGuid = FSharpProjectTypeGuid;
-                }
-
-                if (Directory.GetFiles(Path.GetDirectoryName(bstrFileName), "*.vb", SearchOption.AllDirectories).Any())
-                {
-                    projectTypeGuid = VisualBasicProjectTypeGuid;
-                }
-
-                pguidNewProjectFactory = new Guid(projectTypeGuid);
+                pguidNewProjectFactory = Guid.Empty;
                 pUpgradeProjectCapabilityFlags = (uint)(__VSPPROJECTUPGRADEVIAFACTORYFLAGS.PUVFF_BACKUPSUPPORTED | __VSPPROJECTUPGRADEVIAFACTORYFLAGS.PUVFF_COPYBACKUP);
             }
             else
@@ -233,6 +216,11 @@
                     .Count() == 0);
             var references = itemGroups.Descendants().Where(e => e.Name == "Reference");

+            if (packageReferences.Any(p => p.Attributes().Any(a => a.Name == "Include" && a.Value == "Cosmos.Build")))
+            {
+                return;
+            }
+
             codeProjectStream.Dispose();

             File.WriteAllText(codeProject, GetProjectTemplate());


Move tool writing to the end so we can accumulate the rules.

--- src/Compilers/Core/Portable/CommandLine/SarifV2ErrorLogger.cs
+++ src/Compilers/Core/Portable/CommandLine/SarifV2ErrorLogger.cs
@@ -9,26 +9,23 @@
 {
     internal sealed class SarifV2ErrorLogger : StreamErrorLogger, IDisposable
     {
+
+        private readonly string _toolName;
+        private readonly string _toolFileVersion;
+        private readonly Version _toolAssemblyVersion;
+
         public SarifV2ErrorLogger(Stream stream, string toolName, string toolFileVersion, Version toolAssemblyVersion, CultureInfo culture)
             : base(stream)
         {
+            _toolName = toolName;
+            _toolFileVersion = toolFileVersion;
+            _toolAssemblyVersion = toolAssemblyVersion;
+
             _writer.WriteObjectStart(); // root
             _writer.Write("$schema", "http://json.schemastore.org/sarif-2.1.0");
             _writer.Write("version", "2.1.0");
             _writer.WriteArrayStart("runs");
             _writer.WriteObjectStart(); // run
-
-            _writer.WriteObjectStart("tool");
-            _writer.WriteObjectStart("driver");
-            _writer.Write("name", toolName);
-            _writer.Write("fileVersion", toolFileVersion);
-            _writer.Write("version", toolAssemblyVersion.ToString());
-            _writer.Write("semanticVersion", toolAssemblyVersion.ToString(fieldCount: 3));
-
-            WriteRules();
-
-            _writer.WriteObjectEnd(); // driver
-            _writer.WriteObjectEnd(); // tool

             _writer.WriteArrayStart("results");
         }
@@ -44,10 +41,28 @@
         public override void Dispose()
         {
             _writer.WriteArrayEnd(); //results
+
+            WriteTool();
+
             _writer.WriteObjectEnd(); // run
             _writer.WriteArrayEnd();  // runs
             _writer.WriteObjectEnd(); // root
             base.Dispose();
+        }
+
+        private void WriteTool()
+        {
+            _writer.WriteObjectStart("tool");
+            _writer.WriteObjectStart("driver");
+            _writer.Write("name", _toolName);
+            _writer.Write("fileVersion", _toolFileVersion);
+            _writer.Write("version", _toolAssemblyVersion.ToString());
+            _writer.Write("semanticVersion", _toolAssemblyVersion.ToString(fieldCount: 3));
+
+            WriteRules();
+
+            _writer.WriteObjectEnd(); // driver
+            _writer.WriteObjectEnd(); // tool
         }

         private void WriteRules()


PlayerEngine: inherit from IDisposable

PlayerEngine: inherit from IDisposable

PlayerEngine class has a Dispose() method so it should inherit
from IDisposable.

--- src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngine.cs
+++ src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngine.cs
@@ -38,7 +38,7 @@

 namespace Banshee.MediaEngine
 {
-    public abstract class PlayerEngine
+    public abstract class PlayerEngine : IDisposable
     {
         public const int VolumeDelta = 10;
         public const int SkipDelta = 10;