Removes unnecessary leftover prints from Bridge.Builder.exe.

Solving issue #1126, some unnecessary print commands were left on
Bridge.Builder.exe while parsing commandline arguments. This commit
removes those unnecessary test prints.

--- Compiler/Builder/Program.cs
+++ Compiler/Builder/Program.cs
@@ -172,16 +172,13 @@
         {
             if (bridgeOptions.ProjectLocation == null && bridgeOptions.Lib == null)
             {
-                logger.Info("hey");
                 if (arg.ToLower().EndsWith(".csproj"))
                 {
-                    logger.Info("prj");
                     bridgeOptions.ProjectLocation = arg;
                     return true;
                 }
                 else if (arg.ToLower().EndsWith(".dll"))
                 {
-                    logger.Info("lib");
                     bridgeOptions.Lib = arg;
                     return true;
                 }


git-svn-id: 21cdf44b51306c1f0753fc51e774ecf5fc1851ba@544 a61f9e97-bd4c-0410-8c65-85b29eaa70ff

--- Dorian/PlugIns/Gorgon.Graphics.D3D9/Test.cs
+++ Dorian/PlugIns/Gorgon.Graphics.D3D9/Test.cs
@@ -17,9 +17,11 @@
 		{
 			public Vector3 Position;
 			public int Color;
+			public Vector2 UV;
 		}

 		private VertexBuffer _vb = null;
+		private IndexBuffer _ib = null;
 		private VertexDeclaration _vdecl = null;
 		private Vertex[] triangle = new Vertex[3];
 		private float _pos = -0.75f;
@@ -31,6 +33,7 @@
 		private float _dps = 0.0f;
 		private float _currentTime = 0;
 		private bool _timeSwitch = false;
+		private Texture _image = null;

 		/// <summary>
@@ -45,16 +48,33 @@
 			_device = device;

 			_vdecl = new VertexDeclaration(device, new VertexElement[] {new VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0),
-																		new VertexElement(0, 12, DeclarationType.Color, DeclarationMethod.Default, DeclarationUsage.Color, 0)});
-
-			_vb = new VertexBuffer(device, 3 * 16, Usage.WriteOnly, VertexFormat.None, Pool.Managed);
-			_vb.Lock(0, 0, LockFlags.None).WriteRange(new[] {
-		                new Vertex() { Color = Color.Red.ToArgb(), Position = new Vector3(0.0f, 0.5f, 0.0f) },
-                new Vertex() { Color = Color.Blue.ToArgb(), Position = new Vector3(0.5f, -0.5f, 0.025f) },
-                new Vertex() { Color = Color.Green.ToArgb(), Position = new Vector3(-0.5f, -0.5f, 0.0f) }
+																		new VertexElement(0, 12, DeclarationType.Color, DeclarationMethod.Default, DeclarationUsage.Color, 0),
+																		new VertexElement(0, 16, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0)});
+
+			_vb = new VertexBuffer(device, 4 * 24, Usage.WriteOnly, VertexFormat.None, Pool.Managed);
+			_ib = new IndexBuffer(device, 12, Usage.WriteOnly, Pool.Managed, true);
+			_vb.Lock(0, 0, LockFlags.None).WriteRange(
+				new[] {
+		                new Vertex() { Color = Color.White.ToArgb(), Position = new Vector3(-0.5f, 0.5f, 0.0f), UV = new Vector2(0, 0.0f)},
+						new Vertex() { Color = Color.White.ToArgb(), Position = new Vector3(0.5f, -0.5f, 0.025f), UV = new Vector2(1.0f, 1.0f) },
+						new Vertex() { Color = Color.White.ToArgb(), Position = new Vector3(-0.5f, -0.5f, 0.0f), UV = new Vector2(0.0f, 1.0f) },
+						new Vertex() { Color = Color.White.ToArgb(), Position = new Vector3(0.5f, 0.5f, 0.0f), UV = new Vector2(1.0f, 0.0f) }
             });

 			_vb.Unlock();
+
+			_ib.Lock(0, 0, LockFlags.None).WriteRange(
+				new short[]
+				{
+					1,
+					2,
+					0,
+					0,
+					3,
+					1
+				}
+			);
+			_ib.Unlock();

 			device.SetRenderState(RenderState.Lighting, false);
 			device.SetRenderState(RenderState.CullMode, Cull.None);
@@ -63,6 +83,8 @@
 				device.SetRenderState(RenderState.MultisampleAntialias, true);
 				device.SetRenderState(RenderState.MultisampleMask, 0xFF);
 			}
+
+			_image = Texture.FromFile(_device, @"..\..\..\..\Resources\Images\VBback.jpg");
 			maxPasses = 0;
 		}

@@ -105,8 +127,11 @@
 				_device.SetTransform(TransformState.Projection, Matrix.PerspectiveFovLH(GorgonLibrary.Math.GorgonMathUtility.Radians(75.0f), (float)_window.Mode.Width / (float)_window.Mode.Height, 0.1f, 1000.0f));
 				_device.SetTransform(TransformState.View, Matrix.LookAtLH(new Vector3(0, 0, _pos), new Vector3(0, 0, 1.0f), Vector3.UnitY));

-				_device.SetStreamSource(0, _vb, 0, 16);
+				_device.SetStreamSource(0, _vb, 0, 24);
+				_device.Indices = _ib;
 				_device.VertexDeclaration = _vdecl;
+
+				_device.SetTexture(0, _image);

 				for (int i = 0; i <= maxPasses; i++)
 				{
@@ -117,8 +142,9 @@
 					else
 						passAngle = GorgonLibrary.Math.GorgonMathUtility.Radians(_angle - (maxPasses - (i * (_dps / GorgonLibrary.Math.GorgonMathUtility.Pow(maxPasses, 2)))));

-					_Yrot = Matrix.RotationY(passAngle);
-					_Yrot = _Yrot * Matrix.RotationX(passAngle);
+					//_Yrot = Matrix.RotationY(passAngle);
+					_Yrot = Matrix.Identity;
+					_Yrot = _Yrot * Matrix.RotationZ(passAngle);

 					//if (_currentTime == 0)
 					//    _currentTime= Environment.TickCount;
@@ -130,7 +156,7 @@

 					if ((_window.MultiSampleAALevel.HasValue) && (_window.MultiSampleAALevel.Value.Level != GorgonMSAALevel.None))
 						_device.SetRenderState(RenderState.MultisampleMask, ((int)GorgonLibrary.Math.GorgonMathUtility.Pow(2, (8 - (maxPasses - i))) - 1) & 0xFF);
-					_device.DrawPrimitives(PrimitiveType.TriangleList, 0, 1);
+					_device.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, 4, 0, 2);
 				}
 				_device.EndScene();

@@ -168,6 +194,10 @@
 		/// </summary>
 		public void ShutDown()
 		{
+			if (_image != null)
+				_image.Dispose();
+			if (_ib != null)
+				_ib.Dispose();
 			if (_vdecl != null)
 				_vdecl.Dispose();
 			if (_vb != null)


Enable CtrlSpace test

Enable CtrlSpace test

--- Nodejs/Tests/Core.UI/BasicIntellisense.cs
+++ Nodejs/Tests/Core.UI/BasicIntellisense.cs
@@ -16,11 +16,9 @@

 using System;
 using System.Linq;
-using System.Windows;
 using Microsoft.NodejsTools.Intellisense;
 using Microsoft.VisualStudio.Language.Intellisense;
 using Microsoft.VisualStudio.TestTools.UnitTesting;
-using Microsoft.VisualStudio.Text;
 using TestUtilities;
 using TestUtilities.UI;
 using Key = System.Windows.Input.Key;
@@ -33,14 +31,14 @@
         ///
         /// Make sure Ctrl-Space works
         /// </summary>
-        [TestMethod, Priority(0), TestCategory("Core"), TestCategory("Ignore")]
+        [TestMethod, Priority(0), TestCategory("Core")]
         [HostType("VSTestHost")]
         public void CtrlSpace() {
             var project = Project("CtrlSpace",
                 Compile("server", "var http = require('http');\r\nhttp.createS")
             );

-			using (var solution = project.Generate().ToVs()) {
+            using (var solution = project.Generate().ToVs()) {
                 var optionsPage = NodejsTools.NodejsPackage.Instance.IntellisenseOptionsPage;
                 using (new NodejsOptionHolder(optionsPage, "OnlyTabOrEnterToCommit", false)) {
                     var server = solution.OpenItem("CtrlSpace", "server.js");


finished DEC

finished DEC

--- Numeric_Converter/HexConverter/Program.cs
+++ Numeric_Converter/HexConverter/Program.cs
@@ -10,6 +10,37 @@
     {
         static void Main(string[] args)
         {
+            string numberInput = Console.ReadLine();
+            string inputSystem = Console.ReadLine();
+            string result = string.Empty;
+            if (inputSystem == "DEC")
+            {
+                string remainder ;
+                int number = int.Parse(numberInput);
+                while (number != 0)
+                {
+                    remainder = (number % 16).ToString();
+                    switch (remainder)
+                    {
+                        case "10":remainder = "A"; break;
+                        case "11": remainder = "B"; break;
+                        case "12": remainder = "C"; break;
+                        case "13": remainder = "D"; break;
+                        case "14": remainder = "E"; break;
+                        case "15": remainder = "F"; break;
+
+                    }
+                    number /= 16;
+                    result += remainder;
+                }
+            }
+            else if (inputSystem == "BIN")
+            {
+
+
+
+            }
+            Console.WriteLine(result);

         }
     }


Fixed UnmanagedFunctionPointerAttribute on Rf_findVar

--- R.NET/Internals/Delegates.cs
+++ R.NET/Internals/Delegates.cs
@@ -86,6 +86,7 @@
 	[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
 	internal delegate IntPtr R_ParseVector(IntPtr statement, int statementCount, out ParseStatus status, IntPtr _);

+	[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
 	internal delegate IntPtr Rf_findVar(IntPtr name, IntPtr environment);

 	[UnmanagedFunctionPointer(CallingConvention.Cdecl)]


Changed to a more appropriate exception type

As recommend by @gmarz changed from a generic exception to a transport
type exception.

--- src/Connections/Elasticsearch.Net.Connection.Thrift/Transport/TSocket.cs
+++ src/Connections/Elasticsearch.Net.Connection.Thrift/Transport/TSocket.cs
@@ -117,14 +117,14 @@
 			{
 				InitSocket();
 			}
+

 		    var connectionRequest = client.BeginConnect(host, port, null, null);
-
             var connected = connectionRequest.AsyncWaitHandle.WaitOne(timeout);

 		    if (!connected)
 		    {
-		        throw new Exception("Failed to connect");
+                throw new TTransportException("Failed to connect");
 		    }

 			inputStream = client.GetStream();


Simplify

Simplify

--- src/EditorFeatures/CSharp/StringCopyPaste/UnknownSourcePasteProcessor.cs
+++ src/EditorFeatures/CSharp/StringCopyPaste/UnknownSourcePasteProcessor.cs
@@ -12,6 +12,7 @@
 using Microsoft.CodeAnalysis.Editor.Shared.Extensions;
 using Microsoft.CodeAnalysis.Indentation;
 using Microsoft.CodeAnalysis.PooledObjects;
+using Microsoft.CodeAnalysis.Shared.Collections;
 using Microsoft.CodeAnalysis.Shared.Extensions;
 using Microsoft.CodeAnalysis.Text;
 using Microsoft.VisualStudio.Text;
@@ -79,37 +80,26 @@

         private ImmutableArray<TextChange> GetAppropriateTextChanges(CancellationToken cancellationToken)
         {
-            if (IsAnyRawStringExpression(StringExpressionBeforePaste))
-                return GetTextChangesForRawString(cancellationToken);
-
             // For pastes into non-raw strings, we can just determine how the change should be escaped in-line at that
             // same location the paste originally happened at.  For raw-strings things get more complex as we have to
             // deal with things like indentation and potentially adding newlines to make things legal.
-            if (StringExpressionBeforePaste is LiteralExpressionSyntax literalExpression)
-            {
-                Contract.ThrowIfFalse(literalExpression.Token.Kind() == SyntaxKind.StringLiteralToken);
-                return GetEscapedTextChangesForNonRawString(literalExpression.Token.IsVerbatimStringLiteral());
-            }
-            else if (StringExpressionBeforePaste is InterpolatedStringExpressionSyntax interpolatedString)
-            {
-                if (interpolatedString.StringStartToken.Kind() == SyntaxKind.InterpolatedStringStartToken)
-                    return GetEscapedTextChangesForNonRawString(isVerbatim: false);
-
-                if (interpolatedString.StringStartToken.Kind() == SyntaxKind.InterpolatedVerbatimStringStartToken)
-                    return GetEscapedTextChangesForNonRawString(isVerbatim: true);
-            }
-
-            throw ExceptionUtilities.UnexpectedValue(StringExpressionBeforePaste);
-        }
-
-        private ImmutableArray<TextChange> GetEscapedTextChangesForNonRawString(bool isVerbatim)
-        {
-            using var _ = ArrayBuilder<TextChange>.GetInstance(out var textChanges);
+            return IsAnyRawStringExpression(StringExpressionBeforePaste)
+                ? GetTextChangesForRawString(cancellationToken)
+                : GetTextChangesForNonRawString();
+        }
+
+        private ImmutableArray<TextChange> GetTextChangesForNonRawString()
+        {
+            var isVerbatim =
+                StringExpressionBeforePaste is LiteralExpressionSyntax literalExpression && literalExpression.Token.IsVerbatimStringLiteral() ||
+                StringExpressionBeforePaste is InterpolatedStringExpressionSyntax { StringStartToken.RawKind: (int)SyntaxKind.InterpolatedVerbatimStringStartToken };
+
+            using var textChanges = TemporaryArray<TextChange>.Empty;

             foreach (var change in Changes)
                 textChanges.Add(new TextChange(change.OldSpan.ToTextSpan(), EscapeForNonRawStringLiteral(isVerbatim, change.NewText)));

-            return textChanges.ToImmutable();
+            return textChanges.ToImmutableAndClear();
         }

         /// <summary>
@@ -169,8 +159,8 @@

             var indentationWhitespace = StringExpressionBeforePaste.GetFirstToken().GetPreferredIndentation(DocumentBeforePaste, cancellationToken);

-            using var _1 = ArrayBuilder<TextChange>.GetInstance(out var finalTextChanges);
-            using var _2 = PooledStringBuilder.GetInstance(out var buffer);
+            using var finalTextChanges = TemporaryArray<TextChange>.Empty;
+            using var _ = PooledStringBuilder.GetInstance(out var buffer);

             // First, add any extra quotes if we need them.
             if (quotesToAdd != null)
@@ -226,7 +216,7 @@
             if (quotesToAdd != null)
                 finalTextChanges.Add(new TextChange(new TextSpan(StringExpressionBeforePaste.Span.End, 0), quotesToAdd));

-            return finalTextChanges.ToImmutable();
+            return finalTextChanges.ToImmutableAndClear();

             bool LastPastedLineAddedNewLine()
             {
@@ -246,8 +236,8 @@
             // The indentation whitespace every line of the final raw string needs.
             var indentationWhitespace = endLine.GetLeadingWhitespace();

-            using var _1 = ArrayBuilder<TextChange>.GetInstance(out var finalTextChanges);
-            using var _2 = PooledStringBuilder.GetInstance(out var buffer);
+            using var finalTextChanges = TemporaryArray<TextChange>.Empty;
+            using var _ = PooledStringBuilder.GetInstance(out var buffer);

             if (quotesToAdd != null)
                 finalTextChanges.Add(new TextChange(new TextSpan(StringExpressionBeforePaste.SpanStart, 0), quotesToAdd));
@@ -353,7 +343,7 @@
             if (quotesToAdd != null)
                 finalTextChanges.Add(new TextChange(new TextSpan(StringExpressionBeforePaste.Span.End, 0), quotesToAdd));

-            return finalTextChanges.ToImmutable();
+            return finalTextChanges.ToImmutableAndClear();
         }
     }
 }


AddGremlinq: Use TryAddSingleton, because re-registering some services is unnecessary. We cannot do better than re-registering the IGremlinQuerySourceTransformations, but they are idempotent.

--- src/ExRam.Gremlinq.Core.AspNet/Extensions/ServiceCollectionExtensions.cs
+++ src/ExRam.Gremlinq.Core.AspNet/Extensions/ServiceCollectionExtensions.cs
@@ -3,6 +3,7 @@
 using ExRam.Gremlinq.Core;
 using ExRam.Gremlinq.Core.AspNet;
 using ExRam.Gremlinq.Core.Serialization;
+using Microsoft.Extensions.DependencyInjection.Extensions;
 using Microsoft.Extensions.Logging;
 using Newtonsoft.Json;

@@ -69,11 +70,17 @@
         public static IServiceCollection AddGremlinq(this IServiceCollection serviceCollection, Action<GremlinqSetup> configuration)
         {
             serviceCollection
-                .AddSingleton(new GremlinqSetupInfo())
-                .AddSingleton<IGremlinqConfigurationSection, GremlinqConfigurationSection>()
+                .TryAddSingleton(new GremlinqSetupInfo());
+
+            serviceCollection
+                .TryAddSingleton<IGremlinqConfigurationSection, GremlinqConfigurationSection>();
+
+            serviceCollection
                 .AddSingleton<IGremlinQuerySourceTransformation, UseLoggerGremlinQuerySourceTransformation>()
-                .AddSingleton<IGremlinQuerySourceTransformation, ConfigureOptionsGremlinQuerySourceTransformation>()
-                .AddSingleton(c =>
+                .AddSingleton<IGremlinQuerySourceTransformation, ConfigureOptionsGremlinQuerySourceTransformation>();
+
+            serviceCollection
+                .TryAddSingleton(c =>
                 {
                     var ret = g
                         .ConfigureEnvironment(_ => _);


Add overloads of ConfigureWebJobs to expose HostBuilderContext

--- src/Microsoft.Azure.WebJobs.Host/Hosting/WebJobsHostBuilderExtensions.cs
+++ src/Microsoft.Azure.WebJobs.Host/Hosting/WebJobsHostBuilderExtensions.cs
@@ -25,6 +25,16 @@

         public static IHostBuilder ConfigureWebJobs(this IHostBuilder builder, Action<IWebJobsBuilder> configure, Action<JobHostOptions> configureOptions)
         {
+            return builder.ConfigureWebJobs((context, b) => configure(b), configureOptions);
+        }
+
+        public static IHostBuilder ConfigureWebJobs(this IHostBuilder builder, Action<HostBuilderContext, IWebJobsBuilder> configure)
+        {
+            return builder.ConfigureWebJobs(configure, o => { });
+        }
+
+        public static IHostBuilder ConfigureWebJobs(this IHostBuilder builder, Action<HostBuilderContext, IWebJobsBuilder> configure, Action<JobHostOptions> configureOptions)
+        {
             builder.ConfigureAppConfiguration(config =>
             {
                 config.AddJsonFile("appsettings.json", optional: true);
@@ -34,7 +44,7 @@
             builder.ConfigureServices((context, services) =>
             {
                 IWebJobsBuilder webJobsBuilder = services.AddWebJobs(configureOptions);
-                configure(webJobsBuilder);
+                configure(context, webJobsBuilder);

                 services.TryAddEnumerable(ServiceDescriptor.Singleton<IHostedService, JobHostService>());
             });


Improve BitConverter.ToIntNN methods (#9803)

* Improve BitConverter.ToIntNN methods

- Avoid duplicate argument validation
- Fix failed optimization attempt: (uint)i < a.Length needs to be (uint) < (uint)a.Length otherwise it gets promoted to long and that's bad for 32 bit architectures
- Workaround JIT limitation: fixed variables cannot be enregistered
- Use Unsafe.ReadUnaligned to avoid alignment handling complications
- Use Unsafe.As instead of fixed as it generates shorter code
- Don't forward unsigned method to signed methods. The JIT doesn't want to inline the signed methods even though the generated code isn't significantly larger

--- src/mscorlib/src/System/BitConverter.cs
+++ src/mscorlib/src/System/BitConverter.cs
@@ -4,6 +4,7 @@

 using System.Diagnostics;
 using System.Diagnostics.Contracts;
+using System.Runtime.CompilerServices;
 using System.Security;

 namespace System
@@ -38,47 +39,46 @@
         public static byte[] GetBytes(char value)
         {
             Contract.Ensures(Contract.Result<byte[]>() != null);
-            Contract.Ensures(Contract.Result<byte[]>().Length == 2);
-
-            return GetBytes((short)value);
+            Contract.Ensures(Contract.Result<byte[]>().Length == sizeof(char));
+
+            byte[] bytes = new byte[sizeof(char)];
+            Unsafe.As<byte, char>(ref bytes[0]) = value;
+            return bytes;
         }

         // Converts a short into an array of bytes with length
         // two.
-        public static unsafe byte[] GetBytes(short value)
-        {
-            Contract.Ensures(Contract.Result<byte[]>() != null);
-            Contract.Ensures(Contract.Result<byte[]>().Length == 2);
-
-            byte[] bytes = new byte[2];
-            fixed (byte* b = &bytes[0])
-                *((short*)b) = value;
+        public static byte[] GetBytes(short value)
+        {
+            Contract.Ensures(Contract.Result<byte[]>() != null);
+            Contract.Ensures(Contract.Result<byte[]>().Length == sizeof(short));
+
+            byte[] bytes = new byte[sizeof(short)];
+            Unsafe.As<byte, short>(ref bytes[0]) = value;
             return bytes;
         }

         // Converts an int into an array of bytes with length
         // four.
-        public static unsafe byte[] GetBytes(int value)
-        {
-            Contract.Ensures(Contract.Result<byte[]>() != null);
-            Contract.Ensures(Contract.Result<byte[]>().Length == 4);
-
-            byte[] bytes = new byte[4];
-            fixed (byte* b = &bytes[0])
-                *((int*)b) = value;
+        public static byte[] GetBytes(int value)
+        {
+            Contract.Ensures(Contract.Result<byte[]>() != null);
+            Contract.Ensures(Contract.Result<byte[]>().Length == sizeof(int));
+
+            byte[] bytes = new byte[sizeof(int)];
+            Unsafe.As<byte, int>(ref bytes[0]) = value;
             return bytes;
         }

         // Converts a long into an array of bytes with length
         // eight.
-        public static unsafe byte[] GetBytes(long value)
-        {
-            Contract.Ensures(Contract.Result<byte[]>() != null);
-            Contract.Ensures(Contract.Result<byte[]>().Length == 8);
-
-            byte[] bytes = new byte[8];
-            fixed (byte* b = &bytes[0])
-                *((long*)b) = value;
+        public static byte[] GetBytes(long value)
+        {
+            Contract.Ensures(Contract.Result<byte[]>() != null);
+            Contract.Ensures(Contract.Result<byte[]>().Length == sizeof(long));
+
+            byte[] bytes = new byte[sizeof(long)];
+            Unsafe.As<byte, long>(ref bytes[0]) = value;
             return bytes;
         }

@@ -88,9 +88,11 @@
         public static byte[] GetBytes(ushort value)
         {
             Contract.Ensures(Contract.Result<byte[]>() != null);
-            Contract.Ensures(Contract.Result<byte[]>().Length == 2);
-
-            return GetBytes(unchecked((short)value));
+            Contract.Ensures(Contract.Result<byte[]>().Length == sizeof(ushort));
+
+            byte[] bytes = new byte[sizeof(ushort)];
+            Unsafe.As<byte, ushort>(ref bytes[0]) = value;
+            return bytes;
         }

         // Converts an uint into an array of bytes with
@@ -99,9 +101,11 @@
         public static byte[] GetBytes(uint value)
         {
             Contract.Ensures(Contract.Result<byte[]>() != null);
-            Contract.Ensures(Contract.Result<byte[]>().Length == 4);
-
-            return GetBytes(unchecked((int)value));
+            Contract.Ensures(Contract.Result<byte[]>().Length == sizeof(uint));
+
+            byte[] bytes = new byte[sizeof(uint)];
+            Unsafe.As<byte, uint>(ref bytes[0]) = value;
+            return bytes;
         }

         // Converts an unsigned long into an array of bytes with
@@ -110,212 +114,114 @@
         public static byte[] GetBytes(ulong value)
         {
             Contract.Ensures(Contract.Result<byte[]>() != null);
-            Contract.Ensures(Contract.Result<byte[]>().Length == 8);
-
-            return GetBytes(unchecked((long)value));
+            Contract.Ensures(Contract.Result<byte[]>().Length == sizeof(ulong));
+
+            byte[] bytes = new byte[sizeof(ulong)];
+            Unsafe.As<byte, ulong>(ref bytes[0]) = value;
+            return bytes;
         }

         // Converts a float into an array of bytes with length
         // four.
-        public static unsafe byte[] GetBytes(float value)
-        {
-            Contract.Ensures(Contract.Result<byte[]>() != null);
-            Contract.Ensures(Contract.Result<byte[]>().Length == 4);
-
-            return GetBytes(*(int*)&value);
+        public static byte[] GetBytes(float value)
+        {
+            Contract.Ensures(Contract.Result<byte[]>() != null);
+            Contract.Ensures(Contract.Result<byte[]>().Length == sizeof(float));
+
+            byte[] bytes = new byte[sizeof(float)];
+            Unsafe.As<byte, float>(ref bytes[0]) = value;
+            return bytes;
         }

         // Converts a double into an array of bytes with length
         // eight.
-        public static unsafe byte[] GetBytes(double value)
-        {
-            Contract.Ensures(Contract.Result<byte[]>() != null);
-            Contract.Ensures(Contract.Result<byte[]>().Length == 8);
-
-            return GetBytes(*(long*)&value);
+        public static byte[] GetBytes(double value)
+        {
+            Contract.Ensures(Contract.Result<byte[]>() != null);
+            Contract.Ensures(Contract.Result<byte[]>().Length == sizeof(double));
+
+            byte[] bytes = new byte[sizeof(double)];
+            Unsafe.As<byte, double>(ref bytes[0]) = value;
+            return bytes;
         }

         // Converts an array of bytes into a char.
-        public static char ToChar(byte[] value, int startIndex)
-        {
-            if (value == null)
-                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value);
-            if (unchecked((uint)startIndex) >= value.Length)
-                ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);;
-            if (startIndex > value.Length - 2)
+        public static char ToChar(byte[] value, int startIndex) => unchecked((char)ReadInt16(value, startIndex));
+
+        private static short ReadInt16(byte[] value, int startIndex)
+        {
+            if (value == null)
+                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value);
+            if (unchecked((uint)startIndex) >= unchecked((uint)value.Length))
+                ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);
+            if (startIndex > value.Length - sizeof(short))
                 ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall, ExceptionArgument.value);
             Contract.EndContractBlock();

-            return unchecked((char)ToInt16(value, startIndex));
+            return Unsafe.ReadUnaligned<short>(ref value[startIndex]);
+        }
+
+        private static int ReadInt32(byte[] value, int startIndex)
+        {
+            if (value == null)
+                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value);
+            if (unchecked((uint)startIndex) >= unchecked((uint)value.Length))
+                ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);
+            if (startIndex > value.Length - sizeof(int))
+                ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall, ExceptionArgument.value);
+            Contract.EndContractBlock();
+
+            return Unsafe.ReadUnaligned<int>(ref value[startIndex]);
+        }
+
+        private static long ReadInt64(byte[] value, int startIndex)
+        {
+            if (value == null)
+                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value);
+            if (unchecked((uint)startIndex) >= unchecked((uint)value.Length))
+                ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);
+            if (startIndex > value.Length - sizeof(long))
+                ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall, ExceptionArgument.value);
+            Contract.EndContractBlock();
+
+            return Unsafe.ReadUnaligned<long>(ref value[startIndex]);
         }

         // Converts an array of bytes into a short.
-        public static unsafe short ToInt16(byte[] value, int startIndex)
-        {
-            if (value == null)
-                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value);
-            if (unchecked((uint)startIndex) >= value.Length)
-                ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);;
-            if (startIndex > value.Length - 2)
-                ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall, ExceptionArgument.value);
-            Contract.EndContractBlock();
-
-            fixed (byte* pbyte = &value[startIndex])
-            {
-                if (startIndex % 2 == 0)
-                {
-                    // data is aligned
-                    return *((short*)pbyte);
-                }
-                else if (IsLittleEndian)
-                {
-                    return (short)((*pbyte) | (*(pbyte + 1) << 8));
-                }
-                else
-                {
-                    return (short)((*pbyte << 8) | (*(pbyte + 1)));
-                }
-            }
-        }
+        public static short ToInt16(byte[] value, int startIndex) => ReadInt16(value, startIndex);

         // Converts an array of bytes into an int.
-        public static unsafe int ToInt32(byte[] value, int startIndex)
-        {
-            if (value == null)
-                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value);
-            if (unchecked((uint)startIndex) >= value.Length)
-                ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);;
-            if (startIndex > value.Length - 4)
-                ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall, ExceptionArgument.value);
-            Contract.EndContractBlock();
-
-            fixed (byte* pbyte = &value[startIndex])
-            {
-                if (startIndex % 4 == 0)
-                {
-                    // data is aligned
-                    return *((int*)pbyte);
-                }
-                else if (IsLittleEndian)
-                {
-                    return (*pbyte) | (*(pbyte + 1) << 8) | (*(pbyte + 2) << 16) | (*(pbyte + 3) << 24);
-                }
-                else
-                {
-                    return (*pbyte << 24) | (*(pbyte + 1) << 16) | (*(pbyte + 2) << 8) | (*(pbyte + 3));
-                }
-            }
-        }
+        public static int ToInt32(byte[] value, int startIndex) => ReadInt32(value, startIndex);

         // Converts an array of bytes into a long.
-        public static unsafe long ToInt64(byte[] value, int startIndex)
-        {
-            if (value == null)
-                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value);
-            if (unchecked((uint)startIndex) >= value.Length)
-                ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);;
-            if (startIndex > value.Length - 8)
-                ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall, ExceptionArgument.value);
-            Contract.EndContractBlock();
-
-            fixed (byte* pbyte = &value[startIndex])
-            {
-                if (startIndex % 8 == 0)
-                {
-                    // data is aligned
-                    return *((long*)pbyte);
-                }
-                else if (IsLittleEndian)
-                {
-                    int i1 = (*pbyte) | (*(pbyte + 1) << 8) | (*(pbyte + 2) << 16) | (*(pbyte + 3) << 24);
-                    int i2 = (*(pbyte + 4)) | (*(pbyte + 5) << 8) | (*(pbyte + 6) << 16) | (*(pbyte + 7) << 24);
-                    return unchecked((uint)i1) | ((long)i2 << 32);
-                }
-                else
-                {
-                    int i1 = (*pbyte << 24) | (*(pbyte + 1) << 16) | (*(pbyte + 2) << 8) | (*(pbyte + 3));
-                    int i2 = (*(pbyte + 4) << 24) | (*(pbyte + 5) << 16) | (*(pbyte + 6) << 8) | (*(pbyte + 7));
-                    return unchecked((uint)i2) | ((long)i1 << 32);
-                }
-            }
-        }
-
+        public static long ToInt64(byte[] value, int startIndex) => ReadInt64(value, startIndex);

         // Converts an array of bytes into an ushort.
         //
         [CLSCompliant(false)]
-        public static ushort ToUInt16(byte[] value, int startIndex)
-        {
-            if (value == null)
-                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value);
-            if (unchecked((uint)startIndex) >= value.Length)
-                ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);;
-            if (startIndex > value.Length - 2)
-                ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall, ExceptionArgument.value);
-            Contract.EndContractBlock();
-
-            return unchecked((ushort)ToInt16(value, startIndex));
-        }
+        public static ushort ToUInt16(byte[] value, int startIndex) => unchecked((ushort)ReadInt16(value, startIndex));

         // Converts an array of bytes into an uint.
         //
         [CLSCompliant(false)]
-        public static uint ToUInt32(byte[] value, int startIndex)
-        {
-            if (value == null)
-                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value);
-            if (unchecked((uint)startIndex) >= value.Length)
-                ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);;
-            if (startIndex > value.Length - 4)
-                ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall, ExceptionArgument.value);
-            Contract.EndContractBlock();
-
-            return unchecked((uint)ToInt32(value, startIndex));
-        }
+        public static uint ToUInt32(byte[] value, int startIndex) => unchecked((uint)ReadInt32(value, startIndex));

         // Converts an array of bytes into an unsigned long.
         //
         [CLSCompliant(false)]
-        public static ulong ToUInt64(byte[] value, int startIndex)
-        {
-            if (value == null)
-                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value);
-            if (unchecked((uint)startIndex) >= value.Length)
-                ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);;
-            if (startIndex > value.Length - 8)
-                ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall, ExceptionArgument.value);
-            Contract.EndContractBlock();
-
-            return unchecked((ulong)ToInt64(value, startIndex));
-        }
+        public static ulong ToUInt64(byte[] value, int startIndex) => unchecked((ulong)ReadInt64(value, startIndex));

         // Converts an array of bytes into a float.
         public static unsafe float ToSingle(byte[] value, int startIndex)
         {
-            if (value == null)
-                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value);
-            if (unchecked((uint)startIndex) >= value.Length)
-                ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);;
-            if (startIndex > value.Length - 4)
-                ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall, ExceptionArgument.value);
-            Contract.EndContractBlock();
-
-            int val = ToInt32(value, startIndex);
+            int val = ReadInt32(value, startIndex);
             return *(float*)&val;
         }

         // Converts an array of bytes into a double.
         public static unsafe double ToDouble(byte[] value, int startIndex)
         {
-            if (value == null)
-                ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value);
-            if (unchecked((uint)startIndex) >= value.Length)
-                ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index);;
-            if (startIndex > value.Length - 8)
-                ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_ArrayPlusOffTooSmall, ExceptionArgument.value);
-            Contract.EndContractBlock();
-
-            long val = ToInt64(value, startIndex);
+            long val = ReadInt64(value, startIndex);
             return *(double*)&val;
         }


Don't throw NRE from MemoryVirtualAddressSpace.Name, return null instead (#846)

--- src/Microsoft.Diagnostics.Runtime/src/Linux/MemoryVirtualAddressSpace.cs
+++ src/Microsoft.Diagnostics.Runtime/src/Linux/MemoryVirtualAddressSpace.cs
@@ -17,7 +17,7 @@

         public long Length => throw new NotImplementedException();

-        public string Name => throw new NotImplementedException();
+        public string Name => null;

         public int Read(long position, Span<byte> buffer)
         {


Activate filter targets for grr & grrui on Mac

--- RepoZ.App.Mac/AppDelegate.cs
+++ RepoZ.App.Mac/AppDelegate.cs
@@ -149,7 +149,7 @@
         {
             var aggregator = TinyIoCContainer.Current.Resolve<IRepositoryInformationAggregator>();
             return aggregator.Repositories
-                .Where(r => string.IsNullOrEmpty(repositoryNamePattern) || Regex.IsMatch(r.Name, repositoryNamePattern, RegexOptions.IgnoreCase))
+                .Where(r => r.MatchesRegexFilter(repositoryNamePattern))
                 .Select(r => new Ipc.Repository
                 {
                     Name = r.Name,


Restore using a hashset (like master)

Restore using a hashset (like master)

--- src/OmniSharp.Roslyn.CSharp/Services/Intellisense/IntellisenseService.cs
+++ src/OmniSharp.Roslyn.CSharp/Services/Intellisense/IntellisenseService.cs
@@ -33,7 +33,7 @@
         {
             var documents = _workspace.GetDocuments(request.FileName);
             var wordToComplete = request.WordToComplete;
-            var completions = new List<AutoCompleteResponse>();
+            var completions = new HashSet<AutoCompleteResponse>();

             foreach (var document in documents)
             {
@@ -69,7 +69,7 @@
                 .ThenBy(c => c.CompletionText);
         }

-        private void AddKeywords(List<AutoCompleteResponse> completions, SemanticModel model, int position, bool wantKind, string wordToComplete)
+        private void AddKeywords(HashSet<AutoCompleteResponse> completions, SemanticModel model, int position, bool wantKind, string wordToComplete)
         {
             var context = CSharpSyntaxContext.CreateContext(_workspace, model, position, CancellationToken.None);
             var keywordHandler = new KeywordContextHandler();


#19670 blog archieve count show 0.

#19670 blog archieve count show 0.

--HG--
branch : 1.x

--- src/Orchard.Web/Modules/Orchard.Blogs/Handlers/BlogPartArchiveHandler.cs
+++ src/Orchard.Web/Modules/Orchard.Blogs/Handlers/BlogPartArchiveHandler.cs
@@ -53,7 +53,7 @@
             if(previousArchiveRecord == null)
                 return;

-            if (previousArchiveRecord.PostCount > 0)
+            if (previousArchiveRecord.PostCount > 1)
                 previousArchiveRecord.PostCount--;
             else
                 blogArchiveRepository.Delete(previousArchiveRecord);


Fixing xml content caching issues

Fixing xml content caching issues

--- src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs
+++ src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs
@@ -9,7 +9,6 @@
 using System.Web;
 using System.Web.Mvc;
 using System.Web.Routing;
-using Orchard.Core.Feeds.Rss;
 using Orchard.OutputCache.Models;
 using Orchard.OutputCache.Services;
 using Orchard.Caching;
@@ -35,6 +34,7 @@
         private readonly ICacheService _cacheService;
         private readonly ISignals _signals;
         private readonly ShellSettings _shellSettings;
+        private static readonly string[] AuthorizedContentTypes = new [] { "text/html", "text/xml", "text/json" };

         private const string RefreshKey = "__r";

@@ -285,7 +285,7 @@
         public void OnActionExecuted(ActionExecutedContext filterContext) {

             // only cache view results, but don't return already as we still need to process redirections
-            if (!(filterContext.Result is ViewResultBase) && !(filterContext.Result is RssResult)) {
+            if (!(filterContext.Result is ViewResultBase) && !( AuthorizedContentTypes.Contains(filterContext.HttpContext.Response.ContentType))) {
                 _filter = null;
             }


Fix NRE with TaxonomyIndex (#11283)

Fix NRE with TaxonomyIndex (#11283)

--- src/OrchardCore.Modules/OrchardCore.Taxonomies/Indexing/TaxonomyIndex.cs
+++ src/OrchardCore.Modules/OrchardCore.Taxonomies/Indexing/TaxonomyIndex.cs
@@ -87,7 +87,7 @@
                             continue;
                         }

-                        var jField = (JObject)jPart[fieldDefinition.Name];
+                        var jField = jPart[fieldDefinition.Name] as JObject;

                         if (jField == null)
                         {


Tabified

Tabified

--- RestSharp.Tests/JsonTests.cs
+++ RestSharp.Tests/JsonTests.cs
@@ -30,9 +30,9 @@
 {
 	public class JsonTests
 	{
-        private const string AlternativeCulture = "pt-PT";
-
-        private const string GuidString = "AC1FC4BC-087A-4242-B8EE-C53EBE9887A5";
+		  private const string AlternativeCulture = "pt-PT";
+
+		  private const string GuidString = "AC1FC4BC-087A-4242-B8EE-C53EBE9887A5";

 		[Fact]
 		public void Can_Deserialize_4sq_Json_With_Root_Element_Specified()
@@ -128,7 +128,7 @@
 		[Fact]
 		public void Can_Deserialize_Custom_Formatted_Date()
 		{
-		    var culture = CultureInfo.InvariantCulture;
+			 var culture = CultureInfo.InvariantCulture;
 			var format = "dd yyyy MMM, hh:mm ss tt";
 			var date = new DateTime(2010, 2, 8, 11, 11, 11);

@@ -235,14 +235,14 @@
 			Assert.Equal("Foe 2", p.Foes["dict2"].Nickname);
 		}

-        [Fact]
-        public void Can_Deserialize_With_Default_Root_Alternative_Culture()
-        {
-            using (new CultureChange(AlternativeCulture))
-            {
-                Can_Deserialize_With_Default_Root();
-            }
-        }
+		  [Fact]
+		  public void Can_Deserialize_With_Default_Root_Alternative_Culture()
+		  {
+				using (new CultureChange(AlternativeCulture))
+				{
+					 Can_Deserialize_With_Default_Root();
+				}
+		  }

 		[Fact]
 		public void Can_Deserialize_Names_With_Underscores_With_Default_Root()
@@ -273,14 +273,14 @@
 			Assert.Equal("Foe 2", p.Foes["dict2"].Nickname);
 		}

-        [Fact]
-        public void Can_Deserialize_Names_With_Underscores_With_Default_Root_Alternative_Culture()
-        {
-            using (new CultureChange(AlternativeCulture))
-            {
-                Can_Deserialize_Names_With_Underscores_With_Default_Root();
-            }
-        }
+		  [Fact]
+		  public void Can_Deserialize_Names_With_Underscores_With_Default_Root_Alternative_Culture()
+		  {
+				using (new CultureChange(AlternativeCulture))
+				{
+					 Can_Deserialize_Names_With_Underscores_With_Default_Root();
+				}
+		  }

 		[Fact]
 		public void Can_Deserialize_Names_With_Dashes_With_Default_Root()
@@ -311,14 +311,14 @@
 			Assert.Equal("Foe 2", p.Foes["dict2"].Nickname);
 		}

-        [Fact]
-        public void Can_Deserialize_Names_With_Dashes_With_Default_Root_Alternative_Culture()
-        {
-            using (new CultureChange(AlternativeCulture))
-            {
-                Can_Deserialize_Names_With_Dashes_With_Default_Root();
-            }
-        }
+		  [Fact]
+		  public void Can_Deserialize_Names_With_Dashes_With_Default_Root_Alternative_Culture()
+		  {
+				using (new CultureChange(AlternativeCulture))
+				{
+					 Can_Deserialize_Names_With_Dashes_With_Default_Root();
+				}
+		  }

 		[Fact]
 		public void Ignore_Protected_Property_That_Exists_In_Data()
@@ -343,22 +343,22 @@
 		}

 		[Fact]
-        public void Can_Deserialize_TimeSpan()
-        {
-            var doc = File.ReadAllText(Path.Combine("SampleData", "timespans.txt"));
-            var d = new JsonDeserializer();
-            var response = new RestResponse { Content = doc };
-            var payload = d.Deserialize<TimeSpanTestStructure>(response);
-
-            Assert.Equal(new TimeSpan(468006), payload.Tick);
-            Assert.Equal(new TimeSpan(0, 0, 0, 0, 125), payload.Millisecond);
-            Assert.Equal(new TimeSpan(0, 0, 8), payload.Second);
-            Assert.Equal(new TimeSpan(0, 55, 2), payload.Minute);
-            Assert.Equal(new TimeSpan(21, 30, 7), payload.Hour);
-            Assert.Null(payload.NullableWithoutValue);
-            Assert.NotNull(payload.NullableWithValue);
-            Assert.Equal(new TimeSpan(21, 30, 7), payload.NullableWithValue.Value);
-        }
+		  public void Can_Deserialize_TimeSpan()
+		  {
+				var doc = File.ReadAllText(Path.Combine("SampleData", "timespans.txt"));
+				var d = new JsonDeserializer();
+				var response = new RestResponse { Content = doc };
+				var payload = d.Deserialize<TimeSpanTestStructure>(response);
+
+				Assert.Equal(new TimeSpan(468006), payload.Tick);
+				Assert.Equal(new TimeSpan(0, 0, 0, 0, 125), payload.Millisecond);
+				Assert.Equal(new TimeSpan(0, 0, 8), payload.Second);
+				Assert.Equal(new TimeSpan(0, 55, 2), payload.Minute);
+				Assert.Equal(new TimeSpan(21, 30, 7), payload.Hour);
+				Assert.Null(payload.NullableWithoutValue);
+				Assert.NotNull(payload.NullableWithValue);
+				Assert.Equal(new TimeSpan(21, 30, 7), payload.NullableWithValue.Value);
+		  }

 		[Fact]
 		public void Can_Deserialize_Iso_Json_Dates()


Removed some redundancies

Removed some redundancies

--- src/SAHB.GraphQLClient/QueryGenerator/GraphQLQueryGeneratorFromFields.cs
+++ src/SAHB.GraphQLClient/QueryGenerator/GraphQLQueryGeneratorFromFields.cs
@@ -185,10 +185,10 @@
             var variables = arguments.Where(e => !ShouldInlineArgument(e)).ToArray();
             if (variables.Any())
             {
-                return JsonConvert.SerializeObject(new { query = query, variables = (variables.ToDictionary(e => e.Value.VariableName, e => e.Value.ArgumentValue)) });
-            }
-
-            return JsonConvert.SerializeObject(new { query = query });
+                return JsonConvert.SerializeObject(new { query, variables = variables.ToDictionary(e => e.Value.VariableName, e => e.Value.ArgumentValue) });
+            }
+
+            return JsonConvert.SerializeObject(new { query });
         }

         #region Logging


Fixed query generator

Fixed query generator

--- src/SAHB.GraphQLClient/QueryGenerator/GraphQLQueryGeneratorFromFields.cs
+++ src/SAHB.GraphQLClient/QueryGenerator/GraphQLQueryGeneratorFromFields.cs
@@ -96,7 +96,7 @@
             var readonlyArguments = new ReadOnlyDictionary<GraphQLFieldArguments, GraphQLQueryArgument>(arguments);

             // Get query
-            var query = GetGraphQLQuery(queryType, GetArguments(readonlyArguments), GetFields(fields, readonlyArguments));
+            var query = GetGraphQLQuery(queryType, GetArguments(readonlyArguments), GenerateQueryForFields(fields, readonlyArguments));
             var request = GetQueryRequest(query, readonlyArguments);

             // Logging
@@ -140,47 +140,51 @@
             return string.Join(" ", arguments.Where(argument => !ShouldInlineArgument(argument)).Select(e => $"${e.Key.VariableName}:{e.Key.ArgumentType}"));
         }

-        private string GetFields(IEnumerable<GraphQLField> fields, IReadOnlyDictionary<GraphQLFieldArguments, GraphQLQueryArgument> arguments)
+        private string GenerateQueryForFields(IEnumerable<GraphQLField> fields, IReadOnlyDictionary<GraphQLFieldArguments, GraphQLQueryArgument> arguments)
+        {
+            return "{" + string.Join(" ", fields.Select(field => GenerateQueryForField(field, arguments))) + "}";
+        }
+
+        private string GenerateQueryForField(GraphQLField field, IReadOnlyDictionary<GraphQLFieldArguments, GraphQLQueryArgument> arguments)
         {
             StringBuilder builder = new StringBuilder();
-            builder.Append("{");
-
-            builder.Append(string.Join(" ", fields.Select(field =>
-            {
-                var fieldBuilder = new StringBuilder();
-
-                // Append alias and field
-                if (field.Alias == null || field.Alias.Equals(field.Field, StringComparison.OrdinalIgnoreCase))
-                {
-                    fieldBuilder.Append(field.Field);
-                }
-                else
-                {
-                    fieldBuilder.Append(field.Alias + ":" + field.Field);
-                }
-
-                // Append arguments
-                // Format: (argumentName:$VariableName argumentName:$VariableName)
-                var fieldArguments = field.Arguments?.ToDictionary(argument => argument,
-                    argument => arguments.FirstOrDefault(e => e.Key == argument).Value).Where(e => e.Value != null);
-                if (fieldArguments?.Any() ?? false)
-                {
-                    fieldBuilder.Append("(");
-
-                    fieldBuilder.Append(string.Join(" ",
-                        fieldArguments.Select(
-                            argument => argument.Key.ArgumentName + ":" +
-                                        (ShouldInlineArgument(argument)
-                                            ? JsonConvert.SerializeObject(argument.Value.ArgumentValue)
-                                            : "$" + argument.Key.VariableName))));
-
-                    fieldBuilder.Append(")");
-                }
-
-                // Append subquery
+
+            // Append alias and field
+            if (field.Alias == null || field.Alias.Equals(field.Field, StringComparison.OrdinalIgnoreCase))
+            {
+                builder.Append(field.Field);
+            }
+            else
+            {
+                builder.Append(field.Alias + ":" + field.Field);
+            }
+
+            // Append arguments
+            // Format: (argumentName:$VariableName argumentName:$VariableName)
+            var fieldArguments = field.Arguments?.ToDictionary(argument => argument,
+                argument => arguments.FirstOrDefault(e => e.Key == argument).Value).Where(e => e.Value != null);
+            if (fieldArguments?.Any() ?? false)
+            {
+                builder.Append("(");
+
+                builder.Append(string.Join(" ",
+                    fieldArguments.Select(
+                        argument => argument.Key.ArgumentName + ":" +
+                                    (ShouldInlineArgument(argument)
+                                        ? JsonConvert.SerializeObject(argument.Value.ArgumentValue)
+                                        : "$" + argument.Key.VariableName))));
+
+                builder.Append(")");
+            }
+
+            // Append subquery
+            if ((field.SelectionSet?.Any() ?? false) || (field.TargetTypes?.Any() ?? false))
+            {
                 if (field.SelectionSet?.Any() ?? false)
                 {
-                    fieldBuilder.Append(GetFields(field.SelectionSet, arguments));
+                    builder.Append("{");
+                    // SelectionSet
+                    builder.Append(string.Join(" ", field.SelectionSet.Select(e => GenerateQueryForField(e, arguments))));
                 }

                 // Get other possible subTypes
@@ -188,16 +192,23 @@
                 {
                     foreach (var possibleType in field.TargetTypes)
                     {
+                        builder.Append($" ... on {possibleType.Key}");
+                        builder.Append("{");
+                        builder.Append(string.Join(" ", possibleType.Value.SelectionSet.Select(e => GenerateQueryForField(e, arguments))));
+                        builder.Append("}");
+
                         // Append subquery
-                        fieldBuilder.Append(
-                            $" ... on {possibleType.Key}{GetFields(possibleType.Value.SelectionSet, arguments)}");
+                        //builder.Append(
+                        //    $" ... on {possibleType.Key}{GenerateQueryForFields(possibleType.Value.SelectionSet, arguments)}");
                     }
                 }

-                return fieldBuilder.ToString();
-            })));
-
-            builder.Append("}");
+                if (field.SelectionSet?.Any() ?? false)
+                {
+                    builder.Append("}");
+                }
+            }
+
             return builder.ToString();
         }


No need to specify types in Update() call

--- src/Tests/Nest.Tests.Unit/ObjectInitializer/Update/UpdateRequestTests.cs
+++ src/Tests/Nest.Tests.Unit/ObjectInitializer/Update/UpdateRequestTests.cs
@@ -24,7 +24,7 @@
 					DocAsUpsert = true
 				};

-			var response = this._client.Update<ElasticsearchProject, dynamic>(request);
+			var response = this._client.Update(request);
 			this._status = response.ConnectionStatus;
 		}


lazily load cell provider in tests

lazily load cell provider in tests

--- src/UIA.Fluent.Units/AutomationProviders/Tables/TableCellProviderTest.cs
+++ src/UIA.Fluent.Units/AutomationProviders/Tables/TableCellProviderTest.cs
@@ -9,7 +9,6 @@
     [TestFixture]
     public class TableCellProviderTest
     {
-        private TableCellProvider _cellProvider;
         private Mock<AutomationProvider> _parent;
         private FakeTableInformation.FakeCellInformation _cellInformation;

@@ -17,29 +16,41 @@
         public void SetUp()
         {
             _parent = new Mock<AutomationProvider>();
-            _cellInformation = new FakeTableInformation.FakeCellInformation("Expected Name");
-            _cellProvider = new TableCellProvider(_parent.Object, _cellInformation);
+            _cellInformation = new FakeTableInformation.FakeCellInformation();
+        }
+
+        [TearDown]
+        public void TearDown()
+        {
+            _cellProvider = null;
         }

         [Test]
         public void ItIsOfTheTextControlType()
         {
-            _cellProvider.GetPropertyValue(AutomationElementIdentifiers.ControlTypeProperty.Id)
+            CellProvider.GetPropertyValue(AutomationElementIdentifiers.ControlTypeProperty.Id)
                 .Should().Equal(ControlType.Text.Id);
         }

         [Test]
         public void TheNameIsTheValue()
         {
-            _cellProvider.Name.Should().Equal("Expected Name");
+            _cellInformation.Value = "Expected Name";
+            CellProvider.Name.Should().Equal("Expected Name");
         }

         [Test]
         public void ItDoubleAsATableItem()
         {
-            _cellProvider.Should().Be.AssignableFrom<ITableItemProvider>();
-            _cellProvider.GetPatternProvider(TableItemPatternIdentifiers.Pattern.Id)
+            CellProvider.Should().Be.AssignableFrom<ITableItemProvider>();
+            CellProvider.GetPatternProvider(TableItemPatternIdentifiers.Pattern.Id)
                 .Should().Be.SameAs(_cellProvider);
+        }
+
+        private TableCellProvider _cellProvider;
+        private TableCellProvider CellProvider
+        {
+            get { return _cellProvider ?? (_cellProvider = new TableCellProvider(_parent.Object, _cellInformation)); }
         }
     }
 }


In StoreClient.GetAsync SDKExceptionResponseTestAsync ArgumentException changed to ArgumentOutOfRangeException for InRange validation.

-New parameter added to ArgumentOutOfRangeException for InRange
validation.

--- src/XOMNI.SDK.Public.Test/Fixtures/Clients/Company/StoreClientFixture.cs
+++ src/XOMNI.SDK.Public.Test/Fixtures/Clients/Company/StoreClientFixture.cs
@@ -151,7 +151,7 @@
         {
             await base.SDKExceptionResponseTestAsync(
                 (StoreClient p) => p.GetAsync(location, 1, 1, 0),
-                new ArgumentException("take must be greater than or equal to 1."),
+                new ArgumentOutOfRangeException("take", 0, string.Format("{0} must be in range ({1} - {2}).", "take", 1, 1000)),
                 piiUser: piiUser
             );
         }


Additional fix for #56

Additional fix for #56

--- src/dotnetplugins/Bari.Plugins.Nuget/cs/Packager/NugetProductPackager.cs
+++ src/dotnetplugins/Bari.Plugins.Nuget/cs/Packager/NugetProductPackager.cs
@@ -30,7 +30,7 @@
         public void Publish(Product product)
         {
             var parameters = (NugetPackagerParameters)product.Packager.Parameters;
-            nuget.PublishPackage(targetRoot, product.Name, suite.Version, parameters.ApiKey);
+            nuget.PublishPackage(targetRoot, parameters.Id, suite.Version, parameters.ApiKey);
         }
     }
 }


Replaced usage of OracleType with objects derived during static construction of OracleErrorLog

--- src/Elmah/OracleErrorLog.cs
+++ src/Elmah/OracleErrorLog.cs
@@ -56,6 +56,8 @@

         private static DbProviderFactory _dbProviderFactory;
         private static PropertyInfo _providerSpecificTypeProperty;
+        private static object _clobDbType;
+        private static object _refCursorDbType;

         private static DbParameter AddParameter(DbCommand command, string parameterName)
         {
@@ -99,6 +101,7 @@
                 return;

             var parameter = _dbProviderFactory.CreateParameter();
+            Debug.Assert(parameter != null);
             var parameterType = parameter.GetType();
             _providerSpecificTypeProperty = (from property in parameterType.GetProperties()
                                             let attributes = property.GetCustomAttributes(typeof (DbProviderSpecificTypePropertyAttribute), false)
@@ -106,6 +109,19 @@
                                             where ((DbProviderSpecificTypePropertyAttribute) attribute).IsProviderSpecificTypeProperty
                                             select property).FirstOrDefault();
         }
+
+        static object GetProviderSpecificDbType(params string[] dbTypes)
+        {
+            Debug.Assert(_providerSpecificTypeProperty != null);
+            var enumValues = Enum.GetValues(_providerSpecificTypeProperty.PropertyType);
+
+            foreach (var dbType in dbTypes)
+                foreach (var enumValue in enumValues)
+                    if (enumValue.ToString().Equals(dbType, StringComparison.OrdinalIgnoreCase))
+                        return enumValue;
+
+            return null;
+        }

         static OracleErrorLog()
         {
@@ -114,6 +130,8 @@
                 return;

             GetProviderSpecificType();
+            _clobDbType = GetProviderSpecificDbType("NClob");
+            _refCursorDbType = GetProviderSpecificDbType("Cursor", "RefCursor");
         }

         private DbConnection CreateOpenConnection()
@@ -273,7 +291,7 @@
                     command.CommandType = CommandType.Text;

                     var parameters = command.Parameters;
-                    AddProviderSpecificTypeParameter(command, "tempblob", OracleType.NClob).Direction = ParameterDirection.Output;
+                    AddProviderSpecificTypeParameter(command, "tempblob", _clobDbType).Direction = ParameterDirection.Output;
                     command.ExecuteNonQuery();

                     // now we can get a handle to the NClob
@@ -294,7 +312,7 @@
                     AddGenericTypeParameter(command, "v_Source", DbType.String).Value = error.Source;
                     AddGenericTypeParameter(command, "v_Message", DbType.String).Value = error.Message;
                     AddGenericTypeParameter(command, "v_User", DbType.String).Value = error.User;
-                    AddProviderSpecificTypeParameter(command, "v_AllXml", OracleType.NClob).Value = xmlLob;
+                    AddProviderSpecificTypeParameter(command, "v_AllXml", _clobDbType).Value = xmlLob;
                     AddGenericTypeParameter(command, "v_StatusCode", DbType.Int32).Value = error.StatusCode;
                     AddGenericTypeParameter(command, "v_TimeUtc", DbType.DateTime).Value = error.Time.ToUniversalTime();

@@ -330,7 +348,7 @@
                 AddGenericTypeParameter(command, "v_PageIndex", DbType.Int32).Value = pageIndex;
                 AddGenericTypeParameter(command, "v_PageSize", DbType.Int32).Value = pageSize;
                 AddGenericTypeParameter(command, "v_TotalCount", DbType.Int32).Direction = ParameterDirection.Output;
-                AddProviderSpecificTypeParameter(command, "v_Results", OracleType.Cursor).Direction = ParameterDirection.Output;
+                AddProviderSpecificTypeParameter(command, "v_Results", _refCursorDbType).Direction = ParameterDirection.Output;

                 using (var reader = command.ExecuteReader())
                 {
@@ -399,7 +417,7 @@
                 var parameters = command.Parameters;
                 AddGenericTypeParameter(command, "v_Application", DbType.String).Value = ApplicationName;
                 AddGenericTypeParameter(command, "v_ErrorId", DbType.String).Value = errorGuid.ToString("N");
-                AddProviderSpecificTypeParameter(command, "v_AllXml", OracleType.NClob).Direction = ParameterDirection.Output;
+                AddProviderSpecificTypeParameter(command, "v_AllXml", _clobDbType).Direction = ParameterDirection.Output;

                 command.ExecuteNonQuery();
                 var xmlLob = (Stream)command.Parameters["v_AllXml"].Value;


ProtocolInfo: implemented implicit string conversion

--- src/Mono.Upnp.Dcp/Mono.Upnp.Dcp.MediaServer1/Mono.Upnp.Dcp.MediaServer1/Mono.Upnp.Dcp.MediaServer1.ConnectionManager1/ProtocolInfo.cs
+++ src/Mono.Upnp.Dcp/Mono.Upnp.Dcp.MediaServer1/Mono.Upnp.Dcp.MediaServer1/Mono.Upnp.Dcp.MediaServer1.ConnectionManager1/ProtocolInfo.cs
@@ -30,7 +30,7 @@
     {
         public ProtocolInfo (string protocol)
         {
-            if (string.IsNullOrEmpty (protocol)) {
+            if (string.IsNullOrEmpty (protocol) || protocol == "*") {
                 throw new ArgumentException ("Protocol must be defined.", "protocol");
             }
             this.Protocol = protocol;
@@ -65,6 +65,33 @@

             return string.Format ("{0}:{1}:{2}:{3}", Protocol, network, content_format, additional_info);
         }
+
+        public static implicit operator string(ProtocolInfo protocolInfo)
+        {
+            return protocolInfo.ToString ();
+        }
+
+        public static implicit operator ProtocolInfo(string textValue)
+        {
+            var tokens = textValue.Split (':');
+            if (tokens.Length != 4) {
+                throw new ArgumentException ("textValue");
+            }
+
+            var result = new ProtocolInfo (tokens [0]);
+
+            if (!string.IsNullOrEmpty (tokens [1]) && tokens [1] != "*") {
+                result.Network = tokens [1];
+            }
+            if (!string.IsNullOrEmpty (tokens [2]) && tokens [2] != "*") {
+                result.ContentFormat = tokens [2];
+            }
+            if (!string.IsNullOrEmpty (tokens [3]) && tokens [3] != "*") {
+                result.AdditionalInfo = tokens [3];
+            }
+
+            return result;
+        }
     }

     public static class Protocols


fixes, remove default lambda expression

fixes, remove default lambda expression

--- src/EnumerableExtensions.cs
+++ src/EnumerableExtensions.cs
@@ -182,13 +182,13 @@
 			return table;
 		}

-		// http://stackoverflow.com/a/5729893/4473405
+		// modified from http://stackoverflow.com/a/5729893/4473405
 		// For completeness, this is two methods to ensure that the null check
 		// is done eagerly while the loop is done lazily
-		public static IEnumerable<T> ConsecutiveDistinct<T, TKey>(this IEnumerable<T> input, Func<T, TKey> keySelector = null) {
+		public static IEnumerable<T> ConsecutiveDistinct<T, TKey>(this IEnumerable<T> input, Func<T, TKey> keySelector) {
 			if (input == null)
 				throw new ArgumentNullException("input");
-			return ConsecutiveDistinctImpl(input, keySelector ?? v => v);
+			return ConsecutiveDistinctImpl(input, keySelector);
 		}

 		private static IEnumerable<T> ConsecutiveDistinctImpl<T, TKey>(this IEnumerable<T> input, Func<T, TKey> keySelector) {


cache endpoint subregexes

cache endpoint subregexes

--- DistributingHttpListener.cs
+++ DistributingHttpListener.cs
@@ -19,6 +19,8 @@
         private readonly Thread _acceptorThread;
         protected readonly HttpListener Listener;
         protected readonly List<object> Responders;
+        protected readonly Dictionary<EndpointAttribute, string> EndpointAttributeToRegexString;
+        protected readonly Dictionary<EndpointAttribute, HashSet<string>> EndpointAttributeToGroupNames;
         protected readonly Dictionary<string, Regex> RegexCache;

         /// <summary>
@@ -135,6 +137,8 @@
             Responders = new List<object>();
             _acceptorThread = new Thread(Proc) {Name = "DistributingHttpListener acceptor"};
             RegexCache = new Dictionary<string, Regex>();
+            EndpointAttributeToRegexString = new Dictionary<EndpointAttribute, string>();
+            EndpointAttributeToGroupNames = new Dictionary<EndpointAttribute, HashSet<string>>();

             Listener = new HttpListener();
             Listener.Prefixes.Add(uriPrefix);
@@ -274,18 +278,22 @@
                             continue;
                         }

-                        // construct a regular expression pattern to match the path of the endpoint
-                        var groupNames = new HashSet<string>();
-                        var newBits = endpoint.Path.Split('/').Select(p =>
+                        // see if we already have a pattern for this attribute
+                        if (!EndpointAttributeToRegexString.ContainsKey(endpoint))
+                        {
+                            // nope
+                            // construct a regular expression pattern to match the path of the endpoint
+                            var newGroupNames = new HashSet<string>();
+                            var newBits = endpoint.Path.Split('/').Select(p =>
                             {
                                 if (IsPlaceholder(p))
                                 {
                                     var placeholderText = p.Substring(1, p.Length - 2);
-                                    if (groupNames.Contains(placeholderText))
+                                    if (newGroupNames.Contains(placeholderText))
                                     {
                                         throw new ArgumentException(string.Format("multiple placeholders named '{0}' in path endpoint", placeholderText));
                                     }
-                                    groupNames.Add(placeholderText);
+                                    newGroupNames.Add(placeholderText);
                                     return string.Format("(?<{0}>[^/]+)", placeholderText);
                                 }
                                 else
@@ -293,11 +301,17 @@
                                     return Regex.Escape(p);
                                 }
                             });
-
+                            var regexString = string.Join("[/]", newBits);
+                            EndpointAttributeToRegexString[endpoint] = regexString;
+                            EndpointAttributeToGroupNames[endpoint] = newGroupNames;
+                        }
+
+                        var endpointPart = EndpointAttributeToRegexString[endpoint];
+                        var groupNames = EndpointAttributeToGroupNames[endpoint];
                         Match match = null;
                         foreach (var endpointPrefix in endpointPrefixes)
                         {
-                            var regexString = "^" + Regex.Escape(endpointPrefix) + string.Join("[/]", newBits) + "$";
+                            var regexString = "^" + Regex.Escape(endpointPrefix) + endpointPart + "$";
                             var regex = RegexCache.ContainsKey(regexString)
                                 ? RegexCache[regexString]
                                 : (RegexCache[regexString] = new Regex(regexString));


Use plural name for resource in remarks

Use plural name for resource in remarks

--- FakeServer/Controllers/DynamicController.cs
+++ FakeServer/Controllers/DynamicController.cs
@@ -50,7 +50,7 @@
         /// Get items
         /// </summary>
         /// <remarks>
-        /// Add filtering with query parameters. E.q. /api/user?age=22&name=Phil (not possible with Swagger)
+        /// Add filtering with query parameters. E.q. /api/users?age=22&name=Phil (not possible with Swagger)
         /// </remarks>
         /// <param name="collectionId">Collection id</param>
         /// <param name="skip">Items to skip</param>
@@ -107,7 +107,7 @@
         /// Get nested item
         /// </summary>
         /// <remarks>
-        /// Add full path separated with periods. E.q. /api/user/1/parents/0/work
+        /// Add full path separated with periods. E.q. /api/users/1/parents/0/work
         /// </remarks>
         /// <param name="collectionId">Collection id</param>
         /// <param name="id">Item id</param>


CNG: getrichieste filtra gli eventi con targa

--- src/backend/SO115App.Models/Servizi/CQRS/Queries/GestioneSoccorso/SintesiRichiesteAssistenza/SintesiRichiesteAssistenzaQueryHandler.cs
+++ src/backend/SO115App.Models/Servizi/CQRS/Queries/GestioneSoccorso/SintesiRichiesteAssistenza/SintesiRichiesteAssistenzaQueryHandler.cs
@@ -21,10 +21,12 @@
 using CQRS.Queries;
 using Serilog;
 using SO115App.API.Models.Classi.Organigramma;
+using SO115App.API.Models.Classi.Soccorso.Eventi.Partenze;
 using SO115App.API.Models.Servizi.CQRS.Queries.GestioneSoccorso.Shared.SintesiRichiestaAssistenza;
 using SO115App.API.Models.Servizi.Infrastruttura.GestioneSoccorso;
 using SO115App.API.Models.Servizi.Infrastruttura.GestioneSoccorso.RicercaRichiesteAssistenza;
 using SO115App.Models.Classi.Condivise;
+using SO115App.Models.Classi.Soccorso.Eventi;
 using SO115App.Models.Servizi.Infrastruttura.GestioneUtenti;
 using SO115App.Models.Servizi.Infrastruttura.SistemiEsterni.ServizioSede;
 using System.Collections.Generic;
@@ -118,6 +120,13 @@
             }

             var listaSintesi = _iGetListaSintesi.GetListaSintesiRichieste(query.Filtro);
+
+            //GILTRO EVENTI CON TARGA
+            foreach (var sintesi in listaSintesi)
+            {
+                sintesi.Eventi = sintesi.Eventi.Where(e => e is RichiestaSoccorsoAereo || e is AnnullamentoRichiestaSoccorsoAereo || e is ComposizionePartenze).ToList();
+            }
+
             var listaSintesiPaginata = new List<SintesiRichiesta>();
             if (query.Filtro.Page > 0 && query.Filtro.PageSize > 0)
             {


error

error

--- GE.WebUI/Views/SiteTests/_StepNormal.cshtml
+++ GE.WebUI/Views/SiteTests/_StepNormal.cshtml
@@ -75,9 +75,8 @@

     }
-    using (Ajax.BeginForm("ResultNormal", "SiteTests", new AjaxOptions { UpdateTargetId = "results" , OnSuccess="$(this).remove();" }))
+    using (Ajax.BeginForm("ResultNormal", "SiteTests", new AjaxOptions { UpdateTargetId = "results", OnSuccess = "$(this).remove();" }))
     {
-        @Html.AntiForgeryToken()

             <button type="submit" onclick="$(this).prepend($('.s'));" class="btn btn-danger"> Завершить</button>


Updated Script

Updated Script

--- GlobalGameJam/Assets/Scripts/NodeManager.cs
+++ GlobalGameJam/Assets/Scripts/NodeManager.cs
@@ -4,8 +4,20 @@

 public class NodeManager : MonoBehaviour
 {
-
-    public DialogueNode head;
+
+    public GameObject DialogueSingle;
+    public GameObject DialogueMultiple;
+
+    private GameObject canvas;
+
+    private DialogueNode head;
+
+    private GameObject currentSpawnedDialogue;
+
+    void Start()
+    {
+        canvas = GameObject.Find("Canvas");
+    }

     public NodeManager()
     {
@@ -81,5 +93,20 @@
                 currentNode = currentNode.nextNode[0];
             }
         }
+
+        NextOption(head);
+
+    }
+
+    void NextOption(DialogueNode nodeToSpawn)
+    {
+        if (nodeToSpawn.choiceCount == 1)
+        {
+
+        }
+        else
+        {
+
+        }
     }
 }


save works!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1

--- HardwhereApi/Controllers/AssetController.cs
+++ HardwhereApi/Controllers/AssetController.cs
@@ -6,6 +6,7 @@
 using System.Linq;
 using System.Net;
 using System.Net.Http;
+using System.Web;
 using System.Web.Http;
 using System.Web.Http.Cors;
 using System.Web.Http.Description;
@@ -110,6 +111,37 @@
             return Ok(new DynamicAssetDto(dictionary));
         }

+        private DynamicAssetDto getDynamicAssetDto(int id)
+        {
+              var asset = Mapper.Map<AssetDto>(db.Assets.Include(i => i.AssetType).Include(f => f.AssetProperties).FirstOrDefault(i => i.Id == id));
+            if (asset == null)
+            {
+                return null;
+            }
+
+            var sections = db.Sections.ToList();
+            var generalSectionIds = sections.Select(i => i.Id).ToList();
+
+            //get the type property DTOs if they weren't passed in.
+            var typePropertyDtos = db.TypeProperties.Select(Mapper.Map<TypePropertyDto>).Where(i => generalSectionIds.Contains(i.SectionId)).ToList();
+
+            foreach (var assetProp in asset.AssetProperties)
+            {
+                assetProp.TypeProperty = typePropertyDtos.FirstOrDefault(i => i.Id == assetProp.TypePropertyId);
+            }
+
+            var dictionary = new Dictionary<string, object>();
+            dictionary["Id"] = asset.Id;
+
+            foreach (var prop in asset.AssetProperties.Where(i => i.TypeProperty != null))
+            {
+                //dictionary[prop.TypeProperty.PropertyName] = prop.Value;
+                dictionary[prop.TypeProperty.PropertyName] = GetPropertyObject(prop.TypeProperty, sections.ToDictionary(i => i.Id, j => j), prop.Value);
+            }
+
+            return new DynamicAssetDto(dictionary);
+        }
+
         private SuperDynamic GetPropertyObject(
             TypePropertyDto typeProperty,
             Dictionary<int, Section> sections,
@@ -163,28 +195,54 @@
         [ResponseType(typeof(Asset))]
         public IHttpActionResult PostAsset()
         {
-            //generate stuff from the request form
-            var content = Request.Content;
-            string jsonContent = content.ReadAsStringAsync().Result;
-            //Id=6&Name=tacos&Description=tunafish
-            var dictionary = new Dictionary<string, object>();
-            jsonContent.Split('&').ToList().ForEach(i =>
-            {
-                var kvp = i.Split('=');
-                var key = Uri.UnescapeDataString(kvp.First());
-                var value = Uri.UnescapeDataString(kvp.Last());
-                dictionary[key] = value;
-            });
-
-            if (!ModelState.IsValid)
+            try
+            {
+                //generate stuff from the request form
+                var content = Request.Content;
+                string urlEncodedContent = content.ReadAsStringAsync().Result;
+                //Id=6&Name=tacos&Description=tunafish
+                var dictionary = new Dictionary<string, object>();
+                urlEncodedContent.Split('&').ToList().ForEach(i =>
+                {
+                    var kvp = i.Split('=');
+                    var key = HttpUtility.UrlDecode(kvp.First());
+                    var value = HttpUtility.UrlDecode(kvp.Last());
+                    dictionary[key] = value;
+                });
+
+                var assetTypeId = int.Parse(dictionary["AssetTypeId"].ToString());
+                var assetType = db.AssetTypes.Include(i => i.TypeProperties).FirstOrDefault(i => i.Id == assetTypeId);
+
+                var asset = new Asset {AssetTypeId = assetTypeId};
+                db.Assets.Add(asset);
+                db.SaveChanges();
+
+                foreach (var typeProperty in assetType.TypeProperties)
+                {
+                    if (dictionary.ContainsKey(typeProperty.PropertyName))
+                    {
+                        db.AssertProperties.Add(new AssetProperty
+                        {
+                            AssetId = asset.Id,
+                            TypePropertyId = typeProperty.Id,
+                            Value = dictionary[typeProperty.PropertyName].ToString()
+                        });
+                    }
+                }
+
+                db.SaveChanges();
+
+                if (!ModelState.IsValid)
+                {
+                    return BadRequest(ModelState);
+                }
+
+                return CreatedAtRoute("DefaultApi", new { id = asset.Id }, getDynamicAssetDto(asset.Id));
+            }
+            catch (Exception)
             {
                 return BadRequest(ModelState);
             }
-
-            //db.Assets.Add(asset);
-            //db.SaveChanges();
-
-            return CreatedAtRoute("DefaultApi", new { id = 2 }, new Asset());
         }

         // DELETE api/Asset/5


ISO: Handle 'unspecified' directory times more gracefully.

When reading, return DateTime.MinValue rather than an arbitrary date of Jan 1st 1980.  Similarly, Date.MinValue is persisted as all zeros (i.e. 'unspecified').

Reported by pdeliot [#5182]

--- src/Iso9660/IsoUtilities.cs
+++ src/Iso9660/IsoUtilities.cs
@@ -319,27 +319,34 @@
                     DateTimeKind.Utc);
                 return relTime - TimeSpan.FromMinutes(15 * (sbyte)data[offset + 6]);
             }
-            catch(ArgumentOutOfRangeException)
+            catch (ArgumentOutOfRangeException)
             {
                 // In case the ISO has a bad date encoded, we'll just fall back to using a fixed date
-                return new DateTime(1980, 1, 1);
+                return DateTime.MinValue;
             }
         }

         internal static void ToDirectoryTimeFromUTC(byte[] data, int offset, DateTime dateTime)
         {
-            if (dateTime.Year < 1900)
-            {
-                throw new IOException("Year is out of range");
-            }
-
-            data[offset] = (byte)(dateTime.Year - 1900);
-            data[offset + 1] = (byte)dateTime.Month;
-            data[offset + 2] = (byte)dateTime.Day;
-            data[offset + 3] = (byte)dateTime.Hour;
-            data[offset + 4] = (byte)dateTime.Minute;
-            data[offset + 5] = (byte)dateTime.Second;
-            data[offset + 6] = 0;
+            if (dateTime == DateTime.MinValue)
+            {
+                Array.Clear(data, offset, 7);
+            }
+            else
+            {
+                if (dateTime.Year < 1900)
+                {
+                    throw new IOException("Year is out of range");
+                }
+
+                data[offset] = (byte)(dateTime.Year - 1900);
+                data[offset + 1] = (byte)dateTime.Month;
+                data[offset + 2] = (byte)dateTime.Day;
+                data[offset + 3] = (byte)dateTime.Hour;
+                data[offset + 4] = (byte)dateTime.Minute;
+                data[offset + 5] = (byte)dateTime.Second;
+                data[offset + 6] = 0;
+            }
         }

         internal static DateTime ToDateTimeFromVolumeDescriptorTime(byte[] data, int offset)


Added TagHelpers

Added TagHelpers

--- IgniteTimetableDemo/Views/Home/Index.cshtml
+++ IgniteTimetableDemo/Views/Home/Index.cshtml
@@ -1,4 +1,5 @@
-<!DOCTYPE html>
+@addTagHelper "*, Microsoft.AspNet.Mvc.TagHelpers"
+<!DOCTYPE html>

 <html>
 <head>


StepWaveformクラスがMaxDataSizeを使用していなかった問題を修正

--- ux/Waveform/StepWaveform.cs
+++ ux/Waveform/StepWaveform.cs
@@ -132,7 +132,7 @@
                     if (this.queue != null)
                     {
                         this.queue.Enqueue((byte)data2.Clamp(255.0f, 0.0f));
-                        if (this.queue.Count <= 32767)
+                        if (this.queue.Count <= MaxDataSize)
                             this.SetStep(this.queue.ToArray());

                         this.queue = null;


fix out of range

fix out of range

--- KnuthMorrisPratt/KnuthMorrisPratt/Finder.cs
+++ KnuthMorrisPratt/KnuthMorrisPratt/Finder.cs
@@ -27,12 +27,13 @@
             int i = 0, j = 1;
             while (j < pattern.Length)
             {
-                i = _dfa[_abc[pattern[j++]], i];
-
                 Copy(from: i, to: j);

                 _dfa[_abc[pattern[j]], j] = j + 1;
+
+                i = _dfa[_abc[pattern[j++]], i];
             }
+

             Copy(from: i, to: j);
         }


Fixing goto def--wrong file used in locations.

--- LanguageServer.Exec/LanguageServerTarget.cs
+++ LanguageServer.Exec/LanguageServerTarget.cs
@@ -400,15 +400,17 @@
             var line = position.Line;
             var character = position.Character;
             var index = LanguageServer.Module.GetIndex(line, character, document);
+            var bug = LanguageServer.Module.GetLineColumn(index, document);
             IList<Location> found = LanguageServer.Module.FindDef(index, document);
             var locations = new List<object>();
             foreach (var f in found)
             {
                 var location = new Microsoft.VisualStudio.LanguageServer.Protocol.Location();
                 location.Uri = new Uri(f.Uri.FullPath);
+                var def_document = _workspace.FindDocument(f.Uri.FullPath);
                 location.Range = new Microsoft.VisualStudio.LanguageServer.Protocol.Range();
-                var lcs = LanguageServer.Module.GetLineColumn(f.Range.Start.Value, document);
-                var lce = LanguageServer.Module.GetLineColumn(f.Range.End.Value, document);
+                var lcs = LanguageServer.Module.GetLineColumn(f.Range.Start.Value, def_document);
+                var lce = LanguageServer.Module.GetLineColumn(f.Range.End.Value, def_document);
                 location.Range.Start = new Position(lcs.Item1, lcs.Item2);
                 location.Range.End = new Position(lce.Item1, lce.Item2);
                 locations.Add(location);
@@ -589,6 +591,65 @@
             return null;
         }

+        struct DocumentColorParams
+        {
+            /**
+             * The text document.
+             */
+            TextDocumentIdentifier textDocument;
+        }
+
+        struct ColorInformation
+        {
+            /**
+             * The range in the document where this color appears.
+             */
+            Microsoft.VisualStudio.LanguageServer.Protocol.Range range;
+
+            /**
+             * The actual color value for this color range.
+             */
+            Color color;
+        }
+
+        /**
+         * Represents a color in RGBA space.
+         */
+        struct Color
+        {
+
+            /**
+             * The red component of this color in the range [0-1].
+             */
+            float red;
+
+            /**
+             * The green component of this color in the range [0-1].
+             */
+            float green;
+
+            /**
+             * The blue component of this color in the range [0-1].
+             */
+            float blue;
+
+            /**
+             * The alpha component of this color in the range [0-1].
+             */
+            float alpha;
+        }
+
+        [JsonRpcMethod("textDocument/documentColor")]
+        public async System.Threading.Tasks.Task<object[]> DocumentColor(JToken arg)
+        {
+            var list = new List<object>();
+            list.Add(new ColorInformation()
+                {});
+            var result = list.ToArray();
+            return result;
+        }
+
+
         [JsonRpcMethod(Methods.TextDocumentFormattingName)]
         public async System.Threading.Tasks.Task<JToken> TextDocumentFormattingName(JToken arg)
         {


CreatePlugin can also get exist plugin.

CreatePlugin can also get exist plugin.

--- src/unity/Runtime/Core/PluginManager.cs
+++ src/unity/Runtime/Core/PluginManager.cs
@@ -28,6 +28,7 @@
             new PluginManagerImplIos();
 #endif

+        private static readonly Dictionary<Type, IPlugin> _plugins = new Dictionary<Type, IPlugin>();
         private static Logger _logger;
         private static IMessageBridge _bridge;

@@ -41,9 +42,16 @@

         public static T CreatePlugin<T>() where T : IPlugin {
             var type = typeof(T);
+            if (_plugins.TryGetValue(type, out var plugin)) {
+                return (T) plugin;
+            }
             var (name, constructor) = _pluginInfo[type];
             _impl.AddPlugin(name);
-            var instance = (T) constructor(_bridge, _logger, () => _impl.RemovePlugin(name));
+            var instance = (T) constructor(_bridge, _logger, () => {
+                _impl.RemovePlugin(name);
+                _plugins.Remove(type);
+            });
+            _plugins.Add(type, instance);
             return instance;
         }


dont add the same package twice to _receivedPackets

--- MQTTnet.Core/Client/MqttPacketDispatcher.cs
+++ MQTTnet.Core/Client/MqttPacketDispatcher.cs
@@ -10,7 +10,7 @@
     public class MqttPacketDispatcher
     {
         private readonly object _syncRoot = new object();
-        private readonly List<MqttBasePacket> _receivedPackets = new List<MqttBasePacket>();
+        private readonly HashSet<MqttBasePacket> _receivedPackets = new HashSet<MqttBasePacket>();
         private readonly List<MqttPacketAwaiter> _packetAwaiters = new List<MqttPacketAwaiter>();

         public async Task<MqttBasePacket> WaitForPacketAsync(Func<MqttBasePacket, bool> selector, TimeSpan timeout)


Fixed comments

Fixed comments

--- MimeKit/Cryptography/CryptographyContext.cs
+++ MimeKit/Cryptography/CryptographyContext.cs
@@ -99,19 +99,19 @@
 		}

 		/// <summary>
-		/// Releases all resources used by the <see cref="MimeKit.CryptographyContext"/> object.
+		/// Releases all resources used by the <see cref="MimeKit.Cryptography.CryptographyContext"/> object.
 		/// </summary>
-		/// <remarks>Call <see cref="Dispose"/> when you are finished using the <see cref="MimeKit.CryptographyContext"/>. The
-		/// <see cref="Dispose"/> method leaves the <see cref="MimeKit.CryptographyContext"/> in an unusable state. After
-		/// calling <see cref="Dispose"/>, you must release all references to the <see cref="MimeKit.CryptographyContext"/> so
-		/// the garbage collector can reclaim the memory that the <see cref="MimeKit.CryptographyContext"/> was occupying.</remarks>
+		/// <remarks>Call <see cref="Dispose"/> when you are finished using the <see cref="MimeKit.Cryptography.CryptographyContext"/>. The
+		/// <see cref="Dispose"/> method leaves the <see cref="MimeKit.Cryptography.CryptographyContext"/> in an unusable state. After
+		/// calling <see cref="Dispose"/>, you must release all references to the <see cref="MimeKit.Cryptography.CryptographyContext"/> so
+		/// the garbage collector can reclaim the memory that the <see cref="MimeKit.Cryptography.CryptographyContext"/> was occupying.</remarks>
 		public void Dispose ()
 		{
 			Dispose (true);
 		}

 		/// <summary>
-		/// Creates a <see cref="MimeKit.CryptographyContext"/> for the specified protocol.
+		/// Creates a new <see cref="MimeKit.Cryptography.CryptographyContext"/> for the specified protocol.
 		/// </summary>
 		/// <param name="protocol">The protocol.</param>
 		public static CryptographyContext Create (string protocol)


Removed unnecessary code in QuotedPrintableEncoder

--- MimeKit/Encodings/QuotedPrintableEncoder.cs
+++ MimeKit/Encodings/QuotedPrintableEncoder.cs
@@ -144,9 +144,6 @@

 		unsafe int Encode (byte* input, int length, byte* output)
 		{
-			if (length == 0)
-				return 0;
-
 			byte* inend = input + length;
 			byte* outptr = output;
 			byte* inptr = input;


Fix NRE.

Fix NRE.

--- Mono.Addins/Mono.Addins/ExtensionContext.cs
+++ Mono.Addins/Mono.Addins/ExtensionContext.cs
@@ -137,10 +137,12 @@
 		internal void DisposeChildContext (ExtensionContext ctx)
 		{
 			lock (conditionTypes) {
-				foreach (WeakReference wref in childContexts) {
-					if (wref.Target == ctx) {
-						childContexts.Remove (wref);
-						return;
+				if (childContexts != null) {
+					foreach (WeakReference wref in childContexts) {
+						if (wref.Target == ctx) {
+							childContexts.Remove (wref);
+							return;
+						}
 					}
 				}
 			}


spelling

spelling

--- Octokit.Tests.Conventions/TypeExtensions.cs
+++ Octokit.Tests.Conventions/TypeExtensions.cs
@@ -61,7 +61,7 @@

         public static bool IsClientInterface(this Type type)
         {
-            return type.IsInterface && type.Name.EndsWith(ClientSufix) && type.Namespace == typeof(IEventsClient).Namespace;
+            return type.IsInterface && type.Name.EndsWith(ClientSuffix) && type.Namespace == typeof(IEventsClient).Namespace;
         }

         public static Type GetObservableClientInterface(this Type type)


Add test for filtering on fields that don't exist

--- src/Polarize.Tests/Tests.cs
+++ src/Polarize.Tests/Tests.cs
@@ -65,17 +65,6 @@
             var json = JsonConvert.SerializeObject(filter);
             var expected = "{\"A\":{\"a\":1,\"b\":2,\"c\":3},\"B\":{\"i\":1,\"j\":2,\"k\":3},\"C\":{\"x\":1,\"y\":2,\"z\":3}}";

-            Assert.AreEqual(expected, json);
-        }
-
-        [Test]
-        public void TestFilterFields()
-        {
-            JsonFilter<Dictionary<string, Dictionary<string, int>>> filter =
-                JsonFilter.Create(testDictionary, "A", "B.i", "C.z");
-
-            var json = JsonConvert.SerializeObject(filter);
-            var expected = "{\"A\":{\"a\":1,\"b\":2,\"c\":3},\"B\":{\"i\":1},\"C\":{\"z\":3}}";
             Assert.AreEqual(expected, json);
         }

@@ -156,6 +145,28 @@

         }

+        [Test]
+        public void TestFilterFields()
+        {
+            JsonFilter<Dictionary<string, Dictionary<string, int>>> filter =
+                JsonFilter.Create(testDictionary, "A", "B.i", "C.z");
+
+            var json = JsonConvert.SerializeObject(filter);
+            var expected = "{\"A\":{\"a\":1,\"b\":2,\"c\":3},\"B\":{\"i\":1},\"C\":{\"z\":3}}";
+            Assert.AreEqual(expected, json);
+        }
+
+        [Test]
+        public void TestFilterFields2()
+        {
+            JsonFilter<Dictionary<string, Dictionary<string, int>>> filter =
+                JsonFilter.Create(testDictionary, "D");
+
+            var json = JsonConvert.SerializeObject(filter);
+            var expected = "{}";
+            Assert.AreEqual(expected, json);
+        }
+
         internal class CustomConverter : JsonConverter
         {
             public override bool CanConvert(Type objectType)
@@ -427,5 +438,64 @@
             var json = JsonConvert.SerializeObject(filter);
             Assert.AreEqual(expected, json);
         }
+
+        [Test]
+        public void TestFilterCustomSerializerConstraints()
+        {
+
+            var expected = "{"
+                + "\"objects\":[{"
+                    + "\"first\":\"The\","
+                    + "\"third\":\"Hulk\""
+                + "}]"
+            + "}";
+
+            var filterJSON = @"{
+                ""fields"" : [
+                    ""objects.first"",
+                    ""objects.third"",
+                ],
+                ""constraints"" : {
+                    ""objects"" : {
+                        ""limit"": 1,
+                        ""offset"": 1
+                    }
+                }
+            }";
+
+            var filterIN = JsonConvert
+                .DeserializeObject<JsonFilter>(filterJSON);
+
+            var filter = JsonFilter.Create(
+                (object)(new
+                {
+                    objects = new[]
+                    {
+                        new CustomConverterObject
+                        {
+                            first = "The",
+                            second = "Amazing",
+                            third = "Spiderman"
+                        },
+                        new CustomConverterObject
+                        {
+                            first = "The",
+                            second = "Incredible",
+                            third = "Hulk"
+                        },
+                        new CustomConverterObject
+                        {
+                            first = "The",
+                            second = "Immovable",
+                            third = "Object"
+                        },
+                    }
+                }),
+                filterIN);
+
+            var json = JsonConvert.SerializeObject(filter);
+            Assert.AreEqual(expected, json);
+
+        }
     }
 }


fix - allerta sedi

fix - allerta sedi

--- src/backend/SO115App.Models/Servizi/CQRS/Commands/GestioneSoccorso/GestioneIntervento/AllertaAltreSedi/AllertaAltreSediCommandHandler.cs
+++ src/backend/SO115App.Models/Servizi/CQRS/Commands/GestioneSoccorso/GestioneIntervento/AllertaAltreSedi/AllertaAltreSediCommandHandler.cs
@@ -49,7 +49,7 @@
             var richiesta = _getRichiestaById.GetByCodice(command.CodiceRichiesta);

             var lstSedi = command.CodSediAllertate.Select(s => _getSede.GetSede(s).Descrizione).ToList();
-            if(!lstSedi.All(s => s.ToUpper().Contains("COMANDO")))
+            if(!lstSedi.All(s => s.ToUpper().Contains("CENTRALE")))
                 throw new Exception("Puoi allertare solo i comandi");

             if (richiesta.CodSOAllertate != null && richiesta.CodSOAllertate.Count > 0)


remove wp codes

remove wp codes

--- src/Qiniu/Util/Signature.cs
+++ src/Qiniu/Util/Signature.cs
@@ -30,18 +30,8 @@

         private string encodedSign(byte[] data)
         {
-#if WINDOWS_UWP
-            var hma = MacAlgorithmProvider.OpenAlgorithm(MacAlgorithmNames.HmacSha1);
-            var skBuffer = CryptographicBuffer.ConvertStringToBinary(mac.SecretKey, BinaryStringEncoding.Utf8);
-            var hmacKey = hma.CreateKey(skBuffer);
-            var dataBuffer = CryptographicBuffer.CreateFromByteArray(data);
-            var signBuffer = CryptographicEngine.Sign(hmacKey, dataBuffer);
-            byte[] digest;
-            CryptographicBuffer.CopyToByteArray(signBuffer, out digest);
-#else
             HMACSHA1 hmac = new HMACSHA1(Encoding.UTF8.GetBytes(mac.SecretKey));
             byte[] digest = hmac.ComputeHash(data);
-#endif
             return Base64.UrlSafeBase64Encode(digest);
         }

@@ -114,18 +104,8 @@
                 {
                     buffer.Write(body, 0, body.Length);
                 }
-#if WINDOWS_UWP
-                var hma = MacAlgorithmProvider.OpenAlgorithm(MacAlgorithmNames.HmacSha1);
-                var skBuffer = CryptographicBuffer.ConvertStringToBinary(mac.SecretKey, BinaryStringEncoding.Utf8);
-                var hmacKey = hma.CreateKey(skBuffer);
-                var dataBuffer = CryptographicBuffer.CreateFromByteArray(buffer.ToArray());
-                var signBuffer = CryptographicEngine.Sign(hmacKey, dataBuffer);
-                byte[] digest;
-                CryptographicBuffer.CopyToByteArray(signBuffer, out digest);
-#else
                 HMACSHA1 hmac = new HMACSHA1(Encoding.UTF8.GetBytes(mac.SecretKey));
                 byte[] digest = hmac.ComputeHash(buffer.ToArray());
-#endif
                 string digestBase64 = Base64.UrlSafeBase64Encode(digest);
                 return string.Format("{0}:{1}", mac.AccessKey, digestBase64);
             }


classic tf-idf

classic tf-idf

--- src/Resin/Analysis/Tfidf.cs
+++ src/Resin/Analysis/Tfidf.cs
@@ -20,20 +20,21 @@
         }

         /// <summary>
-        /// Create scorer.
-        /// https://lucene.apache.org/core/4_0_0/core/org/apache/lucene/search/similarities/TFIDFSimilarity.html
+        /// Create scorer.
+        /// On tf-idf:
+        /// https://lucene.apache.org/core/6_4_1/core/org/apache/lucene/search/similarities/TFIDFSimilarity.html
+        /// https://en.wikipedia.org/wiki/Tf%E2%80%93idf
         /// </summary>
         /// <param name="docsInCorpus"></param>
         /// <param name="docsWithTerm"></param>
         public Tfidf(int docsInCorpus, int docsWithTerm)
         {
-            _idf = Math.Log10(docsInCorpus / (double)docsWithTerm + 1) + 1;
+            _idf = 1 + Math.Log10(docsInCorpus / (double)docsWithTerm + 1);
         }

         public void Score(DocumentScore doc)
         {
-            var tf = Math.Sqrt(doc.TermCount);
-            doc.Score = tf * _idf;
+            doc.Score = Math.Sqrt(doc.TermCount) * _idf;
         }

         public IScoringScheme CreateScorer(int docsInCorpus, int docsWithTerm)


Dispose the internal client when using a custom handler

--- src/RestSharp/RestClient.cs
+++ src/RestSharp/RestClient.cs
@@ -95,7 +95,7 @@
     /// </summary>
     /// <param name="handler">Message handler instance to use for HttpClient</param>
     /// <param name="disposeHandler">Dispose the handler when disposing RestClient, true by default</param>
-    public RestClient(HttpMessageHandler handler, bool disposeHandler = true) : this(new HttpClient(handler, disposeHandler)) { }
+    public RestClient(HttpMessageHandler handler, bool disposeHandler = true) : this(new HttpClient(handler, disposeHandler), null, true) { }

     void ConfigureHttpClient(HttpClient httpClient) {
         if (Options.Timeout > 0)


Add a sample parameter to the Time overload

Keeping it consistent with other overloads.

--- src/StatsdClient/Metrics.cs
+++ src/StatsdClient/Metrics.cs
@@ -127,14 +127,15 @@
         }

         /// <summary>
-        /// Time a given piece of code (with a lambda) and send the elapsed miliseconds.
+        /// Time a given piece of code and send the elapsed miliseconds.
         /// </summary>
         /// <param name="func">The code to time.</param>
         /// <param name="statName">Name of the metric.</param>
+        /// <param name="sampleRate">Sample rate to reduce the load on your metric server. Defaults to 1 (100%).</param>
         /// <returns>Return value of the function.</returns>
-        public static T Time<T>(Func<T> func, string statName)
+        public static T Time<T>(Func<T> func, string statName, double sampleRate = 1)
         {
-            using (StartTimer(statName))
+            using (StartTimer(statName, sampleRate))
             {
                 return func();
             }


removed interface

removed interface

--- OpenAsset.RestClient.Library/RESTOptions.cs
+++ OpenAsset.RestClient.Library/RESTOptions.cs
@@ -11,12 +11,7 @@

 namespace OpenAsset.RestClient.Library
 {
-    public interface IRestOptions
-    {
-        string GetUrlParameters();
-    }
-
-    public class RESTOptions<T> : IRestOptions where T : Noun.Base.BaseNoun
+    public class RESTOptions<T> where T : Noun.Base.BaseNoun
     {
         // URL parameters
         private int _limit;