Don't keep reallocating the states list

Don't keep reallocating the states list

--- Assets/MixedRealityToolkit.Providers/WindowsMixedReality/XRSDK/Controllers/WindowsMixedRealityXRSDKArticulatedHand.cs
+++ Assets/MixedRealityToolkit.Providers/WindowsMixedReality/XRSDK/Controllers/WindowsMixedRealityXRSDKArticulatedHand.cs
@@ -52,6 +52,7 @@
         private int[] handMeshTriangleIndices = null;
         private bool hasRequestedHandMeshObserver = false;
         private Vector2[] handMeshUVs;
+        private readonly List<object> states = new List<object>();

         protected void InitializeUVs(Vector3[] neutralPoseVertices)
         {
@@ -179,7 +180,6 @@
                 return;
             }

-            List<object> states = new List<object>();
 #if WMR_ENABLED
             XRSDKSubsystemHelpers.InputSubsystem?.GetCurrentSourceStates(states);
 #endif // WMR_ENABLED


changed to use the more appropriately named RedisGateway

--- Common/ServiceStack.Redis/RedisWebServices/RedisWebServices.ServiceInterface/App/GetCodeGeneratedJavaScriptService.cs
+++ Common/ServiceStack.Redis/RedisWebServices/RedisWebServices.ServiceInterface/App/GetCodeGeneratedJavaScriptService.cs
@@ -17,14 +17,14 @@
 		{
 			var sb = new StringBuilder();

-			sb.Append(@"function RedisClient(baseUri) {
-RedisClient.$baseConstructor.call(this);
+			sb.Append(@"function RedisGateway(baseUri) {
+RedisGateway.$baseConstructor.call(this);

     this.gateway = new JsonServiceClient(baseUri);
 }
-RedisClient.errorFn = function() {
+RedisGateway.errorFn = function() {
 };
-RedisClient.extend(AjaxStack.ASObject, { type: 'AjaxStack.RedisClient' },
+RedisGateway.extend(AjaxStack.ASObject, { type: 'AjaxStack.RedisGateway' },
 {");

 			var allOperationTypes = EndpointHost.AllServiceOperations.AllOperations.Types;
@@ -83,7 +83,7 @@
 				}

 				sb.AppendLine("\t\t\t},");
-				sb.AppendLine("\t\t\tonErrorFn || RedisClient.errorFn);");
+				sb.AppendLine("\t\t\tonErrorFn || RedisGateway.errorFn);");
 				sb.Append("\t}");

 				if (opIndex != allOperationTypes.Count - 1)


Delete Maybe.cs

Delete Maybe.cs

--- JetBlack.Examples.Monads3/Maybe.cs
+++ JetBlack.Examples.Monads3/Maybe.cs
@@ -1,89 +0,0 @@
-using System;
-
-namespace JetBlack.Examples.Monads3
-{
-    public abstract class Maybe<T> : IEquatable<Maybe<T>>, IEquatable<T>
-    {
-        public static readonly Maybe<T> Nothing = new Empty();
-
-        private static readonly bool IsValueType = typeof (T).IsValueType;
-
-        public abstract T Value { get; }
-
-        public bool HasValue
-        {
-            get { return !ReferenceEquals(this, Nothing); }
-        }
-
-        public bool Equals(Maybe<T> other)
-        {
-            return
-                other != null &&
-                ((this is Empty && other is Empty) ||
-                (!(this is Empty || other is Empty) && (Value.Equals(other.Value))));
-        }
-
-        public bool Equals(T other)
-        {
-            return !ReferenceEquals(this, Nothing) && Value.Equals(other);
-        }
-
-        public override bool Equals(object obj)
-        {
-            return Equals(obj as Maybe<T>);
-        }
-
-        public override int GetHashCode()
-        {
-            return ReferenceEquals(this, Nothing) ? 0 : Value.GetHashCode();
-        }
-
-        public static implicit operator Maybe<T>(T value)
-        {
-            return IsValueType || !Equals(value, default(T)) ? new Just(value) : Nothing;
-        }
-
-        public static bool operator ==(Maybe<T> lhs, Maybe<T> rhs)
-        {
-            return (Equals(lhs, null) && Equals(rhs, null)) || (!Equals(lhs, null) && lhs.Equals(rhs));
-        }
-
-        public static bool operator !=(Maybe<T> lhs, Maybe<T> rhs)
-        {
-            return !(lhs == rhs);
-        }
-
-        sealed class Just : Maybe<T>
-        {
-            private readonly T _value;
-
-            public Just(T value)
-            {
-                _value = value;
-            }
-
-            public override T Value
-            {
-                get { return _value; }
-            }
-
-            public override string ToString()
-            {
-                return Value.ToString();
-            }
-        }
-
-        sealed class Empty : Maybe<T>
-        {
-            public override T Value
-            {
-                get { throw new InvalidOperationException("Maybe<T>.Nothing has no value"); }
-            }
-
-            public override string ToString()
-            {
-                return "@Nothing!";
-            }
-        }
-    }
-}


Fix glyphs being read outside of cached texture bounds

--- osu.Framework/IO/Stores/GlyphStore.cs
+++ osu.Framework/IO/Stores/GlyphStore.cs
@@ -171,23 +171,29 @@

             var image = new Image<Rgba32>(SixLabors.ImageSharp.Configuration.Default, charWidth, charHeight, new Rgba32(255, 255, 255, 0));

+            // in the case negative offsets are specified, we want to avoid writing pixels incorrectly to the output.
+            // this is a weird case and seems to only occur with italics fonts (and only in the x direction).
+            // y is accounted for as a safety measure.
+            int xOffset = Math.Max(0, -c.XOffset);
+            int yOffset = Math.Max(0, -c.YOffset);
+
             using (var stream = CacheStorage.GetStream(pageInfo.Filename))
             {
                 var pixels = image.GetPixelSpan();
-                stream.Seek(pageWidth * c.Y, SeekOrigin.Current);
-
-                for (int y = 0; y < c.Height; y++)
+                stream.Seek(pageWidth * (c.Y + yOffset), SeekOrigin.Current);
+
+                // the spritesheet may have unused pixels trimmed
+                int readableHeight = Math.Min(c.Height, pageInfo.Size.Height - c.Y);
+                int readableWidth = Math.Min(c.Width, pageWidth - c.X);
+
+                for (int y = yOffset; y < readableHeight; y++)
                 {
                     stream.Read(readBuffer, 0, pageWidth);

-                    for (int x = 0; x < c.Width; x++)
-                    {
-                        int offsetX = x + c.XOffset;
-                        int offsetY = y + c.YOffset;
-
-                        if (offsetX >= 0 && offsetY > 0 && offsetX < charWidth && offsetY < charHeight) // some glyphs can be offset beyond the valid texture bounds; ignore these pixels.
-                            pixels[offsetY * charWidth + offsetX] = new Rgba32(255, 255, 255, readBuffer[c.X + x]);
-                    }
+                    int writeOffset = (y + c.YOffset) * charWidth + c.XOffset;
+
+                    for (int x = xOffset; x < readableWidth; x++)
+                        pixels[writeOffset + x] = new Rgba32(255, 255, 255, readBuffer[c.X + x]);
                 }
             }


Remove caught objects on revert result

Remove caught objects on revert result

--- osu.Game.Rulesets.Catch/UI/Catcher.cs
+++ osu.Game.Rulesets.Catch/UI/Catcher.cs
@@ -241,7 +241,7 @@
                 updateState(CatcherAnimationState.Fail);
         }

-        public void OnRevertResult(DrawableCatchHitObject fruit, JudgementResult result)
+        public void OnRevertResult(DrawableCatchHitObject drawableObject, JudgementResult result)
         {
             var catchResult = (CatchJudgementResult)result;

@@ -255,6 +255,9 @@
                 else
                     SetHyperDashState();
             }
+
+            caughtFruitContainer.RemoveAll(d => d.HitObject == drawableObject.HitObject);
+            droppedObjectTarget.RemoveAll(d => (d as DrawableCatchHitObject)?.HitObject == drawableObject.HitObject);
         }

         /// <summary>


Rename caughtFruitContainer -> caughtObjectContainer

--- osu.Game.Rulesets.Catch/UI/Catcher.cs
+++ osu.Game.Rulesets.Catch/UI/Catcher.cs
@@ -56,7 +56,7 @@
         /// <summary>
         /// Contains caught objects on the plate.
         /// </summary>
-        private readonly Container<CaughtObject> caughtFruitContainer;
+        private readonly Container<CaughtObject> caughtObjectContainer;

         /// <summary>
         /// Contains objects dropped from the plate.
@@ -138,7 +138,7 @@
                 caughtBananaPool = new DrawablePool<CaughtBanana>(100),
                 // less capacity is needed compared to fruit because droplet is not stacked
                 caughtDropletPool = new DrawablePool<CaughtDroplet>(25),
-                caughtFruitContainer = new Container<CaughtObject>
+                caughtObjectContainer = new Container<CaughtObject>
                 {
                     Anchor = Anchor.TopCentre,
                     Origin = Anchor.BottomCentre,
@@ -186,7 +186,7 @@
         /// <summary>
         /// Creates proxied content to be displayed beneath hitobjects.
         /// </summary>
-        public Drawable CreateProxiedContent() => caughtFruitContainer.CreateProxy();
+        public Drawable CreateProxiedContent() => caughtObjectContainer.CreateProxy();

         /// <summary>
         /// Calculates the scale of the catcher based off the provided beatmap difficulty.
@@ -279,7 +279,7 @@
                     SetHyperDashState();
             }

-            caughtFruitContainer.RemoveAll(d => d.HitObject == drawableObject.HitObject);
+            caughtObjectContainer.RemoveAll(d => d.HitObject == drawableObject.HitObject);
             droppedObjectTarget.RemoveAll(d => d.HitObject == drawableObject.HitObject);
             hitExplosionContainer.RemoveAll(d => d.HitObject == drawableObject.HitObject);
         }
@@ -475,7 +475,7 @@
             caughtObject.Position = position;
             caughtObject.Scale /= 2;

-            caughtFruitContainer.Add(caughtObject);
+            caughtObjectContainer.Add(caughtObject);

             if (!caughtObject.StaysOnPlate)
                 removeFromPlate(caughtObject, DroppedObjectAnimation.Explode);
@@ -486,7 +486,7 @@
             const float radius_div_2 = CatchHitObject.OBJECT_RADIUS / 2;
             const float allowance = 10;

-            while (caughtFruitContainer.Any(f => Vector2Extensions.Distance(f.Position, position) < (displayRadius + radius_div_2) / (allowance / 2)))
+            while (caughtObjectContainer.Any(f => Vector2Extensions.Distance(f.Position, position) < (displayRadius + radius_div_2) / (allowance / 2)))
             {
                 float diff = (displayRadius + radius_div_2) / allowance;

@@ -533,17 +533,17 @@

             droppedObject.CopyStateFrom(caughtObject);
             droppedObject.Anchor = Anchor.TopLeft;
-            droppedObject.Position = caughtFruitContainer.ToSpaceOfOtherDrawable(caughtObject.DrawPosition, droppedObjectTarget);
+            droppedObject.Position = caughtObjectContainer.ToSpaceOfOtherDrawable(caughtObject.DrawPosition, droppedObjectTarget);

             return droppedObject;
         }

         private void clearPlate(DroppedObjectAnimation animation)
         {
-            var caughtObjects = caughtFruitContainer.Children.ToArray();
+            var caughtObjects = caughtObjectContainer.Children.ToArray();
             var droppedObjects = caughtObjects.Select(getDroppedObject).ToArray();

-            caughtFruitContainer.Clear(false);
+            caughtObjectContainer.Clear(false);

             droppedObjectTarget.AddRange(droppedObjects);

@@ -555,7 +555,7 @@
         {
             var droppedObject = getDroppedObject(caughtObject);

-            if (!caughtFruitContainer.Remove(caughtObject))
+            if (!caughtObjectContainer.Remove(caughtObject))
                 throw new InvalidOperationException("Can only drop a caught object on the plate");

             droppedObjectTarget.Add(droppedObject);
@@ -573,7 +573,7 @@
                     break;

                 case DroppedObjectAnimation.Explode:
-                    var originalX = droppedObjectTarget.ToSpaceOfOtherDrawable(d.DrawPosition, caughtFruitContainer).X * Scale.X;
+                    var originalX = droppedObjectTarget.ToSpaceOfOtherDrawable(d.DrawPosition, caughtObjectContainer).X * Scale.X;
                     d.MoveToY(d.Y - 50, 250, Easing.OutSine).Then().MoveToY(d.Y + 50, 500, Easing.InSine);
                     d.MoveToX(d.X + originalX * 6, 1000);
                     d.FadeOut(750);


Fix preview track manager permanently muting game tracks

--- osu.Game/Audio/PreviewTrackManager.cs
+++ osu.Game/Audio/PreviewTrackManager.cs
@@ -80,7 +80,6 @@
                 return;

             current.Stop();
-            current = null;
         }

         /// <summary>


chore (Code Cleanup) minor code cleanup

chore (Code Cleanup) minor code cleanup

Organizing usings, whitespace, variable declarations.

--- src/formulate.api/Controllers/SubmissionsController.cs
+++ src/formulate.api/Controllers/SubmissionsController.cs
@@ -3,16 +3,13 @@

     // Namespaces.
     using app.Managers;
+    using app.Persistence;
     using core.Types;
     using core.Utilities;
     using System;
     using System.IO;
     using System.Linq;
     using System.Web.Mvc;
-
-    using formulate.app.Persistence;
-
-    using Umbraco.Core.Models.PublishedContent;
     using Umbraco.Web.Mvc;

@@ -61,7 +58,7 @@
             var fileKeys = Request.Files.AllKeys;
             var formId = Guid.Parse(Request["FormId"]);
             var pageId = NumberUtility.AttemptParseInt(Request["PageId"]);
-            IPublishedContent pageNode = pageId.HasValue ? Umbraco.Content(pageId.Value) : null;
+            var pageNode = pageId.HasValue ? Umbraco.Content(pageId.Value) : null;
             var pageUrl = pageNode?.Url;
             var pageName = pageNode?.Name;

@@ -138,7 +135,8 @@
                 Validate = Config.EnableServerSideValidation
             };

-            var result = new Submissions(Forms, Validations, Logger).SubmitForm(formId, values, fileValues, payload, options, context);
+            var result = new Submissions(Forms, Validations, Logger)
+                .SubmitForm(formId, values, fileValues, payload, options, context);

             // Return result.
             return Json(new


Ref event should be base64 encoded (#853)


fix regex escaping (#1700)

fix regex escaping (#1700)

--- src/generator/AutoRest.CSharp/ClientModelExtensions.cs
+++ src/generator/AutoRest.CSharp/ClientModelExtensions.cs
@@ -11,6 +11,9 @@
 using AutoRest.CSharp.Model;
 using AutoRest.Extensions;
 using static AutoRest.Core.Utilities.DependencyInjection;
+using System.IO;
+using System.CodeDom.Compiler;
+using System.CodeDom;

 namespace AutoRest.CSharp
 {
@@ -383,6 +386,20 @@
             return null;
         }

+        /// <summary>
+        /// Generates a C# string literal for given string, fully escaped and such.
+        /// </summary>
+        private static string ToLiteral(string input)
+        {
+            using (var writer = new StringWriter())
+            {
+                using (var provider = CodeDomProvider.CreateProvider("CSharp"))
+                {
+                    provider.GenerateCodeFromExpression(new CodePrimitiveExpression(input), writer, null);
+                    return writer.ToString();
+                }
+            }
+        }

         private static void AppendConstraintValidations(string valueReference, Dictionary<Constraint, string> constraints, IndentedStringBuilder sb, KnownFormat format)
         {
@@ -420,7 +437,7 @@
                         constraintCheck = $"{valueReference} % {constraintValue} != 0";
                         break;
                     case Constraint.Pattern:
-                        constraintValue = $"\"{constraintValue.Replace("\\", "\\\\")}\"";
+                        constraintValue = ToLiteral(constraintValue);
                         constraintCheck = $"!System.Text.RegularExpressions.Regex.IsMatch({valueReference}, {constraintValue})";
                         break;
                     case Constraint.UniqueItems:


Fixing possible port assignment collision

--- Kudu.SiteManagement/SiteManager.cs
+++ Kudu.SiteManagement/SiteManager.cs
@@ -10,6 +10,7 @@
     public class SiteManager : ISiteManager
     {
         private const string KuduAppPoolName = "kudu";
+        private static Random portNumberGenRnd = new Random((int)DateTime.Now.Ticks);

         private readonly IPathResolver _pathResolver;

@@ -160,21 +161,20 @@
             return kuduAppPool;
         }

-        //TODO this is duplicated in HgServer.cs.
-        private int GetRandomPort()
-        {
-            Random rnd = new Random((int) DateTime.Now.Ticks);
-            int randomPort = rnd.Next(1025, 65535);
-            while (!IsAvailable(randomPort))
-            {
-                randomPort = rnd.Next(1025, 65535);
+        //TODO this is duplicated in HgServer.cs, though out of sync in functionality.
+        private int GetRandomPort(IIS.ServerManager iis)
+        {
+            int randomPort = portNumberGenRnd.Next(1025, 65535);
+            while (!IsAvailable(randomPort, iis))
+            {
+                randomPort = portNumberGenRnd.Next(1025, 65535);
             }

             return randomPort;
         }

-        //TODO this is duplicated in HgServer.cs.
-        private bool IsAvailable(int port)
+        //TODO this is duplicated in HgServer.cs, though out of sync in functionality.
+        private bool IsAvailable(int port, IIS.ServerManager iis)
         {
             var tcpConnections = IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpConnections();
             foreach (var connectionInfo in tcpConnections)
@@ -185,6 +185,17 @@
                 }
             }

+            foreach (var iisSite in iis.Sites)
+            {
+                foreach (var binding in iisSite.Bindings)
+                {
+                    if (binding.EndPoint != null && binding.EndPoint.Port == port)
+                    {
+                        return false;
+                    }
+                }
+            }
+
             return true;
         }

@@ -192,7 +203,7 @@
         {
             EnsureKuduAppPool(iis);

-            int sitePort = GetRandomPort();
+            int sitePort = GetRandomPort(iis);
             var site = iis.Sites.Add(siteName, siteRoot, sitePort);
             site.ApplicationDefaults.ApplicationPoolName = KuduAppPoolName;


fixed assertion arg order

fixed assertion arg order


Added Optional() for Nullable<T>

Added Optional() for Nullable<T>

--- LanguageExt.Core/Prelude_Option.cs
+++ LanguageExt.Core/Prelude_Option.cs
@@ -37,8 +37,6 @@
         /// <summary>
         /// Create an Option
         /// </summary>
-        /// <typeparam name="T"></typeparam>
-        /// <param name="value"></param>
         /// <typeparam name="T">T</typeparam>
         /// <param name="value">Non-null value to be made optional</param>
         /// <returns>If the value is null it will be None else Some(value)</returns>
@@ -46,6 +44,17 @@
             value == null
                 ? Option<T>.None
                 : Option<T>.Some(value);
+
+        /// <summary>
+        /// Create an Option
+        /// </summary>
+        /// <typeparam name="T">T</typeparam>
+        /// <param name="value">Non-null value to be made optional</param>
+        /// <returns>If the value is null it will be None else Some(value)</returns>
+        public static Option<T> Optional<T>(Nullable<T> value) where T : struct =>
+            value.HasValue
+                ? Option<T>.Some(value.Value)
+                : Option<T>.None;

         public static T failure<T>(Option<T> option, Func<T> None) =>
             option.Failure(None);


--- renderdocui/Windows/MainWindow.cs
+++ renderdocui/Windows/MainWindow.cs
@@ -1101,6 +1101,10 @@
                     item.Text = String.Format("{0} (Offline)", host.Hostname);
                 item.Click += new EventHandler(switchContext);
                 item.Tag = host;
+
+                // don't allow switching to the connected host
+                if (host.Connected)
+                    item.Enabled = false;

                 items[idx++] = item;
             }


fix main view model dispose when closing

--- imageClipPaste/ViewModel/ViewModelLocator.cs
+++ imageClipPaste/ViewModel/ViewModelLocator.cs
@@ -110,12 +110,8 @@
             CleanupPasteProcessSelect();
             CleanupApplicationSetting();

-
-            if (SimpleIoc.Default.IsRegistered<MainWindow>())
-            {
-                SimpleIoc.Default.GetInstance<MainViewModel>().Cleanup();
-                SimpleIoc.Default.Unregister<MainViewModel>();
-            }
+            SimpleIoc.Default.GetInstance<MainViewModel>().Cleanup();
+            SimpleIoc.Default.Unregister<MainViewModel>();
         }

         /// <summary>


Ticket 137 : Add scope "uma_authorization"

--- SimpleIdentityServer/src/SimpleIdentityServer.DataAccess.SqlServer/Extensions/SimpleIdentityServerContextExtensions.cs
+++ SimpleIdentityServer/src/SimpleIdentityServer.DataAccess.SqlServer/Extensions/SimpleIdentityServerContextExtensions.cs
@@ -510,6 +510,10 @@
                             new ClientScope
                             {
                                 ScopeName = "uma_protection"
+                            },
+                            new ClientScope
+                            {
+                                ScopeName = "uma_authorization"
                             }
                         },
                         GrantTypes = "3",


Handling PK field names that aren't "Id".


Added callback to parse comma strings.

Added callback to parse comma strings.

--- numpy/NumpyDotNet/NpyDescr.cs
+++ numpy/NumpyDotNet/NpyDescr.cs
@@ -42,7 +42,7 @@
                 if (!String.IsNullOrEmpty(s) && CheckForDatetime(s)) {
                     result = ConvertFromDatetime(cntx, s);
                 } else if (CheckForCommaString(s)) {
-                    result = ConvertFromCommaString(s);
+                    result = ConvertFromCommaString(cntx, s);
                 } else {
                     result = ConvertSimpleString(s);
                 }
@@ -171,8 +171,23 @@
             return s.Contains(',');
         }

-        private static dtype ConvertFromCommaString(String s) {
+        private static dtype ConvertFromCommaString(CodeContext cntx, String s) {
+            List val = NpyUtil_Python.CallInternal(cntx, "_commastring", s) as List;
+            if (val == null || val.Count < 1) {
+                throw new IronPython.Runtime.Exceptions.RuntimeException(
+                    "_commastring not returning a list with len >= 1");
+            }
+
+            if (val.Count == 1) {
+                return DescrConverter(cntx, val[0]);
+            } else {
+                return ConvertFromCommaStringList(cntx, val);
+            }
             // TODO: Calls Python function, needs integration of numpy + .net interface
+            throw new NotImplementedException();
+        }
+
+        private static dtype ConvertFromCommaStringList(CodeContext cntx, List l) {
             throw new NotImplementedException();
         }


Ajuste da funcionalidade de alteração do doador, valdiando as informações passadas pelo request .


FIX UTs

FIX UTs

- field can be null
- can be a Dict (instead of Hashtable) on some fwks, used IDic as a
common interface

--- ILRepack/Steps/ResourceProcessing/BamlStreamCollector.cs
+++ ILRepack/Steps/ResourceProcessing/BamlStreamCollector.cs
@@ -105,8 +105,8 @@

         private static bool TryGetPreserializedData(ResourceWriter resourceWriter, string resourceName, out byte[] preserializedData)
         {
-            Hashtable resourcesHashtable = (Hashtable)resourceWriter.GetFieldValue("_preserializedData");
-            if (!resourcesHashtable.ContainsKey(resourceName))
+            IDictionary resourcesHashtable = (IDictionary)resourceWriter.GetFieldValue("_preserializedData");
+            if (resourcesHashtable == null || !resourcesHashtable.Contains(resourceName))
             {
                 preserializedData = null;
                 return false;


Remove unused file

Remove unused file

--- Joinrpg/Views/Shared/DisplayTemplates/HiddenArray.cshtml
+++ Joinrpg/Views/Shared/DisplayTemplates/HiddenArray.cshtml
@@ -1,6 +0,0 @@
-@model int[]
-
-@for (var i = 0; i < Model.Length; i++)
-{
-    @Html.HiddenFor(m => Model[i])
-}


Ensures drop has a value, and renames function.

--- Python/Tests/Utilities.Python.Analysis/PythonTestData.cs
+++ Python/Tests/Utilities.Python.Analysis/PythonTestData.cs
@@ -47,7 +47,7 @@
             return Directory.Exists(path) ? path : null;
         }

-        private static string GetSolutionDir() {
+        private static string GetRootDir() {
             var dir = CommonUtils.GetParent((typeof(TestData)).Assembly.Location);
             while (!string.IsNullOrEmpty(dir) &&
                 Directory.Exists(dir) &&
@@ -61,18 +61,19 @@
             var binSource = Environment.GetEnvironmentVariable("PTVS_BINARIES_SOURCE");
             var testDataSource = Environment.GetEnvironmentVariable("PTVS_TESTDATA_SOURCE");

-            var drop = Environment.GetEnvironmentVariable("PTVS_DROP");
+            var drop = Environment.GetEnvironmentVariable("PTVS_DROP") ??
+                CommonUtils.GetParent(CommonUtils.GetParent(typeof(TestData).Assembly.Location));
             string buildRoot = null;

             if (string.IsNullOrEmpty(binSource)) {
-                buildRoot = buildRoot ?? GetSolutionDir();
+                buildRoot = buildRoot ?? GetRootDir();
                 binSource = FindDirectoryFromLandmark(buildRoot, BinariesInSourceTree, BinariesLandmark)
                     ?? FindDirectoryFromLandmark(drop, BinariesInTestDrop, BinariesLandmark)
                     ?? FindDirectoryFromLandmark(drop, BinariesInReleaseDrop, BinariesLandmark);
             }

             if (string.IsNullOrEmpty(testDataSource) && includeTestData) {
-                buildRoot = buildRoot ?? GetSolutionDir();
+                buildRoot = buildRoot ?? GetRootDir();
                 testDataSource = FindDirectoryFromLandmark(buildRoot, TestDataInSourceTree, TestDataLandmark)
                     ?? FindDirectoryFromLandmark(drop, TestDataInTestDrop, TestDataLandmark)
                     ?? FindDirectoryFromLandmark(drop, TestDataInReleaseDrop, TestDataLandmark);


Fix precedence for Windows metadata scripts.

Specifying an instance metadata script will block project scripts.

--- agent/GCEMetadataScripts/ScriptReader.cs
+++ agent/GCEMetadataScripts/ScriptReader.cs
@@ -280,34 +280,13 @@
             }
         }

-        public List<MetadataScript> GetScripts(MetadataJson metadata)
-        {
-            AttributesJson instanceAttributesJson;
-            AttributesJson projectAttributesJson;
-            try
-            {
-                instanceAttributesJson = metadata.Instance.Attributes;
-            }
-            catch (NullReferenceException)
-            {
-                instanceAttributesJson = null;
-            }
-
-            try
-            {
-                projectAttributesJson = metadata.Project.Attributes;
-            }
-            catch (NullReferenceException)
-            {
-                projectAttributesJson = null;
-            }
-
+        public List<MetadataScript> GetAttributeScripts(AttributesJson attributesJson)
+        {
             List<MetadataScript> scripts = new List<MetadataScript>();
             foreach (string suffix in MetadataScript.Suffixes)
             {
                 string scriptKey = MetadataScript.GetMetadataKeyTitle(this.scriptType, suffix);
-                string script = GetPropertyValue(instanceAttributesJson, scriptKey) ??
-                    GetPropertyValue(projectAttributesJson, scriptKey);
+                string script = GetPropertyValue(attributesJson, scriptKey);
                 if (!string.IsNullOrEmpty(script))
                 {
                     Logger.Info("Found {0} in metadata.", MetadataScript.GetMetadataKeyHyphen(this.scriptType, suffix));
@@ -317,5 +296,36 @@

             return scripts;
         }
+
+        public List<MetadataScript> GetScripts(MetadataJson metadata)
+        {
+            AttributesJson attributesJson;
+            List<MetadataScript> scripts = new List<MetadataScript>();
+            try
+            {
+                attributesJson = metadata.Instance.Attributes;
+            }
+            catch (NullReferenceException)
+            {
+                attributesJson = null;
+            }
+
+            scripts = GetAttributeScripts(attributesJson);
+            if (scripts.Count > 0)
+            {
+                return scripts;
+            }
+
+            try
+            {
+                attributesJson = metadata.Project.Attributes;
+            }
+            catch (NullReferenceException)
+            {
+                attributesJson = null;
+            }
+
+            return scripts;
+        }
     }
 }


remove dispose call

remove dispose call

--- tests/Gigya.Microdot.Orleans.Hosting.UnitTests/Microservice/WarmupTestService/WarmupTestServiceHostWithSiloHostFake.cs
+++ tests/Gigya.Microdot.Orleans.Hosting.UnitTests/Microservice/WarmupTestService/WarmupTestServiceHostWithSiloHostFake.cs
@@ -38,7 +38,7 @@
             await WaitForServiceStartedAsync();
             Stop();
             await WaitForServiceGracefullyStoppedAsync();
-            Dispose();
+            //Dispose();

             _hostDisposedEvent.SetResult(true);
         }


Tweak to invariant error message

Tweak to invariant error message

--- src/CommitmentsV2/SFA.DAS.CommitmentsV2/Models/DraftApprenticeship.cs
+++ src/CommitmentsV2/SFA.DAS.CommitmentsV2/Models/DraftApprenticeship.cs
@@ -107,22 +107,22 @@
         {
             if (update.FirstName != FirstName)
             {
-                throw new DomainException(nameof(FirstName), "FirstName property for DraftApprenticeship in ChangeOfPartyCohort cannot be modified");
+                throw new DomainException(nameof(FirstName), "FirstName for DraftApprenticeship in ChangeOfPartyCohort cannot be modified");
             }

             if (update.LastName != LastName)
             {
-                throw new DomainException(nameof(LastName), "LastName property for DraftApprenticeship in ChangeOfPartyCohort cannot be modified");
+                throw new DomainException(nameof(LastName), "LastName for DraftApprenticeship in ChangeOfPartyCohort cannot be modified");
             }

             if (update.DateOfBirth != DateOfBirth)
             {
-                throw new DomainException(nameof(LastName), "LastName property for DraftApprenticeship in ChangeOfPartyCohort cannot be modified");
+                throw new DomainException(nameof(LastName), "DateOfBirth for DraftApprenticeship in ChangeOfPartyCohort cannot be modified");
             }

             if (update.TrainingProgramme?.CourseCode != CourseCode)
             {
-                throw new DomainException(nameof(LastName), "LastName property for DraftApprenticeship in ChangeOfPartyCohort cannot be modified");
+                throw new DomainException(nameof(LastName), "CourseCode for DraftApprenticeship in ChangeOfPartyCohort cannot be modified");
             }
         }
     }


Fix: Missing offset.

Fix: Missing offset.


Check user preference

Check user preference

--- src/Features/CSharp/Portable/ConvertSwitchStatementToExpression/ConvertSwitchStatementToExpressionDiagnosticAnalyzer.cs
+++ src/Features/CSharp/Portable/ConvertSwitchStatementToExpression/ConvertSwitchStatementToExpressionDiagnosticAnalyzer.cs
@@ -4,6 +4,7 @@
 using System.Globalization;
 using System.Linq;
 using Microsoft.CodeAnalysis.CodeStyle;
+using Microsoft.CodeAnalysis.CSharp.CodeStyle;
 using Microsoft.CodeAnalysis.CSharp.Syntax;
 using Microsoft.CodeAnalysis.Diagnostics;

@@ -26,6 +27,29 @@

         private void AnalyzeSyntax(SyntaxNodeAnalysisContext context)
         {
+            var node = context.Node;
+            var syntaxTree = node.SyntaxTree;
+
+            if (((CSharpParseOptions)syntaxTree.Options).LanguageVersion < LanguageVersion.CSharp8)
+            {
+                return;
+            }
+
+            var options = context.Options;
+            var cancellationToken = context.CancellationToken;
+            var optionSet = options.GetDocumentOptionSetAsync(syntaxTree, cancellationToken).GetAwaiter().GetResult();
+            if (optionSet == null)
+            {
+                return;
+            }
+
+            var styleOption = optionSet.GetOption(CSharpCodeStyleOptions.PreferSwitchExpression);
+            if (!styleOption.Value)
+            {
+                // User has disabled this feature.
+                return;
+            }
+
             var switchStatement = context.Node;
             if (switchStatement.GetDiagnostics().Any(diagnostic => diagnostic.Severity == DiagnosticSeverity.Error))
             {


Made GetPaddedLength() static

Made GetPaddedLength() static

--- MimeKit/Tnef/TnefPropertyReader.cs
+++ MimeKit/Tnef/TnefPropertyReader.cs
@@ -227,7 +227,7 @@
 			return DateTime.FromFileTime (fileTime);
 		}

-		int GetPaddedLength (int length)
+		static int GetPaddedLength (int length)
 		{
 			return (length + 3) & ~3;
 		}


again...

again...

--- Minimart/Views/Shared/Error.cshtml
+++ Minimart/Views/Shared/Error.cshtml
@@ -7,4 +7,7 @@
 <hgroup class="title">

Error.

An error occurred while processing your request.

+
@Model.Exception.Message

+
@Model.Exception.StackTrace

+
 </hgroup>


Comments

Comments

--- MinimumEditDistance/Levenshtein.cs
+++ MinimumEditDistance/Levenshtein.cs
@@ -32,7 +32,7 @@
         }

         /// <summary>
-        /// Calculates the Levenshtein minimum edit distance from one string to another
+        /// Calculates the Levenshtein minimum edit distance from one string to another -> optionally uses a MemoryStructure for the algo of your choice
         /// </summary>
         /// <param name="s"></param>
         /// <param name="t"></param>


Added option to disable and enable NameAnimation

--- Mod/Modules/ModuleNameAnimation.cs
+++ Mod/Modules/ModuleNameAnimation.cs
@@ -1,7 +1,75 @@
-namespace Mod.Modules
+using System;
+using System.ComponentModel;
+using ExitGames.Client.Photon;
+using Mod.Interface;
+using UnityEngine;
+using Animator = Mod.Animation.Animator;
+
+namespace Mod.Modules
 {
-    public class ModuleNameAnimation
+    public class ModuleNameAnimation : Module
     {
+        public override string ID => nameof(ModuleNameAnimation);
+        public override string Name => "Name Animation";
+        public override string Description => "Animates your in game name with an animation of your choice.";
+        public override bool IsAbusive => false;
+        public override bool HasGUI => true;
+
+        private int _updatesPerSecond = 3;
+        private int _shades = 25;
+
+        private Animator _animator;
+
+        protected override void OnModuleEnable()
+        {
+            _animator = new Animator(Shelter.AnimationManager.Animation, 20);
+            _animator.ComputeNext();
+        }

+        private float _lastUpdate;
+        protected override void OnModuleUpdate()
+        {
+            if (!PhotonNetwork.inRoom || Time.time - _lastUpdate < 1f / _updatesPerSecond)
+                return;
+
+            Player.Self.SetCustomProperties(new Hashtable
+            {
+                {PlayerProperty.Name, _animator.Current}
+            });
+
+            _animator.ComputeNext();
+            _lastUpdate = Time.time;
+        }
+
+        public override Action<Rect> GetGUI()
+        {
+            Texture2D background = Gui.Texture(255, 255, 255, 160); // Hopefully disposed by GC.. TODO: Need proper disposal (Should be after game but on GUI close is good enough)
+            return rect =>
+            {
+                GUI.DrawTexture(rect, background);
+                GUILayout.BeginArea(rect);
+                GUILayout.Label("[THIS UI IS WIP]");
+                GUILayout.Label("Animation:");
+                GUILayout.Label($"Shades: {_shades}");
+                _shades = (int) GUILayout.HorizontalSlider(_shades, 1, 50);
+                GUILayout.Label($"UpdatesPerSecond: {_updatesPerSecond}");
+                _updatesPerSecond = (int) GUILayout.HorizontalSlider(_updatesPerSecond, 1, 100); //TODO: Color viewer and Animation selector
+                if (GUILayout.Button("Apply shades"))
+                {
+                    _animator = new Animator(Shelter.AnimationManager.Animation, _shades);
+                    _animator.ComputeNext();
+                }
+                GUILayout.EndArea();
+            };
+        }
+
+        protected override void OnModuleDisable()
+        {
+            _animator = null;
+            Player.Self.SetCustomProperties(new Hashtable
+            {
+                {PlayerProperty.Name, Shelter.Profile.Name}
+            });
+        }
     }
 }


Render the app's About info on the REPL screen

--- MultiMiner.TUI/MinerApplication.cs
+++ MultiMiner.TUI/MinerApplication.cs
@@ -116,36 +116,47 @@
             Console.CursorVisible = false;
             Console.Clear();

+            OutputAboutInfo();
+        }
+
+        private const int SplashInfoHeight = 6;
+        private void OutputAboutInfo()
+        {
             var compileDate = Assembly.GetExecutingAssembly().GetCompileDate();
             var minerVersion = MultiMinerInstaller.GetInstalledMinerVersion();

             var row = 0;

-            if (SetCursorPosition(1, row++))
-                WriteText(" _____     _ _   _ _____ _", ConsoleColor.Cyan);
-            if (SetCursorPosition(1, row++))
-                WriteText("|     |_ _| | |_|_|     |_|___ ___ ___", ConsoleColor.Cyan);
-            if (SetCursorPosition(1, row++))
-                WriteText("| | | | | | |  _| | | | | |   | -_|  _|", ConsoleColor.Cyan);
-            if (SetCursorPosition(1, row++))
-                WriteText("|_|_|_|___|_|_| |_|_|_|_|_|_|_|___|_|  ", ConsoleColor.Cyan);
-
+            if (SetCursorPosition(0, row++))
+                WriteText("  _____     _ _   _ _____ _".PadRight(Console.WindowWidth), ConsoleColor.Cyan);
+            if (SetCursorPosition(0, row++))
+                WriteText(" |     |_ _| | |_|_|     |_|___ ___ ___".PadRight(Console.WindowWidth), ConsoleColor.Cyan);
+            if (SetCursorPosition(0, row++))
+                WriteText(" | | | | | | |  _| | | | | |   | -_|  _|".PadRight(Console.WindowWidth), ConsoleColor.Cyan);
+            if (SetCursorPosition(0, row++))
+                WriteText(" |_|_|_|___|_|_| |_|_|_|_|_|_|_|___|_|  ".PadRight(Console.WindowWidth), ConsoleColor.Cyan);
+
+            ClearRow(row);
             row++;

-            if (SetCursorPosition(1, row))
-            {
-                var versionText = String.Format("{0}", minerVersion);
+            var col = 0;
+            if (SetCursorPosition(col, row))
+            {
+                var versionText = String.Format(" {0}", minerVersion);
                 var copyrightText = String.Format("(C) 2013-{0} - {1}", compileDate.Year, "http://multiminerapp.com");
                 WriteText(versionText, ConsoleColor.White);

-                if (SetCursorPosition(versionText.Length + 2, row))
+                col = versionText.Length + 2;
+                if (SetCursorPosition(col, row))
                     WriteText("[", ConsoleColor.DarkGray);

-                if (SetCursorPosition(versionText.Length + 3, row))
+                col++;
+                if (SetCursorPosition(col, row))
                     WriteText(copyrightText, ConsoleColor.Gray);

-                if (SetCursorPosition(versionText.Length + 3 + copyrightText.Length, row))
-                    WriteText("]", ConsoleColor.DarkGray);
+                col += copyrightText.Length;
+                if (SetCursorPosition(col, row))
+                    WriteText("]".PadRight(Console.WindowWidth - col), ConsoleColor.DarkGray);
             }
         }

@@ -410,8 +421,15 @@
             var printableHeight = Console.WindowHeight - 1;
             List<string> lines = GetVisibleReplLines(printableHeight);
             var offset = printableHeight - lines.Count;
-
-            for (int i = 0; i < offset; i++)
+            var start = 0;
+
+            if (offset >= SplashInfoHeight)
+            {
+                OutputAboutInfo();
+                start = SplashInfoHeight;
+            }
+
+            for (int i = start; i < offset; i++)
                 ClearRow(i);

             for (int i = 0; i < lines.Count; i++)
@@ -420,7 +438,7 @@

                 if (String.IsNullOrEmpty(line))
                 {
-                    ClearRow(i);
+                    ClearRow(i + offset);
                     continue;
                 }


Add a REPL screen and a command to switch screens

--- MultiMiner.TUI/MinerApplication.cs
+++ MultiMiner.TUI/MinerApplication.cs
@@ -10,6 +10,12 @@
 {
     class MinerApplication : ConsoleApplication
     {
+        enum Screen
+        {
+            Main,
+            Repl
+        }
+
         //upper-case chars serve as a command alias, e.g. Quit = q
         private const string QuitCommand = "Quit";
         private const string StartCommand = "start";
@@ -20,12 +26,15 @@
         private const string PoolCommand = "Pool";
         private const string AddVerb = "Add";
         private const string RemoveVerb = "Remove";
+        private const string ScreenCommand = "SCreen";

         private const string Ellipsis = "..";

         private readonly ApplicationViewModel app = new ApplicationViewModel();
         private readonly ISynchronizeInvoke threadContext = new SimpleSyncObject();
         private readonly List<NotificationEventArgs> notifications = new List<NotificationEventArgs>();
+        private readonly List<string> replBuffer = new List<string>();
+
         private readonly bool isWindows = Utility.OS.OSVersionPlatform.GetGenericPlatform() != PlatformID.Unix;
         private readonly bool isLinux = Utility.OS.OSVersionPlatform.GetConcretePlatform() == PlatformID.Unix;
         private readonly bool isMac = Utility.OS.OSVersionPlatform.GetConcretePlatform() == PlatformID.MacOSX;
@@ -33,6 +42,7 @@
         private string currentProgress = String.Empty;
         private PromptEventArgs currentPrompt;
         private DateTime promptTime;
+        private Screen currentScreen = Screen.Main;

         #region ConsoleApplication overrides
         protected override void SetupApplication()
@@ -133,6 +143,39 @@
             //OutputJunk();
 #endif

+            if (currentScreen == Screen.Repl)
+                RenderReplScreen();
+            else
+                RenderMainScreen();
+        }
+
+        private void RenderReplScreen()
+        {
+            OutputReplBuffer();
+
+            OutputInput(Console.WindowWidth);
+        }
+
+        private void OutputReplBuffer()
+        {
+            var lines = replBuffer.ToList();
+            lines.Reverse();
+            lines = lines.Take(Console.WindowHeight - 1).ToList();
+
+            for (int i = 0; i < lines.Count; i++)
+            {
+                var line = lines[i];
+
+                if (SetCursorPosition(0, i))
+                    WriteText(line.PadFitRight(Console.WindowWidth, Ellipsis));
+            }
+
+            for (int i = lines.Count; i < Console.WindowHeight - 1; i++)
+                ClearRow(i);
+        }
+
+        private void RenderMainScreen()
+        {
             OutputDevices();

             OutputSpecial();
@@ -162,6 +205,8 @@
                 HandleSwitchAllCommand(input);
             else if (InputMatchesCommand(input, PoolCommand))
                 HandlePoolCommand(input);
+            else if (InputMatchesCommand(input, ScreenCommand))
+                HandleScreenCommand(input);
             else
             {
                 AddNotification(String.Format("Unknown command: {0}", input.Split(' ').First()));
@@ -373,6 +418,28 @@
                 AddNotification(String.Format("Syntax: {0} symbol", SwitchAllCommand.ToLower()));
         }

+        private void HandleScreenCommand(string input)
+        {
+            var parts = input.Split(' ');
+            if (parts.Count() == 2)
+            {
+                var screenName = parts[1];
+                if (screenName.Equals(Screen.Repl.ToString(), StringComparison.OrdinalIgnoreCase))
+                    currentScreen = Screen.Repl;
+                else
+                    currentScreen = Screen.Main;
+                RenderScreen();
+            }
+            else
+            {
+                if (currentScreen == Screen.Main)
+                    currentScreen = Screen.Repl;
+                else
+                    currentScreen = Screen.Main;
+                RenderScreen();
+            }
+        }
+
         private void HandlePoolCommand(string input)
         {
             var syntax = String.Format("Syntax:{0} {{ add | remove }} symbol url user pass", PoolCommand.ToLower());


Can now select to use myo or not

Can now select to use myo or not

--- MyoSnake/MyoSnake/MainPage.xaml.cs
+++ MyoSnake/MyoSnake/MainPage.xaml.cs
@@ -50,6 +50,16 @@
         {
             base.OnNavigatedFrom(e);

+            // save if using myo
+            if (dontUseMyoCB.IsChecked == true) // don't use the myo
+            {
+                myoManager.UseMyo = false;
+
+            }
+            else // use the myo
+            {
+                myoManager.UseMyo = true;
+            } // if

         }
     }


Fast parsing for template

Fast parsing for template

--- NBitcoin/StandardScriptTemplate.cs
+++ NBitcoin/StandardScriptTemplate.cs
@@ -22,6 +22,11 @@

 	public class TxNullDataTemplate : ScriptTemplate
 	{
+		protected override bool FastCheckScriptPubKey(Script scriptPubKey)
+		{
+			var bytes = scriptPubKey.ToRawScript(true);
+			return bytes.Length >= 1 && bytes[0] == (byte)OpcodeType.OP_RETURN;
+		}
 		protected override bool CheckScriptPubKeyCore(Script scriptPubKey, Op[] scriptPubKeyOps)
 		{
 			var ops = scriptPubKeyOps;
@@ -32,17 +37,19 @@
 			if(ops.Length == 2)
 			{
 				return ops[1].PushData != null && ops[1].PushData.Length <= 40;
+				throw new NotSupportedException();
 			}
 			return true;
 		}
-
 		public byte[] ExtractScriptPubKeyParameters(Script scriptPubKey)
 		{
+			if(!FastCheckScriptPubKey(scriptPubKey))
+				return null;
 			var ops = scriptPubKey.ToOps().ToArray();
-			if(!CheckScriptPubKeyCore(scriptPubKey, ops))
-				return null;
-			if(ops.Length == 1)
-				return new byte[0];
+			if(ops.Length != 2)
+				return null;
+			if(ops[1].PushData == null || ops[1].PushData.Length > 40)
+				return null;
 			return ops[1].PushData;
 		}

@@ -156,6 +163,13 @@
 			};
 		}

+		protected override bool FastCheckScriptSig(Script scriptSig, Script scriptPubKey)
+		{
+			var bytes = scriptSig.ToRawScript(true);
+			return bytes.Length >= 1 &&
+				   bytes[0] == (byte)OpcodeType.OP_0;
+		}
+
 		protected override bool CheckScriptSigCore(Script scriptSig, Op[] scriptSigOps, Script scriptPubKey, Op[] scriptPubKeyOps)
 		{
 			if(!scriptSig.IsPushOnly)
@@ -179,6 +193,8 @@

 		public TransactionSignature[] ExtractScriptSigParameters(Script scriptSig)
 		{
+			if(!FastCheckScriptSig(scriptSig, null))
+				return null;
 			var ops = scriptSig.ToOps().ToArray();
 			if(!CheckScriptSigCore(scriptSig, ops, null, null))
 				return null;
@@ -247,6 +263,15 @@
 		public Script GenerateScriptPubKey(Script scriptPubKey)
 		{
 			return GenerateScriptPubKey(scriptPubKey.ID);
+		}
+
+		protected override bool FastCheckScriptPubKey(Script scriptPubKey)
+		{
+			var bytes = scriptPubKey.ToRawScript(true);
+			return
+				   bytes.Length >= 2 &&
+				   bytes[0] == (byte)OpcodeType.OP_HASH160 &&
+				   bytes[1] == 0x14;
 		}

 		protected override bool CheckScriptPubKeyCore(Script scriptPubKey, Op[] scriptPubKeyOps)
@@ -332,6 +357,8 @@

 		public ScriptId ExtractScriptPubKeyParameters(Script scriptPubKey)
 		{
+			if(!FastCheckScriptPubKey(scriptPubKey))
+				return null;
 			var ops = scriptPubKey.ToOps().ToArray();
 			if(!this.CheckScriptPubKeyCore(scriptPubKey, ops))
 				return null;
@@ -392,7 +419,7 @@
 			if(ops.Length != 1)
 				return false;

-			return ops[0].PushData != null;
+			return ops[0].PushData != null && PubKey.IsValidSize(ops[0].PushData.Length);
 		}

 		public override TxOutType Type
@@ -408,7 +435,14 @@
 			var ops = script.ToOps().ToArray();
 			if(!CheckScriptPubKeyCore(script, ops))
 				return null;
-			return new PubKey(ops[0].PushData);
+			try
+			{
+				return new PubKey(ops[0].PushData);
+			}
+			catch(FormatException)
+			{
+				return null;
+			}
 		}

@@ -464,6 +498,15 @@
 				);
 		}

+		protected override bool FastCheckScriptPubKey(Script scriptPubKey)
+		{
+			var bytes = scriptPubKey.ToRawScript(true);
+			return bytes.Length >= 3 &&
+				   bytes[0] == (byte)OpcodeType.OP_DUP &&
+				   bytes[1] == (byte)OpcodeType.OP_HASH160 &&
+				   bytes[2] == 0x14;
+		}
+
 		protected override bool CheckScriptPubKeyCore(Script scriptPubKey, Op[] scriptPubKeyOps)
 		{
 			var ops = scriptPubKeyOps;
@@ -534,7 +577,14 @@
 		{
 			if(scriptPubKey == null)
 				throw new ArgumentNullException("scriptPubKey");
+			if(!FastCheckScriptPubKey(scriptPubKey))
+				return false;
 			return CheckScriptPubKeyCore(scriptPubKey, scriptPubKey.ToOps().ToArray());
+		}
+
+		protected virtual bool FastCheckScriptPubKey(Script scriptPubKey)
+		{
+			return true;
 		}

 		protected abstract bool CheckScriptPubKeyCore(Script scriptPubKey, Op[] scriptPubKeyOps);
@@ -543,8 +593,16 @@
 			if(scriptSig == null)
 				throw new ArgumentNullException("scriptSig");

+			if(!FastCheckScriptSig(scriptSig, scriptPubKey))
+				return false;
 			return CheckScriptSigCore(scriptSig, scriptSig.ToOps().ToArray(), scriptPubKey, scriptPubKey == null ? null : scriptPubKey.ToOps().ToArray());
 		}
+
+		protected virtual bool FastCheckScriptSig(Script scriptSig, Script scriptPubKey)
+		{
+			return true;
+		}
+
 		protected abstract bool CheckScriptSigCore(Script scriptSig, Op[] scriptSigOps, Script scriptPubKey, Op[] scriptPubKeyOps);
 		public abstract TxOutType Type
 		{


Development snapshot, v.0.2.0.0alpha

Development snapshot, v.0.2.0.0alpha

git-svn-id: adac64982eb55d86e6e37c255cd94bbda4da0155@30 ef14acb7-2632-0410-8da5-93b2186763b4

--- NCsvLib/Properties/AssemblyInfo.cs
+++ NCsvLib/Properties/AssemblyInfo.cs
@@ -31,5 +31,5 @@
 //
 // È possibile specificare tutti i valori o impostare come predefiniti i valori Numero revisione e Numero build
 // utilizzando l'asterisco (*) come descritto di seguito:
-[assembly: AssemblyVersion("0.1.0.0")]
-[assembly: AssemblyFileVersion("0.1.0.0")]
+[assembly: AssemblyVersion("0.2.0.0")]
+[assembly: AssemblyFileVersion("0.2.0.0")]


Fix some bugs in the pausing subsystem

Fix some bugs in the pausing subsystem

--- Networking/Pausing/PauseManager.cs
+++ Networking/Pausing/PauseManager.cs
@@ -35,11 +35,19 @@
         /// </summary>
         private PauseMessageHandler _handler;

+        /// <summary>
+        /// Create a new PauseManager instance.
+        /// </summary>
+        /// <param name="context">The networking context to use.</param>
         public PauseManager(NetworkContext context) {
+            _context = context;
             _handler = new PauseMessageHandler();
             _context.AddMessageHandler(_handler);
         }

+        /// <summary>
+        /// Cleans up resources that the PauseManager uses in the NetworkContext.
+        /// </summary>
         public void Dispose() {
             if (_handler != null) {
                 _context.RemoveMessageHandler(_handler);


Add comment in the cursor test about why/how it works in NoRM

--- NoRM.Tests/MongoCollectionTests.cs
+++ NoRM.Tests/MongoCollectionTests.cs
@@ -21,10 +21,12 @@
             }
         }

-
-        [Fact]
-        public void Inserting_More_Than_4MB_Batch_Of_Docs_Returns_Correct_Count()
-        {
+        [Fact]
+        public void Find_On_Collection_Resurning_More_Than_4MB_Of_Docs_Works()
+        {
+            //this tests Cursor management in the ReplyMessage<T>,
+            //we built NoRM so that the average user picking up the library
+            //doesn't have to think about this.
             using (var mongo = Mongo.ParseConnection(TestHelper.ConnectionString()))
             {
                 List<Product> junkInTheTrunk = new List<Product>();


PluginCompiler changes

PluginCompiler changes

- use cached script lines instead of read again
- improved reference/using regex
- handle new game ext naming
- warn on obsolete reference/using of old ext name

--- Oxide.Ext.CSharp/PluginCompiler.cs
+++ Oxide.Ext.CSharp/PluginCompiler.cs
@@ -4,6 +4,7 @@
 using System.IO;
 using System.Linq;
 using System.Reflection;
+using System.Text;
 using System.Text.RegularExpressions;
 using System.Threading;

@@ -88,6 +89,8 @@
                     CacheAllScripts(compilation.plugins);

                     var extension_names = Interface.Oxide.GetAllExtensions().Select(ext => ext.Name).ToArray();
+                    var game_extension_ns = Interface.Oxide.GetAllExtensions().SingleOrDefault(ext => ext.IsGameExtension)?.GetType().Namespace;
+                    var new_game_ext = game_extension_ns != null && game_extension_ns.Contains(".Game.");
                     var include_path = Interface.Oxide.PluginDirectory + "\\Include";

                     foreach (var plugin in compilation.plugins.ToArray())
@@ -96,9 +99,9 @@
                         plugin.IncludePaths.Clear();

                         bool parsingNamespace = false;
-                        foreach (var script_line in plugin.ScriptLines)
+                        for (var i = 0; i < plugin.ScriptLines.Length; i++)
                         {
-                            var line = script_line.Trim();
+                            var line = plugin.ScriptLines[i].Trim();
                             if (line.Length < 1) continue;

                             Match match;
@@ -129,20 +132,31 @@
                             else
                             {
                                 // Include explicit references defined by magic comments in script
-                                match = Regex.Match(line, @"^//\s?Reference:\s?(\S+)$", RegexOptions.IgnoreCase);
+                                match = Regex.Match(line, @"^//\s*Reference:\s*(\S+)\s*$", RegexOptions.IgnoreCase);
                                 if (match.Success)
                                 {
-                                    AddReference(currentId, plugin, match.Groups[1].Value);
+                                    var result = match.Groups[1].Value;
+                                    //TODO temp ignore renamed game exts
+                                    if (!new_game_ext || !result.StartsWith(game_extension_ns.Replace(".Game.", ".Ext.")))
+                                        AddReference(currentId, plugin, match.Groups[1].Value);
+                                    else
+                                        Interface.Oxide.LogWarning("Ignored obsolete game extension reference '{0}' in plugin '{1}'", result, plugin.Name);
                                     continue;
                                 }

                                 // Include implicit references detected from using statements in script
-                                match = Regex.Match(line, @"^\s*using\s+([^;]+)\s*;$", RegexOptions.IgnoreCase);
+                                match = Regex.Match(line, @"^\s*using\s+(Oxide\.(?:Ext|Game)[^;]+);\s*$", RegexOptions.IgnoreCase);
                                 if (match.Success)
                                 {
-                                    var split_name = match.Groups[1].Value.Trim().Split('.');
-                                    if (split_name.Length > 2 && split_name[0] == "Oxide" && split_name[1] == "Ext")
-                                        AddReference(currentId, plugin, "Oxide.Ext." + split_name[2]);
+                                    var result = match.Groups[1].Value;
+                                    //TODO temp ignore renamed game exts
+                                    if (new_game_ext && result.StartsWith(game_extension_ns.Replace(".Game.", ".Ext.")))
+                                    {
+                                        Interface.Oxide.LogWarning("Replaced obsolete game extension using directive '{0}' in plugin '{1}'", result, plugin.Name);
+                                        plugin.ScriptLines[i] = plugin.ScriptLines[i].Replace(".Ext.", ".Game.");
+                                        result = result.Replace(".Ext.", ".Game.");
+                                    }
+                                    AddReference(currentId, plugin, result);
                                     continue;
                                 }

@@ -246,7 +260,7 @@
             referenceFiles.AddRange(compilation.references.Select(reference_name => new CompilerFile { Name = reference_name + ".dll", Data = File.ReadAllBytes(Path.Combine(Interface.Oxide.ExtensionDirectory, reference_name + ".dll")) }));

             var sourceFiles = compilation.plugins.SelectMany(plugin => plugin.IncludePaths).Select(includePath => new CompilerFile { Name = Path.GetFileName(includePath), Data = File.ReadAllBytes(includePath) }).ToList();
-            sourceFiles.AddRange(compilation.plugins.Select(plugin => plugin.ScriptPath).Select(scriptPath => new CompilerFile { Name = Path.GetFileName(scriptPath), Data = File.ReadAllBytes(scriptPath) }));
+            sourceFiles.AddRange(compilation.plugins.Select(plugin => new CompilerFile { Name = plugin.ScriptName + ".cs", Data = Encoding.Default.GetBytes(string.Join(Environment.NewLine, plugin.ScriptLines)) }));

             var compilerData = new CompilerData
             {


added line break to Display.cs reference file

--- frameworks/csharp/nunit/Display.cs
+++ frameworks/csharp/nunit/Display.cs
@@ -49,7 +49,7 @@

 		public static void Write(string type, string message, string label = "", string mode = "")
 		{
-			string line = String.Format("<{0}:{1}:{2}>{3}", type.ToUpper(), mode, label, FormatMessage(message));
+			string line = String.Format("\n<{0}:{1}:{2}>{3}", type.ToUpper(), mode, label, FormatMessage(message));
 			Console.WriteLine(line);
 		}


added Reset() method to SimpleStatusProgress

--- Palaso/Progress/LogBox/Progress.cs
+++ Palaso/Progress/LogBox/Progress.cs
@@ -677,6 +677,16 @@
 		public string LastStatus { get; private set; }
 		public string LastWarning { get; private set; }
 		public string LastError { get; private set; }
+		public void Reset()
+		{
+			LastError = "";
+			LastWarning = "";
+			LastStatus = "";
+			CancelRequested = false;
+			WarningEncountered = false;
+			ErrorEncountered = false;
+			WriteStatus("");
+		}

 	}


removed commented code and fixed hardcoded values


Make ConfigVarsOperator actually work

Make ConfigVarsOperator actually work


Implemented FindFirst by creating a mockup object.

The mockup object should have a default constructor.

--- Cinch/Cinch.cs
+++ Cinch/Cinch.cs
@@ -101,15 +101,35 @@
         /// <returns></returns>
         public static T FindFirst<T>(T obj, int ID) where T : ModelBase
         {
-            string query = String.Format(Queries.FindFirst, obj.ColumnsFullyQualified, obj.TableNameFullyQualified, obj.TableName, obj.PrimaryKeyFullyQualified);
-
-            using (DataConnect dc = new DataConnect(query, CommandType.Text))
-            {
-                dc.SetQuery(query);
-                dc.AddParameter("id", SqlDbType.Int, ID);
-
-                return dc.FillObject<T>();
-            }
+            T result = null;
+
+            if (obj != null)
+            {
+                string query = String.Format(Queries.FindFirst, obj.ColumnsFullyQualified, obj.TableNameFullyQualified, obj.TableName, obj.PrimaryKeyFullyQualified);
+
+                using (DataConnect dc = new DataConnect(query, CommandType.Text))
+                {
+                    dc.SetQuery(query);
+                    dc.AddParameter("id", SqlDbType.Int, ID);
+
+                    result = dc.FillObject<T>();
+                }
+            }
+
+            return result;
+        }
+
+        /// <summary>
+        /// Find first based on explicit primary key value
+        /// </summary>
+        /// <typeparam name="T">The type of the object.</typeparam>
+        /// <param name="ID">The primary key to be searched.</param>
+        /// <returns>The object if found; null, otherwise.</returns>
+        public static T FindFirst<T>(int ID) where T : ModelBase, new()
+        {
+            var obj = default(T);
+
+            return Cinch.FindFirst<T>(obj, ID);
         }

         /// <summary>


Fix weapon update exiting early (typo)

Fix weapon update exiting early (typo)

Oops. That's a bad typo.

--- Client/Ship.cs
+++ Client/Ship.cs
@@ -75,7 +75,7 @@
                     if (weapons[i] == null) continue;
                     Weapon wep = weapons[i];
                     wep.Charge += deltaTime;
-                    if (wep.Charge < wep.ChargeTime) return;
+                    if (wep.Charge < wep.ChargeTime) continue;

                     wep.Charge = 0f;
                     NetServer.AddObject(new Projectile(wep.ProjSprite, position + mounts[i].Position, Utils.Repeat(facing + mounts[i].Bearing, 0f, 360f), wep.ProjSpeed, this.faction));


And some more

And some more

--- osu.Desktop/OsuGameDesktop.cs
+++ osu.Desktop/OsuGameDesktop.cs
@@ -15,12 +15,16 @@
 using osu.Desktop.Updater;
 using osu.Framework;
 using osu.Framework.Platform.Windows;
+using osu.Framework.Screens;
+using osu.Game.Screens;
+using osu.Game.Screens.Menu;

 namespace osu.Desktop
 {
     internal class OsuGameDesktop : OsuGame
     {
         private readonly bool noVersionOverlay;
+        private VersionManager versionManager;

         public OsuGameDesktop(string[] args = null)
             : base(args)
@@ -46,7 +50,7 @@

             if (!noVersionOverlay)
             {
-                LoadComponentAsync(new VersionManager { Depth = int.MinValue }, v =>
+                LoadComponentAsync(versionManager = new VersionManager { Depth = int.MinValue }, v =>
                 {
                     Add(v);
                     v.State = Visibility.Visible;
@@ -56,6 +60,21 @@
                     Add(new SquirrelUpdateManager());
                 else
                     Add(new SimpleUpdateManager());
+            }
+        }
+
+        protected override void ScreenChanged(OsuScreen current, Screen newScreen)
+        {
+            base.ScreenChanged(current, newScreen);
+            switch (newScreen)
+            {
+                case Intro _:
+                case MainMenu _:
+                    versionManager.State = Visibility.Visible;
+                    break;
+                default:
+                    versionManager.State = Visibility.Hidden;
+                    break;
             }
         }


Added Attributes to LineItem to match the DB. Added LineItem Repository Tests

--- Purchasing.Core/Domain/LineItem.cs
+++ Purchasing.Core/Domain/LineItem.cs
@@ -1,7 +1,8 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
 using FluentNHibernate.Mapping;
-using UCDArch.Core.DomainModel;
-
+using UCDArch.Core.DomainModel;
+
 namespace Purchasing.Core.Domain
 {
     public class LineItem : DomainObject
@@ -12,12 +13,16 @@
         }

         public virtual decimal Quantity { get; set; }
+        [StringLength(25)]
         public virtual string CatalogNumber { get; set; }
-        public virtual string Description { get; set; }
+        public virtual string Description { get; set; }
+        [StringLength(25)]
         public virtual string Unit { get; set; }
         public virtual decimal UnitPrice { get; set; }
+        [StringLength(200)]
         public virtual string Url { get; set; }
         public virtual string Notes { get; set; }
+        [Required]
         public virtual Order Order { get; set; }

         public virtual Commodity Commodity { get; set; }


Bump Version number to 0.3

Bump Version number to 0.3

--- RReplay/Properties/AssemblyInfo.cs
+++ RReplay/Properties/AssemblyInfo.cs
@@ -50,6 +50,6 @@
 // You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.2.*")]
+[assembly: AssemblyVersion("0.3.*")]
 [assembly: NeutralResourcesLanguage("en")]


Update to use Locker's item by index when locked Maybe it'll change in the future to be an O(n) operation, when is locked, to only retrieve items that aren't marked to be removed

--- Raccoon/Util/Collections/Locker.cs
+++ Raccoon/Util/Collections/Locker.cs
@@ -85,8 +85,15 @@

         public T this[int i] {
             get {
-                if (IsLocked) {
-                    throw new System.NotSupportedException($"Get element by index isn't available when locked.");
+                // TODO  maybe it should be an O(n) operation when IsLocked
+                //       to only retrieve indices which isn't marked to remove
+
+                if (IsLocked && i >= _items.Count && _toAdd.Count > 0) {
+                    if (i - _items.Count >= _toAdd.Count) {
+                        throw new System.ArgumentOutOfRangeException(nameof(i), $"Index {i} is out of range [0, {_items.Count + _toAdd.Count - 1}]");
+                    }
+
+                    return _toAdd[i - _items.Count].Item;
                 }

                 return _items[i].Item;


removed unnecessary enum member

removed unnecessary enum member

--- Manatee.Json/Path/Expressions/Parsing/JsonPathOperator.cs
+++ Manatee.Json/Path/Expressions/Parsing/JsonPathOperator.cs
@@ -4,8 +4,6 @@
 	{
 		Add,
 		And,
-		// TODO: R# says this isn't used, but I don't want to break anything by removing it.  Run tests first.
-		Constant,
 		Divide,
 		Exponent,
 		Equal,


#137 fixed errors in the IO system object table

--- Node_Editor/Framework/SaveSystem/ImportExportStructure.cs
+++ Node_Editor/Framework/SaveSystem/ImportExportStructure.cs
@@ -34,6 +34,8 @@

 		public ObjectData ReferenceObject(object obj)
 		{
+			if (obj == null)
+				return null;
 			foreach (ObjectData data in objects.Values)
 			{
 				if (data.data == obj)
@@ -248,7 +250,12 @@

 		public ObjectData(object obj)
 		{
+			if (obj == null)
+				throw new ArgumentNullException("obj");
 			refID = obj.GetHashCode();
+			// Some types like MonoScript implement no proper GetHashCode function
+			if (Mathf.Abs (refID) < 10)
+				refID = (int)UnityEngine.Random.value * int.MaxValue;
 			type = obj.GetType();
 			data = obj;
 		}


fixing incorrect urlbuilder test

fixing incorrect urlbuilder test

--- RestSharp.Tests/UrlBuilderTests.cs
+++ RestSharp.Tests/UrlBuilderTests.cs
@@ -42,7 +42,7 @@
 			request.AddParameter("foo", "bar");
 			var client = new RestClient("http://example.com/");

-			var expected = new Uri("http://example.com/resource");
+			var expected = new Uri("http://example.com/resource?foo=bar");
 			var output = client.BuildUri(request);

 			Assert.Equal(expected, output);


[Modify] Polish it

[Modify] Polish it

--- websocket-sharp/WebSocketFrame.cs
+++ websocket-sharp/WebSocketFrame.cs
@@ -385,12 +385,14 @@
       var bytes = frame.ToArray ();
       for (long i = 0; i <= cnt; i++) {
         var j = i * 4;
+
         if (i < cnt) {
           printLine (
             Convert.ToString (bytes[j], 2).PadLeft (8, '0'),
             Convert.ToString (bytes[j + 1], 2).PadLeft (8, '0'),
             Convert.ToString (bytes[j + 2], 2).PadLeft (8, '0'),
-            Convert.ToString (bytes[j + 3], 2).PadLeft (8, '0'));
+            Convert.ToString (bytes[j + 3], 2).PadLeft (8, '0')
+          );

           continue;
         }


Change port for new RabbitMQ-MQTT server

--- SOVND.Server/ServerMqttSettings.cs
+++ SOVND.Server/ServerMqttSettings.cs
@@ -7,7 +7,7 @@
     {
         public string Broker { get { return "104.131.87.42"; } }

-        public int Port { get { return 8883; } }
+        public int Port { get { return 2883; } }

         public string Username
         {


[Modify] Polish it

[Modify] Polish it

--- websocket-sharp/WebSocketFrame.cs
+++ websocket-sharp/WebSocketFrame.cs
@@ -551,8 +551,10 @@
     )
     {
       var len = frame.ExtendedPayloadLengthWidth;
+
       if (len == 0) {
         frame._extPayloadLength = WebSocket.EmptyBytes;
+
         completed (frame);

         return;
@@ -563,10 +565,12 @@
         bytes => {
           if (bytes.Length != len) {
             var msg = "The extended payload length of a frame could not be read.";
+
             throw new WebSocketException (msg);
           }

           frame._extPayloadLength = bytes;
+
           completed (frame);
         },
         error


Fixed startup script execution

Fixed startup script execution

It was actually still using the old broken code path that I'd forgotten
to delete, and the new path was broken. It's now using the fixed new
path.

--- ShaderEditorApp/Model/Workspace.cs
+++ ShaderEditorApp/Model/Workspace.cs
@@ -154,14 +154,8 @@
 					// We handle this together so that the async command runs only once,
 					// avoiding potential race conditions where another script could run inbetween two executions.
 					// This is fire-and-forget. Errors are handled by the usual script execution path.
-					RunScripts.ExecuteAsync(startupScripts);
-
-					// Run startup scripts.
-					foreach (var script in value.StartupScripts)
-					{
-						// TODO: This is really bad, as you could have multiple scripts executing simultaneously!
-						RunScriptFile(script);
-					}
+					// Must subscribe to force it to do something.
+					RunScripts.ExecuteAsync(startupScripts).Subscribe();

 					this.RaisePropertyChanged();
 				}


(TFS CS 5135)

(TFS CS 5135)

--- Signum.Utilities/JsonExtensions.cs
+++ Signum.Utilities/JsonExtensions.cs
@@ -16,9 +16,9 @@
         public static string Quote(this string s)
         {
             if (s == null || s.Length == 0)
-                return "\'\'";
+                return "\"\"";

-            return "\'" + s.Escape() + "\'";
+            return "\"" + s.Escape() + "\"";
         }
         private static string Escape(this string s)
         {
@@ -71,15 +71,15 @@

         public static string ToJSonArray<T>(this IEnumerable<T> collection, Func<T, string> toString)
         {
-            return "[" + collection.ToString(toString, ", ") + "]";
+            return "[" + collection.ToString(toString, ",") + "]";
         }

         public static string ToJSonObject<K, V>(this IDictionary<K, V> dictionary, Func<K, string> keyQuoted, Func<V, string> value)
         {
             return "{" + dictionary.ToString(kvp =>
-                "{0} : {1}".Formato(
+                "{0}:{1}".Formato(
                    keyQuoted(kvp.Key),
-                   value(kvp.Value)), ", ") + "}";
+                   value(kvp.Value)), ",") + "}";
         }

         public static string ToJSonArrayBig<T>(this IEnumerable<T> collection, Func<T, string> toString)
@@ -101,10 +101,10 @@
         {
             List<MemberEntry<T>> entries = (List<MemberEntry<T>>)cache.GetOrCreate(typeof(T), () => MemberEntryFactory.GenerateList<T>());

-            return "{\r\n" + entries.ToString(m =>
+            return "{" + entries.ToString(m =>
                 "{0}:{1}".Formato(
                    Quote(m.Name),
-                   value(m.Getter(element))), ",\r\n").Indent(3) + "\r\n}";
+                   value(m.Getter(element))), ",").Indent(3) + "}";

         }
     }


Version 0.9.5.2

Version 0.9.5.2

--- CustomRules.cs
+++ CustomRules.cs
@@ -1587,61 +1587,62 @@
         // Get CMS type
         public static string getCMS(Session oSession)
         {
-            // Current hostname
-            string currentHostname = oSession.hostname.Replace("www.", "");
-
-            // Check if hostname was already seen in previous sessions
-            foreach (string i in CMSList)
-            {
-                string hostnameInList = Regex.Replace(i, ",.*", "");
-                // Existing match
-                if (hostnameInList == currentHostname)
-                {
-                    return i.Replace(currentHostname + ",", "");
-                }
-            }
-
-            // New hostname, checking for CMS type if meets certain conditions
-            if ((oSession.oResponse.headers.ExistsAndContains("Content-Type","text/html")
-                || oSession.oResponse.headers.ExistsAndContains("Content-Type","text/javascript")
-                || oSession.oResponse.headers.ExistsAndContains("Content-Type","text/plain")
-                || oSession.oResponse.headers.ExistsAndContains("Content-Type","application/javascript")
-                || oSession.oResponse.headers.ExistsAndContains("Content-Type","application/x-javascript"))
-                && oSession.responseCode != 302 && oSession.responseCode != 301)
-            {
-                string sourceCode = oSession.GetResponseBodyAsString().Replace('\0', '\uFFFD');
-                string fullCMSName = "";
+            if (FiddlerApplication.Prefs.GetStringPref("fiddler.advancedUI", null) == "True")
+            {
+                // Current hostname
+                string currentHostname = oSession.hostname.Replace("www.", "");

-                // Loop through regexes
-                foreach (var item in extractionCMSList)
-                {
-                    // Read from our regexes
-                    string CMSName = item.Split('\t')[1];
-                        FiddlerObject.log("Check 2 " + CMSName);
-                    var CMSRegex = item.Split('\t')[2];
-                        FiddlerObject.log("Check 3 " + CMSRegex);
-                    var regexCount = Int32.Parse(item.Split('\t')[3]);
-                    // Match found
-                    if (Regex.Matches(sourceCode, CMSRegex).Count >= regexCount)
-                    {
-                        if (fullCMSName == "")
-                        {
-                            fullCMSName = CMSName;
-                        }else{
-                            fullCMSName = fullCMSName + " | " + CMSName;
-                        }
-                    }
-                }
-                // Add to list (if match(es) were found)
-                if (fullCMSName != "")
-                {
-                    CMSList.Add(currentHostname + "," + fullCMSName);
-                    return fullCMSName;
+                // Check if hostname was already seen in previous sessions
+                foreach (string i in CMSList)
+                {
+                    string hostnameInList = Regex.Replace(i, ",.*", "");
+                    // Existing match
+                    if (hostnameInList == currentHostname)
+                    {
+                        return i.Replace(currentHostname + ",", "");
+                    }
                 }

-                // No match
-                FiddlerObject.log("No MATCH: " + currentHostname);
-                CMSList.Add(currentHostname + "," + "");
+                // New hostname, checking for CMS type if meets certain conditions
+                if ((oSession.oResponse.headers.ExistsAndContains("Content-Type","text/html")
+                    || oSession.oResponse.headers.ExistsAndContains("Content-Type","text/javascript")
+                    || oSession.oResponse.headers.ExistsAndContains("Content-Type","text/plain")
+                    || oSession.oResponse.headers.ExistsAndContains("Content-Type","application/javascript")
+                    || oSession.oResponse.headers.ExistsAndContains("Content-Type","application/x-javascript"))
+                    && oSession.responseCode != 302 && oSession.responseCode != 301)
+                {
+                    string sourceCode = oSession.GetResponseBodyAsString().Replace('\0', '\uFFFD');
+                    string fullCMSName = "";
+
+                    // Loop through regexes
+                    foreach (var item in extractionCMSList)
+                    {
+                        // Read from our regexes
+                        string CMSName = item.Split('\t')[1];
+                        var CMSRegex = item.Split('\t')[2];
+                        var regexCount = Int32.Parse(item.Split('\t')[3]);
+                        // Match found
+                        if (Regex.Matches(sourceCode, CMSRegex).Count >= regexCount)
+                        {
+                            if (fullCMSName == "")
+                            {
+                                fullCMSName = CMSName;
+                            }else{
+                                fullCMSName = fullCMSName + " | " + CMSName;
+                            }
+                        }
+                    }
+                    // Add to list (if match(es) were found)
+                    if (fullCMSName != "")
+                    {
+                        CMSList.Add(currentHostname + "," + fullCMSName);
+                        return fullCMSName;
+                    }
+
+                    // No match
+                    CMSList.Add(currentHostname + "," + "");
+                    return "";
+                }
                 return "";
             }
             return "";
@@ -1715,7 +1716,7 @@
         public static void EKFiddleVersionCheck()
         {
             // Set EKFiddle local version in 'Preferences'
-            string EKFiddleVersion = "0.9.5.1";
+            string EKFiddleVersion = "0.9.5.2";
             FiddlerApplication.Prefs.SetStringPref("fiddler.ekfiddleversion", EKFiddleVersion);
             // Update Fiddler's window title
             FiddlerApplication.UI.Text= "Progress Telerik Fiddler Web Debugger" + " - " + "EKFiddle v." + EKFiddleVersion;


Remove redundant DesktopGameWindow cast

Remove redundant DesktopGameWindow cast

--- osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs
+++ osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs
@@ -8,7 +8,6 @@
 using osu.Framework.Configuration;
 using osu.Framework.Graphics;
 using osu.Framework.Graphics.Containers;
-using osu.Framework.Platform;

 namespace osu.Game.Overlays.Settings.Sections.Graphics
 {
@@ -126,9 +125,9 @@

         private List<KeyValuePair<string, int>> getResolutions()
         {
-            var availableDisplayResolutions = (game.Window as DesktopGameWindow)?.GetCurrentDisplay().AvailableResolutions
-                                                                                .Where(r => r.Width >= 800 && r.Height >= 600)
-                                                                                .OrderByDescending(r => r.Width).ThenByDescending(r => r.Height);
+            var availableDisplayResolutions = game.Window?.GetCurrentDisplay().AvailableResolutions
+                                                  .Where(r => r.Width >= 800 && r.Height >= 600)
+                                                  .OrderByDescending(r => r.Width).ThenByDescending(r => r.Height);

             if (availableDisplayResolutions == null)
                 return new List<KeyValuePair<string, int>>();


Removed debug mode

Removed debug mode

--- Core/OfficeDevPnP.Core.Tests/Framework/Functional/FilesTests.cs
+++ Core/OfficeDevPnP.Core.Tests/Framework/Functional/FilesTests.cs
@@ -16,9 +16,9 @@
         #region Construction
         public FilesTests()
         {
-            debugMode = true;
-            centralSiteCollectionUrl = "https://bertonline.sharepoint.com/sites/TestPnPSC_12345_c89c25d3-4153-4464-8ad3-d0d6715fb6a8";
-            centralSubSiteUrl = "https://bertonline.sharepoint.com/sites/TestPnPSC_12345_c89c25d3-4153-4464-8ad3-d0d6715fb6a8/sub";
+            //debugMode = true;
+            //centralSiteCollectionUrl = "https://bertonline.sharepoint.com/sites/TestPnPSC_12345_c89c25d3-4153-4464-8ad3-d0d6715fb6a8";
+            //centralSubSiteUrl = "https://bertonline.sharepoint.com/sites/TestPnPSC_12345_c89c25d3-4153-4464-8ad3-d0d6715fb6a8/sub";
         }
         #endregion

@@ -67,10 +67,5 @@
             }
         }
         #endregion
-
-        #region Helper methods
-
-        #endregion
-
     }
 }


bug on download via data gateway link

bug on download via data gateway link

--- Terradue.Tep/Terradue/Tep/Controller/Data/DataGatewayFactory.cs
+++ Terradue.Tep/Terradue/Tep/Controller/Data/DataGatewayFactory.cs
@@ -123,7 +123,7 @@
             }

             urib = new UriBuilder(dataGatewayBaseUrl);
-            urib.Path += string.Format("/api/");
+            urib.Path += string.Format("/api/{0}/", baseUri.Host);

             downloadUriCache.Set(new CacheItem(baseUri.ToString(), urib.Uri), new CacheItemPolicy() { AbsoluteExpiration = DateTimeOffset.Now.AddHours(1) });


TcpipClient.cs: Introduce timeout.

TcpipClient.cs: Introduce timeout.

When the agent runs out of time, it is terminated.

--- AIWolfLibCommon/Net/TcpipClient.cs
+++ AIWolfLibCommon/Net/TcpipClient.cs
@@ -3,7 +3,7 @@
 using System.IO;
 using System.Net;
 using System.Net.Sockets;
-using System.Threading;
+using System.Threading.Tasks;

 namespace AIWolf.Common.Net
 {
@@ -34,13 +34,6 @@
         /// <remarks></remarks>
         public bool Running { get; private set; }

-        /// <summary>
-        /// Whether or not this client is connecting server.
-        /// </summary>
-        /// <value>True if this client is connecting server, otherwise, false.</value>
-        /// <remarks></remarks>
-        public bool Connecting { get; private set; }
-
         GameInfo lastGameInfo;

         /// <summary>
@@ -49,6 +42,13 @@
         /// <value>The name of player this client manages.</value>
         /// <remarks></remarks>
         public string PlayerName { get; set; }
+
+        /// <summary>
+        /// The number of milliseconds to wait for the request call.
+        /// </summary>
+        /// <value>The number of milliseconds.</value>
+        /// <remarks></remarks>
+        public int Timeout { get; set; } = 100;

         /// <summary>
         /// Initializes a new instance of this class which connects given port of given host.
@@ -70,45 +70,23 @@
         /// <param name="port">Port number this client connects.</param>
         /// <param name="requestRole">Role this client requests.</param>
         /// <remarks></remarks>
-        public TcpipClient(string host, int port, Role? requestRole)
-        {
-            this.host = host;
-            this.port = port;
+        public TcpipClient(string host, int port, Role? requestRole) : this(host, port)
+        {
             RequestRole = requestRole;
-            Running = false;
         }

         /// <summary>
         /// Connects the player to the server.
         /// </summary>
         /// <param name="player">The player to be connected.</param>
-        /// <returns>True if the connection succeeds, otherwise, false.</returns>
-        /// <remarks></remarks>
-        public bool Connect(IPlayer player)
+        /// <remarks></remarks>
+        public void Connect(IPlayer player)
         {
             this.player = player;

-            try
-            {
-                tcpClient = new TcpClient();
-                tcpClient.Connect(Dns.GetHostAddresses(host), port);
-                Connecting = true;
-
-                Thread th = new Thread(new ThreadStart(Run));
-                th.Start();
-
-                return true;
-            }
-            catch (Exception e)
-            {
-                Console.Error.WriteLine(e.StackTrace);
-                Connecting = false;
-                return false;
-            }
-        }
-
-        void Run()
-        {
+            tcpClient = new TcpClient();
+            tcpClient.Connect(Dns.GetHostAddresses(host), port);
+
             try
             {
                 StreamReader sr = new StreamReader(tcpClient.GetStream());
@@ -137,16 +115,11 @@
                     }
                 }
             }
-            catch
-            {
-                if (Connecting)
-                {
-                    Connecting = false;
-                    if (Running)
-                    {
-                        Running = false;
-                        throw new AIWolfRuntimeException();
-                    }
+            catch (IOException e)
+            {
+                if (Running)
+                {
+                    throw e;
                 }
             }
             finally
@@ -204,85 +177,106 @@
                 }
             }

-            object returnObject = null;
-            switch (packet.Request)
-            {
-                case Request.INITIALIZE:
-                    Running = true;
-                    player.Initialize(gameInfo, gameSetting);
-                    break;
-                case Request.DAILY_INITIALIZE:
-                    player.Update(gameInfo);
-                    player.DayStart();
-                    break;
-                case Request.DAILY_FINISH:
-                    player.Update(gameInfo);
-                    break;
-                case Request.NAME:
-                    if (PlayerName == null)
-                    {
-                        returnObject = player.Name;
+            Task<object> task = Task.Run(() =>
+            {
+                object returnObject = null;
+                switch (packet.Request)
+                {
+                    case Request.INITIALIZE:
+                        Running = true;
+                        player.Initialize(gameInfo, gameSetting);
+                        break;
+                    case Request.DAILY_INITIALIZE:
+                        player.Update(gameInfo);
+                        player.DayStart();
+                        break;
+                    case Request.DAILY_FINISH:
+                        player.Update(gameInfo);
+                        break;
+                    case Request.NAME:
+                        if (PlayerName == null)
+                        {
+                            returnObject = player.Name;
+                            if (returnObject == null)
+                            {
+                                returnObject = player.GetType().Name;
+                            }
+                        }
+                        else
+                        {
+                            returnObject = PlayerName;
+                        }
+                        break;
+                    case Request.ROLE:
+                        if (RequestRole != null)
+                        {
+                            returnObject = RequestRole.ToString();
+                        }
+                        else
+                        {
+                            returnObject = "none";
+                        }
+                        break;
+                    case Request.ATTACK:
+                        player.Update(gameInfo);
+                        returnObject = player.Attack();
+                        break;
+                    case Request.TALK:
+                        player.Update(gameInfo);
+                        returnObject = player.Talk();
                         if (returnObject == null)
                         {
-                            returnObject = player.GetType().Name;
-                        }
-                    }
-                    else
-                    {
-                        returnObject = PlayerName;
-                    }
-                    break;
-                case Request.ROLE:
-                    if (RequestRole != null)
-                    {
-                        returnObject = RequestRole.ToString();
-                    }
-                    else
-                    {
-                        returnObject = "none";
-                    }
-                    break;
-                case Request.ATTACK:
-                    player.Update(gameInfo);
-                    returnObject = player.Attack();
-                    break;
-                case Request.TALK:
-                    player.Update(gameInfo);
-                    returnObject = player.Talk();
-                    if (returnObject == null)
-                    {
-                        returnObject = Talk.SKIP;
-                    }
-                    break;
-                case Request.WHISPER:
-                    player.Update(gameInfo);
-                    returnObject = player.Whisper();
-                    if (returnObject == null)
-                    {
-                        returnObject = Talk.SKIP;
-                    }
-                    break;
-                case Request.DIVINE:
-                    player.Update(gameInfo);
-                    returnObject = player.Divine();
-                    break;
-                case Request.GUARD:
-                    player.Update(gameInfo);
-                    returnObject = player.Guard();
-                    break;
-                case Request.VOTE:
-                    player.Update(gameInfo);
-                    returnObject = player.Vote();
-                    break;
-                case Request.FINISH:
-                    player.Update(gameInfo);
-                    player.Finish();
-                    Running = false;
-                    break;
-                default:
-                    break;
-            }
-            return returnObject;
+                            returnObject = Talk.SKIP;
+                        }
+                        break;
+                    case Request.WHISPER:
+                        player.Update(gameInfo);
+                        returnObject = player.Whisper();
+                        if (returnObject == null)
+                        {
+                            returnObject = Talk.SKIP;
+                        }
+                        break;
+                    case Request.DIVINE:
+                        player.Update(gameInfo);
+                        returnObject = player.Divine();
+                        break;
+                    case Request.GUARD:
+                        player.Update(gameInfo);
+                        returnObject = player.Guard();
+                        break;
+                    case Request.VOTE:
+                        player.Update(gameInfo);
+                        returnObject = player.Vote();
+                        break;
+                    case Request.FINISH:
+                        player.Update(gameInfo);
+                        player.Finish();
+                        Running = false;
+                        break;
+                    default:
+                        break;
+                }
+                return returnObject;
+            });
+            try
+            {
+                if (task.Wait(Timeout))
+                {
+                    return task.Result;
+                }
+                else
+                {
+                    Console.Error.WriteLine(packet.Request + "@" + player.Name + " aborts because of timeout(" + Timeout + "ms).");
+                    Environment.Exit(0);
+                }
+            }
+            catch (AggregateException e)
+            {
+                Console.Error.WriteLine(e.InnerException.StackTrace);
+                Environment.Exit(0);
+            }
+            return null;
         }

         /// <summary>


build: address some compile warnings.

build: address some compile warnings.

--- test/Experiment.IdiomsUnitTest/ClassWithTestMembers.cs
+++ test/Experiment.IdiomsUnitTest/ClassWithTestMembers.cs
@@ -7,8 +7,10 @@
         public object PublicField;
         protected internal object ProtectedInternalField;
         protected object ProtectedField;
-        internal object InternalField;
+        internal object InternalField = null;
+#pragma warning disable 169
         private object PrivateField;
+#pragma warning restore 169

         public ClassWithTestMembers()
         {
@@ -100,10 +102,12 @@
         {
         }

+#pragma warning disable 67
         public event EventHandler PublicEvent;
         protected internal event EventHandler ProtectedInternalEvent;
         protected event EventHandler ProtectedEvent;
         internal event EventHandler InternalEvent;
         private event EventHandler PrivateEvent;
+#pragma warning restore 67
     }
 }


Claim the queue and execute vacuum outside of transaction

--- Akavache.Sqlite3/OperationQueue.cs
+++ Akavache.Sqlite3/OperationQueue.cs
@@ -151,14 +151,20 @@

                 using (await flushLock.LockAsync())
                 {
-                    var newQueue = new BlockingCollection<OperationQueueItem>();
-                    var existingItems = Interlocked.Exchange(ref operationQueue, newQueue).ToList();
-
-                    ProcessItems(CoalesceOperations(existingItems));
+                    FlushInternal();
                 }
             }).ToObservable();
         }

+        // NB: Callers must hold flushLock to call this
+        void FlushInternal()
+        {
+            var newQueue = new BlockingCollection<OperationQueueItem>();
+            var existingItems = Interlocked.Exchange(ref operationQueue, newQueue).ToList();
+
+            ProcessItems(CoalesceOperations(existingItems));
+        }
+
         public AsyncSubject<IEnumerable<CacheElement>> Select(IEnumerable<string> keys)
         {
             var ret = OperationQueueItem.CreateSelect(OperationType.BulkSelectSqliteOperation, keys);
@@ -209,19 +215,40 @@

         public AsyncSubject<Unit> Vacuum()
         {
-            var deleteRet = OperationQueueItem.CreateUnit(OperationType.DeleteExpiredSqliteOperation);
-            operationQueue.Add(deleteRet);
-
-            var vacuumRet = OperationQueueItem.CreateUnit(OperationType.VacuumSqliteOperation);
-            operationQueue.Add(vacuumRet);
-
-            var subject = new AsyncSubject<Unit>();
-
-            Observable.Concat(deleteRet.CompletionAsUnit, vacuumRet.CompletionAsUnit)
-                .Multicast(subject)
-                .PermaRef();
-
-            return subject;
+            // Vacuum is a special snowflake. We want to delete all the expired rows before
+            // actually vacuuming. Unfortunately vacuum can't be run in a transaction so we'll
+            // do the delete first, then claim an exclusive lock on the queue, drain it and
+            // run our vacuum op without any transactions.
+            var ret = new AsyncSubject<Unit>();
+
+            Task.Run(async () =>
+            {
+                // NB: We add a "DoNothing" operation so that the thread waiting
+                // on an item will always have one instead of waiting the full timeout
+                // before we can run the flush
+                operationQueue.Add(OperationQueueItem.CreateUnit(OperationType.DoNothing));
+
+                using (await flushLock.LockAsync())
+                {
+                    var deleteOp = OperationQueueItem.CreateUnit(OperationType.DeleteExpiredSqliteOperation);
+                    operationQueue.Add(deleteOp);
+
+                    FlushInternal();
+
+                    await deleteOp.CompletionAsUnit;
+
+                    var vacuumOp = OperationQueueItem.CreateUnit(OperationType.VacuumSqliteOperation);
+
+                    MarshalCompletion(vacuumOp.Completion, vacuum.PrepareToExecute(), Observable.Return(Unit.Default));
+
+                    await vacuumOp.CompletionAsUnit;
+                }
+            })
+            .ToObservable()
+            .Multicast(ret)
+            .PermaRef();
+
+            return ret;
         }

         public AsyncSubject<IEnumerable<string>> GetAllKeys()
@@ -240,6 +267,7 @@
         void ProcessItems(List<OperationQueueItem> toProcess)
         {
             var commitResult = new AsyncSubject<Unit>();
+
             begin.PrepareToExecute()();

             foreach (var item in toProcess)
@@ -273,10 +301,7 @@
                         MarshalCompletion(item.Completion, deleteExpired.PrepareToExecute(), commitResult);
                         break;
                     case OperationType.VacuumSqliteOperation:
-                        commit.PrepareToExecute()();
-                        MarshalCompletion(item.Completion, vacuum.PrepareToExecute(), commitResult);
-                        begin.PrepareToExecute()();
-                        break;
+                        throw new ArgumentException("Vacuum operation can't run inside transaction");
                     default:
                         throw new ArgumentException("Unknown operation");
                 }


Improved declaration parsing

Improved declaration parsing

--- AngleSharp/Parser/Css/CssParser.cs
+++ AngleSharp/Parser/Css/CssParser.cs
@@ -14,7 +14,7 @@
     /// The CSS parser.
     /// See http://dev.w3.org/csswg/css-syntax/#parsing for more details.
     /// </summary>
-    //[DebuggerStepThrough]
+    [DebuggerStepThrough]
     public sealed class CssParser : IParser
     {
         #region Creator Delegate
@@ -1055,6 +1055,9 @@
                     break;

                 Declaration(tokens, style);
+
+                if (tokens.Current.Type == CssTokenType.CurlyBracketClose)
+                    break;
             }
         }

@@ -1068,9 +1071,6 @@
             {
                 switch (tokens.Current.Type)
                 {
-                    case CssTokenType.Function:
-                        round++;
-                        break;
                     case CssTokenType.CurlyBracketClose:
                         curly--;
                         goto case CssTokenType.Semicolon;
@@ -1080,6 +1080,7 @@
                     case CssTokenType.RoundBracketClose:
                         round--;
                         break;
+                    case CssTokenType.Function:
                     case CssTokenType.RoundBracketOpen:
                         round++;
                         break;
@@ -1092,6 +1093,7 @@
                     case CssTokenType.Semicolon:
                         if (round <= 0 && curly <= 0 && square <= 0)
                             return;
+
                         break;
                 }
             }
@@ -1117,6 +1119,7 @@
                     case CssTokenType.RoundBracketClose:
                         round--;
                         break;
+                    case CssTokenType.Function:
                     case CssTokenType.RoundBracketOpen:
                         round++;
                         break;
@@ -1127,7 +1130,7 @@
                         square++;
                         break;
                     case CssTokenType.Semicolon:
-                        if (round == 0 && curly == 0 && square == 0)
+                        if (round <= 0 && curly <= 0 && square <= 0)
                             return;

                         break;
@@ -1153,11 +1156,12 @@
                         curly++;
                         break;
                     case CssTokenType.RoundBracketClose:
-                        if (round == 0 && curly == 0 && square == 0)
+                        if (round <= 0 && curly <= 0 && square <= 0)
                             return;

                         round--;
                         break;
+                    case CssTokenType.Function:
                     case CssTokenType.RoundBracketOpen:
                         round++;
                         break;