Text Encoding bug fix.

Text Encoding bug fix.

--- advanced-vod-workflow-functions/SubmitMediaJob.cs
+++ advanced-vod-workflow-functions/SubmitMediaJob.cs
@@ -124,7 +124,7 @@
                     if (mediaTask.configuration.StartsWith(base64encodedstringprefix))
                     {
                         byte[] b64decoded = Convert.FromBase64String(mediaTask.configuration.Substring(base64encodedstringprefix.Length));
-                        mediaTask.configuration = System.Text.Encoding.Unicode.GetString(b64decoded);
+                        mediaTask.configuration = System.Text.ASCIIEncoding.ASCII.GetString(b64decoded);
                     }
                     task = job.Tasks.AddNew(mediaTask.mediaTaskName, processor, mediaTask.configuration, TaskOptions.None);
                     if (mediaTask.additionalInputAssetIds != null)


Culture-invariant parsing fixes #482

Culture-invariant parsing fixes #482

--- src/AngleSharp/Html/InputTypes/BaseInputType.cs
+++ src/AngleSharp/Html/InputTypes/BaseInputType.cs
@@ -314,7 +314,7 @@
             {
                 try
                 {
-                    var regex = new Regex(pattern, RegexOptions.ECMAScript);
+                    var regex = new Regex(pattern, RegexOptions.ECMAScript | RegexOptions.CultureInvariant);
                     return !regex.IsMatch(value);
                 }
                 catch { }
@@ -330,7 +330,7 @@
         {
             if (!String.IsNullOrEmpty(value) && Number.IsMatch(value))
             {
-                return Double.Parse(value);
+                return Double.Parse(value, CultureInfo.InvariantCulture);
             }

             return null;
@@ -350,14 +350,14 @@
                 value[position++].IsDigit() &&
                 value[position++] == Symbols.Colon)
             {
-                var hour = Int32.Parse(value.Substring(offset, 2));
+                var hour = Int32.Parse(value.Substring(offset, 2), CultureInfo.InvariantCulture);

                 if (!IsLegalHour(hour) || !value[position++].IsDigit() || !value[position++].IsDigit())
                 {
                     return null;
                 }

-                var minute = Int32.Parse(value.Substring(3 + offset, 2));
+                var minute = Int32.Parse(value.Substring(3 + offset, 2), CultureInfo.InvariantCulture);

                 if (!IsLegalMinute(minute))
                 {
@@ -373,7 +373,7 @@
                         return null;
                     }

-                    second = Int32.Parse(value.Substring(6 + offset, 2));
+                    second = Int32.Parse(value.Substring(6 + offset, 2), CultureInfo.InvariantCulture);

                     if (!IsLegalSecond(second))
                     {
@@ -391,7 +391,7 @@
                         }

                         var fraction = value.Substring(start, position - start);
-                        ms = Int32.Parse(fraction) * (Int32)Math.Pow(10, 3 - fraction.Length);
+                        ms = Int32.Parse(fraction, CultureInfo.InvariantCulture) * (Int32)Math.Pow(10, 3 - fraction.Length);
                     }
                 }


Rightclick in menutree are working

Rightclick in menutree are working

--- src/DatenMeisterWPF/Forms/Lists/ListRequests.cs
+++ src/DatenMeisterWPF/Forms/Lists/ListRequests.cs
@@ -100,6 +100,11 @@
             viewDefinition.ViewExtensions.Add(new RowItemButtonDefinition("Show Items", ShowItems));

             viewDefinition.ViewExtensions.Add(
+                new TreeViewItemCommandDefinition(
+                    "New Extent",
+                    (x) => { LoadExtent(); }));
+
+            viewDefinition.ViewExtensions.Add(
                 new RibbonButtonDefinition(
                     "New Xmi Extent",
                     NewXmiExtent,


Revert formatting changes to RouteTableGroup

--- src/DotVVM.Framework/Routing/RouteTableGroup.cs
+++ src/DotVVM.Framework/Routing/RouteTableGroup.cs
@@ -7,24 +7,16 @@
 {
     public class RouteTableGroup
     {
-        public Action<string, RouteBase> AddToParentRouteTable { get; }
-
-        public string GroupName { get; }
-
-        public string RouteNamePrefix { get; }
-
-        public string UrlPrefix { get; }
-
-        public string VirtualPathPrefix { get; }
+        public Action<string, RouteBase> AddToParentRouteTable { get; private set; }

         public Func<IServiceProvider, IDotvvmPresenter> PresenterFactory { get; }

-        public RouteTableGroup(string groupName,
-            string routeNamePrefix,
-            string urlPrefix,
-            string virtualPathPrefix,
-            Action<string, RouteBase> addToParentRouteTable,
-            Func<IServiceProvider, IDotvvmPresenter> presenterFactory)
+        public string GroupName { get; private set; }
+        public string RouteNamePrefix { get; private set; }
+        public string UrlPrefix { get; private set; }
+        public string VirtualPathPrefix { get; private set; }
+
+        public RouteTableGroup(string groupName, string routeNamePrefix, string urlPrefix, string virtualPathPrefix, Action<string, RouteBase> addToParentRouteTable, Func<IServiceProvider, IDotvvmPresenter> presenterFactory)
         {
             GroupName = groupName;
             RouteNamePrefix = routeNamePrefix;


[xcode] Don't need pedantic. Do need to compile as C++ though to avoid an annoying warning

--- testpackages/HeaderLibraryTest/dev/HeaderLibraryTest.cs
+++ testpackages/HeaderLibraryTest/dev/HeaderLibraryTest.cs
@@ -15,8 +15,6 @@
         {
             var options = module.Options as C.ICCompilerOptions;
             options.IncludePaths.Include(this.PackageLocation, "include");
-            var c = module.Options as GccCommon.ICCompilerOptions;
-            c.Pedantic = false;
         }

         [C.HeaderFiles]


Updated data parser tests

Updated data parser tests

--- src/Ellipse.Parser.Tests/DataParserUnitTests.cs
+++ src/Ellipse.Parser.Tests/DataParserUnitTests.cs
@@ -1,5 +1,7 @@
 using System;
 using System.Collections.Generic;
+using System.IO;
+using Ellipse.DataDictionary.Models;
 using Ellipse.DataDictionary.Parsers;
 using Ellipse.DataDictionary.Parsers.Cobol;
 using Ellipse.DataDictionary.Parsers.Models;
@@ -115,16 +117,16 @@
         }

         [Test]
-        public void HierarchySystemTests()
-        {
-            IReader reader = new FileReader(@".\Resources\DataDictionary\datadict.rpt");
-            IModelParser[] parsers = new IModelParser[] {
-                    new AccessInformationParser(),
-                    new DescriptionParser(),
-                    new DetailsParser(),
-                    new ModifiedParser(),
-                    new ModuleParser(),
-                    new PageHeaderParser(),
+        public void HeaderSystemTests()
+        {
+            IReader reader = new FileReader(@".\Resources\DataDictionary\datadict.rpt");
+            IModelParser[] parsers = new IModelParser[] {
+                    new PageHeaderParser(),
+                    new AccessInformationParser(),
+                    new DescriptionParser(),
+                    new DetailsParser(),
+                    new ModifiedParser(),
+                    new ModuleParser(),
                     new RecordLengthParser(),
                     new RecordParser(),
                     new TechnicalInformationParser(),
@@ -138,6 +140,68 @@
                 throw new InvalidOperationException("No Parser for: " + reader);
             };
             dataParser.Parse();
+
+        }
+
+        [Test]
+        public void HierarchySystemTests()
+        {
+            IReader reader = new FileReader(@".\Resources\DataDictionary\datadict.rpt");
+            IModelParser[] parsers = new IModelParser[] {
+                    new AccessInformationParser(),
+                    new DescriptionParser(),
+                    new DetailsParser(),
+                    new ModifiedParser(),
+                    new ModuleParser(),
+                    new PageHeaderParser(),
+                    new RecordLengthParser(),
+                    new RecordParser(),
+                    new TechnicalInformationParser(),
+                    CobolParser.CobolHierarchy(),
+                    new IgnoreParser(),
+                };
+            IDataParser dataParser = new DataParser(reader, parsers);
+            dataParser.Corrections = corrections;
+            dataParser.OnMissingParser = (line) =>
+            {
+                throw new InvalidOperationException("No Parser for: " + reader);
+            };
+            dataParser.Parse();
+
+            string typename = GetType().Name;
+            string directory = Path.Combine(".", typename);
+
+            if (!Directory.Exists(directory))
+            {
+                Directory.CreateDirectory(directory);
+            }
+
+            foreach (IModel model in dataParser.Results)
+            {
+                HierarchyModel hiearchyModel = model as HierarchyModel;
+                if (hiearchyModel != null)
+                {
+                    ClassModel classModel = hiearchyModel.Model as ClassModel;
+                    if (classModel != null)
+                    {
+                        ModelXmlFormatter formatter = new ModelXmlFormatter(model);
+                        string xml = formatter.Render();
+                        string objectName = classModel.Data;
+
+                        string fileName = directory + @"\" + objectName + ".xml";
+                        if (File.Exists(fileName))
+                        {
+                            File.Delete(fileName);
+                        }
+
+                        Assert.That(File.Exists(fileName), Is.False);
+                        using (StreamWriter writer = new StreamWriter(fileName))
+                        {
+                            writer.Write(xml);
+                        }
+                    }
+                }
+            }
         }
     }
 }


Test service summary.

Test service summary.

--- tests/Facility.Definition.UnitTests/Fsd/ServiceTests.cs
+++ tests/Facility.Definition.UnitTests/Fsd/ServiceTests.cs
@@ -86,6 +86,25 @@
 		}

 		[Test]
+		public void ServiceSummary()
+		{
+			var service = TestUtility.ParseTestApi("/// test\n/// summary\nservice TestApi{}");
+
+			service.Summary.ShouldBe("test summary");
+
+			TestUtility.GenerateFsd(service).ShouldBe(new[]
+			{
+				"// DO NOT EDIT: generated by TestUtility",
+				"",
+				"/// test summary",
+				"service TestApi",
+				"{",
+				"}",
+				"",
+			});
+		}
+
+		[Test]
 		public void ServiceRemarks()
 		{
 			var service = TestUtility.ParseTestApi("service TestApi{}\n# TestApi\ntest\nremarks");


TESSST

TESSST

--- tests/Tgstation.Server.Tests/Instance/FunctionalTest.cs
+++ tests/Tgstation.Server.Tests/Instance/FunctionalTest.cs
@@ -86,7 +86,7 @@

 			daemonStatus = await instanceClient.DreamDaemon.Read(cancellationToken);
 			Assert.AreNotEqual(initialCompileJob.Id, daemonStatus.ActiveCompileJob.Id);
-			Assert.AreEqual(daemonStatus.ActiveCompileJob.Id, daemonStatus.StagedCompileJob.Id);
+			Assert.IsNull(daemonStatus.StagedCompileJob);

 			await instanceClient.DreamDaemon.Shutdown(cancellationToken);

@@ -94,7 +94,7 @@
 			Assert.IsFalse(daemonStatus.Running.Value);
 		}

-		async Task SendCommandHack(string message, bool useTgsGlobal, CancellationToken cancellationToken)
+		async Task SendCommandHack(string command, bool useTgsGlobal, CancellationToken cancellationToken)
 		{
 			// tricky part, we need to get tgs to reboot.
 			// We have a chat command to do this
@@ -132,7 +132,9 @@
 				},
 				cancellationToken);

-			await provider.SendMessage(channels.First().RealId, $"!{(useTgsGlobal ? "tgs" : builder.Nickname)} {message}", cancellationToken);
+			await provider.SendMessage(channels.First().RealId, $"{(useTgsGlobal ? "!tgs" : builder.Nickname)} help", cancellationToken);
+			await provider.SendMessage(channels.First().RealId, $"{(useTgsGlobal ? "!tgs" : builder.Nickname)} ? {command}", cancellationToken);
+			await provider.SendMessage(channels.First().RealId, $"{(useTgsGlobal ? "!tgs" : builder.Nickname)} {command}", cancellationToken);

 			// irc provider is weird


Validates user control directory in assembly browser

--- umbraco/presentation/umbraco/developer/Macros/assemblyBrowser.aspx.cs
+++ umbraco/presentation/umbraco/developer/Macros/assemblyBrowser.aspx.cs
@@ -41,6 +41,9 @@
                     isUserControl = true;
                     string fileName = Request.QueryString["fileName"];

+                    IOHelper.ValidateEditPath(fileName, SystemDirectories.Usercontrols);
+
+
                     if (System.IO.File.Exists(IOHelper.MapPath("~/" + fileName)))
                     {
                         UserControl oControl = (UserControl)LoadControl(@"~/" + fileName);


neatened up command executor as there is no point catching two different types of exception and handling them in the same way

--- src/crane.core/Commands/Execution/CommandExecutor.cs
+++ src/crane.core/Commands/Execution/CommandExecutor.cs
@@ -30,11 +30,6 @@
                 if (!(command is ListCommands))
                     _output.WriteSuccess("{0} success.", command.GetType().Name);
             }
-            catch (CraneException craneException)
-            {
-                _output.WriteError("error: {0}", craneException.Message);
-                return -1;
-            }
             catch (Exception exception)
             {
                 _output.WriteError("error: {0}", exception.Message);


refactor init

refactor init

--- ShapeGame/FallingThings.cs
+++ ShapeGame/FallingThings.cs
@@ -26,18 +26,6 @@
     {
         private const double BaseGravity = 0.017;
         private const double BaseAirFriction = 0.994;
-
-        private readonly Dictionary<PolyType, PolyDef> polyDefs = new Dictionary<PolyType, PolyDef>
-            {
-                { PolyType.Triangle, new PolyDef { Sides = 3, Skip = 1 } },
-                { PolyType.Star, new PolyDef { Sides = 5, Skip = 2 } },
-                { PolyType.Pentagon, new PolyDef { Sides = 5, Skip = 1 } },
-                { PolyType.Square, new PolyDef { Sides = 4, Skip = 1 } },
-                { PolyType.Hex, new PolyDef { Sides = 6, Skip = 1 } },
-                { PolyType.Star7, new PolyDef { Sides = 7, Skip = 3 } },
-                { PolyType.Circle, new PolyDef { Sides = 1, Skip = 1 } },
-                { PolyType.Bubble, new PolyDef { Sides = 0, Skip = 1 } }
-            };

         private readonly List<Thing> things = new List<Thing>();
         private readonly Random rnd = new Random();
@@ -71,14 +59,6 @@
             this.sceneRect.Width = this.sceneRect.Height = 100;
             this.shapeSize = this.sceneRect.Height * this.baseShapeSize / 1000.0;
             this.expandingRate = Math.Exp(Math.Log(6.0) / (this.targetFrameRate * DissolveTime));
-        }
-
-        public enum ThingState
-        {
-            Falling = 0,
-            Bouncing = 1,
-            Dissolving = 2,
-            Remove = 3
         }

         public static Label MakeSimpleLabel(string text, Rect bounds, System.Windows.Media.Brush brush)
@@ -432,56 +412,7 @@
             for (int i = 0; i < this.things.Count; i++)
             {
                 Thing thing = this.things[i];
-                if (thing.Brush == null)
-                {
-                    thing.Brush = new SolidColorBrush(thing.Color);
-                    double factor = 0.4 + (((double)thing.Color.R + thing.Color.G + thing.Color.B) / 1600);
-                    thing.Brush2 =
-                        new SolidColorBrush(
-                            System.Windows.Media.Color.FromRgb(
-                                (byte)(255 - ((255 - thing.Color.R) * factor)),
-                                (byte)(255 - ((255 - thing.Color.G) * factor)),
-                                (byte)(255 - ((255 - thing.Color.B) * factor))));
-                    thing.BrushPulse = new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 255, 255));
-                }
-
-                if (thing.State == ThingState.Bouncing)
-                {
-                    // Pulsate edges
-                    double alpha = Math.Cos((0.15 * (thing.FlashCount++) * thing.Hotness) * 0.5) + 0.5;
-
-                    children.Add(
-                        this.MakeSimpleShape(
-                            this.polyDefs[thing.Shape].Sides,
-                            this.polyDefs[thing.Shape].Skip,
-                            thing.Size,
-                            thing.Theta,
-                            thing.Center,
-                            thing.Brush,
-                            thing.BrushPulse,
-                            thing.Size * 0.1,
-                            alpha));
-                    this.things[i] = thing;
-                }
-                else
-                {
-                    if (thing.State == ThingState.Dissolving)
-                    {
-                        thing.Brush.Opacity = 1.0 - (thing.Dissolve * thing.Dissolve);
-                    }
-
-                    children.Add(
-                        this.MakeSimpleShape(
-                            this.polyDefs[thing.Shape].Sides,
-                            this.polyDefs[thing.Shape].Skip,
-                            thing.Size,
-                            thing.Theta,
-                            thing.Center,
-                            thing.Brush,
-                            (thing.State == ThingState.Dissolving) ? null : thing.Brush2,
-                            1,
-                            1));
-                }
+                thing.Draw(children);
             }

             // Show scores
@@ -650,6 +581,18 @@
             public int Hotness;                 // Score level
             public int FlashCount;

+            private readonly Dictionary<PolyType, PolyDef> polyDefs = new Dictionary<PolyType, PolyDef>
+                {
+                    { PolyType.Triangle, new PolyDef { Sides = 3, Skip = 1 } },
+                    { PolyType.Star, new PolyDef { Sides = 5, Skip = 2 } },
+                    { PolyType.Pentagon, new PolyDef { Sides = 5, Skip = 1 } },
+                    { PolyType.Square, new PolyDef { Sides = 4, Skip = 1 } },
+                    { PolyType.Hex, new PolyDef { Sides = 6, Skip = 1 } },
+                    { PolyType.Star7, new PolyDef { Sides = 7, Skip = 3 } },
+                    { PolyType.Circle, new PolyDef { Sides = 1, Skip = 1 } },
+                    { PolyType.Bubble, new PolyDef { Sides = 0, Skip = 1 } }
+                };
+
             // Hit testing between this thing and a single segment.  If hit, the center point on
             // the segment being hit is returned, along with the spot on the line from 0 to 1 if
             // a line segment was hit.
@@ -688,7 +631,7 @@
                     }

                     // Find dx from center to line
-                    double u = ((this.Center.X - seg.X1) * (seg.X2 - seg.X1)) + (((this.Center.Y - seg.Y1) * (seg.Y2 - seg.Y1)) / sqrLineSize);
+                    double u = ((this.Center.X - seg.X1) * (seg.X2 - seg.X1) + (this.Center.Y - seg.Y1) * (seg.Y2 - seg.Y1)) / sqrLineSize;
                     if ((u >= 0) && (u <= 1.0))
                     {   // Tangent within line endpoints, see if we're close enough
                         double intersectX = seg.X1 + ((seg.X2 - seg.X1) * u);
@@ -774,6 +717,69 @@
                 this.Center.X = x0;
                 this.Center.Y = y0;
             }
-        }
+
+            public void Draw(UIElementCollection children)
+            {
+
+                if (this.Brush == null)
+                {
+                    this.Brush = new SolidColorBrush(this.Color);
+                    double factor = 0.4 + (((double)this.Color.R + this.Color.G + this.Color.B) / 1600);
+                    this.Brush2 =
+                        new SolidColorBrush(
+                            System.Windows.Media.Color.FromRgb(
+                                (byte)(255 - ((255 - this.Color.R) * factor)),
+                                (byte)(255 - ((255 - this.Color.G) * factor)),
+                                (byte)(255 - ((255 - this.Color.B) * factor))));
+                    this.BrushPulse = new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 255, 255));
+                }
+
+                if (this.State == ThingState.Bouncing)
+                {
+                    // Pulsate edges
+                    double alpha = Math.Cos((0.15 * (this.FlashCount++) * this.Hotness) * 0.5) + 0.5;
+
+                    children.Add(
+                        this.MakeSimpleShape(
+                            this.polyDefs[this.Shape].Sides,
+                            this.polyDefs[this.Shape].Skip,
+                            this.Size,
+                            this.Theta,
+                            this.Center,
+                            this.Brush,
+                            this.BrushPulse,
+                            this.Size * 0.1,
+                            alpha));
+                }
+                else
+                {
+                    if (this.State == ThingState.Dissolving)
+                    {
+                        this.Brush.Opacity = 1.0 - (this.Dissolve * this.Dissolve);
+                    }
+
+                    children.Add(
+                        this.MakeSimpleShape(
+                            this.polyDefs[this.Shape].Sides,
+                            this.polyDefs[this.Shape].Skip,
+                            this.Size,
+                            this.Theta,
+                            this.Center,
+                            this.Brush,
+                            (this.State == ThingState.Dissolving) ? null : this.Brush2,
+                            1,
+                            1));
+                }
+            }
+        }
+
+        public enum ThingState
+        {
+            Falling = 0,
+            Bouncing = 1,
+            Dissolving = 2,
+            Remove = 3
+        }
+
     }
 }


closes #6

closes #6

--- src/IdentityModel/Client/RefreshTokenHandler.cs
+++ src/IdentityModel/Client/RefreshTokenHandler.cs
@@ -2,6 +2,7 @@
 // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.

+using System;
 using System.Net;
 using System.Net.Http;
 using System.Net.Http.Headers;
@@ -15,12 +16,14 @@
     /// </summary>
     public class RefeshTokenHandler : DelegatingHandler
     {
+        private static readonly TimeSpan _lockTimeout = TimeSpan.FromSeconds(2);
+
+        private readonly SemaphoreSlim _lock = new SemaphoreSlim(1, 1);
+        private readonly TokenClient _tokenClient;
+
         private string _accessToken;
         private string _refreshToken;
-
-        private readonly TokenClient _tokenClient;
-        private ReaderWriterLockSlim _lock;
-        private int _lockTimeout = 2000;
+        private bool _disposed;

         /// <summary>
         /// Gets the current access token
@@ -29,12 +32,16 @@
         {
             get
             {
-                if (_lock.TryEnterReadLock(_lockTimeout))
+                if (_lock.Wait(_lockTimeout))
                 {
-                    var at = _accessToken;
-                    _lock.ExitReadLock();
-
-                    return at;
+                    try
+                    {
+                        return _accessToken;
+                    }
+                    finally
+                    {
+                        _lock.Release();
+                    }
                 }

                 return null;
@@ -48,12 +55,16 @@
         {
             get
             {
-                if (_lock.TryEnterReadLock(_lockTimeout))
+                if (_lock.Wait(_lockTimeout))
                 {
-                    var rt = _refreshToken;
-                    _lock.ExitReadLock();
-
-                    return rt;
+                    try
+                    {
+                        return _refreshToken;
+                    }
+                    finally
+                    {
+                        _lock.Release();
+                    }
                 }

                 return null;
@@ -71,7 +82,6 @@
             _accessToken = accessToken;

             InnerHandler = innerHandler ?? new HttpClientHandler();
-            _lock = new ReaderWriterLockSlim();
         }

         protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
@@ -102,6 +112,16 @@
             return await base.SendAsync(request, cancellationToken);
         }

+        protected override void Dispose(bool disposing)
+        {
+          if (disposing && !_disposed) {
+              _disposed = true;
+              _lock.Dispose();
+          }
+
+          base.Dispose(disposing);
+        }
+
         private async Task<bool> RefreshTokensAsync(CancellationToken cancellationToken)
         {
             var refreshToken = RefreshToken;
@@ -110,7 +130,7 @@
                 return false;
             }

-            if (_lock.TryEnterWriteLock(_lockTimeout))
+            if (await _lock.WaitAsync(_lockTimeout, cancellationToken).ConfigureAwait(false))
             {
                 try
                 {
@@ -126,11 +146,11 @@
                 }
                 finally
                 {
-                    _lock.ExitWriteLock();
+                    _lock.Release();
                 }
             }

             return false;
         }
     }
-}+}


RefreshTokenHandler no longer blocks the calling thread when a refresh is in progress

--- src/IdentityModel/Client/RefreshTokenHandler.cs
+++ src/IdentityModel/Client/RefreshTokenHandler.cs
@@ -86,7 +86,7 @@

         protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
         {
-            var accessToken = AccessToken;
+            var accessToken = await GetAccessTokenAsync(cancellationToken);
             if (string.IsNullOrEmpty(accessToken))
             {
                 if (await RefreshTokensAsync(cancellationToken) == false)
@@ -152,5 +152,22 @@

             return false;
         }
+
+        private async Task<string> GetAccessTokenAsync(CancellationToken cancellationToken)
+        {
+            if (await _lock.WaitAsync(_lockTimeout, cancellationToken).ConfigureAwait(false))
+            {
+                try
+                {
+                    return _accessToken;
+                }
+                finally
+                {
+                    _lock.Release();
+                }
+            }
+
+            return null;
+        }
     }
 }


Doco for IPrivilegedResource

Doco for IPrivilegedResource

--- source/Glimpse.Core/Extensibility/IPrivilegedResource.cs
+++ source/Glimpse.Core/Extensibility/IPrivilegedResource.cs
@@ -2,8 +2,21 @@

 namespace Glimpse.Core.Extensibility
 {
+    /// <summary>
+    /// Definition of a resource that has access to higher privileges than a
+    /// normal resource.
+    /// </summary>
     internal interface IPrivilegedResource : IResource
     {
+        /// <summary>
+        /// Executes the specified context.
+        /// </summary>
+        /// <param name="context">The context.</param>
+        /// <param name="configuration">The configuration.</param>
+        /// <returns>IResourceResult.</returns>
+        /// <remarks>
+        /// Normal resources shouldn't have access to the <see cref="IGlimpseConfiguration"/>
+        /// </remarks>
         IResourceResult Execute(IResourceContext context, IGlimpseConfiguration configuration);
     }
 }


Documentation for IStaticClientScript

Documentation for IStaticClientScript

--- source/Glimpse.Core/Extensibility/IStaticClientScript.cs
+++ source/Glimpse.Core/Extensibility/IStaticClientScript.cs
@@ -1,8 +1,20 @@
 namespace Glimpse.Core.Extensibility
 {
-    // TODO: Provide a config only way to create static client scripts without implementing a class
+    /// <summary>
+    /// Definition for a static client script that will be injected into response payloads.
+    /// TODO: Provide a config only way to create static client scripts without implementing a class
+    /// </summary>
+    /// <remarks>
+    /// This interface only returns URIs that will be included in the payload. It doesn't
+    /// detail with any raw content in these files.
+    /// </remarks>
     public interface IStaticClientScript : IClientScript
     {
+        /// <summary>
+        /// Gets the URI for where the script is registered.
+        /// </summary>
+        /// <param name="version">The version.</param>
+        /// <returns>The URI where the asset lives.</returns>
         string GetUri(string version);
     }
 }


Doco for IDiscoverableCollection

Doco for IDiscoverableCollection

--- source/Glimpse.Core/Framework/IDiscoverableCollection.cs
+++ source/Glimpse.Core/Framework/IDiscoverableCollection.cs
@@ -3,14 +3,36 @@

 namespace Glimpse.Core.Framework
 {
+    /// <summary>
+    /// Defines methods to self discover collection content
+    /// </summary>
+    /// <typeparam name="T">Collection item type</typeparam>
     public interface IDiscoverableCollection<T> : ICollection<T>
     {
+        /// <summary>
+        /// Gets a value indicating whether [auto discover].
+        /// </summary>
+        /// <value><c>true</c> if [auto discover]; otherwise, <c>false</c>.</value>
+        /// <remarks>
+        /// Indicates whether the system can automatically call Discover()
+        /// </remarks>
         bool AutoDiscover { get; }

+        /// <summary>
+        /// Gets the discovery location.
+        /// </summary>
+        /// <value>The discovery location.</value>
         string DiscoveryLocation { get; }
-
+
+        /// <summary>
+        /// Ignores the type.
+        /// </summary>
+        /// <param name="type">The type.</param>
         void IgnoreType(Type type);
-
+
+        /// <summary>
+        /// Discovers this instance. Triggers the loading of content.
+        /// </summary>
         void Discover();
     }
 }


Tests for add and subtract parameters validation were added

--- test/GfAlgorithms.Tests/FieldElementsMatrixTests.cs
+++ test/GfAlgorithms.Tests/FieldElementsMatrixTests.cs
@@ -44,6 +44,13 @@
             public  FieldElement Element { get; set; }
         }

+        public class BinaryOperationParametersValidationTestCase
+        {
+            public FieldElementsMatrix FirstArgument { get; set; }
+
+            public FieldElementsMatrix SecondArgument { get; set; }
+        }
+
         #endregion

         [UsedImplicitly]
@@ -56,11 +63,14 @@
         public static TheoryData<ElementsGetterParametersValidationTestCase> ElementsGetterParametersValidationTestCases;
         [UsedImplicitly]
         public static TheoryData<ElementsSetterParametersValidationTestCase> ElementsSetterParametersValidationTestCases;
+        [UsedImplicitly]
+        public static TheoryData<BinaryOperationParametersValidationTestCase> AdditionParametersValidationTestCases;

         static FieldElementsMatrixTests()
         {
             var gf2 = new PrimeOrderField(2);
             var gf3 = new PrimeOrderField(3);
+            var matrix = new FieldElementsMatrix(gf2, 3, 3);

             FromInitializerConstructorParametersValidationTestCases
                 = new TheoryData<FromInitializerConstructorParametersValidationTestCase>
@@ -86,7 +96,6 @@
                           Field = gf2, RowsCount = 2, ColumnsCount = 2, ElementInitializer = (i, j) => gf3.One()
                       }
                   };
-
             FromNumbersArrayConstructorParametersValidationTestCases
                 = new TheoryData<FromNumbersArrayConstructorParametersValidationTestCase>
                   {
@@ -107,7 +116,6 @@
                           Field = gf2, Elements = new[,] {{1, 2}, { 0, 1} }
                       }
                   };
-
             FromFieldElementsArrayConstructorParametersValidationTestCases
                 = new TheoryData<FieldElement[,]>
                   {
@@ -117,8 +125,6 @@
                       new[,] {{gf2.One(), null}, {null, gf2.One()}},
                       new[,] {{gf2.One(), gf3.Zero()}, {gf3.Zero(), gf2.One()}}
                   };
-
-            var matrix = new FieldElementsMatrix(gf2, 3, 3);
             ElementsGetterParametersValidationTestCases
                 = new TheoryData<ElementsGetterParametersValidationTestCase>
                   {
@@ -165,7 +171,31 @@
                       new ElementsSetterParametersValidationTestCase
                       {
                           Matrix = matrix, RowNumber = 0, ColumnNumber = 0, Element = gf3.One()
-                      },
+                      }
+                  };
+            AdditionParametersValidationTestCases
+                = new TheoryData<BinaryOperationParametersValidationTestCase>
+                  {
+                      new BinaryOperationParametersValidationTestCase
+                      {
+                          FirstArgument = matrix
+                      },
+                      new BinaryOperationParametersValidationTestCase
+                      {
+                          SecondArgument = matrix
+                      },
+                      new BinaryOperationParametersValidationTestCase
+                      {
+                          FirstArgument = matrix, SecondArgument = new FieldElementsMatrix(gf3, 3, 3)
+                      },
+                      new BinaryOperationParametersValidationTestCase
+                      {
+                          FirstArgument = matrix, SecondArgument = new FieldElementsMatrix(gf2, 2, 3)
+                      },
+                      new BinaryOperationParametersValidationTestCase
+                      {
+                          FirstArgument = matrix, SecondArgument = new FieldElementsMatrix(gf2, 3, 2)
+                      }
                   };
         }

@@ -207,9 +237,24 @@

         [Theory]
         [MemberData(nameof(ElementsSetterParametersValidationTestCases))]
+
         public void ElementsSetterMustValidateParameters(ElementsSetterParametersValidationTestCase testCase)
         {
             Assert.ThrowsAny<ArgumentException>(() => testCase.Matrix[testCase.RowNumber, testCase.ColumnNumber] = testCase.Element);
+        }
+
+        [Theory]
+        [MemberData(nameof(AdditionParametersValidationTestCases))]
+        public void AddMustValidateParameters(BinaryOperationParametersValidationTestCase testCase)
+        {
+            Assert.ThrowsAny<ArgumentException>(() => testCase.FirstArgument + testCase.SecondArgument);
+        }
+
+        [Theory]
+        [MemberData(nameof(AdditionParametersValidationTestCases))]
+        public void SubtractMustValidateParameters(BinaryOperationParametersValidationTestCase testCase)
+        {
+            Assert.ThrowsAny<ArgumentException>(() => testCase.FirstArgument - testCase.SecondArgument);
         }
     }
 }


Do not forward hmac parameters, but use the own ones

--- proj/SecurityServer/proj/GenericSTSClient/HmacHelper.cs
+++ proj/SecurityServer/proj/GenericSTSClient/HmacHelper.cs
@@ -56,7 +56,7 @@
                 { "userid", hmacSettings.UserId },
             };

-            var allParameters = parameters.Concat(hmacParameters.Where(x => !parameters.Keys.Contains(x.Key))).ToDictionary(x => x.Key, x => x.Value);
+            var allParameters = parameters.Where(x => !hmacParameters.Keys.Contains(x.Key)).Concat(hmacParameters).ToDictionary(x => x.Key, x => x.Value);

             allParameters.Add("signature", CalculateHash(allParameters, hmacSettings.Secret));


Loading fixes.

Loading fixes.

--- unity/Assets/Scripts/UI/Screens/LoadingScreen.cs
+++ unity/Assets/Scripts/UI/Screens/LoadingScreen.cs
@@ -28,20 +28,26 @@
             Destroyer.Dialog();
             Draw(display);

+            // Create border
+            UIElement ui = new UIElement();
+            ui.SetLocation(3, 27, UIScaler.GetWidthUnits() - 6, 2);
+            ui.SetBGColor(Color.clear);
+            new UIElementBorder(ui);
+
             // Create an object
             GameObject bar = new GameObject("progress");
             // Mark it as dialog
-            logo.tag = Game.DIALOG;
-            logo.transform.SetParent(Game.Get().uICanvas.transform);
+            bar.tag = Game.DIALOG;
+            bar.transform.SetParent(Game.Get().uICanvas.transform);

-            RectTransform transBg = logo.AddComponent<RectTransform>();
-            transBg.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, 3 * UIScaler.GetPixelsPerUnit(), (UIScaler.Units() - 6) * UIScaler.GetPixelsPerUnit());
+            RectTransform transBg = bar.AddComponent<RectTransform>();
+            transBg.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, 3 * UIScaler.GetPixelsPerUnit(), (UIScaler.GetWidthUnits() - 6) * UIScaler.GetPixelsPerUnit());
             transBg.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 27 * UIScaler.GetPixelsPerUnit(), 2 * UIScaler.GetPixelsPerUnit());

             // Create the image
-            UnityEngine.UI.Image uiImage = logo.AddComponent<UnityEngine.UI.Image>();
+            UnityEngine.UI.Image uiImage = bar.AddComponent<UnityEngine.UI.Image>();
             uiImage.color = Color.white;
-            logo.AddComponent<ProgressBar>().SetDownload(download);
+            bar.AddComponent<ProgressBar>().SetDownload(download);
         }

         /// <summary>


BaseAbiquoClient

BaseAbiquoClient

* removed extra output on every rest request

--- src/biz.dfch.CS.Abiquo.Client/BaseAbiquoClient.cs
+++ src/biz.dfch.CS.Abiquo.Client/BaseAbiquoClient.cs
@@ -142,7 +142,6 @@
             var restCallExecutor = new RestCallExecutor();
             var result = restCallExecutor.Invoke(httpMethod, requestUri, requestHeaders, body);

-            Logger.Current.TraceEvent(TraceEventType.Information, 1, "Executing request '{0} {1}' returned '{2}'", httpMethod, requestUri, result);
             Logger.Current.TraceEvent(TraceEventType.Stop, 1, "END Executing request '{0} {1}' SUCCEEDED", httpMethod, requestUri);

             return result;


Added smoke tests for the fluent syntax

Added smoke tests for the fluent syntax

--- SmokeTests/FluentSyntax.cs
+++ SmokeTests/FluentSyntax.cs
@@ -963,6 +963,85 @@
         }
         #endregion

+        #region Binary Data
+        [SmokeTest("Fluent Syntax Binary ResultSet")]
+        Tuple<bool, string> ExecuteBinarySync(IDbConnection db)
+        {
+            byte[] res = StoredProcedure.Create ("usp_GetIntAsBytes")
+                                        .WithParameter("toBytes", 42)
+                                        .WithResults<byte[]>()
+                                        .Execute(db, Program.timeout)
+                                        .Single();
+
+            if (BitConverter.IsLittleEndian)
+                Array.Reverse(res);
+
+            if (BitConverter.ToInt32(res, 0) != 42)
+                return Tuple.Create(false, "The bytes returned from the stored procedure did not match the expected results");
+
+            return Tuple.Create(true, "");
+        }
+
+        [SmokeTest("Fluent Syntax Binary ResultSet (await)")]
+        async Task<Tuple<bool, string>> ExecuteBinaryAsync(IDbConnection db)
+        {
+            byte[] res = (await StoredProcedure.Create ("usp_GetIntAsBytes")
+                                               .WithParameter("toBytes", 42)
+                                               .WithResults<byte[]>()
+                                               .ExecuteAsync(db, Program.timeout))
+                                               .Single();
+            if (BitConverter.IsLittleEndian)
+                Array.Reverse(res);
+
+            if (BitConverter.ToInt32(res, 0) != 42)
+                return Tuple.Create(false, "The bytes returned from the stored procedure did not match the expected results");
+
+            return Tuple.Create(true, "");
+        }
+
+        [SmokeTest("Fluent Syntax Binary ResultSet (task)")]
+        Task<Tuple<bool, string>> ExecuteBinaryTask(IDbConnection db)
+        {
+            var t = StoredProcedure.Create ("usp_GetIntAsBytes")
+                                   .WithParameter("toBytes", 42)
+                                   .WithResults<byte[]>()
+                                   .ExecuteAsync(db, Program.timeout);
+
+            return t.ContinueWith(r =>
+            {
+                var res = r.Result.Single();
+
+                if (BitConverter.IsLittleEndian)
+                    Array.Reverse(res);
+
+                if (BitConverter.ToInt32(res, 0) != 42)
+                    return Tuple.Create(false, "The bytes returned from the stored procedure did not match the expected results");
+
+                return Tuple.Create(true, "");
+
+            });
+        }
+
+        [SmokeTest("Fluent Syntax Binary Parameter")]
+        Tuple<bool, string> ExecuteBinaryParameter(IDbConnection db)
+        {
+            byte[] bytes = BitConverter.GetBytes(123456);
+            if (BitConverter.IsLittleEndian)
+                Array.Reverse(bytes);
+
+            int res = StoredProcedure.Create("usp_GetBytesAsInt")
+                                     .WithParameter("toInt", bytes)
+                                     .WithResults<int>()
+                                     .Execute(db, Program.timeout)
+                                     .Single();
+
+            if (res != 123456)
+                return Tuple.Create(false, "The int returned from the stored procedure did not match the expected results");
+
+            return Tuple.Create(true, "");
+        }
+        #endregion
+
         private class DoublingTransformer : IDataTransformer<int>, IDataTransformer<Spoke>
         {
             public bool CanTransform(object value, Type targetType, bool isNullable, IEnumerable<Attribute> propertyAttributes)


Lucene.Net.Diagnostics.Debugging: Use J2N StringFormatter to automatically format arrays and IStructuralFormattable collections

--- src/Lucene.Net/Support/Diagnostics/Debugging.cs
+++ src/Lucene.Net/Support/Diagnostics/Debugging.cs
@@ -1,5 +1,5 @@
+using J2N.Text;
 using Lucene.Net.Util;
-using System;
 using System.Runtime.CompilerServices;

 namespace Lucene.Net.Diagnostics
@@ -56,7 +56,8 @@
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static void Assert<T0>(bool condition, string messageToFormat, T0 p0)
         {
-            if (AssertsEnabled && !condition) throw new AssertionException(string.Format(messageToFormat, p0));
+            if (AssertsEnabled && !condition)
+                throw new AssertionException(string.Format(StringFormatter.InvariantCulture, messageToFormat, p0));
         }

         /// <summary>
@@ -68,7 +69,8 @@
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static void Assert<T0, T1>(bool condition, string messageToFormat, T0 p0, T1 p1)
         {
-            if (AssertsEnabled && !condition) throw new AssertionException(string.Format(messageToFormat, p0, p1));
+            if (AssertsEnabled && !condition)
+                throw new AssertionException(string.Format(StringFormatter.InvariantCulture, messageToFormat, p0, p1));
         }

         /// <summary>
@@ -80,7 +82,8 @@
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static void Assert<T0, T1, T2>(bool condition, string messageToFormat, T0 p0, T1 p1, T2 p2)
         {
-            if (AssertsEnabled && !condition) throw new AssertionException(string.Format(messageToFormat, p0, p1, p2));
+            if (AssertsEnabled && !condition)
+                throw new AssertionException(string.Format(StringFormatter.InvariantCulture, messageToFormat, p0, p1, p2));
         }

         /// <summary>
@@ -92,7 +95,8 @@
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static void Assert<T0, T1, T2, T3>(bool condition, string messageToFormat, T0 p0, T1 p1, T2 p2, T3 p3)
         {
-            if (AssertsEnabled && !condition) throw new AssertionException(string.Format(messageToFormat, p0, p1, p2, p3));
+            if (AssertsEnabled && !condition)
+                throw new AssertionException(string.Format(StringFormatter.InvariantCulture, messageToFormat, p0, p1, p2, p3));
         }

         /// <summary>
@@ -104,7 +108,8 @@
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static void Assert<T0, T1, T2, T3, T4>(bool condition, string messageToFormat, T0 p0, T1 p1, T2 p2, T3 p3, T4 p4)
         {
-            if (AssertsEnabled && !condition) throw new AssertionException(string.Format(messageToFormat, p0, p1, p2, p3, p4));
+            if (AssertsEnabled && !condition)
+                throw new AssertionException(string.Format(StringFormatter.InvariantCulture, messageToFormat, p0, p1, p2, p3, p4));
         }

         /// <summary>
@@ -116,7 +121,8 @@
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static void Assert<T0, T1, T2, T3, T4, T5>(bool condition, string messageToFormat, T0 p0, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5)
         {
-            if (AssertsEnabled && !condition) throw new AssertionException(string.Format(messageToFormat, p0, p1, p2, p3, p4, p5));
+            if (AssertsEnabled && !condition)
+                throw new AssertionException(string.Format(StringFormatter.InvariantCulture, messageToFormat, p0, p1, p2, p3, p4, p5));
         }

         /// <summary>
@@ -128,7 +134,8 @@
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static void Assert<T0, T1, T2, T3, T4, T5, T6>(bool condition, string messageToFormat, T0 p0, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6)
         {
-            if (AssertsEnabled && !condition) throw new AssertionException(string.Format(messageToFormat, p0, p1, p2, p3, p4, p5, p6));
+            if (AssertsEnabled && !condition)
+                throw new AssertionException(string.Format(StringFormatter.InvariantCulture, messageToFormat, p0, p1, p2, p3, p4, p5, p6));
         }

         /// <summary>
@@ -140,13 +147,15 @@
         [MethodImpl(MethodImplOptions.AggressiveInlining)]
         public static void Assert<T0, T1, T2, T3, T4, T5, T6, T7>(bool condition, string messageToFormat, T0 p0, T1 p1, T2 p2, T3 p3, T4 p4, T5 p5, T6 p6, T7 p7)
         {
-            if (AssertsEnabled && !condition) throw new AssertionException(string.Format(messageToFormat, p0, p1, p2, p3, p4, p5, p6, p7));
+            if (AssertsEnabled && !condition)
+                throw new AssertionException(string.Format(StringFormatter.InvariantCulture, messageToFormat, p0, p1, p2, p3, p4, p5, p6, p7));
         }

         /// <summary>
         /// Checks for a condition; if the <paramref name="condition"/> is <c>false</c>, throws an <see cref="AssertionException"/> with the given message.
         /// <para/>
-        /// IMPORTANT: If you need to use string concatenation when building the message, use <see cref="Assert(bool, Func{string})"/> for better performance.
+        /// IMPORTANT: If you need to use string concatenation when building the message, use an overload of
+        /// <see cref="Assert{T0}(bool, string, T0)"/> for better performance.
         /// </summary>
         /// <param name="condition">The conditional expression to evaluate. If the condition is <c>true</c>, no exception is thrown.</param>
         /// <param name="message">The message to use.</param>


Fix Crash on missing key

Fix Crash on missing key

* add check to threadgroup id to ensure that the id exists first that we
* are checking

--- src/MIDebugEngine/Engine.Impl/DebuggedThread.cs
+++ src/MIDebugEngine/Engine.Impl/DebuggedThread.cs
@@ -279,7 +279,7 @@
         private bool IsInParent(int tid)
         {
             // only those threads in the s_defaultGroupId threadgroup are in the debuggee, others are transient while attaching to a child process
-            return _threadGroups[c_defaultGroupId].Contains(tid);
+            return _threadGroups.ContainsKey(c_defaultGroupId) && _threadGroups[c_defaultGroupId].Contains(tid);
         }

         private async Task<List<ThreadContext>> WalkStack(DebuggedThread thread)


Fix crash when cursor goes 'off screen'

Fix crash when cursor goes 'off screen'

--- src/Microsoft.PowerShell.Linux.Host/readline.cs
+++ src/Microsoft.PowerShell.Linux.Host/readline.cs
@@ -762,6 +762,8 @@
             internal void Move(int delta)
             {
                 int position = Console.CursorTop * Console.BufferWidth + Console.CursorLeft + delta;
+                int maxPosition = (Console.BufferWidth * Console.BufferHeight) - 1;
+                position = (position < 0) ? 0 : ((position > maxPosition) ? maxPosition : position);

                 Console.CursorLeft = position % Console.BufferWidth;
                 Console.CursorTop = position / Console.BufferWidth;


rely on c# timeouts, not NSURLSession timeouts

--- src/ModernHttpClient/iOS/NSUrlSessionHandler.cs
+++ src/ModernHttpClient/iOS/NSUrlSessionHandler.cs
@@ -46,8 +46,11 @@
         public NativeMessageHandler(): this(false, false) { }
         public NativeMessageHandler(bool throwOnCaptiveNetwork, bool customSSLVerification)
         {
+            var config = NSUrlSessionConfiguration.EphemeralSessionConfiguration;
+            config.TimeoutIntervalForRequest = 1000;
+            config.TimeoutIntervalForResource = 1000;
             session = NSUrlSession.FromConfiguration(
-                NSUrlSessionConfiguration.DefaultSessionConfiguration,
+                config,
                 new DataTaskDelegate(this), null);

             this.throwOnCaptiveNetwork = throwOnCaptiveNetwork;


#317 - Update UserHandler ctor usage.

#317 - Update UserHandler ctor usage.

--- src/Money.Api/Domain/Bootstrap/BootstrapTask.cs
+++ src/Money.Api/Domain/Bootstrap/BootstrapTask.cs
@@ -197,7 +197,8 @@

             bootstrapTask.Initialize();

-            UserHandler userHandler = new UserHandler(services.BuildServiceProvider().GetRequiredService<UserManager<User>>(), eventDispatcher);
+            ServiceProvider serviceProvider = services.BuildServiceProvider();
+            UserHandler userHandler = new UserHandler(serviceProvider.GetRequiredService<UserManager<User>>(), serviceProvider.GetRequiredService<IFactory<AccountContext>>(), eventDispatcher);
             commandDispatcher.Handlers.AddAll(userHandler);
             queryDispatcher.AddAll(userHandler);
         }


Close channel after usage

Close channel after usage

closes #378

--- src/NLog/Targets/LogReceiverWebServiceTarget.cs
+++ src/NLog/Targets/LogReceiverWebServiceTarget.cs
@@ -35,6 +35,7 @@
 {
     using System;
     using System.Collections.Generic;
+    using System.ComponentModel;
     using System.Globalization;
 #if WCF_SUPPORTED
     using System.ServiceModel;
@@ -335,7 +336,19 @@
             {
                 client = new WcfLogReceiverClient(this.EndpointConfigurationName, new EndpointAddress(this.EndpointAddress));
             }
+
+            client.ProcessLogMessagesCompleted += ClientOnProcessLogMessagesCompleted;
+
             return client;
+        }
+
+        private void ClientOnProcessLogMessagesCompleted(object sender, AsyncCompletedEventArgs asyncCompletedEventArgs)
+        {
+            var client = sender as WcfLogReceiverClient;
+            if (client != null && client.State == CommunicationState.Opened)
+            {
+                client.Close();
+            }
         }
 #endif


Broke parts of bilinear scaling into separate functions

Right now it is broken and i'm not sure why :(

--- src/filters/Homework1/BilinearInterpolationFilter.cs
+++ src/filters/Homework1/BilinearInterpolationFilter.cs
@@ -114,6 +114,12 @@
 						//store those points
 						float y1 = rPy;
 						float y2 = rPy + 1;
+						//get the distance between the y coordinates
+						float divisor1 = y2 - y1;
+						//take the distance from the current pixel to x1
+						//and divide it by the distance between y1 and y2
+						float factor1 = num1 / divisor1;
+
 						//these are the bilinear interpolation points
 						//surrounding the target pixel
 						//Grab the values stored in our interpolation points
@@ -124,55 +130,8 @@
 						Color qc12 = Color.FromArgb(srcLine1[(int)y2]);
 						Color qc22 = Color.FromArgb(srcLine2[(int)y2]);

-						//get the distance between the y coordinates
-						float divisor1 = y2 - y1;
-						//take the distance from the current pixel to x1
-						//and divide it by the distance between y1 and y2
-						float factor1 = num1 / divisor1;
-						//we need to computer R1 and R2 which are points computed using the
-						//four surrounding pixels in the source image
-						//to get R1 we multiply factor0 by q11 and add it to
-						//factor1 multiplied by q21
-						Func<float,float,float,float,int> conv = (q11,q21,q12,q22) =>
-						{
-							float fR1a = factor0 * q11;
-							float fR1b = factor1 * q21;
-							float fR1 = fR1a + fR1b;
-							//to get R2 we multiply factor0 by q12 and add it to
-							//factor1 multiplied by q22
-							float fR2a = factor0 * q12;
-							float fR2b = factor1 * q22;
-							float fR2 = fR2a + fR2b;
-							//we then interpolate in the y-direction now that we've finished
-							//computing in the x direction
-							//
-							//Compute the two parts
-							float fPa = ((y2 - y) / divisor1) * fR1;
-							float fPb = ((y - y1) / divisor1) * fR2;
-							//add them together
-							float fP = fPa + fPb;
-							//if the value is less than zero then the value is zero
-							int rslt = (int)Math.Max(0, Math.Round(fP));
-							//if the value is greater than 255 (remember bytes)
-							//then set the value to 255
-							if(rslt > 255)
-								rslt = 255;
-							return rslt;
-						};
-						int red = conv((float)qc11.R,
-								(float)qc21.R,
-								(float)qc12.R,
-								(float)qc22.R);
-						int green = conv((float)qc11.G,
-								(float)qc21.G,
-								(float)qc12.G,
-								(float)qc22.G);
-						int blue = conv((float)qc11.B,
-								(float)qc21.B,
-								(float)qc12.B,
-								(float)qc22.B);
 						//store the result in our output line
-						outLine[j] = Color.FromArgb(255, red, green, blue).ToArgb();
+						outLine[j] = Conv(qc11, qc21, qc12, qc22, factor0, factor1, divisor1, y2, y1, y);
 					}
 					else
 					{
@@ -182,5 +141,50 @@
 			}
 			return output;
 		}
+		private static int Conv(Color qc11, Color qc21, Color qc12, Color qc22,
+				float factor0, float factor1, float divisor1, float y2, float y1, float y)
+		{
+			//we need to computer R1 and R2 which are points computed using the
+			//four surrounding pixels in the source image
+			//to get R1 we multiply factor0 by q11 and add it to
+			//factor1 multiplied by q21
+			return Color.FromArgb(255,
+					Conv((float)qc11.R, (float)qc21.R,
+						(float)qc12.R, (float)qc22.R,
+						factor0, factor1, divisor1, y2, y1, y),
+					Conv((float)qc11.G, (float)qc21.G,
+						(float)qc12.G, (float)qc22.G,
+						factor0, factor1, divisor1, y2, y1, y),
+					Conv((float)qc11.B, (float)qc21.B,
+						(float)qc12.B, (float)qc22.B,
+						factor0, factor1, divisor1, y2, y1, y)).ToArgb();
+		}
+		private static int Conv(float q11, float q21, float q12, float q22,
+				float factor0, float factor1, float divisor1, float y2, float y1, float y)
+		{
+			float fR1a = factor0 * q11;
+			float fR1b = factor1 * q21;
+			float fR1 = fR1a + fR1b;
+			//to get R2 we multiply factor0 by q12 and add it to
+			//factor1 multiplied by q22
+			float fR2a = factor0 * q12;
+			float fR2b = factor1 * q22;
+			float fR2 = fR2a + fR2b;
+			//we then interpolate in the y-direction now that we've finished
+			//computing in the x direction
+			//
+			//Compute the two parts
+			float fPa = ((y2 - y) / divisor1) * fR1;
+			float fPb = ((y - y1) / divisor1) * fR2;
+			//add them together
+			float fP = fPa + fPb;
+			//if the value is less than zero then the value is zero
+			int rslt = (int)Math.Max(0, Math.Round(fP));
+			//if the value is greater than 255 (remember bytes)
+			//then set the value to 255
+			if(rslt > 255)
+				rslt = 255;
+			return rslt;
+		}
 	}
 }


Modified validator not found exception message to be more generic.

--- src/Nancy/Validation/DefaultValidatorLocator.cs
+++ src/Nancy/Validation/DefaultValidatorLocator.cs
@@ -34,7 +34,7 @@
         {
             if (!this.factories.Any())
             {
-                throw new ModelValidationException("No model validator factory could be located. Please ensure you have a Nancy.Validation.* NuGet package installed.");
+                throw new ModelValidationException("No model validator factory could be located. Please ensure that you have an appropriate validation package installed, such as one of the Nancy.Validation packages.");
             }

             return cachedValidators.GetOrAdd(type, CreateValidator);


modified PartitionKey and RowKey scheme as discussed in #34

--- src/Orleans/AzureUtils/StatsTableDataManager.cs
+++ src/Orleans/AzureUtils/StatsTableDataManager.cs
@@ -147,16 +147,16 @@
             counter++;
             var time = DateTime.UtcNow;
             var timeStr = time.ToString(DATE_FORMAT, CultureInfo.InvariantCulture);
-            entry.PartitionKey = deploymentId + ":" + timeStr;
+
+            // number of ticks remaining until the year 9683
+            var ticks = DateTime.MaxValue.Ticks - DateTime.UtcNow.Ticks;
+
+            // partition the table according to the deployment id and hour
+            entry.PartitionKey = string.Join("$", deploymentId, string.Format("{0:d19}", ticks - ticks % TimeSpan.TicksPerHour));
             var counterStr = String.Format("{0:000000}", counter);
-            if (isSilo)
-            {
-                entry.RowKey = name + ":" + counterStr;
-            }
-            else
-            {
-                entry.RowKey = name + ":" + clientEpoch + ":" + counterStr;
-            }
+
+            // order the rows latest-first in the table
+            entry.RowKey = string.Join("$", string.Format("{0:d19}", ticks), name, counterStr);
             entry.DeploymentId = deploymentId;
             entry.Time = time;
             entry.Address = address;


(CFP): minor fix.

(CFP): minor fix.

--- ArcFormats/Tail/ImageCFP.cs
+++ ArcFormats/Tail/ImageCFP.cs
@@ -104,12 +104,11 @@
             int start_pos = header.ToInt32 (0x10);
             if (start_pos < 0x36)
                 return null;
-            int extra_length = header.ToInt32 (0x1C);
             int width = header.ToInt32 (0x14);
             int height = header.ToInt32 (0x18);
             var info = new CfpMetaData {
-                Width = header.ToUInt32 (0x14),
-                Height = header.ToUInt32 (0x18),
+                Width = (uint)width,
+                Height = (uint)height,
                 BPP = 32,
             };
             info.DataLength = width * height * 4;


Added combobox and slider

Added combobox and slider

Still need to make the values set by controls actually filter the set of
faces.

--- Assets/Scripts/FaceCards.cs
+++ Assets/Scripts/FaceCards.cs
@@ -22,6 +22,10 @@
 	int iDeptFilter = 0;    // 0 = all departments included. > 0 means a single department roles[iDeptFilter-1] is included.

 	int iGameMode = 0;
+	int iTenureFilter = 0;
+	float valTenureSlider;	// 0.0 .. 1.0  slider value that determines countTenureMembersMin.
+	int countTenureMembersMin;	// 1..TotalFaces; Minimum number of people to include in filter. This determines the date to use (to get that many people) and in turn determines the actual number shown (because some people were hired on the same date).
+

 	float score;

@@ -37,6 +41,10 @@
 	// Game Mode
 	GUIContent[] comboBoxListMode;
 	private ComboBox comboBoxControlMode;// = new ComboBox();
+
+	// Tenure Filter mode:
+	GUIContent[] comboBoxListTenure;
+	private ComboBox comboBoxControlTenure;

 	public int debugMaxCards = 0;	// greater than 0 the set limit on number of cards.
 	public GameObject faceCardPrefab;
@@ -203,11 +211,11 @@
 		listStyle.padding.top =
 		listStyle.padding.bottom = 4;

+
 		comboBoxControl = new ComboBox(new Rect(xComboBox, Screen.height - btnHeightSpaced, comboButtonWidth, btnHeight), comboBoxList[0], comboBoxList, "button", "box", listStyle, "Department:");

+		// What part of name they need to enter
 		xComboBox += comboSpacing;
-
-		// What part of name they need to enter
 		comboBoxListName = new GUIContent[5];
 		comboBoxListName[0] = new GUIContent("First & Last");
 		comboBoxListName[1] = new GUIContent("First Name");
@@ -217,12 +225,18 @@
 		comboBoxControlName = new ComboBox(new Rect(xComboBox, Screen.height - btnHeightSpaced, comboButtonWidth, btnHeight), comboBoxListName[0], comboBoxListName, "button", "box", listStyle, "Guess/Sort by:");

 		xComboBox += comboSpacing;
-
 		comboBoxListMode = new GUIContent[3];
 		comboBoxListMode[0] = new GUIContent("Memory Game");
 		comboBoxListMode[1] = new GUIContent("Flash Cards*");
 		comboBoxListMode[2] = new GUIContent("Yearbook*");
 		comboBoxControlMode = new ComboBox(new Rect(xComboBox, Screen.height - btnHeightSpaced, comboButtonWidth, btnHeight), comboBoxListMode[0], comboBoxListMode, "button", "box", listStyle, "Mode:");
+
+		xComboBox += comboSpacing;
+		comboBoxListTenure = new GUIContent[3];
+		comboBoxListTenure[0] = new GUIContent("All Tenures");
+		comboBoxListTenure[1] = new GUIContent("Greater than");
+		comboBoxListTenure[2] = new GUIContent("Less than");
+		comboBoxControlTenure = new ComboBox(new Rect(xComboBox, Screen.height - btnHeightSpaced, comboButtonWidth, btnHeight), comboBoxListTenure[0], comboBoxListTenure, "button", "box", listStyle, "Tenure Filter:");

 	}

@@ -257,6 +271,8 @@
 			comboBoxControl.Reposition(new Rect(xCombo, Screen.height - btnHeightSpaced, comboButtonWidth, btnHeight));
 			xCombo += comboSpacing;
 			comboBoxControlName.Reposition(new Rect(xCombo, Screen.height - btnHeightSpaced, comboButtonWidth, btnHeight));
+			xCombo += comboSpacing;
+			comboBoxControlTenure.Reposition(new Rect(xCombo, Screen.height - btnHeightSpaced, comboButtonWidth, btnHeight));
 		}

 #if false
@@ -1056,6 +1072,23 @@
 			bool isYearBookModeBefore = isYearBookMode;
 			iGameMode = comboBoxControlMode.Show();

+			selectedItemIndex = comboBoxControlTenure.Show();
+			if (selectedItemIndex != iTenureFilter)
+			{
+				iTenureFilter = selectedItemIndex;
+
+			}
+			if (!comboBoxControlTenure.isComboBoxOpen && iTenureFilter != 0)
+			{
+				Rect rectTenureSlider = comboBoxControlTenure.rectPosition;
+				rectTenureSlider.y -= 40;
+
+				valTenureSlider = GUI.HorizontalSlider(rectTenureSlider, valTenureSlider, 0.0f, 1.0f);
+				countTenureMembersMin = (int)(valTenureSlider * faceSprites.Count);
+				countTenureMembersMin = Mathf.Clamp(countTenureMembersMin, 1, faceSprites.Count);
+			}
+
+
 			rectText = guiTextName.GetScreenRect(Camera.main);
 			if (guiTextName.text.Length == 0)
 			{


Added TilePosition and Neighbors properties to Cubes

--- Assets/Scripts/Game/Cube.cs
+++ Assets/Scripts/Game/Cube.cs
@@ -11,6 +11,9 @@

         private int _health;
         private GridManager _gridManager;
+
+        public Vector2 TilePosition { get; set; }
+

         public bool IsEdgeCube { private get; set; }


Add checks for game end buttons - ensure that GetComponentsInChildren also catches inactive game objects and set all buttons to active prior to content set

--- Assets/Scripts/GameEndUI.cs
+++ Assets/Scripts/GameEndUI.cs
@@ -49,11 +49,15 @@
         _boardContainer = transform.Find("Wrapper/Board").gameObject;
         _headerContainer = transform.Find("Wrapper/Header").gameObject;
         _buttonsContainer = transform.Find("Wrapper/Buttons").gameObject;
-        _lowerButtons = _buttonsContainer.transform.GetComponentsInChildren<Transform>().Skip(1).ToArray();
+
+        _lowerButtons = _buttonsContainer.transform.GetComponentsInChildren<Transform>(true).Skip(1).ToArray();

         foreach (Transform button in _lowerButtons)
         {
             button.localScale = new Vector3(1, 1, 1);
+
+            if (!button.gameObject.activeSelf)
+                button.gameObject.SetActive(true);
         }

         _finalLevel = GameConfig.CurrentChapter == 2 && GameConfig.CurrentLevel == 1;


implemented mouse controls

implemented mouse controls

--- Assets/Scripts/PadScript.cs
+++ Assets/Scripts/PadScript.cs
@@ -16,6 +16,9 @@
 	void FixedUpdate () {
 		float horizontal = Input.GetAxis ("Horizontal");
 		Vector3 force = new Vector3 (horizontal, 0, 0) * multiplier;
+		rigidbody.AddForce (force);
+		horizontal = Input.GetAxis ("Mouse X");
+		force = new Vector3 (horizontal, 0, 0) * multiplier;
 		rigidbody.AddForce (force);
 	}


add start time log

add start time log

--- Assets/Slua/example/Perf.cs
+++ Assets/Slua/example/Perf.cs
@@ -8,9 +8,16 @@
 	// Use this for initialization
 	void Start()
 	{
+		var startMem = System.GC.GetTotalMemory (true);
+
+		var start = Time.realtimeSinceStartup;
 		l = new LuaSvr();
 		l.init(null, () =>
 		{
+			Debug.Log ("start cost: " + (Time.realtimeSinceStartup - start));
+
+			var endMem = System.GC.GetTotalMemory (true);
+			Debug.Log ("startMem: " + startMem + ", endMem: " + endMem + ", " + "cost mem: " + (endMem - startMem));
 			l.start("perf");
 		});


Include DI policies

Include DI policies

--- src/SFA.DAS.EAS.Api/DependencyResolution/IoC.cs
+++ src/SFA.DAS.EAS.Api/DependencyResolution/IoC.cs
@@ -16,12 +16,22 @@
 // --------------------------------------------------------------------------------------------------------------------

+using SFA.DAS.EmployerApprenticeshipsService.Domain.Configuration;
+using SFA.DAS.EmployerApprenticeshipsService.Infrastructure.DependencyResolution;
+
 namespace SFA.DAS.EAS.Api.DependencyResolution {
     using StructureMap;

     public static class IoC {
+        private const string ServiceName = "SFA.DAS.EmployerApprenticeshipsService";
         public static IContainer Initialize() {
-            return new Container(c => c.AddRegistry<DefaultRegistry>());
+            return new Container(c =>
+            {
+                c.Policies.Add(new ConfigurationPolicy<EmployerApprenticeshipsServiceConfiguration>(ServiceName));
+                c.Policies.Add<LoggingPolicy>();
+                c.Policies.Add(new MessagePolicy<EmployerApprenticeshipsServiceConfiguration>(ServiceName));
+                c.AddRegistry<DefaultRegistry>();
+            });
         }
     }
 }


bugfix

bugfix

--- src/SSCMS.Core/Repositories/ConfigRepository.cs
+++ src/SSCMS.Core/Repositories/ConfigRepository.cs
@@ -37,24 +37,24 @@
             return configId;
         }

-		public async Task UpdateAsync(Config config)
-		{
+        public async Task UpdateAsync(Config config)
+        {
             await _repository.UpdateAsync(config, Q
                 .CachingRemove(_cacheKey)
             );
         }

-		public async Task<bool> IsInitializedAsync()
-		{
+        public async Task<bool> IsInitializedAsync()
+        {
             try
             {
                 if (string.IsNullOrEmpty(_settingsManager.DatabaseConnectionString)) return false;
-                return await _repository.ExistsAsync();
+                return await _repository.Database.IsTableExistsAsync(TableName) && await _repository.ExistsAsync();
             }
-		    catch
-		    {
-		        // ignored
-		    }
+            catch
+            {
+                // ignored
+            }

             return false;
         }


Fix no-PIA support - use IsImport rather than IsCOMObject to determine types that should be compared by GUID.

--- src/Source/Autofac/Util/ReflectionExtensions.cs
+++ src/Source/Autofac/Util/ReflectionExtensions.cs
@@ -137,7 +137,7 @@

         public static int GetCompatibleHashCode(this Type type)
         {
-            if (type.IsCOMObject)
+            if (type.IsImport)
                 return type.GUID.GetHashCode();

             return type.GetHashCode();


Now list item status will only change on click events. Previously it maybe change on touch begin.

--- Source/Scripts/UI/GList.cs
+++ Source/Scripts/UI/GList.cs
@@ -76,7 +76,6 @@
 		Controller _selectionController;

 		GObjectPool _pool;
-		bool _selectionHandled;
 		int _lastSelectedIndex;

 		//Virtual List support
@@ -102,7 +101,6 @@
 		List<ItemInfo> _virtualItems;

 		EventCallback1 _itemClickDelegate;
-		EventCallback1 _itemTouchBeginDelegate;

 		public GList()
 			: base()
@@ -118,7 +116,6 @@
 			_pool = new GObjectPool(container.cachedTransform);

 			_itemClickDelegate = __clickItem;
-			_itemTouchBeginDelegate = __itemTouchBegin;
 			onClickItem = new EventListener(this, "onClickItem");
 			onRightClickItem = new EventListener(this, "onRightClickItem");
 		}
@@ -354,7 +351,6 @@
 				button.changeStateOnClick = false;
 			}

-			child.onTouchBegin.Add(_itemTouchBeginDelegate);
 			child.onClick.Add(_itemClickDelegate);
 			child.onRightClick.Add(_itemClickDelegate);

@@ -370,7 +366,6 @@
 		override public GObject RemoveChildAt(int index, bool dispose)
 		{
 			GObject child = base.RemoveChildAt(index, dispose);
-			child.onTouchBegin.Remove(_itemTouchBeginDelegate);
 			child.onClick.Remove(_itemClickDelegate);
 			child.onRightClick.Remove(_itemClickDelegate);

@@ -892,36 +887,11 @@
 			}
 		}

-		void __itemTouchBegin(EventContext context)
-		{
-			GButton item = context.sender as GButton;
-			if (item == null || selectionMode == ListSelectionMode.None)
-				return;
-
-			_selectionHandled = false;
-
-			if (UIConfig.defaultScrollTouchEffect
-				&& (this.scrollPane != null || this.parent != null && this.parent.scrollPane != null))
-				return;
-
-			if (selectionMode == ListSelectionMode.Single)
-			{
+		void __clickItem(EventContext context)
+		{
+			GObject item = context.sender as GObject;
+			if ((item is GButton) && selectionMode != ListSelectionMode.None)
 				SetSelectionOnEvent(item, context.inputEvent);
-			}
-			else
-			{
-				if (!item.selected)
-					SetSelectionOnEvent(item, context.inputEvent);
-				//如果item.selected，这里不处理selection，因为可能用户在拖动
-			}
-		}
-
-		void __clickItem(EventContext context)
-		{
-			GObject item = context.sender as GObject;
-			if (!_selectionHandled)
-				SetSelectionOnEvent(item, context.inputEvent);
-			_selectionHandled = false;

 			if (scrollPane != null && scrollItemToViewOnClick)
 				scrollPane.ScrollToView(item, true);
@@ -934,10 +904,6 @@

 		void SetSelectionOnEvent(GObject item, InputEvent evt)
 		{
-			if (!(item is GButton) || selectionMode == ListSelectionMode.None)
-				return;
-
-			_selectionHandled = true;
 			bool dontChangeLastIndex = false;
 			GButton button = (GButton)item;
 			int index = ChildIndexToItemIndex(GetChildIndex(item));


if (!string.IsNullOrEmpty(error))

if (!string.IsNullOrEmpty(error))

--- AdvancedNetToolsSolution/AntServicesMvc5/Controllers/HomeController.cs
+++ AdvancedNetToolsSolution/AntServicesMvc5/Controllers/HomeController.cs
@@ -253,6 +253,17 @@
                     }

                     string error = p.StandardError.ReadToEnd();
+                    if (!string.IsNullOrEmpty(error))
+                    {
+                        if (!error.ToUpperInvariant().Contains("WARNING"))
+                        {
+                            throw new ApplicationException(error);
+                        }
+                        if (error.ToUpperInvariant().Contains("ERROR"))
+                        {
+                            throw new ApplicationException(error);
+                        }
+                    }

                     p.WaitForExit(milliseconds: (int)TimeSpan.FromSeconds(1).TotalMilliseconds);


Update version 1.0.84

Update version 1.0.84

--- Build/CommonAssemblyInfo.cs
+++ Build/CommonAssemblyInfo.cs
@@ -15,5 +15,5 @@
 //
 // You can specify all the values or you can default the Revision and Build Numbers
 // by using the '*' as shown below:
-[assembly: AssemblyVersion("1.0.83.2")]
-[assembly: AssemblyFileVersion("1.0.83.2")]
+[assembly: AssemblyVersion("1.0.84.0")]
+[assembly: AssemblyFileVersion("1.0.84.0")]


Formatting

Formatting

--- AllReadyApp/Web-App/AllReady/Areas/Admin/Controllers/TaskController.cs
+++ AllReadyApp/Web-App/AllReady/Areas/Admin/Controllers/TaskController.cs
@@ -239,8 +239,8 @@
                     (model.IgnoreTimeRangeWarning == false))
                 {
                     ModelState.AddModelError("", "Although valid, task time is out of range for activity time from " +
-                        activity.StartDateTime.DateTime.ToString() + " to " + activity.EndDateTime.DateTime.ToString() + " " + activity.Campaign.TimeZoneId.ToString());
-                    ModelState.Remove("IgnoreWarning");
+                        activity.StartDateTime.DateTime.ToString("g") + " to " + activity.EndDateTime.DateTime.ToString("g") + " " + activity.Campaign.TimeZoneId.ToString());
+                    ModelState.Remove("IgnoreTimeRangeWarning");
                     model.IgnoreTimeRangeWarning = true;
                 }
             }


Synchrophasor: Updated registry queries for installation for configuration setup utility startup after install...

git-tfs-id: [https://tfs.codeplex.com/tfs/TFS07]$/openpdc/Synchrophasor/Current Version;C63971

--- Source/Tools/Setup/Main.cs
+++ Source/Tools/Setup/Main.cs
@@ -72,7 +72,7 @@
                         {
                             try
                             {
-                                // Attempt to launch .NET 4.0 installer... This requires elevated privledges, so this may fail
+                                // Attempt to launch .NET 4.0 installer...
                                 net40Install = new Process();
                                 net40Install.StartInfo.FileName = netInstallPath;
                                 net40Install.StartInfo.UseShellExecute = false;
@@ -124,6 +124,7 @@
         {
             this.WindowState = FormWindowState.Minimized;

+            // Install or uninstall openPDC
             Process openPDCInstall = new Process();

             openPDCInstall.StartInfo.FileName = "msiexec.exe";
@@ -140,19 +141,24 @@

             if (openPDCInstall.ExitCode == 0)
             {
-                // Read registry installation parameters
-                string installPath = AddPathSuffix(Registry.LocalMachine.GetValue(@"SOFTWARE\Grid Protection Alliance\openPDC\InstallPath", "").ToString().Trim());
-                string targetBitSize = Registry.LocalMachine.GetValue(@"SOFTWARE\Grid Protection Alliance\openPDC\TargetBitSize", "32bit").ToString().Trim();
-
-                // Run configuration setup utility
-                Process configSetupUtility = new Process();
-
-                configSetupUtility.StartInfo.FileName = installPath + "ConfigurationSetupUtility.exe";
-                configSetupUtility.StartInfo.Arguments = "-install -" + targetBitSize;
-                configSetupUtility.StartInfo.UseShellExecute = false;
-                configSetupUtility.Start();
-                configSetupUtility.WaitForExit();
-
+                // Run configuration setup utility post installation of openPDC, but not for uninstalls
+                if (string.Compare(parameters, "/x", true) != 0)
+                {
+                    // Read registry installation parameters
+                    string installPath = AddPathSuffix(Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Grid Protection Alliance\openPDC", "InstallPath", "").ToString().Trim());
+                    string targetBitSize = Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Grid Protection Alliance\openPDC", "TargetBitSize", "32bit").ToString().Trim();
+
+                    // Run configuration setup utility
+                    Process configSetupUtility = new Process();
+
+                    configSetupUtility.StartInfo.FileName = installPath + "ConfigurationSetupUtility.exe";
+                    configSetupUtility.StartInfo.Arguments = "-install -" + targetBitSize;
+                    configSetupUtility.StartInfo.UseShellExecute = false;
+                    configSetupUtility.Start();
+                    configSetupUtility.WaitForExit();
+                }
+
+                // Install or uninstall PMU Connection Tester
                 if (checkBoxConnectionTester.Checked)
                 {
                     Process connectionTesterInstall = new Process();


Add stopwatch

Add stopwatch

--- AudioAlign/AudioAlign.Audio/Matching/Echoprint/FingerprintGenerator.cs
+++ AudioAlign/AudioAlign.Audio/Matching/Echoprint/FingerprintGenerator.cs
@@ -33,6 +33,9 @@
             float[,] E = new float[SubBands, subbandAnalyzer.WindowCount];
             float[] analyzedFrame = new float[SubBands];

+            var sw = new Stopwatch();
+            sw.Start();
+
             int count = 0;
             while (subbandAnalyzer.HasNext()) {
                 subbandAnalyzer.ReadFrame(analyzedFrame);
@@ -44,11 +47,12 @@
                 count++;
             }

-            uint[,] bandOnsets;
-            uint[] bandOnsetCount;
-            // 345 ~= 1 sec (11025 / 8 [subband downsampling factor in SubbandAnalyzer] / 4 [RMS downsampling in adaptiveOnsets()] ~= 345 frames per second)
-            uint res = GetAdaptiveOnsets(E, 345, out bandOnsets, out bandOnsetCount);
+            Console.WriteLine("analysis time: " + sw.Elapsed);
+
+            sw.Restart();
             var codes = GetCodes(E);
+            sw.Stop();
+            Console.WriteLine("codegen time: " + sw.Elapsed);
         }

         private uint GetAdaptiveOnsets(float[,] E, int targetOnsetDistance, out uint[,] bandOnsets, out uint[] bandOnsetCount) {
@@ -172,6 +176,8 @@
             byte[] hashMaterial = new byte[5];
             uint[] bandOnsetCount;
             uint[,] bandOnsets;
+
+            // 345 ~= 1 sec (11025 / 8 [subband downsampling factor in SubbandAnalyzer] / 4 [RMS downsampling in adaptiveOnsets()] ~= 345 frames per second)
             uint onsetCount = GetAdaptiveOnsets(E, 345, out bandOnsets, out bandOnsetCount);
             List<FPCode> codes = new List<FPCode>((int)onsetCount * 6);


Add adaptive onset detection

Add adaptive onset detection

--- AudioAlign/AudioAlign.Audio/Matching/Echoprint/FingerprintGenerator.cs
+++ AudioAlign/AudioAlign.Audio/Matching/Echoprint/FingerprintGenerator.cs
@@ -18,12 +18,163 @@
     /// </summary>
     public class FingerprintGenerator {

+        private const uint HashSeed = 0x9ea5fa36;
+        private const float Quantize_DT_S = 256f / 11025f;
+        private const float Quantize_A_S = 256f / 11025f;
+        private const uint HashBitmask = 0x000fffff;
+        private const int SubBands = 8;
+
+        private const int _Offset = 0;
+
         public void Generate(AudioTrack track) {
             IAudioStream audioStream = new ResamplingStream(
                 new MonoStream(AudioStreamFactory.FromFileInfoIeee32(track.FileInfo)),
                 ResamplingQuality.Medium, 11025);

+            var whiteningStream = new WhiteningStream(audioStream, 40, 8, 10000);
+            var subbandAnalyzer = new SubbandAnalyzer(whiteningStream);

+            float[,] E = new float[SubBands, subbandAnalyzer.WindowCount];
+            float[] analyzedFrame = new float[SubBands];
+
+            int count = 0;
+            while (subbandAnalyzer.HasNext()) {
+                subbandAnalyzer.ReadFrame(analyzedFrame);
+
+                for (int i = 0; i < SubBands; i++) {
+                    E[i, count] = analyzedFrame[i];
+                }
+
+                count++;
+            }
+
+            float[,] outm;
+            uint[] onset_counter_for_band;
+            uint res = adaptiveOnsets(E, 345, out outm, out onset_counter_for_band);
+        }
+
+        uint adaptiveOnsets(float[,] E, int ttarg, out float[,] outm, out uint[] onset_counter_for_band) {
+            //  E is a sgram-like matrix of energies.
+            //const float *pE;
+            int bands, frames, i, j, k;
+            int deadtime = 128;
+            double[] H = new double[SubBands], taus = new double[SubBands], N = new double[SubBands];
+            int[] contact = new int[SubBands], lcontact = new int[SubBands], tsince = new int[SubBands];
+            double overfact = 1.1;  /* threshold rel. to actual peak */
+            uint onset_counter = 0;
+
+            // Take successive stretches of 8 subband samples and sum their energy under a hann window, then hop by 4 samples (50% window overlap).
+            int hop = 4;
+            int nsm = 8;
+            float[] ham = new float[nsm];
+            WindowUtil.Hann(ham, 0, nsm);
+
+
+            int nc = (int)(Math.Floor((float)E.GetLength(1) / (float)hop) - (Math.Floor((float)nsm / (float)hop) - 1));
+            float[,] Eb = new float[nc, 8];
+
+            for (i = 0; i < nc; i++) {
+                for (j = 0; j < SubBands; j++) {
+                    // Compute RMS of each block
+                    for (k = 0; k < nsm; k++) Eb[i, j] = Eb[i, j] + (E[j, (i * hop) + k] * ham[k]);
+                    Eb[i, j] = (float)Math.Sqrt(Eb[i, j]);
+                }
+            }
+
+            frames = Eb.GetLength(0);
+            bands = Eb.GetLength(1);
+
+            outm = new float[SubBands, frames];
+            onset_counter_for_band = new uint[SubBands];
+
+            double[] bn = { 0.1883, 0.4230, 0.3392 }; /* preemph filter */   // new
+            int nbn = 3;
+            double a1 = 0.98;
+            double[] Y0 = new double[SubBands];
+
+            for (j = 0; j < bands; ++j) {
+                onset_counter_for_band[j] = 0;
+                N[j] = 0.0;
+                taus[j] = 1.0;
+                H[j] = E[0, j];
+                contact[j] = 0;
+                lcontact[j] = 0;
+                tsince[j] = 0;
+                Y0[j] = 0;
+            }
+
+            for (i = 0; i < frames; ++i) {
+                for (j = 0; j < SubBands; ++j) {
+
+                    double xn = 0;
+                    /* calculate the filter -  FIR part */
+                    if (i >= 2 * nbn) {
+                        for (k = 0; k < nbn; ++k) {
+                            //xn += bn[k]*(pE[j-SubBands*k] - pE[j-SubBands*(2*nbn-k)]);
+                            xn += bn[k] * (E[j, i - k] - E[j, i - (2 * nbn - k)]);
+                        }
+                    }
+                    /* IIR part */
+                    xn = xn + a1 * Y0[j];
+                    /* remember the last filtered level */
+                    Y0[j] = xn;
+
+                    contact[j] = (xn > H[j]) ? 1 : 0;
+
+                    if (contact[j] == 1 && lcontact[j] == 0) {
+                        /* attach - record the threshold level unless we have one */
+                        if (N[j] == 0) {
+                            N[j] = H[j];
+                        }
+                    }
+                    if (contact[j] == 1) {
+                        /* update with new threshold */
+                        H[j] = xn * overfact;
+                    }
+                    else {
+                        /* apply decays */
+                        H[j] = H[j] * Math.Exp(-1.0 / (double)taus[j]);
+                    }
+
+                    if (contact[j] == 0 && lcontact[j] == 1) {
+                        /* detach */
+                        if (onset_counter_for_band[j] > 0 && (int)outm[j, onset_counter_for_band[j] - 1] > i - deadtime) {
+                            // overwrite last-written time
+                            --onset_counter_for_band[j];
+                            --onset_counter;
+                        }
+                        outm[j, onset_counter_for_band[j]++] = i;
+                        ++onset_counter;
+                        tsince[j] = 0;
+                    }
+                    ++tsince[j];
+                    if (tsince[j] > ttarg) {
+                        taus[j] = taus[j] - 1;
+                        if (taus[j] < 1) taus[j] = 1;
+                    }
+                    else {
+                        taus[j] = taus[j] + 1;
+                    }
+
+                    if ((contact[j] == 0) && (tsince[j] > deadtime)) {
+                        /* forget the threshold where we recently hit */
+                        N[j] = 0;
+                    }
+                    lcontact[j] = contact[j];
+                }
+            }
+
+            return onset_counter;
+        }
+
+        private uint quantized_time_for_frame_delta(uint frame_delta) {
+            double time_for_frame_delta = (double)frame_delta / ((double)11025 / 32.0);
+            return (uint)(((int)Math.Floor((time_for_frame_delta * 1000.0) / (float)Quantize_DT_S) * Quantize_DT_S) / Math.Floor(Quantize_DT_S * 1000.0));
+        }
+
+        private uint quantized_time_for_frame_absolute(uint frame) {
+            double time_for_frame = _Offset + (double)frame / ((double)11025 / 32.0);
+            return (uint)(((int)Math.Round((time_for_frame * 1000.0) / (float)Quantize_A_S) * Quantize_A_S) / Math.Floor(Quantize_A_S * 1000.0));
         }
     }
 }


[Bam] Removed another reference to V2

[Bam] Removed another reference to V2

--- Bam/Program.cs
+++ Bam/Program.cs
@@ -35,8 +35,6 @@
     /// </summary>
     class Program
     {
-        static bool UseV2 = true;
-
         public static class CommandLineArgumentHelper
         {
             public static void
@@ -89,140 +87,137 @@
             System.Console.CancelKeyPress += new System.ConsoleCancelEventHandler(HandleCancellation);
 #endif

-            if (UseV2)
-            {
-                var verbosityLevel = (Core.EVerboseLevel)Core.CommandLineProcessor.Evaluate(new Core.VerbosityLevel());
-                switch (verbosityLevel)
+            var verbosityLevel = (Core.EVerboseLevel)Core.CommandLineProcessor.Evaluate(new Core.VerbosityLevel());
+            switch (verbosityLevel)
+            {
+                case Core.EVerboseLevel.None:
+                case Core.EVerboseLevel.Info:
+                case Core.EVerboseLevel.Detail:
+                case Core.EVerboseLevel.Full:
+                    Core.State.VerbosityLevel = verbosityLevel;
+                    break;
+
+                default:
+                    throw new Core.Exception("Unrecognized verbosity level, {0}", verbosityLevel);
+            }
+
+            Core.State.ForceDefinitionFileUpdate = Core.CommandLineProcessor.Evaluate(new Core.ForceDefinitionFileUpdate());
+
+            if (Core.CommandLineProcessor.Evaluate(new Core.PrintHelp()))
+            {
+                CommandLineArgumentHelper.PrintHelp();
+                return;
+            }
+
+            if (Core.CommandLineProcessor.Evaluate(new Core.PrintVersion()))
+            {
+                Core.Log.MessageAll(Core.State.VersionString);
+                return;
+            }
+
+            if (Core.CommandLineProcessor.Evaluate(new Core.CreateDebugProject()))
+            {
+                DebugProject.Create();
+                return;
+            }
+
+            if (Core.CommandLineProcessor.Evaluate(new Core.MakePackage()))
+            {
+                Core.PackageUtilities.MakePackage();
+                return;
+            }
+
+            if (Core.CommandLineProcessor.Evaluate(new Core.AddDependentPackage()))
+            {
+                Core.PackageUtilities.AddDependentPackage();
+                return;
+            }
+
+            if (Core.CommandLineProcessor.Evaluate(new Core.ShowDefinitionFile()))
+            {
+                Core.PackageUtilities.IdentifyMainAndDependentPackages(true, false);
+                Core.Graph.Instance.MasterPackage.Show();
+                return;
+            }
+
+            // configure
+            Core.State.BuildRoot = Core.CommandLineProcessor.Evaluate(new Core.BuildRoot());
+            Core.State.CompileWithDebugSymbols = Core.CommandLineProcessor.Evaluate(new Core.UseDebugSymbols());
+            Core.State.BuildMode = Core.CommandLineProcessor.Evaluate(new Core.BuildMode());
+            if (null == Core.State.BuildMode)
+            {
+                throw new Core.Exception("No build mode specified");
+            }
+
+            var configs = new Core.Array<Core.Environment>();
+            var requestedConfigs = Core.CommandLineProcessor.Evaluate(new Core.BuildConfigurations());
+            if (0 == requestedConfigs.Count)
+            {
+                // default
+                requestedConfigs.Add(new Core.StringArray("debug"));
+            }
+            foreach (var configOption in requestedConfigs)
+            {
+                foreach (var config in configOption)
                 {
-                    case Core.EVerboseLevel.None:
-                    case Core.EVerboseLevel.Info:
-                    case Core.EVerboseLevel.Detail:
-                    case Core.EVerboseLevel.Full:
-                        Core.State.VerbosityLevel = verbosityLevel;
-                        break;
-
-                    default:
-                        throw new Core.Exception("Unrecognized verbosity level, {0}", verbosityLevel);
-                }
-
-                Core.State.ForceDefinitionFileUpdate = Core.CommandLineProcessor.Evaluate(new Core.ForceDefinitionFileUpdate());
-
-                if (Core.CommandLineProcessor.Evaluate(new Core.PrintHelp()))
-                {
-                    CommandLineArgumentHelper.PrintHelp();
-                    return;
-                }
-
-                if (Core.CommandLineProcessor.Evaluate(new Core.PrintVersion()))
-                {
-                    Core.Log.MessageAll(Core.State.VersionString);
-                    return;
-                }
-
-                if (Core.CommandLineProcessor.Evaluate(new Core.CreateDebugProject()))
-                {
-                    DebugProject.Create();
-                    return;
-                }
-
-                if (Core.CommandLineProcessor.Evaluate(new Core.MakePackage()))
-                {
-                    Core.PackageUtilities.MakePackage();
-                    return;
-                }
-
-                if (Core.CommandLineProcessor.Evaluate(new Core.AddDependentPackage()))
-                {
-                    Core.PackageUtilities.AddDependentPackage();
-                    return;
-                }
-
-                if (Core.CommandLineProcessor.Evaluate(new Core.ShowDefinitionFile()))
-                {
-                    Core.PackageUtilities.IdentifyMainAndDependentPackages(true, false);
-                    Core.Graph.Instance.MasterPackage.Show();
-                    return;
-                }
-
-                // configure
-                Core.State.BuildRoot = Core.CommandLineProcessor.Evaluate(new Core.BuildRoot());
-                Core.State.CompileWithDebugSymbols = Core.CommandLineProcessor.Evaluate(new Core.UseDebugSymbols());
-                Core.State.BuildMode = Core.CommandLineProcessor.Evaluate(new Core.BuildMode());
-                if (null == Core.State.BuildMode)
-                {
-                    throw new Core.Exception("No build mode specified");
-                }
-
-                var configs = new Core.Array<Core.Environment>();
-                var requestedConfigs = Core.CommandLineProcessor.Evaluate(new Core.BuildConfigurations());
-                if (0 == requestedConfigs.Count)
-                {
-                    // default
-                    requestedConfigs.Add(new Core.StringArray("debug"));
-                }
-                foreach (var configOption in requestedConfigs)
-                {
-                    foreach (var config in configOption)
+                    switch (config)
                     {
-                        switch (config)
-                        {
-                            case "debug":
-                                {
-                                    var env = new Core.Environment();
-                                    env.Configuration = Core.EConfiguration.Debug;
-                                    configs.Add(env);
-                                }
-                                break;
-
-                            case "optimized":
-                                {
-                                    var env = new Core.Environment();
-                                    env.Configuration = Core.EConfiguration.Optimized;
-                                    configs.Add(env);
-                                }
-                                break;
-
-                            case "profile":
-                                {
-                                    var env = new Core.Environment();
-                                    env.Configuration = Core.EConfiguration.Profile;
-                                    configs.Add(env);
-                                }
-                                break;
-
-                            case "final":
-                                {
-                                    var env = new Core.Environment();
-                                    env.Configuration = Core.EConfiguration.Final;
-                                    configs.Add(env);
-                                }
-                                break;
-
-                            default:
-                                throw new Core.Exception("Unrecognized configuration, {0}", config);
-                        }
+                        case "debug":
+                            {
+                                var env = new Core.Environment();
+                                env.Configuration = Core.EConfiguration.Debug;
+                                configs.Add(env);
+                            }
+                            break;
+
+                        case "optimized":
+                            {
+                                var env = new Core.Environment();
+                                env.Configuration = Core.EConfiguration.Optimized;
+                                configs.Add(env);
+                            }
+                            break;
+
+                        case "profile":
+                            {
+                                var env = new Core.Environment();
+                                env.Configuration = Core.EConfiguration.Profile;
+                                configs.Add(env);
+                            }
+                            break;
+
+                        case "final":
+                            {
+                                var env = new Core.Environment();
+                                env.Configuration = Core.EConfiguration.Final;
+                                configs.Add(env);
+                            }
+                            break;
+
+                        default:
+                            throw new Core.Exception("Unrecognized configuration, {0}", config);
                     }
                 }
-
-                try
+            }
+
+            try
+            {
+                Core.EntryPoint.Execute(configs);
+            }
+            catch (Bam.Core.Exception exception)
+            {
+                Core.Log.ErrorMessage(exception.Message);
+                if (null != exception.InnerException)
                 {
-                    Core.EntryPoint.Execute(configs);
+                    Core.Log.ErrorMessage("Additional details:");
+                    Core.Log.ErrorMessage(exception.InnerException.Message);
                 }
-                catch (Bam.Core.Exception exception)
-                {
-                    Core.Log.ErrorMessage(exception.Message);
-                    if (null != exception.InnerException)
-                    {
-                        Core.Log.ErrorMessage("Additional details:");
-                        Core.Log.ErrorMessage(exception.InnerException.Message);
-                    }
-                    System.Environment.ExitCode = -1;
-                }
-                finally
-                {
-                    Core.Log.Info((0 == System.Environment.ExitCode) ? "\nBuild Succeeded" : "\nBuild Failed");
-                    Core.Log.DebugMessage("Exit code {0}", System.Environment.ExitCode);
-                }
+                System.Environment.ExitCode = -1;
+            }
+            finally
+            {
+                Core.Log.Info((0 == System.Environment.ExitCode) ? "\nBuild Succeeded" : "\nBuild Failed");
+                Core.Log.DebugMessage("Exit code {0}", System.Environment.ExitCode);
             }
         }


adds note

adds note

--- src/Umbraco.Core/Sync/ISyncBootStateAccessor.cs
+++ src/Umbraco.Core/Sync/ISyncBootStateAccessor.cs
@@ -16,6 +16,6 @@
         /// <summary>
         /// Raised when the boot state is known
         /// </summary>
-        event EventHandler<SyncBootState> Booting;
+        event EventHandler<SyncBootState> Booting; // TODO: This should be removed in netcore
     }
 }


uaasscrum-827 - more robust umbraco.config

--- src/Umbraco.Web/umbraco.presentation/content.cs
+++ src/Umbraco.Web/umbraco.presentation/content.cs
@@ -431,7 +431,7 @@
             {
                 XmlNode x;

-                //Hack: this is here purely for backwards compat if someone for some reason is using the
+                //Hack: this is here purely for backwards compat if someone for some reason is using the
                 // ClearDocumentCache(int documentId) method and expecting it to remove the xml
                 if (removeDbXmlEntry)
                 {
@@ -870,8 +870,15 @@
             catch (Exception e)
             {
                 // if something goes wrong remove the file
-                DeleteXmlFile();
-
+                try
+                {
+                    DeleteXmlFile();
+                }
+                catch
+                {
+                    // don't make it worse: could be that we failed to write because we cannot
+                    // access the file, in which case we won't be able to delete it either
+                }
                 LogHelper.Error<content>("Failed to save Xml to file.", e);
             }
         }
@@ -933,7 +940,15 @@
             catch (Exception e)
             {
                 LogHelper.Error<content>("Failed to load Xml from file.", e);
-                DeleteXmlFile();
+                try
+                {
+                    DeleteXmlFile();
+                }
+                catch
+                {
+                    // don't make it worse: could be that we failed to read because we cannot
+                    // access the file, in which case we won't be able to delete it either
+                }
                 return null;
             }
         }