Simplify ZoneInterval.ToString. This adds an extra space in the format, but we never specified the format anyway.

--- src/NodaTime/TimeZones/ZoneInterval.cs
+++ src/NodaTime/TimeZones/ZoneInterval.cs
@@ -274,18 +274,7 @@
         /// </returns>
         public override string ToString()
         {
-            var buffer = new StringBuilder();
-            buffer.Append(Name);
-            buffer.Append(":[");
-            buffer.Append(Start);
-            buffer.Append(", ");
-            buffer.Append(End);
-            buffer.Append(") ");
-            buffer.Append(WallOffset);
-            buffer.Append(" (");
-            buffer.Append(Savings);
-            buffer.Append(")");
-            return buffer.ToString();
+            return string.Format("{0}: [{1}, {2}) {3} ({4})", Name, Start, End, WallOffset, Savings);
         }
         #endregion // object Overrides
     }


reorganized delegates

reorganized delegates

--- src/ReflectionUtils/ReflectionUtils.cs
+++ src/ReflectionUtils/ReflectionUtils.cs
@@ -17,10 +17,6 @@
 // <website>https://github.com/facebook-csharp-sdk/ReflectionUtils</website>
 //-----------------------------------------------------------------------

-#if SILVERLIGHT || WINDOWS_PHONE || NETFX_CORE
-#undef REFLECTION_UTILS_REFLECTION_EMIT
-#endif
-
 #if NETFX_CORE
 #define REFLECTION_UTILS_TYPEINFO
 #endif
@@ -33,9 +29,6 @@
 #endif
 using System.Globalization;
 using System.Reflection;
-#if REFLECTION_UTILS_REFLECTIONEMIT
-using System.Reflection.Emit;
-#endif

 namespace ReflectionUtils
 {
@@ -48,6 +41,10 @@
     {
         private static readonly object[] EmptyObjects = new object[] { };

+        public delegate object GetDelegate(object source);
+        public delegate void SetDelegate(object source, object value);
+        public delegate object ConstructorDelegate(params object[] args);
+
         public static Attribute GetAttribute(MemberInfo info, Type type)
         {
 #if NETFX_CORE
@@ -98,11 +95,11 @@
             if (!type.GetTypeInfo().IsGenericType)
                 return false;
 #else
-                if (typeof(IDictionary).IsAssignableFrom(type))
-                    return true;
-
-                if (!type.IsGenericType)
-                    return false;
+            if (typeof(IDictionary).IsAssignableFrom(type))
+                return true;
+
+            if (!type.IsGenericType)
+                return false;
 #endif
             Type genericDefinition = type.GetGenericTypeDefinition();
             return genericDefinition == typeof(IDictionary<,>);
@@ -114,9 +111,9 @@
 #if NETFX_CORE
                 type.GetTypeInfo().IsGenericType
 #else
-                type.IsGenericType
-#endif
-                && type.GetGenericTypeDefinition() == typeof (Nullable<>);
+ type.IsGenericType
+#endif
+ && type.GetGenericTypeDefinition() == typeof(Nullable<>);
         }

         public static object ToNullableType(object obj, Type nullableType)
@@ -212,7 +209,7 @@
             return delegate(object[] args) { return constructorInfo.Invoke(args); };
         }

-        public static ConstructorDelegate GetConstructor(Type type, params  Type[] argsType)
+        public static ConstructorDelegate GetConstructor(Type type, params Type[] argsType)
         {
             ConstructorInfo constructorInfo = GetConstructorInfo(type, argsType);
             return constructorInfo == null ? null : GetContructor(constructorInfo);
@@ -247,20 +244,20 @@

 #endif

-        public static GetHandler GetGetMethod(PropertyInfo propertyInfo)
+        public static GetDelegate GetGetMethod(PropertyInfo propertyInfo)
         {
             MethodInfo methodInfo = GetGetterMethodInfo(propertyInfo);
             return delegate(object source) { return methodInfo.Invoke(source, EmptyObjects); };
         }

-        public static GetHandler GetGetMethod(FieldInfo fieldInfo)
+        public static GetDelegate GetGetMethod(FieldInfo fieldInfo)
         {
             return delegate(object source) { return fieldInfo.GetValue(source); };
         }

 #if !REFLECTION_UTILS_NO_LINQ_EXPRESSION

-        public static GetHandler GetGetMethodByExpression(PropertyInfo propertyInfo)
+        public static GetDelegate GetGetMethodByExpression(PropertyInfo propertyInfo)
         {
             MethodInfo getMethodInfo = GetGetterMethodInfo(propertyInfo);
             ParameterExpression instance = Expression.Parameter(typeof(object), "instance");
@@ -269,30 +266,30 @@
             return delegate(object source) { return compiled(source); };
         }

-        public static GetHandler GetGetMethodByExpression(FieldInfo fieldInfo)
+        public static GetDelegate GetGetMethodByExpression(FieldInfo fieldInfo)
         {
             ParameterExpression instance = Expression.Parameter(typeof(object), "instance");
             MemberExpression member = Expression.Field(Expression.Convert(instance, fieldInfo.DeclaringType), fieldInfo);
-            GetHandler compiled = Expression.Lambda<GetHandler>(Expression.Convert(member, typeof(object)), instance).Compile();
+            GetDelegate compiled = Expression.Lambda<GetDelegate>(Expression.Convert(member, typeof(object)), instance).Compile();
             return delegate(object source) { return compiled(source); };
         }

 #endif

-        public static SetHandler GetSetMethod(PropertyInfo propertyInfo)
+        public static SetDelegate GetSetMethod(PropertyInfo propertyInfo)
         {
             MethodInfo methodInfo = GetSetterMethodInfo(propertyInfo);
             return delegate(object source, object value) { methodInfo.Invoke(source, new object[] { value }); };
         }

-        public static SetHandler GetSetMethod(FieldInfo fieldInfo)
+        public static SetDelegate GetSetMethod(FieldInfo fieldInfo)
         {
             return delegate(object source, object value) { fieldInfo.SetValue(source, value); };
         }

 #if !REFLECTION_UTILS_NO_LINQ_EXPRESSION

-        public static SetHandler GetSetMethodByExpression(PropertyInfo propertyInfo)
+        public static SetDelegate GetSetMethodByExpression(PropertyInfo propertyInfo)
         {
             MethodInfo setMethodInfo = GetSetterMethodInfo(propertyInfo);
             ParameterExpression instance = Expression.Parameter(typeof(object), "instance");
@@ -303,7 +300,7 @@
             return delegate(object source, object val) { compiled(source, val); };
         }

-        public static SetHandler GetSetMethodByExpression(FieldInfo fieldInfo)
+        public static SetDelegate GetSetMethodByExpression(FieldInfo fieldInfo)
         {
             ParameterExpression instance = Expression.Parameter(typeof(object), "instance");
             ParameterExpression value = Expression.Parameter(typeof(object), "value");
@@ -333,25 +330,4 @@
 #endif

     }
-}
-
-#if REFLECTION_UTILS_INTERNAL
-    internal
-#else
-public
-#endif
- delegate object GetHandler(object source);
-
-#if REFLECTION_UTILS_INTERNAL
-    internal
-#else
-public
-#endif
- delegate void SetHandler(object source, object value);
-
-#if REFLECTION_UTILS_INTERNAL
-    internal
-#else
-public
-#endif
- delegate object ConstructorDelegate(params object[] args);+}


Add ScriptOnly support for TemplateRewriterContext

--- src/Scriban/TemplateRewriterContext.cs
+++ src/Scriban/TemplateRewriterContext.cs
@@ -28,15 +28,19 @@
         private bool _hasEndOfStatement;
         private FastStack<bool> _isWhileLoop;
         private ScriptRawStatement _previousRawStatement;
+        private bool _isScriptOnly;

         public TemplateRewriterContext(IScriptOutput output, TemplateRewriterOptions options = default(TemplateRewriterOptions))
         {
             _isWhileLoop = new FastStack<bool>(4);
             Options = options;
-            if (options.Mode != ScriptMode.Default)
-            {
-                throw new ArgumentException($"The rendering mode `{options.Mode}` is not supported. Only `ScriptMode.Default` is currently supported");
-            }
+            if (options.Mode != ScriptMode.Default && options.Mode != ScriptMode.ScriptOnly)
+            {
+                throw new ArgumentException($"The rendering mode `{options.Mode}` is not supported. Only `ScriptMode.Default` or `ScriptMode.ScriptOnly` are currently supported");
+            }
+
+            _isScriptOnly = options.Mode == ScriptMode.ScriptOnly;
+            _isInCode = _isScriptOnly;
             _output = output;
         }

@@ -255,7 +259,7 @@

             if (node is ScriptPage)
             {
-                if (_isInCode)
+                if (_isInCode && !_isScriptOnly)
                 {
                     WriteExitCode();
                 }


Add PreservedBufferPool<T> class with a single method that returns PreservedBuffer of requested size.

--- src/Spreads.Core/Buffers/BufferPool.cs
+++ src/Spreads.Core/Buffers/BufferPool.cs
@@ -5,6 +5,7 @@
 using System;
 using System.Buffers;
 using System.Runtime.CompilerServices;
+using Spreads.Serialization;
 using Spreads.Utils;

 namespace Spreads.Buffers
@@ -46,10 +47,11 @@
         }
     }

+    [Obsolete("Use an instance of PreservedBufferPool<byte> instead. Make it a static field of the class that uses such pool.")]
     internal static class BufferPool
     {
         // max pooled array size
-        private const int SharedBufferSize = 4096; // 8 * 32; // NB must ensure that the upcoming safe disposal machinery won't allocate and we never exceed the initial bitmask capacity if every segment is used once
+        private const int SharedBufferSize = 4096;

         [ThreadStatic]
         private static OwnedBuffer<byte> _sharedBuffer;
@@ -94,4 +96,87 @@
             return new PreservedBuffer<byte>(buffer2);
         }
     }
+
+    /// <summary>
+    /// A memory pool that allows to get preserved buffers backed by pooled arrays.
+    /// </summary>
+    /// <typeparam name="T"></typeparam>
+    public class PreservedBufferPool<T>
+    {
+        /// <summary>
+        /// Constructs a new PreservedBufferPool instance.
+        /// Keep in mind that every thread using this pool will have a thread-static
+        /// buffer of the size `sharedBufferSize * SizeOf(T)` for fast allocation
+        /// of preserved buffers of size smaller or equal to smallTreshhold.
+        /// </summary>
+        /// <param name="sharedBufferSize">Size of thread-static buffers in number of T elements</param>
+        /// <param name="smallTreshhold"></param>
+        public PreservedBufferPool(int sharedBufferSize = 0)
+        {
+            var typeSize = BinarySerializer.Size<T>();
+            if (typeSize <= 0)
+            {
+                throw new NotSupportedException("PreservedBufferPool only supports blittable types");
+            }
+            if (sharedBufferSize <= 0)
+            {
+                sharedBufferSize = 4096 / BinarySerializer.Size<T>();
+            }
+            else
+            {
+                var bytesLength = BitUtil.FindNextPositivePowerOfTwo(sharedBufferSize * typeSize);
+                sharedBufferSize = bytesLength / typeSize;
+            }
+            _sharedBufferSize = sharedBufferSize;
+            _smallTreshhold = 16;
+        }
+        // max pooled array size
+        private int _sharedBufferSize;
+
+        // https://github.com/dotnet/corefx/blob/master/src/System.Buffers/src/System/Buffers/DefaultArrayPool.cs#L35
+        // DefaultArrayPool has a minimum size of 16
+        private int _smallTreshhold;
+
+        [ThreadStatic]
+        private static OwnedBuffer<T> _sharedBuffer;
+
+        [ThreadStatic]
+        private static int _sharedBufferOffset;
+
+        /// <summary>
+        /// Return a contiguous segment of memory backed by a pooled array
+        /// </summary>
+        /// <param name="length"></param>
+        /// <returns></returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public PreservedBuffer<T> PreserveMemory(int length)
+        {
+
+            if (length <= _smallTreshhold)
+            {
+                if (_sharedBuffer == null)
+                {
+                    _sharedBuffer = BufferPool<T>.RentMemory(this._sharedBufferSize, false);
+                    _sharedBufferOffset = 0;
+                }
+                var bufferSize = _sharedBuffer.Length;
+                var newOffset = _sharedBufferOffset + length;
+                if (newOffset > bufferSize)
+                {
+                    // replace shared buffer, the old one will be disposed
+                    // when all ReservedMemory views on it are disposed
+                    _sharedBuffer = BufferPool<T>.RentMemory(_sharedBufferSize, false);
+                    _sharedBufferOffset = 0;
+                }
+                var buffer = _sharedBuffer.Buffer.Slice(_sharedBufferOffset, length);
+
+                _sharedBufferOffset = BitUtil.Align(newOffset, IntPtr.Size);
+                return new PreservedBuffer<T>(buffer);
+            }
+            var ownedMemory = BufferPool<T>.RentMemory(length, false);
+            var buffer2 = ownedMemory.Buffer.Slice(0, length);
+            return new PreservedBuffer<T>(buffer2);
+        }
+    }
+
 }


check param

check param

--- src/Web/Engine/Services/FileDecoder.cs
+++ src/Web/Engine/Services/FileDecoder.cs
@@ -96,7 +96,7 @@

         public FileDecoder(IOptions<DRSConfig> config)
         {
-            _config = config.Value;
+            _config = config.Value ?? throw new ArgumentNullException(nameof(config));
         }

         public IFileInfo Decode(string filename, byte[] buffer)


Fixed potential type casting error in MemoryCache

--- core/Piranha/Cache/MemoryCache.cs
+++ core/Piranha/Cache/MemoryCache.cs
@@ -55,13 +55,15 @@
         /// <returns>The cached model, null it wasn't found</returns>
         public T Get<T>(string key)
         {
-            var obj = _cache.Get<T>(key);
-
-            if (!_clone)
+            if (_cache.TryGetValue<T>(key, out var obj))
             {
-                return obj;
+                if (!_clone)
+                {
+                    return obj;
+                }
+                return Utils.DeepClone<T>(obj);
             }
-            return Utils.DeepClone<T>(obj);
+            return default(T);
         }

         /// <summary>


Swapping diagonal border types for XSSF

Swapping diagonal border types for XSSF

Was inconsistent with HSSF (XSSF forward eq. HSSF backwards and vice versa). Not it is the same.

--- ooxml/XSSF/UserModel/XSSFCellStyle.cs
+++ ooxml/XSSF/UserModel/XSSFCellStyle.cs
@@ -1344,9 +1344,9 @@
                 if (ct.diagonalDown == true && ct.diagonalUp == true)
                     return BorderDiagonal.Both;
                 else if (ct.diagonalDown == true)
+                    return BorderDiagonal.Backward;
+                else if (ct.diagonalUp == true)
                     return BorderDiagonal.Forward;
-                else if (ct.diagonalUp == true)
-                    return BorderDiagonal.Backward;
                 else
                     return BorderDiagonal.None;
             }
@@ -1362,17 +1362,17 @@
                 }
                 else if (value == BorderDiagonal.Forward)
                 {
+                    ct.diagonalDown = false;
+                    ct.diagonalDownSpecified = false;
+                    ct.diagonalUp = true;
+                    ct.diagonalUpSpecified = true;
+                }
+                else if (value == BorderDiagonal.Backward)
+                {
                     ct.diagonalDown = true;
                     ct.diagonalDownSpecified = true;
                     ct.diagonalUp = false;
                     ct.diagonalUpSpecified = false;
-                }
-                else if (value == BorderDiagonal.Backward)
-                {
-                    ct.diagonalDown = false;
-                    ct.diagonalDownSpecified = false;
-                    ct.diagonalUp = true;
-                    ct.diagonalUpSpecified = true;
                 }
                 else
                 {


Windows: Disk cache optimizations when reading byte array

--- source/FFImageLoading.Windows/Cache/DiskCache.cs
+++ source/FFImageLoading.Windows/Cache/DiskCache.cs
@@ -17,6 +17,7 @@
 using System.IO;

 using Windows.Storage;
+using System.Runtime.InteropServices.WindowsRuntime;

 #if SILVERLIGHT
 using FFImageLoading.Concurrency;
@@ -313,14 +314,8 @@
                 if (file == null)
                     return null;

-				using (var fs = await file.OpenStreamForReadAsync().ConfigureAwait(false))
-                {
-                    using (var ms = new MemoryStream())
-                    {
-                        await fs.CopyToAsync(ms, BufferSize, token).ConfigureAwait(false);
-                        return ms.ToArray();
-                    }
-                }
+                var buffer = await FileIO.ReadBufferAsync(file);
+                return buffer.ToArray();
             }
             catch
             {


Search icon in SearchBox no longer shows after selecting it once #2450

--- source/Playnite.DesktopApp/Controls/SearchBox.cs
+++ source/Playnite.DesktopApp/Controls/SearchBox.cs
@@ -99,6 +99,7 @@
                 TextInputText.TextChanged += TextFilter_TextChanged;
                 TextInputText.KeyUp += TextFilter_KeyUp;
                 TextInputText.GotFocus += TextInputText_GotFocus;
+                TextInputText.LostFocus += TextInputText_GotFocus;

                 BindingTools.SetBinding(
                     TextInputText,


Changed prioritization for IGDB requests

--- source/PlayniteServices/Controllers/IGDB/IGDB.cs
+++ source/PlayniteServices/Controllers/IGDB/IGDB.cs
@@ -75,7 +75,7 @@
             }
         }

-        public static async Task<string> SendStringRequest(string url, string key)
+        private static HttpRequestMessage CreateRequest(string url, string apiKey)
         {
             var request = new HttpRequestMessage()
             {
@@ -83,10 +83,26 @@
                 Method = HttpMethod.Get
             };

-            request.Headers.Add("user-key", string.IsNullOrEmpty(key) ? ApiKey : key);
+            request.Headers.Add("user-key", apiKey);
             request.Headers.Add("Accept", "application/json");
-            var response = await HttpClient.SendAsync(request);
-            return await response.Content.ReadAsStringAsync();
+            return request;
+        }
+
+        public static async Task<string> SendStringRequest(string url, string key)
+        {
+            if (!string.IsNullOrEmpty(key))
+            {
+                var request = CreateRequest(url, key);
+                var response = await HttpClient.SendAsync(request);
+                if (response.StatusCode == System.Net.HttpStatusCode.OK)
+                {
+                    return await response.Content.ReadAsStringAsync();
+                }
+            }
+
+            var sharedRequest = CreateRequest(url, ApiKey);
+            var sharedResponse = await HttpClient.SendAsync(sharedRequest);
+            return await sharedResponse.Content.ReadAsStringAsync();
         }
     }
 }


add fallback for mono msbuild when managed by homebrew

--- src/Cake.Common/Tools/MSBuild/MSBuildResolver.cs
+++ src/Cake.Common/Tools/MSBuild/MSBuildResolver.cs
@@ -19,6 +19,13 @@
                 if (fileSystem.Exist(macMSBuildPath))
                 {
                     return macMSBuildPath;
+                }
+
+                var brewMSBuildPath = new FilePath("/usr/local/bin/msbuild");
+
+                if (fileSystem.Exist(brewMSBuildPath))
+                {
+                    return brewMSBuildPath;
                 }

                 throw new CakeException("Could not resolve MSBuild.");


added throttling to RetryOnException

added throttling to RetryOnException

--- src/CavemanTools/Model/Persistence/ModelTools.cs
+++ src/CavemanTools/Model/Persistence/ModelTools.cs
@@ -32,9 +32,10 @@
         /// <param name="excHandler">returns true to continue retrying</param>
         /// <param name="triesCount"></param>
         /// <param name="wait"></param>
+        /// <param name="throttle">If true after 1/4 of the tries it will increase the wait period before tries</param>
         /// <returns></returns>
         [DebuggerStepThrough]
-        public static async Task RetryOnException<T>(Func<Task> update,Func<T,bool> excHandler=null, int triesCount = 10, int wait = 100) where T : Exception
+        public static async Task RetryOnException<T>(Func<Task> update,Func<T,bool> excHandler=null, int triesCount = 10, int wait = 150,bool throttle=true) where T : Exception
         {

             if (excHandler == null)
@@ -44,7 +45,14 @@

             for (var i = 0; i < triesCount; i++)
             {
-                if (i>0) await Task.Delay(wait).ConfigureAwait(false);
+                if (i > 0)
+                {
+                    if (throttle && i > triesCount/4)
+                    {
+                        wait *= (int) 1.5;
+                    }
+                    await Task.Delay(wait).ConfigureAwait(false);
+                }
                 try
                 {
                     await update().ConfigureAwait(false);
@@ -69,9 +77,10 @@
         /// <param name="excHandler">returns true to continue retrying</param>
         /// <param name="triesCount"></param>
         /// <param name="wait"></param>
+        /// <param name="throttle">If true after 1/4 of the tries it will increase the wait period before tries</param>
         /// <returns></returns>
         [DebuggerStepThrough]
-        public static void RetryOnException<T>(Action update, Func<T,bool> excHandler=null,int triesCount = 10, int wait = 100) where T : Exception
+        public static void RetryOnException<T>(Action update, Func<T,bool> excHandler=null,int triesCount = 10, int wait = 100, bool throttle = true) where T : Exception
         {

             if (excHandler == null)
@@ -81,7 +90,14 @@

             for (var i = 0; i < triesCount; i++)
             {
-                if (i > 0) Task.Delay(wait).Wait();
+                if (i > 0)
+                {
+                    if (throttle && i > triesCount / 4)
+                    {
+                        wait *= (int)1.5;
+                    }
+                    Task.Delay(wait).Wait();
+                }
                 try
                 {
                     update();


Catch multiplayer client-related unobserved exceptions better

Silencing an exception from a task continuation requires accessing
`task.Exception` in any way, which was not done previously if
`logOnError` was false.

To resolve without having to worry whether the compiler will optimise
away a useless access or now, just always log, but switch the logging
level. The unimportant errors will be logged as debug and therefore
essentially silenced on release builds (but could still be potentially
useful in debugging).

--- osu.Game/Extensions/TaskExtensions.cs
+++ osu.Game/Extensions/TaskExtensions.cs
@@ -1,7 +1,11 @@
 // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
 // See the LICENCE file in the repository root for full licence text.

+#nullable enable
+
+using System;
 using System.Threading.Tasks;
+using osu.Framework.Extensions.ExceptionExtensions;
 using osu.Framework.Logging;

 namespace osu.Game.Extensions
@@ -13,13 +17,19 @@
         /// Avoids unobserved exceptions from being fired.
         /// </summary>
         /// <param name="task">The task.</param>
-        /// <param name="logOnError">Whether errors should be logged as important, or silently ignored.</param>
-        public static void CatchUnobservedExceptions(this Task task, bool logOnError = false)
+        /// <param name="logAsError">
+        /// Whether errors should be logged as errors visible to users, or as debug messages.
+        /// Logging as debug will essentially silence the errors on non-release builds.
+        /// </param>
+        public static void CatchUnobservedExceptions(this Task task, bool logAsError = false)
         {
             task.ContinueWith(t =>
             {
-                if (logOnError)
-                    Logger.Log($"Error running task: {t.Exception?.Message ?? "unknown"}", LoggingTarget.Runtime, LogLevel.Important);
+                Exception? exception = t.Exception?.AsSingular();
+                if (logAsError)
+                    Logger.Error(exception, $"Error running task: {exception?.Message ?? "(unknown)"}", LoggingTarget.Runtime, true);
+                else
+                    Logger.Log($"Error running task: {exception}", LoggingTarget.Runtime, LogLevel.Debug);
             }, TaskContinuationOptions.NotOnRanToCompletion);
         }
     }


Allow legacy text to display fixed width correctly

--- osu.Game/Skinning/LegacySpriteText.cs
+++ osu.Game/Skinning/LegacySpriteText.cs
@@ -5,6 +5,7 @@
 using osu.Framework.Graphics.Sprites;
 using osu.Framework.Text;
 using osu.Game.Graphics.Sprites;
+using osuTK;

 namespace osu.Game.Skinning
 {
@@ -17,11 +18,12 @@
             Shadow = false;
             UseFullGlyphHeight = false;

-            Font = new FontUsage(font, 1);
+            Font = new FontUsage(font, 1, fixedWidth: true);
             glyphStore = new LegacyGlyphStore(skin);
         }

-        protected override TextBuilder CreateTextBuilder(ITexturedGlyphLookupStore store) => base.CreateTextBuilder(glyphStore);
+        protected override TextBuilder CreateTextBuilder(ITexturedGlyphLookupStore store) =>
+            new TextBuilder(glyphStore, Font, MaxWidth, UseFullGlyphHeight, Vector2.Zero, Spacing, CharactersBacking, neverFixedWidthCharacters: new[] { ',', '.', '%', 'x' }, fixedWidthCalculationCharacter: '5');

         private class LegacyGlyphStore : ITexturedGlyphLookupStore
         {


Bug fixing

Bug fixing

--- cscs/Utils.Parsing.cs
+++ cscs/Utils.Parsing.cs
@@ -373,9 +373,6 @@
             }

             ParsingScript tempScript = script.GetTempScript(script.String, script.Pointer);
-            /*ParsingScript tempScript = new ParsingScript(script.String, script.Pointer);
-            tempScript.ParentScript = script;
-            tempScript.InTryBlock = script.InTryBlock;*/

             if (script.Current != start && script.TryPrev() != start &&
                (script.Current == ' ' || script.TryPrev() == ' '))
@@ -594,7 +591,13 @@
                 return false;
             }

-            return EndsWithFunction(sb.ToString(), Constants.FUNCT_WITH_SPACE_ONCE);
+            string str = sb.ToString();
+            char last = str.Length < 1 ? Constants.EMPTY : str.Last();
+            if (char.IsLetterOrDigit(last) && char.IsLetterOrDigit(next))
+            {
+                return true;
+            }
+            return EndsWithFunction(str, Constants.FUNCT_WITH_SPACE_ONCE);
         }

         public static List<string> GetCompiledArgs(string source)
@@ -680,6 +683,10 @@

             int lastScriptLength = 0;

+            bool precompiledPart = false;
+            int  precompiledCounter = 0;
+            StringBuilder lastToken = new StringBuilder();
+
             // Remove these two lines for quality time debugging in case the user has special
             // spaces with code 160. See https://en.wikipedia.org/wiki/Non-breaking_space
             char extraSpace = Convert.ToChar(160);
@@ -690,6 +697,13 @@
                 char ch = source[i];
                 char next = i + 1 < source.Length ? source[i + 1] : Constants.EMPTY;
                 char last = sb.Length > 0  ? sb[sb.Length - 1] : Constants.EMPTY;
+
+                if (string.IsNullOrWhiteSpace(ch.ToString()))
+                {
+                    precompiledPart = precompiledPart ||
+                        lastToken.ToString().Equals(Constants.COMPILED_FUNCTION, StringComparison.OrdinalIgnoreCase);
+                    lastToken.Clear();
+                }

                 if (ch == '\n')
                 {
@@ -703,7 +717,8 @@
                     {
                         inComments = simpleComments = false;
                     }
-                    spaceOK = false;
+                    spaceOK = precompiledPart;
+                    lastToken.Clear();
                     continue;
                 }

@@ -811,6 +826,7 @@
                                 lineNumberCurly = lineNumber;
                             }
                             levelCurly++;
+                            precompiledCounter = precompiledPart ? precompiledCounter +  1 : 0;
                         }
                         break;
                     case Constants.END_GROUP:
@@ -822,6 +838,11 @@
                             {
                                 ThrowErrorMsg(curlyErrorMsg, source, levelCurly, lineNumberCurly, lineNumber, filename);
                             }
+                            if (precompiledPart && --precompiledCounter <= 0)
+                            {
+                                precompiledPart = false;
+                                precompiledCounter = 0;
+                            }
                         }
                         break;
                     case Constants.START_ARRAY:
@@ -856,6 +877,7 @@
                 if (!inComments)
                 {
                     sb.Append(ch);
+                    lastToken.Append(ch);
                 }
                 prevprev = prev;
                 prev = ch;


Minor update.

Minor update.

--- Cfg/CfgNet.cs
+++ Cfg/CfgNet.cs
@@ -136,8 +136,8 @@
             return _storage.ToString().Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
         }

-        public void AddCustomProblem(string problem) {
-            _storage.Append(problem);
+        public void AddCustomProblem(string problem, params object[] args) {
+            _storage.AppendFormat(problem, args);
             _storage.AppendLine();
         }

@@ -283,8 +283,8 @@
             }
         }

-        protected void AddProblem(string problem) {
-            _problems.AddCustomProblem(problem);
+        protected void AddProblem(string problem, params object[] args) {
+            _problems.AddCustomProblem(problem, args);
         }

         public void Load(string xml, Dictionary<string, string> parameters = null) {


Use type-safe collection for tests

Use type-safe collection for tests

--HG--
extra : convert_revision : charlie%40nunit.com-20091031214104-75l2n3k7dza95gk9

--- src/framework/NUnit/Core/TestSuite.cs
+++ src/framework/NUnit/Core/TestSuite.cs
@@ -41,7 +41,7 @@
 		/// <summary>
 		/// Our collection of child tests
 		/// </summary>
-		private ArrayList tests = new ArrayList();
+		private TestCollection tests = new TestCollection();

         /// <summary>
         /// The fixture setup methods for this suite
@@ -126,8 +126,9 @@
             }
 		}

-		public void Sort(IComparer comparer)
-		{
+#if false
+        public void Sort(IComparer comparer)
+        {
 			this.tests.Sort(comparer);

 			foreach( Test test in Tests )
@@ -137,6 +138,7 @@
 					suite.Sort(comparer);
 			}
 		}
+#endif

 		public void Add( Test test )
 		{
@@ -497,5 +499,11 @@
             }
         }
         #endregion
+
+#if CLR_2_0
+        private class TestCollection : System.Collections.Generic.List<Test> { }
+#else
+        private class TestCollection : ArrayList { }
+#endif
     }
 }


Solved a method-name "collision". [release]

--- src/Dapplo.Windows/Desktop/InteropWindowQuery.cs
+++ src/Dapplo.Windows/Desktop/InteropWindowQuery.cs
@@ -61,15 +61,13 @@
         }

         /// <summary>
-        ///     Find windows belonging to the same process (thread) as the supplied window.
-        /// </summary>
-        /// <param name="windowToLinkTo">InteropWindow</param>
+        ///     Find windows belonging to the same process (thread) as the process ID.
+        /// </summary>
+        /// <param name="processId">int with process Id</param>
         /// <returns>IEnumerable with InteropWindow</returns>
-        public static IEnumerable<IInteropWindow> GetLinkedWindows(this IInteropWindow windowToLinkTo)
-        {
-            var processIdSelectedWindow = windowToLinkTo.GetProcessId();
-
-            using (var process = Process.GetProcessById(processIdSelectedWindow))
+        public static IEnumerable<IInteropWindow> GetWindowsForProcess(int processId)
+        {
+            using (var process = Process.GetProcessById(processId))
             {
                 foreach (ProcessThread thread in process.Threads)
                 {


docs: Fix MaxWaitBetweenGuildAvailablesBeforeReady docs string

Signed-off-by: Still Hsu <34c6fceca75e456f25e7e99531e2425c6c1de443@stillu.cc>

--- src/Discord.Net.WebSocket/DiscordSocketConfig.cs
+++ src/Discord.Net.WebSocket/DiscordSocketConfig.cs
@@ -102,7 +102,7 @@
         /// </remarks>
         public bool AlwaysDownloadUsers { get; set; } = false;
         /// <summary>
-        ///     Gets or sets the timeout for event handlers, in milliseconds, after which a warning will be logged.
+        ///     Gets or sets the timeout for event handlers, in milliseconds, after which a warning will be logged.
         ///     <c>null</c>disables this check.
         /// </summary>
         public int? HandlerTimeout { get; set; } = 3000;
@@ -138,16 +138,17 @@
         /// </remarks>
         public int IdentifyMaxConcurrency { get; set; } = 1;

+        /// <summary>
         ///     Gets or sets the maximum wait time in milliseconds between GUILD_AVAILABLE events before firing READY.
-        ///
         ///     If zero, READY will fire as soon as it is received and all guilds will be unavailable.
         /// </summary>
         /// <remarks>
-        ///     <para>This property is measured in milliseconds, negative values will throw an exception.</para>
+        ///     <para>This property is measured in milliseconds; negative values will throw an exception.</para>
         ///     <para>If a guild is not received before READY, it will be unavailable.</para>
         /// </remarks>
         /// <returns>
-        ///     The maximum wait time in milliseconds between GUILD_AVAILABLE events before firing READY.
+        ///     A <see cref="int"/> representing the maximum wait time in milliseconds between GUILD_AVAILABLE events
+        ///     before firing READY.
         /// </returns>
         /// <exception cref="System.ArgumentException">Value must be at least 0.</exception>
         public int MaxWaitBetweenGuildAvailablesBeforeReady {
@@ -162,7 +163,7 @@
             }
         }
         private int _maxWaitForGuildAvailable = 10000;
-
+
         /// <summary>
         ///    Gets or sets gateway intents to limit what events are sent from Discord. Allows for more granular control than the <see cref="GuildSubscriptions"/> property.
         /// </summary>


refactor: Removed a unncessary guard-clause.

--- src/Experiment.AutoFixture/TestFixtureFactory.cs
+++ src/Experiment.AutoFixture/TestFixtureFactory.cs
@@ -20,9 +20,6 @@
         /// </returns>
         public ITestFixture Create(ITestMethodContext context)
         {
-            if (context == null)
-                throw new ArgumentNullException("context");
-
             return new TestFixture(new Fixture().Customize(this.GetCustomization(context)));
         }


add sqlproj projects

add sqlproj projects

--- src/FullBuild/Helpers/DirectoryInfoExtensions.cs
+++ src/FullBuild/Helpers/DirectoryInfoExtensions.cs
@@ -50,7 +50,8 @@
             var csproj = dir.GetFiles("*.csproj", SearchOption.AllDirectories);
             var vbproj = dir.GetFiles("*.vbproj", SearchOption.AllDirectories);
             var fsproj = dir.GetFiles("*.fsproj", SearchOption.AllDirectories);
-            return csproj.Concat(vbproj).Concat(fsproj);
+            var sqlproj = dir.GetFiles("*.sqlproj", SearchOption.AllDirectories);
+            return csproj.Concat(vbproj).Concat(fsproj).Concat(sqlproj);
         }

         public static IEnumerable<FileInfo> EnumerateSolutionFiles(this DirectoryInfo dir)


Generated compilable wrappers for functions taking char*.

Signed-off-by: Dimitar Dobrev <ca751a5c976abad79158718440750fc638d19ebc@yahoo.com>

--- src/Generator/Generators/CSharp/CSharpMarshal.cs
+++ src/Generator/Generators/CSharp/CSharpMarshal.cs
@@ -344,9 +344,9 @@
             var pointee = pointer.Pointee;

             Type type = pointee.Desugar();
-            if ((type.IsPrimitiveType(PrimitiveType.Char) ||
-                type.IsPrimitiveType(PrimitiveType.WideChar)) &&
-                pointer.QualifiedPointee.Qualifiers.IsConst)
+            if ((type.IsPrimitiveType(PrimitiveType.Char) ||
+                type.IsPrimitiveType(PrimitiveType.WideChar)) &&
+                pointer.QualifiedPointee.Qualifiers.IsConst)
             {
                 Context.Return.Write("Marshal.StringToHGlobalAnsi({0})",
                     Helpers.SafeIdentifier(Context.Parameter.Name));


added load methods

added load methods

--- src/GenericSQLEntityHandler/GenericSQLHandler.cs
+++ src/GenericSQLEntityHandler/GenericSQLHandler.cs
@@ -1,5 +1,6 @@
 using System;
 using System.Collections.Generic;
+using System.Data;
 using System.Data.SqlClient;
 using System.Diagnostics;
 using System.Linq;
@@ -61,6 +62,226 @@

         #region Load Methods

+        #region Connection Depending
+        /// <summary>
+        /// Load single entity from database
+        /// </summary>
+        /// <typeparam name="T">entity type</typeparam>
+        /// <param name="connection">connection to database</param>
+        /// <param name="keyValue"></param>
+        /// <param name="identity">coloumn in database the represents the id</param>
+        /// <param name="tableName">name of sqltable - if null, will use entitytype name as tablename</param>
+        /// <returns>found entity of the specified type or null if nothing is found or caused an exception</returns>
+        public static T Load<T>(SqlConnection connection, object keyValue, string identity = "Id",
+            string tableName = null) where T : class
+        {
+            try
+            {
+                ValidateConnection(connection);
+
+                Dictionary<string, object> filter = new Dictionary<string, object>();
+                filter[identity += "=@0"] = keyValue;
+                GenericSQLEntityHandler entityHandler = new GenericSQLEntityHandler(connection);
+                return entityHandler.LoadSingleEntity<T>(tableName ?? typeof(T).Name, filter);
+            }
+            catch (Exception ex)
+            {
+                Debug.WriteLine(ex.ToString());
+                return null;
+
+            }
+        }
+
+
+        /// <summary>
+        /// Load single entity from database.
+        /// </summary>
+        /// <typeparam name="T">entity type</typeparam>
+        /// <param name="connection">current active sql connection</param>
+        /// <param name="filter">filter made in [string key, object value]</param>
+        /// <param name="identity">coloumn in database the represents the id</param>
+        /// <param name="tableName">name of sqltable - if null, will use entitytype name as tablename</param>
+        /// <returns>found entity of the specified type or null if nothing is found or caused an exception</returns>
+        public static T Load<T>(SqlConnection connection, Dictionary<string, object> filter = null, string identity = "Id",
+            string tableName = null) where T : class
+        {
+            try
+            {
+                ValidateConnection(connection);
+
+                GenericSQLEntityHandler entityHandler = new GenericSQLEntityHandler(connection);
+                return entityHandler.LoadSingleEntity<T>(tableName ?? typeof(T).Name, filter);
+
+            }
+            catch (Exception ex)
+            {
+                Debug.WriteLine(ex.ToString());
+                return null;
+
+            }
+        }
+
+        /// <summary>
+        /// Get list of entities from database
+        /// </summary>
+        /// <typeparam name="T">Entity type</typeparam>
+        /// <param name="connection">Current active sql connection</param>
+        /// <param name="tableName">name of talbe, if not provided - classname will be used</param>
+        /// <returns>List of found items of type T</returns>
+        public static List<T> LoadList<T>(SqlConnection connection, string tableName = null) where T : class
+        {
+            try
+            {
+                ValidateConnection(connection);
+
+                GenericSQLEntityHandler entityHandler = new GenericSQLEntityHandler(connection);
+
+                return entityHandler.LoadEntities<T>(tableName ?? typeof(T).Name, new Dictionary<string, object>());
+            }
+            catch (SqlException ex)
+            {
+                Debug.Write(ex.ToString());
+                return null;
+            }
+        }
+        /// <summary>
+        /// Get list of enities from database, based on filter
+        /// </summary>
+        /// <typeparam name="T">Entity type</typeparam>
+        /// <param name="connection">Current active SQL connection</param>
+        /// <param name="filter">filter made in [string key, object value]</param>
+        /// <param name="tableName">name of sqltable - if null, will use entitytype name as tablename</param>
+        /// <returns>List of T</returns>
+        public static List<T> LoadList<T>(SqlConnection connection, Dictionary<string, object> filter, string tableName = null)
+            where T : class
+        {
+            try
+            {
+                ValidateConnection(connection);
+                    connection.Open();
+
+                GenericSQLEntityHandler entityHandler = new GenericSQLEntityHandler(connection);
+                return entityHandler.LoadEntities<T>(tableName ?? typeof(T).Name, filter ?? new Dictionary<string, object>());
+            }
+            catch (SqlException ex)
+            {
+                Debug.Write(ex.ToString());
+                return null;
+            }
+        }
+
+        /// <summary>
+        /// Loads list of T from query.
+        /// </summary>
+        /// <typeparam name="T">Entity type</typeparam>
+        /// <param name="connection">Current active SQL connection</param>
+        /// <param name="query">Select query</param>
+        /// <param name="keyValue"></param>
+        /// <param name="identity">Identity column</param>
+        /// <param name="orderBy">Column to order result by</param>
+        /// <returns>List of T</returns>
+        public static List<T> LoadListByQuery<T>(SqlConnection connection, string query, object keyValue,
+            string identity = "Id", string orderBy = "") where T : class
+        {
+            try
+            {
+                ValidateConnection(connection);
+
+                Dictionary<string, object> filter = new Dictionary<string, object>();
+                if (keyValue != null)
+                    filter[identity += "=@0"] = keyValue;
+                GenericSQLEntityHandler entityHandler = new GenericSQLEntityHandler(connection);
+                return entityHandler.LoadEntitiesByQuery<T>(query, filter, orderBy);
+
+            }
+            catch (SqlException ex)
+            {
+                Debug.Write(ex.ToString());
+                return null;
+            }
+
+        }
+        /// <summary>
+        /// Get list of entities from database by query
+        /// </summary>
+        /// <typeparam name="T">enitity type</typeparam>
+        /// <param name="connection">Current active SQL connection</param>
+        /// <param name="query">sql query</param>
+        /// <param name="filter"></param>
+        /// <param name="orderBy">how to order / sort the results</param>
+        /// <returns>list of specified entities if found</returns>
+        public static List<T> LoadListByQuery<T>(SqlConnection connection, string query, Dictionary<string, object> filter,
+            string orderBy = "") where T : class
+        {
+            try
+            {
+                ValidateConnection(connection);
+                GenericSQLEntityHandler entityHandler = new GenericSQLEntityHandler(connection);
+                return entityHandler.LoadEntitiesByQuery<T>(query, filter, orderBy);
+
+            }
+            catch (SqlException ex)
+            {
+                Debug.Write(ex.ToString());
+                return null;
+            }
+        }
+
+        /// <summary>
+        /// Get a single antity from database, by custom query
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="connection">Current active SQL connection</param>
+        /// <param name="query">sql query</param>
+        /// <param name="keyValue"></param>
+        /// <param name="identity">coloumn in database the represents the id</param>
+        /// <returns>single entity found be query</returns>
+        public static T LoadByQuery<T>(SqlConnection connection, string query, object keyValue, string identity = "Id")
+            where T : class
+        {
+            try
+            {
+                ValidateConnection(connection);
+                var result = LoadListByQuery<T>(connection, query, keyValue, identity)?.FirstOrDefault();
+
+                return result;
+            }
+            catch (SqlException ex)
+            {
+                Debug.Write(ex.ToString());
+                return null;
+            }
+        }
+
+        /// <summary>
+        /// Get a single antity from database, by custom query
+        /// </summary>
+        /// <typeparam name="T">entity type</typeparam>
+        /// <param name="connection">Current active SQL connection</param>
+        /// <param name="query">sql query</param>
+        /// <param name="filter"></param>
+        /// <returns>single entity found be query</returns>
+        public static T LoadByQuery<T>(SqlConnection connection, string query, Dictionary<string, object> filter)
+            where T : class
+        {
+            try
+            {
+                ValidateConnection(connection);
+
+                var result = LoadListByQuery<T>(connection, query, filter);
+                return result?.FirstOrDefault();
+            }
+            catch (SqlException ex)
+            {
+                Debug.Write(ex.ToString());
+                return null;
+            }
+        }
+
+        #endregion Connection Depending
+
+
+
         /// <summary>
         /// Load single entity from database.
         /// </summary>
@@ -288,5 +509,17 @@
             }
         }
         #endregion Load
+
+        #region Private methods
+        private static void ValidateConnection(SqlConnection connection)
+        {
+            if (connection == null)
+                throw new Exception("COnnection cannot be null - please privide valid connection");
+
+            if (connection.State == ConnectionState.Closed)
+                connection.Open();
+        }
+
+        #endregion Private methods
     }
 }


- adding passing array generating tests

- adding passing array generating tests

--- src/JsonFx.Json.Tests/Json/JsonGeneratorTests.cs
+++ src/JsonFx.Json.Tests/Json/JsonGeneratorTests.cs
@@ -43,7 +43,7 @@
 		#region Array Tests

 		[Fact]
-		public void GetTokens_EmptyArray_ReturnsEmptyArrayTokens()
+		public void GetTokens_ArrayEmpty_ReturnsEmptyArrayTokens()
 		{
 			var input = new object[0];

@@ -60,13 +60,134 @@
 		}

 		[Fact]
-		public void GetTokens_EmptyList_ReturnsEmptyArrayTokens()
+		public void GetTokens_ListEmpty_ReturnsEmptyArrayTokens()
 		{
 			var input = new List<object>(0);

 			var expected = new[]
 				{
 					JsonGrammar.TokenArrayBegin,
+					JsonGrammar.TokenArrayEnd
+				};
+
+			var generator = new JsonWriter.JsonGenerator(new DataWriterSettings());
+			var actual = generator.GetTokens(input).ToArray();
+
+			Assert.Equal(expected, actual);
+		}
+
+		[Fact]
+		public void GetTokens_ArraySingleItem_ReturnsSingleItemArrayTokens()
+		{
+			var input = new object[]
+				{
+					null
+				};
+
+			var expected = new[]
+				{
+					JsonGrammar.TokenArrayBegin,
+					JsonGrammar.TokenNull,
+					JsonGrammar.TokenArrayEnd
+				};
+
+			var generator = new JsonWriter.JsonGenerator(new DataWriterSettings());
+			var actual = generator.GetTokens(input).ToArray();
+
+			Assert.Equal(expected, actual);
+		}
+
+		[Fact]
+		public void GetTokens_ArrayMultiItem_ReturnsArrayTokens()
+		{
+			var input = new object[]
+				{
+					false,
+					true,
+					null,
+					'a',
+					'b',
+					'c',
+					1,
+					2,
+					3
+				};
+
+			var expected = new[]
+				{
+					JsonGrammar.TokenArrayBegin,
+					JsonGrammar.TokenFalse,
+					JsonGrammar.TokenValueDelim,
+					JsonGrammar.TokenTrue,
+					JsonGrammar.TokenValueDelim,
+					JsonGrammar.TokenNull,
+					JsonGrammar.TokenValueDelim,
+					JsonGrammar.TokenString('a'),
+					JsonGrammar.TokenValueDelim,
+					JsonGrammar.TokenString('b'),
+					JsonGrammar.TokenValueDelim,
+					JsonGrammar.TokenString('c'),
+					JsonGrammar.TokenValueDelim,
+					JsonGrammar.TokenNumber(1),
+					JsonGrammar.TokenValueDelim,
+					JsonGrammar.TokenNumber(2),
+					JsonGrammar.TokenValueDelim,
+					JsonGrammar.TokenNumber(3),
+					JsonGrammar.TokenArrayEnd
+				};
+
+			var generator = new JsonWriter.JsonGenerator(new DataWriterSettings());
+			var actual = generator.GetTokens(input).ToArray();
+
+			Assert.Equal(expected, actual);
+		}
+
+		[Fact]
+		public void GetTokens_ArrayNested_ReturnsNestedArrayTokens()
+		{
+			var input = new object[]
+				{
+					false,
+					true,
+					null,
+					new []
+					{
+						'a',
+						'b',
+						'c'
+					},
+					new []
+					{
+						1,
+						2,
+						3
+					}
+				};
+
+			var expected = new[]
+				{
+					JsonGrammar.TokenArrayBegin,
+					JsonGrammar.TokenFalse,
+					JsonGrammar.TokenValueDelim,
+					JsonGrammar.TokenTrue,
+					JsonGrammar.TokenValueDelim,
+					JsonGrammar.TokenNull,
+					JsonGrammar.TokenValueDelim,
+					JsonGrammar.TokenArrayBegin,
+					JsonGrammar.TokenString('a'),
+					JsonGrammar.TokenValueDelim,
+					JsonGrammar.TokenString('b'),
+					JsonGrammar.TokenValueDelim,
+					JsonGrammar.TokenString('c'),
+					JsonGrammar.TokenArrayEnd,
+					JsonGrammar.TokenValueDelim,
+					JsonGrammar.TokenArrayBegin,
+					JsonGrammar.TokenNumber(1),
+					JsonGrammar.TokenValueDelim,
+					JsonGrammar.TokenNumber(2),
+					JsonGrammar.TokenValueDelim,
+					JsonGrammar.TokenNumber(3),
+					JsonGrammar.TokenArrayEnd,
 					JsonGrammar.TokenArrayEnd
 				};


CommandLineTests: test default values

CommandLineTests: test default values

--- src/Kirkin.Tests/CommandLine/CommandLineTests.cs
+++ src/Kirkin.Tests/CommandLine/CommandLineTests.cs
@@ -102,5 +102,36 @@
             Assert.AreEqual("extra", (string)command.Arguments["subscription"]);
             Assert.True((bool)command.Arguments["validate"]);
         }
+
+        [Test]
+        public void DefaultValues()
+        {
+            CommandLineParser parser = new CommandLineParser();
+
+            parser.DefineCommand("sync", sync =>
+            {
+                sync.DefineParameter("subscription");
+                sync.DefineSwitch("validate", shortName: "v");
+                sync.DefineOption("log", shortName: "l");
+            });
+
+            {
+                ICommand command = parser.Parse("sync --validate --log zzz.txt".Split(' '));
+
+                Assert.Null(command.Arguments["subscription"]);
+            }
+
+            {
+                ICommand command = parser.Parse("sync main --log zzz.txt".Split(' '));
+
+                Assert.False((bool)command.Arguments["validate"]);
+            }
+
+            {
+                ICommand command = parser.Parse("sync main --validate".Split(' '));
+
+                Assert.Null(command.Arguments["log"]);
+            }
+        }
     }
 }


Added overload on AddModule methods to allow passing a factory function

--- src/Lime.Protocol/Client/ClientChannelBuilder.cs
+++ src/Lime.Protocol/Client/ClientChannelBuilder.cs
@@ -13,9 +13,9 @@
     public sealed class ClientChannelBuilder : IClientChannelBuilder
     {
         private readonly Func<ITransport> _transportFactory;
-        private readonly List<IChannelModule<Message>> _messageChannelModules;
-        private readonly List<IChannelModule<Notification>> _notificationChannelModules;
-        private readonly List<IChannelModule<Command>> _commandChannelModules;
+        private readonly List<Func<IClientChannel, IChannelModule<Message>>> _messageChannelModules;
+        private readonly List<Func<IClientChannel, IChannelModule<Notification>>> _notificationChannelModules;
+        private readonly List<Func<IClientChannel, IChannelModule<Command>>> _commandChannelModules;
         private readonly List<Func<IClientChannel, CancellationToken, Task>> _builtHandlers;

         /// <summary>
@@ -31,9 +31,9 @@
             if (serverUri == null) throw new ArgumentNullException(nameof(serverUri));
             _transportFactory = transportFactory;
             ServerUri = serverUri;
-            _messageChannelModules = new List<IChannelModule<Message>>();
-            _notificationChannelModules = new List<IChannelModule<Notification>>();
-            _commandChannelModules = new List<IChannelModule<Command>>();
+            _messageChannelModules = new List<Func<IClientChannel, IChannelModule<Message>>>();
+            _notificationChannelModules = new List<Func<IClientChannel, IChannelModule<Notification>>>();
+            _commandChannelModules = new List<Func<IClientChannel, IChannelModule<Command>>>();
             _builtHandlers = new List<Func<IClientChannel, CancellationToken, Task>>();
             SendTimeout = TimeSpan.FromSeconds(60);
             BuffersLimit = 5;
@@ -123,7 +123,17 @@
         public ClientChannelBuilder AddMessageModule(IChannelModule<Message> module)
         {
             if (module == null) throw new ArgumentNullException(nameof(module));
-            _messageChannelModules.Add(module);
+            return AddMessageModule(c => module);
+        }
+
+        /// <summary>
+        /// Adds a message module to the channel.
+        /// </summary>
+        /// <param name="moduleFactory">The module factory.</param>
+        /// <returns></returns>
+        public ClientChannelBuilder AddMessageModule(Func<IClientChannel, IChannelModule<Message>> moduleFactory)
+        {
+            _messageChannelModules.Add(moduleFactory);
             return this;
         }

@@ -135,7 +145,18 @@
         public ClientChannelBuilder AddNotificationModule(IChannelModule<Notification> module)
         {
             if (module == null) throw new ArgumentNullException(nameof(module));
-            _notificationChannelModules.Add(module);
+            return AddNotificationModule(c => module);
+        }
+
+        /// <summary>
+        /// Adds a notification module to the channel.
+        /// </summary>
+        /// <param name="moduleFactory">The module factory.</param>
+        /// <returns></returns>
+        public ClientChannelBuilder AddNotificationModule(Func<IClientChannel, IChannelModule<Notification>> moduleFactory)
+        {
+            if (moduleFactory == null) throw new ArgumentNullException(nameof(moduleFactory));
+            _notificationChannelModules.Add(moduleFactory);
             return this;
         }

@@ -146,8 +167,19 @@
         /// <returns></returns>
         public ClientChannelBuilder AddCommandModule(IChannelModule<Command> module)
         {
-            if (module == null) throw new ArgumentNullException(nameof(module));
-            _commandChannelModules.Add(module);
+            if (module == null) throw new ArgumentNullException(nameof(module));
+            return AddCommandModule(c => module);
+        }
+
+        /// <summary>
+        /// Adds a command module to the channel.
+        /// </summary>
+        /// <param name="moduleFactory">The module factory.</param>
+        /// <returns></returns>
+        public ClientChannelBuilder AddCommandModule(Func<IClientChannel, IChannelModule<Command>> moduleFactory)
+        {
+            if (moduleFactory == null) throw new ArgumentNullException(nameof(moduleFactory));
+            _commandChannelModules.Add(moduleFactory);
             return this;
         }

@@ -184,19 +216,19 @@

             try
             {
-                foreach (var module in _messageChannelModules.ToList())
-                {
-                    clientChannel.MessageModules.Add(module);
-                }
-
-                foreach (var module in _notificationChannelModules.ToList())
-                {
-                    clientChannel.NotificationModules.Add(module);
-                }
-
-                foreach (var module in _commandChannelModules.ToList())
-                {
-                    clientChannel.CommandModules.Add(module);
+                foreach (var moduleFactory in _messageChannelModules.ToList())
+                {
+                    clientChannel.MessageModules.Add(moduleFactory(clientChannel));
+                }
+
+                foreach (var moduleFactory in _notificationChannelModules.ToList())
+                {
+                    clientChannel.NotificationModules.Add(moduleFactory(clientChannel));
+                }
+
+                foreach (var moduleFactory in _commandChannelModules.ToList())
+                {
+                    clientChannel.CommandModules.Add(moduleFactory(clientChannel));
                 }

                 foreach (var handler in _builtHandlers.ToList())


Added missing tests Core.Store.TestMultiMMap (that were swallowed by an invalid Assume statement)

--- src/Lucene.Net.Tests/core/Store/TestMultiMMap.cs
+++ src/Lucene.Net.Tests/core/Store/TestMultiMMap.cs
@@ -47,8 +47,15 @@
         public override void SetUp()
         {
             base.SetUp();
-            // LUCENENET TODO: what?!?!?!?!?!
-            AssumeTrue("test requires a jre that supports unmapping", MMapDirectory.UNMAP_SUPPORTED);
+            // LUCENENET NOTE:
+            // Java seems to have issues releasing memory mapped resources when calling close()
+            // http://stackoverflow.com/a/2973059/181087
+
+            // However, according to MSDN, the Dispose() method of the MemoryMappedFile class will "release all resources".
+            // https://msdn.microsoft.com/en-us/library/system.io.memorymappedfiles.memorymappedfile(v=vs.110).aspx
+            // Therefore, I am assuming removing the below line is the correct choice for .NET.
+
+            //AssumeTrue("test requires a jre that supports unmapping", MMapDirectory.UNMAP_SUPPORTED);
         }

         [Test]


Fixed bug: Method was no extensions

Fixed bug: Method was no extensions

--- src/Math.Analysis/Extensions/IFieldExtensions.cs
+++ src/Math.Analysis/Extensions/IFieldExtensions.cs
@@ -27,7 +27,7 @@
         /// <typeparam name="T">The 1st type parameter.</typeparam>
         /// <exception cref="DivideByZeroException">Thrown when the argument for calculating
         /// the function is the zero element of the field.</exception>
-        public static Func<T,T> MultiplicationInverseFunction<T>(IField<T> field)
+        public static Func<T,T> MultiplicationInverseFunction<T>(this IField<T> field)
         {
             return (x) =>
             {


Fix passing view model to commands in category edit.

--- src/Money.UI/ViewModels/CategoryEditViewModel.cs
+++ src/Money.UI/ViewModels/CategoryEditViewModel.cs
@@ -88,17 +88,24 @@
             Ensure.NotNull(domainFacade, "domainFacade");
             Ensure.NotNull(key, "key");
             Key = key;
+            CreateCommands(domainFacade);
+        }

+        public CategoryEditViewModel(IDomainFacade domainFacade, IKey key, string name, string description, Color color)
+        {
+            Ensure.NotNull(domainFacade, "domainFacade");
+            Ensure.Condition.NotEmptyKey(key);
+            Key = key;
+            Name = name;
+            Description = description;
+            Color = color;
+            CreateCommands(domainFacade);
+        }
+
+        private void CreateCommands(IDomainFacade domainFacade)
+        {
             Rename = new CategoryRenameCommand(domainFacade, this);
             ChangeColor = new CategoryChangeColorCommand(domainFacade, this);
         }
-
-        public CategoryEditViewModel(IDomainFacade domainFacade, IKey key, string name, string description, Color color)
-            : this(domainFacade, key)
-        {
-            Name = name;
-            Description = description;
-            Color = color;
-        }
     }
 }


GetPathInfo() should return the PATH_INFO

Signed-off-by: Etienne CHAMPETIER <d24370f93c848f9b9e9043ebb082d433901eaa60@fiducial.net>

--- src/Mono.WebServer.HyperFastCgi/WorkerRequest.cs
+++ src/Mono.WebServer.HyperFastCgi/WorkerRequest.cs
@@ -191,12 +191,7 @@

 		public override string GetPathInfo ()
 		{
-			return String.Empty;
-//			string pi = cgiRequest.GetParameter ("PATH_INFO");
-//			if (!String.IsNullOrEmpty (pi))
-//				return pi;
-//
-//			return path_info ?? String.Empty;
+			return cgiRequest.GetParameter ("PATH_INFO") ?? String.Empty;
 		}

 		public override string GetRawUrl ()


Fix! Tipo Contribuinte

Fix! Tipo Contribuinte

--- src/MotorTributarioNet/Flags/TipoContribuinte.cs
+++ src/MotorTributarioNet/Flags/TipoContribuinte.cs
@@ -27,14 +27,14 @@
     {
         //Neste caso, deverá ser informada a Inscrição Estadual do destinatário.
         [Description("1 - Contribuinte de ICMS.")]
-        SimplesNacional = 1,
+        Contribuinte = 1,

         [Description("2 - Contribuinte isento")]
-        SimplesNacionalExecesso = 2,
+        Isento = 2,

         //Que pode ou não possuir Inscrição Estadual no Cadastro de Contribuintes do ICMS.
         [Description("9 - Não Contribuinte")]
-        RegimeNormal = 9
+        NaoContribuinte = 9

     }
 }


Forces raw output of text nodes.

Forces raw output of text nodes.

--- x2.markdown/x2.markdown/x2.markdown.cs
+++ x2.markdown/x2.markdown/x2.markdown.cs
@@ -125,8 +125,7 @@
                 return str;
             }

-            if(e.NodeType==XmlNodeType.Text)
-                return Regex.Replace( ((XText)e).Value.Replace('\n', ' '), @"\s+", " ");
+            if (e.NodeType == XmlNodeType.Text) return ((XText)e).Value;

             return "";
         }


Check length of auth method switch payload for detecting old protocol.

Single 0xfe byte of the payload means it's an Old Authentication Method Switch Request Packet.
See http://imysql.com/mysql-internal-manual/connection-phase-packets.html

--- src/MySqlConnector/Serialization/MySqlSession.cs
+++ src/MySqlConnector/Serialization/MySqlSession.cs
@@ -242,8 +242,18 @@
 			// if server doesn't support the authentication fast path, it will send a new challenge
 			if (payload.HeaderByte == AuthenticationMethodSwitchRequestPayload.Signature)
 			{
-				await SwitchAuthenticationAsync(cs, payload, ioBehavior, cancellationToken).ConfigureAwait(false);
-				payload = await ReceiveReplyAsync(ioBehavior, cancellationToken).ConfigureAwait(false);
+				if (payload.ArraySegment.Count == 1)
+				{
+					// Single 0xfe byte of the payload means it's an Old Authentication Method Switch Request Packet.
+					// See http://imysql.com/mysql-internal-manual/connection-phase-packets.html
+					// It's old protocol so MySqlConnector doesn't support it.
+					throw new NotSupportedException("Old Authentication Method Switch is not supported. Use new password hash format of 41-byte in MySQL server, not old format of 16-byte.");
+				}
+				else
+				{
+					await SwitchAuthenticationAsync(cs, payload, ioBehavior, cancellationToken).ConfigureAwait(false);
+					payload = await ReceiveReplyAsync(ioBehavior, cancellationToken).ConfigureAwait(false);
+				}
 			}

 			OkPayload.Create(payload);


Added OkColor to ListPerms cmd embed

Added OkColor to ListPerms cmd embed

--- src/NadekoBot/Modules/Permissions/Permissions.cs
+++ src/NadekoBot/Modules/Permissions/Permissions.cs
@@ -73,20 +73,21 @@
         [RequireContext(ContextType.Guild)]
         public async Task ListPerms(int page = 1)
         {
-            const int PermsPerPage = 20;
+            const int permsPerPage = 20;

             IList<Permissionv2> perms = Service.Cache.TryGetValue(Context.Guild.Id, out var permCache) ? permCache.Permissions.Source.ToList() : Permissionv2.GetDefaultPermlist;
-            var maxPage = (int)Math.Ceiling(perms.Count * 1d / PermsPerPage) - 1;
+            var maxPage = (int)Math.Ceiling(perms.Count * 1d / permsPerPage) - 1;
             page--;
             if (page < 0) page = 0;
             if (page > maxPage) page = maxPage;

             await Context.Channel.SendPaginatedConfirmAsync((DiscordSocketClient) Context.Client, page, i =>
                     new EmbedBuilder()
+                        .WithOkColor()
                         .WithTitle(GetText("page"))
                         .WithDescription(string.Join("\n", perms.Reverse()
-                            .Skip(PermsPerPage * i)
-                            .Take(PermsPerPage)
+                            .Skip(permsPerPage * i)
+                            .Take(permsPerPage)
                             .Select(p =>
                                 $"`{p.Index + 1}.` {Format.Bold(p.GetCommand(Prefix, (SocketGuild) Context.Guild))}{(p.Index == 0 ? $" [{GetText("uneditable")}]" : "")}"))),
                 maxPage, reactUsers: new[] {(IGuildUser) Context.User}).ConfigureAwait(false);


adding unit test for custom delimiter

adding unit test for custom delimiter

--- src/NetSort.UnitTests/SortableExtensionsTests.cs
+++ src/NetSort.UnitTests/SortableExtensionsTests.cs
@@ -228,6 +228,24 @@
             Assert.AreEqual(null, sortedPeople);
         }

+        [TestMethod]
+        public void SortableExtensions_SortByKey_WithCustomDelimiter_Works()
+        {
+            var people = new List<Person>
+            {
+                new Person { NonSortableAddress = new NonIComparableAddress { Metadata = new AddressMetadata { SomeDecimal = 5, } } },
+                new Person { NonSortableAddress = new NonIComparableAddress { Metadata = new AddressMetadata { SomeDecimal = 8, } } },
+                new Person { NonSortableAddress = new NonIComparableAddress { Metadata = new AddressMetadata { SomeDecimal = 4, } } },
+                new Person { NonSortableAddress = new NonIComparableAddress { Metadata = new AddressMetadata { SomeDecimal = 2, } } },
+            };
+
+            var sortedPeople = people.SortByKey("nonSortAddress_metadata_decimal", '_').ToList();
+
+            var isCorrect = DoesMatch(sortedPeople, people.OrderBy(p => p.NonSortableAddress.Metadata.SomeDecimal).ToList(), p => p.NonSortableAddress.Metadata.SomeDecimal);
+
+            Assert.IsTrue(isCorrect);
+        }
+
         private bool DoesMatch<T, TEQuality>(IList<T> data1, IList<T> data2, Func<T, TEQuality> equalitySelector)
         {
             if (data1.Count != data2.Count) return false;


removes borders around hyperlinks by default

--- PDFsharp/code/PdfSharp/PdfSharp.Pdf.Annotations/PdfLinkAnnotation.cs
+++ PDFsharp/code/PdfSharp/PdfSharp.Pdf.Annotations/PdfLinkAnnotation.cs
@@ -116,8 +116,9 @@
       //  "/Rect[{1} {2} {3} {4}]\n/BS<</Type/Border>>\n/Border[0 0 0]\n/C[0 0 0]\n",
       //  this.ObjectID.ObjectNumber, rect.X1, rect.Y1, rect.X2, rect.Y2);

+	  // changed hyperlink to not include a border
       if (Elements[Keys.BS] == null)
-        Elements[Keys.BS] = new PdfLiteral("<</Type/Border>>");
+        Elements[Keys.BS] = new PdfLiteral("<</Type/Border/W 0>>");

       if (Elements[Keys.Border] == null)
         Elements[Keys.Border] = new PdfLiteral("[0 0 0]");


fix TestBlob.cs to also run from within VS IDE

--- csharp/tests/TestBlob/TestBlob.cs
+++ csharp/tests/TestBlob/TestBlob.cs
@@ -3,14 +3,33 @@
 using System.IO;

 public class TestBlob
-{
+{
+    public static string FindSrcImplDirectory()
+    {
+        string dir = Path.Combine("src", "impl");
+        if (Directory.Exists(dir))
+        {
+            return dir;
+        }
+        dir = Path.Combine("..", dir);
+        dir = Path.Combine("..", dir);
+        dir = Path.Combine("..", dir);
+        dir = Path.Combine("..", dir);
+        if (Directory.Exists(dir))
+        {
+            return dir;
+        }
+        return null;
+    }
+
     public static void Main(string[] args)
     {
         Storage db = StorageFactory.CreateStorage();
         db.Open("testblob.dbs");
         byte[] buf = new byte[1024];
         int rc;
-        string[] files = Directory.GetFiles(@"src\impl", "*.cs");
+        string dir = FindSrcImplDirectory();
+        string[] files = Directory.GetFiles(dir, "*.cs");
         Index<string,Blob> root = (Index<string,Blob>)db.Root;
         if (root == null)
         {


Use queues instead of bags for system add and remove queues

--- ECS/SystemManager.cs
+++ ECS/SystemManager.cs
@@ -13,8 +13,8 @@

         internal SortedDictionary<int, List<System>> systems = new SortedDictionary<int, List<System>>();

-        private ConcurrentBag<Tuple<int, System>> toAddSystem = new ConcurrentBag<Tuple<int, System>>();
-        private ConcurrentBag<Tuple<int, System>> toRemoveSystem = new ConcurrentBag<Tuple<int, System>>();
+        private ConcurrentQueue<Tuple<int, System>> toAddSystem = new ConcurrentQueue<Tuple<int, System>>();
+        private ConcurrentQueue<Tuple<int, System>> toRemoveSystem = new ConcurrentQueue<Tuple<int, System>>();

         internal SystemManager()
         {
@@ -23,19 +23,19 @@

         internal void AddSystem(System system, int priority)
         {
-            toAddSystem.Add(Tuple.Create(priority, system));
+            toAddSystem.Enqueue(Tuple.Create(priority, system));
         }

         internal void RemoveSystem(System system, int priority)
         {
-            toRemoveSystem.Add(Tuple.Create(priority, system));
+            toRemoveSystem.Enqueue(Tuple.Create(priority, system));
         }

         internal void ProcessQueues()
         {
             Tuple<int, System> tuple;

-            while (toRemoveSystem.TryTake(out tuple))
+            while (toRemoveSystem.TryDequeue(out tuple))
             {
                 var priority = tuple.Item1;
                 var system = tuple.Item2;
@@ -66,7 +66,7 @@
                 }
             }

-            while (toAddSystem.TryTake(out tuple))
+            while (toAddSystem.TryDequeue(out tuple))
             {
                 var priority = tuple.Item1;
                 var system = tuple.Item2;


Made DataStream unblocking

Made DataStream unblocking

This allows the AlgorithmManger to continue processing events and messages. Achieved by sending an empty collection of data into the AlgorithmManager.

--- Engine/DataStream.cs
+++ Engine/DataStream.cs
@@ -63,6 +63,7 @@
             var increment = TimeSpan.FromSeconds(1);
             _subscriptions = feed.Subscriptions.Count;
             var frontier = frontierOrigin;
+            var nextEmitTime = DateTime.MinValue;
             var newData = new SortedDictionary<DateTime, Dictionary<int, List<BaseData>>>();

             //Wait for datafeeds to be ready, wait for first data to arrive:
@@ -131,9 +132,10 @@
                     frontier += increment;
                 }

-                //Submit the next data array:
-                if (newData.Count > 0)
-                {
+                //Submit the next data array, even if there's no data, allow emits every second to allow event handling (liquidate/stop/ect...)
+                if (newData.Count > 0 || (Engine.LiveMode && DateTime.Now > nextEmitTime))
+                {
+                    nextEmitTime = DateTime.Now + TimeSpan.FromSeconds(1);
                     yield return newData;
                 }
             }


Updates	 cdn link

Updates	 cdn link

--- src/AD.OpenXml/HtmlVisitor.cs
+++ src/AD.OpenXml/HtmlVisitor.cs
@@ -6,6 +6,7 @@
 using AD.OpenXml.Structures;
 using JetBrains.Annotations;

+// ReSharper disable ClassWithVirtualMembersNeverInherited.Global
 namespace AD.OpenXml
 {
     /// <inheritdoc />
@@ -216,13 +217,9 @@
                                 new XAttribute("name", MetaName),
                                 new XAttribute("content", MetaContent)),
                             new XElement("title", title),
-                            new XElement("link",
-                                new XAttribute("type", "text/css"),
-                                new XAttribute("rel", "stylesheet"),
-                                new XAttribute("href", stylesheet)),
                             new XElement("script",
                                 new XAttribute("type", "text/javascript"),
-                                new XAttribute("src", "https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-MML-AM_CHTML"),
+                                new XAttribute("src", "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.4/latest.js?config=TeX-MML-AM_CHTML"),
                                 new XText(string.Empty)),
                             new XElement("style",
                                 new XText("article { counter-reset: chapter_counter; }"),
@@ -240,7 +237,11 @@
                                 new XText("a[aria-describedby=\"footnote-label\"] { font-size: 0.5em; }"),
                                 new XText("a[aria-describedby=\"footnote-label\"] { margin-left: 1px; }"),
                                 new XText("a[aria-describedby=\"footnote-label\"] { text-decoration: none; }"),
-                                new XText("a[aria-describedby=\"footnote-label\"] { vertical-align: super; }"))),
+                                new XText("a[aria-describedby=\"footnote-label\"] { vertical-align: super; }")),
+                            new XElement("link",
+                                new XAttribute("type", "text/css"),
+                                new XAttribute("rel", "stylesheet"),
+                                new XAttribute("href", stylesheet))),
                         // TODO: dispatch sequences of nodes optionally (e.g. virtual) instead of each node to support section-encapsulation.
                         Lift(Visit(document)),
                         // TODO: handle this as a call at the end of an encapsulated section so that each section can be served as stand alone content.


Calling base.Dispose will call AudioFileClose which can write to the file, so we need to do our Dispose work before freeing the GC handle.

--- src/AudioToolbox/AudioFile.cs
+++ src/AudioToolbox/AudioFile.cs
@@ -1064,9 +1064,9 @@

 		protected override void Dispose (bool disposing)
 		{
+			base.Dispose (disposing);
 			if (gch.IsAllocated)
 				gch.Free ();
-			base.Dispose (disposing);
 		}

 		[DllImport (Constants.AudioToolboxLibrary)]


(GH-937) Corrected Obsolete Documentation

--- src/Cake.Core/Tooling/Tool.cs
+++ src/Cake.Core/Tooling/Tool.cs
@@ -26,7 +26,7 @@
         /// <param name="environment">The environment.</param>
         /// <param name="processRunner">The process runner.</param>
         /// <param name="globber">The globber.</param>
-        [Obsolete("Please use Tool(IFileSystem, ICakeEnvironment, IProcessRunner, IToolService) instead.")]
+        [Obsolete("Please use Tool(IFileSystem, ICakeEnvironment, IProcessRunner, IToolLocator) instead.")]
         protected Tool(IFileSystem fileSystem, ICakeEnvironment environment, IProcessRunner processRunner, IGlobber globber)
             : this(fileSystem, environment, processRunner, (IToolLocator)null)
         {


Fix SetLineDash to accept null 'lengths' to remove the dashing [#12291]

--- src/CoreGraphics/CGContext.cs
+++ src/CoreGraphics/CGContext.cs
@@ -249,17 +249,16 @@
 		extern static	void CGContextSetLineDash(IntPtr c, float phase, float [] lengths, int count);
 		public void SetLineDash (float phase, float [] lengths)
 		{
+			int n = lengths == null ? 0 : lengths.Length;
+			CGContextSetLineDash (handle, phase, lengths, n);
+		}
+
+		public void SetLineDash (float phase, float [] lengths, int n)
+		{
 			if (lengths == null)
-				throw new ArgumentNullException ("lengths");
-			CGContextSetLineDash (handle, phase, lengths, lengths.Length);
-		}
-
-		public void SetLineDash (float phase, float [] lengths, int n)
-		{
-			if (lengths == null)
-				throw new ArgumentNullException ("lengths");
-			if (n > lengths.Length)
-				throw new ArgumentNullException ("n");
+				n = 0;
+			else if (n < 0 || n > lengths.Length)
+				throw new ArgumentException ("n");
 			CGContextSetLineDash (handle, phase, lengths, n);
 		}


Added missing documentation to BrowserContext.

--- src/Crowbar/BrowserContext.cs
+++ src/Crowbar/BrowserContext.cs
@@ -4,6 +4,9 @@

 namespace Crowbar
 {
+    /// <summary>
+    /// Defines the context that a <see cref="Browser"/> instance should run under.
+    /// </summary>
     public class BrowserContext : ISimulatedWorkerRequestContext
     {
         private readonly ISimulatedWorkerRequestContext context;
@@ -21,18 +24,33 @@
             context.Headers["Content-Type"] = "application/octet-stream";
         }

+        /// <summary>
+        /// Gets or sets the body.
+        /// </summary>
         string ISimulatedWorkerRequestContext.BodyString { get; set; }

         HttpCookieCollection ISimulatedWorkerRequestContext.Cookies { get; set; }

+        /// <summary>
+        /// Gets or sets the forms values.
+        /// </summary>
         NameValueCollection ISimulatedWorkerRequestContext.FormValues { get; set; }

+        /// <summary>
+        /// Gets or sets the headers that should be used for the request.
+        /// </summary>
         NameValueCollection ISimulatedWorkerRequestContext.Headers { get; set; }

         string ISimulatedWorkerRequestContext.Method { get; set; }

+        /// <summary>
+        /// Gets or sets the protocol that should be used for the request.
+        /// </summary>
         string ISimulatedWorkerRequestContext.Protocol { get; set; }

+        /// <summary>
+        /// Gets or sets the query string.
+        /// </summary>
         string ISimulatedWorkerRequestContext.QueryString { get; set; }

         /// <summary>


Poprawiony backup

Poprawiony backup

--- SerwisAudiometryczny/SerwisAudiometryczny/Views/Backup/export.cshtml
+++ SerwisAudiometryczny/SerwisAudiometryczny/Views/Backup/export.cshtml
@@ -1,2 +1,8 @@
-@Html.ActionLink("Pobierz", "SendFile")
-
+@using (Html.BeginForm("SendFile", "BackupController"))
+{
+

+

+            <input type="submit" value="pobierz" class="btn btn-primary" />
+

+

+}


Fixed namespace

Fixed namespace

--- Sharpex.GameLibrary/Framework/Common/Extensions/LogLevelExtension.cs
+++ Sharpex.GameLibrary/Framework/Common/Extensions/LogLevelExtension.cs
@@ -1,5 +1,5 @@
 using System;
-using SharpexGL.Framework.Common.Debug;
+using SharpexGL.Framework.Debug;

 namespace SharpexGL.Framework.Common.Extensions
 {


Add unit tests for comments module comment reply request.

--- Source/Tests/TraktApiSharp.Tests/Modules/TraktCommentsModuleTests.cs
+++ Source/Tests/TraktApiSharp.Tests/Modules/TraktCommentsModuleTests.cs
@@ -137,8 +137,7 @@

             TestUtility.SetupMockResponseWithoutOAuth($"comments/{commentId}", comment);

-            Func<Task<TraktComment>> act =
-                async () => await TestUtility.MOCK_TEST_CLIENT.Comments.GetCommentAsync(null);
+            Func<Task<TraktComment>> act = async () => await TestUtility.MOCK_TEST_CLIENT.Comments.GetCommentAsync(null);
             act.ShouldThrow<ArgumentException>();

             act = async () => await TestUtility.MOCK_TEST_CLIENT.Comments.GetCommentAsync(string.Empty);
@@ -2812,19 +2811,96 @@
         [TestMethod]
         public void TestTraktCommentsModuleGetCommentReply()
         {
-            Assert.Fail();
+            var comment = TestUtility.ReadFileContents(@"Objects\Basic\Comment.json");
+            comment.Should().NotBeNullOrEmpty();
+
+            var commentId = "76957";
+
+            TestUtility.SetupMockResponseWithoutOAuth($"comments/{commentId}", comment);
+
+            var response = TestUtility.MOCK_TEST_CLIENT.Comments.GetCommentReplyAsync(commentId).Result;
+
+            response.Should().NotBeNull();
+            response.Id.Should().Be(76957);
+            response.ParentId.Should().Be(0);
+            response.CreatedAt.Should().Be(DateTime.Parse("2016-04-01T12:44:40Z").ToUniversalTime());
+            response.Comment.Should().Be("I hate they made The flash a kids show. Could else be much better. And with a better flash offcourse.");
+            response.Spoiler.Should().BeFalse();
+            response.Review.Should().BeFalse();
+            response.Replies.Should().Be(1);
+            response.Likes.Should().Be(2);
+            response.UserRating.Should().Be(7.3f);
+            response.User.Should().NotBeNull();
         }

         [TestMethod]
         public void TestTraktCommentsModuleGetCommentReplyExceptions()
         {
-            Assert.Fail();
+            var commentId = "76957";
+            var uri = $"comments/{commentId}";
+
+            TestUtility.SetupMockResponseWithoutOAuth(uri, HttpStatusCode.NotFound);
+
+            Func<Task<TraktComment>> act =
+                async () => await TestUtility.MOCK_TEST_CLIENT.Comments.GetCommentReplyAsync(commentId);
+            act.ShouldThrow<TraktCommentNotFoundException>();
+
+            TestUtility.ClearMockHttpClient();
+            TestUtility.SetupMockResponseWithoutOAuth(uri, HttpStatusCode.BadRequest);
+            act.ShouldThrow<TraktBadRequestException>();
+
+            TestUtility.ClearMockHttpClient();
+            TestUtility.SetupMockResponseWithoutOAuth(uri, HttpStatusCode.Forbidden);
+            act.ShouldThrow<TraktForbiddenException>();
+
+            TestUtility.ClearMockHttpClient();
+            TestUtility.SetupMockResponseWithoutOAuth(uri, (HttpStatusCode)412);
+            act.ShouldThrow<TraktPreconditionFailedException>();
+
+            TestUtility.ClearMockHttpClient();
+            TestUtility.SetupMockResponseWithoutOAuth(uri, (HttpStatusCode)429);
+            act.ShouldThrow<TraktRateLimitException>();
+
+            TestUtility.ClearMockHttpClient();
+            TestUtility.SetupMockResponseWithoutOAuth(uri, HttpStatusCode.InternalServerError);
+            act.ShouldThrow<TraktServerException>();
+
+            TestUtility.ClearMockHttpClient();
+            TestUtility.SetupMockResponseWithoutOAuth(uri, (HttpStatusCode)503);
+            act.ShouldThrow<TraktServerUnavailableException>();
+
+            TestUtility.ClearMockHttpClient();
+            TestUtility.SetupMockResponseWithoutOAuth(uri, (HttpStatusCode)504);
+            act.ShouldThrow<TraktServerUnavailableException>();
+
+            TestUtility.ClearMockHttpClient();
+            TestUtility.SetupMockResponseWithoutOAuth(uri, (HttpStatusCode)520);
+            act.ShouldThrow<TraktServerUnavailableException>();
+
+            TestUtility.ClearMockHttpClient();
+            TestUtility.SetupMockResponseWithoutOAuth(uri, (HttpStatusCode)521);
+            act.ShouldThrow<TraktServerUnavailableException>();
+
+            TestUtility.ClearMockHttpClient();
+            TestUtility.SetupMockResponseWithoutOAuth(uri, (HttpStatusCode)522);
+            act.ShouldThrow<TraktServerUnavailableException>();
         }

         [TestMethod]
         public void TestTraktCommentsModuleGetCommentReplyArgumentExceptions()
         {
-            Assert.Fail();
+            var comment = TestUtility.ReadFileContents(@"Objects\Basic\Comment.json");
+            comment.Should().NotBeNullOrEmpty();
+
+            var commentId = "76957";
+
+            TestUtility.SetupMockResponseWithoutOAuth($"comments/{commentId}", comment);
+
+            Func<Task<TraktComment>> act = async () => await TestUtility.MOCK_TEST_CLIENT.Comments.GetCommentReplyAsync(null);
+            act.ShouldThrow<ArgumentException>();
+
+            act = async () => await TestUtility.MOCK_TEST_CLIENT.Comments.GetCommentReplyAsync(string.Empty);
+            act.ShouldThrow<ArgumentException>();
         }

         #endregion