Added FT for long path file single download with resume.

--- test/DMLibTest/Cases/LongFilePathTest.cs
+++ test/DMLibTest/Cases/LongFilePathTest.cs
@@ -5,14 +5,17 @@
 //------------------------------------------------------------------------------
 namespace DMLibTest.Cases
 {
+
+    using System;
+    using System.IO;
+    using System.Collections.Generic;
+    using System.Threading;
+
     using DMLibTestCodeGen;
     using Microsoft.VisualStudio.TestTools.UnitTesting;
     using Microsoft.WindowsAzure.Storage.DataMovement;
     using MS.Test.Common.MsTestLib;
-    using System;
-    using System.IO;
-    using System.Collections.Generic;
-    using System.Threading;
+    using DMLibTest.Framework;
 #if DNXCORE50
     using Xunit;

@@ -333,6 +336,206 @@
             }
         }

+        [TestCategory(Tag.Function)]
+        [DMLibTestMethodSet(DMLibTestMethodSet.DirLocalDest)]
+        public void LongFilePathResumeSingleDownload()
+        {
+            int fileSizeInKB = 100 * 1024;
+            DMLibDataInfo sourceDataInfo = new DMLibDataInfo(string.Empty);
+            DMLibDataHelper.AddOneFile(sourceDataInfo.RootNode, DMLibTestBase.FileName, fileSizeInKB);
+
+            string directoryName = Directory.GetCurrentDirectory();
+            DMLibDataInfo destDataInfo = new DMLibDataInfo(GetDirectoryName(directoryName, DMLibTestBase.FileName, pathLengthLimit));
+            DMLibDataHelper.AddOneFile(destDataInfo.RootNode, DMLibTestBase.FileName, fileSizeInKB);
+
+            CancellationTokenSource tokenSource = new CancellationTokenSource();
+
+            TransferItem transferItem = null;
+            var options = new TestExecutionOptions<DMLibDataInfo>();
+            options.DestTransferDataInfo = destDataInfo;
+            options.LimitSpeed = true;
+            options.DisableDestinationFetch = true;
+
+            bool IsStreamJournal = random.Next(0, 2) == 0;
+            using (Stream journalStream = new MemoryStream())
+            {
+                TransferContext transferContext = IsStreamJournal ? new SingleTransferContext(journalStream) : new SingleTransferContext();
+                var progressChecker = new ProgressChecker(1, fileSizeInKB * 1024, 0, 1, 0, fileSizeInKB * 1024);
+                transferContext.ProgressHandler = progressChecker.GetProgressHandler();
+                options.TransferItemModifier = (fileName, item) =>
+                {
+                    item.CancellationToken = tokenSource.Token;
+                    item.TransferContext = transferContext;
+                    transferItem = item;
+                };
+
+                TransferCheckpoint firstCheckpoint = null, secondCheckpoint = null;
+                options.AfterAllItemAdded = () =>
+                {
+                    if (IsStreamJournal &&
+                        (DMLibTestContext.SourceType == DMLibDataType.Stream
+                        || DMLibTestContext.DestType == DMLibDataType.Stream))
+                    {
+                        return;
+                    }
+
+                    // Wait until there are data transferred
+                    progressChecker.DataTransferred.WaitOne();
+
+                    // Store the first checkpoint
+                    if (!IsStreamJournal)
+                    {
+                        firstCheckpoint = transferContext.LastCheckpoint;
+                    }
+                    Thread.Sleep(1000);
+
+                    // Cancel the transfer and store the second checkpoint
+                    tokenSource.Cancel();
+                };
+
+                // Cancel and store checkpoint for resume
+                var result = this.ExecuteTestCase(sourceDataInfo, options);
+
+                if (!IsStreamJournal)
+                {
+                    secondCheckpoint = transferContext.LastCheckpoint;
+                }
+                else
+                {
+                    if (DMLibTestContext.SourceType == DMLibDataType.Stream || DMLibTestContext.DestType == DMLibDataType.Stream)
+                    {
+                        Test.Assert(result.Exceptions.Count == 1, "Verify job is failed");
+                        Exception jobException = result.Exceptions[0];
+                        Test.Info("{0}", jobException);
+                        VerificationHelper.VerifyExceptionErrorMessage(jobException, "Cannot deserialize to TransferLocation when its TransferLocationType is Stream.");
+                        return;
+                    }
+                }
+
+                Test.Assert(result.Exceptions.Count == 1, "Verify job is cancelled");
+                Exception exception = result.Exceptions[0];
+                VerificationHelper.VerifyExceptionErrorMessage(exception, "A task was canceled.");
+
+                TransferCheckpoint firstResumeCheckpoint = null, secondResumeCheckpoint = null;
+                ProgressChecker firstProgressChecker = null, secondProgressChecker = null;
+
+                if (!IsStreamJournal)
+                {
+                    // DMLib doesn't support to resume transfer from a checkpoint which is inconsistent with
+                    // the actual transfer progress when the destination is an append blob.
+                    if (Helper.RandomBoolean() && (DMLibTestContext.DestType != DMLibDataType.AppendBlob || DMLibTestContext.IsAsync))
+                    {
+                        Test.Info("Resume with the first checkpoint first.");
+                        firstResumeCheckpoint = firstCheckpoint;
+                        secondResumeCheckpoint = secondCheckpoint;
+                    }
+                    else
+                    {
+                        Test.Info("Resume with the second checkpoint first.");
+                        firstResumeCheckpoint = secondCheckpoint;
+                        secondResumeCheckpoint = firstCheckpoint;
+                    }
+                }
+
+                // first progress checker
+                if (DMLibTestContext.SourceType == DMLibDataType.Stream && DMLibTestContext.DestType != DMLibDataType.BlockBlob)
+                {
+                    // The destination is already created, will cause a transfer skip
+                    firstProgressChecker = new ProgressChecker(2, fileSizeInKB * 1024, 0, 1 /* failed */, 1 /* skipped */, fileSizeInKB * 1024);
+                }
+                else if (DMLibTestContext.DestType == DMLibDataType.Stream || (DMLibTestContext.SourceType == DMLibDataType.Stream && DMLibTestContext.DestType == DMLibDataType.BlockBlob))
+                {
+                    firstProgressChecker = new ProgressChecker(2, 2 * fileSizeInKB * 1024, 1 /* transferred */, 1 /* failed */, 0, 2 * fileSizeInKB * 1024);
+                }
+                else
+                {
+                    firstProgressChecker = new ProgressChecker(1, fileSizeInKB * 1024, 1, 0, 0, fileSizeInKB * 1024);
+                }
+
+                // second progress checker
+                if (DMLibTestContext.SourceType == DMLibDataType.Stream)
+                {
+                    // The destination is already created, will cause a transfer skip
+                    secondProgressChecker = new ProgressChecker(2, fileSizeInKB * 1024, 0, 1 /* failed */, 1 /* skipped */, fileSizeInKB * 1024);
+                }
+                else if (DMLibTestContext.DestType == DMLibDataType.Stream)
+                {
+                    secondProgressChecker = new ProgressChecker(2, 2 * fileSizeInKB * 1024, 1 /* transferred */, 1 /* failed */, 0, 2 * fileSizeInKB * 1024);
+                }
+                else if (DMLibTestContext.DestType == DMLibDataType.AppendBlob && !DMLibTestContext.IsAsync)
+                {
+                    secondProgressChecker = new ProgressChecker(1, fileSizeInKB * 1024, 0, 1 /* failed */, 0, fileSizeInKB * 1024);
+                }
+                else
+                {
+                    secondProgressChecker = new ProgressChecker(1, fileSizeInKB * 1024, 1 /* transferred */, 0, 0, fileSizeInKB * 1024);
+                }
+
+                // resume with firstResumeCheckpoint
+                TransferItem resumeItem = transferItem.Clone();
+                TransferContext resumeContext = null;
+
+                if (IsStreamJournal)
+                {
+                    Exception deserializeEX = null;
+                    try
+                    {
+                        resumeContext = new SingleTransferContext(journalStream)
+                        {
+                            ProgressHandler = firstProgressChecker.GetProgressHandler()
+                        };
+                    }
+                    catch (Exception ex)
+                    {
+                        if ((DMLibTestContext.SourceType != DMLibDataType.Stream)
+                            && (DMLibTestContext.DestType != DMLibDataType.Stream))
+                        {
+                            Test.Error("Should no exception in deserialization when no target is stream.");
+                        }
+
+                        deserializeEX = ex;
+                    }
+                }
+                else
+                {
+                    resumeContext = new SingleTransferContext(IsStreamDirection() ? firstResumeCheckpoint : DMLibTestHelper.RandomReloadCheckpoint(firstResumeCheckpoint))
+                    {
+                        ProgressHandler = firstProgressChecker.GetProgressHandler()
+                    };
+                }
+
+                resumeItem.TransferContext = resumeContext;
+
+                result = this.RunTransferItems(new List<TransferItem>() { resumeItem }, new TestExecutionOptions<DMLibDataInfo>());
+
+                DataAdaptor<DMLibDataInfo> destAdaptor = GetDestAdaptor(DMLibDataType.Local);
+                destDataInfo = destAdaptor.GetTransferDataInfo(destDataInfo.RootPath);
+
+                Test.Assert(result.Exceptions.Count == 0, "Verify no exception is thrown.");
+                Test.Assert(DMLibDataHelper.Equals(sourceDataInfo, destDataInfo), "Verify transfer result.");
+
+                if (!IsStreamJournal)
+                {
+                    // resume with secondResumeCheckpoint
+                    resumeItem = transferItem.Clone();
+                    resumeContext = new SingleTransferContext(
+                        IsStreamDirection() ? secondResumeCheckpoint : DMLibTestHelper.RandomReloadCheckpoint(secondResumeCheckpoint))
+                    {
+                        ProgressHandler = secondProgressChecker.GetProgressHandler()
+                    };
+                    resumeItem.TransferContext = resumeContext;
+
+                    result = this.RunTransferItems(new List<TransferItem>() { resumeItem }, new TestExecutionOptions<DMLibDataInfo>());
+
+                    destAdaptor = GetDestAdaptor(DMLibDataType.Local);
+                    destDataInfo = destAdaptor.GetTransferDataInfo(destDataInfo.RootPath);
+
+                    Test.Assert(result.Exceptions.Count == 0, "Verify no exception is thrown.");
+                    Test.Assert(DMLibDataHelper.Equals(sourceDataInfo, destDataInfo), "Verify transfer result.");
+                }
+            }
+        }
+
         private static string GetTransferString(DMLibDataType sourceType, DMLibDataType destType, bool isAsync)
         {
             return sourceType.ToString() + destType.ToString() + (isAsync ? "async" : "");
@@ -347,7 +550,7 @@
         {
             int nameLimit = 200;
             string tempName = "t";
-            string tempPath = LongPath.ToUncPath(LongPath.Combine(LongPath.Combine(path, tempName), fileName));
+            string tempPath = LongPathExtention.ToUncPath(LongPathExtention.Combine(LongPathExtention.Combine(path, tempName), fileName));
             int targetLength = length - tempPath.Length + tempName.Length;
             string middleDirectoryName = "";
             while(targetLength > 0)
@@ -370,7 +573,7 @@
                     targetLength = 0;
                 }
             }
-            return LongPath.Combine(path, middleDirectoryName);
+            return LongPathExtention.Combine(path, middleDirectoryName);
         }
     }
 }


test nuget prerelease version.

test nuget prerelease version.

--- BuildScript.cs
+++ BuildScript.cs
@@ -85,13 +85,15 @@
     private static void PublishNuGetPackage(ITaskContext context)
     {
         var version = context.Properties.GetBuildVersion();
+        var nugetVersion = version.ToString(3);
+        nugetVersion = nugetVersion + "-rc1";

         try
         {

             context.CoreTasks().ExecuteDotnetTask("nuget")
                 .WithArguments("push")
-                .WithArguments($"output\\FlubuCore.{version.ToString(3)}.nupkg")
+                .WithArguments($"output\\FlubuCore.{nugetVersion}.nupkg")
                 .WithArguments("-s", "https://www.nuget.org/api/v2/package")
                 .WithArguments("-k", "8da65a4d-9409-4d1b-9759-3b604d7a34ae").Execute(context);
         }
@@ -104,7 +106,7 @@
         {
             context.CoreTasks().ExecuteDotnetTask("nuget")
            .WithArguments("push")
-           .WithArguments($"output\\dotnet-flubu.{version.ToString(3)}.nupkg")
+           .WithArguments($"output\\dotnet-flubu.{nugetVersion}.nupkg")
            .WithArguments("-s", "https://www.nuget.org/api/v2/package")
            .WithArguments("-k", "8da65a4d-9409-4d1b-9759-3b604d7a34ae").Execute(context);
         }
@@ -113,19 +115,19 @@
             Console.WriteLine($"Failed to publish dotnet-flubu. exception: {e.Message}");
         }

-        try
-        {
-            var task = context.Tasks().PublishNuGetPackageTask("FlubuCore.Runner", @"Nuget\FlubuCoreRunner.nuspec");
+        ////try
+        ////{
+        ////    var task = context.Tasks().PublishNuGetPackageTask("FlubuCore.Runner", @"Nuget\FlubuCoreRunner.nuspec");

-            task.NuGetServerUrl = "https://www.nuget.org/api/v2/package";
-            task.ForApiKeyUse("8da65a4d-9409-4d1b-9759-3b604d7a34ae");
-            task.AllowPushOnInteractiveBuild = true;
-            task.Execute(context);
-        }
-        catch (Exception e)
-        {
-            Console.WriteLine($"Failed to publish flubu.ruuner. exception: {e}");
-        }
+        ////    task.NuGetServerUrl = "https://www.nuget.org/api/v2/package";
+        ////    task.ForApiKeyUse("8da65a4d-9409-4d1b-9759-3b604d7a34ae");
+        ////    task.AllowPushOnInteractiveBuild = true;
+        ////    task.Execute(context);
+        ////}
+        ////catch (Exception e)
+        ////{
+        ////    Console.WriteLine($"Failed to publish flubu.ruuner. exception: {e}");
+        ////}
     }

     private static void TargetMerge(ITaskContext context)


Including referenced ignored types

Including referenced ignored types

--- src/ApiContractGenerator/IgnoredNamespaceFilter.cs
+++ src/ApiContractGenerator/IgnoredNamespaceFilter.cs
@@ -4,6 +4,7 @@
 using System.Text;
 using System.Text.RegularExpressions;
 using ApiContractGenerator.Model;
+using ApiContractGenerator.Model.TypeReferences;
 using ApiContractGenerator.Source;

 namespace ApiContractGenerator
@@ -22,27 +23,415 @@
         private IReadOnlyList<IMetadataNamespace> namespaces;
         public IReadOnlyList<IMetadataNamespace> Namespaces
         {
-            get => namespaces ?? (namespaces = CalculateNonignoredTransitiveClosure());
+            get => namespaces ?? (namespaces =
+                ReferencedIgnoredMetadataVisitor.CalculateNonignoredTransitiveClosure(source, ignoredNamespaces));
         }

-        private IReadOnlyList<IMetadataNamespace> CalculateNonignoredTransitiveClosure()
+        private sealed class ReferencedIgnoredMetadataVisitor
         {
-            var regexBuilder = (StringBuilder)null;
-            foreach (var ignoredNamespace in ignoredNamespaces)
-            {
-                if (regexBuilder == null)
-                    regexBuilder = new StringBuilder(@"\A(?:");
-                else
-                    regexBuilder.Append('|');
-
-                regexBuilder.Append(Regex.Escape(ignoredNamespace));
-            }
-
-            if (regexBuilder == null) return source.Namespaces;
-
-            var regex = new Regex(regexBuilder.Append(@")(\Z|\.)").ToString(), RegexOptions.IgnoreCase);
-
-            return source.Namespaces.Where(ns => !regex.IsMatch(ns.Name)).ToList();
+            private readonly IReadOnlyDictionary<string, PartiallyIgnoredNamespaceBuilder> ignoredNamespaces;
+
+            private ReferencedIgnoredMetadataVisitor(IReadOnlyDictionary<string, PartiallyIgnoredNamespaceBuilder> ignoredNamespaces)
+            {
+                this.ignoredNamespaces = ignoredNamespaces;
+            }
+
+            public static IReadOnlyList<IMetadataNamespace> CalculateNonignoredTransitiveClosure(IMetadataSource source, IEnumerable<string> ignoredNamespaces)
+            {
+                var regexBuilder = (StringBuilder)null;
+                foreach (var ignoredNamespace in ignoredNamespaces)
+                {
+                    if (regexBuilder == null)
+                        regexBuilder = new StringBuilder(@"\A(?:");
+                    else
+                        regexBuilder.Append('|');
+
+                    regexBuilder.Append(Regex.Escape(ignoredNamespace));
+                }
+
+                if (regexBuilder == null) return source.Namespaces;
+
+                var namespaceIgnoreRegex = new Regex(regexBuilder.Append(@")(\Z|\.)").ToString(), RegexOptions.IgnoreCase);
+
+                var ignoredNamespaceLookup = new Dictionary<string, PartiallyIgnoredNamespaceBuilder>();
+
+                var includedNamespaces = new List<IMetadataNamespace>(source.Namespaces.Count);
+                foreach (var ns in source.Namespaces)
+                {
+                    if (namespaceIgnoreRegex.IsMatch(ns.Name))
+                        ignoredNamespaceLookup.Add(ns.Name, new PartiallyIgnoredNamespaceBuilder(ns));
+                    else
+                        includedNamespaces.Add(ns);
+                }
+
+                if (ignoredNamespaceLookup.Count != 0)
+                {
+                    var visitor = new ReferencedIgnoredMetadataVisitor(ignoredNamespaceLookup);
+
+                    foreach (var ns in includedNamespaces)
+                    foreach (var type in ns.Types)
+                        visitor.VisitNonignoredType(type);
+
+                    foreach (var ns in visitor.ignoredNamespaces.Values)
+                        if (ns.Types.Count != 0)
+                            includedNamespaces.Add(ns);
+                }
+
+                return includedNamespaces;
+            }
+
+            private void VisitNonignoredType(IMetadataType type)
+            {
+                // Types should not be brought in via interface implementations;
+                // if interface implementations are the only thing bringing it in, that requires naming the ignored type.
+
+                // Generic type and method constraints don't need to be considered;
+                // they'll be picked up in an output position already by VisitTypeReference.
+
+                foreach (var field in type.Fields)
+                    VisitTypeReference(field.FieldType);
+
+                foreach (var method in type.Methods) // Covers constructors, operators, properties and events
+                {
+                    foreach (var parameter in method.Parameters)
+                    {
+                        if (parameter.IsOut // Out var
+                            /* TODO: or parameter is delegate type */)
+                        {
+                            VisitTypeReference(method.ReturnType);
+                        }
+
+                        // Otherwise, types should not be brought in via method parameters;
+                        // if method parameters are the only thing bringing it in, that requires naming the ignored type.
+                    }
+
+                    VisitTypeReference(method.ReturnType);
+                }
+
+                if (type.BaseType != null) VisitTypeReference(type.BaseType);
+
+                if (type is IMetadataDelegate @delegate)
+                {
+                    // Delegate parameters don't require naming the ignored type in order to receive values from them.
+                    // when passing the delegate as a parameter.
+                    foreach (var parameter in @delegate.Parameters)
+                        VisitTypeReference(parameter.ParameterType);
+
+                    // Delegate returns don't require naming the ignored type in order to receive values from them
+                    // when invoking them.
+                    VisitTypeReference(@delegate.ReturnType);
+                }
+
+                foreach (var nestedType in type.NestedTypes)
+                    VisitNonignoredType(nestedType);
+            }
+
+            private void VisitTypeReference(MetadataTypeReference type)
+            {
+                for (;;)
+                {
+                    switch (type)
+                    {
+                        case TopLevelTypeReference topLevel:
+                            VisitTypeName(topLevel.Namespace, topLevel.Name, Array.Empty<string>());
+                            return;
+
+                        case NestedTypeReference nested:
+                            for (var nestedNames = new List<string>(); ;)
+                            {
+                                nestedNames.Add(nested.Name);
+                                if (nested.DeclaringType is NestedTypeReference next)
+                                {
+                                    nested = next;
+                                }
+                                else
+                                {
+                                    var topLevel = (TopLevelTypeReference)nested.DeclaringType;
+                                    nestedNames.Reverse();
+                                    VisitTypeName(topLevel.Namespace, topLevel.Name, nestedNames);
+                                    return;
+                                }
+                            }
+
+                        case GenericInstantiationTypeReference genericInstantiation:
+                            foreach (var argument in genericInstantiation.GenericTypeArguments)
+                                VisitTypeReference(argument);
+                            type = genericInstantiation.TypeDefinition;
+                            continue;
+
+                        case ArrayTypeReference array:
+                            type = array.ElementType;
+                            continue;
+
+                        case ByRefTypeReference byref:
+                            type = byref.ElementType;
+                            continue;
+
+                        case PointerTypeReference pointer:
+                            type = pointer.ElementType;
+                            continue;
+
+                        case GenericParameterTypeReference genericParameter:
+                            foreach (var constraint in genericParameter.TypeParameter.TypeConstraints)
+                                VisitTypeReference(constraint);
+                            return;
+
+                        case PrimitiveTypeReference _:
+                            return;
+
+                        default:
+                            throw new NotImplementedException();
+                    }
+                }
+            }
+
+            private void VisitTypeName(string @namespace, string topLevelName, IReadOnlyList<string> nestedNames)
+            {
+                if (ignoredNamespaces.TryGetValue(@namespace, out var builder)
+                    && builder.TryUnignore(topLevelName, nestedNames, out var unignoredType))
+                {
+                    VisitNonignoredType(unignoredType);
+                }
+            }
+
+            private sealed class PartiallyIgnoredNamespaceBuilder : IMetadataNamespace
+            {
+                private readonly IMetadataNamespace originalNamespace;
+                private readonly List<PartiallyIgnoredTypeBuilder> typeBuilders = new List<PartiallyIgnoredTypeBuilder>();
+
+                public PartiallyIgnoredNamespaceBuilder(IMetadataNamespace originalNamespace)
+                {
+                    this.originalNamespace = originalNamespace;
+                }
+
+                public string Name => originalNamespace.Name;
+
+                public IReadOnlyList<IMetadataType> Types => typeBuilders;
+
+                /// <summary>
+                /// Returns <see langword="false"/> if the type is not found or if it has already been unignored.
+                /// </summary>
+                public bool TryUnignore(string topLevelName, IReadOnlyList<string> nestedNames, out IMetadataType unignoredType)
+                {
+                    var current = originalNamespace.Types.FirstOrDefault(_ => _.Name == topLevelName);
+                    if (current != null)
+                    {
+                        if (nestedNames.Count == 0)
+                        {
+                            var builder = typeBuilders.FirstOrDefault(_ => _.Name == topLevelName);
+                            if (builder == null)
+                            {
+                                typeBuilders.Add(PartiallyIgnoredTypeBuilder.Create(current, asDeclaringNameOnly: false));
+                            }
+                            else if (!builder.TryUnignore())
+                            {
+                                unignoredType = null;
+                                return false;
+                            }
+
+                            unignoredType = current;
+                            return true;
+                        }
+                        else
+                        {
+                            var parentTypes = new List<IMetadataType>(nestedNames.Count);
+                            foreach (var name in nestedNames)
+                            {
+                                parentTypes.Add(current);
+                                current = current.NestedTypes.FirstOrDefault(_ => _.Name == name);
+                                if (current == null)
+                                {
+                                    unignoredType = null;
+                                    return false;
+                                }
+                            }
+
+                            var builder = typeBuilders.FirstOrDefault(_ => _.Name == topLevelName);
+                            if (builder == null)
+                                typeBuilders.Add(builder = PartiallyIgnoredTypeBuilder.Create(parentTypes[0], asDeclaringNameOnly: true));
+
+                            if (builder.TryUnignoreNested(parentTypes, 0, current))
+                            {
+                                unignoredType = current;
+                                return true;
+                            }
+                        }
+                    }
+
+                    unignoredType = null;
+                    return false;
+                }
+            }
+
+            private abstract class PartiallyIgnoredTypeBuilder : IMetadataType
+            {
+                private readonly IMetadataType original;
+                private readonly List<PartiallyIgnoredTypeBuilder> nestedTypeBuilders = new List<PartiallyIgnoredTypeBuilder>();
+
+                private bool asDeclaringNameOnly;
+
+                private PartiallyIgnoredTypeBuilder(IMetadataType original, bool asDeclaringNameOnly)
+                {
+                    this.original = original;
+                    this.asDeclaringNameOnly = asDeclaringNameOnly;
+                }
+
+                public static PartiallyIgnoredTypeBuilder Create(IMetadataType original, bool asDeclaringNameOnly)
+                {
+                    switch (original)
+                    {
+                        case IMetadataClass @class:
+                            return new PartiallyIgnoredClassBuilder(@class, asDeclaringNameOnly);
+                        case IMetadataStruct @struct:
+                            return new PartiallyIgnoredStructBuilder(@struct, asDeclaringNameOnly);
+                        case IMetadataInterface @interface:
+                            return new PartiallyIgnoredInterfaceBuilder(@interface, asDeclaringNameOnly);
+                        case IMetadataEnum @enum:
+                            return new PartiallyIgnoredEnumBuilder(@enum, asDeclaringNameOnly);
+                        case IMetadataDelegate @delegate:
+                            return new PartiallyIgnoredDelegateBuilder(@delegate, asDeclaringNameOnly);
+                        default:
+                            throw new NotImplementedException();
+                    }
+                }
+
+                private sealed class PartiallyIgnoredClassBuilder : PartiallyIgnoredTypeBuilder, IMetadataClass
+                {
+                    public PartiallyIgnoredClassBuilder(IMetadataClass original, bool asDeclaringNameOnly) : base(original, asDeclaringNameOnly)
+                    {
+                    }
+
+                    public bool IsStatic => ((IMetadataClass)original).IsStatic;
+                    public bool IsAbstract => ((IMetadataClass)original).IsAbstract;
+                    public bool IsSealed => ((IMetadataClass)original).IsSealed;
+                }
+
+                private sealed class PartiallyIgnoredStructBuilder : PartiallyIgnoredTypeBuilder, IMetadataStruct
+                {
+                    public PartiallyIgnoredStructBuilder(IMetadataStruct original, bool asDeclaringNameOnly) : base(original, asDeclaringNameOnly)
+                    {
+                    }
+                }
+
+                private sealed class PartiallyIgnoredInterfaceBuilder : PartiallyIgnoredTypeBuilder, IMetadataInterface
+                {
+                    public PartiallyIgnoredInterfaceBuilder(IMetadataInterface original, bool asDeclaringNameOnly) : base(original, asDeclaringNameOnly)
+                    {
+                    }
+                }
+
+                private sealed class PartiallyIgnoredEnumBuilder : PartiallyIgnoredTypeBuilder, IMetadataEnum
+                {
+                    public PartiallyIgnoredEnumBuilder(IMetadataEnum original, bool asDeclaringNameOnly) : base(original, asDeclaringNameOnly)
+                    {
+                    }
+
+                    public MetadataTypeReference UnderlyingType => ((IMetadataEnum)original).UnderlyingType;
+                }
+
+                private sealed class PartiallyIgnoredDelegateBuilder : PartiallyIgnoredTypeBuilder, IMetadataDelegate
+                {
+                    public PartiallyIgnoredDelegateBuilder(IMetadataDelegate original, bool asDeclaringNameOnly) : base(original, asDeclaringNameOnly)
+                    {
+                    }
+
+                    public MetadataTypeReference ReturnType => ((IMetadataDelegate)original).ReturnType;
+                    public IReadOnlyList<IMetadataAttribute> ReturnValueAttributes => ((IMetadataDelegate)original).ReturnValueAttributes;
+                    public IReadOnlyList<IMetadataParameter> Parameters => ((IMetadataDelegate)original).Parameters;
+                }
+
+
+                public bool TryUnignore()
+                {
+                    if (!asDeclaringNameOnly) return false;
+                    asDeclaringNameOnly = false;
+                    return true;
+                }
+
+                public bool TryUnignoreNested(IReadOnlyList<IMetadataType> parentTypes, int parentIndex, IMetadataType typeToUnignore)
+                {
+                    var nextParentIndex = parentIndex + 1;
+                    if (nextParentIndex != parentTypes.Count)
+                    {
+                        var nextParent = parentTypes[nextParentIndex];
+
+                        var builder = nestedTypeBuilders.FirstOrDefault(_ => _.Name == nextParent.Name);
+                        if (builder == null)
+                            nestedTypeBuilders.Add(builder = Create(nextParent, asDeclaringNameOnly: true));
+
+                        return builder.TryUnignoreNested(parentTypes, nextParentIndex, typeToUnignore);
+                    }
+                    else
+                    {
+                        var builder = nestedTypeBuilders.FirstOrDefault(_ => _.Name == typeToUnignore.Name);
+                        if (builder == null)
+                        {
+                            nestedTypeBuilders.Add(Create(typeToUnignore, asDeclaringNameOnly: false));
+                            return true;
+                        }
+                        return builder.TryUnignore();
+                    }
+                }
+
+                public IReadOnlyList<IMetadataType> NestedTypes => nestedTypeBuilders;
+
+                public string Name => original.Name;
+
+                public MetadataVisibility Visibility => original.Visibility;
+
+                public IReadOnlyList<IMetadataGenericTypeParameter> GenericTypeParameters => original.GenericTypeParameters;
+
+                public IReadOnlyList<IMetadataAttribute> Attributes
+                {
+                    get => asDeclaringNameOnly
+                        ? Array.Empty<IMetadataAttribute>()
+                        : original.Attributes;
+                }
+
+                public MetadataTypeReference BaseType
+                {
+                    get => asDeclaringNameOnly
+                        ? null
+                        : original.BaseType;
+                }
+
+                public IReadOnlyList<MetadataTypeReference> InterfaceImplementations
+                {
+                    get => asDeclaringNameOnly
+                        ? Array.Empty<MetadataTypeReference>()
+                        : original.InterfaceImplementations;
+                }
+
+                private bool CouldBeInheritedByNonignoredType => original is IMetadataClass @class && !@class.IsStatic && !@class.IsSealed;
+
+                public IReadOnlyList<IMetadataField> Fields
+                {
+                    get => asDeclaringNameOnly ? Array.Empty<IMetadataField>() :
+                        CouldBeInheritedByNonignoredType ? original.Fields :
+                        original.Fields.Where(_ => _.IsStatic == false).ToList();
+                }
+
+                public IReadOnlyList<IMetadataProperty> Properties
+                {
+                    get => asDeclaringNameOnly ? Array.Empty<IMetadataProperty>() :
+                        CouldBeInheritedByNonignoredType ? original.Properties :
+                        original.Properties.Where(_ => _.GetAccessor?.IsStatic == false || _.SetAccessor?.IsStatic == false).ToList();
+                }
+
+                public IReadOnlyList<IMetadataEvent> Events
+                {
+                    get => asDeclaringNameOnly ? Array.Empty<IMetadataEvent>() :
+                        CouldBeInheritedByNonignoredType ? original.Events :
+                        original.Events.Where(_ => _.AddAccessor?.IsStatic == false || _.RemoveAccessor?.IsStatic == false || _.RaiseAccessor?.IsStatic == false).ToList();
+                }
+
+                public IReadOnlyList<IMetadataMethod> Methods
+                {
+                    get => asDeclaringNameOnly ? (IReadOnlyList<IMetadataMethod>)Array.Empty<IMetadataMethod>() :
+                        CouldBeInheritedByNonignoredType ? original.Methods.Where(_ => _.Name != ".ctor").ToList() :
+                        original.Methods.Where(_ => _.IsStatic == false && _.Name != ".ctor").ToList();
+                }
+            }
         }
     }
 }


Updated FacetIterator.cs to 4.0.2 compatibility (as long as string still works for Comparable<?>).

--- src/BoboBrowse.Net/BoboBrowse.Net/FacetIterator.cs
+++ src/BoboBrowse.Net/BoboBrowse.Net/FacetIterator.cs
@@ -17,7 +17,7 @@
 //* See the License for the specific language governing permissions and
 //* limitations under the License.

-// Version compatibility level: 3.2.0
+// Version compatibility level: 4.0.2
 namespace BoboBrowse.Net
 {
     using BoboBrowse.Net.Support;


[tests][mono] RoslynCodeTaskFactory is broken on mono

.. so, use `CodeTaskFactory` on mono, for now. Affected tests:

```
    Microsoft.Build.Experimental.Graph.UnitTests.IsolateProjectsTests.EnforcementsCanBeSkipped(targetName: "BuildUndeclaredReferenceViaTask")
    Microsoft.Build.Experimental.Graph.UnitTests.IsolateProjectsTests.EnforcementsCanBeSkipped(targetName: "BuildDeclaredReferenceViaTask")
    Microsoft.Build.Experimental.Graph.UnitTests.IsolateProjectsTests.CacheEnforcementShouldAcceptPreviouslyBuiltReferences(targetName: "BuildDeclaredReferenceViaTask")
```

--- src/Build.UnitTests/Graph/IsolateProjects_Tests.cs
+++ src/Build.UnitTests/Graph/IsolateProjects_Tests.cs
@@ -59,7 +59,7 @@
                     <Target Name='SelfTarget'>
                     </Target>

-                    <UsingTask TaskName='CustomMSBuild' TaskFactory='RoslynCodeTaskFactory' AssemblyFile='$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll'>
+                    <UsingTask TaskName='CustomMSBuild' TaskFactory='{5}' AssemblyFile='$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll'>
                         <ParameterGroup>
                           <Projects ParameterType='Microsoft.Build.Framework.ITaskItem[]' Required='true' />
                           <Targets ParameterType='Microsoft.Build.Framework.ITaskItem[]' Required='true' />
@@ -393,7 +393,8 @@
                     : string.Empty,
                 excludeReferencesFromConstraints
                     ? $"{declaredReferenceFile};{undeclaredReferenceFile}"
-                    : string.Empty)
+                    : string.Empty,
+                NativeMethodsShared.IsMono ? "CodeTaskFactory" : "RoslynCodeTaskFactory")
                 .Cleanup();

             File.WriteAllText(rootProjectFile, projectContents);


Update SkiaSharpRenderer.cs

Update SkiaSharpRenderer.cs

--- src/Core2D/Renderer/SkiaSharp/SkiaSharpRenderer.cs
+++ src/Core2D/Renderer/SkiaSharp/SkiaSharpRenderer.cs
@@ -59,62 +59,38 @@
             double rheight = Math.Abs(rect.Bottom - rect.Top);
             double swidth = Math.Abs(size.Right - size.Left);
             double sheight = Math.Abs(size.Bottom - size.Top);
-            double ox, oy;
-
-            switch (style.TextStyle.TextHAlignment)
-            {
-                case TextHAlignment.Left:
-                    ox = rect.Left;
-                    break;
-                case TextHAlignment.Right:
-                    ox = rect.Right - swidth;
-                    break;
-                case TextHAlignment.Center:
-                default:
-                    ox = (rect.Left + rwidth / 2f) - (swidth / 2f);
-                    break;
-            }
-
-            switch (style.TextStyle.TextVAlignment)
-            {
-                case TextVAlignment.Top:
-                    oy = rect.Top;
-                    break;
-                case TextVAlignment.Bottom:
-                    oy = rect.Bottom - sheight;
-                    break;
-                case TextVAlignment.Center:
-                default:
-                    oy = (rect.Bottom - rheight / 2f) - (sheight / 2f);
-                    break;
-            }
-
+            var ox = style.TextStyle.TextHAlignment switch
+            {
+                TextHAlignment.Left => rect.Left,
+                TextHAlignment.Right => rect.Right - swidth,
+                _ => (rect.Left + rwidth / 2f) - (swidth / 2f),
+            };
+            var oy = style.TextStyle.TextVAlignment switch
+            {
+                TextVAlignment.Top => rect.Top,
+                TextVAlignment.Bottom => rect.Bottom - sheight,
+                _ => (rect.Bottom - rheight / 2f) - (sheight / 2f),
+            };
             return new SKPoint((float)ox, (float)oy);
         }

         private SKColor ToSKColor(IColor color)
         {
-            switch (color)
-            {
-                case IArgbColor argbColor:
-                    return new SKColor(argbColor.R, argbColor.G, argbColor.B, argbColor.A);
-                default:
-                    throw new NotSupportedException($"The {color.GetType()} color type is not supported.");
-            }
+            return color switch
+            {
+                IArgbColor argbColor => new SKColor(argbColor.R, argbColor.G, argbColor.B, argbColor.A),
+                _ => throw new NotSupportedException($"The {color.GetType()} color type is not supported."),
+            };
         }

         private static SKStrokeCap ToStrokeCap(IBaseStyle style)
         {
-            switch (style.LineCap)
-            {
-                default:
-                case LineCap.Flat:
-                    return SKStrokeCap.Butt;
-                case LineCap.Square:
-                    return SKStrokeCap.Square;
-                case LineCap.Round:
-                    return SKStrokeCap.Round;
-            }
+            return style.LineCap switch
+            {
+                LineCap.Square => SKStrokeCap.Square,
+                LineCap.Round => SKStrokeCap.Round,
+                _ => SKStrokeCap.Butt,
+            };
         }

         private SKPaint ToSKPaintPen(IBaseStyle style, Func<double, float> scale, double sourceDpi, double targetDpi)
@@ -351,10 +327,10 @@
         {
             using var brush = ToSKPaintBrush(color);
             SKRect srect = SKRect.Create(
-_scaleToPage(rect.X),
-_scaleToPage(rect.Y),
-_scaleToPage(rect.Width),
-_scaleToPage(rect.Height));
+                _scaleToPage(rect.X),
+                _scaleToPage(rect.Y),
+                _scaleToPage(rect.Width),
+                _scaleToPage(rect.Height));
             canvas.DrawRect(srect, brush);
         }

@@ -511,10 +487,10 @@
             using var pen = ToSKPaintPen(arc.Style, _scaleToPage, _sourceDpi, _targetDpi);
             using var path = new SKPath();
             var a = new GdiArc(
-Point2.FromXY(arc.Point1.X, arc.Point1.Y),
-Point2.FromXY(arc.Point2.X, arc.Point2.Y),
-Point2.FromXY(arc.Point3.X, arc.Point3.Y),
-Point2.FromXY(arc.Point4.X, arc.Point4.Y));
+                Point2.FromXY(arc.Point1.X, arc.Point1.Y),
+                Point2.FromXY(arc.Point2.X, arc.Point2.Y),
+                Point2.FromXY(arc.Point3.X, arc.Point3.Y),
+                Point2.FromXY(arc.Point4.X, arc.Point4.Y));
             var rect = new SKRect(
                 _scaleToPage(a.X + dx),
                 _scaleToPage(a.Y + dy),
@@ -533,8 +509,8 @@
             using var pen = ToSKPaintPen(cubicBezier.Style, _scaleToPage, _sourceDpi, _targetDpi);
             using var path = new SKPath();
             path.MoveTo(
-_scaleToPage(cubicBezier.Point1.X + dx),
-_scaleToPage(cubicBezier.Point1.Y + dy));
+                _scaleToPage(cubicBezier.Point1.X + dx),
+                _scaleToPage(cubicBezier.Point1.Y + dy));
             path.CubicTo(
                 _scaleToPage(cubicBezier.Point2.X + dx),
                 _scaleToPage(cubicBezier.Point2.Y + dy),
@@ -554,8 +530,8 @@
             using var pen = ToSKPaintPen(quadraticBezier.Style, _scaleToPage, _sourceDpi, _targetDpi);
             using var path = new SKPath();
             path.MoveTo(
-_scaleToPage(quadraticBezier.Point1.X + dx),
-_scaleToPage(quadraticBezier.Point1.Y + dy));
+                _scaleToPage(quadraticBezier.Point1.X + dx),
+                _scaleToPage(quadraticBezier.Point1.Y + dy));
             path.QuadTo(
                 _scaleToPage(quadraticBezier.Point2.X + dx),
                 _scaleToPage(quadraticBezier.Point2.Y + dy),


Tests

Tests

--- src/hw.nuget/Tests/CompilerTool/Util/MainTokenFactory.cs
+++ src/hw.nuget/Tests/CompilerTool/Util/MainTokenFactory.cs
@@ -81,7 +81,7 @@
     sealed class NestedTokenFactory : TokenFactory
     {
         public static readonly IParser<Syntax> Instance = new PrioParser<Syntax>
-            (PrioTable, Scanner(new NestedTokenFactory()));
+            (PrioTable, Scanner(new NestedTokenFactory()), SwitchToken.Instance);

         NestedTokenFactory() { }

@@ -102,6 +102,7 @@
         {
             return new TokenClass<Syntax>[]
             {
+                SwitchToken.Instance,
                 new LeftParenthesis(),
                 new RightParenthesis()
             };
@@ -118,6 +119,8 @@

     sealed class SwitchToken : NamedToken
     {
+        public static readonly SwitchToken Instance = new SwitchToken();
+
         public SwitchToken()
             : base("-->") {}

@@ -125,7 +128,6 @@

         protected override Syntax Create(Syntax left, IToken token, Syntax right)
         {
-            NotImplementedMethod(left, token, right);
             return null;
         }


color button functionality

color button functionality

--- src/DiabloInterface/Gui/SettingsWindow.Designer.cs
+++ src/DiabloInterface/Gui/SettingsWindow.Designer.cs
@@ -1234,6 +1234,7 @@
             this.btnColorCharCount.TabIndex = 44;
             this.btnColorCharCount.Text = "Color";
             this.btnColorCharCount.UseVisualStyleBackColor = true;
+            this.btnColorCharCount.Click += new System.EventHandler(this.btnSelectColor);
             //
             // SettingsWindow
             //


DCS-30: Update json.net to use new MIME, encoding and camelCase formatting

--- src/DiplomContentSystem/Requests/RequestService.cs
+++ src/DiplomContentSystem/Requests/RequestService.cs
@@ -1,6 +1,7 @@
 using System;
 using System.Net.Http;
 using Newtonsoft.Json;
+using Newtonsoft.Json.Serialization;
 using System.Threading.Tasks;
 using System.Collections.Generic;
 using System.Linq;
@@ -16,11 +17,14 @@
             {
                 try
                 {
-                    var content = new StringContent(JsonConvert.SerializeObject(data)
-                    );
+                    var content = new StringContent(JsonConvert.SerializeObject(data,
+                    new JsonSerializerSettings()
+                    {
+                        ContractResolver = new CamelCasePropertyNamesContractResolver()
+                    }), System.Text.Encoding.UTF8, "application/json");
                     client.BaseAddress = new Uri("http://localhost:1337");

-                    var response = await client.PostAsync("api/docx", content);
+                    var response = await client.PostAsync("api/docx",content);
                     response.EnsureSuccessStatusCode(); // Throw in not success

                     return await response.Content.ReadAsStreamAsync();


Added File.Replace specs for invalid arguments

--- src/Fakes.Tests/Specs/FakeFile/FileReplaceSpecs.cs
+++ src/Fakes.Tests/Specs/FakeFile/FileReplaceSpecs.cs
@@ -11,7 +11,147 @@
 {
     public sealed class FileReplaceSpecs
     {
-        // TODO: Basic null/empty/whitespace/... checks
+        [Fact]
+        private void When_replacing_file_with_null_source_it_must_fail()
+        {
+            // Arrange
+            IFileSystem fileSystem = new FakeFileSystemBuilder()
+                .Build();
+
+            // Act
+            // ReSharper disable once AssignNullToNotNullAttribute
+            Action action = () => fileSystem.File.Replace(null, @"c:\destination.txt", @"c:\backup.txt");
+
+            // Assert
+            action.Should().Throw<ArgumentNullException>();
+        }
+
+        [Fact]
+        private void When_replacing_file_with_null_destination_it_must_fail()
+        {
+            // Arrange
+            IFileSystem fileSystem = new FakeFileSystemBuilder()
+                .Build();
+
+            // Act
+            // ReSharper disable once AssignNullToNotNullAttribute
+            Action action = () => fileSystem.File.Replace(@"c:\source.txt", null, @"c:\backup.txt");
+
+            // Assert
+            action.Should().Throw<ArgumentNullException>();
+        }
+
+        [Fact]
+        private void When_replacing_file_with_empty_string_source_it_must_fail()
+        {
+            // Arrange
+            IFileSystem fileSystem = new FakeFileSystemBuilder()
+                .Build();
+
+            // Act
+            Action action = () => fileSystem.File.Replace(string.Empty, @"c:\destination.txt", @"c:\backup.txt");
+
+            // Assert
+            action.Should().Throw<ArgumentException>().WithMessage("The path is not of a legal form.*");
+        }
+
+        [Fact]
+        private void When_replacing_file_with_empty_string_destination_it_must_fail()
+        {
+            // Arrange
+            IFileSystem fileSystem = new FakeFileSystemBuilder()
+                .Build();
+
+            // Act
+            Action action = () => fileSystem.File.Replace(@"c:\source.txt", string.Empty, @"c:\backup.txt");
+
+            // Assert
+            action.Should().Throw<ArgumentException>().WithMessage("The path is not of a legal form.*");
+        }
+
+        [Fact]
+        private void When_replacing_file_with_whitespace_source_it_must_fail()
+        {
+            // Arrange
+            IFileSystem fileSystem = new FakeFileSystemBuilder()
+                .Build();
+
+            // Act
+            Action action = () => fileSystem.File.Replace(" ", @"c:\destination.txt", @"c:\backup.txt");
+
+            // Assert
+            action.Should().Throw<ArgumentException>().WithMessage("The path is not of a legal form.*");
+        }
+
+        [Fact]
+        private void When_replacing_file_with_whitespace_destination_it_must_fail()
+        {
+            // Arrange
+            IFileSystem fileSystem = new FakeFileSystemBuilder()
+                .Build();
+
+            // Act
+            Action action = () => fileSystem.File.Replace(@"c:\source.txt", " ", @"c:\backup.txt");
+
+            // Assert
+            action.Should().Throw<ArgumentException>().WithMessage("The path is not of a legal form.*");
+        }
+
+        [Fact]
+        private void When_replacing_file_with_invalid_source_root_it_must_fail()
+        {
+            // Arrange
+            IFileSystem fileSystem = new FakeFileSystemBuilder()
+                .Build();
+
+            // Act
+            Action action = () => fileSystem.File.Replace("_:", @"c:\destination.txt", @"c:\backup.txt");
+
+            // Assert
+            action.Should().Throw<NotSupportedException>().WithMessage("The given path's format is not supported.");
+        }
+
+        [Fact]
+        private void When_replacing_file_with_invalid_destination_root_it_must_fail()
+        {
+            // Arrange
+            IFileSystem fileSystem = new FakeFileSystemBuilder()
+                .Build();
+
+            // Act
+            Action action = () => fileSystem.File.Replace(@"c:\source.txt", "_:", @"c:\backup.txt");
+
+            // Assert
+            action.Should().Throw<NotSupportedException>().WithMessage("The given path's format is not supported.");
+        }
+
+        [Fact]
+        private void When_replacing_file_with_invalid_characters_in_source_it_must_fail()
+        {
+            // Arrange
+            IFileSystem fileSystem = new FakeFileSystemBuilder()
+                .Build();
+
+            // Act
+            Action action = () => fileSystem.File.Replace("some?.txt", @"c:\destination.txt", @"c:\backup.txt");
+
+            // Assert
+            action.Should().Throw<ArgumentException>().WithMessage("Illegal characters in path.*");
+        }
+
+        [Fact]
+        private void When_replacing_file_with_invalid_characters_in_destination_it_must_fail()
+        {
+            // Arrange
+            IFileSystem fileSystem = new FakeFileSystemBuilder()
+                .Build();
+
+            // Act
+            Action action = () => fileSystem.File.Replace(@"c:\source.txt", "some?.txt", @"c:\backup.txt");
+
+            // Assert
+            action.Should().Throw<ArgumentException>().WithMessage("Illegal characters in path.*");
+        }

         [Fact]
         private void When_replacing_file_with_missing_source_location_it_must_fail()


Checked out IntergrationTestOptions.cs from master to revert changes on branch

--- src/FluentMigrator.Tests/IntegrationTestOptions.cs
+++ src/FluentMigrator.Tests/IntegrationTestOptions.cs
@@ -13,7 +13,7 @@
         {
             ConnectionString =
                 @"server=.\SQLEXPRESS;uid=;pwd=;Trusted_Connection=yes;database=FluentMigrator",
-            IsEnabled = true
+            IsEnabled = false
         };

 		public static DatabaseServerOptions SqlLite = new DatabaseServerOptions


Moved class member to the top of the class.

--- src/Generator/Generators/CLI/CLIHeadersTemplate.cs
+++ src/Generator/Generators/CLI/CLIHeadersTemplate.cs
@@ -8,6 +8,8 @@
     {
         public override string FileExtension { get { return "h"; } }

+        private CLIForwardRefeferencePrinter forwardRefsPrinter;
+
         protected override void Generate()
         {
             GenerateStart();
@@ -25,8 +27,6 @@
             GenerateDeclarations();
             WriteLine("}");
         }
-
-        private CLIForwardRefeferencePrinter forwardRefsPrinter;

         public void GenerateIncludeForwardRefs()
         {


Extend canCreateGist checking to also look at the selected text.

I was not restricting this before, but if we try to send a new gist with
the file content of it as null, an empty string or white space octokit
returns a validation error saying the files field is missing.  This is
fine, but the Create Gist UI needs to be updated to show that no text
was selected.

--- src/GitHub.App/ViewModels/GistCreationViewModel.cs
+++ src/GitHub.App/ViewModels/GistCreationViewModel.cs
@@ -1,11 +1,9 @@
 using System;
 using GitHub.Exports;
 using System.ComponentModel.Composition;
-using System.Reactive.Linq;
 using GitHub.Api;
-using GitHub.Factories;
+using GitHub.Extensions;
 using GitHub.Models;
-using GitHub.Primitives;
 using GitHub.Services;
 using Octokit;
 using ReactiveUI;
@@ -17,7 +15,6 @@
     [PartCreationPolicy(CreationPolicy.NonShared)]
     public class GistCreationViewModel : BaseViewModel, IGistCreationViewModel
     {
-        readonly ISelectedTextProvider selectedTextProvider;
         readonly IApiClient apiClient;

       [ImportingConstructor]
@@ -31,32 +28,30 @@
         public GistCreationViewModel(IRepositoryHost repositoryHost, ISelectedTextProvider selectedTextProvider)
         {
             Title = Resources.CreateGistTitle;
-            this.selectedTextProvider = selectedTextProvider;
             this.apiClient = repositoryHost.ApiClient;

             // Since the filename is required, go ahead and give it something default so the user is not forced to
             // add a custom name if they do not want to
             FileName = Resources.DefaultGistFileName;
+            selectedText = selectedTextProvider.GetSelectedText().ToProperty(this, x => x.SelectedText);

             var canCreateGist = this.WhenAny(
                 x => x.FileName,
-                fileName => !string.IsNullOrEmpty(fileName.Value));
+                x => x.SelectedText,
+                (fileName, selectedText) => fileName.Value.IsNotNullOrEmptyOrWhiteSpace() && selectedText.Value.IsNotNullOrEmptyOrWhiteSpace());

             CreateGist = ReactiveCommand.CreateAsyncObservable(canCreateGist, OnCreateGist);
         }

-        private IObservable<Gist> OnCreateGist(object _)
+        IObservable<Gist> OnCreateGist(object _)
         {
-            return selectedTextProvider.GetSelectedText().Select(selectedText =>
+            var newGist = new NewGist
             {
-                var newGist = new NewGist
-                {
-                    Description = Description,
-                    Public = !IsPrivate
-                };
-                newGist.Files.Add(FileName, selectedText);
-                return apiClient.CreateGist(newGist);
-            }).SelectMany(gists => gists);
+                Description = Description,
+                Public = !IsPrivate
+            };
+            newGist.Files.Add(FileName, SelectedText);
+            return apiClient.CreateGist(newGist);
         }

         public IReactiveCommand<Gist> CreateGist { get; }
@@ -77,6 +72,13 @@
             set { this.RaiseAndSetIfChanged(ref description, value); }
         }

+        readonly ObservableAsPropertyHelper<string> selectedText;
+        public string SelectedText
+        {
+            [return: AllowNull]
+            get { return selectedText.Value; }
+        }
+
         string fileName;
         [AllowNull]
         public string FileName


Fix test for GZip integration.  All working and passing.

--- src/kafka-tests/Integration/GzipProducerConsumerTests.cs
+++ src/kafka-tests/Integration/GzipProducerConsumerTests.cs
@@ -1,11 +1,10 @@
-using System;
-using System.Collections.Generic;
-using System.Configuration;
+using System.Collections.Generic;
 using System.Linq;
 using KafkaNet;
 using KafkaNet.Model;
 using KafkaNet.Protocol;
 using NUnit.Framework;
+using kafka_tests.Helpers;

 namespace kafka_tests.Integration
 {
@@ -14,21 +13,23 @@
     public class GzipProducerConsumerTests
     {
         private BrokerRouter _router;
-        private const string CompressTopic = "CompressTest";
+        private KafkaConnection _kafkaConnection;

         [SetUp]
         public void Setup()
         {
-            var options = new KafkaOptions(new Uri(ConfigurationManager.AppSettings["IntegrationKafkaServerUrl"]));
-
+            var options = new KafkaOptions(IntegrationConfig.IntegrationUri);
+            _kafkaConnection = new KafkaConnection(new KafkaTcpSocket(new DefaultTraceLog(), options.KafkaServerUri.First()), options.ResponseTimeoutMs, options.Log);
             _router = new BrokerRouter(options);
         }

         [Test]
-        [Ignore]
         public void EnsureGzipCompressedMessageCanSend()
         {
-            var conn = _router.SelectBrokerRoute(CompressTopic, 0);
+            //ensure topic exists
+            _kafkaConnection.SendAsync(new MetadataRequest { Topics = new List<string>(new[] { IntegrationConfig.IntegrationCompressionTopic }) }).Wait();
+
+            var conn = _router.SelectBrokerRoute(IntegrationConfig.IntegrationCompressionTopic, 0);

             var request = new ProduceRequest
             {
@@ -39,7 +40,7 @@
                                     new Payload
                                         {
                                             Codec = MessageCodec.CodecGzip,
-                                            Topic = CompressTopic,
+                                            Topic = IntegrationConfig.IntegrationCompressionTopic,
                                             Partition = 0,
                                             Messages = new List<Message>
                                                     {
@@ -53,38 +54,16 @@

             var response = conn.Connection.SendAsync(request).Result;
             Assert.That(response.First().Error, Is.EqualTo(0));
-
-            //var offsets = producer.GetTopicOffsetAsync("NewTopic").Result;
-
-            //var consumer = new Consumer(new ConsumerOptions("NewTopic", _router),
-            //    offsets.Select(x => new OffsetPosition(x.PartitionId, x.Offsets.Max())).ToArray());
-
-            //var response = producer.SendMessageAsync("NewTopic", new[]
-            //    {
-            //        new Message {Value = "0", Key = "1"},
-            //        new Message {Value = "1", Key = "1"},
-            //        new Message {Value = "2", Key = "1"}
-            //    }, codec: MessageCodec.CodecGzip).Result;
-
-            //Assert.That(response.First().Error, Is.EqualTo(0));
-
-            //var results = consumer.Consume().Take(3).ToList();
-
-            //for (int i = 0; i < 3; i++)
-            //{
-            //    Assert.That(results[i].Value, Is.EqualTo(i.ToString()));
-            //}
         }

         [Test]
-        [Ignore]
         public void EnsureGzipCanDecompressMessageFromKafka()
         {
             var producer = new Producer(_router);

-            var offsets = producer.GetTopicOffsetAsync(CompressTopic).Result;
+            var offsets = producer.GetTopicOffsetAsync(IntegrationConfig.IntegrationCompressionTopic).Result;

-            var consumer = new Consumer(new ConsumerOptions("Empty", _router),
+            var consumer = new Consumer(new ConsumerOptions(IntegrationConfig.IntegrationCompressionTopic, _router),
                 offsets.Select(x => new OffsetPosition(x.PartitionId, 0)).ToArray());

             var results = consumer.Consume().Take(3).ToList();


Always generate Xhtml style for DFM result

--- src/Microsoft.DocAsCode.Dfm/DocfxFlavoredMarked.cs
+++ src/Microsoft.DocAsCode.Dfm/DocfxFlavoredMarked.cs
@@ -12,7 +12,7 @@
         public static DfmEngineBuilder CreateBuilder(string baseDir)
         {
             // TODO: currently disable mangle as a quick workaround for OP Build Service compatibility
-            return new DfmEngineBuilder(new Options() { Mangle = false }, baseDir);
+            return new DfmEngineBuilder(new Options() { Mangle = false, XHtml = true }, baseDir);
         }

         public static string Markup(string src, string path = null)


Handling for Port Messages implemented

Handling for Port Messages implemented

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

--- src/MonoTorrent.Client/PeerMessages/PortMessage.cs
+++ src/MonoTorrent.Client/PeerMessages/PortMessage.cs
@@ -45,11 +45,11 @@
         /// <summary>
         /// The port
         /// </summary>
-        public uint Port
+        public ushort Port
         {
             get { return this.port; }
         }
-        private uint port;
+        private ushort port;
         #endregion

@@ -77,7 +77,6 @@
         /// <summary>
         /// Encodes the PortMessage into the supplied buffer
         /// </summary>
-        /// <param name="id">The peer who we are about to send the message to</param>
         /// <param name="buffer">The buffer to encode the message to</param>
         /// <param name="offset">The offset at which to start encoding the data to</param>
         /// <returns>The number of bytes encoded into the buffer</returns>
@@ -100,7 +99,7 @@
         /// <param name="length">The maximum number of bytes to read from the buffer</param>
         public void Decode(byte[] buffer, int offset, int length)
         {
-            this.port = (uint)IPAddress.NetworkToHostOrder(BitConverter.ToUInt16(buffer, offset));
+            this.port = (ushort)IPAddress.NetworkToHostOrder(BitConverter.ToUInt16(buffer, offset));
         }
         /// <summary>
         /// Performs any necessary actions required to process the message
@@ -108,7 +107,7 @@
         /// <param name="id">The Peer who's message will be handled</param>
         public void Handle(PeerConnectionID id)
         {
-            //Debug.WriteLine(DateTime.Now + ": No support for handling " + this.ToString() + " messages");
+            id.Peer.Connection.Port = this.port;
         }

         /// <summary>


Fixes #1269. Command line arguments were checked in an incorrect way.

--- src/OmniSharp.Stdio/StdioCommandLineApplication.cs
+++ src/OmniSharp.Stdio/StdioCommandLineApplication.cs
@@ -16,9 +16,9 @@
             _encoding = Application.Option("-e | --encoding", "Input / output encoding for STDIO protocol.", CommandOptionType.SingleValue);
         }

-        public bool Stdio => _stdio.GetValueOrDefault(true);
+        public bool Stdio => true;

-        public bool Lsp => _lsp.GetValueOrDefault(false);
+        public bool Lsp => _lsp.HasValue();

         public string Encoding => _encoding.GetValueOrDefault<string>(null);
     }


internal property reflection cleanup

internal property reflection cleanup

--- src/Peachpie.Runtime/Reflection/PhpPropertyInfo.cs
+++ src/Peachpie.Runtime/Reflection/PhpPropertyInfo.cs
@@ -302,7 +302,7 @@

             public override PhpValue GetValue(Context ctx, object instance)
             {
-                var runtime_fields = _tinfo.GetRuntimeFields(instance);
+                var runtime_fields = ContainingType.GetRuntimeFields(instance);

                 // (instance)._runtime_fields[_name]
                 if (runtime_fields != null && runtime_fields.TryGetValue(_name, out var value))
@@ -311,14 +311,14 @@
                 }
                 else
                 {
-                    PhpException.UndefinedProperty(_tinfo.Name, _name.ToString());
+                    PhpException.UndefinedProperty(ContainingType.Name, _name.ToString());
                     return PhpValue.Void;
                 }
             }

             public override PhpAlias EnsureAlias(Context ctx, object instance)
             {
-                var runtime_fields = _tinfo.EnsureRuntimeFields(instance);
+                var runtime_fields = ContainingType.EnsureRuntimeFields(instance);
                 if (runtime_fields == null)
                 {
                     throw new NotSupportedException();
@@ -330,7 +330,7 @@

             public override object EnsureObject(Context ctx, object instance)
             {
-                var runtime_fields = _tinfo.EnsureRuntimeFields(instance);
+                var runtime_fields = ContainingType.EnsureRuntimeFields(instance);
                 if (runtime_fields == null)
                 {
                     throw new NotSupportedException();
@@ -342,7 +342,7 @@

             public override IPhpArray EnsureArray(Context ctx, object instance)
             {
-                var runtime_fields = _tinfo.EnsureRuntimeFields(instance);
+                var runtime_fields = ContainingType.EnsureRuntimeFields(instance);
                 if (runtime_fields == null)
                 {
                     throw new NotSupportedException();
@@ -354,7 +354,7 @@

             public override void SetValue(Context ctx, object instance, PhpValue value)
             {
-                var runtime_fields = _tinfo.EnsureRuntimeFields(instance);
+                var runtime_fields = ContainingType.EnsureRuntimeFields(instance);
                 if (runtime_fields == null)
                 {
                     throw new NotSupportedException();
@@ -384,13 +384,11 @@
         /// Containing type information.
         /// Cannot be <c>null</c>.
         /// </summary>
-        public PhpTypeInfo ContainingType => _tinfo;
-        readonly PhpTypeInfo _tinfo;
+        public PhpTypeInfo ContainingType { get; }

         protected PhpPropertyInfo(PhpTypeInfo tinfo)
         {
-            Debug.Assert(tinfo != null);
-            _tinfo = tinfo;
+            ContainingType = tinfo ?? throw new ArgumentNullException(nameof(tinfo));
         }

         /// <summary>
@@ -524,12 +522,12 @@
             // private
             if (IsPrivate)
             {
-                return _tinfo.Type == caller;
+                return ContainingType.Type == caller;
             }

             // protected|internal
             // language.oop5.visibility: Members declared protected can be accessed only within the class itself and by inheriting and parent classes
-            return _tinfo.Type.IsAssignableFrom(caller) || caller.IsAssignableFrom(_tinfo.Type);
+            return ContainingType.Type.IsAssignableFrom(caller) || caller.IsAssignableFrom(ContainingType.Type);
         }

         /// <summary>


Internalize IEnumerable extensions

Internalize IEnumerable extensions

--- src/Q42.HueApi/Extensions/IEnumerableExtensions.cs
+++ src/Q42.HueApi/Extensions/IEnumerableExtensions.cs
@@ -10,7 +10,7 @@
   /// <summary>
   /// IEnumerable Helpers
   /// </summary>
-  public static class IEnumerableExtensions
+  internal static class IEnumerableExtensions
   {

     /// <summary>


Preparation for upcoming breaking changes (#6376)

--- src/SDKs/Network/Network.Tests/Tests/TestHelper.cs
+++ src/SDKs/Network/Network.Tests/Tests/TestHelper.cs
@@ -132,7 +132,7 @@
                     },
                     LegacyMode = Convert.ToInt32(true)
                 },
-                RouteFilter = filter
+                RouteFilter = { Id = filter.Id }
             };

             var peerResponse = nrpClient.ExpressRouteCircuitPeerings.CreateOrUpdate(resourceGroupName, circuitName,


Manually porting https://github.com/dotnet/corefx/pull/10955/commits/4df0beec28bcb920f6eb44df005ade3cf76730fd to CoreRT

[tfs-changeset: 1623921]

--- src/System.Private.CoreLib/src/System/IO/Stream.cs
+++ src/System.Private.CoreLib/src/System/IO/Stream.cs
@@ -249,7 +249,7 @@
                 Task.Factory.FromAsync(
                     (localBuffer, localOffset, localCount, callback, state) => ((Stream)state).BeginRead(localBuffer, localOffset, localCount, callback, state),
                     iar => ((Stream)iar.AsyncState).EndRead(iar),
-                    buffer, offset, count, this, TaskCreationOptions.DenyChildAttach | TaskCreationOptions.HideScheduler);
+                    buffer, offset, count, this);
         }

         public virtual IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state) =>
@@ -296,7 +296,7 @@
                 Task.Factory.FromAsync(
                     (localBuffer, localOffset, localCount, callback, state) => ((Stream)state).BeginWrite(localBuffer, localOffset, localCount, callback, state),
                     iar => ((Stream)iar.AsyncState).EndWrite(iar),
-                    buffer, offset, count, this, TaskCreationOptions.DenyChildAttach | TaskCreationOptions.HideScheduler);
+                    buffer, offset, count, this);
         }

         public virtual IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state) =>


Simplified dictionary key generation.

Simplified dictionary key generation.

--- src/Tests/Nimbus.Tests.Common/MethodCallCounter.cs
+++ src/Tests/Nimbus.Tests.Common/MethodCallCounter.cs
@@ -35,12 +35,11 @@
                 args.Add(arg);
             }

-            var key = GetMethodKey(expr.Type, method);
+            var key = GetMethodKey(typeof(T), method);
             var methodCallBag = _allReceivedCalls.GetOrAdd(key, k => new ConcurrentBag<object[]>());
             methodCallBag.Add(args.ToArray());

-            var methodName = "{0}.{1}".FormatWith(typeof (T).FullName, method.Name);
-            Console.WriteLine("Observed call to {0}({1})".FormatWith(methodName, string.Join(", ", args.Select(a => a.GetType()))));
+            Console.WriteLine("Observed call to {0}".FormatWith(key));
         }

         public static IEnumerable<object> AllReceivedMessages
@@ -50,7 +49,6 @@
                 var messageBags = _allReceivedCalls.ToDictionary().Values;

                 var messages = messageBags
-                    .Where(kvp => true)
                     .SelectMany(c => c)
                     .SelectMany(args => args)
                     .ToArray();
@@ -62,7 +60,7 @@
         {
             var methodCallExpression = (MethodCallExpression) expr.Body;
             var method = methodCallExpression.Method;
-            var key = GetMethodKey(expr.Type, method);
+            var key = GetMethodKey(typeof(T), method);
             var messageBag = _allReceivedCalls.GetOrAdd(key, k => new ConcurrentBag<object[]>());
             return messageBag;
         }


Remove redundant check

Remove redundant check

--- src/Tools/GenerateGlobalAnalyzerConfigs/Program.cs
+++ src/Tools/GenerateGlobalAnalyzerConfigs/Program.cs
@@ -195,13 +195,6 @@
                 EditorConfigKind editorConfigKind,
                 (ImmutableArray<ReleaseTrackingData> shippedFiles, Version version)? shippedReleaseData = null)
             {
-                // Only generate live analysis specific global analyzer config if we have at least one info or hidden diagnostic
-                // that needs to be skipped during command line build.
-                if (!hasInfoOrHiddenDiagnostic && editorConfigKind == EditorConfigKind.LiveAnalysis)
-                {
-                    return;
-                }
-
                 CreateEditorconfig(outputDir, fileName, title, description, editorConfigKind, allRulesById, shippedReleaseData);
             }
         }


add dumping of markovs manually

add dumping of markovs manually

--- Coremero/Coremero.Plugin.Playground/ImitateChat.cs
+++ Coremero/Coremero.Plugin.Playground/ImitateChat.cs
@@ -1,8 +1,10 @@
 using System;
 using System.Collections.Concurrent;
 using System.Collections.Generic;
+using System.IO;
 using System.Linq;
 using System.Text;
+using System.Threading;
 using System.Threading.Tasks;
 using Coremero.Client;
 using Coremero.Commands;
@@ -21,6 +23,26 @@
         public ImitateChat(IMessageBus messageBus)
         {
             messageBus.Received += MessageBus_Received;
+            foreach (string path in Directory.GetFiles(PathExtensions.PluginDir, "*.*markov"))
+            {
+                try
+                {
+                    var tempMarkov = new StringMarkov().Load<StringMarkov>(path);
+                    if (Path.GetExtension(path) == "usermarkov")
+                    {
+                        _userModels[ulong.Parse(Path.GetFileNameWithoutExtension(path))] = tempMarkov;
+                    }
+                    else
+                    {
+                        _models[Path.GetFileNameWithoutExtension(path)] = tempMarkov;
+                    }
+
+                }
+                catch (Exception e)
+                {
+                    Log.Error($"Unable to load markov file: {path}");
+                }
+            }
         }

         private void MessageBus_Received(object sender, MessageReceivedEventArgs e)
@@ -66,7 +88,7 @@
             {
                 if (!_models.ContainsKey(bufferedChannel.Name))
                 {
-                    StringMarkov markov = new StringMarkov() { EnsureUniqueWalk = true };
+                    StringMarkov markov = new StringMarkov(1) { EnsureUniqueWalk = true };
                     DateTimeOffset offset = DateTimeOffset.UtcNow;
                     List<IBufferedMessage> messages = await bufferedChannel.GetMessagesAsync(offset, SearchDirection.Before, 5000);
                     markov.Learn(messages.Where(x => x.User.Name != context.OriginClient.Username && !string.IsNullOrEmpty(x.Text?.Trim()) && !x.Text.IsCommand()).Select(x => x.Text));
@@ -106,7 +128,7 @@
                                 {
                                     if (!_userModels.ContainsKey(entity.ID))
                                     {
-                                        _userModels.TryAdd(entity.ID, new StringMarkov() { EnsureUniqueWalk = true });
+                                        _userModels.TryAdd(entity.ID, new StringMarkov(1) { EnsureUniqueWalk = true });
                                     }
                                     StringMarkov markov;
                                     _userModels.TryGetValue(entity.ID, out markov);
@@ -165,5 +187,22 @@
             }
             throw new Exception("Not an entity.");
         }
+
+        [Command("dumpmarkov", MinimumPermissionLevel = UserPermission.BotOwner)]
+        public string DumpMarkovs()
+        {
+            int counter = 0;
+            foreach (var keyValuePair in _models)
+            {
+                keyValuePair.Value.Save(Path.Combine(keyValuePair.Key + ".channelmarkov"));
+                counter += 1;
+            }
+            foreach (var keyValuePair in _userModels)
+            {
+                keyValuePair.Value.Save(keyValuePair.Key + ".usermarkov");
+                counter += 1;
+            }
+            return $"Dumped {counter} markovs to disk.";
+        }
     }
 }


Bug-fix - Proper refrigeration check, method name typo

--- DLL_Project/ThingComps/CompRottableRefrigerated.cs
+++ DLL_Project/ThingComps/CompRottableRefrigerated.cs
@@ -46,7 +46,7 @@
             }
         }

-        private CompRefrigerated CompRefigerated
+        private CompRefrigerated CompRefrigerated
         {
             get
             {
@@ -65,7 +65,7 @@
         {
             get
             {
-                var foo = CompRefigerated;
+                var foo = CompRefrigerated;
                 if( foo != null )
                 {
                     return foo.parent.TryGetComp<CompPowerTrader>();
@@ -78,9 +78,15 @@
         {
             get
             {
+                var compRefrigerated = CompRefrigerated;
+                var compPowerTrader = CompPowerTrader;
                 return (
-                    ( CompPowerTrader != null )&&
-                    ( CompPowerTrader.PowerOn )
+                    ( compRefrigerated != null )&&
+                    ( compPowerTrader == null )||
+                    (
+                        ( compPowerTrader != null )&&
+                        ( compPowerTrader.PowerOn )
+                    )
                 );
             }
         }


Extracting RefreshOnXColumnSelection methods

--- Dapper.FastCrud/SqlBuilders/StatementSqlBuilder.cs
+++ Dapper.FastCrud/SqlBuilders/StatementSqlBuilder.cs
@@ -565,6 +565,24 @@
         }

         ///
+        /// Constructs a column selection of all columns to be refreshed on update of the form @PropertyName1,@PropertyName2...
+        ///
+        /// <returns></returns>
+        protected virtual string ConstructRefreshOnUpdateColumnSelection()
+        {
+            return string.Join(",", this.RefreshOnUpdateProperties.Select(propInfo => this.GetColumnName(propInfo, null, true)));
+        }
+
+        ///
+        /// Constructs a column selection of all columns to be refreshed on insert of the form @PropertyName1,@PropertyName2...
+        ///
+        /// <returns></returns>
+        protected virtual string ConstructRefreshOnInsertColumnSelection()
+        {
+            return string.Join(",", this.RefreshOnInsertProperties.Select(propInfo => this.GetColumnName(propInfo, null, true)));
+        }
+
+        ///
         /// Constructs an enumeration of the key values.
         ///
         protected virtual string ConstructKeyColumnEnumerationInternal(string tableAlias = null)
@@ -627,11 +645,7 @@
                     $"UPDATE {this.GetTableName()} SET {this.ConstructUpdateClause()} WHERE {this.ConstructKeysWhereClause()}");
             if (this.RefreshOnUpdateProperties.Length > 0)
             {
-                var databaseGeneratedColumnSelection = string.Join(
-                    ",",
-                    this.RefreshOnUpdateProperties.Select(
-                        propInfo => this.GetColumnName(propInfo, null, true)));
-                sql += this.ResolveWithCultureInvariantFormatter($";SELECT {databaseGeneratedColumnSelection} FROM {this.GetTableName()} WHERE {this.ConstructKeysWhereClause()};");
+                sql += this.ResolveWithCultureInvariantFormatter($";SELECT {this.ConstructRefreshOnUpdateColumnSelection()} FROM {this.GetTableName()} WHERE {this.ConstructKeysWhereClause()};");
             }

             return sql;