using System.Reflection;
using Xunit;

namespace System.Text.Utf8.Tests
{
    public class TypeConstraintsTests
    {
        [Fact]
        public void Utf8StringIsAStruct()
        {
            var utf8String = "anyString"u8;
            Assert.True(utf8String.GetType().GetTypeInfo().IsValueType);
        }

        [Fact]
        public void Utf8StringCodeUnitsEnumeratorIsAStruct()
        {
            var utf8String = "anyString"u8;
            var utf8CodeUnitsEnumerator = utf8String.GetEnumerator();
            Assert.True(utf8String.GetType().GetTypeInfo().IsValueType);
        }

        [Fact]
        public void Utf8StringCodePointEnumerableIsAStruct()
        {
            var utf8String = "anyString"u8;
            Assert.True(utf8String.CodePoints.GetType().GetTypeInfo().IsValueType);
        }

        [Fact]
        public void Utf8StringCodePointEnumeratorIsAStruct()
        {
            var utf8String = "anyString"u8;
            var utf8CodePointEnumerator = utf8String.CodePoints.GetEnumerator();
            Assert.True(utf8CodePointEnumerator.GetType().GetTypeInfo().IsValueType);
        }

        [Fact]
        public void Utf8StringReverseCodePointEnumeratorIsAStruct()
        {
            var utf8String = "anyString"u8;
            var utf8CodePointEnumerator = utf8String.CodePoints.GetReverseEnumerator();
            Assert.True(utf8CodePointEnumerator.GetType().GetTypeInfo().IsValueType);
        }
    }
}

using System.Reflection;
using Xunit;

namespace System.Text.Utf8.Tests
{
    public class TypeConstraintsTests
    {
        private Utf8String _anyUtf8String;

        public TypeConstraintsTests()
        {
            _anyUtf8String = "anyString"u8;
        }

        [Fact]
        public void Utf8StringIsAStruct()
        {
            Assert.True(_anyUtf8String.GetType().GetTypeInfo().IsValueType);
        }

        [Fact]
        public void Utf8StringCodeUnitsEnumeratorIsAStruct()
        {
            var utf8CodeUnitsEnumerator = _anyUtf8String.GetEnumerator();
            Assert.True(_anyUtf8String.GetType().GetTypeInfo().IsValueType);
        }

        [Fact]
        public void Utf8StringCodePointEnumerableIsAStruct()
        {
            Assert.True(_anyUtf8String.CodePoints.GetType().GetTypeInfo().IsValueType);
        }

        [Fact]
        public void Utf8StringCodePointEnumeratorIsAStruct()
        {
            var utf8CodePointEnumerator = _anyUtf8String.CodePoints.GetEnumerator();
            Assert.True(utf8CodePointEnumerator.GetType().GetTypeInfo().IsValueType);
        }

        [Fact]
        public void Utf8StringReverseCodePointEnumeratorIsAStruct()
        {
            var utf8CodePointEnumerator = _anyUtf8String.CodePoints.GetReverseEnumerator();
            Assert.True(utf8CodePointEnumerator.GetType().GetTypeInfo().IsValueType);
        }
    }
}

Replace hard coded string with field in utf8string tests where the value is irrelevant


using System.Reflection;

[assembly: AssemblyTitle("Autofac.Tests.Integration.SignalR")]
[assembly: AssemblyDescription("")]

Build script now writes the package name and version into the AssemblyDescription attibute. This allows the package information to be seen in Visual Studio avoiding confusion with the assembly version that remains at the major.


using Cake.Core;
using Cake.Core.IO;
using Cake.Core.Tooling;

namespace Cake.Terraform
{
    public class TerraformApplyRunner : TerraformRunner<TerraformApplySettings>
    {
        public TerraformApplyRunner(IFileSystem fileSystem, ICakeEnvironment environment, IProcessRunner processRunner, IToolLocator tools)
            : base(fileSystem, environment, processRunner, tools)
        {
        }

        public void Run(TerraformApplySettings settings)
        {
            var builder = new ProcessArgumentBuilder()
                .Append("apply");

            // Order of AutoApprove and Plan are important.
            if (settings.AutoApprove)
            {
                builder.Append("-auto-approve");
            }

            // Use Plan if it exists.
            if (settings.Plan != null)
            {
                builder.Append(settings.Plan);
            }

            if (!string.IsNullOrEmpty(settings.InputVariablesFile))
            {
                builder.AppendSwitchQuoted("-var-file", $"{settings.InputVariablesFile}");
            }

            if (settings.InputVariables != null)
            {
                foreach (var inputVariable in settings.InputVariables)
                {
                    builder.AppendSwitchQuoted("-var", $"{inputVariable.Key}={inputVariable.Value}");
                }
            }

            Run(settings, builder);
        }
    }
}

using Cake.Core;
using Cake.Core.IO;
using Cake.Core.Tooling;

namespace Cake.Terraform
{
    public class TerraformApplyRunner : TerraformRunner<TerraformApplySettings>
    {
        public TerraformApplyRunner(IFileSystem fileSystem, ICakeEnvironment environment, IProcessRunner processRunner, IToolLocator tools)
            : base(fileSystem, environment, processRunner, tools)
        {
        }

        public void Run(TerraformApplySettings settings)
        {
            var builder = new ProcessArgumentBuilder()
                .Append("apply");

            // Order of AutoApprove and Plan are important.
            if (settings.AutoApprove)
            {
                builder.Append("-auto-approve");
            }

            // Use Plan if it exists.
            if (settings.Plan != null)
            {
                builder.Append(settings.Plan.FullPath);
            }

            if (!string.IsNullOrEmpty(settings.InputVariablesFile))
            {
                builder.AppendSwitchQuoted("-var-file", $"{settings.InputVariablesFile}");
            }

            if (settings.InputVariables != null)
            {
                foreach (var inputVariable in settings.InputVariables)
                {
                    builder.AppendSwitchQuoted("-var", $"{inputVariable.Key}={inputVariable.Value}");
                }
            }

            Run(settings, builder);
        }
    }
}

Use fullpath for Plan in Apply command

Use fullpath for Plan in Apply command


using System;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.IO;

namespace IronAHK.Scripting
{
    partial class Parser : ICodeParser
    {
        Dictionary<string, CodeMemberMethod> methods;
        Type core;
        const string mainScope = "";
        CodeEntryPointMethod main;

        /// <summary>
        /// Return a DOM representation of a script.
        /// </summary>
        public CodeCompileUnit CompileUnit
        {
            get
            {
                CodeCompileUnit unit = new CodeCompileUnit();

                CodeNamespace space = new CodeNamespace(core.Namespace + ".Instance");
                unit.Namespaces.Add(space);

                var container = new CodeTypeDeclaration("Program");
                container.BaseTypes.Add(core.BaseType);
                //container.BaseTypes.Add(core);
                container.Attributes = MemberAttributes.Private;
                space.Types.Add(container);

                foreach (CodeMemberMethod method in methods.Values)
                    container.Members.Add(method);

                return unit;
            }
        }

        public Parser()
        {
            main = new CodeEntryPointMethod();
            main.CustomAttributes.Add(new CodeAttributeDeclaration(new CodeTypeReference(typeof(STAThreadAttribute))));
            methods = new Dictionary<string, CodeMemberMethod>();
            methods.Add(mainScope, main);

            core = typeof(Script);
            internalID = 0;
        }

        public CodeCompileUnit Parse(TextReader codeStream)
        {
            var lines = Read(codeStream, null);
            Compile(lines);
            return CompileUnit;
        }
    }
}

using System;
using System.CodeDom;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.IO;

namespace IronAHK.Scripting
{
    partial class Parser : ICodeParser
    {
        Dictionary<string, CodeMemberMethod> methods;
        Type core;
        const string mainScope = "";
        CodeEntryPointMethod main;

        /// <summary>
        /// Return a DOM representation of a script.
        /// </summary>
        public CodeCompileUnit CompileUnit
        {
            get
            {
                CodeCompileUnit unit = new CodeCompileUnit();

                CodeNamespace space = new CodeNamespace(core.Namespace + ".Instance");
                unit.Namespaces.Add(space);

                var container = new CodeTypeDeclaration("Program");
                container.BaseTypes.Add(typeof(Script));
                container.Attributes = MemberAttributes.Private;
                space.Types.Add(container);

                foreach (CodeMemberMethod method in methods.Values)
                    container.Members.Add(method);

                return unit;
            }
        }

        public Parser()
        {
            main = new CodeEntryPointMethod();
            main.CustomAttributes.Add(new CodeAttributeDeclaration(new CodeTypeReference(typeof(STAThreadAttribute))));
            methods = new Dictionary<string, CodeMemberMethod>();
            methods.Add(mainScope, main);

            core = typeof(Script);
            internalID = 0;
        }

        public CodeCompileUnit Parse(TextReader codeStream)
        {
            var lines = Read(codeStream, null);
            Compile(lines);
            return CompileUnit;
        }
    }
}

Set correct base type for script instances.


@using CkanDotNet.Api.Model
@model Package

Rate this Package

       @Html.Partial("~/Views/Shared/_Rating.cshtml", Model, new ViewDataDictionary { { "editable", true } })

@using CkanDotNet.Api.Model
@model Package

Rate this Dataset

       @Html.Partial("~/Views/Shared/_Rating.cshtml", Model, new ViewDataDictionary { { "editable", true } })

Change ui text "Package" to "Dataset"

Change ui text "Package" to "Dataset"


using CommonMarkSharp.Blocks;
using CommonMarkSharp.Inlines;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CommonMarkSharp.InlineParsers
{
    public class LineBreakParser : IParser<LineBreak>
    {
        public string StartsWithChars { get { return "\\ \n"; } }

        public LineBreak Parse(ParserContext context, Subject subject)
        {
            if (!this.CanParse(subject)) return null;

            string[] groups;
            if (subject.IsMatch(@"  +\n", 0, out groups))
            {
                subject.Advance(groups[0].Length);
                subject.AdvanceWhile(c => c == ' ');
                return new HardBreak();
            }
            else if (subject.StartsWith("\\\n", 0))
            {
                subject.Advance(2);
                subject.AdvanceWhile(c => c == ' ');
                return new HardBreak();
            }
            else if (subject.StartsWith(" \n", 0))
            {
                subject.Advance(2);
                subject.AdvanceWhile(c => c == ' ');
                return new SoftBreak();
            }
            else if (subject.Char == '\n')
            {
                subject.Advance();
                subject.AdvanceWhile(c => c == ' ');
                return new SoftBreak();
            }

            return null;
        }
    }
}

using CommonMarkSharp.Blocks;
using CommonMarkSharp.Inlines;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace CommonMarkSharp.InlineParsers
{
    public class LineBreakParser : IParser<LineBreak>
    {
        private static readonly Regex _startsWithDoubleSpaceNewLine = RegexUtils.Create(@"\G  +\n");
        public string StartsWithChars { get { return "\\ \n"; } }

        public LineBreak Parse(ParserContext context, Subject subject)
        {
            if (!this.CanParse(subject)) return null;

            string[] groups;
            if (subject.IsMatch(_startsWithDoubleSpaceNewLine, 0, out groups))
            {
                subject.Advance(groups[0].Length);
                subject.AdvanceWhile(c => c == ' ');
                return new HardBreak();
            }
            else if (subject.StartsWith("\\\n"))
            {
                subject.Advance(2);
                subject.AdvanceWhile(c => c == ' ');
                return new HardBreak();
            }
            else if (subject.StartsWith(" \n"))
            {
                subject.Advance(2);
                subject.AdvanceWhile(c => c == ' ');
                return new SoftBreak();
            }
            else if (subject.Char == '\n')
            {
                subject.Advance();
                subject.AdvanceWhile(c => c == ' ');
                return new SoftBreak();
            }

            return null;
        }
    }
}

Use Regex in stead of string

Use Regex in stead of string


using Newtonsoft.Json;

namespace Stripe
{
    public class StripeCustomerListOptions : StripeListOptions
    {
        [JsonProperty("created")]
        public StripeDateFilter Created { get; set; }
    }
}

using Newtonsoft.Json;

namespace Stripe
{
    public class StripeCustomerListOptions : StripeListOptions
    {
        [JsonProperty("created")]
        public StripeDateFilter Created { get; set; }

        [JsonProperty("email")]
        public string Email { get; set; }
    }
}

Add the ability to list customers via email address


using System.Collections.Generic;
using System.Linq;
using Arango.Client.Protocol;

namespace Arango.Client
{
    public static class ArangoClient
    {
        private static List<Connection> _connections = new List<Connection>();

        public static string DriverName
        {
            get { return "ArangoDB-NET"; }
        }

        public static string DriverVersion
        {
            get { return "0.7.0"; }
        }

        public static ArangoSettings Settings { get; set; }

        static ArangoClient()
        {
            Settings = new ArangoSettings();
        }

        public static void AddDatabase(string hostname, int port, bool isSecured, string userName, string password, string alias)
        {
            var connection = new Connection(hostname, port, isSecured, userName, password, alias);

            _connections.Add(connection);
        }

        internal static Connection GetConnection(string alias)
        {
            return _connections.Where(connection => connection.Alias == alias).FirstOrDefault();
        }
    }
}

using System.Collections.Generic;
using System.Linq;
using Arango.Client.Protocol;

namespace Arango.Client
{
    public static class ArangoClient
    {
        private static Dictionary<string, Connection> _connections = new Dictionary<string, Connection>();

        public const string DriverName = "ArangoDB-NET";

        public const string DriverVersion = "0.7.0";

        public static ArangoSettings Settings { get; set; }

        static ArangoClient()
        {
            Settings = new ArangoSettings();
        }

        public static void AddDatabase(string hostname, int port, bool isSecured, string userName, string password, string alias)
        {
            _connections.Add(
                alias,
                new Connection(hostname, port, isSecured, userName, password, alias)
            );
        }

        internal static Connection GetConnection(string alias)
        {
            return _connections[alias];
        }
    }
}

Make driver name and version static properties constants and use dictionary structure for connections to simplify their retrieval.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.RazorPages;
using BlogTemplate.Models;

namespace BlogTemplate.Pages
{
    public class PostModel : PageModel
    {
        private Blog _blog;

        public PostModel(Blog blog)
        {
            _blog = blog;
        }

        public Post Post { get; set; }

        public void OnGet()
        {
            string slug = RouteData.Values["slug"].ToString();
            Post = _blog.Posts.FirstOrDefault(p => p.Slug == slug);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.RazorPages;
using BlogTemplate.Models;

namespace BlogTemplate.Pages
{
    public class PostModel : PageModel
    {
        private Blog _blog;

        public PostModel(Blog blog)
        {
            _blog = blog;
        }

        public Post Post { get; set; }

        public void OnGet()
        {
            string slug = RouteData.Values["slug"].ToString();
            Post = _blog.Posts.FirstOrDefault(p => p.Slug == slug);

            BlogDataStore dataStore = new BlogDataStore();
            Post = dataStore.GetPost(slug);

            if(Post == null)
            {
                RedirectToPage("/Index");
            }
        }
    }
}

Read in post data from the data store

Read in post data from the data store


namespace food_tracker {
    public class NutritionItem {
        public string name { get; set; }
        public double calories { get; set; }
        public double carbohydrates { get; set; }
        public double sugars { get; set; }
        public double fats { get; set; }
        public double saturatedFats { get; set; }
        public double protein { get; set; }
        public double salt { get; set; }
        public double fibre { get; set; }

        public NutritionItem(string name, double calories, double carbohydrates, double sugars, double fats, double satFat, double protein, double salt, double fibre) {
            this.name = name;
            this.calories = calories;
            this.carbohydrates = carbohydrates;
            this.sugars = sugars;
            this.fats = fats;
            this.saturatedFats = satFat;
            this.protein = protein;
            this.salt = salt;
            this.fibre = fibre;
        }
    }
}

using System.ComponentModel.DataAnnotations;
namespace food_tracker {
    public class NutritionItem {

        [Key]
        public int NutritionItemId { get; set; }
        public string name { get; set; }
        public string dayId { get; set; }
        public double calories { get; set; }
        public double carbohydrates { get; set; }
        public double sugars { get; set; }
        public double fats { get; set; }
        public double saturatedFats { get; set; }
        public double protein { get; set; }
        public double salt { get; set; }
        public double fibre { get; set; }

        public NutritionItem() { }

        public NutritionItem(string name, string day, double calories, double carbohydrates, double sugars, double fats, double satFat, double protein, double salt, double fibre) {
            this.name = name;
            this.dayId = day;
            this.calories = calories;
            this.carbohydrates = carbohydrates;
            this.sugars = sugars;
            this.fats = fats;
            this.saturatedFats = satFat;
            this.protein = protein;
            this.salt = salt;
            this.fibre = fibre;
        }
    }
}

Add defulat constructor and add day as an attribute


using Bugsnag.Payload;

namespace Bugsnag
{
  public interface IClient
  {
    void Notify(System.Exception exception, Request request = null);
    void Notify(System.Exception exception, Severity severity, Request request = null);
    void Notify(System.Exception exception, HandledState severity, Request request = null);
    void Notify(Report report);

    IBreadcrumbs Breadcrumbs { get; }

    ISessionTracker SessionTracking { get; }

    IConfiguration Configuration { get; }
  }
}

using Bugsnag.Payload;

namespace Bugsnag
{
  public interface IClient
  {
    void Notify(System.Exception exception, Request request = null);
    void Notify(System.Exception exception, Severity severity, Request request = null);
    void Notify(System.Exception exception, HandledState severity, Request request = null);
    void Notify(Report report);

    IBreadcrumbs Breadcrumbs { get; }

    ISessionTracker SessionTracking { get; }

    IConfiguration Configuration { get; }

    void BeforeNotify(Middleware middleware);
  }
}

Add before notify to client interface

Add before notify to client interface

@codehex noticed this was missing


using System;
using System.Threading;
namespace SPAD.neXt.Interfaces.Base
{
    public interface ISPADBackgroundThread
    {
        string WorkerName { get; }
        bool IsRunning { get; }
        TimeSpan Interval { get; }
        bool ScheduleOnTimeout { get; }
        EventWaitHandle SignalHandle { get; }
        EventWaitHandle StopHandle { get; }
        bool IsPaused { get; }

        bool IsActive();
        void Signal();
        void Start();
        void Start(uint waitInterval);
        void Start(uint waitInterval, object argument);
        void Pause();
        void Continue();
        bool CanContinue();
        void Stop();
        void Abort();

        void SetImmuneToPreStop(bool v);
        void SetArgument(object argument);
        void SetContinousMode(bool mode);
        void SetIntervall(TimeSpan newInterval);
        void SetScheduleOnTimeout(bool mode);
    }

    public interface ISPADBackgroundWorker
    {
        void BackgroundProcessingStart(ISPADBackgroundThread workerThread, object argument);
        void BackgroundProcessingContinue(ISPADBackgroundThread workerThread, object argument);
        void BackgroundProcessingStop(ISPADBackgroundThread workerThread, object argument);
        void BackgroundProcessingDoWork(ISPADBackgroundThread workerThread, object argument);
    }
}

using System;
using System.Threading;
namespace SPAD.neXt.Interfaces.Base
{
    public interface ISPADBackgroundThread
    {
        string WorkerName { get; }
        bool IsRunning { get; }
        TimeSpan Interval { get; }
        bool ScheduleOnTimeout { get; }
        EventWaitHandle SignalHandle { get; }
        EventWaitHandle StopHandle { get; }
        bool IsPaused { get; }

        bool IsActive();
        void Signal();
        void Start();
        void Start(uint waitInterval);
        void Start(uint waitInterval, object argument);
        void Pause();
        void Continue();
        bool CanContinue();
        void Stop();
        void Abort();

        void SetImmuneToPreStop(bool v);
        void SetArgument(object argument);
        void SetContinousMode(bool mode);
        void SetIntervall(TimeSpan newInterval);
        void SetScheduleOnTimeout(bool mode);
        void SetPriority(ThreadPriority priority);
    }

    public interface ISPADBackgroundWorker
    {
        void BackgroundProcessingStart(ISPADBackgroundThread workerThread, object argument);
        void BackgroundProcessingContinue(ISPADBackgroundThread workerThread, object argument);
        void BackgroundProcessingStop(ISPADBackgroundThread workerThread, object argument);
        void BackgroundProcessingDoWork(ISPADBackgroundThread workerThread, object argument);
    }
}

Add support to set thread priority

Add support to set thread priority


// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Mania.Difficulty;
using osu.Game.Rulesets.Mania.Mods;
using osu.Game.Tests.Beatmaps;

namespace osu.Game.Rulesets.Mania.Tests
{
    public class ManiaDifficultyCalculatorTest : DifficultyCalculatorTest
    {
        protected override string ResourceAssembly => "osu.Game.Rulesets.Mania";

        [TestCase(2.3449735700206298d, 151, "diffcalc-test")]
        public void Test(double expectedStarRating, int expectedMaxCombo, string name)
            => base.Test(expectedStarRating, expectedMaxCombo, name);

        [TestCase(2.7879104989252959d, 151, "diffcalc-test")]
        public void TestClockRateAdjusted(double expectedStarRating, int expectedMaxCombo, string name)
            => Test(expectedStarRating, expectedMaxCombo, name, new ManiaModDoubleTime());

        protected override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) => new ManiaDifficultyCalculator(new ManiaRuleset().RulesetInfo, beatmap);

        protected override Ruleset CreateRuleset() => new ManiaRuleset();
    }
}

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using NUnit.Framework;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Mania.Difficulty;
using osu.Game.Rulesets.Mania.Mods;
using osu.Game.Tests.Beatmaps;

namespace osu.Game.Rulesets.Mania.Tests
{
    public class ManiaDifficultyCalculatorTest : DifficultyCalculatorTest
    {
        protected override string ResourceAssembly => "osu.Game.Rulesets.Mania";

        [TestCase(2.3449735700206298d, 242, "diffcalc-test")]
        public void Test(double expectedStarRating, int expectedMaxCombo, string name)
            => base.Test(expectedStarRating, expectedMaxCombo, name);

        [TestCase(2.7879104989252959d, 242, "diffcalc-test")]
        public void TestClockRateAdjusted(double expectedStarRating, int expectedMaxCombo, string name)
            => Test(expectedStarRating, expectedMaxCombo, name, new ManiaModDoubleTime());

        protected override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) => new ManiaDifficultyCalculator(new ManiaRuleset().RulesetInfo, beatmap);

        protected override Ruleset CreateRuleset() => new ManiaRuleset();
    }
}

Update max combo test value

Update max combo test value


using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DataStats")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("DataStats")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components.  If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("26b9df58-5fa9-42e5-95b0-444a259a3e68")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DataStats")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("J.D. Sandifer")]
[assembly: AssemblyProduct("DataStats")]
[assembly: AssemblyCopyright("© 2016 J.D. Sandifer")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components.  If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("26b9df58-5fa9-42e5-95b0-444a259a3e68")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyFileVersion("1.0.*")]

Update build properties with correct data


using System.Reflection;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OWLib")]
[assembly: AssemblyDescription("Common Overwatch Library")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OWLib")]
[assembly: AssemblyCopyright("Copyright © 2016-2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components.  If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(true)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("353c0d05-c505-4df4-909e-624fd94a7d3b")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.10.0.0")]
[assembly: AssemblyFileVersion("1.10.0.0")]
[assembly: AssemblyInformationalVersion("unknown")]

Add unknown file version placeholder

Add unknown file version placeholder


using System.Threading.Tasks;
using System.Web;
using SignalR.Abstractions;

namespace SignalR.AspNet
{
    public class AspNetResponse : IResponse
    {
        private readonly HttpRequestBase _request;
        private readonly HttpResponseBase _response;

        public AspNetResponse(HttpRequestBase request, HttpResponseBase response)
        {
            _request = request;
            _response = response;
        }

        public bool Buffer
        {
            get
            {
                return _response.Buffer;
            }
            set
            {
                _response.Buffer = value;
                _response.Buffer = value;
                _response.BufferOutput = value;

                if (!value)
                {
                    // This forces the IIS compression module to leave this response alone.
                    // If we don't do this, it will buffer the response to suit its own compression
                    // logic, resulting in partial messages being sent to the client.
                    _request.Headers.Remove("Accept-Encoding");
                    _response.CacheControl = "no-cache";
                    _response.AddHeader("Connection", "keep-alive");
                }
            }
        }

        public bool IsClientConnected
        {
            get
            {
                return _response.IsClientConnected;
            }
        }

        public string ContentType
        {
            get
            {
                return _response.ContentType;
            }
            set
            {
                _response.ContentType = value;
            }
        }

        public Task WriteAsync(string data)
        {
            _response.Write(data);
            return TaskAsyncHelper.Empty;
        }
    }
}

using System.Threading.Tasks;
using System.Web;
using SignalR.Abstractions;

namespace SignalR.AspNet
{
    public class AspNetResponse : IResponse
    {
        private readonly HttpRequestBase _request;
        private readonly HttpResponseBase _response;

        public AspNetResponse(HttpRequestBase request, HttpResponseBase response)
        {
            _request = request;
            _response = response;
        }

        public bool Buffer
        {
            get
            {
                return _response.Buffer;
            }
            set
            {
                _response.Buffer = value;
                _response.BufferOutput = value;

                if (!value)
                {
                    // This forces the IIS compression module to leave this response alone.
                    // If we don't do this, it will buffer the response to suit its own compression
                    // logic, resulting in partial messages being sent to the client.
                    _request.Headers.Remove("Accept-Encoding");
                    _response.CacheControl = "no-cache";
                    _response.AddHeader("Connection", "keep-alive");
                }
            }
        }

        public bool IsClientConnected
        {
            get
            {
                return _response.IsClientConnected;
            }
        }

        public string ContentType
        {
            get
            {
                return _response.ContentType;
            }
            set
            {
                _response.ContentType = value;
            }
        }

        public Task WriteAsync(string data)
        {
            _response.Write(data);
            return TaskAsyncHelper.Empty;
        }
    }
}

Remove duplicate line (copy paste bug).

Remove duplicate line (copy paste bug).


using System.Collections.Generic;

namespace DevelopmentInProgress.DipState
{
    public interface IDipState
    {
        int Id { get; }
        string Name { get; }
        bool IsDirty { get; }
        bool InitialiseWithParent { get; }
        DipStateType Type { get; }
        DipStateStatus Status { get; }
        IDipState Parent { get; }
        IDipState Antecedent { get; }
        IDipState Transition { get; set; }
        List<IDipState> Transitions { get; }
        List<IDipState> Dependencies { get; }
        List<IDipState> SubStates { get; }
        List<StateAction> Actions { get; }
        List<LogEntry> Log { get; }
        bool CanComplete();
        void Reset();
    }
}

using System;
using System.Collections.Generic;

namespace DevelopmentInProgress.DipState
{
    public interface IDipState
    {
        int Id { get; }
        string Name { get; }
        bool IsDirty { get; }
        bool InitialiseWithParent { get; }
        DipStateType Type { get; }
        DipStateStatus Status { get; }
        IDipState Parent { get; }
        IDipState Antecedent { get; }
        IDipState Transition { get; set; }
        List<IDipState> Transitions { get; }
        List<IDipState> Dependencies { get; }
        List<IDipState> SubStates { get; }
        List<StateAction> Actions { get; }
        List<LogEntry> Log { get; }
        bool CanComplete();
        void Reset();
        DipState AddTransition(IDipState transition);
        DipState AddDependency(IDipState dependency);
        DipState AddSubState(IDipState subState);
        DipState AddAction(DipStateActionType actionType, Action<IDipState> action);
    }
}

Add additional methods to interface

Add additional methods to interface

Add additional methods to interface


using System.IO;

namespace LINQToTreeHelpers.FutureUtils
{
    /// <summary>
    /// Future TFile - really just a normal TFile, but gets written out in the future...
    /// </summary>
    public class FutureTFile : FutureTDirectory
    {
        private static ROOTNET.Interface.NTFile CreateOpenFile(string name)
        {
            var f = ROOTNET.NTFile.Open(name, "RECREATE");
            return f;
        }

        /// <summary>
        /// Creates a new ROOT file and attaches a future value container to it. This container
        /// can be used to store future values that get evaluated at a later time.
        /// </summary>
        /// <param name="outputRootFile"></param>
        public FutureTFile(FileInfo outputRootFile)
            : base(CreateOpenFile(outputRootFile.FullName))
        {
        }

        /// <summary>
        /// Creates a new ROOT file and attaches a future value container to it. This container
        /// can be used to store future values that get evaluated at a later time.
        /// </summary>
        /// <param name="outputRootFile"></param>
        public FutureTFile(string outputRootFile)
            : base(CreateOpenFile(outputRootFile))
        {
        }

        /// <summary>
        /// Close this file. Resolves all futures, writes the directories, and closes the file
        /// </summary>
        public void Close()
        {
            //
            // Write out this guy and close it!
            //

            Write();
            Directory.Close();
        }
    }
}

using System;
using System.IO;

namespace LINQToTreeHelpers.FutureUtils
{
    /// <summary>
    /// Future TFile - really just a normal TFile, but gets written out in the future...
    /// </summary>
    public class FutureTFile : FutureTDirectory
    {
        private static ROOTNET.Interface.NTFile CreateOpenFile(string name)
        {
            var f = ROOTNET.NTFile.Open(name, "RECREATE");
            if (!f.IsOpen())
            {
                throw new InvalidOperationException(string.Format("Unable to create file '{0}'. It could be the file is locked by another process (like ROOT!!??)", name));
            }
            return f;
        }

        /// <summary>
        /// Creates a new ROOT file and attaches a future value container to it. This container
        /// can be used to store future values that get evaluated at a later time.
        /// </summary>
        /// <param name="outputRootFile"></param>
        public FutureTFile(FileInfo outputRootFile)
            : base(CreateOpenFile(outputRootFile.FullName))
        {
        }

        /// <summary>
        /// Creates a new ROOT file and attaches a future value container to it. This container
        /// can be used to store future values that get evaluated at a later time.
        /// </summary>
        /// <param name="outputRootFile"></param>
        public FutureTFile(string outputRootFile)
            : base(CreateOpenFile(outputRootFile))
        {
        }

        /// <summary>
        /// Close this file. Resolves all futures, writes the directories, and closes the file
        /// </summary>
        public void Close()
        {
            //
            // Write out this guy and close it!
            //

            Write();
            Directory.Close();
        }
    }
}

Make sure file is open before getting on with it.


using Discord;
using Discord.Commands;
using Discord.Rest;
using Discord.WebSocket;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using SoraBot.Data.Configurations;

namespace SoraBot.Bot.Extensions
{
    public static class ServiceCollectionExtensions
    {
        public static IServiceCollection AddSoraBot(this IServiceCollection services)
        {

            services.AddSingleton(
                provider => new DiscordSocketClient(new DiscordSocketConfig()
                {
                    AlwaysDownloadUsers = false,
                    LogLevel = LogSeverity.Debug,
                    MessageCacheSize = 0, // Let's have this disabled for now.
                    TotalShards = provider.GetService<IOptions<SoraBotConfig>>().Value.TotalShards,
                    ShardId = 0 // TODO make this configurable
                }));

            services.AddSingleton(new DiscordRestClient(new DiscordRestConfig()
            {
                LogLevel = LogSeverity.Debug
            }));

            services.AddSingleton(_ =>
            {
                var service = new CommandService(new CommandServiceConfig()
                {
                    LogLevel = LogSeverity.Debug,
                    DefaultRunMode = RunMode.Sync,
                    CaseSensitiveCommands = false,
                    SeparatorChar = ' '
                });
                // Here i could add type readers or programatically added commands etc
                return services;
            });

            services.AddSingleton<DiscordSerilogAdapter>();

            services.AddHostedService<SoraBot>();

            return services;
        }
    }
}

using Discord;
using Discord.Commands;
using Discord.Rest;
using Discord.WebSocket;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using SoraBot.Data.Configurations;

namespace SoraBot.Bot.Extensions
{
    public static class ServiceCollectionExtensions
    {
        public static IServiceCollection AddSoraBot(this IServiceCollection services)
        {

            services.AddSingleton(
                provider => new DiscordSocketClient(new DiscordSocketConfig()
                {
                    AlwaysDownloadUsers = false,
                    LogLevel = LogSeverity.Debug,
                    MessageCacheSize = 0, // Let's have this disabled for now.
                    TotalShards = provider.GetService<IOptions<SoraBotConfig>>().Value.TotalShards,
                    ShardId = 0 // TODO make this configurable
                }));

            services.AddSingleton(new DiscordRestClient(new DiscordRestConfig()
            {
                LogLevel = LogSeverity.Debug
            }));

            services.AddSingleton(_ =>
            {
                var service = new CommandService(new CommandServiceConfig()
                {
                    LogLevel = LogSeverity.Debug,
                    DefaultRunMode = RunMode.Sync,
                    CaseSensitiveCommands = false,
                    SeparatorChar = ' '
                });
                // Here i could add type readers or programatically added commands etc
                return service;
            });

            services.AddSingleton<DiscordSerilogAdapter>();

            services.AddHostedService<SoraBot>();

            return services;
        }
    }
}

Fix issue with misspelled commandservice


namespace MyStudio.ViewModels
{
    using Catel;
    using Catel.MVVM;

    using MyStudio.Models;
    using MyStudio.Services;

    public class RibbonViewModel : ViewModelBase
    {
        private StudioStateModel model;

        private ICommandsService commandsService;

        public RibbonViewModel(StudioStateModel model,
            ICommandsService commandsService)
        {
            Argument.IsNotNull(() => model);
            Argument.IsNotNull(() => commandsService);

            this.model = model;
            this.commandsService = commandsService;
        }

        public Command StartCommand
        {
            get
            {
                return this.commandsService.StartCommand;
            }
        }

    }
}

namespace MyStudio.ViewModels
{
    using Catel;
    using Catel.MVVM;

    using MyStudio.Models;
    using MyStudio.Services;

    public class RibbonViewModel : ViewModelBase
    {
        private StudioStateModel model;

        private ICommandsService commandsService;

        public RibbonViewModel(StudioStateModel model,
            ICommandsService commandsService)
        {
            Argument.IsNotNull(() => model);
            Argument.IsNotNull(() => commandsService);

            this.model = model;
            this.commandsService = commandsService;
        }

        public Command StartCommand
        {
            get
            {
                return this.commandsService != null ? this.commandsService.StartCommand : null;
            }
        }

    }
}

Fix for win7 null reference exception on start


using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.EventHubs;
using ServiceFabric.Utilities;

namespace SceneSkope.ServiceFabric.EventHubs
{
    public static class EventHubConfiguration
    {
        public static async Task<EventHubClient> GetEventHubClientAsync(string sectionName, Action<string> onFailure, CancellationToken ct)
        {
            var inputConnectionString = await GetEventHubConnectionString(sectionName, onFailure, ct).ConfigureAwait(false);
            return EventHubClient.CreateFromConnectionString(inputConnectionString);
        }

        private static async Task<string> GetEventHubConnectionString(string sectionName, Action<string> onFailure, CancellationToken ct)
        {
            return (await GetEventHubConnectionStringBuilder(sectionName, onFailure, ct).ConfigureAwait(false)).ToString();
        }

        private static async Task<EventHubsConnectionStringBuilder> GetEventHubConnectionStringBuilder(string sectionName, Action<string> onFailure, CancellationToken ct)
        {
            var configuration = new FabricConfigurationProvider(sectionName);
            if (!configuration.HasConfiguration)
            {
                await configuration.RejectConfigurationAsync($"No {sectionName} section", onFailure, ct).ConfigureAwait(false);
            }
            return new EventHubsConnectionStringBuilder(
                new Uri(await configuration.TryReadConfigurationAsync("EndpointAddress", onFailure, ct).ConfigureAwait(false)),
                await configuration.TryReadConfigurationAsync("EntityPath", onFailure, ct).ConfigureAwait(false),
                await configuration.TryReadConfigurationAsync("SharedAccessKeyName", onFailure, ct).ConfigureAwait(false),
                await configuration.TryReadConfigurationAsync("SharedAccessKey", onFailure, ct).ConfigureAwait(false)
            );
        }
    }
}

using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.EventHubs;
using ServiceFabric.Utilities;

namespace SceneSkope.ServiceFabric.EventHubs
{
    public static class EventHubConfiguration
    {
        public static async Task<EventHubClient> GetEventHubClientAsync(string sectionName, Action<string> onFailure, CancellationToken ct)
        {
            var inputConnectionString = await GetEventHubConnectionString(sectionName, onFailure, ct).ConfigureAwait(false);
            return EventHubClient.CreateFromConnectionString(inputConnectionString);
        }

        public static async Task<string> GetEventHubConnectionString(string sectionName, Action<string> onFailure, CancellationToken ct)
        {
            return (await GetEventHubConnectionStringBuilder(sectionName, onFailure, ct).ConfigureAwait(false)).ToString();
        }

        public static async Task<EventHubsConnectionStringBuilder> GetEventHubConnectionStringBuilder(string sectionName, Action<string> onFailure, CancellationToken ct)
        {
            var configuration = new FabricConfigurationProvider(sectionName);
            if (!configuration.HasConfiguration)
            {
                await configuration.RejectConfigurationAsync($"No {sectionName} section", onFailure, ct).ConfigureAwait(false);
            }
            return new EventHubsConnectionStringBuilder(
                new Uri(await configuration.TryReadConfigurationAsync("EndpointAddress", onFailure, ct).ConfigureAwait(false)),
                await configuration.TryReadConfigurationAsync("EntityPath", onFailure, ct).ConfigureAwait(false),
                await configuration.TryReadConfigurationAsync("SharedAccessKeyName", onFailure, ct).ConfigureAwait(false),
                await configuration.TryReadConfigurationAsync("SharedAccessKey", onFailure, ct).ConfigureAwait(false)
            );
        }
    }
}

Make the api changes public!

Make the api changes public!


// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System.Threading.Tasks;
using NUnit.Framework;
using osu.Framework.IO.Stores;
using osu.Framework.Tests.Visual;

namespace osu.Framework.Tests.IO
{
    public class DllResourceStoreTest
    {
        [Test]
        public async Task TestSuccessfulAsyncLookup()
        {
            var resourceStore = new DllResourceStore(typeof(FrameworkTestScene).Assembly);

            byte[]? stream = await resourceStore.GetAsync("Resources.Tracks.sample-track.mp3");
            Assert.That(stream, Is.Not.Null);
        }

        [Test]
        public async Task TestFailedAsyncLookup()
        {
            var resourceStore = new DllResourceStore(typeof(FrameworkTestScene).Assembly);

            byte[]? stream = await resourceStore.GetAsync("Resources.Tracks.sample-track.mp5");
            Assert.That(stream, Is.Null);
        }
    }
}

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using System.Threading.Tasks;
using NUnit.Framework;
using osu.Framework.IO.Stores;
using osu.Framework.Tests.Visual;

namespace osu.Framework.Tests.IO
{
    public class DllResourceStoreTest
    {
        [Test]
        public async Task TestSuccessfulAsyncLookup()
        {
            var resourceStore = new DllResourceStore(typeof(FrameworkTestScene).Assembly);

            byte[]? stream = await resourceStore.GetAsync("Resources.Tracks.sample-track.mp3").ConfigureAwait(false);
            Assert.That(stream, Is.Not.Null);
        }

        [Test]
        public async Task TestFailedAsyncLookup()
        {
            var resourceStore = new DllResourceStore(typeof(FrameworkTestScene).Assembly);

            byte[]? stream = await resourceStore.GetAsync("Resources.Tracks.sample-track.mp5").ConfigureAwait(false);
            Assert.That(stream, Is.Null);
        }
    }
}

Fix CI complaining about no `ConfigureAwait()`


using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Web.Http;
using Microsoft.Owin.Security.OAuth;
using Newtonsoft.Json.Serialization;

namespace NeedDotNet.Web
{
    public static class WebApiConfig
    {
        public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services
            // Configure Web API to use only bearer token authentication.
            config.SuppressDefaultHostAuthentication();
            config.Filters.Add(new HostAuthenticationFilter(OAuthDefaults.AuthenticationType));

            // Use camel case for JSON data.
            config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();

            // Web API routes
            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Web.Http;
using Microsoft.Owin.Security.OAuth;
using Newtonsoft.Json.Serialization;

namespace NeedDotNet.Web
{
    public static class WebApiConfig
    {
        public static void Register(HttpConfiguration config)
        {

            // Web API routes
            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );
        }
    }
}

Clean up Web Api Config Commit

Clean up Web Api Config Commit


using UnityEngine;
using System.Collections;
using System;
namespace Lockstep
{
    public class Buff
    {

        protected int Duration;
        protected int Timer;
        protected LSAgent Target;
        internal int ID {get; set;}
        public bool Active {get; private set;}
        public void Initialize (int duration, LSAgent target) {
            Duration = duration;
            Timer = 0;
            Target = target;

            Target.AddBuff(this);
            Active = true;
        }

        protected virtual void OnInitialize () {

        }

        public void Simulate () {
            Timer++;
            OnSimulate ();
            if (Timer > Duration) {
                Deactivate ();
            }
        }

        protected virtual void OnSimulate () {

        }

        public void Deactivate () {
            Target.RemoveBuff(this);
            Active = false;
        }
        protected virtual void OnDeactivate () {

        }
    }
}

using UnityEngine;
using System.Collections;
using System;
namespace Lockstep
{
    public class Buff
    {

        protected int Duration;
        protected int Timer;
        protected LSAgent Target;
        internal int ID {get; set;}
        public bool Active {get; private set;}
        public void Initialize (int duration, LSAgent target) {
            Duration = duration;
            Timer = 0;
            Target = target;

            Target.AddBuff(this);
            Active = true;
            this.OnInitialize();
        }

        protected virtual void OnInitialize () {

        }

        public void Simulate () {
            Timer++;
            OnSimulate ();
            if (Timer > Duration) {
                Deactivate ();
            }
        }

        protected virtual void OnSimulate () {

        }

        public void Deactivate () {
            Target.RemoveBuff(this);
            Active = false;
            this.OnDeactivate();
        }
        protected virtual void OnDeactivate () {

        }
    }
}

Fix functions not being called

Fix functions not being called


using EntityFrameworkCore.RawSQLExtensions.SqlQuery;
using Microsoft.EntityFrameworkCore.Infrastructure;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;

namespace EntityFrameworkCore.RawSQLExtensions.Extensions
{
    public static class DatabaseFacadeExtensions
    {
        public static ISqlQuery<T> SqlQuery<T>(this DatabaseFacade database, string sqlQuery, params SqlParameter[] parameters)
        {
            return new SqlRawQuery<T>(database, sqlQuery, parameters);
        }
        public static ISqlQuery<T> SqlQuery<T>(this DatabaseFacade database, string sqlQuery, IEnumerable<SqlParameter> parameters)
        {
            return new SqlRawQuery<T>(database, sqlQuery, parameters.ToArray());
        }

        public static ISqlQuery<T> StoredProcedure<T>(this DatabaseFacade database, string storedProcName, params SqlParameter[] parameters)
        {
            return new StoredProcedure<T>(database, storedProcName, parameters);
        }
        public static ISqlQuery<T> StoredProcedure<T>(this DatabaseFacade database, string storedProcName, IEnumerable<SqlParameter> parameters)
        {
            return new StoredProcedure<T>(database, storedProcName, parameters.ToArray());
        }
    }
}

using EntityFrameworkCore.RawSQLExtensions.SqlQuery;
using Microsoft.EntityFrameworkCore.Infrastructure;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;

namespace EntityFrameworkCore.RawSQLExtensions.Extensions
{
    public static class DatabaseFacadeExtensions
    {
        public static ISqlQuery<object> SqlQuery(this DatabaseFacade database, Type type, string sqlQuery, params SqlParameter[] parameters)
        {
            var tsrq = typeof(SqlRawQuery<>).MakeGenericType(type);
            return (ISqlQuery<object>)Activator.CreateInstance(tsrq, database, sqlQuery, parameters);
        }

        public static ISqlQuery<T> SqlQuery<T>(this DatabaseFacade database, string sqlQuery, params SqlParameter[] parameters)
        {
            return new SqlRawQuery<T>(database, sqlQuery, parameters);
        }

        public static ISqlQuery<T> SqlQuery<T>(this DatabaseFacade database, string sqlQuery, IEnumerable<SqlParameter> parameters)
        {
            return new SqlRawQuery<T>(database, sqlQuery, parameters.ToArray());
        }

        public static ISqlQuery<T> StoredProcedure<T>(this DatabaseFacade database, string storedProcName, params SqlParameter[] parameters)
        {
            return new StoredProcedure<T>(database, storedProcName, parameters);
        }

        public static ISqlQuery<T> StoredProcedure<T>(this DatabaseFacade database, string storedProcName, IEnumerable<SqlParameter> parameters)
        {
            return new StoredProcedure<T>(database, storedProcName, parameters.ToArray());
        }
    }
}

Add ISqlQuery<object> SqlQuery(this DatabaseFacade database, Type type, string sqlQuery, params SqlParameter[] parameters)


using System;

namespace GUtils.IO
{
    public static class FileSizes
    {
        public const UInt64 B = 1024;
        public const UInt64 KiB = 1024 * B;
        public const UInt64 MiB = 1024 * KiB;
        public const UInt64 GiB = 1024 * MiB;
        public const UInt64 TiB = 1024 * GiB;
        public const UInt64 PiB = 1024 * TiB;

        private static readonly String[] _suffixes = new[] { "B", "KiB", "MiB", "GiB", "TiB", "PiB" };

        public static String Format ( UInt64 Size )
        {
            var i = ( Int32 ) Math.Floor ( Math.Log ( Size, 1024 ) );
            return $"{Size / ( Math.Pow ( B, i ) )} {_suffixes[i]}";
        }
    }
}

using System;

namespace GUtils.IO
{
	public static class FileSizes
	{
		public const UInt64 B = 1024;
		public const UInt64 KiB = 1024 * B;
		public const UInt64 MiB = 1024 * KiB;
		public const UInt64 GiB = 1024 * MiB;
		public const UInt64 TiB = 1024 * GiB;
		public const UInt64 PiB = 1024 * TiB;

		private static readonly String[] _suffixes = new[] { "B", "KiB", "MiB", "GiB", "TiB", "PiB" };

		public static String Format ( UInt64 Size )
		{
			var i = ( Int32 ) Math.Floor ( Math.Log ( Size, 1024 ) );
			return $"{Size / ( Math.Pow ( B, i ) )} {_suffixes[i]}";
		}

		public static String Format ( UInt64 Size, Int32 decimals )
		{
			var i = ( Int32 ) Math.Floor ( Math.Log ( Size, 1024 ) );
			return $"{Math.Round ( Size / ( Math.Pow ( B, i ) ), decimals )} {_suffixes[i]}";
		}
	}
}

Add an option to set the number of decimal places that will be used in the formatting


using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;
using Fixie.Execution;

namespace Fixie.VisualStudio.TestAdapter
{
    [DefaultExecutorUri(Executor.Id)]
    [FileExtension(".exe")]
    [FileExtension(".dll")]
    public class Discoverer : ITestDiscoverer
    {
        public void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discoveryContext, IMessageLogger log, ITestCaseDiscoverySink discoverySink)
        {
            RemotingUtility.CleanUpRegisteredChannels();

            foreach (var source in sources)
            {
                log.Info("Processing " + source);

                try
                {
                    var assemblyFullPath = Path.GetFullPath(source);

                    using (var environment = new ExecutionEnvironment(assemblyFullPath))
                    {
                        var discovery = environment.Create<DiscoveryProxy>();

                        foreach (var methodGroup in discovery.TestMethodGroups(assemblyFullPath))
                        {
                            discoverySink.SendTestCase(new TestCase(methodGroup.FullName, Executor.Uri, source)
                            {
                                DisplayName = methodGroup.FullName
                            });
                        }
                    }
                }
                catch (Exception exception)
                {
                    log.Error(exception);
                }
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.IO;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Adapter;
using Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging;
using Fixie.Execution;

namespace Fixie.VisualStudio.TestAdapter
{
    [DefaultExecutorUri(Executor.Id)]
    [FileExtension(".exe")]
    [FileExtension(".dll")]
    public class Discoverer : ITestDiscoverer
    {
        public void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discoveryContext, IMessageLogger log, ITestCaseDiscoverySink discoverySink)
        {
            RemotingUtility.CleanUpRegisteredChannels();

            foreach (var source in sources)
            {
                log.Info("Processing " + source);

                try
                {
                    var assemblyFullPath = Path.GetFullPath(source);

                    using (var environment = new ExecutionEnvironment(assemblyFullPath))
                    {
                        var discovery = environment.Create<DiscoveryProxy>();

                        foreach (var methodGroup in discovery.TestMethodGroups(assemblyFullPath))
                            discoverySink.SendTestCase(new TestCase(methodGroup.FullName, Executor.Uri, source));
                    }
                }
                catch (Exception exception)
                {
                    log.Error(exception);
                }
            }
        }
    }
}

Remove population of Visual Studio's TestCase.DisplayName property during test discovery. This has no effect and is misleading. TestCase.FullyQualifiedName is set to the method group of a test method, but TestCase.DisplayName should only be set during execution time to the full name of a test case including input parameters. Setting TestCase.DisplayName at discovery time is meaningless.


// 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.Graphics;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.UI;

namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners
{
    public class SpinnerPlacementBlueprint : PlacementBlueprint
    {
        public new Spinner HitObject => (Spinner)base.HitObject;

        private readonly SpinnerPiece piece;

        private bool isPlacingEnd;

        public SpinnerPlacementBlueprint()
            : base(new Spinner { Position = OsuPlayfield.BASE_SIZE / 2 })
        {
            InternalChild = piece = new SpinnerPiece(HitObject) { Alpha = 0.5f };
        }

        protected override bool OnClick(ClickEvent e)
        {
            if (isPlacingEnd)
            {
                HitObject.EndTime = EditorClock.CurrentTime;
                EndPlacement();
            }
            else
            {
                HitObject.StartTime = EditorClock.CurrentTime;

                isPlacingEnd = true;
                piece.FadeTo(1f, 150, Easing.OutQuint);
            }

            return true;
        }
    }
}

// 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.Graphics;
using osu.Framework.Input.Events;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.UI;

namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners
{
    public class SpinnerPlacementBlueprint : PlacementBlueprint
    {
        public new Spinner HitObject => (Spinner)base.HitObject;

        private readonly SpinnerPiece piece;

        private bool isPlacingEnd;

        public SpinnerPlacementBlueprint()
            : base(new Spinner { Position = OsuPlayfield.BASE_SIZE / 2 })
        {
            InternalChild = piece = new SpinnerPiece(HitObject) { Alpha = 0.5f };
        }

        protected override bool OnClick(ClickEvent e)
        {
            if (isPlacingEnd)
            {
                HitObject.EndTime = EditorClock.CurrentTime;
                EndPlacement();
            }
            else
            {
                HitObject.StartTime = EditorClock.CurrentTime;

                isPlacingEnd = true;
                piece.FadeTo(1f, 150, Easing.OutQuint);

                BeginPlacement();
            }

            return true;
        }
    }
}

Fix spinners not starting placement with the first click


using System;
using System.Diagnostics;

namespace NuGetConsole.Implementation.PowerConsole {
    /// <summary>
    /// Represents a host with extra info.
    /// </summary>
    class HostInfo : ObjectWithFactory<PowerConsoleWindow> {
        Lazy<IHostProvider, IHostMetadata> HostProvider { get; set; }

        public HostInfo(PowerConsoleWindow factory, Lazy<IHostProvider, IHostMetadata> hostProvider)
            : base(factory) {
            UtilityMethods.ThrowIfArgumentNull(hostProvider);
            this.HostProvider = hostProvider;
        }

        /// <summary>
        /// Get the HostName attribute value of this host.
        /// </summary>
        public string HostName {
            get { return HostProvider.Metadata.HostName; }
        }

        IWpfConsole _wpfConsole;

        /// <summary>
        /// Get/create the console for this host. If not already created, this
        /// actually creates the (console, host) pair.
        ///
        /// Note: Creating the console is handled by this package and mostly will
        /// succeed. However, creating the host could be from other packages and
        /// fail. In that case, this console is already created and can be used
        /// subsequently in limited ways, such as displaying an error message.
        /// </summary>
        public IWpfConsole WpfConsole {
            get {
                if (_wpfConsole == null) {
                    _wpfConsole = Factory.WpfConsoleService.CreateConsole(
                        Factory.ServiceProvider, PowerConsoleWindow.ContentType, HostName);
                    _wpfConsole.Host = HostProvider.Value.CreateHost(_wpfConsole, @async: false);
                }
                return _wpfConsole;
            }
        }
    }
}

using System;
using System.Diagnostics;

namespace NuGetConsole.Implementation.PowerConsole {
    /// <summary>
    /// Represents a host with extra info.
    /// </summary>
    class HostInfo : ObjectWithFactory<PowerConsoleWindow> {
        Lazy<IHostProvider, IHostMetadata> HostProvider { get; set; }

        public HostInfo(PowerConsoleWindow factory, Lazy<IHostProvider, IHostMetadata> hostProvider)
            : base(factory) {
            UtilityMethods.ThrowIfArgumentNull(hostProvider);
            this.HostProvider = hostProvider;
        }

        /// <summary>
        /// Get the HostName attribute value of this host.
        /// </summary>
        public string HostName {
            get { return HostProvider.Metadata.HostName; }
        }

        IWpfConsole _wpfConsole;

        /// <summary>
        /// Get/create the console for this host. If not already created, this
        /// actually creates the (console, host) pair.
        ///
        /// Note: Creating the console is handled by this package and mostly will
        /// succeed. However, creating the host could be from other packages and
        /// fail. In that case, this console is already created and can be used
        /// subsequently in limited ways, such as displaying an error message.
        /// </summary>
        public IWpfConsole WpfConsole {
            get {
                if (_wpfConsole == null) {
                    _wpfConsole = Factory.WpfConsoleService.CreateConsole(
                        Factory.ServiceProvider, PowerConsoleWindow.ContentType, HostName);
                    _wpfConsole.Host = HostProvider.Value.CreateHost(_wpfConsole, @async: true);
                }
                return _wpfConsole;
            }
        }
    }
}

Revert accidental change to @async flag.

--HG--
branch : 1.1


// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

#nullable enable

namespace osu.Game.Database
{
    public interface IHasOnlineID
    {
        /// <summary>
        /// The server-side ID representing this instance, if one exists. Any value 0 or less denotes a missing ID.
        /// </summary>
        /// <remarks>
        /// Generally we use -1 when specifying "missing" in code, but values of 0 are also considered missing as the online source
        /// is generally a MySQL autoincrement value, which can never be 0.
        /// </remarks>
        int OnlineID { get; }
    }
}

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

#nullable enable

namespace osu.Game.Database
{
    public interface IHasOnlineID
    {
        /// <summary>
        /// The server-side ID representing this instance, if one exists. Any value 0 or less denotes a missing ID (except in special cases where autoincrement is not used, like rulesets).
        /// </summary>
        /// <remarks>
        /// Generally we use -1 when specifying "missing" in code, but values of 0 are also considered missing as the online source
        /// is generally a MySQL autoincrement value, which can never be 0.
        /// </remarks>
        int OnlineID { get; }
    }
}

Add a note about `OnlineID` potentially being zero in non-autoincrement cases


// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using System;
using System.Globalization;
using Newtonsoft.Json;
using osu.Framework.Extensions;

namespace osu.Game.Online.API
{
    [Serializable]
    internal class OAuthToken
    {
        /// <summary>
        /// OAuth 2.0 access token.
        /// </summary>
        [JsonProperty(@"access_token")]
        public string AccessToken;

        [JsonProperty(@"expires_in")]
        public long ExpiresIn
        {
            get
            {
                return AccessTokenExpiry - DateTime.Now.ToUnixTimestamp();
            }

            set
            {
                AccessTokenExpiry = DateTime.Now.AddSeconds(value).ToUnixTimestamp();
            }
        }

        public bool IsValid => !string.IsNullOrEmpty(AccessToken) && ExpiresIn > 30;

        public long AccessTokenExpiry;

        /// <summary>
        /// OAuth 2.0 refresh token.
        /// </summary>
        [JsonProperty(@"refresh_token")]
        public string RefreshToken;

        public override string ToString() => $@"{AccessToken}/{AccessTokenExpiry.ToString(NumberFormatInfo.InvariantInfo)}/{RefreshToken}";

        public static OAuthToken Parse(string value)
        {
            try
            {
                string[] parts = value.Split('/');
                return new OAuthToken
                {
                    AccessToken = parts[0],
                    AccessTokenExpiry = long.Parse(parts[1], NumberFormatInfo.InvariantInfo),
                    RefreshToken = parts[2]
                };
            }
            catch
            {

            }

            return null;
        }
    }
}

// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using System;
using System.Globalization;
using Newtonsoft.Json;
using osu.Framework.Extensions;

namespace osu.Game.Online.API
{
    [Serializable]
    internal class OAuthToken
    {
        /// <summary>
        /// OAuth 2.0 access token.
        /// </summary>
        [JsonProperty(@"access_token")]
        public string AccessToken;

        [JsonProperty(@"expires_in")]
        public long ExpiresIn
        {
            get
            {
                return AccessTokenExpiry - DateTime.Now.ToUnixTimestamp();
            }

            set
            {
                AccessTokenExpiry = DateTime.Now.AddSeconds(value).ToUnixTimestamp();
            }
        }

        public bool IsValid => !string.IsNullOrEmpty(AccessToken) && ExpiresIn > 30;

        public long AccessTokenExpiry;

        /// <summary>
        /// OAuth 2.0 refresh token.
        /// </summary>
        [JsonProperty(@"refresh_token")]
        public string RefreshToken;

        public override string ToString() => $@"{AccessToken}|{AccessTokenExpiry.ToString(NumberFormatInfo.InvariantInfo)}|{RefreshToken}";

        public static OAuthToken Parse(string value)
        {
            try
            {
                string[] parts = value.Split('|');
                return new OAuthToken
                {
                    AccessToken = parts[0],
                    AccessTokenExpiry = long.Parse(parts[1], NumberFormatInfo.InvariantInfo),
                    RefreshToken = parts[2]
                };
            }
            catch
            {

            }

            return null;
        }
    }
}

Fix refresh tokens not working correctly

Turns out there's plenty of slashes in refresh tokens.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NProcessPipe.DependencyAnalysis
{
    public class Node<T>
    {
        public Node(T data)
        {
            //Index = -1;
            Data = data;
        }

        public T Data { get; private set; }

        public bool Equals(Node<T> other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return Equals(other.Data, Data);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != typeof(Node<T>)) return false;
            return Equals((Node<T>)obj);
        }

        public override int GetHashCode()
        {
            return (Data != null ? Data.GetHashCode() : 0);
        }

        public override string ToString()
        {
            return Data.ToString();
        }

        //public void SetIndex(int index)
        //{
        //    Index = index;
        //}

        //public void SetLowLink(int lowlink)
        //{
        //    LowLink = lowlink;
        //}

        //public int Index { get; private set; }
        //public int LowLink { get; private set; }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace NProcessPipe.DependencyAnalysis
{
    public class Node<T>
    {
        public Node(T data)
        {
            Data = data;
        }

        public T Data { get; private set; }

        public bool Equals(Node<T> other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return Equals(other.Data, Data);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != typeof(Node<T>)) return false;
            return Equals((Node<T>)obj);
        }

        public override int GetHashCode()
        {
            return (Data != null ? Data.GetHashCode() : 0);
        }

        public override string ToString()
        {
            return Data.ToString();
        }
    }
}

Clean up dependency node class

Clean up dependency node class


// --------------------------------------------------------------------------------------------------------------------
// <copyright file="CourseExerciseFiles.cs" company="CodeBlueDev">
//   All rights reserved.
// </copyright>
// <summary>
//   Represents a PluralSight Course's exercise files information.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace CodeBlueDev.PluralSight.Core.Models
{
    using System;
    using System.Runtime.Serialization;

    /// <summary>
    /// Represents a PluralSight Course's exercise files information.
    /// </summary>
    /// <example>
    /// {
    ///  "exerciseFilesUrl": "http://s.pluralsight.com/course-materials/windows-forms-best-practices/866AB96258/20140926213054/windows-forms-best-practices.zip?userHandle=aaf74aa9-49b7-415b-ba2d-bdc49b285671"
    /// }
    /// </example>
    [DataContract]
    [Serializable]
    public class CourseExerciseFiles
    {
        /// <summary>
        /// Gets or sets the Exercise Files Url for a PluralSight Course.
        /// </summary>
        [DataMember(Name = "exerciseFilesUrl")]
        public string ExerciseFilesUrl { get; set; }
    }
}

// --------------------------------------------------------------------------------------------------------------------
// <copyright file="CourseExerciseFiles.cs" company="CodeBlueDev">
//   All rights reserved.
// </copyright>
// <summary>
//   Represents a PluralSight Course's exercise files information.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace CodeBlueDev.PluralSight.Core.Models
{
    using System;
    using System.Runtime.Serialization;

    /// <summary>
    /// Represents a PluralSight Course's exercise files information.
    /// </summary>
    /// <example>
    /// {
    ///  "exerciseFilesUrl": "http://s.pluralsight.com/course-materials/windows-forms-best-practices/866AB96258/20140926213054/windows-forms-best-practices.zip?userHandle=03b9fd64-819c-4def-a610-52457b0479ec"
    /// }
    /// </example>
    [DataContract]
    [Serializable]
    public class CourseExerciseFiles
    {
        /// <summary>
        /// Gets or sets the Exercise Files Url for a PluralSight Course.
        /// </summary>
        [DataMember(Name = "exerciseFilesUrl")]
        public string ExerciseFilesUrl { get; set; }
    }
}

Update userHandle to be consistent in all examples instead of random


using System.Collections.Generic;
using System.IO;
using System.Management.Automation.Language;

namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.Extensions
{
    // TODO Add documentation
    public static class Extensions
    {
        public static IEnumerable<string> GetLines(this string text)
        {
            var lines = new List<string>();
            using (var stringReader = new StringReader(text))
            {
                string line;
                line = stringReader.ReadLine();
                while (line != null)
                {
                    yield return line;
                    line = stringReader.ReadLine();
                }
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Management.Automation.Language;

namespace Microsoft.Windows.PowerShell.ScriptAnalyzer.Extensions
{
    // TODO Add documentation
    public static class Extensions
    {
        public static IEnumerable<string> GetLines(this string text)
        {
            var lines = new List<string>();
            using (var stringReader = new StringReader(text))
            {
                string line;
                line = stringReader.ReadLine();
                while (line != null)
                {
                    yield return line;
                    line = stringReader.ReadLine();
                }
            }
        }

        public static IScriptExtent Translate(this IScriptExtent extent, int lineDelta, int columnDelta)
        {
            var newStartLineNumber = extent.StartLineNumber + lineDelta;
            if (newStartLineNumber < 1)
            {
                throw new ArgumentException(
                    "Invalid line delta. Resulting start line number must be greather than 1.");
            }

            var newStartColumnNumber = extent.StartColumnNumber + columnDelta;
            var newEndColumnNumber = extent.EndColumnNumber + columnDelta;
            if (newStartColumnNumber < 1 || newEndColumnNumber < 1)
            {
                throw new ArgumentException(@"Invalid column delta.
Resulting start column and end column number must be greather than 1.");
            }

            return new ScriptExtent(
                new ScriptPosition(
                    extent.File,
                    newStartLineNumber,
                    newStartColumnNumber,
                    extent.StartScriptPosition.Line),
                new ScriptPosition(
                    extent.File,
                    extent.EndLineNumber + lineDelta,
                    newEndColumnNumber,
                    extent.EndScriptPosition.Line));
        }
    }
}

Add extension method to translate text coordinates


// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Net.Sockets.Tests;
using System.Net.Test.Common;

using Xunit;
using Xunit.Abstractions;

namespace System.Net.Sockets.Performance.Tests
{
    [Trait("Perf", "true")]
    public class SocketPerformanceAsyncTests
    {
        private readonly ITestOutputHelper _log;
        private readonly int _iterations = 1;

        public SocketPerformanceAsyncTests(ITestOutputHelper output)
        {
            _log = TestLogging.GetInstance();

            string env = Environment.GetEnvironmentVariable("SOCKETSTRESS_ITERATIONS");
            if (env != null)
            {
                _iterations = int.Parse(env);
            }
        }

        [ActiveIssue(13349, TestPlatforms.OSX)]
        [OuterLoop]
        [Fact]
        public void SocketPerformance_MultipleSocketClientAsync_LocalHostServerAsync()
        {
            SocketImplementationType serverType = SocketImplementationType.Async;
            SocketImplementationType clientType = SocketImplementationType.Async;
            int iterations = 200 * _iterations;
            int bufferSize = 256;
            int socket_instances = 200;

            var test = new SocketPerformanceTests(_log);

            // Run in Stress mode no expected time to complete.
            test.ClientServerTest(
                serverType,
                clientType,
                iterations,
                bufferSize,
                socket_instances);
        }
    }
}

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Net.Sockets.Tests;
using System.Net.Test.Common;

using Xunit;
using Xunit.Abstractions;

namespace System.Net.Sockets.Performance.Tests
{
    [Trait("Perf", "true")]
    public class SocketPerformanceAsyncTests
    {
        private readonly ITestOutputHelper _log;
        private readonly int _iterations = 1;

        public SocketPerformanceAsyncTests(ITestOutputHelper output)
        {
            _log = TestLogging.GetInstance();

            string env = Environment.GetEnvironmentVariable("SOCKETSTRESS_ITERATIONS");
            if (env != null)
            {
                _iterations = int.Parse(env);
            }
        }

        [ActiveIssue(13349, TestPlatforms.OSX)]
        [OuterLoop]
        [Fact]
        public void SocketPerformance_MultipleSocketClientAsync_LocalHostServerAsync()
        {
            SocketImplementationType serverType = SocketImplementationType.Async;
            SocketImplementationType clientType = SocketImplementationType.Async;
            int iterations = 200 * _iterations;
            int bufferSize = 256;
            int socket_instances = 20;

            var test = new SocketPerformanceTests(_log);

            // Run in Stress mode no expected time to complete.
            test.ClientServerTest(
                serverType,
                clientType,
                iterations,
                bufferSize,
                socket_instances);
        }
    }
}

Decrease number of socket instances in SocketPerformance_MultipleSocketClientAsync_LocalHostServerAsync

Larger number causes listen queue to be exceeded, resulting in client failures due to connection being rejected by server.


using System;

namespace ClosedXML.Excel
{
    internal class XLWorksheetInternals : IDisposable
    {
        public XLWorksheetInternals(
            XLCellsCollection cellsCollection,
            XLColumnsCollection columnsCollection,
            XLRowsCollection rowsCollection,
            XLRanges mergedRanges
            )
        {
            CellsCollection = cellsCollection;
            ColumnsCollection = columnsCollection;
            RowsCollection = rowsCollection;
            MergedRanges = mergedRanges;
        }

        public XLCellsCollection CellsCollection { get; private set; }
        public XLColumnsCollection ColumnsCollection { get; private set; }
        public XLRowsCollection RowsCollection { get; private set; }
        public XLRanges MergedRanges { get; internal set; }

        public void Dispose()
        {
            ColumnsCollection.Clear();
            RowsCollection.Clear();
            MergedRanges.RemoveAll();
        }
    }
}

using System;

namespace ClosedXML.Excel
{
    internal class XLWorksheetInternals : IDisposable
    {
        public XLWorksheetInternals(
            XLCellsCollection cellsCollection,
            XLColumnsCollection columnsCollection,
            XLRowsCollection rowsCollection,
            XLRanges mergedRanges
            )
        {
            CellsCollection = cellsCollection;
            ColumnsCollection = columnsCollection;
            RowsCollection = rowsCollection;
            MergedRanges = mergedRanges;
        }

        public XLCellsCollection CellsCollection { get; private set; }
        public XLColumnsCollection ColumnsCollection { get; private set; }
        public XLRowsCollection RowsCollection { get; private set; }
        public XLRanges MergedRanges { get; internal set; }

        public void Dispose()
        {
            CellsCollection.Clear();
            ColumnsCollection.Clear();
            RowsCollection.Clear();
            MergedRanges.RemoveAll();
        }
    }
}

Clear CellsCollection on WorksheetInternals disposal to make it easier to GC to collect unused references


---
Title: HTML
Description: Report format to create reports in any text based format (HTML, Markdown, ...).
---

@Html.Raw(Model.String(DocsKeys.Description))

    Support for creating reports in any text based format like HTML or Markdown is implemented in the
    Cake.Issues.Reporting.Generic addin.

@Html.Partial("_ChildPages")

---
Title: Generic
Description: Report format to create reports in any text based format (HTML, Markdown, ...).
---

@Html.Raw(Model.String(DocsKeys.Description))

    Support for creating reports in any text based format like HTML or Markdown is implemented in the
    Cake.Issues.Reporting.Generic addin.

@Html.Partial("_ChildPages")

Fix title for generic report format

Fix title for generic report format


// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

namespace osu.Game.Rulesets.Mania.Objects.Drawables
{
    /// <summary>
    /// The head of a <see cref="DrawableHoldNote"/>.
    /// </summary>
    public class DrawableHoldNoteHead : DrawableNote
    {
        protected override ManiaSkinComponents Component => ManiaSkinComponents.HoldNoteHead;

        public DrawableHoldNoteHead(DrawableHoldNote holdNote)
            : base(holdNote.HitObject.Head)
        {
        }

        public void UpdateResult() => base.UpdateResult(true);

        protected override void UpdateInitialTransforms()
        {
            base.UpdateInitialTransforms();

            // This hitobject should never expire, so this is just a safe maximum.
            LifetimeEnd = LifetimeStart + 30000;
        }

        public override bool OnPressed(ManiaAction action) => false; // Handled by the hold note

        public override void OnReleased(ManiaAction action)
        {
        }
    }
}

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Game.Rulesets.Objects.Drawables;

namespace osu.Game.Rulesets.Mania.Objects.Drawables
{
    /// <summary>
    /// The head of a <see cref="DrawableHoldNote"/>.
    /// </summary>
    public class DrawableHoldNoteHead : DrawableNote
    {
        protected override ManiaSkinComponents Component => ManiaSkinComponents.HoldNoteHead;

        public DrawableHoldNoteHead(DrawableHoldNote holdNote)
            : base(holdNote.HitObject.Head)
        {
        }

        public void UpdateResult() => base.UpdateResult(true);

        protected override void UpdateInitialTransforms()
        {
            base.UpdateInitialTransforms();

            // This hitobject should never expire, so this is just a safe maximum.
            LifetimeEnd = LifetimeStart + 30000;
        }

        protected override void UpdateHitStateTransforms(ArmedState state)
        {
            // suppress the base call explicitly.
            // the hold note head should never change its visual state on its own due to the "freezing" mechanic
            // (when hit, it remains visible in place at the judgement line; when dropped, it will scroll past the line).
            // it will be hidden along with its parenting hold note when required.
        }

        public override bool OnPressed(ManiaAction action) => false; // Handled by the hold note

        public override void OnReleased(ManiaAction action)
        {
        }
    }
}

Fix mania hold note heads hiding when frozen

This was an insidious regression from a3dc1d5. Prior to that commit,
`DrawableHoldNoteHead` had `UpdateStateTransforms()` overridden, to set
the hold note head's lifetime. When that method was split into
`UpdateInitialStateTransforms()` and `UpdateHitStateTransforms()`, the
lifetime set was moved to the former.

Unfortunately, that override served two purposes: both to set the
lifetime, and to suppress hit animations which would normally be added
by the base `DrawableManiaHitObject`. That fact being missed led to
`UpdateHitStateTransforms()` hiding the hold note head immediately on
hit and with a slight delay on miss.

To resolve, explicitly override `UpdateHitStateTransforms()` and
suppress the base call, with an explanatory comment.


using System.IO;
using Htc.Vita.Core.Runtime;

namespace Htc.Vita.Core.Util
{
    public static partial class Extract
    {
        public static bool FromFileToIcon(FileInfo fromFile, FileInfo toIcon)
        {
            if (!Platform.IsWindows)
            {
                return false;
            }
            return Windows.FromFileToIconInPlatform(fromFile, toIcon);
        }
    }
}

using System;
using System.IO;
using System.IO.Compression;
using System.Reflection;
using Htc.Vita.Core.Log;
using Htc.Vita.Core.Runtime;

namespace Htc.Vita.Core.Util
{
    public static partial class Extract
    {
        public static bool FromFileToIcon(
                FileInfo fromFile,
                FileInfo toIcon)
        {
            if (!Platform.IsWindows)
            {
                return false;
            }
            return Windows.FromFileToIconInPlatform(fromFile, toIcon);
        }

        public static bool FromAssemblyToFileByResourceName(
                string byResourceName,
                FileInfo toFile,
                CompressionType compressionType)
        {
            if (string.IsNullOrWhiteSpace(byResourceName))
            {
                return false;
            }

            if (toFile == null)
            {
                return false;
            }

            try
            {
                var binaryDirectory = toFile.Directory;
                if (binaryDirectory != null && !binaryDirectory.Exists)
                {
                    binaryDirectory.Create();
                }

                var assembly = Assembly.GetCallingAssembly();
                var doesResourceExist = false;
                foreach (var name in assembly.GetManifestResourceNames())
                {
                    if (byResourceName.Equals(name))
                    {
                        doesResourceExist = true;
                    }
                }

                if (!doesResourceExist)
                {
                    return false;
                }

                using (var stream = assembly.GetManifestResourceStream(byResourceName))
                {
                    if (stream == null)
                    {
                        return false;
                    }

                    if (compressionType == CompressionType.Gzip)
                    {
                        using (var gZipStream = new GZipStream(stream, CompressionMode.Decompress))
                        {
                            using (var fileStream = toFile.OpenWrite())
                            {
                                gZipStream.CopyTo(fileStream);
                            }
                        }
                    }
                    else
                    {
                        using (var fileStream = toFile.OpenWrite())
                        {
                            stream.CopyTo(fileStream);
                        }
                    }
                }

                return true;
            }
            catch (Exception e)
            {
                Logger.GetInstance(typeof(Extract)).Error("Can not extract resource \"" + byResourceName + "\" to \"" + toFile + "\": " + e.Message);
            }

            return false;
        }

        public enum CompressionType
        {
            None,
            Gzip
        }
    }
}

Add API to extract resource from assembly


using Rg.Plugins.Popup.Pages;
using Rg.Plugins.Popup.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Forms;
using Xamarin.Forms.Xaml;
using XamMusic.Interfaces;
using XamMusic.ViewModels;

namespace XamMusic.Controls
{
    [XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class CreatePlaylistPopup : PopupPage
    {
        public CreatePlaylistPopup()
        {
            InitializeComponent();
        }

        private async void CreatePlaylist(object sender, EventArgs e)
        {
            if (String.IsNullOrWhiteSpace(PlaylistNameEntry.Text))
            {
                DependencyService.Get<IPlaylistManager>().CreatePlaylist("Untitled Playlist");
            }
            else
            {
                DependencyService.Get<IPlaylistManager>().CreatePlaylist(PlaylistNameEntry.Text);
            }
            MenuViewModel.Instance.Refresh();
            await Navigation.PopAllPopupAsync(true);
        }
    }
}

using Rg.Plugins.Popup.Pages;
using Rg.Plugins.Popup.Extensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Forms;
using Xamarin.Forms.Xaml;
using XamMusic.Interfaces;
using XamMusic.ViewModels;

namespace XamMusic.Controls
{
    [XamlCompilation(XamlCompilationOptions.Compile)]
    public partial class CreatePlaylistPopup : PopupPage
    {
        public CreatePlaylistPopup()
        {
            InitializeComponent();
        }

        private async void CreatePlaylist(object sender, EventArgs e)
        {
            string title;
            if (String.IsNullOrWhiteSpace(PlaylistNameEntry.Text))
            {
                title = "Untitled Playlist";
            }
            else
            {
                title = PlaylistNameEntry.Text;
            }

            if (MenuViewModel.Instance.PlaylistItems.Where(r => r.Playlist?.Title == title).Count() > 0)
            {
                int i = 1;
                while (MenuViewModel.Instance.PlaylistItems.Where(q => q.Playlist?.Title == $"{title}{i}").Count() > 0)
                {
                    i++;
                }
                title = $"{title}{i}";
            }

            DependencyService.Get<IPlaylistManager>().CreatePlaylist(title);
            MenuViewModel.Instance.Refresh();
            await Navigation.PopAllPopupAsync(true);
        }
    }
}

Append numbers to created playlist names if taken