Implement CacheDownloadStrategy

Implement CacheDownloadStrategy

--- src/Paket.Bootstrapper/CacheDownloadStrategy.cs
+++ src/Paket.Bootstrapper/CacheDownloadStrategy.cs
@@ -1,10 +1,12 @@
 using System;
+using System.IO;

 namespace Paket.Bootstrapper
 {
     internal class CacheDownloadStrategy : IDownloadStrategy
     {
         public string Name { get { return "Cache"; } }
+        private const string CacheDir = "PaketCache";

         private IDownloadStrategy _fallbackStrategy;
         public IDownloadStrategy FallbackStrategy
@@ -33,7 +35,24 @@

         public void DownloadVersion(string latestVersion, string target, bool silent)
         {
-            throw new NotImplementedException();
+            var cached = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), CacheDir, latestVersion, "paket.exe");
+
+            if (!File.Exists(cached))
+            {
+                if (!silent)
+                    Console.WriteLine("Version {0} not found in cache.", latestVersion);
+
+                FallbackStrategy.DownloadVersion(latestVersion, target, silent);
+                Directory.CreateDirectory(Path.GetDirectoryName(cached));
+                File.Copy(target, cached);
+            }
+            else
+            {
+                if (!silent)
+                    Console.WriteLine("Copying version {0} from cache.", latestVersion);
+
+                File.Copy(cached, target, true);
+            }
         }

         public void SelfUpdate(string latestVersion, bool silent)


Store cached paket.exe versions in Nuget cache

--- src/Paket.Bootstrapper/CacheDownloadStrategy.cs
+++ src/Paket.Bootstrapper/CacheDownloadStrategy.cs
@@ -6,7 +6,9 @@
     internal class CacheDownloadStrategy : IDownloadStrategy
     {
         public string Name { get { return "Cache"; } }
-        private const string CacheDir = "PaketCache";
+
+        private readonly string _paketCacheDir =
+            Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "NuGet", "Cache", "Paket");

         private IDownloadStrategy _fallbackStrategy;
         public IDownloadStrategy FallbackStrategy
@@ -35,7 +37,7 @@

         public void DownloadVersion(string latestVersion, string target, bool silent)
         {
-            var cached = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), CacheDir, latestVersion, "paket.exe");
+            var cached = Path.Combine(_paketCacheDir, latestVersion, "paket.exe");

             if (!File.Exists(cached))
             {


Refine ResultTtlSpecs

Refine ResultTtlSpecs

Make spec demonstrate that Ttl can actually be based on the incoming
result.

--- src/Polly.SharedSpecs/Caching/ResultTtlSpecs.cs
+++ src/Polly.SharedSpecs/Caching/ResultTtlSpecs.cs
@@ -1,8 +1,7 @@
 using System;
-using System.Collections.Generic;
-using System.Text;
 using FluentAssertions;
 using Polly.Caching;
+using Polly.Specs.Helpers.Caching;
 using Xunit;

 namespace Polly.Specs.Caching
@@ -12,7 +11,7 @@
         [Fact]
         public void Should_throw_when_func_is_null()
         {
-            Action configure = () => new ResultTtl<dynamic>(null);
+            Action configure = () => new ResultTtl<object>(null);

             configure.ShouldThrow<ArgumentNullException>().And.ParamName.Should().Be("ttlFunc");
         }
@@ -20,7 +19,7 @@
         [Fact]
         public void Should_not_throw_when_func_is_set()
         {
-            Action configure = () => new ResultTtl<dynamic>((result) => new Ttl());
+            Action configure = () => new ResultTtl<object>((result) => new Ttl());

             configure.ShouldNotThrow();
         }
@@ -29,13 +28,14 @@
         public void Should_return_func_result()
         {
             TimeSpan ttl = TimeSpan.FromMinutes(1);
-            Func<dynamic, Ttl> func = (result) => { return new Ttl(ttl); };
+            Func<dynamic, Ttl> func = (result) => { return new Ttl(result.Ttl); };

             ResultTtl<dynamic> ttlStrategy = new ResultTtl<dynamic>(func);

             Ttl retrieved = ttlStrategy.GetTtl(new Context("someExecutionKey"), new { Ttl = ttl });
-            retrieved.Timespan.Should().BeCloseTo(ttl);
+            retrieved.Timespan.Should().Be(ttl);
             retrieved.SlidingExpiration.Should().BeFalse();
         }
+
     }
 }


ReflectionHelpers can handle full type names

--- src/Sacho.DOM.XamarinForms/ReflectionHelpers.cs
+++ src/Sacho.DOM.XamarinForms/ReflectionHelpers.cs
@@ -73,6 +73,9 @@

         public static Type GetType(string name)
         {
+            if (name.Contains("."))
+                return VisualElementTypes.FirstOrDefault(x => x.Value.FullName.EndsWith(name)).Value;
+
             Type type;
             if (VisualElementTypes.TryGetValue(name, out type))
                 return type;
@@ -82,6 +85,9 @@

         public static Type GetAllType(string name)
         {
+            if (name.Contains("."))
+                return AllTypes.FirstOrDefault(x => x.Value.FullName.EndsWith(name)).Value;
+
             Type type;
             if (AllTypes.TryGetValue(name, out type))
                 return type;


Update AssemblyInfo.cs

Update AssemblyInfo.cs

--- src/ScriptCs.Octokit/Properties/AssemblyInfo.cs
+++ src/ScriptCs.Octokit/Properties/AssemblyInfo.cs
@@ -14,6 +14,6 @@

 [assembly: Guid("69341200-0230-4734-9F20-CE145B17043E")]

-[assembly: AssemblyVersion("0.2.1")]
-[assembly: AssemblyFileVersion("0.2.1")]
-[assembly: AssemblyInformationalVersion("0.2.1")]
+[assembly: AssemblyVersion("0.3.0")]
+[assembly: AssemblyFileVersion("0.3.0")]
+[assembly: AssemblyInformationalVersion("0.3.0")]


BugFix Exception when using Stringify. Fix #1426

--- src/Serilog/Capturing/PropertyValueConverter.cs
+++ src/Serilog/Capturing/PropertyValueConverter.cs
@@ -299,7 +299,7 @@
         LogEventPropertyValue Stringify(object value)
         {
             var stringified = value.ToString();
-            var truncated = TruncateIfNecessary(stringified);
+            var truncated = stringified == null ? null : TruncateIfNecessary(stringified);
             return new ScalarValue(truncated);
         }


Update Comment

Update Comment

--- src/SixLabors.Fonts/FontCollectionExtensions.cs
+++ src/SixLabors.Fonts/FontCollectionExtensions.cs
@@ -31,7 +31,7 @@
         /// Adds the fonts from the <see cref="SystemFonts"/> collection to this <see cref="FontCollection"/>.
         /// </summary>
         /// <param name="collection">The font collection.</param>
-        /// <param name="match">The <see cref="System.Predicate"/> delegate that defines the conditions of <see cref="FontMetrics"/> to add into the font collection.</param>
+        /// <param name="match">The <see cref="Predicate{T}"/> delegate that defines the conditions of <see cref="FontMetrics"/> to add into the font collection.</param>
         /// <returns>The <see cref="FontCollection"/> containing the system fonts.</returns>
         public static FontCollection AddSystemFonts(this FontCollection collection, Predicate<FontMetrics> match)
         {


Add generic GetOrCreateComponent<> to Node

--- Bindings/Portable/Node.cs
+++ Bindings/Portable/Node.cs
@@ -116,5 +116,14 @@
 			Runtime.ValidateRefCounted(this);
 			return (T)Components.FirstOrDefault(c => c is T);
 		}
+
+		public T GetOrCreateComponent<T>(bool recursive = false) where T : Component
+		{
+			Runtime.ValidateRefCounted(this);
+			var component = (T)Components.FirstOrDefault(c => c is T);
+			if (component == null)
+				return CreateComponent<T>();
+			return component;
+		}
 	}
 }


don't log worker cancelled exceptions as unhandled

--- BitSharp.Common/Worker.cs
+++ BitSharp.Common/Worker.cs
@@ -214,10 +214,13 @@
                     }
                     catch (Exception e)
                     {
-                        Console.WriteLine(new string('*', 80));
-                        Console.WriteLine("Unhandled worker exception: " + e.Message);
-                        Console.WriteLine(e);
-                        Console.WriteLine(new string('*', 80));
+                        if (!(e is OperationCanceledException))
+                        {
+                            Console.WriteLine(new string('*', 80));
+                            Console.WriteLine("Unhandled worker exception: " + e.Message);
+                            Console.WriteLine(e);
+                            Console.WriteLine(new string('*', 80));
+                        }
                         throw;
                     }
                     finally


Return existing string instance for String.Join when there is only one item in the list

--- src/System.Private.CoreLib/src/System/String.cs
+++ src/System.Private.CoreLib/src/System/String.cs
@@ -421,29 +421,28 @@
             if (values == null)
                 throw new ArgumentNullException("values");

-            if (separator == null)
-                separator = String.Empty;
-
-
             using (IEnumerator<String> en = values.GetEnumerator())
             {
                 if (!en.MoveNext())
                     return String.Empty;

+                String firstValue = en.Current;
+
+                if (!en.MoveNext())
+                {
+                    // Only one value available
+                    return firstValue ?? String.Empty;
+                }
+
+                // Null separator and values are handled by the StringBuilder
                 StringBuilder result = StringBuilderCache.Acquire();
-                if (en.Current != null)
-                {
+                result.Append(firstValue);
+
+                do
+                {
+                    result.Append(separator);
                     result.Append(en.Current);
-                }
-
-                while (en.MoveNext())
-                {
-                    result.Append(separator);
-                    if (en.Current != null)
-                    {
-                        result.Append(en.Current);
-                    }
-                }
+                } while (en.MoveNext());
                 return StringBuilderCache.GetStringAndRelease(result);
             }
         }
@@ -474,6 +473,11 @@
             if (count == 0)
             {
                 return String.Empty;
+            }
+
+            if (count == 1)
+            {
+                return value[startIndex] ?? String.Empty;
             }

             int endIndex = startIndex + count - 1;


small change to owned memory (#1012)

small change to owned memory (#1012)

--- src/System.Slices/System/Buffers/OwnedMemory.cs
+++ src/System.Slices/System/Buffers/OwnedMemory.cs
@@ -18,6 +18,8 @@
         public int ReferenceCount { get { return _referenceCount; } }

         private OwnedMemory() { }
+
+        protected OwnedMemory(T[] array) : this(array, 0, array.Length) { }

         protected OwnedMemory(T[] array, int arrayOffset, int length, IntPtr pointer = default(IntPtr))
         {
@@ -38,10 +40,7 @@
             }
         }

-        public static implicit operator OwnedMemory<T>(T[] array)
-        {
-            return new OwnedArray<T>(array);
-        }
+        public static implicit operator OwnedMemory<T>(T[] array) => new OwnedArray<T>(array);

         protected bool TryGetArrayCore(out ArraySegment<T> buffer)
         {


Added index and id to inner_hits api test, to address #3260

--- src/Tests/Search/Request/InnerHitsUsageTests.cs
+++ src/Tests/Search/Request/InnerHitsUsageTests.cs
@@ -332,6 +332,9 @@
 			response.Hits.Should().NotBeEmpty();
 			foreach (var hit in response.Hits)
 			{
+				hit.Id.Should().NotBeNullOrEmpty();
+				hit.Index.Should().NotBeNullOrEmpty();
+
 				var princes = hit.InnerHits["princes"].Documents<Prince>();
 				princes.Should().NotBeEmpty();
 				foreach (var princeHit in hit.InnerHits["princes"].Hits.Hits)


eliminated another isFile() dependency by fixing the folder and file constructor to set the proper bool directory flag to true and false respectively.

--- CS410Project/Directory.cs
+++ CS410Project/Directory.cs
@@ -70,7 +70,7 @@
             }
             else
             {
-                if (client.isFile(destination))
+                if (newWorkingDir.fileinfo.directory)
                 {
                     //Just move the working directory over to the new one
                     workingDir = (Folder)newWorkingDir;
@@ -208,6 +208,7 @@
             public Folder(string permissions, string owner, string group, uint size, string dateCreated, string name, Folder parentDir)
                 : base(permissions, owner, group, size, dateCreated, name)
             {
+                fileinfo.directory = true;
                 subdirectory = new List<File>();
                 this.parentDir = parentDir;
             }
@@ -276,6 +277,7 @@
             public File(string permissions, string owner, string group, uint size, string dateCreated, string name)
             {
                 fileinfo.permissions = permissions;
+                fileinfo.directory = false;
                 fileinfo.owner = owner;
                 fileinfo.group = group;
                 fileinfo.size = size;


Resolve #21 - Handle 'macroname' variable

--- CSF.Zpt/Tal/TalVisitor.cs
+++ CSF.Zpt/Tal/TalVisitor.cs
@@ -10,6 +10,12 @@
   /// </summary>
   public class TalVisitor : ContextVisitorBase
   {
+    #region constants
+
+    private const string MACRONAME = "macroname";
+
+    #endregion
+
     #region fields

     #pragma warning disable 414
@@ -38,6 +44,12 @@
       IEnumerable<RenderingContext>
         output = new [] { context },
         newlyExposedElements = new RenderingContext[0];
+
+      var macroAttribute = context.Element.GetMetalAttribute(ZptConstants.Metal.DefineMacroAttribute);
+      if(macroAttribute != null)
+      {
+        context.TalModel.AddLocal(MACRONAME, macroAttribute.Value);
+      }

       foreach(var handler in _handlers)
       {


Address feedback on FindBestConfiguration

--- src/Tools/CoreFx.Tools/FindBestConfiguration.cs
+++ src/Tools/CoreFx.Tools/FindBestConfiguration.cs
@@ -11,11 +11,11 @@
 {
     public class FindBestConfiguration : BuildTask
     {
-        private static readonly char s_SupportedGroupsSeparator = '|';
-        private static readonly char s_VerticalGroupsSeparator = '-';
+        private static readonly char[] s_SupportedGroupsSeparator = new[] { '|' };
+        private static readonly char[] s_VerticalGroupsSeparator = new[] { '-' };

         [Required]
-        public string ProjectConfigurations { get; set; }
+        public string[] ProjectConfigurations { get; set; }

         [Required]
         public string SelectionGroup { get; set; }
@@ -38,8 +38,7 @@

         public override bool Execute()
         {
-            string[] configurations = ProjectConfigurations.Split(';');
-            string[] supportedTargetGroups = configurations.Select(s => s.Split(s_SupportedGroupsSeparator)[0]).Where(w => !string.IsNullOrWhiteSpace(w)).ToArray();
+            string[] supportedTargetGroups = ProjectConfigurations.Select(s => s.Split(s_SupportedGroupsSeparator)[0]).Where(w => !string.IsNullOrWhiteSpace(w)).ToArray();

             string[] tokens = SelectionGroup.Split(s_VerticalGroupsSeparator);
             string osGroup = tokens[0];
@@ -69,14 +68,14 @@
                 metadata.Add("TargetGroup", targetGroup);
             }

-            string[] supportedOSGroups = configurations.Where(v => v.Contains(targetGroup)).Select(v => v.Split(s_SupportedGroupsSeparator)[1]).ToArray();
+            string[] supportedOSGroups = ProjectConfigurations.Where(v => v.Contains(targetGroup)).Select(v => v.Split(s_SupportedGroupsSeparator)[1]).ToArray();
             Dictionary<string, ITaskItem> searchOSGroups = OSGroups.ToDictionary(o => o.ItemSpec, o => o);
             string compatibleOSGroup = FindCompatibleOSGroup(osGroup, supportedOSGroups, searchOSGroups);
             metadata.Add("OSGroup", compatibleOSGroup);

             OutputItem = new TaskItem(Name, metadata);

-            return true;
+            return !Log.HasLoggedErrors;
         }

         private string FindCompatibleOSGroup(string osGroup, string[] supportedOsGroups, Dictionary<string, ITaskItem> searchOSGroups)


RIP DirtyBackDoor

RIP DirtyBackDoor

--- src/Umbraco.Core/ObjectResolution/Resolution.cs
+++ src/Umbraco.Core/ObjectResolution/Resolution.cs
@@ -63,49 +63,6 @@
 			}
 		}

-        // NOTE - the ugly code below exists only because of umbraco.BusinessLogic.Actions.Action.ReRegisterActionsAndHandlers
-        // which wants to re-register actions and handlers instead of properly restarting the application. Don't even think
-        // about using it for anything else. Also, while the backdoor is open, the resolution system is locked so nothing
-        // can work properly => deadlocks. Therefore, open the backdoor, do resolution changes EXCLUSIVELY, and close the door!
-
-        /// <summary>
-        /// Returns a disposable object that reprents dirty access to temporarily unfrozen resolution configuration.
-        /// </summary>
-        /// <remarks>
-        /// <para>Should not be used.</para>
-        /// <para>Should be used in a <c>using(Resolution.DirtyBackdoorToConfiguration) { ... }</c> mode.</para>
-        /// <para>Because we just lift the frozen state, and we don't actually re-freeze, the <c>Frozen</c> event does not trigger.</para>
-        /// </remarks>
-        internal static IDisposable DirtyBackdoorToConfiguration
-        {
-            get { return new DirtyBackdoor(); }
-        }
-
-        // keep the class here because it needs write-access to Resolution.IsFrozen
-        private class DirtyBackdoor : IDisposable
-        {
-
-            private readonly IDisposable _lock;
-            private readonly bool _frozen;
-
-            public DirtyBackdoor()
-            {
-                LogHelper.Debug(typeof(DirtyBackdoor), "Creating back door for resolution");
-
-                _lock = new WriteLock(ConfigurationLock);
-                _frozen = _isFrozen;
-                _isFrozen = false;
-            }
-
-            public void Dispose()
-            {
-                LogHelper.Debug(typeof(DirtyBackdoor), "Disposing back door for resolution");
-
-                _isFrozen = _frozen;
-                _lock.Dispose();
-            }
-        }
-
 		/// <summary>
 		/// Freezes resolution.
 		/// </summary>


Undo fix for #1 due to performance issues caused. Proper fix will probably require moving a lot of the arrange logic to the measure step

--- src/UniversalWPF/RelativePanel/RelativePanel.cs
+++ src/UniversalWPF/RelativePanel/RelativePanel.cs
@@ -347,7 +347,6 @@
 				//this helps for instance textblocks to reflow the text wrapping
 				//We should probably have done this during the measure step but it would cause a more expensive
 				//measure+arrange layout cycle
-				child.Measure(new Size(Math.Max(0, finalSize.Width - rect[2] - rect[0]), Math.Max(0, finalSize.Height - rect[3] - rect[1])));
 				child.Arrange(new Rect(rect[0], rect[1], Math.Max(0, finalSize.Width - rect[2] - rect[0]), Math.Max(0, finalSize.Height - rect[3] - rect[1])));
 			}
 			return base.ArrangeOverride(finalSize);


Ensure no trailing slashes for LZMA generation

--- build/tasks/CreateLzma.cs
+++ build/tasks/CreateLzma.cs
@@ -25,8 +25,9 @@
                 {
                     if (Directory.Exists(source))
                     {
-                        Log.LogMessage(MessageImportance.High, $"Adding directory: {source}");
-                        archive.AddDirectory(source, progress);
+                        var trimmedSource = source.TrimEnd(new char[] { '\\', '/' });
+                        Log.LogMessage(MessageImportance.High, $"Adding directory: {trimmedSource}");
+                        archive.AddDirectory(trimmedSource, progress);
                     }
                     else
                     {


Adding updated Playback

Adding updated Playback

Adding updated Playback class.

--- CodedSelenium/Playback.cs
+++ CodedSelenium/Playback.cs
@@ -5,6 +5,21 @@
 {
     public static class Playback
     {
+        /// <summary>
+        /// Property added for Compatibility Purposes Only
+        /// Doesn't work
+        /// </summary>
+        public static event EventHandler<PlaybackErrorEventArgs> PlaybackError
+        {
+            add
+            {
+            }
+
+            remove
+            {
+            }
+        }
+
         public static int Wait(int thinkTimeMilliseconds)
         {
             Thread.Sleep(thinkTimeMilliseconds);


Added back ExportUtc element.

Added back ExportUtc element.

--- src/Orchard.Web/Modules/Orchard.Recipes/Services/RecipeBuilder.cs
+++ src/Orchard.Web/Modules/Orchard.Recipes/Services/RecipeBuilder.cs
@@ -1,9 +1,15 @@
 using System.Collections.Generic;
 using System.Xml.Linq;
+using Orchard.Services;

 namespace Orchard.Recipes.Services {
     public class RecipeBuilder : Component, IRecipeBuilder {
-
+        private readonly IClock _clock;
+
+        public RecipeBuilder(IClock clock) {
+            _clock = clock;
+        }
+
         public XDocument Build(IEnumerable<IRecipeBuilderStep> steps) {
             var context = new BuildContext {
                 RecipeDocument = CreateRecipeRoot()
@@ -19,9 +25,10 @@
         private XDocument CreateRecipeRoot() {
             var recipeRoot = new XDocument(
                 new XDeclaration("1.0", "", "yes"),
-                new XComment("Exported from Orchard"),
+                new XComment(T("Exported from Orchard").ToString()),
                 new XElement("Orchard",
-                    new XElement("Recipe")
+                    new XElement("Recipe",
+                        new XElement("ExportUtc", _clock.UtcNow))
                 )
             );
             return recipeRoot;


Media text: Check if index exists (#7993)

--- src/OrchardCore.Modules/OrchardCore.Media/Views/MediaField.cshtml
+++ src/OrchardCore.Modules/OrchardCore.Media/Views/MediaField.cshtml
@@ -14,7 +14,7 @@
         {
             var path = paths[i];
             var url = Orchard.AssetUrl(path);
-            var text = !string.IsNullOrEmpty(mediaTexts[i]) ? mediaTexts[i] : path;
+            var text = !string.IsNullOrEmpty(mediaTexts.ElementAtOrDefault(i)) ? mediaTexts[i] : path;

             if (Orchard.IsImageFile(path))
             {


Update SqlQuerySource.cs (#4835)

Update SqlQuerySource.cs (#4835)

Fixes issues with named Queries

--- src/OrchardCore.Modules/OrchardCore.Queries/Sql/SqlQuerySource.cs
+++ src/OrchardCore.Modules/OrchardCore.Queries/Sql/SqlQuerySource.cs
@@ -71,7 +71,7 @@

                     using (var transaction = connection.BeginTransaction(_session.Store.Configuration.IsolationLevel))
                     {
-                        documentIds = await connection.QueryAsync<int>(rawQuery, parameters);
+                        documentIds = await connection.QueryAsync<int>(rawQuery, parameters, transaction);
                     }
                 }

@@ -88,7 +88,7 @@

                     using (var transaction = connection.BeginTransaction(_session.Store.Configuration.IsolationLevel))
                     {
-                        queryResults = await connection.QueryAsync(rawQuery, parameters);
+                        queryResults = await connection.QueryAsync(rawQuery, parameters, transaction);
                     }
                 }


Add codemirror resourses to manifest. (#5548)

Co-authored-by: Antoine Griffard <1b6ecbb1cf8aa9a67727914b885ab668b8df63a2@hotmail.com>

--- src/OrchardCore.Modules/OrchardCore.Resources/ResourceManifest.cs
+++ src/OrchardCore.Modules/OrchardCore.Resources/ResourceManifest.cs
@@ -135,6 +135,20 @@
                 .SetUrl("~/OrchardCore.Resources/Scripts/codemirror/addon/mode/simple.min.js", "~/OrchardCore.Resources/Scripts/codemirror/addon/mode/simple.js")
                 .SetCdn("https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.51.0/addon/mode/simple.min.js", "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.51.0/addon/mode/simple.js")
                 .SetCdnIntegrity("sha384-PYnRCkTSLtxgDbM57KaZEFO1eo3GS7wo0+VSnVr+6rcsGXcVYqlW74MV1gJvE8HN", "sha384-ntjFEzI50GYBTbLGaOVgBt97cxp74jfCqMDmZYlGWk8ZZp2leFMJYOp85T3tOeG9")
+                .SetVersion("5.51.0");
+
+            manifest
+                .DefineScript("codemirror-mode-css")
+                .SetUrl("~/OrchardCore.Resources/Scripts/codemirror/mode/css/css.min.js", "~/OrchardCore.Resources/Scripts/codemirror/mode/css/css.js")
+                .SetCdn("https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.51.0/mode/css/css.min.js", "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.51.0/mode/css/css.js")
+                .SetCdnIntegrity("sha384-SrOROyP0t9lG4sW9jdpO04/mCGGU/2o02aT088UUixjeJvwyhO1otG9biCdry5Ci", "sha384-RN42QX7medq2vyftditoRxJxgTDfVeuWcC6zR9iEiGOMxEYrzukFTBXuZrEmlTUA")
+                .SetVersion("5.51.0");
+
+            manifest
+                .DefineScript("codemirror-mode-htmlmixed")
+                .SetUrl("~/OrchardCore.Resources/Scripts/codemirror/mode/htmlmixed/htmlmixed.min.js", "~/OrchardCore.Resources/Scripts/codemirror/mode/htmlmixed/htmlmixed.js")
+                .SetCdn("https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.51.0/mode/htmlmixed/htmlmixed.min.js", "https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.51.0/mode/htmlmixed/htmlmixed.js")
+                .SetCdnIntegrity("sha384-JL3CPNoNfm5b6L9dNL99RuMfsLE2DSD1Pbbh++B/2MQTIj+0ZrK0+YxxWlFZ5VVX", "sha384-fxS517EbIB2hObIbibF9AuQAFnAlwZgIsy2zpeCqpw4yIkJRfNOLSe0JHu7H7ULE")
                 .SetVersion("5.51.0");

             manifest


oops

oops

please don't kill me

--- ModCore/Commands/Lists.cs
+++ ModCore/Commands/Lists.cs
@@ -1,250 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using DSharpPlus.CommandsNext;
-using DSharpPlus.CommandsNext.Attributes;
-using DSharpPlus.Entities;
-using DSharpPlus.Interactivity;
-using Humanizer;
-using Humanizer.Localisation;
-using ModCore.Database;
-using ModCore.Entities;
-using ModCore.Listeners;
-using ModCore.Logic;
-
-namespace ModCore.Commands
-{
-    [Group("list"), Description("Commands for managing your lists.")]
-    public class Lists
-    {
-        private const string ListTut = @"
-Sets a new reminder. The time span parser is fluent and will understand many different formats of reminders:
-
-<Time span>, <Message>
-[in] <Time span> to <Message>
-<Short time span> <Message>
-
-Where ""Time span"" represents a time period or a relative date (optionally with time of day specified), such as
-\* Tomorrow at 2:00 PM Chicago time
-\* Next fortnight
-\* 8 hours 20 minutes
-
-A ""Short time span"" represents a time span represented in a single word (we call this a token), such as
-\* 2h
-\* 4m5s
-\* 15min
-\* 30min55sec
-
-See these examples:
-
-```
-+remindme next week to walk the dog
-+remindme tomorrow, fix socket
-+remindme 2h5m watch new stranger things episode
-+remindme 8 hours wake up
-+remindme in an hour to eat something
-+remindme in nine months to have a baby
-```
-
-Note that even if your arguments don't fit the grammar denoted above, they might still be parsed fine.
-If in doubt, just try it! You can always clear the reminders later.
-";
-        public SharedData Shared { get; }
-        public DatabaseContextBuilder Database { get; }
-        public InteractivityExtension Interactivity { get; }
-
-        public Lists(SharedData shared, DatabaseContextBuilder db, InteractivityExtension interactive)
-        {
-            this.Shared = shared;
-            this.Database = db;
-            this.Interactivity = interactive;
-        }
-
-        [Description(ListTut)]
-        public async Task ExecuteGroupAsync(CommandContext ctx, [RemainingText] string dataToParse)
-        {
-            await SetAsync(ctx, dataToParse);
-        }
-
-        [Command("list"), Description("Lists your... lists.")]
-        public async Task ListAsync(CommandContext ctx)
-        {
-            await ctx.TriggerTypingAsync();
-            DatabaseTimer[] reminders;
-            using (var db = this.Database.CreateContext())
-                reminders = db.Timers.Where(xt =>
-                    xt.ActionType == TimerActionType.Reminder && xt.GuildId == (long)ctx.Guild.Id &&
-                    xt.UserId == (long)ctx.User.Id).ToArray();
-            if (!reminders.Any())
-            {
-                await ctx.RespondAsync("You have no reminders set.");
-                return;
-            }
-
-            var rms = reminders.OrderByDescending(xt => xt.DispatchAt).ToArray();
-            var interactivity = this.Interactivity;
-            var emoji = DiscordEmoji.FromName(ctx.Client, ":alarm_clock:");
-
-            var page = 1;
-            var total = rms.Length / 5 + (rms.Length % 5 == 0 ? 0 : 1);
-            var pages = new List<Page>();
-            var cembed = new DiscordEmbedBuilder
-            {
-                Title = $"{emoji} Your currently set reminders:",
-                Footer = new DiscordEmbedBuilder.EmbedFooter
-                {
-                    Text = $"Page {page} of {total}"
-                }
-            };
-            foreach (var xr in rms)
-            {
-                var data = xr.GetData<TimerReminderData>();
-                var note = data.ReminderText;
-                if (note.Contains('\n'))
-                    note = string.Concat(note.Substring(0, note.IndexOf('\n')), "...");
-
-                cembed.AddField(
-                    $"In {(DateTimeOffset.UtcNow - xr.DispatchAt).Humanize(4, minUnit: TimeUnit.Second)} (ID: #{xr.Id})",
-                    $"{note}");
-                if (cembed.Fields.Count < 5) continue;
-                page++;
-                pages.Add(new Page { Embed = cembed.Build() });
-                cembed = new DiscordEmbedBuilder
-                {
-                    Title = $"{emoji} Your currently set reminders:",
-                    Footer = new DiscordEmbedBuilder.EmbedFooter
-                    {
-                        Text = $"Page {page} of {total}"
-                    }
-                };
-            }
-            if (cembed.Fields.Count > 0)
-                pages.Add(new Page { Embed = cembed.Build() });
-
-            if (pages.Count > 1)
-                await interactivity.SendPaginatedMessage(ctx.Channel, ctx.User, pages);
-            else
-                await ctx.RespondAsync(embed: pages.First().Embed);
-        }
-
-        [Command("set"), Description(ListTut)]
-        public async Task SetAsync(CommandContext ctx, [RemainingText] string dataToParse)
-        {
-            await ctx.TriggerTypingAsync();
-
-            var (duration, text) = await Dates.ParseTime(dataToParse);
-            if (duration == Dates.ParsingError)
-            {
-                await ctx.RespondAsync(
-                    $"Sorry, there was an error parsing your reminder.\nIf you see a developer, this info might help them: {text}");
-                return;
-            }
-
-            if (string.IsNullOrWhiteSpace(text) || text.Length > 128)
-            {
-                await ctx.RespondAsync(
-                    "Reminder text must to be no longer than 128 characters, not empty and not whitespace.");
-                return;
-            }
-#if !DEBUG
-            if (duration < TimeSpan.FromSeconds(30))
-            {
-                await ctx.RespondAsync("Minimum required time span to set a reminder is 30 seconds.");
-                return;
-            }
-#endif
-
-            if (duration > TimeSpan.FromDays(365)) // 1 year is the maximum
-            {
-                await ctx.RespondAsync("Maximum allowed time span to set a reminder is 1 year.");
-                return;
-            }
-
-            var now = DateTimeOffset.UtcNow;
-            var dispatchAt = now + duration;
-
-            // create a new timer
-            var reminder = new DatabaseTimer
-            {
-                GuildId = (long)ctx.Guild.Id,
-                ChannelId = (long)ctx.Channel.Id,
-                UserId = (long)ctx.User.Id,
-                DispatchAt = dispatchAt.LocalDateTime,
-                ActionType = TimerActionType.Reminder
-            };
-            reminder.SetData(new TimerReminderData { ReminderText = text });
-            using (var db = this.Database.CreateContext())
-            {
-                db.Timers.Add(reminder);
-                await db.SaveChangesAsync();
-            }
-
-            // reschedule timers
-            Timers.RescheduleTimers(ctx.Client, this.Database, this.Shared);
-
-            var emoji = DiscordEmoji.FromName(ctx.Client, ":alarm_clock:");
-            await ctx.RespondAsync(
-                $"{emoji} Ok, in {duration.Humanize(4, minUnit: TimeUnit.Second)} I will remind you about the following:\n\n{text}");
-        }
-
-        [Command("stop"), Aliases("unset", "remove"), Description("Stops and removes a reminder.")]
-        public async Task UnsetAsync(CommandContext ctx, [Description("Which timer to stop. To get a Timer ID, use " +
-                                                                      "the `reminder list` command.")] int timerId)
-        {
-            await ctx.TriggerTypingAsync();
-
-            // find the timer
-            var reminder = Timers.FindTimer(timerId, TimerActionType.Reminder, ctx.User.Id, this.Database);
-            if (reminder == null)
-            {
-                await ctx.RespondAsync($"Timer with specified ID (#{timerId}) was not found.");
-                return;
-            }
-
-            // unschedule and reset timers
-            await Timers.UnscheduleTimerAsync(reminder, ctx.Client, this.Database, this.Shared);
-
-            var duration = reminder.DispatchAt - DateTimeOffset.Now;
-            var data = reminder.GetData<TimerReminderData>();
-            var emoji = DiscordEmoji.FromName(ctx.Client, ":ballot_box_with_check:");
-            await ctx.RespondAsync(
-                $"{emoji} Ok, timer #{reminder.Id} due in {duration.Humanize(4, minUnit: TimeUnit.Second)} was removed. The reminder's message was:\n\n{data.ReminderText}");
-        }
-
-        [Command("clear"), Description("Clears all active reminders.")]
-        public async Task ClearAsync(CommandContext ctx)
-        {
-            await ctx.TriggerTypingAsync();
-
-            await ctx.RespondAsync("Are you sure you want to clear all your active reminders? This action cannot be undone!");
-
-            var m = await this.Interactivity.WaitForMessageAsync(x => x.ChannelId == ctx.Channel.Id && x.Author.Id == ctx.Member.Id, TimeSpan.FromSeconds(30));
-
-            if (m == null)
-            {
-                await ctx.RespondAsync("Timed out.");
-            }
-            else if (InteractivityUtil.Confirm(m))
-            {
-                await ctx.RespondAsync("Brace for impact!");
-                await ctx.TriggerTypingAsync();
-                using (var db = this.Database.CreateContext())
-                {
-                    var timers = db.Timers
-                        .Where(xt => xt.ActionType == TimerActionType.Reminder && xt.UserId == (long)ctx.User.Id)
-                        .ToArray();
-                    var count = timers.Length;
-                    db.Timers.RemoveRange(timers);
-
-                    await ctx.RespondAsync("Alright, cleared " + count + " timers.");
-                }
-
-            }
-            else
-            {
-                await ctx.RespondAsync("Nevermind then, maybe next time.");
-            }
-        }
-    }
-}


remove todo (tech debt task has been created for it)

--- src/SFA.DAS.EAS.Portal/DependencyResolution/CommitmentsService.cs
+++ src/SFA.DAS.EAS.Portal/DependencyResolution/CommitmentsService.cs
@@ -28,8 +28,6 @@
             public string ClientToken { get; set; }
         }

-        //todo: as we're not in the client, we could/should use RestHttpClient here instead
-        // and there is no direct nuget reference to the SFA.DAS.Http package in this project
         private static HttpClient GetHttpClient(IServiceProvider provider)
         {
             var config = provider.GetService<CommitmentsApiClientConfiguration>();


Set List parameter to required

Set List parameter to required

--- Commands/Lists/AddView.cs
+++ Commands/Lists/AddView.cs
@@ -13,7 +13,7 @@
         SortOrder = 1)]
     public class AddView : SPOWebCmdlet
     {
-        [Parameter(Mandatory = false, ValueFromPipeline = true, Position = 0, HelpMessage = "The ID or Url of the list.")]
+        [Parameter(Mandatory = true, ValueFromPipeline = true, Position = 0, HelpMessage = "The ID or Url of the list.")]
         public ListPipeBind List;

         [Parameter(Mandatory = true, HelpMessage = "The title of the view.")]
@@ -39,11 +39,7 @@

         protected override void ExecuteCmdlet()
         {
-            List list = null;
-            if (List != null)
-            {
-                list = List.GetList(SelectedWeb);
-            }
+            var list = List.GetList(SelectedWeb);
             if (list != null)
             {
                 var view = list.CreateView(Title, ViewType, Fields, RowLimit, SetAsDefault, Query, Personal);
@@ -52,5 +48,4 @@
             }
         }
     }
-
 }


let's have a better error message here

let's have a better error message here

--- src/Shimmer.Core/ReactiveUIMicro/Rx-Shim/AwaitableAsyncSubject.cs
+++ src/Shimmer.Core/ReactiveUIMicro/Rx-Shim/AwaitableAsyncSubject.cs
@@ -334,7 +334,7 @@
             }

             if (!_hasValue)
-                throw new InvalidOperationException("Sequence has no elements");
+                throw new InvalidOperationException("AwaitableAsyncSubject<T>.GetResult() completed without having a result. That's bad.");

             return _value;
         }


Fix short path expansion (dotnet/coreclr#16901)

Also make methods internal so I can add better unit tests.

Signed-off-by: dotnet-bot <03c4cb6107ae99956a7681f2c97ff7104809a2bd@microsoft.com>

--- src/System.Private.CoreLib/shared/System/IO/PathHelper.Windows.cs
+++ src/System.Private.CoreLib/shared/System/IO/PathHelper.Windows.cs
@@ -67,7 +67,7 @@
             builder.Length = (int)result;
         }

-        private static int PrependDevicePathChars(ref ValueStringBuilder content, bool isDosUnc, ref ValueStringBuilder buffer)
+        internal static int PrependDevicePathChars(ref ValueStringBuilder content, bool isDosUnc, ref ValueStringBuilder buffer)
         {
             int length = content.Length;

@@ -98,7 +98,7 @@
             }
         }

-        private static string TryExpandShortFileName(ref ValueStringBuilder outputBuilder, string originalPath)
+        internal static string TryExpandShortFileName(ref ValueStringBuilder outputBuilder, string originalPath)
         {
             // We guarantee we'll expand short names for paths that only partially exist. As such, we need to find the part of the path that actually does exist. To
             // avoid allocating like crazy we'll create only one input array and modify the contents with embedded nulls.
@@ -197,13 +197,13 @@
                     outputBuilder.Length = checked((int)result);
                     if (foundIndex < inputLength - 1)
                     {
-                        // It was a partial find, put the non-existent part of the path back
-                        outputBuilder.Append(inputBuilder.AsSpan(foundIndex, inputBuilder.Length - foundIndex));
-                    }
-                }
-            }
-
-            // Need to trim out the trailing separator in the input builder
+                        // It was a partial find, put the non-existent part of the path back (minus the added null)
+                        outputBuilder.Append(inputBuilder.AsSpan(foundIndex, inputBuilder.Length - foundIndex - 1));
+                    }
+                }
+            }
+
+            // Need to trim out the trailing null in the input builder
             inputBuilder.Length = inputBuilder.Length - 1;

             // If we were able to expand the path, use it, otherwise use the original full path result


Added support for script resources as embedded content in incoming assembly

--- ConDep.Console/Program.cs
+++ ConDep.Console/Program.cs
@@ -47,7 +47,8 @@
                                                           optionHandler.Params.DeployOnly,
                                                           optionHandler.Params.WebDeployExist,
                                                           optionHandler.Params.StopAfterMarkedServer,
-                                                          optionHandler.Params.ContinueAfterMarkedServer);
+                                                          optionHandler.Params.ContinueAfterMarkedServer,
+                                                          assembly);
                     var envSettings = GetEnvConfig(optionHandler.Params, assembly);

                     var status = new WebDeploymentStatus();


Loop in a clearer way without overflow.

Loop in a clearer way without overflow.

--- MoreLinq/Pull/Sequence.cs
+++ MoreLinq/Pull/Sequence.cs
@@ -63,11 +63,13 @@

         private static IEnumerable<TResult> GenerateByIndexImpl<TResult>(Func<int, TResult> generator)
         {
-            // Simplest way to get 0 to int.MaxValue inclusive due to overflow.
-            for (int i = 0; i >= 0; i++)
+            // Looping over 0...int.MaxValue inclusive is a pain. Simplest is to go exclusive,
+            // then go again for int.MaxValue.
+            for (int i = 0; i < int.MaxValue; i++)
             {
                 yield return generator(i);
             }
+            yield return generator(int.MaxValue);
         }
     }
 }


ItemInStoreMetadataClient.GetAsync take paramater made InRange validation.

--- src/XOMNI.SDK.Public/Clients/Catalog/ItemInStoreMetadataClient.cs
+++ src/XOMNI.SDK.Public/Clients/Catalog/ItemInStoreMetadataClient.cs
@@ -44,7 +44,7 @@
             }

             Validator.For(skip, "skip").IsGreaterThanOrEqual(0);
-            Validator.For(take, "take").IsGreaterThanOrEqual(1);
+            Validator.For(take, "take").InRange(1, 1000);

             path += string.Format("skip={0}&take={1}&companyWide={2}", skip, take, companyWide);


Fix typo (#1818)

Fix typo (#1818)

Co-authored-by: Erik Zhang <c195b508e6f0c57aeafdb5e96947e2b79e6a4b40@neo.org>

--- src/neo/Network/P2P/Payloads/HighPriorityAttribute.cs
+++ src/neo/Network/P2P/Payloads/HighPriorityAttribute.cs
@@ -20,8 +20,8 @@

         public override bool Verify(StoreView snapshot, Transaction tx)
         {
-            UInt160 commitee = NativeContract.NEO.GetCommitteeAddress(snapshot);
-            return tx.Signers.Any(p => p.Account.Equals(commitee));
+            UInt160 committee = NativeContract.NEO.GetCommitteeAddress(snapshot);
+            return tx.Signers.Any(p => p.Account.Equals(committee));
         }
     }
 }


update version

update version

--- Cowboy/SolutionVersion.cs
+++ Cowboy/SolutionVersion.cs
@@ -1,13 +1,13 @@
 using System.Reflection;
 using System.Runtime.InteropServices;

-[assembly: AssemblyDescription("Cowboy is a library for building sockets based services.")]
+[assembly: AssemblyDescription("Cowboy is a C# library for building sockets based services.")]
 [assembly: AssemblyCompany("Dennis Gao")]
 [assembly: AssemblyProduct("Cowboy")]
 [assembly: AssemblyCopyright("Copyright © 2015-2016 Dennis Gao")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyConfiguration("")]
 [assembly: AssemblyCulture("")]
-[assembly: AssemblyVersion("1.2.20.0")]
-[assembly: AssemblyFileVersion("1.2.20.0")]
+[assembly: AssemblyVersion("1.3.1.0")]
+[assembly: AssemblyFileVersion("1.3.1.0")]
 [assembly: ComVisible(false)]


Made sure actor clients cannot connect after server has been shutdown

--- Stacks/Actors/Remote/ActorServerProxyTemplate.cs
+++ Stacks/Actors/Remote/ActorServerProxyTemplate.cs
@@ -20,6 +20,7 @@
         protected Dictionary<string, Action<FramedClient, long, MemoryStream>> handlers;
         protected Dictionary<string, object> obsHandlers;
         protected IStacksSerializer serializer;
+        protected bool isStopped;

         protected Dictionary<int, Action<FramedClient, MemoryStream>> protocolHandlers;

@@ -30,6 +31,7 @@

         public ActorServerProxyTemplate(T actorImplementation, IPEndPoint bindEndPoint)
         {
+            isStopped = false;
             executor = new ActionBlockExecutor();
             serializer = new ProtoBufStacksSerializer();
             clients = new List<FramedClient>();
@@ -54,6 +56,7 @@
             server.Stop();
             executor.Enqueue(() =>
                 {
+                    isStopped = true;
                     pingTimer.Change(Timeout.Infinite, Timeout.Infinite);

                     foreach (var client in clients)
@@ -123,6 +126,9 @@

         private void ClientConnected(SocketClient socketClient)
         {
+            if (isStopped)
+                return;
+
             var client = new FramedClient(socketClient);

             client.Disconnected.Subscribe(exn =>


Do case insensitive comparison when checking for existing wallet (#615)

* Do case insensitive comparison of existing wallets before creating new wallet.

Fixes #596

* Remove redundant file exists check.

#596

* Address code review issues.

--- Stratis.Bitcoin.Features.Wallet/WalletManager.cs
+++ Stratis.Bitcoin.Features.Wallet/WalletManager.cs
@@ -1078,7 +1078,7 @@
         /// <param name="chainCode">The chain code.</param>
         /// <param name="creationTime">The time this wallet was created.</param>
         /// <returns>The wallet object that was saved into the file system.</returns>
-        /// <exception cref="System.NotSupportedException"></exception>
+        /// <exception cref="WalletException">Thrown if wallet cannot be created.</exception>
         private Wallet GenerateWalletFile(string name, string encryptedSeed, byte[] chainCode, DateTimeOffset? creationTime = null)
         {
             Guard.NotEmpty(name, nameof(name));
@@ -1086,7 +1086,8 @@
             Guard.NotNull(chainCode, nameof(chainCode));
             this.logger.LogTrace("({0}:'{1}')", nameof(name), name);

-            if (this.fileStorage.Exists($"{name}.{WalletFileExtension}"))
+            // Check if any wallet file already exists, with case insensitive comparison.
+            if (this.Wallets.Any(w => string.Equals(w.Name, name, StringComparison.OrdinalIgnoreCase)))
             {
                 this.logger.LogTrace("(-)[WALLET_ALREADY_EXISTS]");
                 throw new WalletException($"Wallet with name '{name}' already exists.");


wait for queued continuation to finish

wait for queued continuation to finish

--- src/csharp/Grpc.Core/Internal/GrpcThreadPool.cs
+++ src/csharp/Grpc.Core/Internal/GrpcThreadPool.cs
@@ -33,8 +33,7 @@
     internal class GrpcThreadPool
     {
         static readonly ILogger Logger = GrpcEnvironment.Logger.ForType<GrpcThreadPool>();
-        static readonly WaitCallback RunCompletionQueueEventCallbackSuccess = new WaitCallback((callback) => RunCompletionQueueEventCallback((OpCompletionDelegate) callback, true));
-        static readonly WaitCallback RunCompletionQueueEventCallbackFailure = new WaitCallback((callback) => RunCompletionQueueEventCallback((OpCompletionDelegate) callback, false));
+        const int FinishContinuationsSleepMillis = 10;

         readonly GrpcEnvironment environment;
         readonly object myLock = new object();
@@ -42,6 +41,9 @@
         readonly int poolSize;
         readonly int completionQueueCount;
         readonly bool inlineHandlers;
+        readonly WaitCallback runCompletionQueueEventCallbackSuccess;
+        readonly WaitCallback runCompletionQueueEventCallbackFailure;
+        readonly AtomicCounter queuedContinuationCounter = new AtomicCounter();

         readonly List<BasicProfiler> threadProfilers = new List<BasicProfiler>();  // profilers assigned to threadpool threads

@@ -64,6 +66,9 @@
             this.inlineHandlers = inlineHandlers;
             GrpcPreconditions.CheckArgument(poolSize >= completionQueueCount,
                 "Thread pool size cannot be smaller than the number of completion queues used.");
+
+            this.runCompletionQueueEventCallbackSuccess = new WaitCallback((callback) => RunCompletionQueueEventCallback((OpCompletionDelegate) callback, true));
+            this.runCompletionQueueEventCallbackFailure = new WaitCallback((callback) => RunCompletionQueueEventCallback((OpCompletionDelegate) callback, false));
         }

         public void Start()
@@ -173,7 +178,8 @@
                         // Use cached delegates to avoid unnecessary allocations
                         if (!inlineHandlers)
                         {
-                            ThreadPool.QueueUserWorkItem(success ? RunCompletionQueueEventCallbackSuccess : RunCompletionQueueEventCallbackFailure, callback);
+                            queuedContinuationCounter.Increment();
+                            ThreadPool.QueueUserWorkItem(success ? runCompletionQueueEventCallbackSuccess : runCompletionQueueEventCallbackFailure, callback);
                         }
                         else
                         {
@@ -187,6 +193,16 @@
                 }
             }
             while (ev.type != CompletionQueueEvent.CompletionType.Shutdown);
+
+            // Continuations are running on default threadpool that consists of background threads.
+            // GrpcThreadPool thread (a foreground thread) will not exit unless all queued work had
+            // been finished to prevent terminating the continuations queued prematurely.
+            while (queuedContinuationCounter.Count != 0)
+            {
+                // Only happens on shutdown and having pending continuations shouldn't very common,
+                // so sleeping here for a little bit is fine.
+                Thread.Sleep(FinishContinuationsSleepMillis);
+            }
         }

         private static IReadOnlyCollection<CompletionQueueSafeHandle> CreateCompletionQueueList(GrpcEnvironment environment, int completionQueueCount)
@@ -200,7 +216,7 @@
             return list.AsReadOnly();
         }

-        private static void RunCompletionQueueEventCallback(OpCompletionDelegate callback, bool success)
+        private void RunCompletionQueueEventCallback(OpCompletionDelegate callback, bool success)
         {
             try
             {
@@ -209,6 +225,10 @@
             catch (Exception e)
             {
                 Logger.Error(e, "Exception occured while invoking completion delegate");
+            }
+            finally
+            {
+                queuedContinuationCounter.Decrement();
             }
         }
     }


new server code

new server code

--- central-server/Program.cs
+++ central-server/Program.cs
@@ -82,7 +82,7 @@

                     IPAddress messageIP = new IPAddress(addressBytes);
                     Int32 port = BitConverter.ToInt32(portBytes, 0);
-					Int32 cmd = BitConverter.ToInt32(portBytes, 0);
+					Int32 cmd = BitConverter.ToInt32(cmdBytes, 0);
                     //BitConverter.
                     ////convert endianness if necessary
                     //if (BitConverter.IsLittleEndian)


update MIConvexHull VoronoiMesh.Create requires config no more

--- src/Mesh2D.cs
+++ src/Mesh2D.cs
@@ -158,16 +158,18 @@
             if (failedPoints != null) failedPoints.Clear();
             _pointToPoly = new Dictionary<Vector3D, Mesh2DPoly>(vCmp);

+            /*
             var config = new TriangulationComputationConfig
             {
                 PointTranslationType = PointTranslationType.TranslateInternal,
                 PlaneDistanceTolerance = 1e-6,
                 PointTranslationGenerator = TriangulationComputationConfig.RandomShiftByRadius(1e-6, 0)
             };
+            */

             var vs = Points.Select(v => new Vertex(v)).ToList();

-            _voronoiMesh = VoronoiMesh.Create<Vertex, Cell>(vs, config);
+            _voronoiMesh = VoronoiMesh.Create<Vertex, Cell>(vs);//, config);

             _vectorToCell = new Dictionary<Vector3D, List<Cell>>(vCmp);


Adding test on parameters count for 'unit' function

--- src/dotless.Test/Specs/Functions/UnitFixture.cs
+++ src/dotless.Test/Specs/Functions/UnitFixture.cs
@@ -24,5 +24,11 @@
         {
             AssertExpressionError("Expected number in function 'unit', found at", 0, "unit(at, px)");
         }
+
+        [Test]
+        public void ThrowIsIncorrectParametersCount()
+        {
+            AssertExpressionError("Expected at most 2 arguments in function 'unit', found 3", 0, "unit(5, 12, px)");
+        }
     }
 }


[Modify] Polish it

[Modify] Polish it

--- websocket-sharp/HttpRequest.cs
+++ websocket-sharp/HttpRequest.cs
@@ -171,7 +171,7 @@
       }

       var method = reqLineParts[0];
-      var uri = reqLineParts[1];
+      var target = reqLineParts[1];

       var num = reqLineParts[2].Substring (5);
       var ver = new Version (num);
@@ -181,7 +181,7 @@
       for (var i = 1; i < headerParts.Length; i++)
         headers.InternalSet (headerParts[i], false);

-      return new HttpRequest (method, uri, ver, headers);
+      return new HttpRequest (method, target, ver, headers);
     }

     internal static HttpRequest Read (Stream stream, int millisecondsTimeout)


Added quick check if item is null

Added quick check if item is null

--- AngleSharp/Extensions.cs
+++ AngleSharp/Extensions.cs
@@ -136,14 +136,17 @@
         public static Int32 Index<T>(this IEnumerable<T> elements, T item)
             where T : INode
         {
-            int i = 0;
-
-            foreach (var element in elements)
+            if (item != null)
             {
-                if (Object.ReferenceEquals(element, item))
-                    return i;
-
-                i++;
+                int i = 0;
+
+                foreach (var element in elements)
+                {
+                    if (Object.ReferenceEquals(element, item))
+                        return i;
+
+                    i++;
+                }
             }

             return -1;


Fixed prefetch all

Fixed prefetch all

--- AngleSharp/TextSource.cs
+++ AngleSharp/TextSource.cs
@@ -274,8 +274,11 @@
         /// <returns>The awaitable task.</returns>
         public async Task PrefetchAll(CancellationToken cancellationToken)
         {
-            while (!_finished && !cancellationToken.IsCancellationRequested)
-                await ExpandBufferAsync(BufferSize, cancellationToken).ConfigureAwait(false);
+            if (_content.Length == 0)
+                await DetectByteOrderMarkAsync(cancellationToken).ConfigureAwait(false);
+
+            while (!_finished)
+                await ReadIntoBufferAsync(cancellationToken).ConfigureAwait(false);
         }

         /// <summary>


Refactor ChangeRotationForTimestamp()

Refactor ChangeRotationForTimestamp()

--- AnimationPathAnimator.cs
+++ AnimationPathAnimator.cs
@@ -397,13 +397,32 @@
             float timestamp,
             Vector3 newPosition) {

+            // Get node timestamps.
             var timestamps = rotationPath.GetTimestamps();
+            // If matching timestamp in the path was found.
+            var foundMatch = false;
+            // For each timestamp..
             for (var i = 0; i < rotationPath.KeysNo; i++) {
+                // Check if it is the timestamp to remove..
                 if (Math.Abs(timestamps[i] - timestamp) < 0.001f) {
+                    // Remove node.
                     rotationPath.RemoveNode(i);
-                }
-            }
+
+                    foundMatch = true;
+                }
+            }
+
+            // If timestamp was not found..
+            if (!foundMatch) {
+                Debug.Log("You're trying to change rotation for nonexistent " +
+                    "node.");
+
+                return;
+            }
+
+            // Create new node.
             rotationPath.CreateNewNode(timestamp, newPosition);
+            // Smooth all nodes.
             rotationPath.SmoothAllNodes();
         }


Reorganize members

Reorganize members

--- AnimationPathAnimator.cs
+++ AnimationPathAnimator.cs
@@ -20,7 +20,7 @@
     [ExecuteInEditMode]
     public class AnimationPathAnimator : GameComponent {
         #region CONSTANTS
-        private Vector3 defaultRotationPointOffset = new Vector3(0, 0, 0);
+        private const int RotationCurveSampling = 20;
         private const float DefaultEndEaseValue = 0.01f;
         private const float DefaultSecondEaseValue = 0.08f;
         private const float DefaultStartEaseValue = 0.01f;
@@ -59,6 +59,13 @@
         #endregion CONSTANTS

         #region FIELDS
+        [SerializeField]
+        private AnimatorRotationMode rotationMode = AnimatorRotationMode.Forward;
+
+        [SerializeField]
+        private AnimatorHandleMode handleMode = AnimatorHandleMode.None;
+
+        private Vector3 defaultRotationPointOffset = new Vector3(0, 0, 0);
         /// <summary>
         /// Path used to animate the <c>animatedGO</c> transform.
         /// </summary>
@@ -95,13 +102,6 @@
         #endregion FIELDS

         #region EDITOR
-        [SerializeField]
-        private AnimatorHandleMode handleMode = AnimatorHandleMode.None;
-
-        [SerializeField]
-        private AnimatorRotationMode rotationMode = AnimatorRotationMode.Forward;
-
-
         /// <summary>
         /// Transform to be animated.
         /// </summary>
@@ -138,7 +138,6 @@
         // ReSharper disable once FieldCanBeMadeReadOnly.Local ReSharper
         // disable once ConvertToConstant.Local
         private float rotationSpeed = 3.0f;
-
 #pragma warning restore 649
 #pragma warning restore 649
         #endregion EDITOR
@@ -240,8 +239,7 @@
         }

         private void DrawRotationGizmoCurve() {
-            // TODO Calculate samplingRate using rotatio path length.
-            var points = rotationCurves.SamplePathForPoints(20);
+            var points = rotationCurves.SamplePathForPoints(RotationCurveSampling);

             if (points.Count < 2) return;


improved run

improved run

--- Cycle.Net.Run/CycleNet.cs
+++ Cycle.Net.Run/CycleNet.cs
@@ -1,4 +1,5 @@
 using System;
+using System.Linq;
 using System.Reactive;
 using System.Reactive.Linq;
 using System.Reactive.Disposables;
@@ -20,20 +21,19 @@

         public static void Run(Func<IObservable<IResponse>, IObservable<IRequest>> main, Drivers drivers)
         {
-            var requestSubject = new Subject<IRequest>();
-            var responseSubject = new Subject<IResponse>();
-            // make sure our source and sink are cached and subscription happen on the scheduler
-            var sink = requestSubject.AsObservable().ObserveOn(Scheduler).SubscribeOn(Scheduler);
-            var source = responseSubject.AsObservable().ObserveOn(Scheduler).SubscribeOn(Scheduler);
-            foreach (var driver in drivers)
-            {
-                driver(sink)
-                    // ignore driver that does not give an output
+            var proxy = new Subject<IRequest>();
+            var observableProxy = proxy.AsObservable();
+            var observerProxy = proxy.AsObserver();
+            main(Observable.Merge(drivers.Select(driver =>
+                driver(observableProxy)
                     .Where(response => !(response is EmptyResponse))
-                    .Subscribe(responseSubject.AsObserver());
-            }
-            main(source)
-                .Subscribe(requestSubject.AsObserver());
+                ))
+                .SubscribeOn(Scheduler)
+                .ObserveOn(Scheduler)
+                .Publish()
+                .RefCount()
+            )
+            .Subscribe(observerProxy);
         }
     }
 }


Adding link to explanation on the ranges.

--- WmcSoft.Core/SemVer.cs
+++ WmcSoft.Core/SemVer.cs
@@ -31,6 +31,7 @@
     /// <summary>
     /// Represent a version when using semantic versioning.
     /// </summary>
+    /// <remarks>See http://developer.telerik.com/featured/mystical-magical-semver-ranges-used-npm-bower/ </remarks>
     public sealed class SemVer : ICloneable<SemVer>, IComparable<SemVer>, IEquatable<SemVer>, IComparable
     {
         private readonly Version _version;


Cleanup.

Cleanup.

--- WordExtraction/Demo.cs
+++ WordExtraction/Demo.cs
@@ -13,10 +13,6 @@
             {
                 Console.WriteLine("\"" + word + "\"");
             }
-            //Console.WriteLine(SymbolTable.GetSymbolType(' '));
-            //Console.WriteLine(SymbolTable.GetSymbolType('e'));
-            //Console.WriteLine(SymbolTable.GetSymbolType('z'));
-            //Console.WriteLine(SymbolTable.GetSymbolType('g'));
         }
     }
 }


Changed discovery endpoint to use dynamic

--- source/Core/Connect/Endpoints/DiscoveryEndpointController.cs
+++ source/Core/Connect/Endpoints/DiscoveryEndpointController.cs
@@ -5,6 +5,7 @@
 using System.Web.Http;
 using Thinktecture.IdentityModel;
 using Thinktecture.IdentityServer.Core.Services;
+using Thinktecture.IdentityServer.Core.Extensions;

 namespace Thinktecture.IdentityServer.Core.Connect
 {
@@ -19,32 +20,24 @@
         }

         [Route("openid-configuration")]
-        public Dictionary<string, object> GetConfiguration()
+        public dynamic GetConfiguration()
         {
-            var doc = new Dictionary<string, object>();
+            var baseUrl = Request.GetBaseUrl(_settings.GetPublicHost());

-            string host = _settings.GetPublicHost();
-            if (host.IsMissing())
+            return new
             {
-                host = "https://" + Request.Headers.Host;
-            }
-
-            var baseUrl = new Uri(new Uri(host), Request.GetRequestContext().VirtualPathRoot).AbsoluteUri;
-            if (!baseUrl.EndsWith("/")) baseUrl += "/";
-
-            doc.Add("issuer", _settings.GetIssuerUri());
-            doc.Add("jwks_uri", baseUrl + ".well-known/jwks");
-            doc.Add("authorization_endpoint", baseUrl + "connect/authorize");
-            doc.Add("token_endpoint", baseUrl + "connect/token");
-            doc.Add("userinfo_endpoint", baseUrl + "connect/userinfo");
-            doc.Add("scopes_supported", _settings.GetScopes().Select(s => s.Name));
-            doc.Add("response_types_supported", Constants.SupportedResponseTypes);
-            doc.Add("response_modes_supported", Constants.SupportedResponseModes);
-            doc.Add("grant_types_supported", Constants.SupportedGrantTypes);
-            doc.Add("subject_types_support", new string[] { "pairwise", "public" });
-            doc.Add("id_token_signing_alg_values_supported", "RS256");
-
-            return doc;
+                issuer = _settings.GetIssuerUri(),
+                jwks_uri = baseUrl + ".well-known/jwks",
+                authorization_endpoint = baseUrl + "connect/authorize",
+                token_endpoint = baseUrl + "connect/token",
+                userinfo_endpoint = baseUrl + "connect/userinfo",
+                scopes_supported = _settings.GetScopes().Select(s => s.Name),
+                response_types_supported = Constants.SupportedResponseTypes,
+                response_modes_supported = Constants.SupportedResponseModes,
+                grant_types_supported = Constants.SupportedGrantTypes,
+                subject_types_support = new string[] { "pairwise", "public" },
+                id_token_signing_alg_values_supported = "RS256"
+            };
         }

         [Route("jwks")]
@@ -56,7 +49,7 @@

             var key = new
             {
-                kty = "foo",
+                kty = "RSA",
                 use = "sig",
                 kid = thumbprint,
                 x5c = new string[] { cert64 }


(BdfOpener): override OpenImage method.

(BdfOpener): override OpenImage method.

--- ArcFormats/Zyx/ArcBDF.cs
+++ ArcFormats/Zyx/ArcBDF.cs
@@ -23,11 +23,11 @@
 // IN THE SOFTWARE.
 //

-using System;
 using System.Collections.Generic;
 using System.ComponentModel.Composition;
 using System.IO;
 using System.Linq;
+using System.Windows.Media;
 using GameRes.Utility;

 namespace GameRes.Formats.Zyx
@@ -44,9 +44,17 @@
     {
         public byte[] FirstFrame;

+        public ImageMetaData Info { get; private set; }
+
         public BdfArchive (ArcView arc, ArchiveFormat impl, ICollection<Entry> dir)
             : base (arc, impl, dir)
         {
+            var base_frame = dir.First() as BdfFrame;
+            Info = new ImageMetaData {
+                Width = (uint)base_frame.Width,
+                Height = (uint)base_frame.Height,
+                BPP = 24
+            };
         }

         public byte[] ReadFrame (BdfFrame frame)
@@ -84,7 +92,7 @@
             return pixels;
         }

-        private void DecodeFrame (Stream input, byte[] output, bool incremental = false)
+        private void DecodeFrame (IBinaryStream input, byte[] output, bool incremental = false)
         {
             int v2 = incremental ? 6 : 4;
             int dst = 0;
@@ -119,10 +127,8 @@
                     }
                 case 2:
                     {
-                        count = 3 * input.ReadByte();
-                        offset  = input.ReadByte();
-                        offset |= input.ReadByte() << 8;
-                        offset *= 3;
+                        count  = 3 * input.ReadByte();
+                        offset = 3 * input.ReadUInt16();
                         int src = dst - offset;
                         Binary.CopyOverlapped (output, src, dst, count);
                         dst += count;
@@ -139,9 +145,7 @@
                     }
                 case 4:
                     {
-                        offset  = input.ReadByte();
-                        offset |= input.ReadByte() << 8;
-                        offset *= 3;
+                        offset = 3 * input.ReadUInt16();
                         int src = dst - offset;
                         output[dst++] = output[src++];
                         output[dst++] = output[src++];
@@ -163,8 +167,7 @@
                         }
                         else
                         {
-                            count  = input.ReadByte();
-                            count |= input.ReadByte() << 8;
+                            count = input.ReadUInt16();
                         }
                         dst += 3 * count;
                     }
@@ -200,7 +203,7 @@
             {
                 var entry = new BdfFrame {
                     Number = i,
-                    Name = string.Format ("{0}#{1:D2}.tga", base_name, i),
+                    Name = string.Format ("{0}#{1:D2}", base_name, i),
                     Type = "image",
                     Offset = base_offset + file.View.ReadUInt32 (index_offset),
                     Size = file.View.ReadUInt32 (index_offset+4),
@@ -217,23 +220,32 @@
             return new BdfArchive (file, this, dir);
         }

-        public override Stream OpenEntry (ArcFile arc, Entry entry)
+        public override IImageDecoder OpenImage (ArcFile arc, Entry entry)
         {
             var bdf = arc as BdfArchive;
             var frame = entry as BdfFrame;
             if (null == bdf || null == frame)
-                return base.OpenEntry (arc, entry);
-
-            var pixels = bdf.ReadFrame (frame);
-            var header = new byte[0x12];
-            header[2] = 2;
-            if (frame.Incremental)
-                frame = bdf.Dir.First() as BdfFrame;
-            LittleEndian.Pack ((ushort)frame.Width,  header, 0xc);
-            LittleEndian.Pack ((ushort)frame.Height, header, 0xe);
-            header[0x10] = 24;
-            header[0x11] = 0x20;
-            return new PrefixStream (header, new MemoryStream (pixels));
+                return base.OpenImage (arc, entry);
+            return new BdfImageDecoder (bdf, frame);
+        }
+    }
+
+    internal sealed class BdfImageDecoder : BinaryImageDecoder
+    {
+        BdfArchive          m_bdf;
+        BdfFrame            m_frame;
+
+        public BdfImageDecoder (BdfArchive arc, BdfFrame entry)
+            : base (arc.File.CreateStream (entry.Offset, entry.Size), arc.Info)
+        {
+            m_bdf = arc;
+            m_frame = entry;
+        }
+
+        protected override ImageData GetImageData ()
+        {
+            var pixels = m_bdf.ReadFrame (m_frame);
+            return ImageData.Create (Info, PixelFormats.Bgr24, null, pixels);
         }
     }
 }


Added a centralized tile array, not used yet.

--- Assets/MapGen/GameMap.cs
+++ Assets/MapGen/GameMap.cs
@@ -5,6 +5,11 @@

 public class GameMap : MonoBehaviour
 {
+    public class MapTile
+    {
+        int tileType;
+    }
+    public MapTile[, ,] tiles;
     ConnectionState connectionState;
     public MapBlock defaultMapBlock;
     public GameObject defaultTile;
@@ -153,16 +158,16 @@
         connectionState.BlockListCall.execute(connectionState.net_block_request, out connectionState.net_block_list);
         //stopwatch.Stop();
         //Debug.Log(connectionState.net_block_list.map_blocks.Count + " blocks gotten, took 1/" + (1.0 / stopwatch.Elapsed.TotalSeconds) + " seconds.\n");
-        FreeAllBlocks();
-        for (int i = 0; i < blockCollection.Count; i++)
-        {
-            if (blockCollection[i].gameObject.activeSelf == true)
-            {
-                blockCollection[i].Reposition(connectionState.net_block_list);
-            }
-        }
+        //for (int i = 0; i < blockCollection.Count; i++)
+        //{
+        //    if (blockCollection[i].gameObject.activeSelf == true)
+        //    {
+        //        blockCollection[i].Reposition(connectionState.net_block_list);
+        //    }
+        //}
         //System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
         //watch.Start();
+        FreeAllBlocks();
         for (int i = 0; i < connectionState.net_block_list.map_blocks.Count; i++)
         {
             MapBlock newBlock = getFreeBlock();


number 6

number 6


Increase time limit to complete the game

--- Assets/Scripts/Player.cs
+++ Assets/Scripts/Player.cs
@@ -70,7 +70,7 @@
 			other.gameObject.SetActive (false);
 			score += 1;
 			SetScoreText ();
-		} else if (other.gameObject.CompareTag ("Human") && Math.Abs(verticalAcceleration) > 0.05f) {
+		} else if (other.gameObject.CompareTag ("Human") && Math.Abs(verticalAcceleration) > 0.1f) {
 			Human human = other.GetComponent<Human>();
 			if (human.isAlive ())
 				time -= 20;
@@ -82,7 +82,7 @@
 	public void Reset ()
 	{
 		score = 0;
-		time = 3 * 60f;
+		time = 6 * 60f;
 		SetScoreText ();
 		SetWinText ("");
 		transform.position = new Vector3 (cityMapWidth / 2, 1f, -10f);


Fixed fat burning and fat-based movement speed.

--- Assets/Scripts/Player.cs
+++ Assets/Scripts/Player.cs
@@ -1,11 +1,21 @@
 using UnityEngine;
-using System.Collections;

 public class Player : MonoBehaviour {
-	const float MIN_SPEED = 5f;
-	const float MAX_SPEED = 20f;
+	const float MIN_SPEED = 3f; //Movement speed is MIN_SPEED + FAT_SPEED/fatness
+	const float FAT_SPEED = 5f;
+
+	const float CHARGE_SPEED = 20f; //This is speed of charging.
+
+	const float MIN_SHOVE = 1f; //Shove distance is MIN_SHOVE + FatDifference*FAT_SHOVE. Minimum of MIN_SHOVE.
+	const float FAT_SHOVE = 0.5f;
+
+	const float KNOCKBACK_SPEED = 20f; //This is knockback speed.
+
+	const float WALK_CONSUMPTION = 0.2f; //Cost per second of walking.
+	const float CHARGE_CONSUMPTION = 0.5f; //Cost per charge.
+	const float SHOVE_CONSUMPTION = 0.1f; //Cost per shove.
+
 	const float PROJECTILE_SPEED = 15f;
-	const float FAT_CONSUMPTIONRATE = 0.2f;

 	// Heart Constants
 	const float NORMAL_HEART = 1f;
@@ -45,14 +55,13 @@
 	public Player lastTouch;
 	public float sinceTouch;

-	private bool attacked;
 	public double distance;
+	private double timer;

 	public enum State {WAITING, CHARGING, SHOVING, PUSHED};
 	public State status;

 	public Score score;
-
 	private Vector3 old_position;
 	public Vector3 position
 	{
@@ -115,6 +124,14 @@
 				lastTouch = null;
 			}
 		}
+
+		if(status == State.SHOVING){
+			timer -= Time.deltaTime;
+			if(timer <= 0){
+				status = State.WAITING;
+			}
+		}
+
 		// resync
 		if (Networking.myId == 0) {
 			// resync this guy's position
@@ -132,26 +149,52 @@
 		if(old_position == null){
 			old_position = position;
 		}
-		distance -= (position-old_position).magnitude;
-		old_position = position;
-		if(distance <= 0){
-			rigidbody.velocity = Vector3.zero;
-			status = State.WAITING;
-		}

 		if(status == State.WAITING){
-
+			float traveled = (position-old_position).magnitude;
+			old_position = position;
+			if(traveled > 0.00001f){
+				distance -= traveled;
+				if(distance <= 0){
+					rigidbody.velocity = Vector3.zero;
+					//We finished walking for this frame.
+				}
+				updateFatness(-WALK_CONSUMPTION*0.02f);
+			}
 		}else if(status == State.CHARGING){
+			float traveled = (position-old_position).magnitude;
+			old_position = position;
+			if(traveled > 0.00001f){
+				distance -= traveled;
+				if(distance <= 0){
+					rigidbody.velocity = Vector3.zero;
+					status = State.WAITING;
+
+					//Charging ended here.
+				}
+			}
 		}else if(status == State.SHOVING){
+			//Nothing here yet.
 		}else if(status == State.PUSHED){
+			float traveled = (position-old_position).magnitude;
+			old_position = position;
+			if(traveled > 0.00001f){
+				distance -= traveled;
+				if(distance <= 0){
+					rigidbody.velocity = Vector3.zero;
+					status = State.WAITING;
+
+					//Shoving ended here.
+				}
+			}
 		}
 	}

 	public void MoveForward(Vector3 unitVector, int networkId){
 		if (this.networkId == networkId) {
 			if(status == State.WAITING){
-				rigidbody.velocity = unitVector * MIN_SPEED;
-				distance = 0.01;
+				rigidbody.velocity = unitVector * (MIN_SPEED + FAT_SPEED/fatness);
+				distance = 0.10;
 			}
 		}
 	}
@@ -159,9 +202,10 @@
 	public void Charge(Vector3 unitVector, int networkId){
 		if (this.networkId == networkId) {
 			if(status == State.WAITING){
-				rigidbody.velocity = unitVector * MAX_SPEED;
+				rigidbody.velocity = unitVector * CHARGE_SPEED;
 				status = State.CHARGING;
 				distance = 5;
+				updateFatness (-CHARGE_CONSUMPTION);
 			}
 		}
 	}
@@ -172,6 +216,7 @@

 		if (this.networkId == networkId) {
 			if(status == State.WAITING){
+				updateFatness (-SHOVE_CONSUMPTION);
 				status = State.SHOVING;

 				Quaternion rotation = transform.rotation;
@@ -200,14 +245,14 @@
 						float dotB = full.x*ortho.x + full.y*ortho.y + full.z*ortho.z;
 						if( 0 <= dotA && dotA <= 2.5 && Mathf.Abs(dotB) <= 1.5){
 							Vector3 unit = full/full.magnitude;
+							float fatnessDifference = fatness-player.fatness;

-							player.Attacked (unit, Mathf.Max(2+(fatness-player.fatness)/2, 1), 2);
+							player.Attacked (unit, Mathf.Max(MIN_SHOVE+FAT_SHOVE*fatnessDifference, 1), MIN_SHOVE);
 						}
-					}
+					}
 				}
 			}
 		}
-
 	}
 	/*
 	public void Shove(Vector3 unitVector, int networkId){
@@ -236,7 +281,7 @@
 	public void Attacked(Vector3 knockbackVector, float knockbackDistance, float fatLoss){
 		if(status != State.CHARGING){
 			//Charging is immune to knockback??
-			rigidbody.velocity = knockbackVector * MAX_SPEED;
+			rigidbody.velocity = knockbackVector * KNOCKBACK_SPEED;

 			distance = knockbackDistance;
 			updateFatness (-fatLoss);


Added symbolic matrix transpose as a MatExprType and the corresponding function to construct symbolic matrices as transposes of others


Remove unnecessary spaces

Remove unnecessary spaces

--- Authy.Net/AuthyClient.cs
+++ Authy.Net/AuthyClient.cs
@@ -62,8 +62,6 @@
             });
         }

-
-
         /// <summary>
         /// Verify a token with authy
         /// </summary>
@@ -131,7 +129,6 @@
                 return apiResponse;
             });
         }
-

         /// <summary>
         /// Send the token via phone call to a user who isn't registered.  If the user is registered with a mobile app then the phone call will be ignored.


CombinedDisassemblyExporter output should be aligned to left, not right

--- src/BenchmarkDotNet/Exporters/CombinedDisassemblyExporter.cs
+++ src/BenchmarkDotNet/Exporters/CombinedDisassemblyExporter.cs
@@ -10,6 +10,14 @@
 {
     public class CombinedDisassemblyExporter : ExporterBase
     {
+        internal const string CssDefinition = @"
+<style type=""text/css"">
+	table { border-collapse: collapse; display: block; width: 100%; overflow: auto; }
+	td, th { padding: 6px 13px; border: 1px solid #ddd; text-align: left; }
+	tr { background-color: #fff; border-top: 1px solid #ccc; }
+	tr:nth-child(even) { background: #f8f8f8; }
+</style>";
+
         private readonly IReadOnlyDictionary<BenchmarkCase, DisassemblyResult> results;

         public CombinedDisassemblyExporter(IReadOnlyDictionary<BenchmarkCase, DisassemblyResult> results)
@@ -32,7 +40,7 @@
             logger.WriteLine("<head>");
             logger.WriteLine("<meta charset='utf-8' />");
             logger.WriteLine($"<title>DisassemblyDiagnoser Output {summary.Title}</title>");
-            logger.WriteLine(HtmlExporter.CssDefinition);
+            logger.WriteLine(CssDefinition);
             logger.WriteLine("</head>");

             logger.WriteLine("<body>");


Got hash key clashes when using xsltviewengine

a referenced library instead of directly in the web app (i assume dll
scanning is at play here) fixed with a quick check.

--- src/Plugin.cs
+++ src/Plugin.cs
@@ -104,6 +104,10 @@
       foreach (string prefix in plugins.Keys)
       {
         Plugin plugin = plugins[prefix];
+        var extensionObject = xslArgs.GetExtensionObject(plugin.NamespaceUri);
+        if (extensionObject != null)
+          xslArgs.RemoveExtensionObject(plugin.NamespaceUri);
+
         xslArgs.AddExtensionObject(plugin.NamespaceUri, plugin);
       }
     }


AttackPlan: bugfix don't crash trying to draw off screen

--- TribalWars/Maps/AttackPlans/AttackManipulator.cs
+++ TribalWars/Maps/AttackPlans/AttackManipulator.cs
@@ -117,7 +117,7 @@
                         break;
                 }
             }
-            World.Default.Map.Invalidate(false);
+            _map.Invalidate(false);
         }

         private void RemoveAttacker(AttackPlan plan, AttackPlanFrom attacker)
@@ -154,25 +154,28 @@

             if (e.IsActiveManipulator && ActivePlan != null)
             {
-                // Paint circles around the active plan
-                using (var activeTargetPen = new Pen(Color.Yellow, 2))
-                {
-                    if (gameSize.Contains(ActivePlan.Target.Location))
-                    {
-                        Point villageLocation = _map.Display.GetMapLocation(ActivePlan.Target.Location);
-                        g.DrawEllipse(
-                            activeTargetPen,
-                            villageLocation.X,
-                            villageLocation.Y,
-                            villageSize.Width,
-                            villageSize.Height);
-
-                        g.DrawEllipse(
-                            activeTargetPen,
-                            villageLocation.X - 4,
-                            villageLocation.Y - 4,
-                            villageSize.Width + 8,
-                            villageSize.Height + 8);
+                if (_map.Display.IsVisible(ActivePlan.Target))
+                {
+                    // Paint circles around the active plan
+                    using (var activeTargetPen = new Pen(Color.Yellow, 2))
+                    {
+                        if (gameSize.Contains(ActivePlan.Target.Location))
+                        {
+                            Point villageLocation = _map.Display.GetMapLocation(ActivePlan.Target.Location);
+                            g.DrawEllipse(
+                                activeTargetPen,
+                                villageLocation.X,
+                                villageLocation.Y,
+                                villageSize.Width,
+                                villageSize.Height);
+
+                            g.DrawEllipse(
+                                activeTargetPen,
+                                villageLocation.X - 4,
+                                villageLocation.Y - 4,
+                                villageSize.Width + 8,
+                                villageSize.Height + 8);
+                        }
                     }
                 }

@@ -210,29 +213,32 @@

             if (ActivePlan != null)
             {
-                Point activePlanTargetLocation = World.Default.Map.Display.GetMapLocation(ActivePlan.Target.Location);
-
-                // The active plan attacked village
-                activePlanTargetLocation.Offset(villageSize.Width / 2, villageSize.Height / 2);
-                activePlanTargetLocation.Offset(-8, -48); // more - means to the top or the left
-                g.DrawImage(AttackIcons.FlagGreen, activePlanTargetLocation);
-
-                activePlanTargetLocation = World.Default.Map.Display.GetMapLocation(ActivePlan.Target.Location);
-                activePlanTargetLocation.Offset(villageSize.Width / 2, villageSize.Height / 2);
-                using (var font = new Font("Verdana", 10, FontStyle.Bold))
-                {
-                    g.DrawString(
-                        ActivePlan.Attacks.Count().ToString(CultureInfo.InvariantCulture),
-                        font,
-                        Brushes.Black,
-                        activePlanTargetLocation.X + 1,
-                        activePlanTargetLocation.Y - 40);
+                Point activePlanTargetLocation = _map.Display.GetMapLocation(ActivePlan.Target.Location);
+
+                if (_map.Display.IsVisible(ActivePlan.Target))
+                {
+                    // The active plan attacked village
+                    activePlanTargetLocation.Offset(villageSize.Width / 2, villageSize.Height / 2);
+                    activePlanTargetLocation.Offset(-8, -48); // more - means to the top or the left
+                    g.DrawImage(AttackIcons.FlagGreen, activePlanTargetLocation);
+
+                    activePlanTargetLocation = _map.Display.GetMapLocation(ActivePlan.Target.Location);
+                    activePlanTargetLocation.Offset(villageSize.Width / 2, villageSize.Height / 2);
+                    using (var font = new Font("Verdana", 10, FontStyle.Bold))
+                    {
+                        g.DrawString(
+                            ActivePlan.Attacks.Count().ToString(CultureInfo.InvariantCulture),
+                            font,
+                            Brushes.Black,
+                            activePlanTargetLocation.X + 1,
+                            activePlanTargetLocation.Y - 40);
+                    }
                 }

                 foreach (AttackPlanFrom attacker in FilterAttacksForDrawing(ActivePlan.Attacks, gameSize))
                 {
                     // Villages attacking the active target village
-                    activePlanTargetLocation = World.Default.Map.Display.GetMapLocation(attacker.Attacker.Location);
+                    activePlanTargetLocation = _map.Display.GetMapLocation(attacker.Attacker.Location);
                     activePlanTargetLocation.Offset(villageSize.Width / 2, villageSize.Height / 2);

                     if (villageSize.Width < VillageWidthToSwitchToSmallerFlags)
@@ -276,7 +282,7 @@
                         foreach (AttackPlanFrom attacker in FilterAttacksForDrawing(plan.Attacks, gameSize))
                         {
                             // Villages attacking other target villages
-                            loc = World.Default.Map.Display.GetMapLocation(attacker.Attacker.Location);
+                            loc = _map.Display.GetMapLocation(attacker.Attacker.Location);
                             loc.Offset(villageSize.Width / 2, villageSize.Height / 2);

                             if (villageSize.Width < VillageWidthToSwitchToSmallerFlags)


Add !uncall command

Add !uncall command

--- TwitchPlaysAssembly/Src/Commands/GameCommands.cs
+++ TwitchPlaysAssembly/Src/Commands/GameCommands.cs
@@ -585,6 +585,18 @@
 	[Command(@"call *count")]
 	public static void CallCountCommand() => IRCConnection.SendMessageFormat("{0} out of {1} calls needed.", TwitchGame.Instance.CallingPlayers.Count, TwitchGame.Instance.callsNeeded);

+	[Command(@"uncall")]
+	public static void RemoveQueuedPlayer(string user)
+	{
+		if (!TwitchGame.Instance.CallingPlayers.Contains(user))
+		{
+			IRCConnection.SendMessage($"@{0}, you haven't called yet!", user);
+			return;
+		}
+		TwitchGame.Instance.CallingPlayers.Remove(user);
+		IRCConnection.SendMessage($"@{0}, your call has been removed.", user);
+		CallCountCommand();
+	}
 	[Command(@"setmultiplier +(\d*\.?\d+)", AccessLevel.Admin, AccessLevel.Admin)]
 	public static void SetMultiplier([Group(1)] float multiplier) => OtherModes.SetMultiplier(multiplier);


Removed unnecessary code.

Removed unnecessary code.

--- UnityProject/Assets/Scripts/Doors/DoorTrigger.cs
+++ UnityProject/Assets/Scripts/Doors/DoorTrigger.cs
@@ -22,7 +22,6 @@

         public override void Interact(GameObject originator, Vector3 position, string hand)
         {
-            AccessRestrictions AR = GetComponent<AccessRestrictions>();

             // Close the door if it's open
             if(doorController.IsOpened && allowInput)


make alertlevelstring enum private

make alertlevelstring enum private


テストをわざと落とす

テストをわざと落とす

--- VSTSBuildBadge/VSTSBuildBadge.Tests/UnitTest1.cs
+++ VSTSBuildBadge/VSTSBuildBadge.Tests/UnitTest1.cs
@@ -9,6 +9,7 @@
         [TestMethod]
         public void TestMethod1()
         {
+            Assert.Fail();
         }
     }
 }


Add null check on operation context Check that OperationContext.Current is not null before checking for a client-side context

--- WCF/Shared/Implementation/WcfOperationContext.cs
+++ WCF/Shared/Implementation/WcfOperationContext.cs
@@ -105,7 +105,7 @@
         private static IOperationContext GetContext()
         {
             var owner = OperationContext.Current;
-            if ( owner.IsClientSideContext() )
+            if ( owner != null && owner.IsClientSideContext() )
             {
                 owner = null;
             }


ThickClient: refactor BaseClientWindow

ThickClient: refactor BaseClientWindow

* No need for a ctor of an abstract class to be public.
* Remove unneeded 'using' clauses.
* The ConfigureWindow() method was protected virtual but:
- Nobody was overriding it.
- Nobody was calling it.
So now it can be private and non-virtual, and we can encapsulate
some logic in it related to window configuration (previously it
was empty).

--- src/Core/Banshee.ThickClient/Banshee.Gui/BaseClientWindow.cs
+++ src/Core/Banshee.ThickClient/Banshee.Gui/BaseClientWindow.cs
@@ -32,11 +32,9 @@

 using Hyena;

-using Banshee.Base;
 using Banshee.ServiceStack;
 using Banshee.MediaEngine;
 using Banshee.Collection;
-using Banshee.Configuration;

 namespace Banshee.Gui
 {
@@ -61,15 +59,12 @@
         {
         }

-        public BaseClientWindow (string title, WindowConfiguration windowConfiguration) : base (title)
+        protected BaseClientWindow (string title, WindowConfiguration windowConfiguration) : base (title)
         {
             elements_service = ServiceManager.Get<GtkElementsService> ();
             action_service = ServiceManager.Get<InterfaceActionService> ();

-            ConfigureWindow ();
-
-            window_controller = new PersistentWindowController (this, windowConfiguration, WindowPersistOptions.All);
-            window_controller.Restore ();
+            ConfigureWindow (windowConfiguration);

             elements_service.PrimaryWindow = this;

@@ -156,8 +151,10 @@
             UpdateTitle ();
         }

-        protected virtual void ConfigureWindow ()
-        {
+        private void ConfigureWindow (WindowConfiguration windowConfiguration)
+        {
+            window_controller = new PersistentWindowController (this, windowConfiguration, WindowPersistOptions.All);
+            window_controller.Restore ();
         }

         protected override bool OnDeleteEvent (Gdk.Event evnt)


Changed name to lower case

Changed name to lower case

--- Cheers/Cheers/Program.cs
+++ Cheers/Cheers/Program.cs
@@ -12,14 +12,16 @@
         {
             System.Console.WriteLine("Hello there! What's your name?");
             string name = System.Console.ReadLine();
+            string lowName = name.ToLower();
             System.Console.WriteLine("Hi, " + name);
-            foreach (char letter in name)
+            foreach (char letter in lowName)
             {
                 string anLetters = "halfnorsemixHALFNORSEMIX";
                 if (anLetters.IndexOf(letter) == -1)
                 {
                     System.Console.WriteLine("Give me a .. " + letter);
                     System.Console.ReadLine();
+
                 }
                 else
                 {


Replaced path sys

Replaced path sys

--- ClientUpdater/Program.cs
+++ ClientUpdater/Program.cs
@@ -11,7 +11,7 @@
         {
             Console.WriteLine("This program will download the latest UNSTABLE version and replace your current LMPClient");

-            if (!File.Exists($@"{Directory.GetCurrentDirectory()}\KSP.exe"))
+            if (!File.Exists(Path.Combine(Directory.GetCurrentDirectory(), "KSP.exe")))
                 Console.WriteLine("Please drop \"Client LMP Updater\" in the main KSP folder next to KSP.exe!");
             else
             {


when test with DateTime.Now, only test datetime precision in seconds

--- NSupport.Test/TimeSpanDateTimeTest.cs
+++ NSupport.Test/TimeSpanDateTimeTest.cs
@@ -5,18 +5,18 @@
     public class TimeSpanDateTimeTest {
         [Fact]
         public void Test_Ago() {
-            Assert.Equal(DateTime.Now.AddSeconds(-1), new TimeSpan(0, 0, 1).Ago()); // seconds
-            Assert.Equal(DateTime.Now.AddMinutes(-1), new TimeSpan(0, 1, 0).Ago()); // minutes
-            Assert.Equal(DateTime.Now.AddHours(-1), new TimeSpan(1, 0, 0).Ago()); // hours
-            Assert.Equal(DateTime.Now.AddDays(-1), new TimeSpan(1, 0, 0, 0).Ago()); // days
+            AssertEqualDateTimePrecisionInSeconds(DateTime.Now.AddSeconds(-1), new TimeSpan(0, 0, 1).Ago()); // seconds
+            AssertEqualDateTimePrecisionInSeconds(DateTime.Now.AddMinutes(-1), new TimeSpan(0, 1, 0).Ago()); // minutes
+            AssertEqualDateTimePrecisionInSeconds(DateTime.Now.AddHours(-1), new TimeSpan(1, 0, 0).Ago()); // hours
+            AssertEqualDateTimePrecisionInSeconds(DateTime.Now.AddDays(-1), new TimeSpan(1, 0, 0, 0).Ago()); // days
         }

         [Fact]
         public void Test_FromNow() {
-            Assert.Equal(DateTime.Now.AddSeconds(1), new TimeSpan(0, 0, 1).FromNow()); // seconds
-            Assert.Equal(DateTime.Now.AddMinutes(1), new TimeSpan(0, 1, 0).FromNow()); // minutes
-            Assert.Equal(DateTime.Now.AddHours(1), new TimeSpan(1, 0, 0).FromNow()); // hours
-            Assert.Equal(DateTime.Now.AddDays(1), new TimeSpan(1, 0, 0, 0).FromNow()); // days
+            AssertEqualDateTimePrecisionInSeconds(DateTime.Now.AddSeconds(1), new TimeSpan(0, 0, 1).FromNow()); // seconds
+            AssertEqualDateTimePrecisionInSeconds(DateTime.Now.AddMinutes(1), new TimeSpan(0, 1, 0).FromNow()); // minutes
+            AssertEqualDateTimePrecisionInSeconds(DateTime.Now.AddHours(1), new TimeSpan(1, 0, 0).FromNow()); // hours
+            AssertEqualDateTimePrecisionInSeconds(DateTime.Now.AddDays(1), new TimeSpan(1, 0, 0, 0).FromNow()); // days
         }

         [Fact]
@@ -34,5 +34,14 @@
             Assert.Equal(new DateTime(2011, 6, 16, 1, 0, 0), new TimeSpan(1, 0, 0).Since(new DateTime(2011, 6, 16))); // hours
             Assert.Equal(new DateTime(2011, 6, 17, 0, 0, 0), new TimeSpan(1, 0, 0, 0).Since(new DateTime(2011, 6, 16))); // days
         }
+
+        public void AssertEqualDateTimePrecisionInSeconds(DateTime expected, DateTime actual) {
+            Assert.Equal(expected.Year, actual.Year);
+            Assert.Equal(expected.Month, actual.Month);
+            Assert.Equal(expected.Day, actual.Day);
+            Assert.Equal(expected.Hour, actual.Hour);
+            Assert.Equal(expected.Minute, actual.Minute);
+            Assert.Equal(expected.Second, actual.Second);
+        }
     }
 }


Tests for configuration immutability

Tests for configuration immutability

--- AngleSharp.Core.Tests/Library/BasicConfiguration.cs
+++ AngleSharp.Core.Tests/Library/BasicConfiguration.cs
@@ -1,5 +1,6 @@
 namespace AngleSharp.Core.Tests.Library
 {
+    using System.Linq;
     using AngleSharp.Dom.Css;
     using AngleSharp.Extensions;
     using AngleSharp.Network;
@@ -21,6 +22,28 @@
         }

         [Test]
+        public void ConfigurationWithExtensionLeavesOriginallyUnmodified()
+        {
+            var original = new Configuration();
+            var modified = original.WithCss();
+            Assert.AreNotSame(original, modified);
+            Assert.AreNotEqual(original.Services.Count(), modified.Services.Count());
+            Assert.AreSame(original.Events, modified.Events);
+            Assert.AreSame(original.Culture, modified.Culture);
+        }
+
+        [Test]
+        public void ConfigurationSetCultureExtensionLeavesOriginallyUnmodified()
+        {
+            var original = new Configuration();
+            var modified = original.SetCulture("de-at");
+            Assert.AreNotSame(original, modified);
+            Assert.AreEqual(original.Services.Count(), modified.Services.Count());
+            Assert.AreSame(original.Events, modified.Events);
+            Assert.AreNotSame(original.Culture, modified.Culture);
+        }
+
+        [Test]
         public void ObtainDefaultSheet()
         {
             var engine = new CssStyleEngine();