Added TriangleDraw method

Added TriangleDraw method

--- GGJ-2014/GGJ-2014/GGJ-2014/Graphics/TextureGenerator.cs
+++ GGJ-2014/GGJ-2014/GGJ-2014/Graphics/TextureGenerator.cs
@@ -13,6 +13,8 @@
         GRASS,
         DIRT,
         COBBLESTONE,
+        PAVEMENT,
+        TREE_ON_GRASS,
         BORDERED
     }

@@ -124,6 +126,116 @@

                 #endregion

+                #region TREE_ON_GRASS_GENERATOR
+
+                case Textures.TREE_ON_GRASS:
+                    {
+                        Color baseColor = Color.MediumSeaGreen;
+                        Color subtractiveColor;
+                        Random rand = new Random();
+                        double randVal;
+                        for (int y = 0; y < texture.Height; y++)
+                        {
+                            for (int x = 0; x < texture.Width; x++)
+                            {
+                                randVal = rand.NextDouble();
+
+                                int safeXMax = (int)MathHelper.Clamp(x + 1, 0, texture.Width - 1);
+                                int safeYMax = (int)MathHelper.Clamp(y + 1, 0, texture.Height - 1);
+                                int safeXMin = (int)MathHelper.Clamp(x - 1, 0, texture.Width - 1);
+                                int safeYMin = (int)MathHelper.Clamp(y - 1, 0, texture.Height - 1);
+
+                                if (DarkerThan(textureData[y * texture.Width + safeXMax], baseColor)
+                                    || DarkerThan(textureData[y * texture.Width + safeXMin], baseColor)
+                                    || DarkerThan(textureData[safeYMax * texture.Width + x], baseColor)
+                                    || DarkerThan(textureData[safeYMin * texture.Width + x], baseColor))
+                                {
+                                    randVal = MathHelper.Clamp((float)randVal - 0.05f, 0.0f, 1.0f);
+                                }
+
+                                if (randVal > 0.7)
+                                {
+                                    subtractiveColor = new Color(25, 25, 25, 0);
+                                }
+                                else if (randVal > 0.5)
+                                {
+                                    subtractiveColor = new Color(0, 0, 0, 0);
+                                }
+                                else
+                                {
+                                    subtractiveColor = new Color(25, 25, -25, 0);
+                                }
+                                textureData[y * texture.Width + x] = SubtractColor(baseColor, subtractiveColor);
+                            }
+                        }
+
+
+                        for (int i = 0; i < 5; i++)
+                        {
+                            int a = rand.Next(-10, 30);
+
+                            textureData = AddCircle(
+                                textureData,
+                                new Vector2(texture.Width, texture.Height),
+                                rand.Next(8, 12),
+                                new Vector2(rand.Next(8, 24), rand.Next(8, 24)),
+                                SubtractColor(Color.ForestGreen, new Color(a, a, a, 0))
+                                );
+                        }
+
+
+                        break;
+                    }
+
+                #endregion
+
+                #region PAVEMENT_GENERATOR
+
+                case Textures.PAVEMENT:
+                    {
+                        Color baseColor = Color.SlateGray;
+                        Color subtractiveColor;
+                        Random rand = new Random();
+                        double randVal;
+                        for (int y = 0; y < texture.Height; y++)
+                        {
+                            for (int x = 0; x < texture.Width; x++)
+                            {
+                                randVal = rand.NextDouble();
+
+                                int safeXMax = (int)MathHelper.Clamp(x + 1, 0, texture.Width - 1);
+                                int safeYMax = (int)MathHelper.Clamp(y + 1, 0, texture.Height - 1);
+                                int safeXMin = (int)MathHelper.Clamp(x - 1, 0, texture.Width - 1);
+                                int safeYMin = (int)MathHelper.Clamp(y - 1, 0, texture.Height - 1);
+
+                                if (DarkerThan(textureData[y * texture.Width + safeXMax], baseColor)
+                                    || DarkerThan(textureData[y * texture.Width + safeXMin], baseColor)
+                                    || DarkerThan(textureData[safeYMax * texture.Width + x], baseColor)
+                                    || DarkerThan(textureData[safeYMin * texture.Width + x], baseColor))
+                                {
+                                    randVal = MathHelper.Clamp((float)randVal - 0.05f, 0.0f, 1.0f);
+                                }
+
+                                if (randVal > 0.7)
+                                {
+                                    subtractiveColor = new Color(25, 25, 25, 0);
+                                }
+                                else if (randVal > 0.5)
+                                {
+                                    subtractiveColor = new Color(0, 0, 0, 0);
+                                }
+                                else
+                                {
+                                    subtractiveColor = new Color(25, 25, 25, 0);
+                                }
+                                textureData[y * texture.Width + x] = SubtractColor(baseColor, subtractiveColor);
+                            }
+                        }
+                        break;
+                    }
+
+                #endregion
+
                 #region COBBLESTONE_GENERATOR

                 case Textures.COBBLESTONE:
@@ -271,5 +383,46 @@
             }
             return textureData;
         }
+
+        private static Color[] AddTriangle(Color[] textureData, Vector2 arraySize, Vector2[] verticies, Color colorToAdd)
+        {
+            for (int x = 0; x < (int)arraySize.X; x++)
+            {
+                for (int y = 0; y < (int)arraySize.Y; y++)
+                {
+                    if (CheckIfPointInTriangle(verticies, new Vector2(x, y)))
+                    {
+                        textureData[y * (int)arraySize.X + x] = colorToAdd;
+                    }
+                }
+            }
+            return textureData;
+        }
+
+        private static bool CheckIfPointInTriangle(Vector2[] verticies, Vector2 point)
+        {
+            Vector2 v0 = verticies[2] - verticies[0];
+            Vector2 v1 = verticies[1] - verticies[0];
+            Vector2 v2 = point - verticies[0];
+
+            double dot00 = Vector2.Dot(v0, v0);
+            double dot01 = Vector2.Dot(v0, v1);
+            double dot02 = Vector2.Dot(v0, v2);
+            double dot11 = Vector2.Dot(v1, v1);
+            double dot12 = Vector2.Dot(v1, v2);
+
+            double invDenom, u, v;
+            invDenom = 1.0 / (dot00 * dot11 - dot01 * dot01);
+
+            u = (dot11 * dot02 - dot01 * dot12) * invDenom;
+            v = (dot00 * dot12 - dot01 * dot02) * invDenom;
+
+            return (u >= 0) && (v >= 0) && (u + v < 1);
+
+        }
+        private static Vector2 Midpoint(Vector2 vec1, Vector2 vec2)
+        {
+            return new Vector2((vec1.X + vec2.X) / 2.0f, (vec1.Y + vec2.Y) / 2.0f);
+        }
     }
 }


[ReignOfKings] Fix error in core causing compiling to fail

--- Games/Unity/Oxide.Game.ReignOfKings/ReignOfKingsCore.cs
+++ Games/Unity/Oxide.Game.ReignOfKings/ReignOfKingsCore.cs
@@ -49,6 +49,7 @@
         // Commands that a plugin can't override
         internal static IEnumerable<string> RestrictedCommands => new[]
         {
+            ""
         };

         /// <summary>


added DistinctUntilChanged to improve performance in state selection

--- HandbookApp/HandbookApp/ViewModels/MainViewViewModel.cs
+++ HandbookApp/HandbookApp/ViewModels/MainViewViewModel.cs
@@ -74,14 +74,18 @@
                 this.WhenAnyValue (x => x.CanIncrement);

             Update = ReactiveCommand.CreateAsyncTask(x => updateImpl());
-
-
+
             Increment = ReactiveCommand.CreateAsyncObservable<Unit> (canExecuteIncrement, _ => incrementImpl());

             Decrement = ReactiveCommand.CreateAsyncObservable<Unit> (canExecuteIncrement, _ => decrementImpl());

-            App.Store.Subscribe(state => setNumArticles(state));
-            App.Store.Subscribe(state => setNumBookpages(state));
+            App.Store
+                .DistinctUntilChanged(state => new { state.Articles })
+                .Subscribe(state => setNumArticles(state));
+
+            App.Store
+                .DistinctUntilChanged(state => new { state.Bookpages })
+                .Subscribe(state => setNumBookpages(state));
         }

         private void setNumBookpages(AppState state)


improves the user list

improves the user list

--- Handle.WPF/Handle.WPF/ViewModels/IrcChannelViewModel.cs
+++ Handle.WPF/Handle.WPF/ViewModels/IrcChannelViewModel.cs
@@ -112,6 +112,7 @@
       {
         sb.Append(user.User.NickName + " | ");
       }
+      if (sb[sb.Length - 2] == '|') sb.Length -= 3;
       this.Users = sb.ToString();
     }


Started rework of mediaplayer

Started rework of mediaplayer

--- HiPMobile/HiPMobile.Droid/Helpers/MediaPlayerService.cs
+++ HiPMobile/HiPMobile.Droid/Helpers/MediaPlayerService.cs
@@ -20,6 +20,7 @@
 using Android.Util;
 using de.upb.hip.mobile.pcl.BusinessLayer.Models;
 using Java.IO;
+using Java.Util.Logging;

 namespace de.upb.hip.mobile.droid.Helpers {
     /// <summary>
@@ -37,8 +38,10 @@

         private bool AudioFileIsSet;
         private readonly IBinder binder;
-
+
         private MediaPlayer mediaPlayer;
+
+        private AudioTrack audiotrack;

         public MediaPlayerService ()
         {
@@ -69,9 +72,10 @@
             {
                 //the service is bound, therefore this function is used rather than OnStartCommand
                 //mediaPlayer = MediaPlayer.Create(this, a1.getAudioDir());
-                mediaPlayer.SetAudioStreamType (Stream.Music);
+
+                /*mediaPlayer.SetAudioStreamType (Stream.Music);
                 mediaPlayer.SetOnPreparedListener (this);
-                mediaPlayer.PrepareAsync ();
+                mediaPlayer.PrepareAsync ();*/
             }
             catch (Exception e)
             {
@@ -83,9 +87,9 @@
             try
             {
                 //            mMediaPlayer = MediaPlayer.create(this, songList[current].getAudioDir());
-                mediaPlayer.SetAudioStreamType (Stream.Music);
+                /*mediaPlayer.SetAudioStreamType (Stream.Music);
                 mediaPlayer.SetOnPreparedListener (this);
-                mediaPlayer.PrepareAsync ();
+                mediaPlayer.PrepareAsync ();*/
             }
             catch (Exception e)
             {
@@ -99,56 +103,47 @@
         //following are the functions for the app to use to control the media player
         public void StartSound ()
         {
-            if (!AudioFileIsSet)
-            {
-                mediaPlayer = new MediaPlayer ();
-            }
-            mediaPlayer.Start ();
+            if (audiotrack != null)
+            {
+                audiotrack.Play ();
+            }
         }

         public void StopSound ()
         {
-            mediaPlayer.Stop ();
+            audiotrack.Stop ();
         }

         public void PauseSound ()
         {
-            mediaPlayer.Pause ();
-        }
-
-        public void changeAudioFile ()
-        {
-            try
-            {
-                mediaPlayer.Reset ();
-            }
-            catch (Exception e)
-            {
-            }
+            audiotrack.Pause ();
         }

         /** sets a specific audio file*/
-
         public void SetAudioFile (Audio audio)
         {
             try
             {
-                if (mediaPlayer != null)
+                if (audiotrack != null)
                 {
-                    mediaPlayer.Stop ();
-                    mediaPlayer.Reset ();
+                    audiotrack.Stop ();
+                    audiotrack.Release ();
                 }
                 //may be needed for handling audio files later. until know, leave this commented in here.
-                var path = CopyAudioToTemp (audio);
-                mediaPlayer = new MediaPlayer ();
-                mediaPlayer.SetAudioStreamType (Stream.Music);
-                mediaPlayer.SetDataSource (path);
-                mediaPlayer.Prepare ();
-                AudioFileIsSet = true;
+                if (audio != null)
+                {
+                    var streamType = Stream.Music;
+                    var sampleSize = AudioTrack.GetNativeOutputSampleRate (streamType);
+                    var buffer = AudioTrack.GetMinBufferSize (sampleSize, ChannelOut.Mono, Encoding.Pcm16bit)*2;
+                    audiotrack = new AudioTrack (streamType, sampleSize, ChannelOut.Mono, Encoding.Pcm16bit, buffer, AudioTrackMode.Stream);
+                    audiotrack.SetVolume (1.0f);
+                    var r=audiotrack.Write (audio.Data, 0, audio.Data.Length);
+                }
             }
             catch (Exception e)
             {
                 //            add an exception handling
+                Log.Error ("Mediaplayerservice", e.Message);
             }
         }


add PostAuthenticateLocalAsync

add PostAuthenticateLocalAsync

--- source/AspNetIdentityUserService/AspNetIdentityUserService.cs
+++ source/AspNetIdentityUserService/AspNetIdentityUserService.cs
@@ -175,6 +175,20 @@
         {
             return await userManager.FindByNameAsync(username);
         }
+
+        protected virtual Task<AuthenticateResult> PostAuthenticateLocalAsync(TUser account, SignInMessage message)
+        {
+            //if (await userManager.GetTwoFactorEnabledAsync(userId) &&
+            //    !await AuthenticationManager.TwoFactorBrowserRememberedAsync(user.Id))
+            //{
+            //    var identity = new ClaimsIdentity(DefaultAuthenticationTypes.TwoFactorCookie);
+            //    identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, user.Id));
+            //    AuthenticationManager.SignIn(identity);
+            //    return SignInStatus.RequiresTwoFactorAuthentication;
+            //}
+
+            return Task.FromResult<AuthenticateResult>(null);
+        }

         public virtual async Task<AuthenticateResult> AuthenticateLocalAsync(string username, string password, SignInMessage message)
         {
@@ -197,14 +211,9 @@

             if (await userManager.CheckPasswordAsync(user, password))
             {
-                //if (await userManager.GetTwoFactorEnabledAsync(userId) &&
-                //    !await AuthenticationManager.TwoFactorBrowserRememberedAsync(user.Id))
-                //{
-                //    var identity = new ClaimsIdentity(DefaultAuthenticationTypes.TwoFactorCookie);
-                //    identity.AddClaim(new Claim(ClaimTypes.NameIdentifier, user.Id));
-                //    AuthenticationManager.SignIn(identity);
-                //    return SignInStatus.RequiresTwoFactorAuthentication;
-                //}
+
+                var result = await PostAuthenticateLocalAsync(user, message);
+                if (result != null) return result;

                 var p = IdentityServerPrincipal.Create(user.Id.ToString(), await GetDisplayNameForAccountAsync(user.Id));
                 return new AuthenticateResult(p);


Comments improved +1

Comments improved +1


#70 Add WithLoggerName extension method for AtataContextBuilder<NLogConsumer>

--- src/Atata/Context/LogConsumerAtataContextBuilderExtensions.cs
+++ src/Atata/Context/LogConsumerAtataContextBuilderExtensions.cs
@@ -32,5 +32,17 @@
             consumerInfo.MinLevel = level;
             return builder;
         }
+
+        /// <summary>
+        /// Specifies the name of NLog logger.
+        /// </summary>
+        /// <param name="builder">The builder.</param>
+        /// <param name="loggerName">The name of the logger.</param>
+        /// <returns>The <see cref="AtataContextBuilder{NLogConsumer}"/> instance.</returns>
+        public static AtataContextBuilder<NLogConsumer> WithLoggerName(this AtataContextBuilder<NLogConsumer> builder, string loggerName)
+        {
+            builder.Context.LoggerName = loggerName;
+            return builder;
+        }
     }
 }


Set LightDimissEnabled via SetValue()

Set LightDimissEnabled via SetValue()

--- src/Avalonia.Diagnostics/Diagnostics/Views/MainWindow.xaml.cs
+++ src/Avalonia.Diagnostics/Diagnostics/Views/MainWindow.xaml.cs
@@ -1,15 +1,18 @@
 using System;
 using System.Collections.Generic;
 using System.Linq;
+using System.Reactive.Disposables;
 using System.Reactive.Linq;
 using System.Reactive.Subjects;
 using Avalonia.Controls;
 using Avalonia.Controls.Diagnostics;
 using Avalonia.Controls.Primitives;
+using Avalonia.Data;
 using Avalonia.Diagnostics.ViewModels;
 using Avalonia.Input;
 using Avalonia.Input.Raw;
 using Avalonia.Markup.Xaml;
+using Avalonia.Media;
 using Avalonia.Styling;
 using Avalonia.VisualTree;

@@ -18,6 +21,7 @@
     internal class MainWindow : Window, IStyleHost
     {
         private readonly IDisposable _keySubscription;
+        private readonly Dictionary<Popup, IDisposable> _frozenPopupStates;
         private TopLevel? _root;

         public MainWindow()
@@ -27,6 +31,8 @@
             _keySubscription = InputManager.Instance.Process
                 .OfType<RawKeyEventArgs>()
                 .Subscribe(RawKeyDown);
+
+            _frozenPopupStates = new Dictionary<Popup, IDisposable>();

             EventHandler? lh = default;
             lh = (s, e) =>
@@ -183,7 +189,25 @@
                     {
                         if (popupRoot.Parent is Popup popup)
                         {
-                            popup.IsLightDismissEnabled = !vm.FreezePopups;
+                            if (vm.FreezePopups)
+                            {
+                                var lightDismissEnabledState = popup.SetValue(
+                                    Popup.IsLightDismissEnabledProperty,
+                                    !vm.FreezePopups,
+                                    BindingPriority.Animation);
+
+                                if (lightDismissEnabledState != null)
+                                {
+                                    _frozenPopupStates[popup] = lightDismissEnabledState;
+                                }
+                            }
+                            else
+                            {
+                                if (_frozenPopupStates.TryGetValue(popup, out var state))
+                                {
+                                    state.Dispose();
+                                }
+                            }
                         }
                     }


Made PlayerInformationHeader constructable

--- src/Booma.Packet.Game/Block/Models/PlayerInformationHeader.cs
+++ src/Booma.Packet.Game/Block/Models/PlayerInformationHeader.cs
@@ -1,3 +1,4 @@
+using System;
 using FreecraftCore.Serializer;

 namespace Booma
@@ -28,6 +29,7 @@
 		public bool isSlotFilled { get; internal set; }

 		//Sylverant doesn't have this, Teth does and Soly uses it too.
+		//Value from: https://github.com/Sylverant/ship_server/blob/4b94e90d9857fb88f45537f25fa589f1b5d90bda/src/ship_packets.c#L1584
 		[WireMember(4)]
 		internal int unk4 { get; set; } = 0x00010000;

@@ -40,7 +42,7 @@
 		//TODO: What is this?
 		[KnownSize(5)] //Syl says there are 3 of these but Soda's Teth skips x10 from the begining of GCN meaning he considers there is only 4
 		[WireMember(6)]
-		internal uint[] unk1 { get; set; }
+		internal uint[] unk1 { get; set; } = Array.Empty<uint>();

 		/// <summary>
 		/// The ID of the client.
@@ -57,6 +59,13 @@
 		//TODO: What is this?
 		[WireMember(10)]
 		internal uint unk3 { get; set; }
+
+		public PlayerInformationHeader(uint guildCardNumber, int clientId, string characterName)
+		{
+			GuildCardNumber = guildCardNumber;
+			ClientId = clientId;
+			CharacterName = characterName;
+		}

 		/// <summary>
 		/// Serializer ctor.


methods called statically are not called virtually

--- src/Compiler/PhpCodeAnalysis/CodeGen/Graph/BoundExpression.cs
+++ src/Compiler/PhpCodeAnalysis/CodeGen/Graph/BoundExpression.cs
@@ -1704,7 +1704,7 @@
         internal override TypeSymbol Emit(CodeGenerator cg)
         {
             return (TargetMethod != null)
-                ? EmitDirectCall(cg, TargetMethod.IsVirtual ? ILOpCode.Callvirt : ILOpCode.Call, TargetMethod)
+                ? EmitDirectCall(cg, IsVirtualCall ? ILOpCode.Callvirt : ILOpCode.Call, TargetMethod)
                 : EmitCallsiteCall(cg);
         }

@@ -1721,6 +1721,7 @@
         protected virtual string CallsiteName => null;
         protected virtual BoundExpression RoutineNameExpr => null;
         protected virtual BoundExpression TypeNameExpr => null;
+        protected virtual bool IsVirtualCall => true;

         internal virtual TypeSymbol EmitCallsiteCall(CodeGenerator cg)
         {
@@ -1792,6 +1793,7 @@
     {
         protected override string CallsiteName => _name.IsDirect ? _name.NameValue.ToString() : null;
         protected override BoundExpression RoutineNameExpr => _name.NameExpression;
+        protected override bool IsVirtualCall => false;

         internal override TypeSymbol EmitCallsiteCall(CodeGenerator cg)
         {
@@ -1829,7 +1831,7 @@
     {
         protected override string CallsiteName => _name.IsDirect ? _name.NameValue.ToString() : null;
         protected override BoundExpression RoutineNameExpr => _name.NameExpression;
-
+
         internal override void BuildCallsiteCreate(CodeGenerator cg, TypeSymbol returntype)
         {
             cg.Builder.EmitStringConstant(CallsiteName);        // name
@@ -1845,6 +1847,7 @@
         protected override string CallsiteName => _name.IsDirect ? _name.NameValue.ToString() : null;
         protected override BoundExpression RoutineNameExpr => _name.NameExpression;
         protected override BoundExpression TypeNameExpr => _typeRef.TypeExpression;
+        protected override bool IsVirtualCall => false;

         internal override void BuildCallsiteCreate(CodeGenerator cg, TypeSymbol returntype)
         {


Improve the spectrum effect.

Improve the spectrum effect.

--- scripts/Spectrum.cs
+++ scripts/Spectrum.cs
@@ -1,8 +1,7 @@
 using OpenTK;
-using OpenTK.Graphics;
+using StorybrewCommon.Animations;
 using StorybrewCommon.Scripting;
 using StorybrewCommon.Storyboarding;
-using StorybrewCommon.Storyboarding.Util;
 using System;

 namespace StorybrewScripts
@@ -19,58 +18,86 @@
         public int EndTime = 10000;

         [Configurable]
-        public int BeatDivisor = 4;
+        public Vector2 Position = new Vector2(-107, 240);

         [Configurable]
-        public int BarCount = 256;
+        public float Width = 844;
+
+        [Configurable]
+        public int BeatDivisor = 16;
+
+        [Configurable]
+        public int BarCount = 96;

         [Configurable]
         public string SpritePath = "sb/pl.png";

         [Configurable]
-        public int SpriteWidth = 76;
+        public OsbOrigin SpriteOrigin = OsbOrigin.CentreLeft;
+
+        [Configurable]
+        public Vector2 Scale = new Vector2(1, 200);
+
+        [Configurable]
+        public int LogScale = 600;
+
+        [Configurable]
+        public double Tolerance = 0.2;
+
+        [Configurable]
+        public float MinimalHeight = 0.05f;
+
+        [Configurable]
+        public OsbEasing FftEasing = OsbEasing.InExpo;

         public override void Generate()
         {
             var endTime = Math.Min(EndTime, (int)AudioDuration);
             var startTime = Math.Min(StartTime, endTime);
+            var bitmap = GetMapsetBitmap(SpritePath);

-            var layer = GetLayer("Spectrum");
+            var heightKeyframes = new KeyframedValue<float>[BarCount];
+            for (var i = 0; i < BarCount; i++)
+                heightKeyframes[i] = new KeyframedValue<float>(null);
+
             var fftTimeStep = Beatmap.GetTimingPointAt(startTime).BeatDuration / BeatDivisor;
-
-            var bars = new OsbSprite[BarCount];
-            var barWidth = 640.0 / bars.Length;
-            var imageWidth = SpriteWidth;
-
-            for (var i = 0; i < bars.Length; i++)
-            {
-                bars[i] = layer.CreateSprite(SpritePath, OsbOrigin.CentreLeft);
-                bars[i].Move(startTime, i * barWidth, 240);
-                bars[i].ScaleVec(startTime, barWidth / imageWidth, 0);
-                bars[i].Additive(startTime, endTime);
-            }
-
             var fftOffset = fftTimeStep * 0.2;
             for (var time = (double)startTime; time < endTime; time += fftTimeStep)
             {
-                var fft = GetFft(time + fftOffset, bars.Length);
-                for (var i = 0; i < bars.Length; i++)
+                var fft = GetFft(time + fftOffset, BarCount, null, FftEasing);
+                for (var i = 0; i < BarCount; i++)
                 {
-                    var height = fft[i] * 2000 / imageWidth;
-                    if (height < 0.01) height = 0;
+                    var height = (float)Math.Log10(1 + fft[i] * LogScale) * Scale.Y / bitmap.Height;
+                    height = (float)Math.Floor(height * 10) / 10.0f;
+                    if (height < MinimalHeight) height = MinimalHeight;

-                    var previousHeight = bars[i].ScaleAt(time).Y;
-                    if (height == previousHeight)
-                        continue;
+                    heightKeyframes[i].Add(time, height);
+                }
+            }

-                    if (height < previousHeight)
-                        bars[i].ScaleVec(time, time + fftTimeStep,
-                            barWidth / imageWidth, previousHeight,
-                            barWidth / imageWidth, height);
-                    else if (height != previousHeight)
-                        bars[i].ScaleVec(time,
-                            barWidth / imageWidth, height);
-                }
+            var layer = GetLayer("Spectrum");
+            var barWidth = Width / BarCount;
+            for (var i = 0; i < BarCount; i++)
+            {
+                var keyframes = heightKeyframes[i];
+                keyframes.Simplify1dKeyframes(Tolerance, h => h);
+
+                var bar = layer.CreateSprite(SpritePath, SpriteOrigin, new Vector2(Position.X + (float)(i * barWidth), Position.Y));
+                bar.ColorHsb(startTime, (i * 360.0 / BarCount) + Random(-10.0, 10.0), 0.6 + Random(0.4), 1);
+                bar.Additive(startTime, endTime);
+
+                var scaleX = Scale.X * barWidth / bitmap.Width;
+                scaleX = (float)Math.Floor(scaleX * 10) / 10.0f;
+
+                var hasScale = false;
+                keyframes.ForEachPair((startKeyframe, endKeyframe) =>
+                {
+                    hasScale = true;
+                    bar.ScaleVec(startKeyframe.Time, endKeyframe.Time,
+                        scaleX, startKeyframe.Value,
+                        scaleX, endKeyframe.Value);
+                });
+                if (!hasScale) bar.ScaleVec(startTime, scaleX, MinimalHeight);
             }
         }
     }


added a test for https://github.com/dotnet/roslyn/issues/14878

--- src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncEHTests.cs
+++ src/Compilers/CSharp/Test/Emit/CodeGen/CodeGenAsyncEHTests.cs
@@ -142,6 +142,460 @@
             var expected = @"";
             CompileAndVerify(source, expectedOutput: expected);
         }
+
+        [WorkItem(14878, "https://github.com/dotnet/roslyn/issues/14878")]
+        [Fact]
+        public void AsyncWithEHCodeQuality()
+        {
+            var source = @"
+using System;
+using System.Threading.Tasks;
+
+class Test
+{
+    static async Task<int> G()
+    {
+        int x = 1;
+
+        try
+        {
+            try
+            {
+                try
+                {
+                    await Task.Yield();
+                    x += 1;
+                    await Task.Yield();
+                    x += 1;
+                    await Task.Yield();
+                    x += 1;
+                    await Task.Yield();
+                    x += 1;
+                    await Task.Yield();
+                    x += 1;
+                    await Task.Yield();
+                    x += 1;
+                }
+                finally
+                {
+                    x += 1;
+                }
+            }
+            finally
+            {
+                x += 1;
+            }
+        }
+        finally
+        {
+            x += 1;
+        }
+
+        return x;
+    }
+
+    public static void Main()
+    {
+        Task<int> t2 = G();
+        t2.Wait(1000 * 60);
+        Console.WriteLine(t2.Result);
+    }
+}";
+            var expected = @"
+10
+";
+            CompileAndVerify(source, expectedOutput: expected).
+VerifyIL("Test.<G>d__0.System.Runtime.CompilerServices.IAsyncStateMachine.MoveNext()", @"
+{
+  // Code size      945 (0x3b1)
+  .maxstack  3
+  .locals init (int V_0,
+                int V_1,
+                System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter V_2,
+                System.Runtime.CompilerServices.YieldAwaitable V_3,
+                System.Exception V_4)
+  IL_0000:  ldarg.0
+  IL_0001:  ldfld      ""int Test.<G>d__0.<>1__state""
+  IL_0006:  stloc.0
+  .try
+  {
+    IL_0007:  ldloc.0
+    IL_0008:  switch    (
+        IL_002c,
+        IL_002c,
+        IL_002c,
+        IL_002c,
+        IL_002c,
+        IL_002c)
+    IL_0025:  ldarg.0
+    IL_0026:  ldc.i4.1
+    IL_0027:  stfld      ""int Test.<G>d__0.<x>5__1""
+    IL_002c:  nop
+    .try
+    {
+      IL_002d:  ldloc.0
+      IL_002e:  switch    (
+        IL_004b,
+        IL_004b,
+        IL_004b,
+        IL_004b,
+        IL_004b,
+        IL_004b)
+      IL_004b:  nop
+      .try
+      {
+        IL_004c:  ldloc.0
+        IL_004d:  switch    (
+        IL_006a,
+        IL_006a,
+        IL_006a,
+        IL_006a,
+        IL_006a,
+        IL_006a)
+        IL_006a:  nop
+        .try
+        {
+          IL_006b:  ldloc.0
+          IL_006c:  switch    (
+        IL_00c3,
+        IL_0136,
+        IL_01a9,
+        IL_021c,
+        IL_028f,
+        IL_0302)
+          IL_0089:  call       ""System.Runtime.CompilerServices.YieldAwaitable System.Threading.Tasks.Task.Yield()""
+          IL_008e:  stloc.3
+          IL_008f:  ldloca.s   V_3
+          IL_0091:  call       ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter System.Runtime.CompilerServices.YieldAwaitable.GetAwaiter()""
+          IL_0096:  stloc.2
+          IL_0097:  ldloca.s   V_2
+          IL_0099:  call       ""bool System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.IsCompleted.get""
+          IL_009e:  brtrue.s   IL_00df
+          IL_00a0:  ldarg.0
+          IL_00a1:  ldc.i4.0
+          IL_00a2:  dup
+          IL_00a3:  stloc.0
+          IL_00a4:  stfld      ""int Test.<G>d__0.<>1__state""
+          IL_00a9:  ldarg.0
+          IL_00aa:  ldloc.2
+          IL_00ab:  stfld      ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.<G>d__0.<>u__1""
+          IL_00b0:  ldarg.0
+          IL_00b1:  ldflda     ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<G>d__0.<>t__builder""
+          IL_00b6:  ldloca.s   V_2
+          IL_00b8:  ldarg.0
+          IL_00b9:  call       ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter, Test.<G>d__0>(ref System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter, ref Test.<G>d__0)""
+          IL_00be:  leave      IL_03b0
+          IL_00c3:  ldarg.0
+          IL_00c4:  ldfld      ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.<G>d__0.<>u__1""
+          IL_00c9:  stloc.2
+          IL_00ca:  ldarg.0
+          IL_00cb:  ldflda     ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.<G>d__0.<>u__1""
+          IL_00d0:  initobj    ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter""
+          IL_00d6:  ldarg.0
+          IL_00d7:  ldc.i4.m1
+          IL_00d8:  dup
+          IL_00d9:  stloc.0
+          IL_00da:  stfld      ""int Test.<G>d__0.<>1__state""
+          IL_00df:  ldloca.s   V_2
+          IL_00e1:  call       ""void System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.GetResult()""
+          IL_00e6:  ldloca.s   V_2
+          IL_00e8:  initobj    ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter""
+          IL_00ee:  ldarg.0
+          IL_00ef:  ldarg.0
+          IL_00f0:  ldfld      ""int Test.<G>d__0.<x>5__1""
+          IL_00f5:  ldc.i4.1
+          IL_00f6:  add
+          IL_00f7:  stfld      ""int Test.<G>d__0.<x>5__1""
+          IL_00fc:  call       ""System.Runtime.CompilerServices.YieldAwaitable System.Threading.Tasks.Task.Yield()""
+          IL_0101:  stloc.3
+          IL_0102:  ldloca.s   V_3
+          IL_0104:  call       ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter System.Runtime.CompilerServices.YieldAwaitable.GetAwaiter()""
+          IL_0109:  stloc.2
+          IL_010a:  ldloca.s   V_2
+          IL_010c:  call       ""bool System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.IsCompleted.get""
+          IL_0111:  brtrue.s   IL_0152
+          IL_0113:  ldarg.0
+          IL_0114:  ldc.i4.1
+          IL_0115:  dup
+          IL_0116:  stloc.0
+          IL_0117:  stfld      ""int Test.<G>d__0.<>1__state""
+          IL_011c:  ldarg.0
+          IL_011d:  ldloc.2
+          IL_011e:  stfld      ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.<G>d__0.<>u__1""
+          IL_0123:  ldarg.0
+          IL_0124:  ldflda     ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<G>d__0.<>t__builder""
+          IL_0129:  ldloca.s   V_2
+          IL_012b:  ldarg.0
+          IL_012c:  call       ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter, Test.<G>d__0>(ref System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter, ref Test.<G>d__0)""
+          IL_0131:  leave      IL_03b0
+          IL_0136:  ldarg.0
+          IL_0137:  ldfld      ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.<G>d__0.<>u__1""
+          IL_013c:  stloc.2
+          IL_013d:  ldarg.0
+          IL_013e:  ldflda     ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.<G>d__0.<>u__1""
+          IL_0143:  initobj    ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter""
+          IL_0149:  ldarg.0
+          IL_014a:  ldc.i4.m1
+          IL_014b:  dup
+          IL_014c:  stloc.0
+          IL_014d:  stfld      ""int Test.<G>d__0.<>1__state""
+          IL_0152:  ldloca.s   V_2
+          IL_0154:  call       ""void System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.GetResult()""
+          IL_0159:  ldloca.s   V_2
+          IL_015b:  initobj    ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter""
+          IL_0161:  ldarg.0
+          IL_0162:  ldarg.0
+          IL_0163:  ldfld      ""int Test.<G>d__0.<x>5__1""
+          IL_0168:  ldc.i4.1
+          IL_0169:  add
+          IL_016a:  stfld      ""int Test.<G>d__0.<x>5__1""
+          IL_016f:  call       ""System.Runtime.CompilerServices.YieldAwaitable System.Threading.Tasks.Task.Yield()""
+          IL_0174:  stloc.3
+          IL_0175:  ldloca.s   V_3
+          IL_0177:  call       ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter System.Runtime.CompilerServices.YieldAwaitable.GetAwaiter()""
+          IL_017c:  stloc.2
+          IL_017d:  ldloca.s   V_2
+          IL_017f:  call       ""bool System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.IsCompleted.get""
+          IL_0184:  brtrue.s   IL_01c5
+          IL_0186:  ldarg.0
+          IL_0187:  ldc.i4.2
+          IL_0188:  dup
+          IL_0189:  stloc.0
+          IL_018a:  stfld      ""int Test.<G>d__0.<>1__state""
+          IL_018f:  ldarg.0
+          IL_0190:  ldloc.2
+          IL_0191:  stfld      ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.<G>d__0.<>u__1""
+          IL_0196:  ldarg.0
+          IL_0197:  ldflda     ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<G>d__0.<>t__builder""
+          IL_019c:  ldloca.s   V_2
+          IL_019e:  ldarg.0
+          IL_019f:  call       ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter, Test.<G>d__0>(ref System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter, ref Test.<G>d__0)""
+          IL_01a4:  leave      IL_03b0
+          IL_01a9:  ldarg.0
+          IL_01aa:  ldfld      ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.<G>d__0.<>u__1""
+          IL_01af:  stloc.2
+          IL_01b0:  ldarg.0
+          IL_01b1:  ldflda     ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.<G>d__0.<>u__1""
+          IL_01b6:  initobj    ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter""
+          IL_01bc:  ldarg.0
+          IL_01bd:  ldc.i4.m1
+          IL_01be:  dup
+          IL_01bf:  stloc.0
+          IL_01c0:  stfld      ""int Test.<G>d__0.<>1__state""
+          IL_01c5:  ldloca.s   V_2
+          IL_01c7:  call       ""void System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.GetResult()""
+          IL_01cc:  ldloca.s   V_2
+          IL_01ce:  initobj    ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter""
+          IL_01d4:  ldarg.0
+          IL_01d5:  ldarg.0
+          IL_01d6:  ldfld      ""int Test.<G>d__0.<x>5__1""
+          IL_01db:  ldc.i4.1
+          IL_01dc:  add
+          IL_01dd:  stfld      ""int Test.<G>d__0.<x>5__1""
+          IL_01e2:  call       ""System.Runtime.CompilerServices.YieldAwaitable System.Threading.Tasks.Task.Yield()""
+          IL_01e7:  stloc.3
+          IL_01e8:  ldloca.s   V_3
+          IL_01ea:  call       ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter System.Runtime.CompilerServices.YieldAwaitable.GetAwaiter()""
+          IL_01ef:  stloc.2
+          IL_01f0:  ldloca.s   V_2
+          IL_01f2:  call       ""bool System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.IsCompleted.get""
+          IL_01f7:  brtrue.s   IL_0238
+          IL_01f9:  ldarg.0
+          IL_01fa:  ldc.i4.3
+          IL_01fb:  dup
+          IL_01fc:  stloc.0
+          IL_01fd:  stfld      ""int Test.<G>d__0.<>1__state""
+          IL_0202:  ldarg.0
+          IL_0203:  ldloc.2
+          IL_0204:  stfld      ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.<G>d__0.<>u__1""
+          IL_0209:  ldarg.0
+          IL_020a:  ldflda     ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<G>d__0.<>t__builder""
+          IL_020f:  ldloca.s   V_2
+          IL_0211:  ldarg.0
+          IL_0212:  call       ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter, Test.<G>d__0>(ref System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter, ref Test.<G>d__0)""
+          IL_0217:  leave      IL_03b0
+          IL_021c:  ldarg.0
+          IL_021d:  ldfld      ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.<G>d__0.<>u__1""
+          IL_0222:  stloc.2
+          IL_0223:  ldarg.0
+          IL_0224:  ldflda     ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.<G>d__0.<>u__1""
+          IL_0229:  initobj    ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter""
+          IL_022f:  ldarg.0
+          IL_0230:  ldc.i4.m1
+          IL_0231:  dup
+          IL_0232:  stloc.0
+          IL_0233:  stfld      ""int Test.<G>d__0.<>1__state""
+          IL_0238:  ldloca.s   V_2
+          IL_023a:  call       ""void System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.GetResult()""
+          IL_023f:  ldloca.s   V_2
+          IL_0241:  initobj    ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter""
+          IL_0247:  ldarg.0
+          IL_0248:  ldarg.0
+          IL_0249:  ldfld      ""int Test.<G>d__0.<x>5__1""
+          IL_024e:  ldc.i4.1
+          IL_024f:  add
+          IL_0250:  stfld      ""int Test.<G>d__0.<x>5__1""
+          IL_0255:  call       ""System.Runtime.CompilerServices.YieldAwaitable System.Threading.Tasks.Task.Yield()""
+          IL_025a:  stloc.3
+          IL_025b:  ldloca.s   V_3
+          IL_025d:  call       ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter System.Runtime.CompilerServices.YieldAwaitable.GetAwaiter()""
+          IL_0262:  stloc.2
+          IL_0263:  ldloca.s   V_2
+          IL_0265:  call       ""bool System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.IsCompleted.get""
+          IL_026a:  brtrue.s   IL_02ab
+          IL_026c:  ldarg.0
+          IL_026d:  ldc.i4.4
+          IL_026e:  dup
+          IL_026f:  stloc.0
+          IL_0270:  stfld      ""int Test.<G>d__0.<>1__state""
+          IL_0275:  ldarg.0
+          IL_0276:  ldloc.2
+          IL_0277:  stfld      ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.<G>d__0.<>u__1""
+          IL_027c:  ldarg.0
+          IL_027d:  ldflda     ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<G>d__0.<>t__builder""
+          IL_0282:  ldloca.s   V_2
+          IL_0284:  ldarg.0
+          IL_0285:  call       ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter, Test.<G>d__0>(ref System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter, ref Test.<G>d__0)""
+          IL_028a:  leave      IL_03b0
+          IL_028f:  ldarg.0
+          IL_0290:  ldfld      ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.<G>d__0.<>u__1""
+          IL_0295:  stloc.2
+          IL_0296:  ldarg.0
+          IL_0297:  ldflda     ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.<G>d__0.<>u__1""
+          IL_029c:  initobj    ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter""
+          IL_02a2:  ldarg.0
+          IL_02a3:  ldc.i4.m1
+          IL_02a4:  dup
+          IL_02a5:  stloc.0
+          IL_02a6:  stfld      ""int Test.<G>d__0.<>1__state""
+          IL_02ab:  ldloca.s   V_2
+          IL_02ad:  call       ""void System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.GetResult()""
+          IL_02b2:  ldloca.s   V_2
+          IL_02b4:  initobj    ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter""
+          IL_02ba:  ldarg.0
+          IL_02bb:  ldarg.0
+          IL_02bc:  ldfld      ""int Test.<G>d__0.<x>5__1""
+          IL_02c1:  ldc.i4.1
+          IL_02c2:  add
+          IL_02c3:  stfld      ""int Test.<G>d__0.<x>5__1""
+          IL_02c8:  call       ""System.Runtime.CompilerServices.YieldAwaitable System.Threading.Tasks.Task.Yield()""
+          IL_02cd:  stloc.3
+          IL_02ce:  ldloca.s   V_3
+          IL_02d0:  call       ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter System.Runtime.CompilerServices.YieldAwaitable.GetAwaiter()""
+          IL_02d5:  stloc.2
+          IL_02d6:  ldloca.s   V_2
+          IL_02d8:  call       ""bool System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.IsCompleted.get""
+          IL_02dd:  brtrue.s   IL_031e
+          IL_02df:  ldarg.0
+          IL_02e0:  ldc.i4.5
+          IL_02e1:  dup
+          IL_02e2:  stloc.0
+          IL_02e3:  stfld      ""int Test.<G>d__0.<>1__state""
+          IL_02e8:  ldarg.0
+          IL_02e9:  ldloc.2
+          IL_02ea:  stfld      ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.<G>d__0.<>u__1""
+          IL_02ef:  ldarg.0
+          IL_02f0:  ldflda     ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<G>d__0.<>t__builder""
+          IL_02f5:  ldloca.s   V_2
+          IL_02f7:  ldarg.0
+          IL_02f8:  call       ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.AwaitUnsafeOnCompleted<System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter, Test.<G>d__0>(ref System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter, ref Test.<G>d__0)""
+          IL_02fd:  leave      IL_03b0
+          IL_0302:  ldarg.0
+          IL_0303:  ldfld      ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.<G>d__0.<>u__1""
+          IL_0308:  stloc.2
+          IL_0309:  ldarg.0
+          IL_030a:  ldflda     ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter Test.<G>d__0.<>u__1""
+          IL_030f:  initobj    ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter""
+          IL_0315:  ldarg.0
+          IL_0316:  ldc.i4.m1
+          IL_0317:  dup
+          IL_0318:  stloc.0
+          IL_0319:  stfld      ""int Test.<G>d__0.<>1__state""
+          IL_031e:  ldloca.s   V_2
+          IL_0320:  call       ""void System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter.GetResult()""
+          IL_0325:  ldloca.s   V_2
+          IL_0327:  initobj    ""System.Runtime.CompilerServices.YieldAwaitable.YieldAwaiter""
+          IL_032d:  ldarg.0
+          IL_032e:  ldarg.0
+          IL_032f:  ldfld      ""int Test.<G>d__0.<x>5__1""
+          IL_0334:  ldc.i4.1
+          IL_0335:  add
+          IL_0336:  stfld      ""int Test.<G>d__0.<x>5__1""
+          IL_033b:  leave.s    IL_0350
+        }
+        finally
+        {
+          IL_033d:  ldloc.0
+          IL_033e:  ldc.i4.0
+          IL_033f:  bge.s      IL_034f
+          IL_0341:  ldarg.0
+          IL_0342:  ldarg.0
+          IL_0343:  ldfld      ""int Test.<G>d__0.<x>5__1""
+          IL_0348:  ldc.i4.1
+          IL_0349:  add
+          IL_034a:  stfld      ""int Test.<G>d__0.<x>5__1""
+          IL_034f:  endfinally
+        }
+        IL_0350:  leave.s    IL_0365
+      }
+      finally
+      {
+        IL_0352:  ldloc.0
+        IL_0353:  ldc.i4.0
+        IL_0354:  bge.s      IL_0364
+        IL_0356:  ldarg.0
+        IL_0357:  ldarg.0
+        IL_0358:  ldfld      ""int Test.<G>d__0.<x>5__1""
+        IL_035d:  ldc.i4.1
+        IL_035e:  add
+        IL_035f:  stfld      ""int Test.<G>d__0.<x>5__1""
+        IL_0364:  endfinally
+      }
+      IL_0365:  leave.s    IL_037a
+    }
+    finally
+    {
+      IL_0367:  ldloc.0
+      IL_0368:  ldc.i4.0
+      IL_0369:  bge.s      IL_0379
+      IL_036b:  ldarg.0
+      IL_036c:  ldarg.0
+      IL_036d:  ldfld      ""int Test.<G>d__0.<x>5__1""
+      IL_0372:  ldc.i4.1
+      IL_0373:  add
+      IL_0374:  stfld      ""int Test.<G>d__0.<x>5__1""
+      IL_0379:  endfinally
+    }
+    IL_037a:  ldarg.0
+    IL_037b:  ldfld      ""int Test.<G>d__0.<x>5__1""
+    IL_0380:  stloc.1
+    IL_0381:  leave.s    IL_039c
+  }
+  catch System.Exception
+  {
+    IL_0383:  stloc.s    V_4
+    IL_0385:  ldarg.0
+    IL_0386:  ldc.i4.s   -2
+    IL_0388:  stfld      ""int Test.<G>d__0.<>1__state""
+    IL_038d:  ldarg.0
+    IL_038e:  ldflda     ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<G>d__0.<>t__builder""
+    IL_0393:  ldloc.s    V_4
+    IL_0395:  call       ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetException(System.Exception)""
+    IL_039a:  leave.s    IL_03b0
+  }
+  IL_039c:  ldarg.0
+  IL_039d:  ldc.i4.s   -2
+  IL_039f:  stfld      ""int Test.<G>d__0.<>1__state""
+  IL_03a4:  ldarg.0
+  IL_03a5:  ldflda     ""System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int> Test.<G>d__0.<>t__builder""
+  IL_03aa:  ldloc.1
+  IL_03ab:  call       ""void System.Runtime.CompilerServices.AsyncTaskMethodBuilder<int>.SetResult(int)""
+  IL_03b0:  ret
+}
+
+");
+        }
+

         [Fact, WorkItem(855080, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/855080")]
         public void GenericCatchVariableInAsyncMethod()


Update BoxDecorator.cs

Update BoxDecorator.cs

--- src/Core2D/ViewModels/Editor/Tools/Decorators/BoxDecorator.cs
+++ src/Core2D/ViewModels/Editor/Tools/Decorators/BoxDecorator.cs
@@ -708,8 +708,8 @@

             var scaleX = 1.0;
             var scaleY = (_groupBox.Bounds.Height - dy) / _groupBox.Bounds.Height;
-            var centerX = _anchorTop.X;
-            var centerY = _anchorTop.Y;
+            var centerX = _groupBox.Bounds.CenterX;
+            var centerY = _groupBox.Bounds.Bottom;
             var matrix = Matrix2.ScaleAt(scaleX, scaleY, centerX, centerY);

             for (int i = 0; i < _pointsTop.Count; i++)


Update BoxDecorator.cs

Update BoxDecorator.cs

--- src/Core2D/ViewModels/Editor/Tools/Decorators/BoxDecorator.cs
+++ src/Core2D/ViewModels/Editor/Tools/Decorators/BoxDecorator.cs
@@ -664,13 +664,18 @@

             _pointsTop.Sort(PointShapeUtil.CompareY);

+            var scaleX = 1.0;
+            var scaleY = (_groupBox.Bounds.Height - dy) / _groupBox.Bounds.Height;
+            var centerX = _anchorTop.X;
+            var centerY = _anchorTop.Y;
+            var matrix = Matrix2.ScaleAt(scaleX, scaleY, centerX, centerY);
+
             for (int i = 0; i < _pointsTop.Count; i++)
             {
                 var point = _pointsTop[i];
-                if (point != _anchorTop && !(point.Y == _anchorTop.Y && _pointsTop.Count > 2))
-                {
-                    point.Move(null, 0, dy);
-                }
+                var transformed = Matrix2.TransformPoint(matrix, new Point2(point.X, point.Y));
+                point.X = transformed.X;
+                point.Y = transformed.Y;
             }
         }

@@ -689,13 +694,18 @@

             _pointsBottom.Sort(PointShapeUtil.CompareY);

+            var scaleX = 1.0;
+            var scaleY = (_groupBox.Bounds.Height + dy) / _groupBox.Bounds.Height;
+            var centerX = _anchorBottom.X;
+            var centerY = _anchorBottom.Y;
+            var matrix = Matrix2.ScaleAt(scaleX, scaleY, centerX, centerY);
+
             for (int i = 0; i < _pointsBottom.Count; i++)
             {
                 var point = _pointsBottom[i];
-                if (point != _anchorBottom && !(point.Y == _anchorBottom.Y && _pointsBottom.Count > 2))
-                {
-                    point.Move(null, 0, dy);
-                }
+                var transformed = Matrix2.TransformPoint(matrix, new Point2(point.X, point.Y));
+                point.X = transformed.X;
+                point.Y = transformed.Y;
             }
         }

@@ -714,13 +724,18 @@

             _pointsLeft.Sort(PointShapeUtil.CompareX);

+            var scaleX = (_groupBox.Bounds.Width - dx) / _groupBox.Bounds.Width;
+            var scaleY = 1.0;
+            var centerX = _anchorLeft.X;
+            var centerY = _anchorLeft.Y;
+            var matrix = Matrix2.ScaleAt(scaleX, scaleY, centerX, centerY);
+
             for (int i = 0; i < _pointsLeft.Count; i++)
             {
                 var point = _pointsLeft[i];
-                if (point != _anchorLeft && !(point.X == _anchorLeft.X && _pointsLeft.Count > 2))
-                {
-                    point.Move(null, dx, 0);
-                }
+                var transformed = Matrix2.TransformPoint(matrix, new Point2(point.X, point.Y));
+                point.X = transformed.X;
+                point.Y = transformed.Y;
             }
         }

@@ -739,13 +754,18 @@

             _pointsRight.Sort(PointShapeUtil.CompareX);

+            var scaleX = (_groupBox.Bounds.Width + dx) / _groupBox.Bounds.Width;
+            var scaleY = 1.0;
+            var centerX = _anchorRight.X;
+            var centerY = _anchorRight.Y;
+            var matrix = Matrix2.ScaleAt(scaleX, scaleY, centerX, centerY);
+
             for (int i = 0; i < _pointsRight.Count; i++)
             {
                 var point = _pointsRight[i];
-                if (point != _anchorRight && !(point.X == _anchorRight.X && _pointsRight.Count > 2))
-                {
-                    point.Move(null, dx, 0);
-                }
+                var transformed = Matrix2.TransformPoint(matrix, new Point2(point.X, point.Y));
+                point.X = transformed.X;
+                point.Y = transformed.Y;
             }
         }
     }


Align the unit test to show the implications of setting PreventIncrementOfMergedBranchVersion

--- src/GitVersionCore.Tests/IntegrationTests/DevelopScenarios.cs
+++ src/GitVersionCore.Tests/IntegrationTests/DevelopScenarios.cs
@@ -286,15 +286,14 @@
         }

         [Test]
-        public void WhenPreventIncrementOfMergedBranchVersionIsSetToTrueCommitsSinceVersionSourceShouldNotGoDownWhenMergingReleaseToDevelop()
-        {
-            // Simulate the configuration used in production.
+        public void WhenPreventIncrementOfMergedBranchVersionIsSetToFalseCommitsSinceVersionSourceShouldNotGoDownWhenMergingReleaseToDevelop()
+        {
             var config = new Config
             {
                 VersioningMode = VersioningMode.ContinuousDeployment,
                 Branches = new Dictionary<string, BranchConfig>
                 {
-                    { "develop", new BranchConfig { PreventIncrementOfMergedBranchVersion = true } },
+                    { "develop", new BranchConfig { PreventIncrementOfMergedBranchVersion = false } },
                 }
             };

@@ -324,12 +323,18 @@

             var versionSourceBeforeReleaseBranchIsRemoved = fixture.GetVersion(config).Sha;

-            // Removing the release branch and calculating the version with the config exhibits the problem.
             fixture.Repository.Branches.Remove(ReleaseBranch);
             var versionSourceAfterReleaseBranchIsRemoved = fixture.GetVersion(config).Sha;
             Assert.AreEqual(versionSourceBeforeReleaseBranchIsRemoved, versionSourceAfterReleaseBranchIsRemoved);
             fixture.AssertFullSemver("1.2.0-alpha.6");
             fixture.AssertFullSemver("1.2.0-alpha.6", config);
+
+
+            config.Branches = new Dictionary<string, BranchConfig>
+            {
+                { "develop", new BranchConfig { PreventIncrementOfMergedBranchVersion = true } },
+            };
+            fixture.AssertFullSemver("1.2.0-alpha.3", config);
         }
     }
 }


If you use 'UseNLog' MT will now use LogManager - rather than an empty LogFactory

--- src/Loggers/MassTransit.NLogIntegration/Logging/NLogLogger.cs
+++ src/Loggers/MassTransit.NLogIntegration/Logging/NLogLogger.cs
@@ -12,6 +12,7 @@
 // specific language governing permissions and limitations under the License.
 namespace MassTransit.NLogIntegration.Logging
 {
+    using System;
     using MassTransit.Logging;
     using NLog;
     using Util;
@@ -20,22 +21,21 @@
     public class NLogLogger :
         ILogger
     {
-        readonly LogFactory _factory;
-
+        readonly Func<string, NLog.Logger> _logFactory;
+
         public NLogLogger([NotNull] LogFactory factory)
         {
-            _factory = factory;
+            _logFactory = factory.GetLogger;
         }

         public NLogLogger()
-            : this(new LogFactory())
         {
-
+            _logFactory = NLog.LogManager.GetLogger;
         }

         public ILog Get(string name)
         {
-            return new NLogLog(_factory.GetLogger(name), name);
+            return new NLogLog(_logFactory(name), name);
         }

         public static void Use()


Lucene.Net.Core.Codecs.Lucene40.Lucene40PostingsReader refactor: renamed protected fields camelCase prefixed with m_

--- src/Lucene.Net.Core/Codecs/Lucene40/Lucene40PostingsReader.cs
+++ src/Lucene.Net.Core/Codecs/Lucene40/Lucene40PostingsReader.cs
@@ -233,7 +233,7 @@
                 if (docsEnum.StartFreqIn == FreqIn)
                 {
                     // we only reuse if the the actual the incoming enum has the same liveDocs as the given liveDocs
-                    return liveDocs == docsEnum.LiveDocs;
+                    return liveDocs == docsEnum.m_liveDocs;
                 }
             }
             return false;
@@ -307,90 +307,90 @@
         {
             private readonly Lucene40PostingsReader OuterInstance;

-            protected internal readonly int[] Docs = new int[BUFFERSIZE];
-            protected internal readonly int[] Freqs = new int[BUFFERSIZE];
+            protected readonly int[] m_docs = new int[BUFFERSIZE];
+            protected readonly int[] m_freqs = new int[BUFFERSIZE];

             internal readonly IndexInput FreqIn; // reuse
             internal readonly IndexInput StartFreqIn; // reuse
             internal Lucene40SkipListReader Skipper; // reuse - lazy loaded

-            protected internal bool IndexOmitsTF; // does current field omit term freq?
-            protected internal bool StorePayloads; // does current field store payloads?
-            protected internal bool StoreOffsets; // does current field store offsets?
-
-            protected internal int Limit; // number of docs in this posting
-            protected internal int Ord; // how many docs we've read
-            protected internal int Doc; // doc we last read
-            protected internal int Accum; // accumulator for doc deltas
-            protected internal int Freq_Renamed; // freq we last read
-            protected internal int MaxBufferedDocId;
-
-            protected internal int Start;
-            protected internal int Count;
-
-            protected internal long FreqOffset;
-            protected internal long SkipOffset;
-
-            protected internal bool Skipped;
-            protected internal readonly IBits LiveDocs;
+            protected bool m_indexOmitsTF; // does current field omit term freq?
+            protected bool m_storePayloads; // does current field store payloads?
+            protected bool m_storeOffsets; // does current field store offsets?
+
+            protected int m_limit; // number of docs in this posting
+            protected int m_ord; // how many docs we've read
+            protected int m_doc; // doc we last read
+            protected int m_accum; // accumulator for doc deltas
+            protected int m_freq; // freq we last read
+            protected int m_maxBufferedDocId;
+
+            protected int m_start;
+            protected int m_count;
+
+            protected long m_freqOffset;
+            protected long m_skipOffset;
+
+            protected bool m_skipped;
+            protected internal readonly IBits m_liveDocs;

             internal SegmentDocsEnumBase(Lucene40PostingsReader outerInstance, IndexInput startFreqIn, IBits liveDocs)
             {
                 this.OuterInstance = outerInstance;
                 this.StartFreqIn = startFreqIn;
                 this.FreqIn = (IndexInput)startFreqIn.Clone();
-                this.LiveDocs = liveDocs;
+                this.m_liveDocs = liveDocs;
             }

             internal virtual DocsEnum Reset(FieldInfo fieldInfo, StandardTermState termState)
             {
-                IndexOmitsTF = fieldInfo.IndexOptions == IndexOptions.DOCS_ONLY;
-                StorePayloads = fieldInfo.HasPayloads;
-                StoreOffsets = fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
-                FreqOffset = termState.FreqOffset;
-                SkipOffset = termState.SkipOffset;
+                m_indexOmitsTF = fieldInfo.IndexOptions == IndexOptions.DOCS_ONLY;
+                m_storePayloads = fieldInfo.HasPayloads;
+                m_storeOffsets = fieldInfo.IndexOptions >= IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS;
+                m_freqOffset = termState.FreqOffset;
+                m_skipOffset = termState.SkipOffset;

                 // TODO: for full enum case (eg segment merging) this
                 // seek is unnecessary; maybe we can avoid in such
                 // cases
                 FreqIn.Seek(termState.FreqOffset);
-                Limit = termState.DocFreq;
-                Debug.Assert(Limit > 0);
-                Ord = 0;
-                Doc = -1;
-                Accum = 0;
+                m_limit = termState.DocFreq;
+                Debug.Assert(m_limit > 0);
+                m_ord = 0;
+                m_doc = -1;
+                m_accum = 0;
                 // if (DEBUG) System.out.println("  sde limit=" + limit + " freqFP=" + freqOffset);
-                Skipped = false;
-
-                Start = -1;
-                Count = 0;
-                Freq_Renamed = 1;
-                if (IndexOmitsTF)
-                {
-                    CollectionsHelper.Fill(Freqs, 1);
-                }
-                MaxBufferedDocId = -1;
+                m_skipped = false;
+
+                m_start = -1;
+                m_count = 0;
+                m_freq = 1;
+                if (m_indexOmitsTF)
+                {
+                    CollectionsHelper.Fill(m_freqs, 1);
+                }
+                m_maxBufferedDocId = -1;
                 return this;
             }

             public override sealed int Freq
             {
-                get { return Freq_Renamed; }
+                get { return m_freq; }
             }

             public override sealed int DocID
             {
-                get { return Doc; }
+                get { return m_doc; }
             }

             public override sealed int Advance(int target)
             {
                 // last doc in our buffer is >= target, binary search + next()
-                if (++Start < Count && MaxBufferedDocId >= target)
-                {
-                    if ((Count - Start) > 32) // 32 seemed to be a sweetspot here so use binsearch if the pending results are a lot
-                    {
-                        Start = BinarySearch(Count - 1, Start, target, Docs);
+                if (++m_start < m_count && m_maxBufferedDocId >= target)
+                {
+                    if ((m_count - m_start) > 32) // 32 seemed to be a sweetspot here so use binsearch if the pending results are a lot
+                    {
+                        m_start = BinarySearch(m_count - 1, m_start, target, m_docs);
                         return NextDoc();
                     }
                     else
@@ -399,9 +399,9 @@
                     }
                 }

-                Start = Count; // buffer is consumed
-
-                return Doc = SkipTo(target);
+                m_start = m_count; // buffer is consumed
+
+                return m_doc = SkipTo(target);
             }

             private int BinarySearch(int hi, int low, int target, int[] docs)
@@ -446,23 +446,23 @@
             protected internal int Refill()
             {
                 int doc = NextUnreadDoc();
-                Count = 0;
-                Start = -1;
+                m_count = 0;
+                m_start = -1;
                 if (doc == NO_MORE_DOCS)
                 {
                     return NO_MORE_DOCS;
                 }
-                int numDocs = Math.Min(Docs.Length, Limit - Ord);
-                Ord += numDocs;
-                if (IndexOmitsTF)
-                {
-                    Count = FillDocs(numDocs);
+                int numDocs = Math.Min(m_docs.Length, m_limit - m_ord);
+                m_ord += numDocs;
+                if (m_indexOmitsTF)
+                {
+                    m_count = FillDocs(numDocs);
                 }
                 else
                 {
-                    Count = FillDocsAndFreqs(numDocs);
-                }
-                MaxBufferedDocId = Count > 0 ? Docs[Count - 1] : NO_MORE_DOCS;
+                    m_count = FillDocsAndFreqs(numDocs);
+                }
+                m_maxBufferedDocId = m_count > 0 ? m_docs[m_count - 1] : NO_MORE_DOCS;
                 return doc;
             }

@@ -471,23 +471,23 @@
             private int FillDocs(int size)
             {
                 IndexInput freqIn = this.FreqIn;
-                int[] docs = this.Docs;
-                int docAc = Accum;
+                int[] docs = this.m_docs;
+                int docAc = m_accum;
                 for (int i = 0; i < size; i++)
                 {
                     docAc += freqIn.ReadVInt();
                     docs[i] = docAc;
                 }
-                Accum = docAc;
+                m_accum = docAc;
                 return size;
             }

             private int FillDocsAndFreqs(int size)
             {
                 IndexInput freqIn = this.FreqIn;
-                int[] docs = this.Docs;
-                int[] freqs = this.Freqs;
-                int docAc = Accum;
+                int[] docs = this.m_docs;
+                int[] freqs = this.m_freqs;
+                int docAc = m_accum;
                 for (int i = 0; i < size; i++)
                 {
                     int code = freqIn.ReadVInt();
@@ -495,13 +495,13 @@
                     freqs[i] = ReadFreq(freqIn, code);
                     docs[i] = docAc;
                 }
-                Accum = docAc;
+                m_accum = docAc;
                 return size;
             }

             private int SkipTo(int target)
             {
-                if ((target - OuterInstance.SkipInterval) >= Accum && Limit >= OuterInstance.SkipMinimum)
+                if ((target - OuterInstance.SkipInterval) >= m_accum && m_limit >= OuterInstance.SkipMinimum)
                 {
                     // There are enough docs in the posting to have
                     // skip data, and it isn't too close.
@@ -512,25 +512,25 @@
                         Skipper = new Lucene40SkipListReader((IndexInput)FreqIn.Clone(), OuterInstance.MaxSkipLevels, OuterInstance.SkipInterval);
                     }

-                    if (!Skipped)
+                    if (!m_skipped)
                     {
                         // this is the first time this posting has
                         // skipped since reset() was called, so now we
                         // load the skip data for this posting

-                        Skipper.Init(FreqOffset + SkipOffset, FreqOffset, 0, Limit, StorePayloads, StoreOffsets);
-
-                        Skipped = true;
+                        Skipper.Init(m_freqOffset + m_skipOffset, m_freqOffset, 0, m_limit, m_storePayloads, m_storeOffsets);
+
+                        m_skipped = true;
                     }

                     int newOrd = Skipper.SkipTo(target);

-                    if (newOrd > Ord)
+                    if (newOrd > m_ord)
                     {
                         // Skipper moved

-                        Ord = newOrd;
-                        Accum = Skipper.Doc;
+                        m_ord = newOrd;
+                        m_accum = Skipper.Doc;
                         FreqIn.Seek(Skipper.FreqPointer);
                     }
                 }
@@ -539,7 +539,7 @@

             public override long Cost()
             {
-                return Limit;
+                return m_limit;
             }
         }

@@ -551,44 +551,44 @@
                 : base(outerInstance, startFreqIn, null)
             {
                 this.OuterInstance = outerInstance;
-                Debug.Assert(LiveDocs == null);
+                Debug.Assert(m_liveDocs == null);
             }

             public override int NextDoc()
             {
-                if (++Start < Count)
-                {
-                    Freq_Renamed = Freqs[Start];
-                    return Doc = Docs[Start];
-                }
-                return Doc = Refill();
+                if (++m_start < m_count)
+                {
+                    m_freq = m_freqs[m_start];
+                    return m_doc = m_docs[m_start];
+                }
+                return m_doc = Refill();
             }

             protected internal override int LinearScan(int scanTo)
             {
-                int[] docs = this.Docs;
-                int upTo = Count;
-                for (int i = Start; i < upTo; i++)
+                int[] docs = this.m_docs;
+                int upTo = m_count;
+                for (int i = m_start; i < upTo; i++)
                 {
                     int d = docs[i];
                     if (scanTo <= d)
                     {
-                        Start = i;
-                        Freq_Renamed = Freqs[i];
-                        return Doc = docs[i];
-                    }
-                }
-                return Doc = Refill();
+                        m_start = i;
+                        m_freq = m_freqs[i];
+                        return m_doc = docs[i];
+                    }
+                }
+                return m_doc = Refill();
             }

             protected internal override int ScanTo(int target)
             {
-                int docAcc = Accum;
+                int docAcc = m_accum;
                 int frq = 1;
                 IndexInput freqIn = this.FreqIn;
-                bool omitTF = IndexOmitsTF;
-                int loopLimit = Limit;
-                for (int i = Ord; i < loopLimit; i++)
+                bool omitTF = m_indexOmitsTF;
+                int loopLimit = m_limit;
+                for (int i = m_ord; i < loopLimit; i++)
                 {
                     int code = freqIn.ReadVInt();
                     if (omitTF)
@@ -602,32 +602,32 @@
                     }
                     if (docAcc >= target)
                     {
-                        Freq_Renamed = frq;
-                        Ord = i + 1;
-                        return Accum = docAcc;
-                    }
-                }
-                Ord = Limit;
-                Freq_Renamed = frq;
-                Accum = docAcc;
+                        m_freq = frq;
+                        m_ord = i + 1;
+                        return m_accum = docAcc;
+                    }
+                }
+                m_ord = m_limit;
+                m_freq = frq;
+                m_accum = docAcc;
                 return NO_MORE_DOCS;
             }

             protected internal override int NextUnreadDoc()
             {
-                if (Ord++ < Limit)
+                if (m_ord++ < m_limit)
                 {
                     int code = FreqIn.ReadVInt();
-                    if (IndexOmitsTF)
-                    {
-                        Accum += code;
+                    if (m_indexOmitsTF)
+                    {
+                        m_accum += code;
                     }
                     else
                     {
-                        Accum += (int)((uint)code >> 1); // shift off low bit
-                        Freq_Renamed = ReadFreq(FreqIn, code);
-                    }
-                    return Accum;
+                        m_accum += (int)((uint)code >> 1); // shift off low bit
+                        m_freq = ReadFreq(FreqIn, code);
+                    }
+                    return m_accum;
                 }
                 else
                 {
@@ -649,48 +649,48 @@

             public override int NextDoc()
             {
-                IBits liveDocs = this.LiveDocs;
-                for (int i = Start + 1; i < Count; i++)
-                {
-                    int d = Docs[i];
+                IBits liveDocs = this.m_liveDocs;
+                for (int i = m_start + 1; i < m_count; i++)
+                {
+                    int d = m_docs[i];
                     if (liveDocs.Get(d))
                     {
-                        Start = i;
-                        Freq_Renamed = Freqs[i];
-                        return Doc = d;
-                    }
-                }
-                Start = Count;
-                return Doc = Refill();
+                        m_start = i;
+                        m_freq = m_freqs[i];
+                        return m_doc = d;
+                    }
+                }
+                m_start = m_count;
+                return m_doc = Refill();
             }

             protected internal override int LinearScan(int scanTo)
             {
-                int[] docs = this.Docs;
-                int upTo = Count;
-                IBits liveDocs = this.LiveDocs;
-                for (int i = Start; i < upTo; i++)
+                int[] docs = this.m_docs;
+                int upTo = m_count;
+                IBits liveDocs = this.m_liveDocs;
+                for (int i = m_start; i < upTo; i++)
                 {
                     int d = docs[i];
                     if (scanTo <= d && liveDocs.Get(d))
                     {
-                        Start = i;
-                        Freq_Renamed = Freqs[i];
-                        return Doc = docs[i];
-                    }
-                }
-                return Doc = Refill();
+                        m_start = i;
+                        m_freq = m_freqs[i];
+                        return m_doc = docs[i];
+                    }
+                }
+                return m_doc = Refill();
             }

             protected internal override int ScanTo(int target)
             {
-                int docAcc = Accum;
+                int docAcc = m_accum;
                 int frq = 1;
                 IndexInput freqIn = this.FreqIn;
-                bool omitTF = IndexOmitsTF;
-                int loopLimit = Limit;
-                IBits liveDocs = this.LiveDocs;
-                for (int i = Ord; i < loopLimit; i++)
+                bool omitTF = m_indexOmitsTF;
+                int loopLimit = m_limit;
+                IBits liveDocs = this.m_liveDocs;
+                for (int i = m_ord; i < loopLimit; i++)
                 {
                     int code = freqIn.ReadVInt();
                     if (omitTF)
@@ -704,26 +704,26 @@
                     }
                     if (docAcc >= target && liveDocs.Get(docAcc))
                     {
-                        Freq_Renamed = frq;
-                        Ord = i + 1;
-                        return Accum = docAcc;
-                    }
-                }
-                Ord = Limit;
-                Freq_Renamed = frq;
-                Accum = docAcc;
+                        m_freq = frq;
+                        m_ord = i + 1;
+                        return m_accum = docAcc;
+                    }
+                }
+                m_ord = m_limit;
+                m_freq = frq;
+                m_accum = docAcc;
                 return NO_MORE_DOCS;
             }

             protected internal override int NextUnreadDoc()
             {
-                int docAcc = Accum;
+                int docAcc = m_accum;
                 int frq = 1;
                 IndexInput freqIn = this.FreqIn;
-                bool omitTF = IndexOmitsTF;
-                int loopLimit = Limit;
-                IBits liveDocs = this.LiveDocs;
-                for (int i = Ord; i < loopLimit; i++)
+                bool omitTF = m_indexOmitsTF;
+                int loopLimit = m_limit;
+                IBits liveDocs = this.m_liveDocs;
+                for (int i = m_ord; i < loopLimit; i++)
                 {
                     int code = freqIn.ReadVInt();
                     if (omitTF)
@@ -737,14 +737,14 @@
                     }
                     if (liveDocs.Get(docAcc))
                     {
-                        Freq_Renamed = frq;
-                        Ord = i + 1;
-                        return Accum = docAcc;
-                    }
-                }
-                Ord = Limit;
-                Freq_Renamed = frq;
-                Accum = docAcc;
+                        m_freq = frq;
+                        m_ord = i + 1;
+                        return m_accum = docAcc;
+                    }
+                }
+                m_ord = m_limit;
+                m_freq = frq;
+                m_accum = docAcc;
                 return NO_MORE_DOCS;
             }
         }


Fix encryption for new header

Fix encryption for new header

--- Desktop/Tempest/Providers/Network/MessageSerializer.cs
+++ Desktop/Tempest/Providers/Network/MessageSerializer.cs
@@ -598,7 +598,7 @@
 				encryptor = am.CreateEncryptor();
 			}

-			const int workingHeaderLength = 7; // right after length
+			const int workingHeaderLength = LengthOffset + sizeof(int); // right after length

 			int r = ((writer.Length - workingHeaderLength) % encryptor.OutputBlockSize);
 			if (r != 0)


Use header names from HttpAbstractions

Use header names from HttpAbstractions

Closes aspnet/Home#2319

This will use constants defined in HeaderNames class instead of hard coded strings.

--- src/Microsoft.AspNetCore.Cors/Infrastructure/CorsConstants.cs
+++ src/Microsoft.AspNetCore.Cors/Infrastructure/CorsConstants.cs
@@ -1,5 +1,7 @@
 // Copyright (c) .NET Foundation. All rights reserved.
 // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using Microsoft.Net.Http.Headers;

 namespace Microsoft.AspNetCore.Cors.Infrastructure
 {
@@ -10,13 +12,13 @@
     {
         /// <summary>
         /// The HTTP method for the CORS preflight request.
-        /// </summary>
+        /// </summary>
         public static readonly string PreflightHttpMethod = "OPTIONS";

         /// <summary>
         /// The Origin request header.
         /// </summary>
-        public static readonly string Origin = "Origin";
+        public static readonly string Origin = HeaderNames.Origin;

         /// <summary>
         /// The value for the Access-Control-Allow-Origin response header to allow all origins.
@@ -26,59 +28,60 @@
         /// <summary>
         /// The Access-Control-Request-Method request header.
         /// </summary>
-        public static readonly string AccessControlRequestMethod = "Access-Control-Request-Method";
+        public static readonly string AccessControlRequestMethod = HeaderNames.AccessControlRequestMethod;

         /// <summary>
         /// The Access-Control-Request-Headers request header.
         /// </summary>
-        public static readonly string AccessControlRequestHeaders = "Access-Control-Request-Headers";
+        public static readonly string AccessControlRequestHeaders = HeaderNames.AccessControlRequestHeaders;

         /// <summary>
         /// The Access-Control-Allow-Origin response header.
         /// </summary>
-        public static readonly string AccessControlAllowOrigin = "Access-Control-Allow-Origin";
+        public static readonly string AccessControlAllowOrigin = HeaderNames.AccessControlAllowOrigin;

         /// <summary>
         /// The Access-Control-Allow-Headers response header.
         /// </summary>
-        public static readonly string AccessControlAllowHeaders = "Access-Control-Allow-Headers";
+        public static readonly string AccessControlAllowHeaders = HeaderNames.AccessControlAllowHeaders;

         /// <summary>
         /// The Access-Control-Expose-Headers response header.
         /// </summary>
-        public static readonly string AccessControlExposeHeaders = "Access-Control-Expose-Headers";
+        public static readonly string AccessControlExposeHeaders = HeaderNames.AccessControlExposeHeaders;

         /// <summary>
         /// The Access-Control-Allow-Methods response header.
         /// </summary>
-        public static readonly string AccessControlAllowMethods = "Access-Control-Allow-Methods";
+        public static readonly string AccessControlAllowMethods = HeaderNames.AccessControlAllowMethods;

         /// <summary>
         /// The Access-Control-Allow-Credentials response header.
         /// </summary>
-        public static readonly string AccessControlAllowCredentials = "Access-Control-Allow-Credentials";
+        public static readonly string AccessControlAllowCredentials = HeaderNames.AccessControlAllowCredentials;

         /// <summary>
         /// The Access-Control-Max-Age response header.
         /// </summary>
-        public static readonly string AccessControlMaxAge = "Access-Control-Max-Age";
+        public static readonly string AccessControlMaxAge = HeaderNames.AccessControlMaxAge;
+

         internal static readonly string[] SimpleRequestHeaders =
         {
-            "Origin",
-            "Accept",
-            "Accept-Language",
-            "Content-Language",
+            HeaderNames.Origin,
+            HeaderNames.Accept,
+            HeaderNames.AcceptLanguage,
+            HeaderNames.ContentLanguage,
         };

         internal static readonly string[] SimpleResponseHeaders =
         {
-            "Cache-Control",
-            "Content-Language",
-            "Content-Type",
-            "Expires",
-            "Last-Modified",
-            "Pragma"
+            HeaderNames.CacheControl,
+            HeaderNames.ContentLanguage,
+            HeaderNames.ContentType,
+            HeaderNames.Expires,
+            HeaderNames.LastModified,
+            HeaderNames.Pragma
         };

         internal static readonly string[] SimpleMethods =


Route name change

Route name change

--- src/Microsoft.AspNetCore.Routing.Subdomain.Samples/Startup.cs
+++ src/Microsoft.AspNetCore.Routing.Subdomain.Samples/Startup.cs
@@ -95,7 +95,7 @@
                     new { controller = "Home", action = "Action2" });

                 routes.MapRoute(hostnames,
-                "NormalRouteTest",
+                "NormalRoute",
                 "{language}/{controller}/{action}",
                 new { Action = "Index", Controller = "Home", Language = "English" });
             });


Added title to Windows tray icon. This fixes #2652

--- Duplicati/GUI/Duplicati.GUI.TrayIcon/WinFormsRunner.cs
+++ Duplicati/GUI/Duplicati.GUI.TrayIcon/WinFormsRunner.cs
@@ -126,6 +126,7 @@
             m_trayIcon = new NotifyIcon();
             m_trayIcon.DoubleClick += new EventHandler(m_trayIcon_DoubleClick);
             m_trayIcon.Click += new EventHandler(m_trayIcon_Click);
+            m_trayIcon.Text = Duplicati.Library.AutoUpdater.AutoUpdateSettings.AppName;
             base.Init(args);
         }


Correct order of params to Guard.ArgumentValid() (#493)

The arguments are in order: condition, error message, name of parameter. See https://github.com/nunit/nunit-console/blob/master/src/NUnitEngine/nunit.engine/Guard.cs#L76

--- src/NUnitEngine/nunit.engine/Drivers/NUnit3FrameworkDriver.cs
+++ src/NUnitEngine/nunit.engine/Drivers/NUnit3FrameworkDriver.cs
@@ -74,7 +74,7 @@
         /// <returns>An Xml string representing the loaded test</returns>
         public string Load(string testAssemblyPath, IDictionary<string, object> settings)
         {
-            Guard.ArgumentValid(File.Exists(testAssemblyPath), "testAssemblyPath", "Framework driver constructor called with a file name that doesn't exist.");
+            Guard.ArgumentValid(File.Exists(testAssemblyPath), "Framework driver constructor called with a file name that doesn't exist.", "testAssemblyPath");

             var idPrefix = string.IsNullOrEmpty(ID) ? "" : ID + "-";
             _testAssemblyPath = testAssemblyPath;


Update IFileSystemWatcher to: * Pass through FileChangeTypes when available * Allow clients to watch a directory (in addition to individual files)

--- src/OmniSharp.Abstractions/FileWatching/IFileSystemWatcher.cs
+++ src/OmniSharp.Abstractions/FileWatching/IFileSystemWatcher.cs
@@ -1,12 +1,20 @@
-using System;
+using OmniSharp.Models;
+using System;

 namespace OmniSharp.FileWatching
 {
     // TODO: Flesh out this API more
     public interface IFileSystemWatcher
     {
-        void Watch(string path, Action<string> callback);
+        void Watch(string path, Action<string, FileChangeType?> callback);

-        void TriggerChange(string path);
+        /// <summary>
+        /// Called when a file is created, changed, or deleted.
+        /// </summary>
+        /// <param name="path">The path to the file</param>
+        /// <param name="verb">The type of change. Hosts are not required to pass a change type</param>
+        void TriggerChange(string path, FileChangeType? verb);
+
+        void WatchDirectory(string path, Action<string, FileChangeType?> callback);
     }
-}+}


PERF: Fixing 16595 Verify User Unicity

PERF: Fixing 16595 Verify User Unicity

--HG--
branch : perf

--- src/Orchard.Web/Modules/Orchard.Users/Services/UserService.cs
+++ src/Orchard.Web/Modules/Orchard.Users/Services/UserService.cs
@@ -38,32 +38,30 @@
         public ILogger Logger { get; set; }

         public string VerifyUserUnicity(string userName, string email) {
-            IEnumerable<UserPart> allUsers = _contentManager.Query<UserPart, UserPartRecord>().List();
+            string normalizedUserName = userName.ToLower();

-            foreach (var user in allUsers) {
-                if (String.Equals(userName.ToLower(), user.NormalizedUserName, StringComparison.OrdinalIgnoreCase)) {
-                    return "A user with that name already exists";
-                }
-                if (String.Equals(email, user.Email, StringComparison.OrdinalIgnoreCase)) {
-                    return "A user with that email already exists";
-                }
+            if (_contentManager.Query<UserPart, UserPartRecord>()
+                                   .Where(user =>
+                                          user.NormalizedUserName == normalizedUserName ||
+                                          user.Email == email)
+                                   .List().Any()) {
+                return "User with that username and/or email already exists.";
             }

             return null;
         }

         public string VerifyUserUnicity(int id, string userName, string email) {
-            IEnumerable<UserPart> allUsers = _contentManager.Query<UserPart, UserPartRecord>().List();
-            foreach (var user in allUsers) {
-                if (user.Id == id)
-                    continue;
-                if (String.Equals(userName.ToLower(), user.NormalizedUserName, StringComparison.OrdinalIgnoreCase)) {
-                    return "A user with that name already exists";
-                }
-                if (String.Equals(email, user.Email, StringComparison.OrdinalIgnoreCase)) {
-                    return "A user with that email already exists";
-                }
+            string normalizedUserName = userName.ToLower();
+
+            if (_contentManager.Query<UserPart, UserPartRecord>()
+                                   .Where(user =>
+                                          user.NormalizedUserName == normalizedUserName ||
+                                          user.Email == email)
+                                   .List().Any(user => user.Id != id)) {
+                return "User with that username and/or email already exists.";
             }
+
             return null;
         }


Fixing localized message of RequiredAttribute

--HG--
branch : 1.x

--- src/Orchard/Mvc/DataAnnotations/LocalizedRequiredAttribute.cs
+++ src/Orchard/Mvc/DataAnnotations/LocalizedRequiredAttribute.cs
@@ -17,7 +17,7 @@

         public override string FormatErrorMessage(string name) {
             return String.IsNullOrEmpty(ErrorMessage)
-                ? T("The field {0} is required.", name).Text
+                ? T("The {0} field is required.", name).Text
                 : T(ErrorMessage, name).Text;
         }
     }


Fixes #6344 shape items ordering (#6369)

--- src/OrchardCore/OrchardCore.DisplayManagement/Shapes/Shape.cs
+++ src/OrchardCore/OrchardCore.DisplayManagement/Shapes/Shape.cs
@@ -16,7 +16,7 @@
     {
         private List<string> _classes;
         private Dictionary<string, string> _attributes;
-        private readonly List<IPositioned> _items = new List<IPositioned>();
+        private List<IPositioned> _items = new List<IPositioned>();
         private bool _sorted = false;

         public ShapeMetadata Metadata { get; } = new ShapeMetadata();
@@ -31,7 +31,7 @@
             {
                 if (!_sorted)
                 {
-                    _items.Sort(FlatPositionComparer.Instance);
+                    _items = _items.OrderBy(x => x, FlatPositionComparer.Instance).ToList();
                     _sorted = true;
                 }

@@ -138,7 +138,7 @@
         {
             if (!_sorted)
             {
-                _items.Sort(FlatPositionComparer.Instance);
+                _items = _items.OrderBy(x => x, FlatPositionComparer.Instance).ToList();
                 _sorted = true;
             }

@@ -149,7 +149,7 @@
         {
             if (!_sorted)
             {
-                _items.Sort(FlatPositionComparer.Instance);
+                _items = _items.OrderBy(x => x, FlatPositionComparer.Instance).ToList();
                 _sorted = true;
             }


compiler: do not create Nullable{T} for locals

ref https://github.com/peachpiecompiler/peachpie/issues/938

--- src/Peachpie.CodeAnalysis/Compilation/PhpCompilation.Types.cs
+++ src/Peachpie.CodeAnalysis/Compilation/PhpCompilation.Types.cs
@@ -200,7 +200,7 @@
         /// <summary>
         /// Merges CLR type to be nullable.
         /// </summary>
-        internal TypeSymbol MergeNull(TypeSymbol type)
+        internal TypeSymbol MergeNull(TypeSymbol type, bool asSystemNullable)
         {
             if (type == null || type.IsVoid())
             {
@@ -209,14 +209,17 @@

             if (type.IsValueType || type.IsOfType(CoreTypes.IPhpArray)) // TODO: remove IPhpArray and check for null in emitted code
             {
-                // nullable bool|int|long|double|string
-                if (type.SpecialType == SpecialType.System_Boolean ||
-                    type.SpecialType == SpecialType.System_Int32 ||
-                    type.SpecialType == SpecialType.System_Int64 ||
-                    type.SpecialType == SpecialType.System_Double ||
-                    type.Is_PhpString())
-                {
-                    return this.GetSpecialType(SpecialType.System_Nullable_T).Construct(ImmutableArray.Create(type));
+                if (asSystemNullable)
+                {
+                    // nullable bool|int|long|double|string
+                    if (type.SpecialType == SpecialType.System_Boolean ||
+                        type.SpecialType == SpecialType.System_Int32 ||
+                        type.SpecialType == SpecialType.System_Int64 ||
+                        type.SpecialType == SpecialType.System_Double ||
+                        type.Is_PhpString())
+                    {
+                        return this.GetSpecialType(SpecialType.System_Nullable_T).Construct(ImmutableArray.Create(type));
+                    }
                 }

                 return CoreTypes.PhpValue;    // anything else -> PhpValue
@@ -309,8 +312,7 @@

             if (t.IsNullable || nullable)
             {
-                // TODO: for value types -> Nullable<T>
-                symbol = MergeNull(symbol);
+                symbol = MergeNull(symbol, asSystemNullable: true);
             }

             return symbol;
@@ -718,7 +720,7 @@
                     }
                 }

-                result = maybenull ? MergeNull(result) : result ?? CoreTypes.Void;
+                result = maybenull ? MergeNull(result, asSystemNullable: false) : result ?? CoreTypes.Void;

                 Debug.Assert(result.IsValidType());


#42 Throw user cancelled exception when play store window is cancelled

--- src/Plugin.InAppBilling.Android/InAppBillingImplementation.cs
+++ src/Plugin.InAppBilling.Android/InAppBillingImplementation.cs
@@ -40,6 +40,8 @@
         const string RESPONSE_IAP_CONTINUATION_TOKEN = "INAPP_CONTINUATION_TOKEN";

         const int PURCHASE_REQUEST_CODE = 1001;
+
+        const int RESPONSE_CODE_RESULT_USER_CANCELED = 1;

         Activity Context => CrossCurrentActivity.Current.Activity;

@@ -487,6 +489,10 @@
                 });

             }
+            else if (responseCode == RESPONSE_CODE_RESULT_USER_CANCELED)
+            {
+                tcsPurchase.SetException(new InAppBillingPurchaseException(PurchaseError.UserCancelled));
+            }
             else
             {
                 tcsPurchase?.TrySetResult(null);


Added update and delete functions to HTTP API in AutoAddPlugin.

--- src/Plugins/HdknPlugins.AutoAdd/Http/Api/FoldersController.cs
+++ src/Plugins/HdknPlugins.AutoAdd/Http/Api/FoldersController.cs
@@ -36,5 +36,35 @@

             return new JsonResult(folder);
         }
+
+        [HttpPut("api/folders/{id}")]
+        public ActionResult Edit(int id)
+        {
+            var folder = BindModel<Folder>();
+            var oldFolder = _dataRepository.Single<Folder>(id);
+
+            if (oldFolder != null)
+            {
+                folder.Id = id;
+                _dataRepository.Update(folder);
+            }
+
+            return new JsonResult(folder);
+        }
+
+        [HttpDelete("api/folders/{id}")]
+        public ActionResult Delete(int id)
+        {
+            var folder = _dataRepository.Single<Folder>(id);
+
+            if (folder != null)
+            {
+                _dataRepository.Delete(folder);
+
+                return new JsonResult(true);
+            }
+
+            return new JsonResult(false);
+        }
     }
 }


Correctly compare field values before setting using NO standard values

Ref: https://github.com/kamsar/Unicorn/issues/162

--- src/Rainbow.Storage.Sc/Deserialization/DefaultDeserializer.cs
+++ src/Rainbow.Storage.Sc/Deserialization/DefaultDeserializer.cs
@@ -625,7 +625,7 @@
 				return true;
 			}

-			if (field.Value != null && !field.Value.Equals(itemField.Value))
+			if (field.Value != null && !field.Value.Equals(itemField.GetValue(false, false)))
 			{
 				var oldValue = itemField.Value;
 				itemField.SetValue(field.Value, true);


Added config action to the shorter Run method so devs can still config Seleno

--- src/TestStack.Seleno/Configuration/SelenoApplicationRunner.cs
+++ src/TestStack.Seleno/Configuration/SelenoApplicationRunner.cs
@@ -24,10 +24,10 @@
             return Host;
         }

-        public static void Run(string webProjectFolder, int portNumber)
+        public static void Run(string webProjectFolder, int portNumber, Action<IAppConfigurator> configure = null)
         {
             var webApplication = new WebApplication(ProjectLocation.FromFolder(webProjectFolder), portNumber);
-            Host = New(x => x.ProjectToTest(webApplication));
+            Run(webApplication, configure);
         }

         public static void Run(WebApplication app, Action<IAppConfigurator> configure)
@@ -37,7 +37,9 @@
                 Action<IAppConfigurator> action = x =>
                 {
                     x.ProjectToTest(app);
-                    configure(x);
+
+                    if (configure != null)
+                        configure(x);
                 };

                Host = New(action);


Improves time slot retrievial

Improves time slot retrievial

Adds another GetTimeSlot method without any parameters to get the time slot for today.

--- code/Scheduler.cs
+++ code/Scheduler.cs
@@ -43,12 +43,12 @@
 			UI.fieldDayOfWeek.SelectedIndex = Days.IndexOf(DateTime.Now.DayOfWeek);

 			// displays the start time and end time for today
-			TimeSlot Today = GetTimeSlot(DateTime.Now.DayOfWeek);
+			TimeSlot slot = GetTimeSlot();

-			if (Today != null) {
-				UI.fieldStartTime.Text = Today.Start.Hours.ToString() + ":00";
-				UI.fieldEndTime.Text = Today.End.Hours.ToString() + ":00";
-				UI.labelDuration.Text = Today.Start.Subtract(Today.End).Duration().Hours.ToString() + " " + Translation.hours;
+			if (slot != null) {
+				UI.fieldStartTime.Text = slot.Start.Hours.ToString() + ":00";
+				UI.fieldEndTime.Text = slot.End.Hours.ToString() + ":00";
+				UI.labelDuration.Text = slot.Start.Subtract(slot.End).Duration().Hours.ToString() + " " + Translation.hours;
 			} else {
 				UI.fieldStartTime.Text = "-";
 				UI.fieldEndTime.Text = "-";
@@ -66,7 +66,17 @@
 		}

 		/// <summary>
-		/// Searches for a time slot for a specific day
+		/// Searches a time slot for today
+		/// </summary>
+		/// <returns>The time slot of today</returns>
+		public TimeSlot GetTimeSlot() {
+			return Slots.Find((match) => {
+				return match.Day == DateTime.Now.DayOfWeek;
+			});
+		}
+
+		/// <summary>
+		/// Searches a time slot for a specific day
 		/// </summary>
 		/// <param name="day">The day for which to find a time slot</param>
 		/// <returns>The time slot of the day</returns>
@@ -121,8 +131,8 @@
 		/// <returns>A flag that tells if the inbox can be synched</returns>
 		public bool ScheduledSync() {

-			// gets the current time slot for today
-			TimeSlot slot = GetTimeSlot(DateTime.Now.DayOfWeek);
+			// gets the time slot of today
+			TimeSlot slot = GetTimeSlot();

 			// allows inbox syncing if there is no slot defined for today
 			if (slot == null) {


Detect "infinite" ranges (even if the endpoints are finite) in tex range

--- renderdocui/Controls/RangeHistogram.cs
+++ renderdocui/Controls/RangeHistogram.cs
@@ -113,7 +113,9 @@
                 if (float.IsInfinity(m_WhitePoint) || float.IsNaN(m_WhitePoint) ||
                     float.IsInfinity(m_BlackPoint) || float.IsNaN(m_BlackPoint) ||
                     float.IsInfinity(m_RangeMax) || float.IsNaN(m_RangeMax) ||
-                    float.IsInfinity(m_RangeMin) || float.IsNaN(m_RangeMin))
+                    float.IsInfinity(m_RangeMin) || float.IsNaN(m_RangeMin) ||
+                    float.IsInfinity(m_RangeMax - m_RangeMin) || float.IsNaN(m_RangeMax - m_RangeMin) ||
+                    float.IsInfinity(m_WhitePoint - m_BlackPoint) || float.IsNaN(m_WhitePoint - m_BlackPoint))
                 {
                     return false;
                 }


Added leave command.

Added leave command.

--- Dogey/Modules/OwnerModule.cs
+++ Dogey/Modules/OwnerModule.cs
@@ -27,6 +27,16 @@
         public async Task Say(IUserMessage msg, [Remainder]string text)
         {
             await msg.Channel.SendMessageAsync(text);
+        }
+
+        [Command("leave")]
+        [Description("Make Dogey leave a server.")]
+        public async Task Set(IUserMessage msg, ulong guildId)
+        {
+            var guild = await _client.GetGuildAsync(guildId);
+
+            await guild.LeaveAsync();
+            await msg.Channel.SendMessageAsync($"I left the guild **{guild.Name}** ({guild.Id}).");
         }

         [Command("set")]