Avoid requiring a list per drawable

Avoid requiring a list per drawable

--- osu.Framework/Graphics/Drawable.cs
+++ osu.Framework/Graphics/Drawable.cs
@@ -116,25 +116,20 @@

         internal virtual void UnbindAllBindables() => unbindAllBindables();

-        private List<Action<object>> unbindActions;
-
-        private void prepareUnbindActions()
-        {
-            Trace.Assert(unbindActions == null);
-
-            unbindActions = new List<Action<object>>();
+        private void cacheUnbindActions()
+        {
             Type type = GetType();

             do
             {
-                unbindActions.Add(createUnbindAction(type));
+                cacheUnbindAction(type);
                 type = type.BaseType;
             } while (type != null && type != typeof(object));

-            Action<object> createUnbindAction(Type targetType)
-            {
-                if (unbind_action_cache.TryGetValue(targetType, out var existing))
-                    return existing;
+            void cacheUnbindAction(Type targetType)
+            {
+                if (unbind_action_cache.TryGetValue(targetType, out _))
+                    return;

                 // List containing all the delegates to perform the unbinds
                 var actions = new List<Action<object>>();
@@ -149,9 +144,7 @@
                                            .Where(p => typeof(IUnbindable).IsAssignableFrom(p.PropertyType))
                                            .Select(p => new Action<object>(target => ((IUnbindable)p.GetValue(target))?.UnbindAll())));

-                return unbind_action_cache[targetType] = performUnbind;
-
-                void performUnbind(object target)
+                unbind_action_cache[targetType] = target =>
                 {
                     foreach (var a in actions)
                     {
@@ -164,7 +157,7 @@
                             // Execution should continue regardless of whether an unbind failed
                         }
                     }
-                }
+                };
             }
         }

@@ -173,11 +166,15 @@
         /// </summary>
         private void unbindAllBindables()
         {
-            if (unbindActions == null)
-                return;
-
-            foreach (var a in unbindActions)
-                a.Invoke(this);
+            Type type = GetType();
+
+            do
+            {
+                if (unbind_action_cache.TryGetValue(type, out var existing))
+                    existing?.Invoke(this);
+
+                type = type.BaseType;
+            } while (type != null && type != typeof(object));
         }

         #endregion
@@ -254,7 +251,7 @@

             InjectDependencies(dependencies);

-            prepareUnbindActions();
+            cacheUnbindActions();

             LoadAsyncComplete();


Update xmldoc with better references

Update xmldoc with better references

--- osu.Framework/Graphics/Drawable.cs
+++ osu.Framework/Graphics/Drawable.cs
@@ -142,7 +142,7 @@
         /// <param name="game">The game to load this Drawable on.</param>
         /// <param name="target">
         /// The target this Drawable may eventually be loaded into.
-        /// <see cref="Clock"/> and <see cref="CompositeDrawable.Dependencies"/> are inherited from the target.
+        /// The <see cref="IFrameBasedClock"/> and dependencies via <see cref="IReadOnlyDependencyContainer"/> are inherited from the <see cref="target"/>.
         /// </param>
         /// <param name="cancellation">A cancellation token.</param>
         /// <param name="onLoaded">Callback to be invoked on the update thread after loading is complete.</param>


another unused using

another unused using

--- osu.Game/Audio/AudioLoadWrapper.cs
+++ osu.Game/Audio/AudioLoadWrapper.cs
@@ -5,7 +5,6 @@
 using osu.Framework.Audio;
 using osu.Framework.Audio.Track;
 using osu.Framework.Graphics;
-using osu.Game.Beatmaps;

 namespace osu.Game.Audio
 {


Fixed wrong action message color

Fixed wrong action message color

--- osu.Game/Overlays/Chat/ChatLine.cs
+++ osu.Game/Overlays/Chat/ChatLine.cs
@@ -195,8 +195,8 @@
                     }
                 }
             };
-            if (message.IsAction)
-                contentFlow.Colour = senderHasBackground ? OsuColour.FromHex(message.Sender.Colour) : username_colours[message.Sender.Id % username_colours.Length];
+            if (message.IsAction && senderHasBackground)
+                contentFlow.Colour = OsuColour.FromHex(message.Sender.Colour);

             updateMessageContent();
             FinishTransforms(true);


Remove blank line

Remove blank line

--- osu.Game/Overlays/ChatOverlayV2.cs
+++ osu.Game/Overlays/ChatOverlayV2.cs
@@ -290,4 +290,3 @@
         }
     }
 }
-


Tidy up initialisation

Tidy up initialisation

--- osu.Game/Overlays/ChatOverlayV2.cs
+++ osu.Game/Overlays/ChatOverlayV2.cs
@@ -64,20 +64,27 @@
         [Cached]
         private readonly Bindable<Channel> currentChannel = new Bindable<Channel>();

+        public ChatOverlayV2()
+        {
+            Height = default_chat_height;
+
+            Masking = true;
+
+            const float corner_radius = 7f;
+
+            CornerRadius = corner_radius;
+
+            // Hack to hide the bottom edge corner radius off-screen.
+            Margin = new MarginPadding { Bottom = -corner_radius };
+            Padding = new MarginPadding { Bottom = corner_radius };
+
+            Anchor = Anchor.BottomCentre;
+            Origin = Anchor.BottomCentre;
+        }
+
         [BackgroundDependencyLoader]
         private void load()
         {
-            // Width = 0.85f; // Matches OnlineOverlay
-            Height = default_chat_height;
-            RelativeSizeAxes = Axes.Both;
-            RelativePositionAxes = Axes.Both;
-            Anchor = Anchor.BottomCentre;
-            Origin = Anchor.BottomCentre;
-            Masking = true;
-            CornerRadius = 7f;
-            Margin = new MarginPadding { Bottom = -10 };
-            Padding = new MarginPadding { Bottom = 10 };
-
             Children = new Drawable[]
             {
                 topBar = new ChatOverlayTopBar


[050copyfiles] Fixing QtXml in 4.7.1

[050copyfiles] Fixing QtXml in 4.7.1

--- packages/Qt/4.7.1/Scripts/QtXml.cs
+++ packages/Qt/4.7.1/Scripts/QtXml.cs
@@ -5,7 +5,7 @@
 // <author>Mark Final</author>
 namespace Qt
 {
-    public sealed class Xml : QtCommon.Core
+    public sealed class Xml : QtCommon.Xml
     {
         public Xml()
             : base(typeof(Qt.Toolset), false)


Remove unnecessary initial call to HitObjectApplied bound method

Was causing test failures. Looks to be unnecessary on a check of when
HitObjectApplied is invoked.

--- osu.Game.Rulesets.Osu/Skinning/Default/PlaySliderBody.cs
+++ osu.Game.Rulesets.Osu/Skinning/Default/PlaySliderBody.cs
@@ -45,7 +45,6 @@
             BorderColour = skin.GetConfig<OsuSkinColour, Color4>(OsuSkinColour.SliderBorder)?.Value ?? Color4.White;

             drawableObject.HitObjectApplied += onHitObjectApplied;
-            onHitObjectApplied(drawableObject);
         }

         private void onHitObjectApplied(DrawableHitObject obj)


Clean up test case

Clean up test case

--- osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs
+++ osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs
@@ -156,8 +156,6 @@
         {
             protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground();

-            public bool BackgroundLoaded => Background?.IsLoaded ?? false;
-
             public bool AssertDimmed()
             {
                 return ((FadeAccessibleBackground)Background).AssertDimmed();
@@ -207,6 +205,7 @@
             public DimAccessiblePlayerLoader(Player player) : base(() => player)
             {
             }
+
             protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground();
         }


Adjust comment + accessibility

Adjust comment + accessibility

--- osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs
+++ osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs
@@ -221,9 +221,9 @@
         }

         /// <summary>
-        /// Should be called at least once after lifetime of this hit object is end.
-        /// </summary>
-        public void OnLifetimeEnd()
+        /// Will called at least once after the <see cref="LifetimeEnd"/> of this <see cref="DrawableHitObject"/> has been passed.
+        /// </summary>
+        internal void OnLifetimeEnd()
         {
             foreach (var nested in NestedHitObjects)
                 nested.OnLifetimeEnd();


Run child updates for nested hitobjects when parent hitobjects are masked

--- osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs
+++ osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs
@@ -36,6 +36,7 @@

         public override bool RemoveCompletedTransforms => false;
         public override bool RemoveWhenNotAlive => false;
+        protected override bool RequiresChildrenUpdate => true;

         protected DrawableHitObject(HitObject hitObject)
         {


wrong filter for external claim types

wrong filter for external claim types

--- source/Core/Models/AuthenticateResult.cs
+++ source/Core/Models/AuthenticateResult.cs
@@ -96,7 +96,7 @@
             var user = IdentityServerPrincipal.Create(subject, name, authenticationMethod, identityProvider, authenticationType);
             if (claims != null && claims.Any())
             {
-                claims = claims.Where(x => !Constants.ExternalAuthenticationType.Contains(x.Type));
+                claims = claims.Where(x => !Constants.ExternalIdentityProviderProtocolClaimTypes.Contains(x.Type));
                 claims = claims.Where(x => !Constants.AuthenticateResultClaimTypes.Contains(x.Type));
                 user.Identities.First().AddClaims(claims);
             }


Remove MTFast and MTUntempered

Remove MTFast and MTUntempered

--- 3DSRNGTool/RNG/MT.cs
+++ 3DSRNGTool/RNG/MT.cs
@@ -249,297 +249,4 @@
             _mt[0] = 0x80000000; /* MSB is 1; assuring non-zero initial array */
         }
     }
-
-    public class MersenneTwisterFast : IRNG
-    {
-        /* Period parameters */
-        private const Int32 N = 624;
-        private const Int32 M = 397;
-        private const uint MatrixA = 0x9908b0df; /* constant vector a */
-        private const uint UpperMask = 0x80000000; /* most significant w-r bits */
-        private const uint LowerMask = 0x7fffffff; /* least significant r bits */
-
-        /* Tempering parameters */
-        private const uint TemperingMaskB = 0x9d2c5680;
-        private const uint TemperingMaskC = 0xefc60000;
-        private const uint TemperingMaskC2 = 0xef000000;
-        private static readonly uint[] _mag01 = { 0x0, MatrixA };
-        private readonly uint[] _mt = new uint[N]; /* the array for the state vector  */
-        private Int16 _mti;
-        private int maxCalls;
-
-        /// <summary>
-        ///     Creates a new pseudo-random number generator with a given seed.
-        /// </summary>
-        /// <param name="seed">A value to use as a seed.</param>
-        /// <param name="calls">The number of calls to make </param>
-        public MersenneTwisterFast(uint seed, int calls)
-        {
-            maxCalls = calls;
-
-            if (maxCalls > 227)
-            {
-                throw (new ArgumentOutOfRangeException(maxCalls.ToString(),
-                                                       "Number of calls exceeds Fast IVRNG maximum!"));
-            }
-            init(seed);
-        }
-
-        #region IRNG Members
-
-        public void Reseed(uint seed)
-        {
-            init(seed);
-        }
-
-        /// <summary>
-        ///     Returns the next pseudo-random <see cref="uint" />.
-        /// </summary>
-        /// <returns>
-        ///     A pseudo-random <see cref="uint" /> value.
-        /// </returns>
-        public uint Nextuint()
-        {
-            return Generateuint();
-        }
-
-        // Interface call
-        public void Next()
-        {
-            Generateuint();
-        }
-
-        #endregion
-
-        /// <summary>
-        ///     Generates a new pseudo-random <see cref="uint" />.
-        /// </summary>
-        /// <returns>
-        ///     A pseudo-random <see cref="uint" />.
-        /// </returns>
-        protected uint Generateuint()
-        {
-            uint y;
-
-
-            /* _mag01[x] = x * MatrixA  for x=0,1 */
-            if (_mti >= (M + maxCalls)) /* generate N words at one time */
-            {
-                Int16 kk = 0;
-
-                for (; kk < maxCalls; ++kk)
-                {
-                    //y = (_mt[kk] & UpperMask) | (_mt[(kk + 1) % N] & LowerMask);
-                    y = (_mt[kk] & UpperMask) | (_mt[kk + 1] & LowerMask);
-                    _mt[kk] = _mt[(kk + M)] ^ (y >> 1) ^ _mag01[y & 0x1];
-                }
-
-
-                _mti = 0;
-            }
-
-            y = _mt[_mti++];
-
-
-            y ^= temperingShiftU(y);
-            y ^= temperingShiftS(y) & TemperingMaskB;
-            y ^= temperingShiftT(y) & TemperingMaskC2;
-
-
-            // removed because we only need the top 5 bits, so this is unnecessary
-            //y ^= temperingShiftL(y);
-
-            return y;
-        }
-
-        private static uint temperingShiftU(uint y)
-        {
-            return (y >> 11);
-        }
-
-        private static uint temperingShiftS(uint y)
-        {
-            return (y << 7);
-        }
-
-        private static uint temperingShiftT(uint y)
-        {
-            return (y << 15);
-        }
-
-        private static uint temperingShiftL(uint y)
-        {
-            return (y >> 18);
-        }
-
-        public static uint[] generateArray(uint seed, uint maxCalls)
-        {
-            var MTarray = new uint[397 + maxCalls];
-            MTarray[0] = seed;
-            for (int i = 1; i <= 397 + maxCalls; i++)
-            {
-                MTarray[i] = (uint)(0x6c078965 * (MTarray[i - 1] ^ (MTarray[i - 1] >> 30)) + i) & 0xFFFFFFFF;
-            }
-            return MTarray;
-        }
-
-        private void init(uint seed)
-        {
-            //_mt[0] = seed & 0xffffffffU;
-            _mt[0] = seed;
-
-            if (maxCalls > (N - M))
-            {
-                maxCalls = N - M;
-            }
-
-            int max = M + maxCalls;
-            for (_mti = 1; _mti < max; ++_mti)
-            {
-                _mt[_mti] = (uint)(1812433253U * (_mt[_mti - 1] ^ (_mt[_mti - 1] >> 30)) + _mti);
-                // See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier.
-                // In the previous versions, MSBs of the seed affect
-                // only MSBs of the array _mt[].
-                // 2002/01/09 modified by Makoto Matsumoto
-
-                //this should do absolutely nothing and be quite expensive, removed for now
-                //tested and it appears to do nothing
-                /*
-                uint a = _mt[_mti];
-                _mt[_mti] &= 0xffffffffU;
-                uint b = _mt[_mti];
-                if (a != b)
-                {
-                    System.Windows.Forms.MessageBox.Show(a.ToString() + " " + b.ToString());
-                }*/
-                // for >32 bit machines
-            }
-        }
-    }
-
-    public class MersenneTwisterUntempered : IRNG
-    {
-        /* Period parameters */
-        private const Int32 N = 624;
-        private const Int32 M = 397;
-        private const uint MatrixA = 0x9908b0df; /* constant vector a */
-        private const uint UpperMask = 0x80000000; /* most significant w-r bits */
-        private const uint LowerMask = 0x7fffffff; /* least significant r bits */
-
-        /* Tempering parameters */
-        private const uint TemperingMaskB = 0x9d2c5680;
-        private const uint TemperingMaskC = 0xefc60000;
-        private static readonly uint[] _mag01 = { 0x0, MatrixA };
-        private readonly uint[] _mt = new uint[N]; /* the array for the state vector  */
-        private Int16 _mti;
-
-        /// <summary>
-        ///     Creates a new pseudo-random number generator with a given seed.
-        /// </summary>
-        /// <param name="seed">A value to use as a seed.</param>
-        public MersenneTwisterUntempered(Int32 seed)
-        {
-            init((uint)seed);
-        }
-
-        #region IRNG Members
-
-        public void Reseed(uint seed)
-        {
-            init(seed);
-        }
-
-        /// <summary>
-        ///     Returns the next pseudo-random <see cref="uint" />.
-        /// </summary>
-        /// <returns>
-        ///     A pseudo-random <see cref="uint" /> value.
-        /// </returns>
-        public uint Nextuint()
-        {
-            return Generateuint();
-        }
-
-        // Interface call
-        public void Next()
-        {
-            Generateuint();
-        }
-
-        #endregion
-
-        /// <summary>
-        ///     Generates a new pseudo-random <see cref="uint" />.
-        /// </summary>
-        /// <returns>
-        ///     A pseudo-random <see cref="uint" />.
-        /// </returns>
-        protected uint Generateuint()
-        {
-            uint y;
-
-            /* _mag01[x] = x * MatrixA  for x=0,1 */
-            if (_mti >= N) /* generate N words at one time */
-            {
-                Int16 kk = 0;
-
-                for (; kk < N - M; ++kk)
-                {
-                    y = (_mt[kk] & UpperMask) | (_mt[kk + 1] & LowerMask);
-                    _mt[kk] = _mt[kk + M] ^ (y >> 1) ^ _mag01[y & 0x1];
-                }
-
-                for (; kk < N - 1; ++kk)
-                {
-                    y = (_mt[kk] & UpperMask) | (_mt[kk + 1] & LowerMask);
-                    _mt[kk] = _mt[kk + (M - N)] ^ (y >> 1) ^ _mag01[y & 0x1];
-                }
-
-                y = (_mt[N - 1] & UpperMask) | (_mt[0] & LowerMask);
-                _mt[N - 1] = _mt[M - 1] ^ (y >> 1) ^ _mag01[y & 0x1];
-
-                _mti = 0;
-            }
-
-            y = _mt[_mti++];
-
-            return y;
-        }
-
-        private static uint temperingShiftU(uint y)
-        {
-            return (y >> 11);
-        }
-
-        private static uint temperingShiftS(uint y)
-        {
-            return (y << 7);
-        }
-
-        private static uint temperingShiftT(uint y)
-        {
-            return (y << 15);
-        }
-
-        private static uint temperingShiftL(uint y)
-        {
-            return (y >> 18);
-        }
-
-        private void init(uint seed)
-        {
-            _mt[0] = seed & 0xffffffffU;
-
-            for (_mti = 1; _mti < N; _mti++)
-            {
-                _mt[_mti] = (uint)(1812433253U * (_mt[_mti - 1] ^ (_mt[_mti - 1] >> 30)) + _mti);
-                // See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier.
-                // In the previous versions, MSBs of the seed affect
-                // only MSBs of the array _mt[].
-                // 2002/01/09 modified by Makoto Matsumoto
-                _mt[_mti] &= 0xffffffffU;
-                // for >32 bit machines
-            }
-        }
-    }
 }


Implement ICorLibTypes iface

Implement ICorLibTypes iface

--- dot10/dotNET/Hi/ModuleDefMD.cs
+++ dot10/dotNET/Hi/ModuleDefMD.cs
@@ -6,7 +6,7 @@
 	///
 	/// Created from a row in the Module table
 	///
-	public sealed class ModuleDefMD : ModuleDef {
+	public sealed class ModuleDefMD : ModuleDef, ICorLibTypes {
 		/// The file that contains all .NET metadata
 		DotNetFile dnFile;
 		/// The raw table row. It's null until <see cref="InitializeRawRow"/> is called
@@ -132,6 +132,101 @@
 		/// <inheritdoc/>
 		public override IList<TypeDef> Types {
 			get { return types; }
+		}
+
+		/// <inheritdoc/>
+		public ITypeSig Void {
+			get { throw new NotImplementedException(); /*TODO:*/ }
+		}
+
+		/// <inheritdoc/>
+		public ITypeSig Boolean {
+			get { throw new NotImplementedException(); /*TODO:*/ }
+		}
+
+		/// <inheritdoc/>
+		public ITypeSig Char {
+			get { throw new NotImplementedException(); /*TODO:*/ }
+		}
+
+		/// <inheritdoc/>
+		public ITypeSig SByte {
+			get { throw new NotImplementedException(); /*TODO:*/ }
+		}
+
+		/// <inheritdoc/>
+		public ITypeSig Byte {
+			get { throw new NotImplementedException(); /*TODO:*/ }
+		}
+
+		/// <inheritdoc/>
+		public ITypeSig Int16 {
+			get { throw new NotImplementedException(); /*TODO:*/ }
+		}
+
+		/// <inheritdoc/>
+		public ITypeSig UInt16 {
+			get { throw new NotImplementedException(); /*TODO:*/ }
+		}
+
+		/// <inheritdoc/>
+		public ITypeSig Int32 {
+			get { throw new NotImplementedException(); /*TODO:*/ }
+		}
+
+		/// <inheritdoc/>
+		public ITypeSig UInt32 {
+			get { throw new NotImplementedException(); /*TODO:*/ }
+		}
+
+		/// <inheritdoc/>
+		public ITypeSig Int64 {
+			get { throw new NotImplementedException(); /*TODO:*/ }
+		}
+
+		/// <inheritdoc/>
+		public ITypeSig UInt64 {
+			get { throw new NotImplementedException(); /*TODO:*/ }
+		}
+
+		/// <inheritdoc/>
+		public ITypeSig Single {
+			get { throw new NotImplementedException(); /*TODO:*/ }
+		}
+
+		/// <inheritdoc/>
+		public ITypeSig Double {
+			get { throw new NotImplementedException(); /*TODO:*/ }
+		}
+
+		/// <inheritdoc/>
+		public ITypeSig String {
+			get { throw new NotImplementedException(); /*TODO:*/ }
+		}
+
+		/// <inheritdoc/>
+		public ITypeSig TypedReference {
+			get { throw new NotImplementedException(); /*TODO:*/ }
+		}
+
+		/// <inheritdoc/>
+		public ITypeSig IntPtr {
+			get { throw new NotImplementedException(); /*TODO:*/ }
+		}
+
+		/// <inheritdoc/>
+		public ITypeSig UIntPtr {
+			get { throw new NotImplementedException(); /*TODO:*/ }
+		}
+
+		/// <inheritdoc/>
+		public ITypeSig Object {
+			get { throw new NotImplementedException(); /*TODO:*/ }
+		}
+
+		/// <inheritdoc/>
+		public AssemblyRef AssemblyRef {
+			get { throw new NotImplementedException(); /*TODO:*/ }
 		}

 		///


consistent indenting of the methods and the brackets.

--- build.cake
+++ build.cake
@@ -207,9 +207,9 @@
 Task("TestNUnitLite")
   .IsDependentOn("BuildFramework")
     .OnError(exception =>
-        {
-            ErrorDetail.Add(exception.Message);
-        })
+    {
+        ErrorDetail.Add(exception.Message);
+    })
 	.Does(() =>
 	{
 			if (framework == "sl-5.0")
@@ -221,9 +221,9 @@
 Task("TestEngine")
   .IsDependentOn("Build")
     .OnError(exception =>
-        {
-            ErrorDetail.Add(exception.Message);
-        })
+    {
+        ErrorDetail.Add(exception.Message);
+    })
   .Does(() =>
 	{
 		RunTest(NUNIT3_CONSOLE, BIN_DIR, ENGINE_TESTS, "TestEngine", ref ErrorDetail);
@@ -239,9 +239,9 @@

 Task("TestAddins")
     .OnError(exception =>
-        {
-            ErrorDetail.Add(exception.Message);
-        })
+    {
+        ErrorDetail.Add(exception.Message);
+    })
   .IsDependentOn("Build")
   .Does(() =>
 	{
@@ -251,9 +251,9 @@
 Task("TestV2Driver")
   .IsDependentOn("Build")
     .OnError(exception =>
-        {
-            ErrorDetail.Add(exception.Message);
-        })
+    {
+        ErrorDetail.Add(exception.Message);
+    })
   .Does(() =>
 	{
 		RunTest(NUNIT3_CONSOLE, BIN_DIR, V2_PORTABLE_AGENT_TESTS,"TestV2Driver", ref ErrorDetail);
@@ -262,9 +262,9 @@
 Task("TestConsole")
   .IsDependentOn("Build")
     .OnError(exception =>
-        {
-            ErrorDetail.Add(exception.Message);
-        })
+    {
+        ErrorDetail.Add(exception.Message);
+    })
   .Does(() =>
 	{
 		RunTest(NUNIT3_CONSOLE, BIN_DIR, CONSOLE_TESTS, "TestConsole", ref ErrorDetail);


Coverage build should verify codegen.

Coverage build should verify codegen.

--- build.cake
+++ build.cake
@@ -166,7 +166,7 @@
 	});

 Task("Coverage")
-	.IsDependentOn("Build")
+	.IsDependentOn("VerifyCodeGen")
 	.Does(() =>
 	{
 		CreateDirectory("release");


add repository path to nuget update

add repository path to nuget update

--- build.cake
+++ build.cake
@@ -138,7 +138,8 @@
             foreach(var project in parameters.Paths.Files.Projects)
             {
                 NuGetUpdate(project.PackagesFile, new NuGetUpdateSettings {
-                    Safe = true
+                    Safe = true,
+                    ArgumentCustomization = args => args.Append("-FileConflictAction Overwrite -ConfigFile ./tools/nuget.config -RepositoryPath " + parameters.Solution.GetDirectory().Combine("packages").ToString())
                 });
             }


Updated solution version

Updated solution version

--- src/Banzai/Properties/SolutionVersion.cs
+++ src/Banzai/Properties/SolutionVersion.cs
@@ -4,9 +4,9 @@

 [assembly: AssemblyProduct("Banzai")]
 [assembly: AssemblyCopyright("Copyright 2014 Eric Swann - All rights reserved.")]
-[assembly: AssemblyVersion("1.0.3")]
-[assembly: AssemblyFileVersion("1.0.3")]
+[assembly: AssemblyVersion("1.0.4")]
+[assembly: AssemblyFileVersion("1.0.4")]

-[assembly: AssemblyInformationalVersion("1.0.3.0")]
+[assembly: AssemblyInformationalVersion("1.0.4.0")]
 [assembly: ComVisible(false)]
 [assembly: CLSCompliant(false)]


added params key word

added params key word

--- src/Classifier/Languages/BaseLanguage.cs
+++ src/Classifier/Languages/BaseLanguage.cs
@@ -55,7 +55,7 @@
             =>
                 new List<string>
                 {
-                    "\\b(if|else|while|for|foreach|in|do|return|continue|break|switch|case|default|goto|throw|try|catch|finally|lock|yield|await)\\b"
+                    "\\b(if|else|while|for|foreach|in|do|return|continue|break|switch|case|default|goto|throw|try|catch|finally|lock|yield|await|params)\\b"
                 };
     }
-}+}


Cleanup code in ImageLoaderThread.

Cleanup code in ImageLoaderThread.

--- src/Clients/MainApp/ImageLoaderThread.cs
+++ src/Clients/MainApp/ImageLoaderThread.cs
@@ -30,323 +30,321 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-using Gdk;
-using Gtk;
+
 using System.Collections;
 using System.Collections.Generic;
 using System.Threading;
-using System;
-
+using FSpot.Imaging;
+using FSpot.Utils;
+using Gdk;
+using Gtk;
 using Hyena;

-using FSpot.Utils;
-using FSpot.Imaging;
-
-public class ImageLoaderThread
+namespace FSpot
 {
-	// Types.
-	public class RequestItem
+	public class ImageLoaderThread
 	{
-		/// <summary>
-		/// Gets or Sets image uri
-		/// </summary>
-		/// <value>
-		/// Image Uri
-		/// </value>
-		public SafeUri Uri { get; set; }
-
-		/* Order value; requests with a lower value get performed first.  */
-		public int Order { get; set; }
-
-		/* The pixbuf obtained from the operation.  */
-		private Pixbuf result;
-
-		public Pixbuf Result {
-			get {
-				if (result == null) {
-					return null;
-				}
-				return result.ShallowCopy ();
-			}
-			set { result = value; }
-		}
-
-		/* the maximium size both must be greater than zero if either is */
-		public int Width { get; set; }
-
-		public int Height { get; set; }
-
-		public RequestItem (SafeUri uri, int order, int width, int height)
-		{
-			this.Uri = uri;
-			this.Order = order;
-			this.Width = width;
-			this.Height = height;
-			if ((width <= 0 && height > 0) || (height <= 0 && width > 0)) {
-				throw new System.Exception ("Invalid arguments");
-			}
-		}
-
-		~RequestItem ()
-		{
-			if (result != null) {
-				result.Dispose ();
-			}
-			result = null;
-		}
+		// Types.
+		public class RequestItem
+		{
+			/// <summary>
+			/// Gets or Sets image uri
+			/// </summary>
+			/// <value>
+			/// Image Uri
+			/// </value>
+			public SafeUri Uri { get; set; }
+
+			/* Order value; requests with a lower value get performed first.  */
+			public int Order { get; set; }
+
+			/* The pixbuf obtained from the operation.  */
+			Pixbuf result;
+
+			public Pixbuf Result {
+				get {
+					return result == null ? null : result.ShallowCopy ();
+				}
+				set { result = value; }
+			}
+
+			/* the maximium size both must be greater than zero if either is */
+			public int Width { get; set; }
+
+			public int Height { get; set; }
+
+			public RequestItem (SafeUri uri, int order, int width, int height)
+			{
+				Uri = uri;
+				Order = order;
+				Width = width;
+				Height = height;
+				if ((width <= 0 && height > 0) || (height <= 0 && width > 0)) {
+					throw new System.Exception ("Invalid arguments");
+				}
+			}
+
+			~RequestItem ()
+			{
+				if (result != null) {
+					result.Dispose ();
+				}
+				result = null;
+			}
+		}
+
+
+		#region Private members.
+		static List<ImageLoaderThread> instances = new List<ImageLoaderThread> ();
+
+		/* The thread used to handle the requests.  */
+		Thread worker_thread;
+
+		/* The request queue; it's shared between the threads so it
+		   needs to be locked prior to access.  */
+		List<RequestItem> queue;
+
+		/* A dict of all the requests; note that the current request
+		   isn't in the dict.  */
+		Dictionary<SafeUri, RequestItem> requests_by_uri;
+
+		/* Current request.  Request currently being handled by the
+		   auxiliary thread.  Should be modified only by the auxiliary
+		   thread (the GTK thread can only read it).  */
+		RequestItem current_request;
+
+		/* The queue of processed requests.  */
+		readonly Queue processed_requests;
+
+		/* This is used by the helper thread to notify the main GLib
+		   thread that there are pending items in the
+		   `processed_requests' queue.  */
+		ThreadNotify pending_notify;
+
+		/* Whether a notification is pending on `pending_notify'
+		   already or not.  */
+		bool pending_notify_notified;
+		volatile bool should_cancel;
+		#endregion
+
+		#region Public API
+		public delegate void PixbufLoadedHandler (ImageLoaderThread loader,RequestItem result);
+
+		public event PixbufLoadedHandler OnPixbufLoaded;
+
+		public ImageLoaderThread ()
+		{
+			queue = new List<RequestItem> ();
+			requests_by_uri = new Dictionary<SafeUri, RequestItem> ();
+			// requests_by_path = Hashtable.Synchronized (new Hashtable ());
+			processed_requests = new Queue ();
+
+			pending_notify = new ThreadNotify (new Gtk.ReadyEvent (HandleProcessedRequests));
+
+			instances.Add (this);
+		}
+
+		void StartWorker ()
+		{
+			if (worker_thread != null) {
+				return;
+			}
+
+			should_cancel = false;
+			worker_thread = new Thread (new ThreadStart (WorkerThread));
+			worker_thread.Start ();
+		}
+
+		int block_count;
+
+		public void PushBlock ()
+		{
+			Interlocked.Increment (ref block_count);
+		}
+
+		public void PopBlock ()
+		{
+			if (Interlocked.Decrement (ref block_count) == 0) {
+				lock (queue) {
+					Monitor.Pulse (queue);
+				}
+			}
+		}
+
+		public void Cleanup ()
+		{
+			should_cancel = true;
+			if (worker_thread != null) {
+				lock (queue) {
+					Monitor.Pulse (queue);
+				}
+				worker_thread.Join ();
+			}
+			worker_thread = null;
+		}
+
+		public static void CleanAll ()
+		{
+			foreach (var thread in instances) {
+				thread.Cleanup ();
+			}
+		}
+
+		public void Request (SafeUri uri, int order)
+		{
+			Request (uri, order, 0, 0);
+		}
+
+		public virtual void Request (SafeUri uri, int order, int width, int height)
+		{
+			lock (queue) {
+				if (InsertRequest (uri, order, width, height)) {
+					Monitor.Pulse (queue);
+				}
+			}
+		}
+
+		public void Cancel (SafeUri uri)
+		{
+			lock (queue) {
+				RequestItem r = requests_by_uri [uri];
+				if (r != null) {
+					requests_by_uri.Remove (uri);
+					queue.Remove (r);
+				}
+			}
+		}
+		#endregion
+
+		#region Private utility methods.
+		protected virtual void ProcessRequest (RequestItem request)
+		{
+			Pixbuf orig_image;
+			try {
+				using (var img = FSpot.App.Instance.Container.Resolve<IImageFileFactory> ().Create (request.Uri)) {
+					if (request.Width > 0) {
+						orig_image = img.Load (request.Width, request.Height);
+					} else {
+						orig_image = img.Load ();
+					}
+				}
+			} catch (GLib.GException e) {
+				Log.Exception (e);
+				return;
+			}
+
+			if (orig_image == null) {
+				return;
+			}
+
+			request.Result = orig_image;
+		}
+
+		/* Insert the request in the queue, return TRUE if the queue actually grew.
+		   NOTE: Lock the queue before calling.  */
+		bool InsertRequest (SafeUri uri, int order, int width, int height)
+		{
+			StartWorker ();
+
+			/* Check if this is the same as the request currently being processed.  */
+			lock (processed_requests) {
+				if (current_request != null && current_request.Uri == uri) {
+					return false;
+				}
+			}
+			/* Check if a request for this path has already been queued.  */
+			RequestItem existing_request;
+			if (requests_by_uri.TryGetValue (uri, out existing_request)) {
+				/* FIXME: At least for now, this shouldn't happen.  */
+				if (existing_request.Order != order) {
+					Log.WarningFormat ("BUG: Filing another request of order {0} (previously {1}) for `{2}'",
+						order, existing_request.Order, uri);
+				}
+
+				queue.Remove (existing_request);
+				queue.Add (existing_request);
+				return false;
+			}
+
+			/* New request, just put it on the queue with the right order.  */
+			RequestItem new_request = new RequestItem (uri, order, width, height);
+
+			queue.Add (new_request);
+
+			lock (queue) {
+				requests_by_uri.Add (uri, new_request);
+			}
+			return true;
+		}
+
+		/* The worker thread's main function.  */
+		void WorkerThread ()
+		{
+			Log.Debug (ToString (), "Worker starting");
+			try {
+				while (!should_cancel) {
+					lock (processed_requests) {
+						if (current_request != null) {
+							processed_requests.Enqueue (current_request);
+
+							if (! pending_notify_notified) {
+								pending_notify.WakeupMain ();
+								pending_notify_notified = true;
+							}
+
+							current_request = null;
+						}
+					}
+
+					lock (queue) {
+
+						while ((queue.Count == 0 || block_count > 0) && !should_cancel) {
+							Monitor.Wait (queue);
+						}
+
+						if (should_cancel) {
+							return;
+						}
+
+						int pos = queue.Count - 1;
+
+						current_request = queue [pos];
+						queue.RemoveAt (pos);
+						requests_by_uri.Remove (current_request.Uri);
+					}
+
+					ProcessRequest (current_request);
+				}
+			} catch (ThreadAbortException) {
+				//Aborting
+			}
+		}
+
+		protected virtual void EmitLoaded (Queue results)
+		{
+			if (OnPixbufLoaded != null) {
+				foreach (RequestItem r in results) {
+					OnPixbufLoaded (this, r);
+				}
+			}
+		}
+
+		void HandleProcessedRequests ()
+		{
+			Queue results;
+
+
+			lock (processed_requests) {
+				/* Copy the queued items out of the shared queue so we hold the lock for
+				   as little time as possible.  */
+				results = processed_requests.Clone () as Queue;
+				processed_requests.Clear ();
+
+				pending_notify_notified = false;
+			}
+
+			EmitLoaded (results);
+		}
+		#endregion
 	}
-
-
-	#region Private members.
-	static List<ImageLoaderThread> instances = new List<ImageLoaderThread> ();
-
-	/* The thread used to handle the requests.  */
-	private Thread worker_thread;
-
-	/* The request queue; it's shared between the threads so it
-	   needs to be locked prior to access.  */
-	private List<RequestItem> queue;
-
-	/* A dict of all the requests; note that the current request
-	   isn't in the dict.  */
-	Dictionary<SafeUri, RequestItem> requests_by_uri;
-
-	/* Current request.  Request currently being handled by the
-	   auxiliary thread.  Should be modified only by the auxiliary
-	   thread (the GTK thread can only read it).  */
-	private RequestItem current_request;
-
-	/* The queue of processed requests.  */
-	private Queue processed_requests;
-
-	/* This is used by the helper thread to notify the main GLib
-	   thread that there are pending items in the
-	   `processed_requests' queue.  */
-	ThreadNotify pending_notify;
-
-	/* Whether a notification is pending on `pending_notify'
-	   already or not.  */
-	private bool pending_notify_notified;
-	volatile bool should_cancel = false;
-	#endregion
-
-	#region Public API
-	public delegate void PixbufLoadedHandler (ImageLoaderThread loader,RequestItem result);
-
-	public event PixbufLoadedHandler OnPixbufLoaded;
-
-	public ImageLoaderThread ()
-	{
-		queue = new List<RequestItem> ();
-		requests_by_uri = new Dictionary<SafeUri, RequestItem> ();
-//		requests_by_path = Hashtable.Synchronized (new Hashtable ());
-		processed_requests = new Queue ();
-
-		pending_notify = new ThreadNotify (new Gtk.ReadyEvent (HandleProcessedRequests));
-
-		instances.Add (this);
-	}
-
-	void StartWorker ()
-	{
-		if (worker_thread != null) {
-			return;
-		}
-
-		should_cancel = false;
-		worker_thread = new Thread (new ThreadStart (WorkerThread));
-		worker_thread.Start ();
-	}
-
-	int block_count;
-
-	public void PushBlock ()
-	{
-		System.Threading.Interlocked.Increment (ref block_count);
-	}
-
-	public void PopBlock ()
-	{
-		if (System.Threading.Interlocked.Decrement (ref block_count) == 0) {
-			lock (queue) {
-				Monitor.Pulse (queue);
-			}
-		}
-	}
-
-	public void Cleanup ()
-	{
-		should_cancel = true;
-		if (worker_thread != null) {
-			lock (queue) {
-				Monitor.Pulse (queue);
-			}
-			worker_thread.Join ();
-		}
-		worker_thread = null;
-	}
-
-	public static void CleanAll ()
-	{
-		foreach (var thread in instances) {
-			thread.Cleanup ();
-		}
-	}
-
-	public void Request (SafeUri uri, int order)
-	{
-		Request (uri, order, 0, 0);
-	}
-
-	public virtual void Request (SafeUri uri, int order, int width, int height)
-	{
-		lock (queue) {
-			if (InsertRequest (uri, order, width, height)) {
-				Monitor.Pulse (queue);
-			}
-		}
-	}
-
-	public void Cancel (SafeUri uri)
-	{
-		lock (queue) {
-			RequestItem r = requests_by_uri [uri];
-			if (r != null) {
-				requests_by_uri.Remove (uri);
-				queue.Remove (r);
-			}
-		}
-	}
-	#endregion
-
-	#region Private utility methods.
-	protected virtual void ProcessRequest (RequestItem request)
-	{
-		Pixbuf orig_image;
-		try {
-			using (var img = FSpot.App.Instance.Container.Resolve<IImageFileFactory> ().Create (request.Uri)) {
-				if (request.Width > 0) {
-					orig_image = img.Load (request.Width, request.Height);
-				} else {
-					orig_image = img.Load ();
-				}
-			}
-		} catch (GLib.GException e) {
-			Log.Exception (e);
-			return;
-		}
-
-		if (orig_image == null) {
-			return;
-		}
-
-		request.Result = orig_image;
-	}
-
-	/* Insert the request in the queue, return TRUE if the queue actually grew.
-	   NOTE: Lock the queue before calling.  */
-	private bool InsertRequest (SafeUri uri, int order, int width, int height)
-	{
-		StartWorker ();
-
-		/* Check if this is the same as the request currently being processed.  */
-		lock (processed_requests) {
-			if (current_request != null && current_request.Uri == uri) {
-				return false;
-			}
-		}
-		/* Check if a request for this path has already been queued.  */
-		RequestItem existing_request;
-		if (requests_by_uri.TryGetValue (uri, out existing_request)) {
-			/* FIXME: At least for now, this shouldn't happen.  */
-			if (existing_request.Order != order) {
-				Log.WarningFormat ("BUG: Filing another request of order {0} (previously {1}) for `{2}'",
-						   order, existing_request.Order, uri);
-			}
-
-			queue.Remove (existing_request);
-			queue.Add (existing_request);
-			return false;
-		}
-
-		/* New request, just put it on the queue with the right order.  */
-		RequestItem new_request = new RequestItem (uri, order, width, height);
-
-		queue.Add (new_request);
-
-		lock (queue) {
-			requests_by_uri.Add (uri, new_request);
-		}
-		return true;
-	}
-
-	/* The worker thread's main function.  */
-	private void WorkerThread ()
-	{
-		Log.Debug (this.ToString (), "Worker starting");
-		try {
-			while (!should_cancel) {
-				lock (processed_requests) {
-					if (current_request != null) {
-						processed_requests.Enqueue (current_request);
-
-						if (! pending_notify_notified) {
-							pending_notify.WakeupMain ();
-							pending_notify_notified = true;
-						}
-
-						current_request = null;
-					}
-				}
-
-				lock (queue) {
-
-					while ((queue.Count == 0 || block_count > 0) && !should_cancel) {
-						Monitor.Wait (queue);
-					}
-
-					if (should_cancel) {
-						return;
-					}
-
-					int pos = queue.Count - 1;
-
-					current_request = queue [pos];
-					queue.RemoveAt (pos);
-					requests_by_uri.Remove (current_request.Uri);
-				}
-
-				ProcessRequest (current_request);
-			}
-		} catch (ThreadAbortException) {
-			//Aborting
-		}
-	}
-
-	protected virtual void EmitLoaded (Queue results)
-	{
-		if (OnPixbufLoaded != null) {
-			foreach (RequestItem r in results) {
-				OnPixbufLoaded (this, r);
-			}
-		}
-	}
-
-	private void HandleProcessedRequests ()
-	{
-		Queue results;
-
-
-		lock (processed_requests) {
-			/* Copy the queued items out of the shared queue so we hold the lock for
-			   as little time as possible.  */
-			results = processed_requests.Clone () as Queue;
-			processed_requests.Clear ();
-
-			pending_notify_notified = false;
-		}
-
-		EmitLoaded (results);
-	}
-	#endregion
 }


Add modes to Codex.Automation.Workflow.

Add modes to Codex.Automation.Workflow.

--- src/Codex.Automation.Workflow/Program.cs
+++ src/Codex.Automation.Workflow/Program.cs
@@ -18,6 +18,14 @@
         public string SourcesDirectory;
         public string RepoName;
     }
+
+    enum Mode
+    {
+        Prepare = 1 << 0,
+        AnalyzeOnly = 1 << 1,
+        FullAnalyze = Prepare | AnalyzeOnly
+    }
+
     class Program
     {
         private static Arguments ParseArguments(string[] args)
@@ -67,58 +75,101 @@
             return false;
         }

+        private static Mode GetMode(ref string[] args)
+        {
+            if (args[0].StartsWith("/"))
+            {
+                // No mode specified. Use default mode.
+                return Mode.FullAnalyze;
+            }
+            else
+            {
+                var modeArgument = args[0];
+                args = args.Skip(1).ToArray();
+
+                if (!Enum.TryParse<Mode>(modeArgument, ignoreCase: true, result: out var mode))
+                {
+                    throw new ArgumentException("Invalid mode: " + modeArgument);
+                }
+
+                return mode;
+            }
+        }
+
+        private static bool HasModeFlag(Mode mode, Mode flag)
+        {
+            return (mode & flag) == flag;
+        }
+
         static void Main(string[] args)
         {
+            if (args.Length == 0)
+            {
+                // TODO: Add help text
+                Console.WriteLine("No arguments specified.");
+                return;
+            }
+
+            Mode mode = GetMode(ref args);
+
             Arguments arguments = ParseArguments(args);

-            // download files
-            var client = new WebClient();
-            string downloadDirectory = Path.Combine(arguments.CodexOutputRoot, "zip");
-            string zipPath = Path.Combine(downloadDirectory, "Codex.zip");
-            Directory.CreateDirectory(downloadDirectory);
+            string codexBinDirectory = Path.Combine(arguments.CodexOutputRoot, "bin");
+            string analysisOutputDirectory = Path.Combine(arguments.CodexOutputRoot, "store");

-            Console.WriteLine("Downloading Files...");
-            client.DownloadFile("https://github.com/Ref12/Codex/releases/download/latest-prerel/Codex.zip", zipPath);
+            if (HasModeFlag(mode, Mode.Prepare))
+            {
+                // download files
+                var client = new WebClient();
+                string downloadDirectory = Path.Combine(arguments.CodexOutputRoot, "zip");
+                string zipPath = Path.Combine(downloadDirectory, "Codex.zip");
+                Directory.CreateDirectory(downloadDirectory);

-            // zip/unzip files
-            Console.WriteLine("Creating Directories");
-            string codexBin = Path.Combine(arguments.CodexOutputRoot, "bin");
-            Directory.CreateDirectory(codexBin);
-            Console.WriteLine("Extracting Zip Files");
-            ZipFile.ExtractToDirectory(zipPath, codexBin); // TODO doesnt work if the directory already exists?
+                Console.WriteLine("Downloading Files...");
+                client.DownloadFile("https://github.com/Ref12/Codex/releases/download/latest-prerel/Codex.zip", zipPath);

-            // run exe
-            Console.WriteLine("Running Process");
-            string executablePath = Path.Combine(codexBin, "Codex.exe");
-            string analysisOutputDirectory = Path.Combine(arguments.CodexOutputRoot, "store");
-            Process runExe = Process.Start(new ProcessStartInfo(executablePath, string.Join(" ",
-                "index",
-                "-save",
-                analysisOutputDirectory,
-                "-p",
-                arguments.SourcesDirectory,
-                "-repoUrl",
-                arguments.CodexRepoUrl,
-                "-n",
-                arguments.RepoName,
-                arguments.AdditionalCodexArguments))
+                // zip/unzip files
+                Console.WriteLine("Creating Directories");
+                Directory.CreateDirectory(codexBinDirectory);
+                Console.WriteLine("Extracting Zip Files");
+                ZipFile.ExtractToDirectory(zipPath, codexBinDirectory); // TODO: doesnt work if the directory already contains files
+
+                Console.WriteLine($"##vso[task.setvariable variable=CodexBinDir;]{codexBinDirectory}");
+                Console.WriteLine($"##vso[task.setvariable variable=CodexAnalysisOutDir;]{analysisOutputDirectory}");
+            }
+
+            if (HasModeFlag(mode, Mode.AnalyzeOnly))
             {
-                UseShellExecute = false
-            });
-            runExe.WaitForExit();
+                // run exe
+                Console.WriteLine("Running Process");
+                string executablePath = Path.Combine(codexBinDirectory, "Codex.exe");
+                Process runExe = Process.Start(new ProcessStartInfo(executablePath, string.Join(" ",
+                    "index",
+                    "-save",
+                    analysisOutputDirectory,
+                    "-p",
+                    arguments.SourcesDirectory,
+                    "-repoUrl",
+                    arguments.CodexRepoUrl,
+                    "-n",
+                    arguments.RepoName,
+                    arguments.AdditionalCodexArguments))
+                {
+                    UseShellExecute = false
+                });
+                runExe.WaitForExit();

-            // get json files and zip
-            Console.WriteLine("Zipping JSON files");
+                // get json files and zip
+                Console.WriteLine("Zipping JSON files");

-            string analysisOutputZip = analysisOutputDirectory + ".zip";
-            ZipFile.CreateFromDirectory(analysisOutputDirectory, analysisOutputZip);
+                string analysisOutputZip = analysisOutputDirectory + ".zip";
+                ZipFile.CreateFromDirectory(analysisOutputDirectory, analysisOutputZip);

-            // publish to a vsts build
-            Console.WriteLine("Publishing to Build");
-            Console.WriteLine($"##vso[artifact.upload artifactname=CodexOutputs;]{analysisOutputZip}");
-            Console.WriteLine("##vso[build.addbuildtag]CodexOutputs");
-
-
+                // publish to a vsts build
+                Console.WriteLine("Publishing to Build");
+                Console.WriteLine($"##vso[artifact.upload artifactname=CodexOutputs;]{analysisOutputZip}");
+                Console.WriteLine("##vso[build.addbuildtag]CodexOutputs");
+            }
         }
     }
 }


Fixed Number formatting alongside html Type attribute

--- src/DotVVM.Framework/Controls/TextBox.cs
+++ src/DotVVM.Framework/Controls/TextBox.cs
@@ -125,11 +125,21 @@

         protected internal override void OnPreRender(IDotvvmRequestContext context)
         {
-            isFormattingRequired = !string.IsNullOrEmpty(FormatString) ||
-                #pragma warning disable
+            if (!string.IsNullOrEmpty(FormatString) && (Type == TextBoxType.Number || Type == TextBoxType.Date))
+            {
+                throw new NotSupportedException($"Property StringFormat cannot be used with Type set to '{ Type }'." +
+                    $" In this case browsers localize '{ Type }' themselves.");
+            }
+
+            // Don't format <input type="Number" ... browsers expect
+            // value in specific format and localization breaks it
+            isFormattingRequired =  Type != TextBoxType.Number &&
+                (!string.IsNullOrEmpty(FormatString) ||
+#pragma warning disable
                 ValueType != FormatValueType.Text ||
-                #pragma warning restore
-                NeedsFormatting(GetValueBinding(TextProperty));
+#pragma warning restore
+                NeedsFormatting(GetValueBinding(TextProperty)));
+
             if (isFormattingRequired)
             {
                 context.ResourceManager.AddCurrentCultureGlobalizationResource();


Close #47: Already fixed with commit c7255be6f9e3f2ba923ca5cf45ba79883f786c6d for issue #46

--- src/FLS.Server.Data/DbEntities/Flight.cs
+++ src/FLS.Server.Data/DbEntities/Flight.cs
@@ -217,7 +217,7 @@

             if (currentFlightAirStateId <= (int)FLS.Data.WebApi.Flight.FlightAirState.Started)
             {
-                // not started or just started flights do not have a landing
+                // not or might be started or just started flights do not have a landing
                 return 0;
             }


Cleanup and documentation.

Cleanup and documentation.

--- src/GitHub.VisualStudio/GitHubPackage.cs
+++ src/GitHub.VisualStudio/GitHubPackage.cs
@@ -13,6 +13,7 @@
 using Microsoft.VisualStudio.Shell.Interop;
 using Microsoft.VisualStudio.TextManager.Interop;
 using Octokit;
+using IConnection = GitHub.Models.IConnection;

 namespace GitHub.VisualStudio
 {
@@ -57,29 +58,28 @@
                 (s, e) =>
                 {
                     // All this code should get moved somewhere else, not sure where though, any pointers?!
-                    var highlightedText = GetHighlightedText();
+                    IsUserLoggedIn().ContinueWith(async isLoggedIn =>
+                    {
+                        // Log in the user if they are not already logged in.
+                        if (!isLoggedIn.Result)
+                        {
+                            // Can we use the Authentication UIControllerFlow here and wait for a successful authentication before proceeding?
+                        }

-                    var repoHosts = ServiceProvider.GetExportedValue<IRepositoryHosts>();
-                    var connMgr = ServiceProvider.GetExportedValue<IConnectionManager>();
+                        var highlightedText = GetHighlightedText();

-                    // If the user is logged in, go ahead and create the gist
-                    connMgr
-                        .IsLoggedIn(repoHosts)
-                        .Where(isLoggedIn => isLoggedIn)
-                        .Subscribe(async _ =>
-                        {
-                            // It may be useful to return the created gist if we support an "Open Gist in GitHub" checkbox feature
-                            // that will auto open the newly created Gist if checked.
-                            var createdGist = await
-                                CreateGist("NameWillBeEnteredInThePopup", "DescriptionWillBeEnteredInThePopup", true,
-                                    highlightedText);
-                        });
+                        // TODO Show a popup with
+                        //  - TextBox to name the gist
+                        //  - TextBox to give the gist a description
+                        //  - Checkbox for public gist
+                        //  - Not sure about this one, but may be nice to open the newly created gist in GitHub checkbox
+                        //  - Not sure if we really need to re-display the selected text as it should still be selected in the text editor.

-                    // If the user is not logged in, we need to log them in before we can create the gist. Can we use the existing login workflow here somehow?
-                    connMgr
-                        .IsLoggedIn(repoHosts)
-                        .Where(isLoggedIn => !isLoggedIn)
-                        .Subscribe(_ => { });
+                        // It may be useful to return the created gist if we support an "Open Gist in GitHub" checkbox feature
+                        // that will auto open the newly created Gist if checked.
+                        var createdGist = await CreateGist("NameWillBeEnteredInThePopup",
+                            "DescriptionWillBeEnteredInThePopup", true, highlightedText);
+                    });
                 });

             ServiceProvider.AddTopLevelMenuItem(GuidList.guidGitHubCmdSet, PkgCmdIDList.showGitHubPaneCommand, (s, e) =>
@@ -117,11 +117,17 @@
             return highlightedText;
         }

+        async Task<bool> IsUserLoggedIn()
+        {
+            var repoHosts = ServiceProvider.GetExportedValue<IRepositoryHosts>();
+            var connMgr = ServiceProvider.GetExportedValue<IConnectionManager>();
+
+            return await connMgr.IsLoggedIn(repoHosts);
+        }
+
         async Task<Gist> CreateGist(string name, string description, bool isPublic, string content)
         {
             Guard.ArgumentNotEmptyString(name, nameof(name));
-            Guard.ArgumentNotEmptyString(description, nameof(description));
-            Guard.ArgumentNotEmptyString(content, nameof(content));

             var newGist = new NewGist
             {


Fix #2881: Host crashes after interrupting, then running another command

Detect when a ReadConsole callback was interrupted via CancelAll, and handle that case appropriately.

--- src/Host/Client/Impl/Session/RSession.cs
+++ src/Host/Client/Impl/Session/RSession.cs
@@ -6,6 +6,8 @@
 using System.Diagnostics;
 using System.IO;
 using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Runtime.Serialization;
 using System.Threading;
 using System.Threading.Tasks;
 using System.Threading.Tasks.Dataflow;
@@ -214,7 +216,7 @@
                     await _host.CancelAllAsync(cancellationToken);
                 } finally {
                     // Even if cancellationToken.IsCancellationRequested == true, we can't find out if request was fully completed or not, so we consider it canceled
-                    currentRequest?.TryCancel(exception);
+                    currentRequest?.TryCancel(new CancelAllException(exception.Message, exception));
                 }
             }
         }
@@ -553,11 +555,16 @@
                 ct.ThrowIfCancellationRequested();
                 try {
                     consoleInput = await ReadNextRequest(Prompt, len, ct);
-                } catch (OperationCanceledException) {
+                } catch (OperationCanceledException ex) when (!(ex is CancelAllException)) {
                     // If request was canceled through means other than our token, it indicates the refusal of
                     // that requestor to respond to that particular prompt, so move on to the next requestor.
                     // If it was canceled through the token, then host itself is shutting down, and cancellation
                     // will be propagated on the entry to next iteration of this loop.
+                    //
+                    // If request was canceled due to CancelAllAsync, then we should not continue to process this
+                    // ReadConsole call at all. Under normal conditions, ct will also be marked as canceled; but
+                    // there is a potential for a race condition where we get a cancellation exception here, but
+                    // ct is not marked as canceled yet. Explicitly checking for CancelAllException handles this.
                 }
             } while (consoleInput == null);

@@ -787,5 +794,24 @@
                 _hostToSwitch?.Dispose();
             }
         }
+
+        // A custom exception type for the sole purpose of distinguishing cancellation of ReadConsole
+        // due to CancelAllAsync from all other cases, and special handling of the former.
+        [Serializable]
+        private class CancelAllException : OperationCanceledException {
+            public CancelAllException() { }
+
+            public CancelAllException(string message) : base(message) { }
+
+            public CancelAllException(string message, Exception innerException) : base(message, innerException) { }
+
+            public CancelAllException(CancellationToken token) : base(token) { }
+
+            public CancelAllException(string message, CancellationToken token) : base(message, token) { }
+
+            public CancelAllException(string message, Exception innerException, CancellationToken token) : base(message, innerException, token) { }
+
+            protected CancelAllException(SerializationInfo info, StreamingContext context) : base(info, context) { }
+        }
     }
 }


Update Animation.cs

Update Animation.cs

added XML comments

--- src/Animation.cs
+++ src/Animation.cs
@@ -11,10 +11,16 @@

 namespace ReactiveAnimation
 {
+	/// <summary>
+	/// Used to create a new animation, with a set duration and specific easing function, that can then be used to tween multiple properties.
+	/// </summary>
 	public class Animation : IDisposable
 	{
 		public const int FrameRate = 60;
-
+
+		/// <summary>
+		/// An observable that pulses on every frame.
+		/// </summary>
 		public static readonly IObservable<long> EveryFrame = Observable.Interval(TimeSpan.FromMilliseconds((double)1000 / (double)FrameRate)) // create a cold observable
 																		.Publish().RefCount(); // only pulse while subscribers are connected
 		/// <summary>
@@ -59,7 +65,10 @@
 		}

 		internal Subject<float> _progress;
-
+
+		/// <summary>
+		/// An observable that pulses on every frame while the animation is running, with the eased percentage completion of the animation.
+		/// </summary>
 		public IObservable<float> Progress
 		{
 			get
@@ -70,7 +79,7 @@
 		public Func<double, float> EasingFunction { get; set; }
 		internal CancellationTokenSource _cancelProgress;
 		//x internal List<CancellationTokenSource> _cancelChildren;
-
+
 		public bool IsRunning
 		{
 			get
@@ -160,7 +169,10 @@
 			Pause();
 			GoToSpecificFrame(DurationInFrames);
 		}
-
+
+		/// <summary>
+		/// Contains useful information about the progress of specific values in the animation.
+		/// </summary>
 		public struct AnimationProgress
 		{
 			public string Key { get; internal set; }


Reset identify button if process has exited

--- APE.Spy/APE.Spy/APE.Spy.cs
+++ APE.Spy/APE.Spy/APE.Spy.cs
@@ -352,6 +352,15 @@

         private void IdentifyButton_Click(object sender, EventArgs e)
         {
+            m_CurrentAttached = (KeyValuePair<Process, string>)WinformsProcessesCombobox.SelectedItem;
+
+            if (m_CurrentAttached.Key.HasExited)
+            {
+                WinformsProcessesCombobox.SelectedIndex = 0;
+                Populate();
+                return;
+            }
+
             IdentifyButton.Enabled = false;
             WinformsProcessesCombobox.Enabled = false;
             label1.Text = "Move the mouse cursor over the desired window and then press the control key";


Fixed two sprite bugs:  1. Frames would not be carved if the source surface was exactly the right size 2. Sprites with only one frame would sometimes crash.

--- AgateLib/Sprites/Sprite.cs
+++ AgateLib/Sprites/Sprite.cs
@@ -363,7 +363,7 @@
 					location.Y += size.Height;
 				}

-			} while (location.Y + size.Height < surface.SurfaceHeight);
+			} while (location.Y + size.Height <= surface.SurfaceHeight);

 		}

@@ -756,7 +756,7 @@
 			get { return mCurrentFrameIndex; }
 			set
 			{
-				if (mFrames.Count == 0)
+				if (mFrames.Count <= 1)
 				{
 					mCurrentFrameIndex = 0;
 					return;


Fixed a bug with setting the trace level via config file.

--- src/Magellan/Diagnostics/TraceSources.cs
+++ src/Magellan/Diagnostics/TraceSources.cs
@@ -28,12 +28,7 @@

         private static TraceSource CreateTraceSource(string name)
         {
-            var source = new TraceSource(name);
-#if SILVERLIGHT
-            source.Switch.Level = SourceLevels.Off;
-#else
-            source.Switch.Level = SourceLevels.Warning;
-#endif
+            var source = new TraceSource(name, SourceLevels.Warning);
             return source;
         }
     }


Handle ObjectDisposedException in ServerSession.TryResetConnectionAsync

Signed-off-by: Laurent Jeancler <3b9cd2d73d410a863ae106f8325ff0bb064414ea@green-acres.com>

--- src/MySqlConnector/Core/ServerSession.cs
+++ src/MySqlConnector/Core/ServerSession.cs
@@ -542,6 +542,10 @@
 			catch (IOException ex)
 			{
 				Log.Debug(ex, "Session{0} ignoring IOException in TryResetConnectionAsync", m_logArguments);
+			}
+			catch (ObjectDisposedException ex)
+			{
+				Log.Debug(ex, "Session{0} ignoring ObjectDisposedException in TryResetConnectionAsync", m_logArguments);
 			}
 			catch (SocketException ex)
 			{


(ABMP): moved reader to separate class.

(ABMP): moved reader to separate class.

--- ArcFormats/Qlie/ArcABMP.cs
+++ ArcFormats/Qlie/ArcABMP.cs
@@ -2,7 +2,7 @@
 //! \date       Wed Oct 28 02:51:46 2015
 //! \brief      QLIE mulit-frame images.
 //
-// Copyright (C) 2015 by morkt
+// Copyright (C) 2015-2017 by morkt
 //
 // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to
@@ -23,13 +23,13 @@
 // IN THE SOFTWARE.
 //

-using GameRes.Utility;
+using System;
 using System.Collections.Generic;
 using System.ComponentModel.Composition;
 using System.IO;
-using System.Linq;
 using System.Text;
 using System.Text.RegularExpressions;
+using GameRes.Utility;

 namespace GameRes.Formats.Qlie
 {
@@ -52,50 +52,88 @@
             int version = file.View.ReadByte (4) * 10 + file.View.ReadByte (5) - '0' * 11;
             if (file.View.ReadByte (6) != 0 || version < 10 || version > 12)
                 return null;
-            string base_name = Path.GetFileNameWithoutExtension (file.Name);
-            uint offset = 0x10;
-            var dir = new List<Entry>();
+            using (var reader = new AbmpReader (file, version))
+            {
+                var dir = reader.ReadIndex();
+                if (null == dir || 0 == dir.Count)
+                    return null;
+                return new ArcFile (file, this, dir);
+            }
+        }
+
+        public override Stream OpenEntry (ArcFile arc, Entry entry)
+        {
+            if (0xFF435031 != arc.File.View.ReadUInt32 (entry.Offset))
+                return base.OpenEntry (arc, entry);
+            var data = arc.File.View.ReadBytes (entry.Offset, entry.Size);
+            data = PackOpener.Decompress (data) ?? data;
+            return new BinMemoryStream (data, entry.Name);
+        }
+    }
+
+    internal sealed class AbmpReader : IDisposable
+    {
+        ArcView             m_file;
+        IBinaryStream       m_input;
+        string              m_base_name;
+        int                 m_version;
+        List<Entry>         m_dir;
+
+        public AbmpReader (ArcView file, int version)
+        {
+            m_file = file;
+            m_input = file.CreateStream();
+            m_base_name = Path.GetFileNameWithoutExtension (file.Name);
+            m_version = version;
+            m_dir = new List<Entry>();
+        }
+
+        public List<Entry> ReadIndex ()
+        {
+            m_input.Position = 0x10;
             int n = 0;
             var type_buf = new byte[0x10];
-            while (offset < file.MaxOffset)
-            {
-                if (0x10 != file.View.Read (offset, type_buf, 0, 0x10))
-                    break;
-                offset += 0x10;
+            while (0x10 == m_input.Read (type_buf, 0, 0x10))
+            {
                 if (Binary.AsciiEqual (type_buf, "abdata"))
                 {
+                    uint size = m_input.ReadUInt32();
                     var entry = new Entry {
-                        Name = string.Format ("{0}#{1}.dat", base_name, n++),
-                        Offset = offset + 4,
-                        Size = file.View.ReadUInt32 (offset),
+                        Name = string.Format ("{0}#{1}.dat", m_base_name, n++),
+                        Offset = m_input.Position,
+                        Size = size,
                     };
-                    dir.Add (entry);
-                    offset += 4 + entry.Size;
+                    m_dir.Add (entry);
+                    Skip (size);
                 }
-                else if (Binary.AsciiEqual (type_buf, "abimage10\0")
-                         || Binary.AsciiEqual (type_buf, "absound10\0"))
+                else if (Binary.AsciiEqual (type_buf, "abimage10\0") ||
+                         Binary.AsciiEqual (type_buf, "absound10\0"))
                 {
-                    int count = file.View.ReadByte (offset++);
-                    for (int i = 0; i < count && offset < file.MaxOffset; ++i)
+                    int count = m_input.ReadByte();
+                    for (int i = 0; i < count; ++i)
                     {
-                        file.View.Read (offset, type_buf, 0, 0x10);
+                        if (0x10 != m_input.Read (type_buf, 0, 0x10))
+                            break;
                         var tag = Binary.GetCString (type_buf, 0, 0x10, Encoding.ASCII);
                         string name = null;
                         if ("abimgdat15" == tag)
                         {
-                            uint name_length = file.View.ReadUInt16 (offset+0x14);
-                            offset += 0x16;
+                            Skip (4);
+                            int name_length = m_input.ReadUInt16();
                             if (name_length > 0)
                             {
-                                var name_bytes = file.View.ReadBytes (offset, name_length*2);
+                                var name_bytes = m_input.ReadBytes (name_length*2);
                                 name = Encoding.Unicode.GetString (name_bytes);
-                                offset += name_length*2;
-                            }
-                            name_length = file.View.ReadUInt16 (offset);
-                            if (name_length > 0 && string.IsNullOrEmpty (name))
-                                name = file.View.ReadString (offset+2, name_length);
-                            offset += 2 + name_length;
-                            byte type = file.View.ReadByte (offset);
+                            }
+                            name_length = m_input.ReadUInt16();
+                            if (name_length > 0)
+                            {
+                                if (string.IsNullOrEmpty (name))
+                                    name = m_input.ReadCString (name_length);
+                                else
+                                    Skip ((uint)name_length);
+                            }
+                            byte type = m_input.ReadUInt8();
                             /*
                             case 0:   ".bmp"
                             case 1:   ".jpg"
@@ -107,76 +145,65 @@
                             case 7:   ".ogv"
                             case 8:   ".mdl"
                             */
-                            offset += 0x12;
+                            Skip (0x11);
                         }
                         else
                         {
-                            uint name_length = file.View.ReadUInt16 (offset+0x10);
-                            name = file.View.ReadString (offset+0x12, name_length);
-                            offset += 0x12 + name_length;
+                            int name_length = m_input.ReadUInt16();
+                            name = m_input.ReadCString (name_length);

                             if (tag != "abimgdat10" && tag != "absnddat10")
                             {
-                                offset += 2u + file.View.ReadUInt16 (offset);
+                                Skip (m_input.ReadUInt16());
                                 if ("abimgdat13" == tag)
-                                    offset += 0x0C;
+                                    Skip (0x0C);
                                 else if ("abimgdat14" == tag)
-                                    offset += 0x4C;
-                            }
-                            ++offset;
+                                    Skip (0x4C);
+                            }
+                            m_input.ReadByte();
                         }
-                        var size = file.View.ReadUInt32 (offset);
-                        offset += 4;
+                        var size = m_input.ReadUInt32();
                         if (0 != size)
                         {
                             if (string.IsNullOrEmpty (name))
-                                name = string.Format ("{0}#{1}", base_name, n++);
+                                name = string.Format ("{0}#{1}", m_base_name, n++);
                             else
                                 name = s_InvalidChars.Replace (name, "_");
                             var entry = new Entry {
                                 Name = name,
                                 Type = tag.StartsWith ("abimg") ? "image" : tag.StartsWith ("absnd") ? "audio" : "",
-                                Offset = offset,
+                                Offset = m_input.Position,
                                 Size = size,
                             };
-                            if (entry.CheckPlacement (file.MaxOffset))
-                            {
-                                DetectFileType (file, entry);
-                                dir.Add (entry);
+                            if (entry.CheckPlacement (m_file.MaxOffset))
+                            {
+                                DetectFileType (m_file, entry);
+                                m_dir.Add (entry);
                             }
                         }
-                        offset += size;
+                        Skip (size);
                     }
                 }
                 else
                 {
                     var entry = new Entry {
-                        Name = string.Format ("{0}#{1}#{2}", base_name, n++, GetTypeName (type_buf)),
-                        Offset = offset,
-                        Size = (uint)(file.MaxOffset - offset),
+                        Name = string.Format ("{0}#{1}#{2}", m_base_name, n++, GetTypeName (type_buf)),
+                        Offset = m_input.Position,
+                        Size = (uint)(m_file.MaxOffset - m_input.Position),
                     };
-                    dir.Add (entry);
-                    offset += entry.Size;
+                    m_dir.Add (entry);
+                    Skip (entry.Size);
                 }
             }
-            if (0 == dir.Count)
-                return null;
-            return new ArcFile (file, this, dir);
-        }
-
-        public override Stream OpenEntry (ArcFile arc, Entry entry)
-        {
-            if (0xFF435031 != arc.File.View.ReadUInt32 (entry.Offset))
-                return base.OpenEntry (arc, entry);
-            var packed = new byte[entry.Size];
-            arc.File.View.Read (entry.Offset, packed, 0, entry.Size);
-            var unpacked = PackOpener.Decompress (packed);
-            if (null == unpacked)
-                unpacked = packed;
-            return new BinMemoryStream (unpacked, entry.Name);
-        }
-
-        static protected void DetectFileType (ArcView file, Entry entry)
+            return m_dir;
+        }
+
+        void Skip (uint amount)
+        {
+            m_input.Seek (amount, SeekOrigin.Current);
+        }
+
+        static internal void DetectFileType (ArcView file, Entry entry)
         {
             uint signature = file.View.ReadUInt32 (entry.Offset);
             var res = AutoEntry.DetectFileType (signature);
@@ -200,6 +227,18 @@
         }

         static readonly Regex s_InvalidChars = new Regex (@"[:/\\*?]");
+
+        #region IDisposable Members
+        bool _disposed = false;
+        public void Dispose ()
+        {
+            if (!_disposed)
+            {
+                m_input.Dispose();
+                _disposed = true;
+            }
+        }
+        #endregion
     }

     [Export(typeof(ArchiveFormat))]
@@ -244,7 +283,7 @@
                 };
                 if (!entry.CheckPlacement (file.MaxOffset))
                     break;
-                DetectFileType (file, entry);
+                AbmpReader.DetectFileType (file, entry);
                 dir.Add (entry);
                 offset += size;
             }


Fixed another garbage collection issue

Fixed another garbage collection issue

--- Assets/NewtonVR/NVRHand.cs
+++ Assets/NewtonVR/NVRHand.cs
@@ -228,8 +228,10 @@
         {
             if (CurrentHandState == HandState.Idle)
             {
-                foreach (var hoveringOver in CurrentlyHoveringOver)
-                {
+                var hoveringEnumerator = CurrentlyHoveringOver.GetEnumerator();
+                while (hoveringEnumerator.MoveNext())
+                {
+                    var hoveringOver = hoveringEnumerator.Current;
                     if (hoveringOver.Value.Count > 0)
                     {
                         hoveringOver.Key.HoveringUpdate(this, Time.time - hoveringOver.Value.OrderBy(colliderTime => colliderTime.Value).First().Value);


Dispatch mouse move events simultaneously with touch drag events

--- MonoGdx/XnaInput.cs
+++ MonoGdx/XnaInput.cs
@@ -117,13 +117,16 @@

             if (state.Position != _oldMouseState.Position) {
                 TouchEvent ev = ObtainTouchEvent(ref state);
+                ev.Type = TouchEventType.Moved;
+                _touchEvents.Add(ev);
+
                 if (state.LeftButton == ButtonState.Pressed
                     || state.MiddleButton == ButtonState.Pressed
-                    || state.RightButton == ButtonState.Pressed)
+                    || state.RightButton == ButtonState.Pressed) {
+                    ev = ObtainTouchEvent(ref state);
                     ev.Type = TouchEventType.Dragged;
-                else
-                    ev.Type = TouchEventType.Moved;
-                _touchEvents.Add(ev);
+                    _touchEvents.Add(ev);
+                }
             }

             if (state.ScrollWheelValue != _oldMouseState.ScrollWheelValue) {


Use the Count property for ICollection optimization

--- MoreLinq/AtLeast.cs
+++ MoreLinq/AtLeast.cs
@@ -54,7 +54,7 @@
             var collection = source as ICollection<TSource>;
             if (collection != null)
             {
-                return collection.Count() >= count;
+                return collection.Count >= count;
             }

             return source.Take(count).Count() == count;


Orleans.Core: Added checks for period >= maximum period of internal timer in SafeTimerBase. (#7782)

* Orleans.Core: Added checks for period >= maximum period of internal timer in SafeTimerBase.

* Orleans.Core: Reworked logic to fit the logic in System.Threading.

--- src/Orleans.Core/Timers/SafeTimerBase.cs
+++ src/Orleans.Core/Timers/SafeTimerBase.cs
@@ -12,6 +12,7 @@
     {
         private const string asyncTimerName ="Orleans.Runtime.AsyncTaskSafeTimer";
         private const string syncTimerName = "Orleans.Runtime.SafeTimerBase";
+        private const uint MaxSupportedTimeout = 0xfffffffe;

         private Timer               timer;
         private Func<object, Task>  asyncTaskCallback;
@@ -49,7 +50,15 @@
         {
             if (timerStarted) throw new InvalidOperationException(String.Format("Calling start on timer {0} is not allowed, since it was already created in a started mode with specified due.", GetFullName()));
             if (period == TimeSpan.Zero) throw new ArgumentOutOfRangeException("period", period, "Cannot use TimeSpan.Zero for timer period");
-
+
+            long dueTm = (long)dueTime.TotalMilliseconds;
+            if (dueTm < -1) throw new ArgumentOutOfRangeException(nameof(dueTime), "The due time must not be less than -1.");
+            if (dueTm > MaxSupportedTimeout) throw new ArgumentOutOfRangeException(nameof(dueTime), "The due time interval must be less than 2^32-2.");
+
+            long periodTm = (long)period.TotalMilliseconds;
+            if (periodTm < -1) throw new ArgumentOutOfRangeException(nameof(period), "The period must not be less than -1.");
+            if (periodTm > MaxSupportedTimeout) throw new ArgumentOutOfRangeException(nameof(period), "The period interval must be less than 2^32-2.");
+
             timerFrequency = period;
             dueTime = due;
             timerStarted = true;
@@ -63,6 +72,14 @@
             int numNonNulls = (asynCallback != null ? 1 : 0) + (synCallback != null ? 1 : 0);
             if (numNonNulls > 1) throw new ArgumentNullException("synCallback", "Cannot define more than one timer callbacks. Pick one.");
             if (period == TimeSpan.Zero) throw new ArgumentOutOfRangeException("period", period, "Cannot use TimeSpan.Zero for timer period");
+
+            long dueTm = (long)dueTime.TotalMilliseconds;
+            if (dueTm < -1) throw new ArgumentOutOfRangeException(nameof(dueTime), "The due time must not be less than -1.");
+            if (dueTm > MaxSupportedTimeout) throw new ArgumentOutOfRangeException(nameof(dueTime), "The due time interval must be less than 2^32-2.");
+
+            long periodTm = (long)period.TotalMilliseconds;
+            if (periodTm < -1) throw new ArgumentOutOfRangeException(nameof(period), "The period must not be less than -1.");
+            if (periodTm > MaxSupportedTimeout) throw new ArgumentOutOfRangeException(nameof(period), "The period interval must be less than 2^32-2.");

             this.asyncTaskCallback = asynCallback;
             syncCallbackFunc = synCallback;


Remove conditional override of IsSingleByte as we'll only define the ASCIIEncoding class on target frameworks that do not support this override.

--- src/Renci.SshNet/Common/ASCIIEncoding.cs
+++ src/Renci.SshNet/Common/ASCIIEncoding.cs
@@ -191,19 +191,6 @@

             return byteCount;
         }
-
-#if !SILVERLIGHT && !WINDOWS_PHONE
-        /// <summary>
-        /// Gets a value indicating whether the current encoding uses single-byte code points
-        /// </summary>
-        /// <value>
-        /// This property is always <c>true</c>.
-        /// </value>
-        public override bool IsSingleByte
-        {
-            get { return true; }
-        }
-#endif // !SILVERLIGHT && !WINDOWS_PHONE
     }
 }


updated logging of jobs to cover all parts and use the correct logger

--- src/SFA.DAS.EmployerFinance.Jobs/Jobs.cs
+++ src/SFA.DAS.EmployerFinance.Jobs/Jobs.cs
@@ -14,38 +14,65 @@
     {
         public static Task ImportLevyDeclarations([TimerTrigger("0 0 15 20 * *")] TimerInfo timer, TraceWriter logger)
         {
-            var messageSession = ServiceLocator.GetInstance<IMessageSession>();
-            return messageSession.Send(new ImportLevyDeclarationsCommand());
+            ILog nLogger = null;
+
+            try
+            {
+                nLogger = ServiceLocator.GetInstance<ILog>();
+
+                nLogger.Info("Getting message session for import levy declarations job");
+                var messageSession = ServiceLocator.GetInstance<IMessageSession>();
+
+                nLogger.Info("Creating new import levy declarations command for job");
+                return messageSession.Send(new ImportLevyDeclarationsCommand());
+            }
+            catch (Exception e)
+            {
+                nLogger?.Error(e, "Failed to create new import levy declarations command for job");
+                throw;
+            }
         }

         public static Task ImportPayments([TimerTrigger("0 0 * * * *")] TimerInfo timer, TraceWriter logger)
         {
             ILog nLogger = null;
+
             try
             {
                 nLogger = ServiceLocator.GetInstance<ILog>();
-
-                logger.Info("[TraceWriter] - About to create new import payment command");
-                nLogger.Info("[NLog] - Creating new import payment command");
+
+                nLogger.Info("Getting message session for import payments job");
                 var messageSession = ServiceLocator.GetInstance<IMessageSession>();
-
-
-                logger.Info("[TraceWriter] - Creating new import payment command");
-                nLogger.Info("[NLog] - Creating new import payment command");
+
+                nLogger.Info("Creating new import payment command for job");
                 return messageSession.Send(new ImportPaymentsCommand());
             }
             catch (Exception e)
             {
-                logger.Error("[TraceWriter] - Failed to create new import payment command", e);
-                nLogger?.Error(e, "[NLog] - Failed to create new import payment command");
+                nLogger?.Error(e, "Failed to create new import payment command for job");
                 throw;
             }
         }

         public static Task ProcessOutboxMessages([TimerTrigger("0 */10 * * * *")] TimerInfo timer, TraceWriter logger)
         {
-            var job = ServiceLocator.GetInstance<IProcessClientOutboxMessagesJob>();
-            return job.RunAsync();
+            ILog nLogger = null;
+
+            try
+            {
+                nLogger = ServiceLocator.GetInstance<ILog>();
+
+                nLogger.Info("Getting client outbox message job");
+                var job = ServiceLocator.GetInstance<IProcessClientOutboxMessagesJob>();
+
+                nLogger.Info("Running client outbox message job");
+                return job.RunAsync();
+            }
+            catch (Exception e)
+            {
+                nLogger?.Error(e, "Failed run client outbox message job");
+                throw;
+            }
         }
     }
 }


Formatting.

Formatting.

--- uhttpsharp-demo/Program.cs
+++ uhttpsharp-demo/Program.cs
@@ -17,7 +17,6 @@
  */

 using System;
-using System.Net.Sockets;
 using uhttpsharp;
 using uhttpsharp.Handlers;
 using uhttpsharpdemo.Handlers;
@@ -30,11 +29,13 @@
         {
             log4net.Config.XmlConfigurator.Configure();

-            using (var httpServer = new HttpServer(800, new HttpRequestProvider()))
+            using (var httpServer = new HttpServer(8000, new HttpRequestProvider()))
             {
                 httpServer.Use(new TimingHandler());
+
                 httpServer.Use(new HttpRouter().With(string.Empty, new IndexHandler())
-                                                .With("about", new AboutHandler()));
+                                               .With("about", new AboutHandler()));
+
                 httpServer.Use(new FileHandler());
                 httpServer.Use(new ErrorHandler());


Updated tests to validate HeartActivitiesIntradayTimeSeries

--- Fitbit.Portable.Tests/HeartRateTests.cs
+++ Fitbit.Portable.Tests/HeartRateTests.cs
@@ -9,6 +9,7 @@
 using Fitbit.Api.Portable.Models;
 using Fitbit.Models;
 using FluentAssertions;
+using Newtonsoft.Json;
 using NUnit.Framework;

 namespace Fitbit.Portable.Tests
@@ -109,34 +110,54 @@
         [Category("Portable")]
         public void Can_Deserialize_HeartRateIntradayTimeSeries()
         {
-            string content = SampleDataHelper.GetContent("GetHeartRateIntradayTimeSeries.json");
-            var deserializer = new JsonDotNetSerializer {RootProperty = "activities-heart-intraday"};
+            //assemble
+            string content = SampleDataHelper.GetContent("GetHeartRateIntradayTimeSeries1.1.json");

-            HeartActivitiesIntradayTimeSeries stats = deserializer.Deserialize<HeartActivitiesIntradayTimeSeries>(content);
+            //act
+            HeartActivitiesIntradayTimeSeries stats = JsonConvert.DeserializeObject<HeartActivitiesIntradayTimeSeries>(content);

+            //assert
             ValidateHeartRateTimeSeriesData(stats);
         }

         private void ValidateHeartRateTimeSeriesData(HeartActivitiesIntradayTimeSeries activity)
         {
-            activity.Dataset.First().Time.TimeOfDay.Should().Be(new TimeSpan(0,0,0,0));
-            activity.Dataset.First().Value.Should().Be(58);
+            //Activities Heart Intraday
+            var actIntraday = activity.ActivitiesHeartIntraday;
+
+            actIntraday.Dataset.Count().Should().Be(96);
+            actIntraday.Dataset[0].Time.TimeOfDay.Should().Be(new TimeSpan(0,0,0,0)); //First entry
+            actIntraday.Dataset[0].Value.Should().Be(57);
+            actIntraday.Dataset[95].Time.TimeOfDay.Should().Be(new TimeSpan(0, 23,45, 0)); //Last entry
+            actIntraday.Dataset[95].Value.Should().Be(47);
+
+            actIntraday.DatasetInterval.Should().Be(15);
+
+            actIntraday.DatasetType.Should().Be("minute");
+
+            //Activities Heart
+            var act = activity.ActivitiesHeart.First();
+
+            act.DateTime.Should().Be(new DateTime(2017, 8, 21));
+
+            act.HeartRateZones.Count().Should().Be(4);
+            act.HeartRateZones[0].CaloriesOut.Should().Be(2071.96748);
+            act.HeartRateZones[0].Max.Should().Be(92);
+            act.HeartRateZones[0].Min.Should().Be(30);
+            act.HeartRateZones[0].Minutes.Should().Be(1387);
+            act.HeartRateZones[0].Name.Should().Be("Out of Range");
+
+            act.CustomHeartRateZones.Count().Should().Be(0);
+
+            act.Value.Should().Be(55.44);
+
         }

         private void ValidateHeartRateTimeSeriesData(List<HeartActivitiesTimeSeries> activities)
         {
             var activity = activities.First();

-            activity.DateTime.Should().Be(new DateTime(2017, 6, 29));
-            //activity.Value.CustomHeartRateZones
-
-            //activity.Value.HeartRateZones.First().CaloriesOut.Should().Be(1693.83222);
-            activity.Value.HeartRateZones.First().Max.Should().Be(95);
-            activity.Value.HeartRateZones.First().Min.Should().Be(30);
-            activity.Value.HeartRateZones.First().Minutes.Should().Be(1122);
-            activity.Value.HeartRateZones.First().Name.Should().Be("Out of Range");
-
-            activity.Value.RestingHeartRate.Should().Be(59);
+
         }
     }
 }


Commit to branch Development test

Commit to branch Development test

--- 05.GitHub/Program.cs
+++ 05.GitHub/Program.cs
@@ -4,9 +4,10 @@
 {
     class Program
     {
-        static void Main(string[] args)
+        static void Main()
         {
-            Console.WriteLine("Develop");
+			var i = 0;
+			Console.WriteLine("My number is" + );
         }
     }
 }


missed class fixed

missed class fixed

--- samples/WebApp/Views/Blogifier/Admin/Custom/Index.cshtml
+++ samples/WebApp/Views/Blogifier/Admin/Custom/Index.cshtml
@@ -5,7 +5,7 @@
 }
 <link href="~/@themeFolder/lib/autocomplete/easy-autocomplete.min.css" rel="stylesheet" />

-

+


rename HttpResponse#_ConditionalSendHeader -> _ConditionalSendHeaders

--- Net/HttpResponse.cs
+++ Net/HttpResponse.cs
@@ -262,6 +262,7 @@
             _bufferOutput;

         private void _ConditionalSendHeader()
+        private void _ConditionalSendHeaders()
         {
             // If we've already begun responding, we've already
             // sent the headers, so we can just return.


define HttpResponse#_Write method, replace relevant if statements

--- Net/HttpResponse.cs
+++ Net/HttpResponse.cs
@@ -273,6 +273,17 @@
             _bufferOutput;
         private Encoding _encoding;

+        private void _Write(byte[] bytes)
+        {
+            if (this.BufferOutput)
+            {
+                _BufferedWrite(bytes);
+            }
+            else
+            {
+                _ChunkedNetworkWrite(bytes);
+            }
+        }
         private void _BufferedWrite(byte[] bytes)
         {
             _obstr.Write(bytes, 0, bytes.Length);
@@ -699,20 +710,7 @@
             // Send headers if necessary.
             _ConditionalSendHeaders();

-            // The function signature uses IEnumerable<byte>
-            // to ease use, but in the end we do need a byte
-            // array to pass to the streams.
-            var valueArray = value.ToArray();
-            // If output buffering is enabled, we need to write
-            // to a different stream.
-            if (this.BufferOutput)
-            {
-                _BufferedWrite(valueArray);
-            }
-            else
-            {
-                _ChunkedNetworkWrite(valueArray);
-            }
+            _Write(value is byte[] ? (byte[])value : value.ToArray());
         }
         /// <summary>
         /// Writes the provided values to the response in the


Fixes bugs in rounding DateTime values

Fixes bugs in rounding DateTime values

--- Common/Extensions.cs
+++ Common/Extensions.cs
@@ -235,6 +235,12 @@
         /// <returns>Rounded timespan</returns>
         public static TimeSpan Round(this TimeSpan time, TimeSpan roundingInterval, MidpointRounding roundingType)
         {
+            if (roundingInterval == TimeSpan.Zero)
+            {
+                // divide by zero exception
+                return time;
+            }
+
             return new TimeSpan(
                 Convert.ToInt64(System.Math.Round(
                     time.Ticks / (decimal)roundingInterval.Ticks,
@@ -264,6 +270,11 @@
         /// <returns>Rounded datetime</returns>
         public static DateTime RoundDown(this DateTime dateTime, TimeSpan interval)
         {
+            if (interval == TimeSpan.Zero)
+            {
+                // divide by zero exception
+                return dateTime;
+            }
             return dateTime.AddTicks(-(dateTime.Ticks % interval.Ticks));
         }

@@ -288,6 +299,11 @@
         /// <returns>Rounded datetime</returns>
         public static DateTime RoundUp(this DateTime time, TimeSpan d)
         {
+            if (d == TimeSpan.Zero)
+            {
+                // divide by zero exception
+                return time;
+            }
             return new DateTime(((time.Ticks + d.Ticks - 1) / d.Ticks) * d.Ticks);
         }