Added fluent interface for setting values in the ISerializationContext

--- src/Kephas.Core/Serialization/ISerializationContext.cs
+++ src/Kephas.Core/Serialization/ISerializationContext.cs
@@ -11,7 +11,9 @@
 namespace Kephas.Serialization
 {
     using System;
+    using System.Runtime.CompilerServices;

+    using Kephas.Diagnostics.Contracts;
     using Kephas.Services;

     /// <summary>
@@ -67,4 +69,95 @@
         /// </value>
         bool IncludeTypeInfo { get; set; }
     }
+
+    /// <summary>
+    /// Extension methods for <see cref="ISerializationContext"/>.
+    /// </summary>
+    public static class SerializationContextExtensions {
+
+        /// <summary>
+        /// Sets a value indicating whether to indent the serialized value.
+        /// </summary>
+        /// <param name="context">The serialization context.</param>
+        /// <param name="value">True to indent, false otherwise.</param>
+        /// <returns>
+        /// This <see cref="ISerializationContext"/>.
+        /// </returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public static ISerializationContext Indent(this ISerializationContext context, bool value)
+        {
+            Requires.NotNull(context, nameof(context));
+
+            context.Indent = value;
+            return context;
+        }
+
+        /// <summary>
+        /// Sets a value indicating whether to include the type information in the serialized value.
+        /// </summary>
+        /// <param name="context">The serialization context.</param>
+        /// <param name="value">True to include type information, false otherwise.</param>
+        /// <returns>
+        /// This <see cref="ISerializationContext"/>.
+        /// </returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public static ISerializationContext IncludeTypeInfo(this ISerializationContext context, bool value)
+        {
+            Requires.NotNull(context, nameof(context));
+
+            context.IncludeTypeInfo = value;
+            return context;
+        }
+
+        /// <summary>
+        /// Sets the root object type.
+        /// </summary>
+        /// <param name="context">The serialization context.</param>
+        /// <param name="value">The root object type.</param>
+        /// <returns>
+        /// This <see cref="ISerializationContext"/>.
+        /// </returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public static ISerializationContext RootObjectType(this ISerializationContext context, Type value)
+        {
+            Requires.NotNull(context, nameof(context));
+
+            context.RootObjectType = value;
+            return context;
+        }
+
+        /// <summary>
+        /// Sets the root object factory.
+        /// </summary>
+        /// <param name="context">The serialization context.</param>
+        /// <param name="value">The root object factory.</param>
+        /// <returns>
+        /// This <see cref="ISerializationContext"/>.
+        /// </returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public static ISerializationContext RootObjectFactory(this ISerializationContext context, Func<object> value)
+        {
+            Requires.NotNull(context, nameof(context));
+
+            context.RootObjectFactory = value;
+            return context;
+        }
+
+        /// <summary>
+        /// Sets the media type.
+        /// </summary>
+        /// <param name="context">The serialization context.</param>
+        /// <param name="value">The media type.</param>
+        /// <returns>
+        /// This <see cref="ISerializationContext"/>.
+        /// </returns>
+        [MethodImpl(MethodImplOptions.AggressiveInlining)]
+        public static ISerializationContext MediaType(this ISerializationContext context, Type value)
+        {
+            Requires.NotNull(context, nameof(context));
+
+            context.MediaType = value;
+            return context;
+        }
+    }
 }


Lucene.Net.TestFramework.Analysis.MockTokenizer: used new keyword on State enum since a base class has a nested class with the same name. Added override keyword to SetReaderTestPoint().

--- src/Lucene.Net.TestFramework/Analysis/MockTokenizer.cs
+++ src/Lucene.Net.TestFramework/Analysis/MockTokenizer.cs
@@ -78,7 +78,7 @@
         // TODO: "register" with LuceneTestCase to ensure all streams are closed() ?
         // currently, we can only check that the lifecycle is correct if someone is reusing,
         // but not for "one-offs".
-        private enum State
+        new private enum State
         {
             SETREADER, // consumer set a reader input either via ctor or via reset(Reader)
             RESET, // consumer has called reset()
@@ -314,7 +314,7 @@
             StreamState = State.CLOSE;
         }

-        internal bool SetReaderTestPoint()
+        internal override bool SetReaderTestPoint()
         {
             Assert.True(!EnableChecks_Renamed || StreamState == State.CLOSE, "setReader() called in wrong state: " + StreamState);
             StreamState = State.SETREADER;


Don't capture connection on closure

Don't capture connection on closure

--- src/Microsoft.AspNet.Server.Kestrel/Http/Connection.cs
+++ src/Microsoft.AspNet.Server.Kestrel/Http/Connection.cs
@@ -13,8 +13,10 @@
 {
     public class Connection : ConnectionContext, IConnectionControl
     {
-        private static readonly Action<UvStreamHandle, int, object> _readCallback = ReadCallback;
-        private static readonly Func<UvStreamHandle, int, object, Libuv.uv_buf_t> _allocCallback = AllocCallback;
+        private static readonly Action<UvStreamHandle, int, object> _readCallback =
+            (handle, status, state) => ReadCallback(handle, status, state);
+        private static readonly Func<UvStreamHandle, int, object, Libuv.uv_buf_t> _allocCallback =
+            (handle, suggestedsize, state) => AllocCallback(handle, suggestedsize, state);

         private static long _lastConnectionId;

@@ -83,12 +85,12 @@
                     if (task.IsFaulted)
                     {
                         connection.Log.LogError("ConnectionFilter.OnConnection", task.Exception);
-                        ConnectionControl.End(ProduceEndType.SocketDisconnect);
+                        connection.ConnectionControl.End(ProduceEndType.SocketDisconnect);
                     }
                     else if (task.IsCanceled)
                     {
                         connection.Log.LogError("ConnectionFilter.OnConnection Canceled");
-                        ConnectionControl.End(ProduceEndType.SocketDisconnect);
+                        connection.ConnectionControl.End(ProduceEndType.SocketDisconnect);
                     }
                     else
                     {


update DfmVideoBlockRule. (#1475)

update DfmVideoBlockRule. (#1475)

--- src/Microsoft.DocAsCode.Dfm/Rules/DfmVideoBlockRule.cs
+++ src/Microsoft.DocAsCode.Dfm/Rules/DfmVideoBlockRule.cs
@@ -7,12 +7,30 @@
     using System.Text.RegularExpressions;

     using Microsoft.DocAsCode.MarkdownLite;
+    using Microsoft.DocAsCode.MarkdownLite.Matchers;

     public class DfmVideoBlockRule : IMarkdownRule
     {
+        private static readonly Matcher _VideoMatcher =
+            Matcher.WhiteSpacesOrEmpty + Matcher.CaseInsensitiveString("[!video") + Matcher.WhiteSpaces +
+            (
+                Matcher.String("http") + Matcher.Char('s').Maybe() + "://" +
+                (
+                    Matcher.AnyCharNotIn('\n', ' ', ']').RepeatAtLeast(1) |
+                    (Matcher.ReverseTest(Matcher.Char('\\')) + ']')
+                ).RepeatAtLeast(1)
+            ).ToGroup("link") +
+            Matcher.WhiteSpacesOrEmpty + ']' + Matcher.WhiteSpacesOrEmpty +
+            (Matcher.NewLine.RepeatAtLeast(1) | Matcher.EndOfString);
+
         private static readonly Regex _videoRegex = new Regex(@"^ *\[\!Video +(?<link>https?\:\/\/.+?) *\] *(\n|$)", RegexOptions.Compiled | RegexOptions.IgnoreCase, TimeSpan.FromSeconds(10));
+
         public virtual string Name => "DfmVideoBlock";
+
+        [Obsolete("Please use VideoMatcher.")]
         public virtual Regex VideoRegex => _videoRegex;
+
+        public virtual Matcher VideoMatcher => _VideoMatcher;

         public IMarkdownToken TryMatch(IMarkdownParser parser, IMarkdownParsingContext context)
         {
@@ -20,7 +38,21 @@
             {
                 return null;
             }
+            if (VideoRegex != _videoRegex)
+            {
+                return TryMatchOld(parser, context);
+            }
+            var match = context.Match(VideoMatcher);
+            if (match?.Length > 0)
+            {
+                var sourceInfo = context.Consume(match.Length);
+                return new DfmVideoBlockToken(this, parser.Context, StringHelper.UnescapeMarkdown(match["link"].GetValue()), sourceInfo);
+            }
+            return null;
+        }

+        public IMarkdownToken TryMatchOld(IMarkdownParser parser, IMarkdownParsingContext context)
+        {
             var match = VideoRegex.Match(context.CurrentMarkdown);
             if (match.Length == 0)
             {


Fix ScriptRuntime.ToString with boolean values

--- src/Rhino/ScriptRuntime.cs
+++ src/Rhino/ScriptRuntime.cs
@@ -933,9 +933,9 @@
 				{
 					return (string)val;
 				}
-				if (val is string)
-				{
-					return val.ToString();
+				if (val is bool)
+				{
+					return ((bool) val) ? "true" : "false";
 				}
 				if (val.IsNumber())
 				{


Expose access to refreshed version of light

--- LifxHttp/Light.cs
+++ LifxHttp/Light.cs
@@ -134,11 +134,20 @@
         }

         /// <summary>
+        /// Re-requests light information
+        /// </summary>
+        /// <returns>A new instance of this light returned from API</returns>
+        public async Task<Light> GetRefreshed()
+        {
+            return (await Client.ListLights(this)).First();
+        }
+
+        /// <summary>
         /// Re-requests light information and updates all properties
         /// </summary>
         public async Task Refresh()
         {
-            Light light = (await Client.ListLights(this)).First();
+            Light light = await GetRefreshed();
             Id = light.Id;
             UUID = light.UUID;
             Label = light.Label;


Message support checking done inside the message itself

svn path=/trunk/bitsharp/; revision=71786

--- src/MonoTorrent.Client/PeerMessages/PeerwireEncoder.cs
+++ src/MonoTorrent.Client/PeerMessages/PeerwireEncoder.cs
@@ -50,8 +50,6 @@
             switch (buffer[offset])
             {
                 case AllowedFastMessage.MessageId:
-                    if (!ClientEngine.SupportsFastPeer)
-                        throw new ProtocolException("Message not supported");
                     message = new AllowedFastMessage();
                     break;

@@ -72,8 +70,6 @@
                     break;

                 case HaveAllMessage.MessageId:
-                    if (!ClientEngine.SupportsFastPeer)
-                        throw new ProtocolException("Message not supported");
                     message = new HaveAllMessage();
                     break;

@@ -82,8 +78,6 @@
                     break;

                 case HaveNoneMessage.MessageId:
-                    if (!ClientEngine.SupportsFastPeer)
-                        throw new ProtocolException("Message not supported");
                     message = new HaveNoneMessage();
                     break;

@@ -104,8 +98,6 @@
                     break;

                 case RejectRequestMessage.MessageId:
-                    if (!ClientEngine.SupportsFastPeer)
-                        throw new ProtocolException("Message not supported");
                     message = new RejectRequestMessage();
                     break;

@@ -114,8 +106,6 @@
                     break;

                 case SuggestPieceMessage.MessageId:
-                    if (!ClientEngine.SupportsFastPeer)
-                        throw new ProtocolException("Message not supported");
                     message = new SuggestPieceMessage();
                     break;

@@ -125,8 +115,6 @@

                 case 21:                            // An "extended" message
-                    if (!ClientEngine.SupportsFastPeer)
-                        throw new ProtocolException("Message not supported");
                     switch (IPAddress.NetworkToHostOrder(BitConverter.ToInt32(buffer, ++offset)))
                     {
                         default:
@@ -136,7 +124,6 @@
                 default:
                     message = new UnknownMessage();
                     break;
-#warning This should also be handled. Does the spec call for closing or ignoring? Closing iirc.
             }

             // The message length is given in the second byte and the message body follows directly after that


Fix configuration for SQSMessagingScenarioFactory

--- Rock.Messaging.SQS/MQ/SQSMessagingScenarioFactory.cs
+++ Rock.Messaging.SQS/MQ/SQSMessagingScenarioFactory.cs
@@ -1,5 +1,7 @@
 using Amazon.SQS;
 using System;
+using System.Collections.Generic;
+using System.Linq;

 #if ROCKLIB
 namespace RockLib.Messaging.SQS
@@ -9,19 +11,30 @@
 {
     public class SQSMessagingScenarioFactory : IMessagingScenarioFactory
     {
-        private readonly ISQSConfigurationProvider _configurationProvider;
+        private ISQSConfigurationProvider _configurationProvider;

+#if ROCKLIB
+
+        private List<SQSConfiguration> _sqsSettings;
+
+        public List<SQSConfiguration> SQSSettings
+        {
+            get => _sqsSettings;
+            set
+            {
+                _sqsSettings = value;
+                _configurationProvider = new SQSConfigurationProvider
+                {
+                    Configurations = value.ToArray<ISQSConfiguration>()
+                };
+            }
+        }
+#else
         public SQSMessagingScenarioFactory(ISQSConfigurationProvider configurationProvider)
         {
             _configurationProvider = configurationProvider ?? throw new ArgumentNullException(nameof(configurationProvider));
         }

-#if ROCKLIB
-        public SQSMessagingScenarioFactory(SQSConfigurationProvider sqsSettings)
-            : this((ISQSConfigurationProvider)sqsSettings)
-        {
-        }
-#else
         public SQSMessagingScenarioFactory(XmlDeserializingSQSConfigurationProvider sqsSettings)
             : this((ISQSConfigurationProvider)sqsSettings)
         {


Ajuste Referencia!!!

Ajuste Referencia!!!

--- src/MotorTributarioNet/Impostos/ResultadoTributacao.cs
+++ src/MotorTributarioNet/Impostos/ResultadoTributacao.cs
@@ -231,6 +231,7 @@
         private TributacaoDifal calcularDifal()
         {

+
             return null;
         }


Use lower case controller name which looks better in routes

--- src/MvcHaack.ControllerInspector/ControllerDetailer.cs
+++ src/MvcHaack.ControllerInspector/ControllerDetailer.cs
@@ -114,7 +114,7 @@

             return urlHelper.Action(
                 actionNameAttrib != null ? actionNameAttrib.Name : action.ActionName,
-                action.ControllerDescriptor.ControllerName,
+                action.ControllerDescriptor.ControllerName.ToLowerInvariant(),
                 routeValues);
         }


Add test for version height with path filters and merge conflict

This demonstrates the repro for #658

--- src/NerdBank.GitVersioning.Tests/VersionOracleTests.cs
+++ src/NerdBank.GitVersioning.Tests/VersionOracleTests.cs
@@ -752,6 +752,38 @@
     }

     [Fact]
+    public void GetVersion_PathFilterPlusMerge()
+    {
+        this.InitializeSourceControl(withInitialCommit: false);
+        this.WriteVersionFile(new VersionOptions
+        {
+            Version = new SemanticVersion("1.0"),
+            PathFilters = new FilterPath[] { new FilterPath(".", string.Empty) },
+        });
+
+        string conflictedFilePath = Path.Combine(this.RepoPath, "foo.txt");
+
+        File.WriteAllText(conflictedFilePath, "foo");
+        Commands.Stage(this.LibGit2Repository, conflictedFilePath);
+        this.LibGit2Repository.Commit("Add foo.txt with foo content.", this.Signer, this.Signer);
+        Branch originalBranch = this.LibGit2Repository.Head;
+
+        Branch topicBranch = this.LibGit2Repository.Branches.Add("topic", "HEAD~1");
+        Commands.Checkout(this.LibGit2Repository, topicBranch);
+        File.WriteAllText(conflictedFilePath, "bar");
+        Commands.Stage(this.LibGit2Repository, conflictedFilePath);
+        this.LibGit2Repository.Commit("Add foo.txt with bar content.", this.Signer, this.Signer);
+
+        Commands.Checkout(this.LibGit2Repository, originalBranch);
+        MergeResult result = this.LibGit2Repository.Merge(topicBranch, this.Signer, new MergeOptions { FileConflictStrategy = CheckoutFileConflictStrategy.Ours });
+        Assert.Equal(MergeStatus.Conflicts, result.Status);
+        Commands.Stage(this.LibGit2Repository, conflictedFilePath);
+        this.LibGit2Repository.Commit("Merge two branches", this.Signer, this.Signer);
+
+        Assert.Equal(3, this.GetVersionHeight());
+    }
+
+    [Fact]
     public void GetVersionHeight_ProjectDirectoryDifferentToVersionJsonDirectory()
     {
         this.InitializeSourceControl();


assigning `new` by ref does not have any effect

This is a deprecated construct only used in PHP 4. This is not ignored since objects are passed by reference always.

--- src/Peachpie.CodeAnalysis/Semantics/SemanticsBinder.cs
+++ src/Peachpie.CodeAnalysis/Semantics/SemanticsBinder.cs
@@ -986,6 +986,13 @@
         protected BoundExpression BindNew(AST.NewEx x, BoundAccess access)
         {
             Debug.Assert(access.IsRead || access.IsReadRef || access.IsNone);
+
+            if (access.IsReadRef)
+            {
+                // assigning `new` by reference is deprecated,
+                // this is not intended to create an alias
+                access = BoundAccess.Read;
+            }

             return new BoundNewEx(BindTypeRef(x.ClassNameRef, objectTypeInfoSemantic: true), BindArguments(x.CallSignature.Parameters))
                 .WithAccess(access);


Improves comments in GeneratorsSemanticBinder.

--- src/Peachpie.CodeAnalysis/Semantics/SemanticsBinder.cs
+++ src/Peachpie.CodeAnalysis/Semantics/SemanticsBinder.cs
@@ -892,6 +892,8 @@
             if (!rightExprBag.IsOnlyBoundElement)
             {
                 // make a defensive copy if multiple evaluations could be a problem for left expr (which serves as the condition)
+                // no need to worry about order of execution: right bag contains preBoundStatements
+                // .. -> we are on yield<>root path -> expression to the left are already prepended
                 leftExpr = MakeTmpCopyAndPrependAssigment(leftExpr, BoundAccess.Read);

                 // create a condition expr. that is true only when right operand would have to be evaluated
@@ -947,11 +949,16 @@

             // if at least branch has any pre-bound statements we need to condition them
             if (!trueExprBag.IsOnlyBoundElement || !falseExprBag.IsOnlyBoundElement)
-            {
+            {
+                // make a defensive copy of condition, would be evaluated twice otherwise (conditioned prebound blocks and original position)
+                // no need to worry about order of execution: either true or false branch contains preBoundStatements
+                // .. -> we are on yield<>root path -> expression to the left are already prepended
                 condExpr = MakeTmpCopyAndPrependAssigment(condExpr, BoundAccess.Read);
+
                 // create a conditional edge and set the last (current) pre-bound block to the conditional edge's end block
                 CurrentPreBoundBlock = CreateConditionalEdge(currBlock, condExpr,
-                    trueExprBag.PreBoundBlockFirst, trueExprBag.PreBoundBlockLast, falseExprBag.PreBoundBlockFirst, falseExprBag.PreBoundBlockLast);
+                    trueExprBag.PreBoundBlockFirst, trueExprBag.PreBoundBlockLast,
+                    falseExprBag.PreBoundBlockFirst, falseExprBag.PreBoundBlockLast);
             }

             return new BoundConditionalEx(


MP v14.8.1 修复几处GetNoncestr还在使用GBK编码

MP v14.8.1 修复几处GetNoncestr还在使用GBK编码

--- src/Senparc.Weixin/Senparc.Weixin/Trace/WeixinTrace.cs
+++ src/Senparc.Weixin/Senparc.Weixin/Trace/WeixinTrace.cs
@@ -109,7 +109,7 @@
 #else

 #if NET40 || NET45 || NET461
-                var logDir = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "App_Data", "WeixinTraceLog");
+                logDir = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "App_Data", "WeixinTraceLog");
 #else
                 //var logDir = Path.Combine(AppContext.BaseDirectory, "App_Data", "WeixinTraceLog");
                 logDir = Path.Combine(Senparc.Weixin.Config.RootDictionaryPath, "App_Data", "WeixinTraceLog");


fixed bug in ToInsertRowCreation (alias was ignored)

--- src/ServiceStack.OrmLite/OrmLiteDialectProviderBase.cs
+++ src/ServiceStack.OrmLite/OrmLiteDialectProviderBase.cs
@@ -421,14 +421,14 @@
             {
                 if (fieldDef.AutoIncrement) continue;

-				if( insertFields.Count>0 && !insertFields.Contains( fieldDef.Name )) continue;
+				if( insertFields.Count>0 && !insertFields.Contains( fieldDef.FieldName )) continue;

                 if (sbColumnNames.Length > 0) sbColumnNames.Append(",");
                 if (sbColumnValues.Length > 0) sbColumnValues.Append(",");

                 try
                 {
-                    sbColumnNames.Append(GetNameDelimited(fieldDef.Name));
+                    sbColumnNames.Append(GetNameDelimited(fieldDef.FieldName));
                     sbColumnValues.Append(fieldDef.GetQuotedValue(objWithProperties));
                 }
                 catch (Exception ex)


fixing modified properties appearing correctly

--- Source/EntityFramework.Extended/Audit/AuditLogger.cs
+++ Source/EntityFramework.Extended/Audit/AuditLogger.cs
@@ -254,22 +254,25 @@
                 if (Configuration.IsNotAudited(type, name))
                     continue;

-                bool isModified = modifiedMembers.Any(m => m == name);
-
-                if (state.IsModified && !isModified
-                  && !Configuration.IsAlwaysAudited(type, name))
-                    continue; // this means the property was not changed, skip it
-
                 var auditProperty = new AuditProperty();
+
                 try
                 {
+                    var currentValue = currentValues.GetValue(name);
+                    var originalValue = originalValues.GetValue(name);
+
+                    bool isModified = modifiedMembers.Any(m => m == name);
+
+                    if (state.IsModified && !isModified && !Configuration.IsAlwaysAudited(type, name))
+                        continue; // this means the property was not changed, skip it
+
                     auditProperty.Name = name;
                     auditProperty.Type = GetType(edmProperty);

-                    var currentValue = currentValues.GetValue(name);
+                    //var currentValue = currentValues.GetValue(name);
                     currentValue = FormatValue(state, name, currentValue);

-                    if (!state.IsModified && currentValue == null)
+                    if ((!state.IsModified && currentValue == null) || (originalValue == null && currentValue == null) || currentValue.Equals(originalValue))
                         continue; // ignore null properties?

                     switch (state.AuditEntity.Action)
@@ -282,7 +285,6 @@

                             if (originalValues != null)
                             {
-                                object originalValue = originalValues.GetValue(edmProperty.Name);
                                 originalValue = FormatValue(state, name, originalValue);

                                 auditProperty.Original = originalValue;


win32 updates

win32 updates

--- Source/HtmlRenderer.WinForms/Utilities/Win32Utils.cs
+++ Source/HtmlRenderer.WinForms/Utilities/Win32Utils.cs
@@ -141,10 +141,10 @@
         public static extern int SetBkMode(IntPtr hdc, int mode);

         [DllImport("gdi32.dll")]
-        public static extern int SelectObject(IntPtr hdc, IntPtr hgdiObj);
-
-        [DllImport("gdi32.dll")]
-        public static extern int SetTextColor(IntPtr hdc, int color);
+        public static extern IntPtr SelectObject(IntPtr hdc, IntPtr hgdiObj);
+
+        [DllImport("gdi32.dll")]
+        public static extern uint SetTextColor(IntPtr hdc, int color);

         [DllImport("gdi32.dll", CharSet = CharSet.Unicode)]
         public static extern bool GetTextMetrics(IntPtr hdc, out TextMetric lptm);
@@ -172,7 +172,7 @@

         [DllImport("gdi32.dll")]
         [return: MarshalAs(UnmanagedType.Bool)]
-        public static extern bool BitBlt(IntPtr hdc, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, int dwRop);
+        public static extern bool BitBlt(IntPtr hdc, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, uint dwRop);

         [DllImport("gdi32.dll", EntryPoint = "GdiAlphaBlend")]
         public static extern bool AlphaBlend(IntPtr hdcDest, int nXOriginDest, int nYOriginDest, int nWidthDest, int nHeightDest, IntPtr hdcSrc, int nXOriginSrc, int nYOriginSrc, int nWidthSrc, int nHeightSrc, BlendFunction blendFunction);


Remove RedirectToCanonicalUrl whitespace

--- Source/MVC6/Boilerplate.AspNetCore.Sample/Startup.cs
+++ Source/MVC6/Boilerplate.AspNetCore.Sample/Startup.cs
@@ -124,8 +124,8 @@
                     {
                         // $Start-RedirectToCanonicalUrl$
                         this.routeOptions = options;
+
                         // $End-RedirectToCanonicalUrl$
-
                         // Improve SEO by stopping duplicate URL's due to case differences or trailing slashes.
                         // See http://googlewebmastercentral.blogspot.co.uk/2010/04/to-slash-or-not-to-slash.html
                         // All generated URL's should append a trailing slash.


expose ReavticeProperty.RaiseEventScheduler and IsDictinctUntilChanged and IsRaiseLatestValueOnSubscribe

--- Source/ReactiveProperty.Portable/ReactiveProperty.cs
+++ Source/ReactiveProperty.Portable/ReactiveProperty.cs
@@ -42,9 +42,9 @@

         private T LatestValue { get; set; }
         private bool IsDisposed { get; set; } = false;
-        private IScheduler RaiseEventScheduler { get; }
-        private bool IsDistinctUntilChanged { get; }
-        private bool IsRaiseLatestValueOnSubscribe { get; }
+        public IScheduler RaiseEventScheduler { get; }
+        public bool IsDistinctUntilChanged { get; }
+        public bool IsRaiseLatestValueOnSubscribe { get; }

         private Subject<T> Source { get; } = new Subject<T>();
         private IDisposable SourceDisposable { get; }


Disconnecting a hot observable does not call onNext.

--- Source/ReactiveTests/Tests/HotColdObservableTests.cs
+++ Source/ReactiveTests/Tests/HotColdObservableTests.cs
@@ -3,6 +3,7 @@
 using System.Reactive;
 using System.Reactive.Disposables;
 using System.Reactive.Linq;
+using System.Threading;

 namespace ReactiveTests.Tests
 {
@@ -87,5 +88,30 @@
       // Connect actually instantiates the subscription.
       Assert.True(isCreated);
     }
+
+    [Test]
+    public void DisposingAConnectableDisposableDisconnectsTheSequence()
+    {
+      var coldInterval = Observable.Interval(TimeSpan.FromMilliseconds(10));
+      var hotInterval = coldInterval.Publish();
+      var hotConnection = hotInterval.Connect();
+
+      var onNextWasCalled = false;
+      var subscription = hotInterval.Subscribe(_ => onNextWasCalled = true );
+      Thread.Sleep(100);
+      subscription.Dispose();
+      Assert.True(onNextWasCalled);
+
+      // Now disconnect the observable so it stops publishing
+      hotConnection.Dispose();
+
+      onNextWasCalled = false;
+      subscription = hotInterval.Subscribe(_ => onNextWasCalled = true );
+
+      Thread.Sleep(100);
+      subscription.Dispose();
+      // Calling subscribe on a disconnected hot observable should do nothing
+      Assert.False(onNextWasCalled);
+    }
   }
 }


Fixes #2 by allowing for the publication on subscribers to continue after posting a publication to a subscription missing a MessageVerbosityAttribute.

--- Src/MudEngine.Core/MessageBrokering/MessageBroker.cs
+++ Src/MudEngine.Core/MessageBrokering/MessageBroker.cs
@@ -106,7 +106,7 @@
                 if (attribute == null)
                 {
                     handler.ProcessMessage(message);
-                    return;
+                    continue;
                 }

                 if (attribute.Scope == this.scope || this.scope == MessageScope.Full)


Clean up logging and change command format to accept a single template as parameter.

--- TeamCityBuildChanges/Commands/TestTemplateCommand.cs
+++ TeamCityBuildChanges/Commands/TestTemplateCommand.cs
@@ -15,12 +15,15 @@
         public TestTemplate()
         {
             IsCommand("testtemplate", "When run, will watch a template file, and regenerate a HTML file against a generated Model.");
-            HasRequiredOption("t|template=", "Template to watch.", s => _templateFile = s);
             HasOption("o|output=", "Output filename.", s => _outputFilename = s);
-
+            HasAdditionalArguments(1,"Provide the path to the template file to watch.");
         }
         public override int Run(string[] remainingArguments)
         {
+            if (RemainingArgumentsCount != 1) throw new ArgumentException("Please provide the path to the template file to parse.");
+
+            _templateFile = remainingArguments[0];
+
             if (!File.Exists(_templateFile)) throw new ArgumentException("Please provide a template file that exists.");

             var resolver = CreateMockedAggregateBuildDeltaResolver();
@@ -28,6 +31,7 @@
             var result = resolver.CreateChangeManifestFromBuildTypeId("bt1", null, "1.2", "1.6");
             var renderer = new RazorOutputRenderer(_templateFile);

+            Console.WriteLine("Running Render on File Change - Hit ENTER to EXIT.");
             if (!File.Exists(_outputFilename ?? "Output.html")) TryToRender(renderer, result, "Rendering on first run...");

             var watcher = new FileSystemWatcher
@@ -38,8 +42,7 @@
                     NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.Size | NotifyFilters.CreationTime
                 };

-            watcher.Changed += (o, e) => TryToRender(renderer, result, "Detected the file has changed, running renderer...");
-            watcher.Created += (o, e) => TryToRender(renderer, result, "Detected the file has changed, running renderer...");
+            watcher.Changed += (o, e) => TryToRender(renderer, result, "Detected template has changed, running renderer...");

             Console.Read();
             return 0;
@@ -49,25 +52,55 @@
         {
             try
             {
-                Console.WriteLine(message);
+                ConsoleOutputWithColourToggle(message, ConsoleColor.White, Console.Write);
                 var results = renderer.Render(result);
                 if (!string.IsNullOrEmpty(results))
+                {
                     File.WriteAllText(_outputFilename ?? "Output.html", results);
+                    ConsoleOutputWithColourToggle("success! Please refresh browser.", ConsoleColor.Green, Console.Write);
+                }
                 else
-                    Console.WriteLine("Did not render any output, nothing written...");
+                {
+                    ConsoleOutputWithColourToggle("failed.  Nothing written...", ConsoleColor.Red, Console.Write);
+                }
+                Console.WriteLine();
             }
             catch (Exception ex)
             {
                 Console.Clear();
-                Console.WriteLine("Failed to render template, fix it, save it and I will try again...");
+                ConsoleOutputWithColourToggle("Failed to render template, fix it, save it and I will try again...", ConsoleColor.Red, Console.WriteLine);
                 Console.WriteLine();
-                Console.WriteLine(ex.ToString());
+                ConsoleOutputWithColourToggle(ex.ToString(), ConsoleColor.Yellow, Console.WriteLine);
             }
+        }
+
+        private static void ConsoleOutputWithColourToggle(string message, ConsoleColor colour, Action<string> log)
+        {
+            var oldColour = Console.ForegroundColor;
+            Console.ForegroundColor = colour;
+            log(message);
+            Console.ForegroundColor = oldColour;
         }

         private static AggregateBuildDeltaResolver CreateMockedAggregateBuildDeltaResolver()
         {
-            return TestHelpers.CreateMockedAggregateBuildDeltaResolver(new[] { new BuildTemplate { BuildId = "bt1", BuildName = "Build1", BuildCount = 15, BuildNumberPattern = "1.{0}", StartBuildNumber = 2, FinishBuildNumber = 4, StartBuildPackages = new Dictionary<string, string> { { "Package1", "1.0" }, { "Package2", "1.0" } }, FinishBuildPackages = new Dictionary<string, string> { { "Package1", "1.1" }, { "Package2", "1.0" } }, IssueCount = 5, NestedIssueDepth = 1, NestedIssueChance = 80 } });
+            return TestHelpers.CreateMockedAggregateBuildDeltaResolver(new[]
+                {
+                    new BuildTemplate
+                        {
+                            BuildId = "bt1",
+                            BuildName = "Build1",
+                            BuildCount = 15,
+                            BuildNumberPattern = "1.{0}",
+                            StartBuildNumber = 2,
+                            FinishBuildNumber = 4,
+                            StartBuildPackages = new Dictionary<string, string> { { "Package1", "1.0" }, { "Package2", "1.0" } },
+                            FinishBuildPackages = new Dictionary<string, string> { { "Package1", "1.1" }, { "Package2", "1.0" } },
+                            IssueCount = 5,
+                            NestedIssueDepth = 1,
+                            NestedIssueChance = 80
+                        }
+                });
         }
     }
 }


Delete Processor.cs

Delete Processor.cs

--- TextEditor/TestConsole/CommandProcessor/Processor.cs
+++ TextEditor/TestConsole/CommandProcessor/Processor.cs
@@ -1,256 +0,0 @@
-using Kernel.CommandProcessor.Commands;
-using Kernel.CommandProcessor.Text;
-using System;
-using System.Collections.Generic;
-using System.IO;
-
-namespace Kernel.CommandProcessor
-{
-    public class Processor
-    {
-        static List<BaseCommand> Commands = new List<BaseCommand>();
-        static TextInput textInput = null;
-        static List<string> batchExtentions = new List<string> { ".bat", ".cmd" };
-
-        static Processor()
-        {
-            Commands.Add(new Cd());
-            Commands.Add(new Del());
-            Commands.Add(new Dir());
-            Commands.Add(new Echo());
-            Commands.Add(new MkDir());
-            Commands.Add(new MkFile());
-            Commands.Add(new Rem());
-            Commands.Add(new RmDir());
-            Commands.Add(new Set());
-            Commands.Add(new Commands.Type());
-        }
-
-        public static string GetCommand()
-        {
-            List<string> dirContents = new List<string>();
-            foreach (string s in Directory.EnumerateFileSystemEntries(Global.CurrentPath))
-                dirContents.Add(Path.GetFileName(s));
-
-            ConsoleTextInputIO consoleTextInputIO = new ConsoleTextInputIO();
-            textInput = new TextInput(consoleTextInputIO, false);
-
-            TextInputResult tir = textInput.GetText("");
-            if (tir.ConsoleKeyInfo.Key == ConsoleKey.Enter)
-            {
-                if (tir.Result.Length > 0)
-                {
-                    string[] parms = Split(tir.Result, false);
-                    Console.WriteLine();
-
-                    switch (parms[0].ToLower())
-                    {
-                        case "help":
-                            DisplayHelp();
-                            break;
-                        default:
-                            DetermineCommandType(parms);
-                            break;
-                    }
-                }
-            }
-            else
-            {
-                // process special keys : TAB, Down\Up arrow, Function keys.
-            }
-
-            return tir.Result;
-        }
-
-        private static void DetermineCommandType(string[] parms)
-        {
-            BaseCommand cmd = FindCommand(parms[0]);
-            if (cmd == null)
-            {
-                FindExecutable(parms);
-            }
-            else
-            {
-                ProcessCommand(cmd, parms);
-            }
-        }
-
-        private static void ProcessCommand(BaseCommand cmd, string[] parms)
-        {
-            if (cmd.ValidateParams(parms))
-            {
-                cmd.Do(parms);
-                DisplayCommandResult(cmd.CommandResult);
-            }
-            else
-            {
-                DisplayCommandResult(cmd.CommandResult);
-            }
-        }
-
-        private static void FindExecutable(string[] parms)
-        {
-            foreach (string file in Directory.EnumerateFiles(Global.CurrentPath))
-            {
-                string s = Path.GetFileName(file);
-                if (s.Length > 4)
-                {
-                    if (batchExtentions.Contains(s.Substring(s.Length - 4)))
-                    {
-                        if (s.ToLower().StartsWith(parms[0]))
-                        {
-                            ExecuteBatch(s);
-                        }
-                    }
-                }
-            }
-        }
-
-        private static void ExecuteBatch(string file)
-        {
-            string[] lines = File.ReadAllLines(Path.Combine(Global.CurrentPath, file));
-            int curLine = 0;
-            bool loop = true;
-
-            while (loop && curLine < lines.Length)
-            {
-                string[] parms = Split(lines[curLine], true);
-
-                if (parms.Length == 0 || parms[0][0] == ':')
-                {
-                    curLine++;
-                    continue;
-                }
-
-                switch (parms[0].ToLower())
-                {
-                    case "goto":
-                        if (parms.Length > 1)
-                        {
-                            int lc = 0;
-                            foreach (string s in lines)
-                            {
-                                if (s[0] == ':')
-                                {
-                                    if (s.Substring(1) == parms[1])
-                                    {
-                                        curLine = lc;
-                                        break;
-                                    }
-                                }
-                                lc++;
-                            }
-                        }
-                        break;
-                    case "exit":
-                        loop = false;
-                        break;
-                    default:
-                        DetermineCommandType(parms);
-                        curLine++;
-                        break;
-                }
-            }
-        }
-
-        private static void DisplayCommandResult(CommandResult cr)
-        {
-            if (cr.Success)
-            {
-                foreach (string s in cr.SuccessMsg)
-                    Console.WriteLine(s);
-            }
-            else
-            {
-                foreach (string s in cr.ErrorMsg)
-                    Console.WriteLine(s);
-            }
-
-            if (cr.Exception != null)
-                Console.WriteLine("Exception: " + cr.Exception.Message);
-        }
-
-        private static string[] Split(string v, bool eatStartingSpaces)
-        {
-            List<string> p = new List<string>();
-
-            string s = "";
-            int cnt = 0;
-            bool inQuotes = false;
-            bool startingSpaces = true;
-
-            foreach (char c in v)
-            {
-                switch (c)
-                {
-                    case ' ':
-                        if (eatStartingSpaces && startingSpaces)
-                            continue;
-                        if (inQuotes)
-                        {
-                            s += c;
-                        }
-                        else
-                        {
-                            p.Add(s);
-                            s = "";
-                            cnt++;
-                        }
-                        break;
-                    case '\'':
-                        if (!inQuotes)
-                        {
-                            inQuotes = true;
-                        }
-                        else
-                        {
-                            p.Add(s);
-                            s = "";
-                            cnt++;
-                        }
-                        startingSpaces = false;
-                        break;
-                    default:
-                        s += c;
-                        startingSpaces = false;
-                        break;
-                }
-            }
-
-            if (s.Trim().Length > 0)
-            {
-                p.Add(s.Trim());
-                cnt++;
-            }
-
-            string[] result = new string[cnt];
-            cnt = 0;
-            foreach (string ss in p)
-                result[cnt++] = ss;
-
-            return result;
-        }
-
-        private static BaseCommand FindCommand(string cmd)
-        {
-            foreach (BaseCommand c in Commands)
-            {
-                if (c.Name == cmd.ToLower())
-                    return c.Create();
-            }
-            return null;
-        }
-
-        private static void DisplayHelp()
-        {
-            Console.WriteLine("");
-            Console.WriteLine("For more information on a specific command, type 'HELP <command>'.");
-            Console.WriteLine("");
-            foreach (BaseCommand c in Commands)
-            {
-                Console.WriteLine(c.Name.PadRight(15) + c.Description);
-            }
-            Console.WriteLine("");
-        }
-    }
-}


Show more gradient

Show more gradient

--- UVRefocus/Assets/UVRefocus/Editor/UVRefocusEditor.cs
+++ UVRefocus/Assets/UVRefocus/Editor/UVRefocusEditor.cs
@@ -1145,9 +1145,9 @@
             float ratio2 = ratio1;
             float ratio3 = ratio1;

-            colors[face1] = Color.Lerp(Color.red, Color.green, ratio1);
-            colors[face2] = Color.Lerp(Color.red, Color.green, ratio2);
-            colors[face3] = Color.Lerp(Color.red, Color.green, ratio3);
+            colors[face1] = GetColorRatio(ratio1);
+            colors[face2] = GetColorRatio(ratio2);
+            colors[face3] = GetColorRatio(ratio3);
         }

         #region Show step
@@ -1182,6 +1182,18 @@
         #endregion
     }

+    Color GetColorRatio(float ratio)
+    {
+        if (ratio < 0.5f)
+        {
+            return Color.Lerp(Color.red, Color.green, ratio*2);
+        }
+        else
+        {
+            return Color.Lerp(Color.green, Color.blue, (ratio - 0.5f)*2);
+        }
+    }
+
     void RecursiveMarch(List<int> searchableList, Dictionary<int, List<int>> dictFaces,
         List<int> sortedFaces, Dictionary<Vector3, List<int>> dictVerteces,
         Vector3[] verts,


Fixes sounds being muffled when they weren't supposed to. (#6044)

--- UnityProject/Assets/Scripts/Managers/SoundManager.cs
+++ UnityProject/Assets/Scripts/Managers/SoundManager.cs
@@ -599,7 +599,7 @@
 		if (!Global
 		    && PlayerManager.LocalPlayer != null
 		    && (MatrixManager.Linecast(PlayerManager.LocalPlayer.TileWorldPosition().To3Int(),
-			    LayerTypeSelection.Walls, layerMask, source.RegisterTile.WorldPositionClient.To2Int().To3Int())
+			    LayerTypeSelection.Walls, layerMask, source.transform.position.To2Int().To3Int())
 			    .ItHit))
 			{
 				source.AudioSource.outputAudioMixerGroup = soundManager.MuffledMixer;


Simplyfied it

Simplyfied it

Simplified it a little bit.  It does exactly the same.

--- UnityProject/Assets/Scripts/Managers/SoundManager.cs
+++ UnityProject/Assets/Scripts/Managers/SoundManager.cs
@@ -111,14 +111,7 @@
 		//Mute Music Preference
 		if (PlayerPrefs.HasKey(PlayerPrefKeys.MuteMusic))
 		{
-			if (PlayerPrefs.GetInt(PlayerPrefKeys.MuteMusic) == 0)
-			{
-				isMusicMute = true;
-			}
-			else
-			{
-				isMusicMute = false;
-			}
+			isMusicMute = PlayerPrefs.GetInt(PlayerPrefKeys.MuteMusic) == 0;
 		}

 		//Ambient Volume Preference
@@ -545,4 +538,4 @@
 	plating,
 	wood,
 	clownstep,
-}+}


Support reading VCS version 62, 64 and maybe 63

--- ValveResourceFormat/CompiledShader/CompiledShader.cs
+++ ValveResourceFormat/CompiledShader/CompiledShader.cs
@@ -11,6 +11,7 @@

         private BinaryReader Reader;
         private string ShaderType;
+        private uint version;

         /// <summary>
         /// Releases binary reader.
@@ -71,12 +72,21 @@
             }

             // This is static across all files, is it version?
-            if (Reader.ReadUInt32() != 0x00000040)
-            {
-                throw new InvalidDataException("Not 40.");
-            }
-
-            Reader.ReadUInt32(); // always 0?
+            // Known versions:
+            //  62 - April 2016
+            //  63 - March 2017
+            //  64 - May 2017
+            version = Reader.ReadUInt32();
+
+            if (version < 62 || version > 64)
+            {
+                throw new InvalidDataException("Unsupported VCS2 version: " + version);
+            }
+
+            if (version >= 64)
+            {
+                Reader.ReadUInt32(); // always 0, new in version 64
+            }

             var wtf = Reader.ReadUInt32();

@@ -107,9 +117,16 @@
             var e = Reader.ReadInt32();
             var f = Reader.ReadInt32();
             var g = Reader.ReadInt32();
-            var h = Reader.ReadInt32();
-
-            Console.WriteLine($"{a} {b} {c} {d} {e} {f} {g} {h}");
+
+            if (version >= 63)
+            {
+                var h = Reader.ReadInt32();
+                Console.WriteLine($"{a} {b} {c} {d} {e} {f} {g} {h}");
+            }
+            else
+            {
+                Console.WriteLine($"{a} {b} {c} {d} {e} {f} {g}");
+            }

             var count = Reader.ReadUInt32();

@@ -142,8 +159,15 @@
                 }
             }

-            // Appears to be always 112 bytes
-            for (var i = 0; i < 8; i++)
+            var identifierCount = 7;
+
+            if (version > 62)
+            {
+                identifierCount = 8;
+            }
+
+            // Appears to be always 128 bytes in version 63 and higher, 112 before
+            for (var i = 0; i < identifierCount; i++)
             {
                 // 0 - ?
                 // 1 - vertex shader
@@ -152,7 +176,7 @@
                 // 4 - hull shader
                 // 5 - domain shader
                 // 6 - ?
-                // 7 - ?
+                // 7 - ?, new in version 63
                 var identifier = Reader.ReadBytes(16);

                 Console.WriteLine("#{0} identifier: {1}", i, BitConverter.ToString(identifier));
@@ -283,11 +307,16 @@

                 if (b > -1 && type != 0)
                 {
-                    Reader.BaseStream.Position = previousPosition + 484 + b + 4;
+                    Reader.BaseStream.Position = previousPosition + 480 + b + 4;
                 }
                 else
                 {
-                    Reader.BaseStream.Position = previousPosition + 484;
+                    Reader.BaseStream.Position = previousPosition + 480;
+                }
+
+                if (version > 62)
+                {
+                    Reader.BaseStream.Position += 4;
                 }

                 Console.WriteLine($"{type} {b} {name}");


Removed duplication in total calculation

--- VendingMachine/VendingMachine.Core/VendingMachine.cs
+++ VendingMachine/VendingMachine.Core/VendingMachine.cs
@@ -3,6 +3,7 @@
 using System.Globalization;
 using System.Linq;
 using System.Text;
+using System.Threading;
 using System.Threading.Tasks;

 namespace Vending.Core
@@ -42,7 +43,30 @@
                 counts[coin]++;
             }

-            return (counts[Coin.Nickel] * 5.0m + counts[Coin.Dime] * 10.0m + counts[Coin.Quarter] * 25.0m) / 100;
+            decimal total = 0;
+            foreach (var coinCount in counts)
+            {
+                total += (coinCount.Value * CoinValue(coinCount.Key));
+            }
+
+            return total/100;
+
+            //return (counts[Coin.Nickel] * 5.0m + counts[Coin.Dime] * 10.0m + counts[Coin.Quarter] * 25.0m) / 100;
+        }
+
+        private decimal CoinValue(Coin coinType)
+        {
+            switch (coinType)
+            {
+                case Coin.Nickel:
+                    return 5.0m;
+                case Coin.Dime:
+                    return 10.0m;
+                case Coin.Quarter:
+                    return 25.0m;
+                default:
+                    return 0.0m;
+            }
         }

         public void Accept(Coin coin)


Remove task.run and use proper async/await

--- error-reporting/api/ErrorReportingSample.cs
+++ error-reporting/api/ErrorReportingSample.cs
@@ -52,10 +52,10 @@
         /// with the Application Default Credentials and the proper scopes.
         /// See: https://developers.google.com/identity/protocols/application-default-credentials.
         /// </summary>
-        private static ClouderrorreportingService CreateErrorReportingClient()
+        private static async Task<ClouderrorreportingService> CreateErrorReportingClient()
         {
             // Get the Application Default Credentials.
-            GoogleCredential credential = Task.Run(() => GoogleCredential.GetApplicationDefaultAsync()).Result;
+            GoogleCredential credential = await GoogleCredential.GetApplicationDefaultAsync();

             // Add the needed scope to the credentials.
             credential.CreateScoped(ClouderrorreportingService.Scope.CloudPlatform);
@@ -71,10 +71,10 @@
         /// <summary>
         /// Creates a <seealso cref="ReportRequest"/> from a given exception.
         /// </summary>
-        private static ReportRequest CreateReportRequest(Exception e)
+        private static async Task<ReportRequest> CreateReportRequest(Exception e)
         {
             // Create the service.
-            ClouderrorreportingService service = CreateErrorReportingClient();
+            ClouderrorreportingService service = await CreateErrorReportingClient();

             // Get the project ID from the environement variables.
             string projectId = Environment.GetEnvironmentVariable("GOOGLE_PROJECT_ID");
@@ -101,10 +101,10 @@
         /// <summary>
         /// Report an exception to the Error Reporting service.
         /// </summary>
-        private static void report(Exception e)
+        private static async void report(Exception e)
         {
             // Create the report and execute the request.
-            ReportRequest request = CreateReportRequest(e);
+            ReportRequest request = await CreateReportRequest(e);
             request.Execute();
         }
     }


removed the wildcards "%" in LIKE queries because the user should be able to set the wildcards himselfs.

--- src/Workbooster.ObjectDbMapper/Query.cs
+++ src/Workbooster.ObjectDbMapper/Query.cs
@@ -282,15 +282,8 @@

                 try
                 {
-                    if (filter.Operator == FilterComparisonOperatorEnum.Like)
-                    {
-                        param.Value = String.Format("%{0}%", filter.Value);
-                    }
-                    else
-                    {
-                        // convert the value to the type of the member
-                        param.Value = Convert.ChangeType(filter.Value, memberType);
-                    }
+                    // convert the value to the type of the member
+                    param.Value = Convert.ChangeType(filter.Value, memberType);
                 }
                 catch (Exception ex)
                 {


Doors are now timebased

Doors are now timebased

--- Assets/Scripts/Transfer.cs
+++ Assets/Scripts/Transfer.cs
@@ -7,6 +7,7 @@
 	protected ulong lightTimer = 0;
 	protected ulong worldTimer = 0;
 	protected float lightControl = 1f;
+	private bool[] complete = new bool[8];
 	public GameObject rig;
 	public GameObject Ele0;
 	public GameObject Ele1;
@@ -19,61 +20,54 @@
 		Ele0Control = Ele0.GetComponent<ElevatorControl> ();
 		Ele1Control = Ele1.GetComponent<ElevatorControl> ();
 		Ele2Control = Ele2.GetComponent<ElevatorControl> ();
+		for(int i = 0; i < 8; i++){
+			complete[i] = false;
+		}
 	}

-	// Update is called once per frame
-	void Update () {
-		/*if (Input.GetKeyDown(KeyCode.Backspace)){
-			if (stage == 0) {
-				stage++;
-				changing = true;
-				Ele0.transform.GetChild (0).gameObject.SetActive(true);
-				Ele1.transform.GetChild (0).gameObject.SetActive(true);
-			} else if (stage == 1) {
-				stage++;
-				changing = true;
-				Ele1.transform.GetChild (0).gameObject.SetActive(true);
-				Ele2.transform.GetChild (0).gameObject.SetActive(true);
-			}
-		}*/
-	}
-
 	void FixedUpdate(){
-		worldTimer++;
-		//Debug.Log(worldTimer);
-		checkTime ();
+		worldTimer = (ulong)Time.time;
+		if (!complete[7]) {
+			checkTime ();
+		}
 		movePlayer ();
 	}

 	protected void checkTime(){
-
-		if (worldTimer == 3230) {
+		if (worldTimer >= 94&& !complete[7]) {
 			Ele2Control.callDoor ();
 			Ele2.transform.GetChild (0).gameObject.SetActive(true);
-		} else if (worldTimer == 2800) {
+			complete [7] = true;
+		} else if (worldTimer >= 74 && !complete[6]) {
 			Ele2Control.callDoor ();
 			Ele2.transform.GetChild (0).gameObject.SetActive(false);
-		} else if (worldTimer == 2400) {
+			complete [6] = true;
+		} else if (worldTimer >= 64 && !complete[5]) {
 			stage++;
 			changing = true;
 			Ele2.transform.GetChild (0).gameObject.SetActive(true);
 			Ele1.transform.GetChild (0).gameObject.SetActive(true);
-		} else if (worldTimer == 2230) {
+			complete [5] = true;
+		} else if (worldTimer >= 62 && !complete[4]) {
 			Ele1Control.callDoor ();
-
-		} else if (worldTimer == 1600) {
+			complete [4] = true;
+		} else if (worldTimer >= 42 && !complete[3]) {
 			Ele1Control.callDoor ();
 			Ele1.transform.GetChild (0).gameObject.SetActive(false);
-		} else if (worldTimer == 1200) {
+			complete [3] = true;
+		} else if (worldTimer >= 32 && !complete[2]) {
 			stage++;
 			changing = true;
 			Ele1.transform.GetChild (0).gameObject.SetActive(true);
 			Ele0.transform.GetChild (0).gameObject.SetActive (true);
-		} else if (worldTimer == 1030) {
+			complete [2] = true;
+		} else if (worldTimer >= 30 && !complete[1]) {
 			Ele0Control.callDoor ();
-		} else if (worldTimer == 400) {
+			complete [1] = true;
+		} else if (worldTimer >= 10 && !complete[0]) {
 			Ele0Control.callDoor ();
 			Ele0.transform.GetChild (0).gameObject.SetActive (false);
+			complete [0] = true;
 		}
 	}


Removed unused import.

Removed unused import.

--- src/Renci.SshNet/Messages/Connection/GlobalRequestMessage.cs
+++ src/Renci.SshNet/Messages/Connection/GlobalRequestMessage.cs
@@ -1,6 +1,4 @@
-using Renci.SshNet.Abstractions;
-
-namespace Renci.SshNet.Messages.Connection
+namespace Renci.SshNet.Messages.Connection
 {
     /// <summary>
     /// Represents SSH_MSG_GLOBAL_REQUEST message.


added ability to expand the transfer on StripeCharge

--- src/Stripe.net/Services/Charges/StripeChargeService.cs
+++ src/Stripe.net/Services/Charges/StripeChargeService.cs
@@ -14,6 +14,7 @@
         public bool ExpandDestination { get; set; }
         public bool ExpandInvoice { get; set; }
         public bool ExpandReview { get; set; }
+        public bool ExpandTransfer { get; set; }


sample keywords updated

sample keywords updated

--- src/TwitterService.Business/Services/TwitterService.cs
+++ src/TwitterService.Business/Services/TwitterService.cs
@@ -217,7 +217,7 @@
             {
                 if (!distinctKeywordRepository.AsQueryable().Any())
                 {
-                    const string OrganizationId = "1";
+                    const string OrganizationId = "51fb4622902c7f0fecca0343";

                     this.AddOrganization(OrganizationId);

@@ -232,9 +232,17 @@
                     this.AddKeyword(OrganizationId, "task management");
                     this.AddKeyword(OrganizationId, "team management");
                     this.AddKeyword(OrganizationId, "collaboration software");
+                    this.AddKeyword(OrganizationId, "collaborative project management");
                     this.AddKeyword(OrganizationId, "collaborative project management tool");
+                    this.AddKeyword(OrganizationId, "collaborative task management");
                     this.AddKeyword(OrganizationId, "business chat");
-                    this.AddKeyword(OrganizationId, "girl");
+                    this.AddKeyword(OrganizationId, "group chat");
+
+                    this.AddKeyword(OrganizationId, "flowdock");
+                    this.AddKeyword(OrganizationId, "trello");
+                    this.AddKeyword(OrganizationId, "kanbanize");
+                    this.AddKeyword(OrganizationId, "pivotal tracker");
+                    this.AddKeyword(OrganizationId, "kanbanery");
                 }

                 var keywords = distinctKeywordRepository.AsQueryable().ToList().Select(x => x.Key).ToList();


[Skip CI] Elevate out to variable.

[Skip CI] Elevate out to variable.

--- WalletWasabi/JsonConverters/OutPointJsonConverter.cs
+++ WalletWasabi/JsonConverters/OutPointJsonConverter.cs
@@ -24,7 +24,8 @@
 		/// <inheritdoc />
 		public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
 		{
-			writer.WriteValue(((OutPoint)value).ToHex());
+			string opHex = ((OutPoint)value).ToHex();
+			writer.WriteValue(opHex);
 		}
 	}
 }


Fix a crash when pressing tab on a textbox

Happens when a textbox isn't part of a tabbable container.

--- osu.Framework/Graphics/Containers/TabbableContainer.cs
+++ osu.Framework/Graphics/Containers/TabbableContainer.cs
@@ -29,7 +29,7 @@

         protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
         {
-            if (args.Key != Key.Tab)
+            if (TabbableContentContainer == null || args.Key != Key.Tab)
                 return false;

             nextTabStop(TabbableContentContainer, state.Keyboard.ShiftPressed)?.TriggerFocus();


Unify spelling in xmldoc.

Unify spelling in xmldoc.

--- osu.Framework/Graphics/Containers/TextFlowContainer.cs
+++ osu.Framework/Graphics/Containers/TextFlowContainer.cs
@@ -132,12 +132,12 @@
         public IEnumerable<SpriteText> AddParagraph(string paragraph, Action<SpriteText> creationParameters = null) => addLine(new TextLine(paragraph, creationParameters), false);

         /// <summary>
-        /// Ends current line and start a new one.
+        /// End current line and start a new one.
         /// </summary>
         public void NewLine() => base.Add(new NewLineContainer(false));

         /// <summary>
-        /// Ends current paragraph and start a new one.
+        /// End current paragraph and start a new one.
         /// </summary>
         public void NewParagraph() => base.Add(new NewLineContainer(true));


Use existing hit objects instead of defining own

--- osu.Game.Rulesets.Catch.Tests/TestSceneComboCounter.cs
+++ osu.Game.Rulesets.Catch.Tests/TestSceneComboCounter.cs
@@ -55,25 +55,13 @@

         private void performJudgement(HitResult type, Judgement judgement = null)
         {
-            var judgedObject = new TestDrawableCatchHitObject(new TestCatchHitObject());
+            var judgedObject = new DrawableFruit(new Fruit()) { AccentColour = { Value = judgedObjectColour } };
+
             var result = new JudgementResult(judgedObject.HitObject, judgement ?? new Judgement()) { Type = type };
             scoreProcessor.ApplyResult(result);

             foreach (var counter in CreatedDrawables.Cast<CatchComboDisplay>())
                 counter.OnNewResult(judgedObject, result);
         }
-
-        private class TestDrawableCatchHitObject : DrawableCatchHitObject
-        {
-            public TestDrawableCatchHitObject(CatchHitObject hitObject)
-                : base(hitObject)
-            {
-                AccentColour.Value = Color4.White;
-            }
-        }
-
-        private class TestCatchHitObject : CatchHitObject
-        {
-        }
     }
 }


Add inline comment mentioning binding issues

--- osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs
+++ osu.Game.Rulesets.Catch/Edit/CatchHitObjectComposer.cs
@@ -92,6 +92,9 @@
         {
             switch (e.Action)
             {
+                // Note that right now these are hard to use as the default key bindings conflict with existing editor key bindings.
+                // In the future we will want to expose this via UI and potentially change the key bindings to be editor-specific.
+                // May be worth considering standardising "zoom" behaviour with what the timeline uses (ie. alt-wheel) but that may cause new conflicts.
                 case GlobalAction.IncreaseScrollSpeed:
                     this.TransformBindableTo(timeRangeMultiplier, timeRangeMultiplier.Value - 1, 200, Easing.OutQuint);
                     break;


Remove explicit specification of new default

--- osu.Game.Rulesets.Mania/Skinning/LegacyHitExplosion.cs
+++ osu.Game.Rulesets.Mania/Skinning/LegacyHitExplosion.cs
@@ -39,7 +39,7 @@
             if (tmp is IFramedAnimation tmpAnimation && tmpAnimation.FrameCount > 0)
                 frameLength = Math.Max(1000 / 60.0, 170.0 / tmpAnimation.FrameCount);

-            explosion = skin.GetAnimation(imageName, true, false, startAtCurrentTime: true, frameLength: frameLength).With(d =>
+            explosion = skin.GetAnimation(imageName, true, false, frameLength: frameLength).With(d =>
             {
                 if (d == null)
                     return;


Add background video for showcase scene (Tournament Client)

--- osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs
+++ osu.Game.Tournament/Screens/Showcase/ShowcaseScreen.cs
@@ -2,6 +2,8 @@
 // See the LICENCE file in the repository root for full licence text.

 using osu.Framework.Allocation;
+using osu.Framework.Graphics;
+using osu.Game.Tournament.Components;

 namespace osu.Game.Tournament.Screens.Showcase
 {
@@ -10,7 +12,14 @@
         [BackgroundDependencyLoader]
         private void load()
         {
-            AddInternal(new TournamentLogo());
+            AddRangeInternal(new Drawable[] {
+                new TournamentLogo(),
+                new TourneyVideo("showcase")
+                {
+                    Loop = true,
+                    RelativeSizeAxes = Axes.Both,
+                }
+            });
         }
     }
 }


Removed unused imports

Removed unused imports

--- src/Skybrud.Umbraco.Redirects/Routing/RedirectsHttpModule.cs
+++ src/Skybrud.Umbraco.Redirects/Routing/RedirectsHttpModule.cs
@@ -1,12 +1,7 @@
 using System;
-using System.Text;
 using System.Web;
 using Skybrud.Umbraco.Redirects.Models;
-using umbraco.cms.businesslogic.web;
-using Umbraco.Core;
 using Umbraco.Core.Models;
-using Umbraco.Core.Persistence;
-using Umbraco.Core.Services;
 using Umbraco.Web;
 using Umbraco.Web.Routing;
 using System.Text.RegularExpressions;


Disable beatmap download button if not supporter

--- osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs
+++ osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs
@@ -1,18 +1,25 @@
 // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
 // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

+using osu.Framework.Allocation;
+using osu.Framework.Configuration;
 using osu.Framework.Graphics;
 using osu.Framework.Graphics.Containers;
 using osu.Game.Beatmaps;
 using osu.Game.Beatmaps.Drawables;
 using osu.Game.Graphics;
 using osu.Game.Graphics.Sprites;
+using osu.Game.Online.API;
+using osu.Game.Users;
 using OpenTK;
+using OpenTK.Graphics;

 namespace osu.Game.Overlays.BeatmapSet.Buttons
 {
     public class DownloadButton : HeaderButton
     {
+        private readonly IBindable<User> localUser = new Bindable<User>();
+
         public DownloadButton(BeatmapSetInfo set, bool noVideo = false)
         {
             Width = 120;
@@ -86,5 +93,17 @@
                 }
             };
         }
+
+        [BackgroundDependencyLoader]
+        private void load(APIAccess api)
+        {
+            localUser.BindTo(api.LocalUser);
+            localUser.BindValueChanged(userChanged, true);
+            Enabled.BindValueChanged(enabledChanged, true);
+        }
+
+        private void userChanged(User user) => Enabled.Value = user.IsSupporter;
+
+        private void enabledChanged(bool enabled) => this.FadeColour(enabled ? Color4.White : Color4.Gray, 200, Easing.OutQuint);
     }
 }


Make disposal of tracker idempotent for operations

--- osu.Game/Screens/OnlinePlay/OngoingOperationTracker.cs
+++ osu.Game/Screens/OnlinePlay/OngoingOperationTracker.cs
@@ -52,5 +52,13 @@
             leasedInProgress?.Return();
             leasedInProgress = null;
         }
+
+        protected override void Dispose(bool isDisposing)
+        {
+            base.Dispose(isDisposing);
+            // base call does an UnbindAllBindables().
+            // clean up the leased reference here so that it doesn't get returned twice.
+            leasedInProgress = null;
+        }
     }
 }


CHT Issue 28 (#1800)

CHT Issue 28 (#1800)

* Common Cases and Issue 19

* removed notfinished test

* #1936 #1765 #1806

* Test Issue 19 #1766

* code cleanup

* formating fix

* test fix. resolve comments

* clean formating

* fixed formation

* Decline .Next pointer usage.

* fixed test. changed order for basic tests.

* Formating issues fixed

* fixed/refactored test case

* used static const for localpeer

* cht test case. issue 20 #1767 #1807

* fixed merge conflict

* fixed comments

* space fix

* formating issue fixed

* cht20 bug fix

* spaces cleanup

* spaces cleanup

* added issue 18

* fixed PR

* grammar fix

* Added test for Issue 28 #1775 #1815

* fixed PR #1800

* fixed test

--- src/Stratis.Bitcoin.Tests/Consensus/ChainedHeaderTreeTest.cs
+++ src/Stratis.Bitcoin.Tests/Consensus/ChainedHeaderTreeTest.cs
@@ -2180,10 +2180,10 @@
             Dictionary<uint256, HashSet<int>> tipsDictionary = cht.GetPeerIdsByTipHash();
             Dictionary<int, uint256> peerIdsDictionary = cht.GetPeerTipsByPeerId();

-            for (int i = 0; i < peerIdsDictionary.Count - 1; i++)
-            {
-                peerHeaderDictionary.Add(i, 0);
-                peerEntryDictionary.Add(i, 0);
+            foreach (int key in peerIdsDictionary.Keys)
+            {
+                peerHeaderDictionary.Add(key, 0);
+                peerEntryDictionary.Add(key, 0);
             }

             var tipsLeft = new HashSet<uint256>(cht.GetChainedHeadersByHash().Select(x => x.Value).Where(x => x.Next.Count == 0).Select(x => x.HashBlock));
@@ -2250,6 +2250,63 @@
             }

             Assert.Equal(chainHeaders.Count, allConnectedHeaders.Count);
+        }
+
+        /// <summary>
+        /// Issue 28 @ Peers E,F claims 10d. PartialOrFullValidationFailed(7a), make sure that 7a,8a,9a,8d,9d,10d,11d are removed and the peers A, E, F, D are marked as PeersToBan.
+        /// </summary>
+        [Fact]
+        public void PeerEAndFClaimsHead_PartialOrFullValidationFailed_RestOfHeadMustBeRemoved_PeersMarkedAsPeersToBan()
+        {
+            const int initialChainSize = 5;
+            TestContext ctx = new TestContextBuilder().WithInitialChain(initialChainSize).UseCheckpoints().Build();
+            ChainedHeaderTree cht = ctx.ChainedHeaderTree;
+            ChainedHeader initialChainTip = ctx.InitialChainTip;
+            ChainedHeaderBlock consensusTip = cht.GetChainedHeaderBlock(cht.GetPeerTipsByPeerId()[ChainedHeaderTree.LocalPeerId]);
+
+            ctx.SetupPeersForTest(cht, initialChainTip);
+
+            // Additional SetUp for current test.
+            ChainedHeader chainATip = cht.GetPeerTipChainedHeaderByPeerId(0);
+            ChainedHeader chainDTip = cht.GetPeerTipChainedHeaderByPeerId(3);
+            ChainedHeader chainETip = ctx.ExtendAChain(2, chainDTip.GetAncestor(10)); // i.e. ((h1=h2=h3=h4=h5)=6a=7a)=8d=9d=10d)=11e
+            ChainedHeader chainFTip = ctx.ExtendAChain(2, chainDTip.GetAncestor(10)); // i.e. ((h1=h2=h3=h4=h5)=6a=7a)=8d=9d=10d)=11f
+            List<BlockHeader> peerEBlockHeaders = ctx.ChainedHeaderToList(chainETip, chainETip.Height);
+            List<BlockHeader> peerFBlockHeaders = ctx.ChainedHeaderToList(chainFTip, chainFTip.Height);
+
+            ConnectNewHeadersResult eResult = cht.ConnectNewHeaders(5, peerEBlockHeaders);
+            cht.ConnectNewHeaders(6, peerFBlockHeaders);
+
+            var peerIdsByHash = new Dictionary<int, uint256>(cht.GetPeerTipsByPeerId());
+
+            var dictionaryAffectedPeers = new Dictionary<int, uint256>()
+            {
+                {0, peerIdsByHash[0]},
+                {3, peerIdsByHash[3]},
+                {5, peerIdsByHash[5]},
+                {6, peerIdsByHash[6]}
+            };
+
+            List<ChainedHeader> listOfChainedHeaders = chainATip.ToArray(chainATip.Height).Where(x => x.Height >= 7).ToList();
+            listOfChainedHeaders.AddRange(chainDTip.ToArray(chainDTip.Height).Where(x => x.Height >= 7).ToList());
+            listOfChainedHeaders.AddRange(chainETip.ToArray(chainETip.Height).Where(x => x.Height >= 7).ToList());
+            listOfChainedHeaders.AddRange(chainFTip.ToArray(chainFTip.Height).Where(x => x.Height >= 7).ToList());
+            List<ChainedHeader> listOfChainedHeadersMustBeRemovedFromCht = listOfChainedHeaders.Distinct().ToList();
+
+            ChainedHeader[] consumedHeaders = eResult.Consumed.ToArray(12);
+            List<int> peersToBan = cht.PartialOrFullValidationFailed(consumedHeaders.FirstOrDefault(x => x.Height == 7)); // 7a validation failed.
+            peersToBan.Count.Should().Be(4); // Check that just four peers have been banned.
+
+            List<uint256> peerIdsByHashAfterFail = cht.GetPeerIdsByTipHash().Select(x => x.Key).ToList();
+            List<ChainedHeader> chainedHeadersAfterFail = cht.GetChainedHeadersByHash().Select(x => x.Value).ToList();
+
+            chainedHeadersAfterFail.Should().NotContain(listOfChainedHeadersMustBeRemovedFromCht); // Check that headers have been removed.
+
+            peersToBan.Should().Contain(dictionaryAffectedPeers.Select(x => x.Key).ToList()); // Check that Peers A, D, E, F are in ban list.
+
+            peerIdsByHashAfterFail.Should().NotContain(dictionaryAffectedPeers.Select(x => x.Value).ToList()); // Check that Peers A, D, E, F have been disconected.
+
+            this.CheckChainedHeaderTreeConsistency(cht, ctx, consensusTip, new HashSet<int>() { 1, 2 });
         }

         /// <summary>


adds comments

adds comments

--- src/Umbraco.Core/Persistence/NPocoDatabaseExtensions-Bulk.cs
+++ src/Umbraco.Core/Persistence/NPocoDatabaseExtensions-Bulk.cs
@@ -232,6 +232,9 @@
                 using (var copy = new SqlBulkCopy(tConnection, SqlBulkCopyOptions.Default, tTransaction) { BulkCopyTimeout = 10000, DestinationTableName = tableName })
                 using (var bulkReader = new PocoDataDataReader<T, SqlServerSyntaxProvider>(records, pocoData, syntax))
                 {
+                    //we need to add column mappings here because otherwise columns will be matched by their order and if the order of them are different in the DB compared
+                    //to the order in which they are declared in the model then this will not work, so instead we will add column mappings by name so that this explicitly uses
+                    //the names instead of their ordering.
                     foreach(var col in bulkReader.ColumnMappings)
                     {
                         copy.ColumnMappings.Add(col.DestinationColumn, col.DestinationColumn);


Update `IsTopLevelStatementsEntryPointMethod`

--- src/Utilities/Compiler/Extensions/IMethodSymbolExtensions.cs
+++ src/Utilities/Compiler/Extensions/IMethodSymbolExtensions.cs
@@ -709,9 +709,7 @@
         /// Check if the given <paramref name="methodSymbol"/> is an implicitly generated method for top level statements.
         /// </summary>
         public static bool IsTopLevelStatementsEntryPointMethod([NotNullWhen(true)] this IMethodSymbol? methodSymbol)
-            => methodSymbol?.ContainingType.IsTopLevelStatementsEntryPointType() == true &&
-               methodSymbol.IsStatic &&
-               methodSymbol.Name switch
+            => methodSymbol.Name switch
                {
                    "$Main" => true,
                    "<Main>$" => true,


Avoid using cached CompilationWithAnalyzers for project analysis as it leads to significant memory pressure. Diagnostics from project analysis are already cached in VS side, so we will not do any redundant analysis.

--- src/Workspaces/Remote/Core/Diagnostics/DiagnosticComputer.cs
+++ src/Workspaces/Remote/Core/Diagnostics/DiagnosticComputer.cs
@@ -55,7 +55,8 @@
             bool getTelemetryInfo,
             CancellationToken cancellationToken)
         {
-            var compilationWithAnalyzersData = await CompilationWithAnalyzersData.GetOrCreateAsync(_project, cancellationToken).ConfigureAwait(false);
+            var compilationWithAnalyzersData = await CompilationWithAnalyzersData.GetOrCreateAsync(
+                _project, isDocumentAnalysis: _document != null, cancellationToken).ConfigureAwait(false);

             var analyzers = GetAnalyzers(compilationWithAnalyzersData.AnalyzerToIdMap, analyzerIds);
             if (analyzers.IsEmpty)
@@ -169,11 +170,12 @@
             /// <summary>
             /// Cache of <see cref="CompilationWithAnalyzers"/> and a map from analyzer IDs to <see cref="DiagnosticAnalyzer"/>s
             /// for all analyzers for each project.
-            /// The <see cref="CompilationWithAnalyzers"/> instance is shared between all the following analyses modes for the project:
+            /// The <see cref="CompilationWithAnalyzers"/> instance is shared between all the following document analyses modes for the project:
             ///  1. Span-based analysis for active document (lightbulb)
             ///  2. Background analysis for active and open documents.
-            ///  3. Background project analysis.
-            ///  4. <see cref="DefaultDiagnosticAnalyzerService"/> computation for analyzer diagnostics.
+            ///
+            /// NOTE: We do not re-use this cache for project analysis as it leads to significant memory increase in the OOP process,
+            /// and CWT does not seem to drop entries until ForceGC happens.
             /// </summary>
             private static readonly ConditionalWeakTable<Project, CompilationWithAnalyzersData> s_cache
                 = new ConditionalWeakTable<Project, CompilationWithAnalyzersData>();
@@ -187,8 +189,17 @@
             public BidirectionalMap<string, DiagnosticAnalyzer> AnalyzerToIdMap { get; }
             public CompilationWithAnalyzers CompilationWithAnalyzers { get; }

-            public static async Task<CompilationWithAnalyzersData> GetOrCreateAsync(Project project, CancellationToken cancellationToken)
-            {
+            public static async Task<CompilationWithAnalyzersData> GetOrCreateAsync(
+                Project project,
+                bool isDocumentAnalysis,
+                CancellationToken cancellationToken)
+            {
+                if (!isDocumentAnalysis)
+                {
+                    // Only use cache for document analysis.
+                    return await CreateAsync(project, cancellationToken).ConfigureAwait(false);
+                }
+
                 if (s_cache.TryGetValue(project, out var data))
                 {
                     return data;


Grammar issues.

Grammar issues.

--- src/Workspaces/Core/Portable/Utilities/EditDistance.cs
+++ src/Workspaces/Core/Portable/Utilities/EditDistance.cs
@@ -121,8 +121,8 @@
             -------------

             And we can cap the search past the diagonals based on the threshold.  For larger strings
-            With a small threshold, this can be very valuable.  For example, if we had 10 char strings
-            with a a threshold of 2, we'd only have to search
+            with a small threshold, this can be very valuable.  For example, if we had 10 char strings
+            with a threshold of 2, we'd only have to search

             -------------
             | abcdefghij|


Fix visitor method to return a bool.

Fix visitor method to return a bool.

--- NtApiDotNet/NtKey.cs
+++ NtApiDotNet/NtKey.cs
@@ -1592,18 +1592,18 @@
         /// <param name="recurse">True to recurse into sub keys.</param>
         /// <param name="max_depth">Specify max recursive depth. -1 to not set a limit.</param>
         /// <param name="open_for_backup">Open the key using backup privileges.</param>
-        public void VisitAccessibleKeys(Func<NtKey, bool> visitor, KeyAccessRights desired_access, bool open_for_backup, bool recurse, int max_depth)
+        public bool VisitAccessibleKeys(Func<NtKey, bool> visitor, KeyAccessRights desired_access, bool open_for_backup, bool recurse, int max_depth)
         {
             if (max_depth == 0)
             {
-                return;
+                return true;
             }

             using (var for_enum = GetKeyForEnumeration(open_for_backup))
             {
                 if (!for_enum.IsSuccess)
                 {
-                    return;
+                    return true;
                 }

                 using (var keys = for_enum.Result.QueryAccessibleKeys(desired_access, true, open_for_backup).ToDisposableList())
@@ -1617,16 +1617,21 @@
                     {
                         if (!visitor(key))
                         {
-                            break;
+                            return false;
                         }

                         if (recurse)
                         {
-                            key.VisitAccessibleKeys(visitor, desired_access, open_for_backup, recurse, max_depth);
+                            if (!key.VisitAccessibleKeys(visitor, desired_access, open_for_backup, recurse, max_depth))
+                            {
+                                return false;
+                            }
                         }
                     }
                 }
             }
+
+            return true;
         }

         /// <summary>


Added additonal win32k registry keys.

Added additonal win32k registry keys.

--- NtApiDotNet/NtKey.cs
+++ NtApiDotNet/NtKey.cs
@@ -988,6 +988,8 @@
                 dict.Add("HKCU", current_user);
                 dict.Add("HKEY_CURRENT_USER", current_user);
             }
+            dict.Add("HKEY_CLASSES_ROOT", @"\Registry\Machine\Software\Classes");
+            dict.Add("HKCR", @"\Registry\Machine\Software\Classes");
             return dict;
         }

@@ -1015,6 +1017,14 @@
             throw new NtException(NtStatus.STATUS_OBJECT_NAME_INVALID);
         }

+        class StringLengthComparer : IComparer<string>
+        {
+            public int Compare(string x, string y)
+            {
+                return y.Length - x.Length;
+            }
+        }
+
         /// <summary>
         /// Attempt to convert an NT style registry key name to Win32 form.
         /// If it's not possible to convert the function will return the
@@ -1024,7 +1034,7 @@
         /// <returns>The converted path, or original if it can't be converted.</returns>
         public static string NtKeyNameToWin32(string nt_path)
         {
-            foreach (var pair in _win32_base_keys)
+            foreach (var pair in _win32_base_keys.OrderBy(p => p.Value, new StringLengthComparer()))
             {
                 if (nt_path.Equals(pair.Value, StringComparison.OrdinalIgnoreCase))
                 {


NyaaSpam: Rework argument parsing a bit

NyaaSpam: Rework argument parsing a bit

--- NyaaSpam/NyaaSpam.cs
+++ NyaaSpam/NyaaSpam.cs
@@ -131,66 +131,73 @@

     public void Nyaa(ITriggerMsg e)
     {
-        if (conf.Feed == null)
-        {
-            e.Reply(feedError);
+        string command = null;
+        int? assocPat = null;
+        string input = string.Empty;
+
+        using (var argEnum = new ArgEnumerator(e) { ToLower = true })
+        {
+            if (argEnum.Next() == "ex")
+            {
+                // nyaa ex <assocPat> <add|del|show>
+                // Exclude Patterns associated with a pattern.
+                if (int.TryParse(argEnum.Next(), out int assocOut))
+                {
+                    assocPat = assocOut;
+                    command = argEnum.Next();
+                }
+                // nyaa ex <add|del|show>
+                // Global Exclude Patterns.
+                else
+                {
+                    assocPat = -1;
+                    command = argEnum.Current;
+                }
+            }
+            // nyaa [add|del|show]
+            else if (argEnum.Current.HasValue())
+                command = argEnum.Current;
+
+            if (command.HasValue())
+                input = argEnum.GetRemaining().ToJoined();
+        }
+
+        switch (command)
+        {
+            // Restrict access to add and del, but not show.
+            case "add":
+            if (Allowed(e))
+                Add(e.Channel, e.Nick, input, assocPat);
             return;
-        }
-
-        if (conf.ActiveChannels.Contains(e.Channel) || meido.AuthLevel(e.Nick) >= 2)
-        {
-            string command = null;
-            int? assocPat = null;
-            string input = string.Empty;
-
-            using (var argEnum = new ArgEnumerator(e) { ToLower = true })
-            {
-                if (argEnum.Next() == "ex")
-                {
-                    // nyaa ex <assocPat> <add|del|show>
-                    // Exclude Patterns associated with a pattern.
-                    if (int.TryParse(argEnum.Next(), out int assocOut))
-                    {
-                        assocPat = assocOut;
-                        command = argEnum.Next();
-                    }
-                    // nyaa ex <add|del|show>
-                    // Global Exclude Patterns.
-                    else
-                    {
-                        assocPat = -1;
-                        command = argEnum.Current;
-                    }
-                }
-                // nyaa <add|del|show>
-                else if (argEnum.Current.HasValue())
-                    command = argEnum.Current;
-
-                input = argEnum.GetRemaining().ToJoined();
-            }
-
-            switch (command)
-            {
-                case "add":
-                Add(e.Channel, e.Nick, input, assocPat);
-                return;
-
-                case "del":
+
+            case "del":
+            if (Allowed(e))
                 Del(e.Channel, e.Nick, input, assocPat);
-                return;
-
-                case "show":
-                ShowAll(e.Channel, e.Nick, assocPat);
-                return;
-
-                case null:
+            return;
+
+            case "show":
+            ShowAll(e.Channel, e.Nick, assocPat);
+            return;
+
+            case null:
+            if (conf.Feed != null)
+            {
                 e.Reply("Currently fetching {0} every {1} minutes. See nyaa add|del|show for usage.",
                         conf.Feed, conf.Interval.Minutes);
-                return;
-            }
-        }
-        else
-            e.Reply("Access denied, please contact my owner for information.");
+            }
+            else
+                e.Reply(feedError);
+            return;
+        }
+    }
+
+    bool Allowed(ITriggerMsg e)
+    {
+        if (conf.ActiveChannels.Contains(e.Channel) || meido.AuthLevel(e.Nick) >= 2)
+            return true;
+
+        e.Reply("Access denied, please contact my owner for information.");
+        return false;
     }


--- CSharp/Struct/ShortYear.cs
+++ CSharp/Struct/ShortYear.cs
@@ -14,11 +14,11 @@
 	public byte Year;
 	public const short Century = 1900;
 	public ShortYear(short value) {
-		Contract.Ensures(value >= 1900 && value < 2156);
+		Contract.Ensures(value >= Century && value < Century + 256);
 		Year = (byte)(value - Century);
 	}
 	public ShortYear(int value) {
-		Contract.Ensures(value >= 1900 && value < 2156);
+		Contract.Ensures(value >= Century && value < Century + 256);
 		Year = (byte)(value - Century);
 	}
     public static implicit operator short(ShortYear value) => (short)(value.Year + Century);


Remove no longer used file

Remove no longer used file

--- ClientKit/ClientContext.cs
+++ ClientKit/ClientContext.cs
@@ -1,124 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-using OSVR.ClientKit;
-
-namespace OSVR {
-
-namespace ClientKit {
-
-	/// @brief Client context object: Create and keep one in your application.
-	/// Handles lifetime management and provides access to ClientKit
-	/// functionality.
-	/// @ingroup ClientKitCPP
-	class ClientContext : IDisposable {
-			#region ClientKit C functions
-			#if UNITY_IPHONE || UNITY_XBOX360
-			// On iOS and Xbox 360, plugins are statically linked into
-			// the executable, so we have to use __Internal as the
-			// library name.
-			const string OSVR_CORE_DLL = "__Internal";
-			#else
-			const string OSVR_CORE_DLL = "osvrCore";
-			#endif
-
-			[DllImport (OSVR_CORE_DLL)]
-			IntPtr /*OSVR_ClientContext*/ osvrClientInit(string applicationIdentifier, uint flags);
-
-			[DllImport (OSVR_CORE_DLL)]
-			char osvrClientUpdate(IntPtr /*OSVR_ClientContext*/ ctx);
-
-			[DllImport (OSVR_CORE_DLL)]
-			char osvrClientShutdown(IntPtr /*OSVR_ClientContext*/ ctx);
-
-			#endregion
-
-		/// @brief Initialize the library.
-		/// @param applicationIdentifier A string identifying your application.
-		/// Reverse DNS format strongly suggested.
-		/// @param flags initialization options (reserved) - pass 0 for now.
-		public ClientContext(string applicationIdentifier, uint flags = 0)
-		{
-			this.m_context = osvrClientInit(applicationIdentifier, flags);
-		}
-
-		~ClientContext()
-		{
-			Dispose(false);
-		}
-
-		/// @brief Destructor: Shutdown the library.
-		public void Dispose()
-		{
-			Dispose(true);
-			osvrClientShutdown(m_context);
-		}
-
-		protected virtual void Dispose(bool disposing)
-		{
-			if (this.m_context != IntPtr.Zero) {
-				osvrClientShutdown (this.m_context);
-				this.m_context = IntPtr.Zero;
-			}
-
-			if (disposing) {
-				// No need to call the finalizer since we've now cleaned
-				// up the unmanaged memory.
-				GC.SuppressFinalize (this);
-			}
-		}
-
-		/// @brief Updates the state of the context - call regularly in your
-		/// mainloop.
-		public void update()
-		{
-			char ret = osvrClientUpdate(this.m_context);
-			if (OSVR_RETURN_SUCCESS != ret) {
-				throw ApplicationException("Error updating context.");
-			}
-		}
-
-		/// @brief Get the interface associated with the given path.
-		/// @param path A resource path.
-		/// @returns The interface object.
-		public Interface getInterface(string path)
-		{
-			IntPtr /*OSVR_ClientInterface*/ iface = IntPtr.Zero;
-			char ret = osvrClientGetInterface(this.m_context, path, ref iface);
-			if (OSVR_RETURN_SUCCESS != ret) {
-				throw ArgumentException("Couldn't create interface because the path was invalid.");
-			}
-
-			return new Interface(iface);
-		}
-
-		/// @brief Get a string parameter value from the given path.
-		/// @param path A resource path.
-		/// @returns parameter value, or empty string if parameter does not
-		/// exist or is not a string.
-		public string getStringParameter(string path)
-		{
-			size_t length = 0;
-			char ret = osvrClientGetStringParameterLength(m_context, path.c_str(), ref length);
-			if (OSVR_RETURN_SUCCESS != ret) {
-				throw ArgumentException("Invalid context or null reference to length variable.");
-			}
-
-			if (0 == length) {
-				return "";
-			}
-
-			boost::scoped_array<char> buf(new char[length]);
-			ret = osvrClientGetStringParameter(m_context, path.c_str(), buf.get(), length);
-			if (OSVR_RETURN_SUCCESS != ret) {
-				throw ApplicationException("Invalid context, null reference to buffer, or buffer is too small.");
-			}
-
-			return std::string(buf.get(), length);
-		}
-
-		private IntPtr /*OSVR_ClientContext*/ m_context;
-	}
-
-} // end namespace ClientKit
-
-} // end namespace OSVR


Fixed missing ";"

Fixed missing ";"

--- CloseRunningApp/Program.cs
+++ CloseRunningApp/Program.cs
@@ -32,7 +32,7 @@
                 }
                 catch
                 {
-                    Console.WriteLine("En error occurred while trying to connect to pipe.")
+                    Console.WriteLine("En error occurred while trying to connect to pipe.");
                 }

                 using (var writer = new StreamWriter(client))


Refactor + fix invalid method call

Refactor + fix invalid method call

--- LifeDISA/LifeDISA/Program.cs
+++ LifeDISA/LifeDISA/Program.cs
@@ -34,8 +34,19 @@
 			//parse vars
 			if(File.Exists(@"GAMEDATA\vars.txt"))
 			{
-				vars.Load(@"GAMEDATA\vars.txt", VarEnum.LIFES, VarEnum.BODYS, VarEnum.MUSIC, VarEnum.ANIMS, VarEnum.SPECIAL, VarEnum.TRACKS,
-				          VarEnum.POSREL, VarEnum.VARS, VarEnum.C_VARS, VarEnum.SOUNDS, VarEnum.ACTIONS, VarEnum.KEYBOARD_INPUT);
+				vars.Load(@"GAMEDATA\vars.txt",
+				          VarEnum.LIFES,
+				          VarEnum.BODYS,
+				          VarEnum.MUSIC,
+				          VarEnum.ANIMS,
+				          VarEnum.SPECIAL,
+				          VarEnum.TRACKS,
+				          VarEnum.POSREL,
+				          VarEnum.VARS,
+				          VarEnum.C_VARS,
+				          VarEnum.SOUNDS,
+				          VarEnum.ACTIONS,
+				          VarEnum.KEYBOARD_INPUT);
 			}

 			Regex r = new Regex(@"[0-9a-fA-F]{8}\.DAT", RegexOptions.IgnoreCase);
@@ -130,7 +141,7 @@
 					writer.WriteLine("--------------------------------------------------");
 					allBytes = pak.GetEntry(i);
 					#if AITD2 && !AITD3
-					if(i == 670) Fix670();
+					if(i == 670 && allBytes.Length == 182) Fix670();
 					#endif

 					ParseFile();
@@ -333,6 +344,7 @@
 		}
 		#endif

+		#if AITD2 && !AITD3
 		static void Fix670()
 		{
 			var list = allBytes.ToList();
@@ -343,6 +355,7 @@
 				allBytes[j] -= 4;
 			}
 		}
+		#endif

 		static void Dump(TextWriter writer)
 		{
@@ -483,7 +496,7 @@
 				case LifeEnum.DELETE:
 				case LifeEnum.IN_HAND:
 					#if AITD2
-						ins.Add(GetObject(Evalvar()));
+						ins.Add(GetObjectName(Evalvar()));
 					#else
 						ins.Add(GetObjectName(GetParam()));
 					#endif
@@ -913,7 +926,7 @@
 		static int GetParam()
 		{
 			int curr = allBytes.ReadShort(pos);
-			pos +=2;
+			pos += 2;
 			return curr;
 		}


Game list performance improvement by passing multiple roms to Mame for verification

--- Mamesaver/GameListBuilder.cs
+++ Mamesaver/GameListBuilder.cs
@@ -11,6 +11,17 @@
     internal static class GameListBuilder
     {
         ///
+        ///     Number of roms to process per batch. Rom files are batched when passing as arguments to Mame as a precaution
+        ///     in case we have a very large number of roms and end up with command line length limit issues.
+        ///
+        private const int RomsPerBatch = 50;
+
+        ///
+        ///     Settings for parsing Mame's listxml output
+        ///
+        private static readonly XmlReaderSettings ReaderSettings = new XmlReaderSettings { DtdProcessing = DtdProcessing.Parse };
+
+        ///
         /// Returns a <see cref="List{T}"/> of <see cref="SelectableGame"/>s which are read from
         /// the full list and then merged with the verified rom's list. The games which are returned
         /// all have a "good" status on their drivers. This check also eliminates BIOS ROMS.
@@ -21,42 +32,49 @@
             var games = new List<SelectableGame>();

             // Enrich game metadata for each verified game
-            foreach (var game in GetVerifiedSets())
+            var verifiedGames = GetVerifiedSets().Keys;
+
+            // Get details for each verified rom
+            var index = 0;
+            List<string> romsToProcess;
+            while ((romsToProcess = verifiedGames.Skip(index).Take(RomsPerBatch).ToList()).Any())
             {
-                using (var stream = GetGameDetails(game.Key))
-                {
-                    var readerSettings = new XmlReaderSettings { DtdProcessing = DtdProcessing.Parse };
-                    using (var reader = XmlReader.Create(stream, readerSettings))
-                    {
-                        reader.ReadStartElement("mame");
-
-                        // Read each machine, enriching metadata for verified sets
-                        while (reader.Read() && reader.Name == "machine")
-                        {
-                            // Read game metadata
-                            var element = (XElement) XNode.ReadFrom(reader);
-
-                            var name = element.Attribute("name")?.Value;
-                            if (name == null) continue;
-
-                            var driver = element.Element("driver");
-                            if (driver == null) continue;
-
-                            // Skip games which aren't fully emulated
-                            var status = driver.Attribute("status")?.Value;
-                            if (status != "good") continue;
-
-                            var year = element.Element("year")?.Value ?? "";
-                            var manufacturer = element.Element("manufacturer")?.Value ?? "";
-                            var description = element.Element("description")?.Value ?? "";
-
-                            games.Add(new SelectableGame(name, description, year, manufacturer, false));
-                        }
-                    }
-                }
+                using (var stream = GetGameDetails(romsToProcess)) GetRomDetails(stream, games);
+                index += RomsPerBatch;
             }

             return games;
+        }
+
+        private static void GetRomDetails(StreamReader stream, List<SelectableGame> games)
+        {
+            using (var reader = XmlReader.Create(stream, ReaderSettings))
+            {
+                reader.ReadStartElement("mame");
+
+                // Read each machine, enriching metadata for verified sets
+                while (reader.Read() && reader.Name == "machine")
+                {
+                    // Read game metadata
+                    var element = (XElement)XNode.ReadFrom(reader);
+
+                    var name = element.Attribute("name")?.Value;
+                    if (name == null) continue;
+
+                    var driver = element.Element("driver");
+                    if (driver == null) continue;
+
+                    // Skip games which aren't fully emulated
+                    var status = driver.Attribute("status")?.Value;
+                    if (status != "good") continue;
+
+                    var year = element.Element("year")?.Value ?? "";
+                    var manufacturer = element.Element("manufacturer")?.Value ?? "";
+                    var description = element.Element("description")?.Value ?? "";
+
+                    games.Add(new SelectableGame(name, description, year, manufacturer, false));
+                }
+            }
         }

         ///
@@ -69,18 +87,27 @@
             var verifiedRoms = new Dictionary<string, string>();
             var regex = new Regex(@"romset (\w*)(?:\s\[(\w*)\])? is good"); //only accept the "good" ROMS

+            var romFiles = GetRomFiles();
+
             // Verify each rom in directory
-            foreach (var rom in GetRomFiles())
+            var index = 0;
+            List<string> filesToVerify;
+            while ((filesToVerify = romFiles.Skip(index).Take(RomsPerBatch).ToList()).Any())
             {
-                // Retrieve state per rom
-                using (var stream = MameInvoker.GetOutput("-verifyroms", rom))
+                var arguments = new List<string> { "-verifyroms" }.Concat(filesToVerify).ToArray();
+                using (var stream = MameInvoker.GetOutput(arguments))
                 {
                     var output = stream.ReadToEnd();
-                    if (!regex.IsMatch(output)) continue;

-                    var matches = regex.Match(output);
-                    verifiedRoms[matches.Groups[1].Value] = matches.Groups[2].Value;
+                    var matches = regex.Matches(output);
+                    for (var i = 0; i < matches.Count; i++)
+                    {
+                        var match = matches[i];
+                        verifiedRoms[match.Groups[1].Value] = match.Groups[2].Value;
+                    }
                 }
+
+                index += RomsPerBatch;
             }

             return verifiedRoms;
@@ -92,7 +119,7 @@
         /// <remarks>
         ///     It is assumed that roms are zipped.
         /// </remarks>
-        private static IEnumerable<string> GetRomFiles()
+        private static List<string> GetRomFiles()
         {
             var roms = new List<string>();

@@ -153,13 +180,13 @@
         }

         ///
-        ///     Gets the full XML game list from Mame.
+        ///     Gets XML details for a list of games from Mame.
         ///
-        /// <param name="game">game to retrieve details for</param>
+        /// <param name="games">games to retrieve details for</param>
         /// <returns><see cref="StreamReader" /> containing stream of Mame XML</returns>
-        private static StreamReader GetGameDetails(string game)
+        private static StreamReader GetGameDetails(List<string> games)
         {
-            return MameInvoker.GetOutput("-listxml", game);
+            return MameInvoker.GetOutput(new List<string> { "-listxml" }.Concat(games).ToArray());
         }
     }
 }


Fix saving

Fix saving

--- Torch/Patches/TorchAsyncSaving.cs
+++ Torch/Patches/TorchAsyncSaving.cs
@@ -62,12 +62,11 @@

                 if (!Game.IsDedicated)
                     TakeSaveScreenshot();
-                tmpSnapshot.SaveParallel(() =>
+                tmpSnapshot.SaveParallel(() => true, () =>
                 {
                     if (!Game.IsDedicated && MySession.Static != null)
                         ShowWorldSaveResult(tmpSnapshot.SavingSuccess);
                     saveTaskSource.TrySetResult(tmpSnapshot.SavingSuccess ? GameSaveResult.Success : GameSaveResult.FailedToSaveToDisk);
-                    return false;
                 });
             });
             return saveTaskSource.Task;