using Microsoft.Owin.Hosting;
using System;
using System.Net.Http;
using System.Net.WebSockets;
using System.Text;
using System.Threading;
using Owin.WebSocket;
using Owin.WebSocket.Extensions;
using System.Threading.Tasks;

namespace Containerizer
{
    public class Program
    {
        static void Main(string[] args)
        {
            // Start OWIN host
            try
            {
                using (WebApp.Start<Startup>("http://*:" + args[0] + "/"))
                {
                    Console.WriteLine("SUCCESS: started");

                    // Create HttpCient and make a request to api/values
                    HttpClient client = new HttpClient();

                    var response = client.GetAsync("http://localhost:" + args[0] + "/api/ping").Result;

                    Console.WriteLine(response);
                    Console.WriteLine(response.Content.ReadAsStringAsync().Result);

                    Console.WriteLine("Hit a key");
                    Console.ReadLine();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("ERRROR: " + ex.Message);
            }
        }
    }
}

using Microsoft.Owin.Hosting;
using System;
using System.Net.Http;
using System.Net.WebSockets;
using System.Text;
using System.Threading;
using Owin.WebSocket;
using Owin.WebSocket.Extensions;
using System.Threading.Tasks;

namespace Containerizer
{
    public class Program
    {
        static void Main(string[] args)
        {
            var port = (args.Length == 1 ? args[0] : "80");

            // Start OWIN host
            try
            {
                using (WebApp.Start<Startup>("http://*:" + port + "/"))
                {
                    Console.WriteLine("SUCCESS: started");

                    // Create HttpCient and make a request to api/values
                    HttpClient client = new HttpClient();

                    var response = client.GetAsync("http://localhost:" + port + "/api/ping").Result;

                    Console.WriteLine(response);
                    Console.WriteLine(response.Content.ReadAsStringAsync().Result);

                    Console.WriteLine("Hit a key");
                    Console.ReadLine();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("ERRROR: " + ex.Message);
            }
        }
    }
}

Use port 80 by default for containerizer


/*Problem 1. Exchange If Greater

    Write an if-statement that takes two double variables a and b and exchanges their values if the first one
    is greater than the second one. As a result print the values a and b, separated by a space.

Examples:
a 	    b 	    result
5 	    2 	    2 5
3 	    4 	    3 4
5.5 	4.5 	4.5 5.5
*/

using System;
using System.Globalization;
using System.Threading;

class ExchangeIfGreater
{
    static void Main()
    {
        Console.Title = "Exchange If Greater"; //Changing the title of the console.
        Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US"); //Setting the culture to en-US
        Console.WriteLine("Please, enter two numbers 'a' and 'b'!");
        Console.Write("a: ");
        double a = double.Parse(Console.ReadLine());
        Console.Write("b: ");
        double b = double.Parse(Console.ReadLine());

        if (a > b)
        {
            double temp = a;
            a = b;
            b = temp;
        }

        Console.WriteLine("\nresult\n{0} {1}", a, b);

        Console.ReadKey(); // Keeping the console opened.
    }
}

/*Problem 1. Exchange If Greater

    Write an if-statement that takes two double variables a and b and exchanges their values if the first one
    is greater than the second one. As a result print the values a and b, separated by a space.

Examples:
a 	    b 	    result
5 	    2 	    2 5
3 	    4 	    3 4
5.5 	4.5 	4.5 5.5
*/

using System;
using System.Globalization;
using System.Threading;

class ExchangeIfGreater
{
    static void Main()
    {
        Console.Title = "Exchange If Greater"; //Changing the title of the console.
        Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US"); //Setting the culture to en-US

        Console.WriteLine("Please, enter two numbers 'a' and 'b'!");
        Console.Write("a: ");
        double a = double.Parse(Console.ReadLine());
        Console.Write("b: ");
        double b = double.Parse(Console.ReadLine());

        if (a > b)
        {
            double temp = a;
            a = b;
            b = temp;
        }

        Console.WriteLine("\r\nresult\r\n{0} {1}", a, b);

        Console.ReadKey(); // Keeping the console opened.
    }
}

Update to Problem 1. Exchange If Greater


@using Humanizer
@model FilesOverviewModel

@{
    ViewBag.Title = "Uploaded file overview";
}

@ViewBag.Title

@{
    var sortedFiles = Model.Files.OrderBy(x => x.Metadata.OriginalFileName);
}

        ID
        File name
        Uploaded on
        Expires

    @foreach (var file in sortedFiles) {

            @file.Id
            @file.Metadata.OriginalFileName

                @file.Metadata.UploadedOn.Humanize()

                @file.Metadata.Expiration.Humanize()

    }

Allow downloading files from administrative mode


using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;

namespace MicroMVVM
{
    public static class ViewLocator
    {
        public static UIElement LocateForModel(object model)
        {
            var viewName = model.GetType().FullName;
            var modelName = Regex.Replace(viewName, @"ViewModel", "View");
            var modelType = Assembly.GetEntryAssembly().GetType(modelName);
            if (modelType == null)
                throw new Exception(String.Format("Unable to find a View with type {0}", modelName));

            var instance = Activator.CreateInstance(modelType);
            if (!(instance is UIElement))
                throw new Exception(String.Format("Managed to create a {0}, but it wasn't a UIElement", modelName));

            return (UIElement)instance;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;

namespace MicroMVVM
{
    public static class ViewLocator
    {
        public static UIElement LocateForModel(object model)
        {
            var modelName = model.GetType().FullName;
            var viewName = Regex.Replace(modelName, @"ViewModel", "View");
            var viewType = Assembly.GetEntryAssembly().GetType(modelName);
            if (viewType == null)
                throw new Exception(String.Format("Unable to find a View with type {0}", viewName));

            var instance = Activator.CreateInstance(viewType);
            if (!(instance is UIElement))
                throw new Exception(String.Format("Managed to create a {0}, but it wasn't a UIElement", viewName));

            var initializer = viewType.GetMethod("InitializeComponent", BindingFlags.Public | BindingFlags.Instance);
            if (initializer != null)
                initializer.Invoke(instance, null);

            return (UIElement)instance;
        }
    }
}

Call InitializeComponent, if no code-behind


// 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.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Configuration;
using osu.Game.Localisation;
using osu.Framework.Graphics.Containers;

namespace osu.Game.Overlays.Settings.Sections.Gameplay
{
    public class AudioSettings : SettingsSubsection
    {
        protected override LocalisableString Header => GameplaySettingsStrings.AudioHeader;

        private Bindable<float> positionalHitsoundsLevel;

        private FillFlowContainer<SettingsSlider<float>> positionalHitsoundsSettings;

        [BackgroundDependencyLoader]
        private void load(OsuConfigManager config, OsuConfigManager osuConfig)
        {
            positionalHitsoundsLevel = osuConfig.GetBindable<float>(OsuSetting.PositionalHitsoundsLevel);
            Children = new Drawable[]
            {
                positionalHitsoundsSettings = new FillFlowContainer<SettingsSlider<float>>
                {
                    Direction = FillDirection.Vertical,
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes = Axes.Y,
                    Masking = true,
                    Children = new[]
                    {
                        new SettingsSlider<float>
                        {
                            LabelText = AudioSettingsStrings.PositionalLevel,
                            Current = positionalHitsoundsLevel,
                            KeyboardStep = 0.01f,
                            DisplayAsPercentage = true
                        }
                    }
                },
                new SettingsCheckbox
                {
                    LabelText = GameplaySettingsStrings.AlwaysPlayFirstComboBreak,
                    Current = config.GetBindable<bool>(OsuSetting.AlwaysPlayFirstComboBreak)
                }
            };
        }
    }
}

// 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.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Localisation;
using osu.Game.Configuration;
using osu.Game.Localisation;

namespace osu.Game.Overlays.Settings.Sections.Gameplay
{
    public class AudioSettings : SettingsSubsection
    {
        protected override LocalisableString Header => GameplaySettingsStrings.AudioHeader;

        [BackgroundDependencyLoader]
        private void load(OsuConfigManager config, OsuConfigManager osuConfig)
        {
            Children = new Drawable[]
            {
                new SettingsSlider<float>
                {
                    LabelText = AudioSettingsStrings.PositionalLevel,
                    Keywords = new[] { @"positional", @"balance" },
                    Current = osuConfig.GetBindable<float>(OsuSetting.PositionalHitsoundsLevel),
                    KeyboardStep = 0.01f,
                    DisplayAsPercentage = true
                },
                new SettingsCheckbox
                {
                    LabelText = GameplaySettingsStrings.AlwaysPlayFirstComboBreak,
                    Current = config.GetBindable<bool>(OsuSetting.AlwaysPlayFirstComboBreak)
                }
            };
        }
    }
}

Remove unnecessary code and fix double nesting causing filtering to not work


using UnityEditor;
using UnityEngine;

namespace SpaceTrader.Util.EditorUtil {
    public static class AspectRatioLayoutSwitcherEditor {
        [MenuItem("SpaceTrader/Refresh All Layout Switchers")]
        private static void RefreshAllSwitchersInScene() {
            var switchers = Object.FindObjectsOfType<AspectRatioLayoutSwitcher>();
            foreach (var switcher in switchers) {
                if (switcher.isActiveAndEnabled) {
                    switcher.SendMessage("OnRectTransformDimensionsChange");

                    Debug.Log($"refreshed layout of {switcher.name}", switcher);
                }
            }
        }
    }
}

using UnityEditor;
using UnityEngine;

namespace SpaceTrader.Util.EditorUtil {
    public static class AspectRatioLayoutSwitcherEditor {
        [MenuItem("Tools/SpaceTrader/Refresh All Layout Switchers")]
        private static void RefreshAllSwitchersInScene() {
            var switchers = Object.FindObjectsOfType<AspectRatioLayoutSwitcher>();
            foreach (var switcher in switchers) {
                if (switcher.isActiveAndEnabled) {
                    switcher.SendMessage("OnRectTransformDimensionsChange");

                    Debug.Log($"refreshed layout of {switcher.name}", switcher);
                }
            }
        }
    }
}

Fix layout switcher tool menu path

Fix layout switcher tool menu path


using System;
using System.Data;
using System.Text;

using NHibernate.Engine;
using NExpression = NHibernate.Expression;
using NHibernate.SqlCommand;
using NHibernate.Type;

using NHibernate.DomainModel;
using NUnit.Framework;

namespace NHibernate.Test.ExpressionTest
{
	/// <summary>
	/// Summary description for InsensitiveLikeExpressionFixture.
	/// </summary>
	[TestFixture]
	public class InsensitiveLikeExpressionFixture : BaseExpressionFixture
	{
		[Test]
		public void InsentitiveLikeSqlStringTest()
		{

			ISession session = factory.OpenSession();

			NExpression.Expression expression = NExpression.Expression.InsensitiveLike("Address", "12 Adress");

			SqlString sqlString = expression.ToSqlString(factoryImpl, typeof(Simple), "simple_alias");

			string expectedSql = "lower(simple_alias.address) like :simple_alias.address";
			Parameter[] expectedParams = new Parameter[1];

			Parameter firstParam = new Parameter( "address", "simple_alias", new SqlTypes.StringSqlType() );
			expectedParams[0] = firstParam;

			CompareSqlStrings(sqlString, expectedSql, expectedParams);

			session.Close();
		}

	}
}

using System;
using System.Data;
using System.Text;

using NHibernate.Engine;
using NExpression = NHibernate.Expression;
using NHibernate.SqlCommand;
using NHibernate.Type;

using NHibernate.DomainModel;
using NUnit.Framework;

namespace NHibernate.Test.ExpressionTest
{
	/// <summary>
	/// Summary description for InsensitiveLikeExpressionFixture.
	/// </summary>
	[TestFixture]
	public class InsensitiveLikeExpressionFixture : BaseExpressionFixture
	{
		[Test]
		public void InsentitiveLikeSqlStringTest()
		{

			ISession session = factory.OpenSession();

			NExpression.Expression expression = NExpression.Expression.InsensitiveLike("Address", "12 Adress");

			SqlString sqlString = expression.ToSqlString(factoryImpl, typeof(Simple), "simple_alias");

			string expectedSql = "lower(simple_alias.address) like :simple_alias.address";
			if ((factory as ISessionFactoryImplementor).Dialect is Dialect.PostgreSQLDialect)
			{
				expectedSql = "simple_alias.address ilike :simple_alias.address";
			}
			Parameter[] expectedParams = new Parameter[1];

			Parameter firstParam = new Parameter( "address", "simple_alias", new SqlTypes.StringSqlType() );
			expectedParams[0] = firstParam;

			CompareSqlStrings(sqlString, expectedSql, expectedParams);

			session.Close();
		}

	}
}

Make the test pass for PostgreSQL, using a bit of a hack

SVN: 488784591515bd4cdaa016be4ec9b172dc4e7caf@1282


using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;

namespace DummyConsoleApp
{
    public class Program
    {
        static void Main(string[] args)
        {
            var exitCodeToReturn = int.Parse(args[0]);
            var millisecondsToSleep = int.Parse(args[1]);
            var linesOfStandardOutput = int.Parse(args[2]);
            var linesOfStandardError = int.Parse(args[3]);

            Thread.Sleep(millisecondsToSleep);

            for (var i = 0; i < linesOfStandardOutput; i++)
                Console.WriteLine("Standard output line #{0}", i + 1);

            for (var i = 0; i < linesOfStandardError; i++)
                Console.Error.WriteLine("Standard error line #{0}", i + 1);

            Environment.Exit(exitCodeToReturn);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;

namespace DummyConsoleApp
{
    public class Program
    {
        static void Main(string[] args)
        {
            int exitCodeToReturn = int.Parse(args[0]);
            int millisecondsToSleep = int.Parse(args[1]);
            int linesOfStandardOutput = int.Parse(args[2]);
            int linesOfStandardError = int.Parse(args[3]);

            Thread.Sleep(millisecondsToSleep);

            for (int i = 0; i < linesOfStandardOutput; i++)
            {
                Console.WriteLine("Standard output line #{0}", i + 1);
            }

            for (int i = 0; i < linesOfStandardError; i++)
            {
                Console.Error.WriteLine("Standard error line #{0}", i + 1);
            }

            Environment.Exit(exitCodeToReturn);
        }
    }
}

Reduce diff size: undo autoformat.

Reduce diff size: undo autoformat.


using System;
using Glimpse.Agent.Web.Options;
using Microsoft.Framework.OptionsModel;

namespace Glimpse.Agent.Web
{
    public class GlimpseAgentWebOptionsSetup : ConfigureOptions<GlimpseAgentWebOptions>
    {
        public GlimpseAgentWebOptionsSetup() : base(ConfigureGlimpseAgentWebOptions)
        {
            Order = -1000;
        }

        public static void ConfigureGlimpseAgentWebOptions(GlimpseAgentWebOptions options)
        {
            // Set up IgnoredUris
            options.IgnoredUris.Add("^/__browserLink/requestData");
            options.IgnoredUris.Add("^/Glimpse");
            options.IgnoredUris.Add("^/favicon.ico");
        }
    }
}

using System;
using Glimpse.Agent.Web.Options;
using Microsoft.Framework.OptionsModel;

namespace Glimpse.Agent.Web
{
    public class GlimpseAgentWebOptionsSetup : ConfigureOptions<GlimpseAgentWebOptions>
    {
        public GlimpseAgentWebOptionsSetup() : base(ConfigureGlimpseAgentWebOptions)
        {
            Order = -1000;
        }

        public static void ConfigureGlimpseAgentWebOptions(GlimpseAgentWebOptions options)
        {
            // Set up IgnoredUris
            options.IgnoredUris.AddUri("^/__browserLink/requestData");
            options.IgnoredUris.AddUri("^/Glimpse");
            options.IgnoredUris.AddUri("^/favicon.ico");
        }
    }
}

Switch over to using Regex extension

Switch over to using Regex extension


using System;
using System.Data;
using System.Text;

using NHibernate.Engine;
using NExpression = NHibernate.Expression;
using NHibernate.SqlCommand;
using NHibernate.Type;

using NHibernate.DomainModel;
using NUnit.Framework;

namespace NHibernate.Test.ExpressionTest
{
	/// <summary>
	/// Summary description for NotExpressionFixture.
	/// </summary>
	[TestFixture]
	public class NotExpressionFixture : BaseExpressionFixture
	{
		[Test]
		public void NotSqlStringTest()
		{
			ISession session = factory.OpenSession();

			NExpression.ICriterion notExpression = NExpression.Expression.Not(NExpression.Expression.Eq("Address", "12 Adress"));

			SqlString sqlString = notExpression.ToSqlString(factoryImpl, typeof(Simple), "simple_alias", BaseExpressionFixture.EmptyAliasClasses );

			string expectedSql = dialect is Dialect.MySQLDialect ?
				"not(simple_alias.address = :simple_alias.address)" :
				"not simple_alias.address = :simple_alias.address";

			Parameter firstParam = new Parameter( "address", "simple_alias", new SqlTypes.StringSqlType() );
			CompareSqlStrings(sqlString, expectedSql, new Parameter[] {firstParam});

			session.Close();
		}

	}
}

using System;
using System.Data;
using System.Text;

using NHibernate.Engine;
using NExpression = NHibernate.Expression;
using NHibernate.SqlCommand;
using NHibernate.Type;

using NHibernate.DomainModel;
using NUnit.Framework;

namespace NHibernate.Test.ExpressionTest
{
	/// <summary>
	/// Summary description for NotExpressionFixture.
	/// </summary>
	[TestFixture]
	public class NotExpressionFixture : BaseExpressionFixture
	{
		[Test]
		public void NotSqlStringTest()
		{
			ISession session = factory.OpenSession();

			NExpression.ICriterion notExpression = NExpression.Expression.Not(NExpression.Expression.Eq("Address", "12 Adress"));

			SqlString sqlString = notExpression.ToSqlString(factoryImpl, typeof(Simple), "simple_alias", BaseExpressionFixture.EmptyAliasClasses );

			string expectedSql = dialect is Dialect.MySQLDialect ?
				"not (simple_alias.address = :simple_alias.address)" :
				"not simple_alias.address = :simple_alias.address";

			Parameter firstParam = new Parameter( "address", "simple_alias", new SqlTypes.StringSqlType() );
			CompareSqlStrings(sqlString, expectedSql, new Parameter[] {firstParam});

			session.Close();
		}

	}
}

Fix the test on MySQL, should work now

Fix the test on MySQL, should work now

SVN: 488784591515bd4cdaa016be4ec9b172dc4e7caf@1689


using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;

namespace Firehose.Web.Authors
{
    public class ThomasRayner : IAmAMicrosoftMVP
    {
        public string FirstName => "Thomas";
        public string LastName => "Rayner";
        public string ShortBioOrTagLine => "Senior Security Systems Engineer @ Microsoft";
        public string StateOrRegion => "Canada";
        public string EmailAddress => "thmsrynr@outlook.com";
        public string TwitterHandle => "MrThomasRayner";
        public string GitHubHandle => "ThmsRynr";
        public string GravatarHash => "";
        public GeoPosition Position => new GeoPosition(53.5443890, -113.4909270);

        public Uri WebSite => new Uri("https://thomasrayner.ca");
        public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://thomasrayner.ca/feed"); } }
    }

}

using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;

namespace Firehose.Web.Authors
{
    public class ThomasRayner : IWorkAtMicrosoft
    {
        public string FirstName => "Thomas";
        public string LastName => "Rayner";
        public string ShortBioOrTagLine => "Senior Security Systems Engineer @ Microsoft";
        public string StateOrRegion => "Canada";
        public string EmailAddress => "thmsrynr@outlook.com";
        public string TwitterHandle => "MrThomasRayner";
        public string GitHubHandle => "ThmsRynr";
        public string GravatarHash => "";
        public GeoPosition Position => new GeoPosition(53.5443890, -113.4909270);

        public Uri WebSite => new Uri("https://thomasrayner.ca");
        public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://thomasrayner.ca/feed"); } }
    }

}

Switch Thomas Rayner over to IWorkAtMicrosoft


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("Cake.Hg")]
[assembly: AssemblyDescription("Cake AddIn that extends Cake with Mercurial features")]
[assembly: AssemblyCompany("vCipher")]
[assembly: AssemblyProduct("Cake.Hg")]

// 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("8E7F175A-9805-4FB2-8708-C358FF9F5CB2")]

// 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("0.0.3.0")]
[assembly: AssemblyFileVersion("0.0.3.0")]

using Cake.Core.Annotations;
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("Cake.Hg")]
[assembly: AssemblyDescription("Cake AddIn that extends Cake with Mercurial features")]
[assembly: AssemblyCompany("vCipher")]
[assembly: AssemblyProduct("Cake.Hg")]

// 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("8E7F175A-9805-4FB2-8708-C358FF9F5CB2")]

// 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("0.0.4.0")]
[assembly: AssemblyFileVersion("0.0.4.0")]

// Cake build configuration
[assembly: CakeNamespaceImport("Mercurial")]
[assembly: CakeNamespaceImport("Cake.Hg")]
[assembly: CakeNamespaceImport("Cake.Hg.Aliases")]
[assembly: CakeNamespaceImport("Cake.Hg.Versions")]

Add assemblywide cake namespace imports

Add assemblywide cake namespace imports


using System;
using IFVM.Core;

namespace IFVM.Glulx
{
    public class GlulxMachine : Machine
    {
        public GlulxHeader Header { get; }

        public GlulxMachine(Memory memory) : base(memory)
        {
            this.Header = new GlulxHeader(memory);

            VerifyChecksum(memory, this.Header.Checksum);

            // Initial the memory should have a size equal to ExtStart.
            // We must expand it to EndMem.
            if (this.Header.ExtStart != memory.Size)
            {
                throw new InvalidOperationException($"Size expected to be {this.Header.ExtStart}");
            }

            memory.Expand((int)this.Header.EndMem);
        }

        private static void VerifyChecksum(Memory memory, uint expectedValue)
        {
            var scanner = memory.CreateScanner(offset: 0);

            var checksum = 0u;
            while (scanner.CanReadNextDWord)
            {
                if (scanner.Offset == 0x20)
                {
                    // Note: We don't include the checksum value from the header.
                    scanner.SkipDWord();
                }
                else
                {
                    checksum += scanner.NextDWord();
                }
            }

            if (checksum != expectedValue)
            {
                throw new InvalidOperationException("Checksum does not match.");
            }
        }
    }
}

using System;
using IFVM.Core;

namespace IFVM.Glulx
{
    public class GlulxMachine : Machine
    {
        public GlulxHeader Header { get; }

        public GlulxMachine(Memory memory) : base(memory)
        {
            this.Header = new GlulxHeader(memory);

            VerifyChecksum(memory, this.Header.Checksum);

            // Initial the memory should have a size equal to ExtStart.
            // We must expand it to EndMem.
            if (this.Header.ExtStart != memory.Size)
            {
                throw new InvalidOperationException($"Size expected to be {this.Header.ExtStart}");
            }

            memory.Expand((int)this.Header.EndMem);
            memory.AddReadOnlyRegion(0, (int)this.Header.RamStart);
        }

        private static void VerifyChecksum(Memory memory, uint expectedValue)
        {
            var scanner = memory.CreateScanner(offset: 0);

            var checksum = 0u;
            while (scanner.CanReadNextDWord)
            {
                if (scanner.Offset == 0x20)
                {
                    // Note: We don't include the checksum value from the header.
                    scanner.SkipDWord();
                }
                else
                {
                    checksum += scanner.NextDWord();
                }
            }

            if (checksum != expectedValue)
            {
                throw new InvalidOperationException("Checksum does not match.");
            }
        }
    }
}

Mark ROM region for Glulx

Mark ROM region for Glulx


namespace DanTup.DartVS.ProjectSystem
{
    using System.ComponentModel;
    using System.Runtime.InteropServices;
    using Microsoft.VisualStudio.Project;
    using prjBuildAction = VSLangProj.prjBuildAction;

    [ComVisible(true)]
    public class DartFileNodeProperties : FileNodeProperties
    {
        public DartFileNodeProperties(DartFileNode node)
            : base(node)
        {
        }

        [Browsable(false)]
        public override prjBuildAction BuildAction
        {
            get
            {
                return base.BuildAction;
            }

            set
            {
                base.BuildAction = value;
            }
        }

        public override CopyToOutputDirectoryBehavior CopyToOutputDirectory
        {
            get
            {
                return base.CopyToOutputDirectory;
            }

            set
            {
                if (Node.ItemNode.IsVirtual && value != CopyToOutputDirectoryBehavior.DoNotCopy)
                {
                    Node.ItemNode = Node.ProjectManager.AddFileToMSBuild(Node.VirtualNodeName, ProjectFileConstants.Content, null);
                }

                base.CopyToOutputDirectory = value;
            }
        }
    }
}

namespace DanTup.DartVS.ProjectSystem
{
    using System.ComponentModel;
    using System.Runtime.InteropServices;
    using Microsoft.VisualStudio.Project;
    using prjBuildAction = VSLangProj.prjBuildAction;

    [ComVisible(true)]
    public class DartFileNodeProperties : FileNodeProperties
    {
        public DartFileNodeProperties(DartFileNode node)
            : base(node)
        {
        }

        [Browsable(false)]
        public override prjBuildAction BuildAction
        {
            get
            {
                return base.BuildAction;
            }

            set
            {
                base.BuildAction = value;
            }
        }

        [Browsable(false)]
        public override CopyToOutputDirectoryBehavior CopyToOutputDirectory
        {
            get
            {
                return base.CopyToOutputDirectory;
            }

            set
            {
                base.CopyToOutputDirectory = value;
            }
        }
    }
}

Remove the Copy to Output Directory file property


using System.Collections.Generic;
using System.Linq;
using DirigoEdgeCore.Data.Entities;
using DirigoEdgeCore.Models;

public class RedirectViewModel : DirigoBaseModel
{
    public List<Redirect> Redirects;
    public List<string> Pages = new List<string>();

    public RedirectViewModel()
    {
        BookmarkTitle = "Configure Redirects";
        Redirects = Context.Redirects.ToList();

        var pages = Context.ContentPages.Where(x => x.IsActive == true).ToList();

        foreach (var page in pages)
        {
            Pages.Add(NavigationUtils.GetGeneratedUrl(page));
        }
    }
}

using System.Collections.Generic;
using System.Linq;
using DirigoEdgeCore.Data.Entities;
using DirigoEdgeCore.Models;

public class RedirectViewModel : DirigoBaseModel
{
    public List<Redirect> Redirects;
    public List<string> Pages = new List<string>();

    public RedirectViewModel()
    {
        BookmarkTitle = "Configure Redirects";
        Redirects = Context.Redirects.ToList();

        var pages = Context.ContentPages.Where(x => x.IsActive == true).OrderBy(x => x.Title).ToList();

        foreach (var page in pages)
        {
            Pages.Add(NavigationUtils.GetGeneratedUrl(page));
        }
    }
}

Order pages by title in dropdown

Order pages by title in dropdown


using Utf8Json;

namespace Nest
{
	internal class IndexNameFormatter : IJsonFormatter<IndexName>
	{
		public IndexName Deserialize(ref JsonReader reader, IJsonFormatterResolver formatterResolver)
		{
			if (reader.GetCurrentJsonToken() != JsonToken.String) return null;

			IndexName indexName = reader.ReadString();
			return indexName;
		}

		public void Serialize(ref JsonWriter writer, IndexName value, IJsonFormatterResolver formatterResolver)
		{
			if (value == null)
			{
				writer.WriteNull();
				return;
			}

			var settings = formatterResolver.GetConnectionSettings();
			var indexName = settings.Inferrer.IndexName(value);
			writer.WriteString(indexName);
		}
	}
}

using Utf8Json;

namespace Nest
{
	internal class IndexNameFormatter : IJsonFormatter<IndexName>, IObjectPropertyNameFormatter<IndexName>
	{
		public IndexName Deserialize(ref JsonReader reader, IJsonFormatterResolver formatterResolver)
		{
			if (reader.GetCurrentJsonToken() != JsonToken.String) return null;

			IndexName indexName = reader.ReadString();
			return indexName;
		}

		public void Serialize(ref JsonWriter writer, IndexName value, IJsonFormatterResolver formatterResolver)
		{
			if (value == null)
			{
				writer.WriteNull();
				return;
			}

			var settings = formatterResolver.GetConnectionSettings();
			var indexName = settings.Inferrer.IndexName(value);
			writer.WriteString(indexName);
		}

		public void SerializeToPropertyName(ref JsonWriter writer, IndexName value, IJsonFormatterResolver formatterResolver) =>
			Serialize(ref writer, value, formatterResolver);

		public IndexName DeserializeFromPropertyName(ref JsonReader reader, IJsonFormatterResolver formatterResolver) =>
			Deserialize(ref reader, formatterResolver);

	}
}

Allow IndexName to be serialized as an object key


using System;
using System.IO;
using System.Windows.Forms;

namespace MusicRandomizer
{
    public partial class VersionRequestForm : Form
    {
        public SplatoonRegion chosenRegion;

        public VersionRequestForm()
        {
            InitializeComponent();
        }

        private void VersionRequestForm_Load(object sender, EventArgs e)
        {
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!radNorthAmerica.Checked && !radEurope.Checked && !radJapan.Checked)
            {
                MessageBox.Show("Please choose a region.");
                return;
            }

            if (Directory.Exists("other_files"))
            {
                MessageBox.Show("The files inside other_files will be moved to a new folder called cafiine_root.");
            }

            if (radNorthAmerica.Checked)
            {
                chosenRegion = SplatoonRegion.NorthAmerica;
            }
            else if (radEurope.Checked)
            {
                chosenRegion = SplatoonRegion.Europe;
            }
            else
            {
                chosenRegion = SplatoonRegion.Japan;
            }

            this.Close();
        }
    }
}

using System;
using System.IO;
using System.Windows.Forms;

namespace MusicRandomizer
{
    public partial class VersionRequestForm : Form
    {
        public SplatoonRegion chosenRegion;

        public VersionRequestForm()
        {
            InitializeComponent();
        }

        private void VersionRequestForm_Load(object sender, EventArgs e)
        {
        }

        private void btnSave_Click(object sender, EventArgs e)
        {
            if (!radNorthAmerica.Checked && !radEurope.Checked && !radJapan.Checked)
            {
                MessageBox.Show("Please choose a region.");
                return;
            }

            if (radNorthAmerica.Checked)
            {
                chosenRegion = SplatoonRegion.NorthAmerica;
            }
            else if (radEurope.Checked)
            {
                chosenRegion = SplatoonRegion.Europe;
            }
            else
            {
                chosenRegion = SplatoonRegion.Japan;
            }

            this.Close();
        }
    }
}

MusicRandomizer: Remove other_files message box from the region selector


using System.Data;
using System.Data.SqlClient;
using SimpleAzureTraceListener.Listeners.Base;
using SimpleAzureTraceListener.Models;

namespace SimpleAzureTraceListener.Listeners
{
    public class AzureSqlTraceListener : AzureTraceListener
    {
        private readonly string _tableName;
        private readonly SqlConnection _connection;

        public AzureSqlTraceListener(string applicationName, string sqlConnectionString, string tableName = "TraceLogs")
        {
            _tableName = tableName;
            ApplicationName = applicationName;
            _connection = new SqlConnection(sqlConnectionString);
            _connection.Open();
        }

        protected override void SaveMessage(AzureTraceMessage azureTraceMessage)
        {
            using (var command = _connection.CreateCommand())
            {
                command.CommandText = string.Format(@"INSERT INTO {0} (ApplicationName, Message, Category, Timestamp) VALUES
                                            (@applicationName, @message, @category, @timeStamp)", _tableName);
                command.Parameters.Add(new SqlParameter("applicationName", SqlDbType.NVarChar) { Value = azureTraceMessage.ApplicationName });
                command.Parameters.Add(new SqlParameter("message", SqlDbType.NVarChar) { Value = azureTraceMessage.Message });
                command.Parameters.Add(new SqlParameter("category", SqlDbType.NVarChar) { Value = azureTraceMessage.Category });
                command.Parameters.Add(new SqlParameter("timeStamp", SqlDbType.DateTime2) { Value = azureTraceMessage.Timestamp });
                command.ExecuteNonQuery();
            }
        }
    }
}

using System;
using System.Data;
using System.Data.SqlClient;
using SimpleAzureTraceListener.Listeners.Base;
using SimpleAzureTraceListener.Models;

namespace SimpleAzureTraceListener.Listeners
{
    public class AzureSqlTraceListener : AzureTraceListener
    {
        private readonly string _tableName;
        private readonly SqlConnection _connection;

        public AzureSqlTraceListener(string applicationName, string sqlConnectionString, string tableName = "TraceLogs")
        {
            _tableName = tableName;
            ApplicationName = applicationName;
            _connection = new SqlConnection(sqlConnectionString);
            _connection.Open();
        }

        protected override void SaveMessage(AzureTraceMessage azureTraceMessage)
        {
            using (var command = _connection.CreateCommand())
            {
                command.CommandText = string.Format(@"INSERT INTO {0} (ApplicationName, Message, Category, Timestamp) VALUES
                                            (@applicationName, @message, @category, @timeStamp)", _tableName);
                command.Parameters.Add(new SqlParameter("applicationName", SqlDbType.NVarChar) { Value = azureTraceMessage.ApplicationName });
                command.Parameters.Add(new SqlParameter("message", SqlDbType.NVarChar) { Value = azureTraceMessage.Message });
                command.Parameters.Add(new SqlParameter("category", SqlDbType.NVarChar) { IsNullable = true, Value = azureTraceMessage.Category ?? (object) DBNull.Value });
                command.Parameters.Add(new SqlParameter("timeStamp", SqlDbType.DateTime2) { Value = azureTraceMessage.Timestamp });
                command.ExecuteNonQuery();
            }
        }
    }
}

Allow category to be null in Azure SQL listener

Another null category fix


using SnakeApp.Models;
using System;
using System.Threading.Tasks;

namespace SnakeApp
{
	public class GameController
	{
		public async Task StartNewGame()
		{
			var game = new Game(80, 25, 5, 100);
			game.Start();

			ConsoleKeyInfo userInput = new ConsoleKeyInfo();
			do
			{
				userInput = Console.ReadKey(true);
				game.ReceiveInput(userInput.Key);
			} while (userInput.Key != ConsoleKey.Q);
		}
	}
}

using SnakeApp.Models;
using System;
using System.Threading.Tasks;

namespace SnakeApp
{
	public class GameController
	{
		public async Task StartNewGame()
		{
			PrepareConsole();

			var game = new Game(80, 25, 5, 100);
			game.Start();

			ConsoleKeyInfo userInput = new ConsoleKeyInfo();
			do
			{
				userInput = Console.ReadKey(true);
				game.ReceiveInput(userInput.Key);
			} while (userInput.Key != ConsoleKey.Q);

			RestoreConsole();
		}

		private void PrepareConsole()
		{
			// getting the current cursor visibility is not supported on linux, so just hide then restore it
			Console.Clear();
			Console.CursorVisible = false;
		}

		private void RestoreConsole()
		{
			Console.Clear();
			Console.CursorVisible = true;
		}
	}
}

Hide the blinking console tail on linux.


using System;

namespace PcscDotNet
{
    public static class Pcsc<TIPcscProvider> where TIPcscProvider : class, IPcscProvider, new()
    {
        private static readonly Pcsc _instance = new Pcsc(new TIPcscProvider());

        public static Pcsc Instance => _instance;

        public static PcscContext CreateContext()
        {
            return new PcscContext(_instance);
        }

        public static PcscContext EstablishContext(SCardScope scope)
        {
            return new PcscContext(_instance, scope);
        }
    }
}

using System;

namespace PcscDotNet
{
    public static class Pcsc<TIPcscProvider> where TIPcscProvider : class, IPcscProvider, new()
    {
        private static readonly Pcsc _instance = new Pcsc(new TIPcscProvider());

        public static Pcsc Instance => _instance;

        public static PcscContext CreateContext()
        {
            return _instance.CreateContext();
        }

        public static PcscContext EstablishContext(SCardScope scope)
        {
            return _instance.EstablishContext(scope);
        }
    }
}

Change method callings to default static instance


using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
using Newtonsoft.Json.Linq;

namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
{
    public class CodeActionRequest
    {
        public static readonly
            RequestType<CodeActionParams, CodeActionCommand[], object, object> Type =
            RequestType<CodeActionParams, CodeActionCommand[], object, object>.Create("textDocument/codeAction");
    }

    /// <summary>
    /// Parameters for CodeActionRequest.
    /// </summary>
    public class CodeActionParams
    {
        /// <summary>
        /// The document in which the command was invoked.
        /// </summary>
        public TextDocumentIdentifier TextDocument { get; set; }

        /// <summary>
        /// The range for which the command was invoked.
        /// </summary>
        public Range Range { get; set; }

        /// <summary>
        /// Context carrying additional information.
        /// </summary>
        public CodeActionContext Context { get; set; }
    }

    public class CodeActionContext
    {
        public Diagnostic[] Diagnostics { get; set; }
    }

    public class CodeActionCommand
    {
        public string Title { get; set; }

        public string Command { get; set; }

        public JArray Arguments { get; set; }
    }
}

using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;
using Newtonsoft.Json.Linq;

namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
{
    public class CodeActionRequest
    {
        public static readonly
            RequestType<CodeActionParams, CodeActionCommand[], object, TextDocumentRegistrationOptions> Type =
            RequestType<CodeActionParams, CodeActionCommand[], object, TextDocumentRegistrationOptions>.Create("textDocument/codeAction");
    }

    /// <summary>
    /// Parameters for CodeActionRequest.
    /// </summary>
    public class CodeActionParams
    {
        /// <summary>
        /// The document in which the command was invoked.
        /// </summary>
        public TextDocumentIdentifier TextDocument { get; set; }

        /// <summary>
        /// The range for which the command was invoked.
        /// </summary>
        public Range Range { get; set; }

        /// <summary>
        /// Context carrying additional information.
        /// </summary>
        public CodeActionContext Context { get; set; }
    }

    public class CodeActionContext
    {
        public Diagnostic[] Diagnostics { get; set; }
    }

    public class CodeActionCommand
    {
        public string Title { get; set; }

        public string Command { get; set; }

        public JArray Arguments { get; set; }
    }
}

Add registration options for codeAction request


using System.Net.Http;
using MyCouch.Net;

namespace MyCouch.Requests.Factories
{
    public class AttachmentHttpRequestFactory :
        HttpRequestFactoryBase,
        IHttpRequestFactory<GetAttachmentRequest>,
        IHttpRequestFactory<PutAttachmentRequest>,
        IHttpRequestFactory<DeleteAttachmentRequest>
    {
        public AttachmentHttpRequestFactory(IConnection connection) : base(connection) { }

        protected virtual string GenerateRequestUrl(string docId, string docRev, string attachmentName)
        {
            return string.Format("{0}/{1}/{2}{3}",
                Connection.Address,
                docId,
                attachmentName,
                docRev == null ? string.Empty : string.Concat("?rev=", docRev));
        }

        public virtual HttpRequest Create(GetAttachmentRequest request)
        {
            var httpRequest = new HttpRequest(HttpMethod.Get, GenerateRequestUrl(request.DocId, request.DocRev, request.Name));

            httpRequest.SetIfMatch(request.DocRev);

            return httpRequest;
        }

        public virtual HttpRequest Create(PutAttachmentRequest request)
        {
            var httpRequest = new HttpRequest(HttpMethod.Put, GenerateRequestUrl(request.DocId, request.DocRev, request.Name));

            httpRequest.SetIfMatch(request.DocRev);
            httpRequest.SetContent(request.Content, request.ContentType);

            return httpRequest;
        }

        public virtual HttpRequest Create(DeleteAttachmentRequest request)
        {
            var httpRequest = new HttpRequest(HttpMethod.Delete, GenerateRequestUrl(request.DocId, request.DocRev, request.Name));

            httpRequest.SetIfMatch(request.DocRev);

            return httpRequest;
        }
    }
}

using System.Net.Http;
using MyCouch.Net;

namespace MyCouch.Requests.Factories
{
    public class AttachmentHttpRequestFactory :
        HttpRequestFactoryBase,
        IHttpRequestFactory<GetAttachmentRequest>,
        IHttpRequestFactory<PutAttachmentRequest>,
        IHttpRequestFactory<DeleteAttachmentRequest>
    {
        public AttachmentHttpRequestFactory(IConnection connection) : base(connection) { }

        public virtual HttpRequest Create(GetAttachmentRequest request)
        {
            var httpRequest = new HttpRequest(HttpMethod.Get, GenerateRequestUrl(request.DocId, request.DocRev, request.Name));

            httpRequest.SetIfMatch(request.DocRev);

            return httpRequest;
        }

        public virtual HttpRequest Create(PutAttachmentRequest request)
        {
            var httpRequest = new HttpRequest(HttpMethod.Put, GenerateRequestUrl(request.DocId, request.DocRev, request.Name));

            httpRequest.SetIfMatch(request.DocRev);
            httpRequest.SetContent(request.Content, request.ContentType);

            return httpRequest;
        }

        public virtual HttpRequest Create(DeleteAttachmentRequest request)
        {
            var httpRequest = new HttpRequest(HttpMethod.Delete, GenerateRequestUrl(request.DocId, request.DocRev, request.Name));

            httpRequest.SetIfMatch(request.DocRev);

            return httpRequest;
        }

        protected virtual string GenerateRequestUrl(string docId, string docRev, string attachmentName)
        {
            return string.Format("{0}/{1}/{2}{3}",
                Connection.Address,
                docId,
                attachmentName,
                docRev == null ? string.Empty : string.Concat("?rev=", docRev));
        }
    }
}

Move down to highlight the Create methods.


using UnityEngine;
using System.Collections;
using Realms.Common.Packet;
using System;

namespace Realms.Server.Packet
{
    [Serializable]
    public class PlayerHandshakePacket : IPacket
    {
        /// <summary>
        /// Is the connection to the server allowed
        /// </summary>
        public bool AllowConnection { get; private set; }

        /// <summary>
        /// If connection is refused, the reason why
        /// </summary>
        public string ErrorMessage { get; private set; }

        /// <summary>
        /// Spawn X position
        /// </summary>
        public float PositionX { get; private set; }

        /// <summary>
        /// Spawn Y position
        /// </summary>
        public float PositionY { get; private set; }

        /// <summary>
        /// Spawn Z position
        /// </summary>
        public float PositionZ { get; private set; }

        /// <summary>
        /// Class constructor
        /// </summary>
        /// <param name="allowConnection"></param>
        /// <param name="errorMessage"></param>
        public PlayerHandshakePacket(bool allowConnection, string errorMessage, Vector3 spawnPosition) : base(typeof(PlayerHandshakePacket))
        {
            this.AllowConnection = allowConnection;
            this.ErrorMessage = errorMessage;
            this.PositionX = spawnPosition.x;
            this.PositionX = spawnPosition.y;
            this.PositionX = spawnPosition.z;
        }

        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public Vector3 GetPosition()
        {
            return new Vector3(this.PositionX, this.PositionY, this.PositionZ);
        }
    }
}

using UnityEngine;
using System.Collections;
using Realms.Common.Packet;
using System;

namespace Realms.Server.Packet
{
    [Serializable]
    public class PlayerHandshakePacket : IPacket
    {
        /// <summary>
        /// Is the connection to the server allowed
        /// </summary>
        public bool AllowConnection { get; private set; }

        /// <summary>
        /// If connection is refused, the reason why
        /// </summary>
        public string ErrorMessage { get; private set; }

        /// <summary>
        /// Spawn X position
        /// </summary>
        public float PositionX { get; private set; }

        /// <summary>
        /// Spawn Y position
        /// </summary>
        public float PositionY { get; private set; }

        /// <summary>
        /// Spawn Z position
        /// </summary>
        public float PositionZ { get; private set; }

        /// <summary>
        /// Class constructor
        /// </summary>
        /// <param name="allowConnection"></param>
        /// <param name="errorMessage"></param>
        public PlayerHandshakePacket(bool allowConnection, string errorMessage, Vector3 spawnPosition) : base(typeof(PlayerHandshakePacket))
        {
            this.AllowConnection = allowConnection;
            this.ErrorMessage = errorMessage;
            this.PositionX = spawnPosition.x;
            this.PositionY = spawnPosition.y;
            this.PositionZ = spawnPosition.z;
        }

        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public Vector3 GetPosition()
        {
            return new Vector3(this.PositionX, this.PositionY, this.PositionZ);
        }
    }
}

Fix copy and past bug.

Fix copy and past bug.


// 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.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Osu;
using osu.Game.Screens.Edit.Components.Timelines.Summary;
using osuTK;

namespace osu.Game.Tests.Visual.Editing
{
    [TestFixture]
    public class TestSceneEditorSummaryTimeline : EditorClockTestScene
    {
        [BackgroundDependencyLoader]
        private void load()
        {
            Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);

            Add(new SummaryTimeline
            {
                Anchor = Anchor.Centre,
                Origin = Anchor.Centre,
                Size = new Vector2(500, 50)
            });
        }
    }
}

// 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.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Beatmaps;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Components.Timelines.Summary;
using osuTK;

namespace osu.Game.Tests.Visual.Editing
{
    [TestFixture]
    public class TestSceneEditorSummaryTimeline : EditorClockTestScene
    {
        [Cached(typeof(EditorBeatmap))]
        private readonly EditorBeatmap editorBeatmap = new EditorBeatmap(new OsuBeatmap());

        [BackgroundDependencyLoader]
        private void load()
        {
            Beatmap.Value = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo);

            Add(new SummaryTimeline
            {
                Anchor = Anchor.Centre,
                Origin = Anchor.Centre,
                Size = new Vector2(500, 50)
            });
        }
    }
}

Fix failing test due to missing dependency


using org.grobid.core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FluentAssertions;
using Xunit;
using Grobid.NET;
using System.Xml.Linq;
using org.apache.log4j;

namespace Grobid.Test
{
    public class GrobidTest
    {
        static GrobidTest()
        {
            BasicConfigurator.configure();
            org.apache.log4j.Logger.getRootLogger().setLevel(Level.DEBUG);
        }

        [Fact]
        public void ExtractTest()
        {
            var factory = new GrobidFactory(
                @"c:\dev\grobid.net\grobid.zip",
                @"c:\dev\grobid.net\bin\pdf2xml.exe",
                @"c:\temp");

            var grobid = factory.Create();
            var result = grobid.Extract(@"c:\dev\grobid.net\content\essence-linq.pdf");

            result.Should().NotBeEmpty();

            Action test = () => XDocument.Parse(result);
            test.ShouldNotThrow();
        }

        [Fact]
        public void Test()
        {
            var x = GrobidModels.NAMES_HEADER;
            x.name().Should().Be("NAMES_HEADER");
            x.toString().Should().Be("name/header");
        }
    }
}

using org.grobid.core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FluentAssertions;
using Xunit;
using Grobid.NET;
using System.Xml.Linq;
using org.apache.log4j;

namespace Grobid.Test
{
    public class GrobidTest
    {
        static GrobidTest()
        {
            BasicConfigurator.configure();
            org.apache.log4j.Logger.getRootLogger().setLevel(Level.DEBUG);
        }

        [Fact]
        [Trait("Test", "EndToEnd")]
        public void ExtractTest()
        {
            var factory = new GrobidFactory(
                @"c:\dev\grobid.net\grobid.zip",
                @"c:\dev\grobid.net\bin\pdf2xml.exe",
                @"c:\temp");

            var grobid = factory.Create();
            var result = grobid.Extract(@"c:\dev\grobid.net\content\essence-linq.pdf");

            result.Should().NotBeEmpty();

            Action test = () => XDocument.Parse(result);
            test.ShouldNotThrow();
        }

        [Fact]
        public void Test()
        {
            var x = GrobidModels.NAMES_HEADER;
            x.name().Should().Be("NAMES_HEADER");
            x.toString().Should().Be("name/header");
        }
    }
}

Mark the ExtractTest as EndToEnd.

Mark the ExtractTest as EndToEnd.


//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//

using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;

namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
{
    public enum DocumentHighlightKind
    {
        Text = 1,
        Read = 2,
        Write = 3
    }

    public class DocumentHighlight
    {
	    public Range Range { get; set; }

        public DocumentHighlightKind Kind { get; set; }
    }

    public class DocumentHighlightRequest
    {
        public static readonly
            RequestType<TextDocumentPositionParams, DocumentHighlight[], object, object> Type =
            RequestType<TextDocumentPositionParams, DocumentHighlight[], object, object>.Create("textDocument/documentHighlight");
    }
}

//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//

using Microsoft.PowerShell.EditorServices.Protocol.MessageProtocol;

namespace Microsoft.PowerShell.EditorServices.Protocol.LanguageServer
{
    public enum DocumentHighlightKind
    {
        Text = 1,
        Read = 2,
        Write = 3
    }

    public class DocumentHighlight
    {
	    public Range Range { get; set; }

        public DocumentHighlightKind Kind { get; set; }
    }

    public class DocumentHighlightRequest
    {
        public static readonly
            RequestType<TextDocumentPositionParams, DocumentHighlight[], object, TextDocumentRegistrationOptions> Type =
            RequestType<TextDocumentPositionParams, DocumentHighlight[], object, TextDocumentRegistrationOptions>.Create("textDocument/documentHighlight");
    }
}

Add registration options for documentHighlight request


using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SpinnerActivator : MonoBehaviour
{
    public bool boostEnabled;
    public GameObject boost;

    private void Start()
    {
        boost.GetComponent<BoostPadForce>().boostEnabled = false;
        boost.GetComponent<BoostPad>().lightDisabled();

        GetComponent<ObstacleNetworking>().ActivateFromServer += ActivateBoost;
        GetComponent<ObstacleNetworking>().DeactivateFromServer += DeactivateBoost;
    }

    void OnCollisionEnter(Collision col)
    {
        if (boostEnabled == true)
        {
            ActivateBoost();
            GetComponent<ObstacleNetworking>().ActivateFromServer();
        }
        else if (boostEnabled == false)
        {
            DeactivateBoost();
            GetComponent<ObstacleNetworking>().DeactivateFromServer();
        }
    }

    void ActivateBoost()
    {
        boost.GetComponent<BoostPadForce>().boostEnabled = false;
        boost.GetComponent<BoostPad>().lightDisabled();
        boostEnabled = false;
    }

    void DeactivateBoost()
    {
        boost.GetComponent<BoostPadForce>().boostEnabled = true;
        boost.GetComponent<BoostPad>().lightEnabled();
        boostEnabled = true;
    }
}

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;

public class SpinnerActivator : MonoBehaviour
{
    public bool boostEnabled;
    public GameObject boost;

    private void Start()
    {
        boost.GetComponent<BoostPadForce>().boostEnabled = false;
        boost.GetComponent<BoostPad>().lightDisabled();
    }

    private void Awake()
    {
        GetComponent<ObstacleNetworking>().ActivateFromServer += ActivateBoost;
        GetComponent<ObstacleNetworking>().DeactivateFromServer += DeactivateBoost;
    }

    void OnCollisionEnter(Collision col)
    {
        if (!NetworkManager.singleton.isNetworkActive || NetworkServer.connections.Count > 0)
        {
            //Host only
            if (boostEnabled == false)
            {
                ActivateBoost();
                GetComponent<ObstacleNetworking>().ActivateFromServer();
            }
            else if (boostEnabled == true)
            {
                DeactivateBoost();
                GetComponent<ObstacleNetworking>().DeactivateFromServer();
            }
        }
    }

    void DeactivateBoost()
    {
        boost.GetComponent<BoostPadForce>().boostEnabled = false;
        boost.GetComponent<BoostPad>().lightDisabled();
        boostEnabled = false;
    }

    void ActivateBoost()
    {
        boost.GetComponent<BoostPadForce>().boostEnabled = true;
        boost.GetComponent<BoostPad>().lightEnabled();
        boostEnabled = true;
    }
}

Put obstaclenetworking setup in the right place.


namespace StressMeasurementSystem.Models
{
    public class Patient
    {
        #region Structs

        struct Name
        {
            public string Prefix { get; set; }
            public string First { get; set; }
            public string Middle { get; set; }
            public string Last { get; set; }
            public string Suffix { get; set; }
        }

        struct Organization
        {
            public string Company { get; set; }
            public string JobTitle { get; set; }
        }

        struct PhoneNumber
        {
            internal enum Type {Mobile, Home, Work, Main, WorkFax, HomeFax, Pager, Other}

            public string Number { get; set; }
            public Type T { get; set; }
        }

        #endregion

        #region Fields

        private Name _name;
        private int _age;
        private Organization _organization;
        private PhoneNumber _phoneNumber;

        #endregion
    }
}

namespace StressMeasurementSystem.Models
{
    public class Patient
    {
        #region Structs

        struct Name
        {
            public string Prefix { get; set; }
            public string First { get; set; }
            public string Middle { get; set; }
            public string Last { get; set; }
            public string Suffix { get; set; }
        }

        struct Organization
        {
            public string Company { get; set; }
            public string JobTitle { get; set; }
        }

        struct PhoneNumber
        {
            internal enum Type {Mobile, Home, Work, Main, WorkFax, HomeFax, Pager, Other}

            public string Number { get; set; }
            public Type T { get; set; }
        }

        #endregion

        #region Fields

        private Name _name;
        private uint _age;
        private Organization _organization;
        private PhoneNumber _phoneNumber;

        #endregion
    }
}

Redefine age field as unsigned

Redefine age field as unsigned


using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Networking;
public static class UnityUtils
{
    /// <summary>
    /// Is any of the keys UP?
    /// </summary>
    /// <param name="keys"></param>
    /// <returns></returns>
    public static bool IsAnyKeyUp(KeyCode[] keys)
    {
        foreach (KeyCode key in keys)
        {
            if (Input.GetKeyUp(key))
                return true;
        }
        return false;
    }

    /// <summary>
    /// Is any of the keys DOWN?
    /// </summary>
    /// <param name="keys"></param>
    /// <returns></returns>
    public static bool IsAnyKeyDown(KeyCode[] keys)
    {
        foreach (KeyCode key in keys)
        {
            if (Input.GetKeyDown(key))
                return true;
        }
        return false;
    }

    /// <summary>
    /// Detect headless mode (which has graphicsDeviceType Null)
    /// </summary>
    /// <returns></returns>
    public static bool IsHeadless()
    {
        return SystemInfo.graphicsDeviceType == GraphicsDeviceType.Null;
    }

    public static bool TryGetByNetId<T>(NetworkInstanceId targetNetId, out T output) where T : Component
    {
        output = null;
        GameObject foundObject = ClientScene.FindLocalObject(targetNetId);
        if (foundObject == null)
            return false;

        output = foundObject.GetComponent<T>();
        if (output == null)
            return false;

        return true;
    }
}

using UnityEngine;
using UnityEngine.Rendering;
using UnityEngine.Networking;
public static class UnityUtils
{
    public static bool IsAnyKeyUp(KeyCode[] keys)
    {
        foreach (KeyCode key in keys)
        {
            if (Input.GetKeyUp(key))
                return true;
        }
        return false;
    }

    public static bool IsAnyKeyDown(KeyCode[] keys)
    {
        foreach (KeyCode key in keys)
        {
            if (Input.GetKeyDown(key))
                return true;
        }
        return false;
    }

    /// <summary>
    /// Detect headless mode (which has graphicsDeviceType Null)
    /// </summary>
    /// <returns></returns>
    public static bool IsHeadless()
    {
        return SystemInfo.graphicsDeviceType == GraphicsDeviceType.Null;
    }

    public static bool TryGetByNetId<T>(NetworkInstanceId targetNetId, out T output) where T : Component
    {
        output = null;
        GameObject foundObject = ClientScene.FindLocalObject(targetNetId);
        if (foundObject == null)
            return false;

        output = foundObject.GetComponent<T>();
        if (output == null)
            return false;

        return true;
    }
}

Remove some hints, function name is clear enough


@model SFA.DAS.EmployerUsers.Web.Models.OrchestratorResponse<SFA.DAS.EmployerUsers.Web.Models.ConfirmChangeEmailViewModel>

Enter your security code

<form method="post">
    @Html.AntiForgeryToken()

    <fieldset>
        <legend class="visuallyhidden">Enter your security code</legend>

            Enter security code
            <input autofocus="autofocus" aria-required="true" class="form-control" id="SecurityCode" name="SecurityCode">

            Password
            <input type="password" aria-required="true" autocomplete="off" class="form-control" id="Password" name="Password">

    </fieldset>
    <button type="submit" class="button">Continue</button>
</form>

@if (Model.Data.SecurityCode != null)
{

Not received your security code?

You can request another security code.

}

Add view elements for resending Confirm code


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

namespace Serilog.Sinks.MSSqlServer.Tests
{
    class TestPropertiesColumnFiltering
    {
    }
}

using Dapper;
using FluentAssertions;
using System.Data.SqlClient;
using Xunit;

namespace Serilog.Sinks.MSSqlServer.Tests
{
    [Collection("LogTest")]
    public class TestPropertiesColumnFiltering
    {
        internal class PropertiesColumns
        {
            public string Properties { get; set; }
        }

        [Fact]
        public void FilteredProperties()
        {
            // arrange
            var columnOptions = new ColumnOptions();
            columnOptions.Properties.PropertiesFilter = (propName) => propName == "A";

            Log.Logger = new LoggerConfiguration()
                .WriteTo.MSSqlServer
                (
                    connectionString: DatabaseFixture.LogEventsConnectionString,
                    tableName: DatabaseFixture.LogTableName,
                    columnOptions: columnOptions,
                    autoCreateSqlTable: true
                )
                .CreateLogger();

            // act
            Log.Logger
                .ForContext("A", "AValue")
                .ForContext("B", "BValue")
                .Information("Logging message");

            Log.CloseAndFlush();

            // assert
            using (var conn = new SqlConnection(DatabaseFixture.LogEventsConnectionString))
            {
                var logEvents = conn.Query<PropertiesColumns>($"SELECT Properties from {DatabaseFixture.LogTableName}");

                logEvents.Should().Contain(e => e.Properties.Contains("AValue"));
                logEvents.Should().NotContain(e => e.Properties.Contains("BValue"));
            }
        }
    }
}

Test for properties column filtering

Test for properties column filtering


namespace NerdBank.GitVersioning.CloudBuildServices
{
    using System;
    using System.Collections.Generic;
    using System.IO;
    using Nerdbank.GitVersioning;

    internal class GitHubActions : ICloudBuild
    {
        public bool IsApplicable => Environment.GetEnvironmentVariable("GITHUB_ACTIONS") == "true";

        public bool IsPullRequest => Environment.GetEnvironmentVariable("GITHUB_EVENT_NAME") == "PullRequestEvent";

        public string BuildingBranch => (BuildingRef?.StartsWith("refs/heads/") ?? false) ? BuildingRef : null;

        public string BuildingTag => (BuildingRef?.StartsWith("refs/tags/") ?? false) ? BuildingRef : null;

        public string GitCommitId => Environment.GetEnvironmentVariable("GITHUB_SHA");

        private static string BuildingRef => Environment.GetEnvironmentVariable("GITHUB_REF");

        private static string EnvironmentFile => Environment.GetEnvironmentVariable("GITHUB_ENV");

        public IReadOnlyDictionary<string, string> SetCloudBuildNumber(string buildNumber, TextWriter stdout, TextWriter stderr)
        {
            return new Dictionary<string, string>();
        }

        public IReadOnlyDictionary<string, string> SetCloudBuildVariable(string name, string value, TextWriter stdout, TextWriter stderr)
        {
            File.AppendAllText(EnvironmentFile, $"{name}={value}{Environment.NewLine}");
            return GetDictionaryFor(name, value);
        }

        private static IReadOnlyDictionary<string, string> GetDictionaryFor(string variableName, string value)
        {
            return new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
            {
                { GetEnvironmentVariableNameForVariable(variableName), value },
            };
        }

        private static string GetEnvironmentVariableNameForVariable(string name) => name.ToUpperInvariant().Replace('.', '_');
    }
}

namespace NerdBank.GitVersioning.CloudBuildServices
{
    using System;
    using System.Collections.Generic;
    using System.IO;
    using Nerdbank.GitVersioning;

    internal class GitHubActions : ICloudBuild
    {
        public bool IsApplicable => Environment.GetEnvironmentVariable("GITHUB_ACTIONS") == "true";

        public bool IsPullRequest => Environment.GetEnvironmentVariable("GITHUB_EVENT_NAME") == "PullRequestEvent";

        public string BuildingBranch => (BuildingRef?.StartsWith("refs/heads/") ?? false) ? BuildingRef : null;

        public string BuildingTag => (BuildingRef?.StartsWith("refs/tags/") ?? false) ? BuildingRef : null;

        public string GitCommitId => Environment.GetEnvironmentVariable("GITHUB_SHA");

        private static string BuildingRef => Environment.GetEnvironmentVariable("GITHUB_REF");

        private static string EnvironmentFile => Environment.GetEnvironmentVariable("GITHUB_ENV");

        public IReadOnlyDictionary<string, string> SetCloudBuildNumber(string buildNumber, TextWriter stdout, TextWriter stderr)
        {
            return new Dictionary<string, string>();
        }

        public IReadOnlyDictionary<string, string> SetCloudBuildVariable(string name, string value, TextWriter stdout, TextWriter stderr)
        {
            File.AppendAllText(EnvironmentFile, $"{Environment.NewLine}{name}={value}{Environment.NewLine}");
            return GetDictionaryFor(name, value);
        }

        private static IReadOnlyDictionary<string, string> GetDictionaryFor(string variableName, string value)
        {
            return new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
            {
                { GetEnvironmentVariableNameForVariable(variableName), value },
            };
        }

        private static string GetEnvironmentVariableNameForVariable(string name) => name.ToUpperInvariant().Replace('.', '_');
    }
}

Add Newline at String Start

Add Newline at String Start


// Copyright 2015 Coinprism, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

using System;
using System.Data.SqlClient;
using Openchain.Tests;

namespace Openchain.SqlServer.Tests
{
    public class SqlServerStorageEngineTests : BaseStorageEngineTests
    {
        private readonly int instanceId;

        public SqlServerStorageEngineTests()
        {
            Random rnd = new Random();
            this.instanceId = rnd.Next(0, int.MaxValue);

            SqlServerStorageEngine engine = new SqlServerStorageEngine("Data Source=.;Initial Catalog=Openchain;Integrated Security=True", this.instanceId, TimeSpan.FromSeconds(10));
            engine.OpenConnection().Wait();

            SqlCommand command = engine.Connection.CreateCommand();
            command.CommandText = @"
                DELETE FROM [Openchain].[RecordMutations];
                DELETE FROM [Openchain].[Records];
                DELETE FROM [Openchain].[Transactions];
            ";

            command.ExecuteNonQuery();

            this.Store = engine;
        }
    }
}

// Copyright 2015 Coinprism, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

using System;
using System.Data.SqlClient;
using Openchain.Tests;
using Xunit;

namespace Openchain.SqlServer.Tests
{
    [Collection("SQL Server Tests")]
    public class SqlServerStorageEngineTests : BaseStorageEngineTests
    {
        private readonly int instanceId;

        public SqlServerStorageEngineTests()
        {
            SqlServerStorageEngine engine = new SqlServerStorageEngine("Data Source=.;Initial Catalog=Openchain;Integrated Security=True", 1, TimeSpan.FromSeconds(10));
            engine.OpenConnection().Wait();

            SqlCommand command = engine.Connection.CreateCommand();
            command.CommandText = @"
                DELETE FROM [Openchain].[RecordMutations];
                DELETE FROM [Openchain].[Records];
                DELETE FROM [Openchain].[Transactions];
            ";

            command.ExecuteNonQuery();

            this.Store = engine;
        }
    }
}

Make sure SQL Server tests don't run in parallel


// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Test2d;

namespace Test2d
{
    /// <summary>
    ///
    /// </summary>
    public class RoslynScriptGlobals
    {
        /// <summary>
        ///
        /// </summary>
        public EditorContext Context;
    }
}

// Copyright (c) Wiesław Šoltés. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Test2d;

namespace Test2d
{
    /// <summary>
    ///
    /// </summary>
    public class RoslynScriptGlobals : ShapeFactory
    {
    }
}

Use ShapeFactory as base class

Use ShapeFactory as base class


// 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.Framework.Input.StateChanges;
using osu.Framework.Input.States;
using osu.Framework.Platform;
using osu.Framework.Statistics;
using Veldrid;
using TKKey = osuTK.Input.Key;

namespace osu.Framework.Input.Handlers.Keyboard
{
    public class Sdl2KeyboardHandler : InputHandler
    {
        private readonly KeyboardState lastKeyboardState = new KeyboardState();
        private readonly KeyboardState thisKeyboardState = new KeyboardState();

        public override bool IsActive => true;

        public override int Priority => 0;

        public override bool Initialize(GameHost host)
        {
            if (!(host.Window is Window window))
                return false;

            Enabled.BindValueChanged(e =>
            {
                if (e.NewValue)
                {
                    window.KeyDown += handleKeyboardEvent;
                    window.KeyUp += handleKeyboardEvent;
                }
                else
                {
                    window.KeyDown -= handleKeyboardEvent;
                    window.KeyUp -= handleKeyboardEvent;
                }
            }, true);

            return true;
        }

        private void handleKeyboardEvent(KeyEvent keyEvent)
        {
            thisKeyboardState.Keys.SetPressed((TKKey)keyEvent.Key, keyEvent.Down);
            PendingInputs.Enqueue(new KeyboardKeyInput(thisKeyboardState.Keys, lastKeyboardState.Keys));
            lastKeyboardState.Keys.SetPressed((TKKey)keyEvent.Key, keyEvent.Down);
            FrameStatistics.Increment(StatisticsCounterType.KeyEvents);
        }
    }
}

// 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.Framework.Input.StateChanges;
using osu.Framework.Input.States;
using osu.Framework.Platform;
using osu.Framework.Statistics;
using Veldrid;
using TKKey = osuTK.Input.Key;

namespace osu.Framework.Input.Handlers.Keyboard
{
    public class Sdl2KeyboardHandler : InputHandler
    {
        private readonly KeyboardState lastKeyboardState = new KeyboardState();
        private readonly KeyboardState thisKeyboardState = new KeyboardState();

        public override bool IsActive => true;

        public override int Priority => 0;

        public override bool Initialize(GameHost host)
        {
            if (!(host.Window is Window window))
                return false;

            Enabled.BindValueChanged(e =>
            {
                if (e.NewValue)
                {
                    window.KeyDown += handleKeyboardEvent;
                    window.KeyUp += handleKeyboardEvent;
                }
                else
                {
                    window.KeyDown -= handleKeyboardEvent;
                    window.KeyUp -= handleKeyboardEvent;
                }
            }, true);

            return true;
        }

        private void handleKeyboardEvent(KeyEvent keyEvent)
        {
            if (keyEvent.Key == Key.Unknown)
                return;

            thisKeyboardState.Keys.SetPressed((TKKey)keyEvent.Key, keyEvent.Down);
            PendingInputs.Enqueue(new KeyboardKeyInput(thisKeyboardState.Keys, lastKeyboardState.Keys));
            lastKeyboardState.Keys.SetPressed((TKKey)keyEvent.Key, keyEvent.Down);
            FrameStatistics.Increment(StatisticsCounterType.KeyEvents);
        }
    }
}

Abort key handling if SDL2 passes us an unknown key


using CertiPay.Common.Logging;
using CertiPay.Common.WorkQueue;
using System.Threading;
using System.Threading.Tasks;

namespace CertiPay.Common.Notifications
{
    /// <summary>
    /// Sends notifications to the background worker queue for async processing and retries
    /// </summary>
    public partial class QueuedSender :
        INotificationSender<SMSNotification>,
        INotificationSender<EmailNotification>
    {
        private static readonly ILog Log = LogManager.GetLogger<QueuedSender>();

        private readonly IQueueManager _queue;

        public QueuedSender(IQueueManager queue)
        {
            this._queue = queue;
        }

        public async Task SendAsync(EmailNotification notification)
        {
            await SendAsync(notification, CancellationToken.None);
        }
        public async Task SendAsync(EmailNotification notification, CancellationToken token)
        {
            using (Log.Timer("QueuedSender.SendAsync", context: notification))
            {
                await _queue.Enqueue(EmailNotification.QueueName, notification);
            }
        }
        public async Task SendAsync(SMSNotification notification)
        {
            await SendAsync(notification, CancellationToken.None);
        }
        public async Task SendAsync(SMSNotification notification, CancellationToken token)
        {
            using (Log.Timer("QueuedSender.SendAsync", context: notification))
            {
                await _queue.Enqueue(SMSNotification.QueueName, notification);
            }
        }
    }
}

Fix formatting on queued sender

:lipstick: Fix formatting on queued sender


using NUnit.Framework;

namespace Atata.Tests
{
    public class ControlTests : UITestFixture
    {
        [Test]
        public void Control_DragAndDrop_UsingDragAndDropUsingScriptBehavior()
        {
            Go.To<DragAndDropPage>().
                DropContainer.Items.Should.BeEmpty().
                DragItems.Items.Should.HaveCount(2).
                DragItems[x => x.Content == "Drag item 1"].DragAndDropTo(x => x.DropContainer).
                DragItems[0].DragAndDropTo(x => x.DropContainer).
                DropContainer.Items.Should.HaveCount(2).
                DragItems.Items.Should.BeEmpty().
                DropContainer[1].Content.Should.Equal("Drag item 2");
        }
    }
}

using NUnit.Framework;

namespace Atata.Tests
{
    public class ControlTests : UITestFixture
    {
        [Test]
        public void Control_DragAndDrop_UsingDomEvents()
        {
            Go.To<DragAndDropPage>().
                DropContainer.Items.Should.BeEmpty().
                DragItems.Items.Should.HaveCount(2).
                DragItems[x => x.Content == "Drag item 1"].DragAndDropTo(x => x.DropContainer).
                DragItems[0].DragAndDropTo(x => x.DropContainer).
                DropContainer.Items.Should.HaveCount(2).
                DragItems.Items.Should.BeEmpty().
                DropContainer[1].Content.Should.Equal("Drag item 2");
        }
    }
}

Rename Control_DragAndDrop_UsingDragAndDropUsingScriptBehavior test to Control_DragAndDrop_UsingDomEvents


namespace TensorSharp.Operations
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    public class DivideIntegerIntegerOperation : IBinaryOperation<int, int, int>
    {
        public Tensor<int> Evaluate(Tensor<int> tensor1, Tensor<int> tensor2)
        {
            Tensor<int> result = new Tensor<int>();

            result.SetValue(tensor1.GetValue() / tensor2.GetValue());

            return result;
        }
    }
}

namespace TensorSharp.Operations
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    public class DivideIntegerIntegerOperation : IBinaryOperation<int, int, int>
    {
        public Tensor<int> Evaluate(Tensor<int> tensor1, Tensor<int> tensor2)
        {
            int[] values1 = tensor1.GetValues();
            int l = values1.Length;

            int value2 = tensor2.GetValue();

            int[] newvalues = new int[l];

            for (int k = 0; k < l; k++)
                newvalues[k] = values1[k] / value2;

            return tensor1.CloneWithNewValues(newvalues);
        }
    }
}

Refactor Divide Integers Operation to use GetValujes and CloneWithValues


// Copyright (c) MarinAtanasov. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the project root for license information.
//
using AppBrix.Configuration;
using System;
using System.Linq;
using System.Threading;

namespace AppBrix.Web.Client.Configuration
{
    public sealed class WebClientConfig : IConfig
    {
        #region Construction
        /// <summary>
        /// Creates a new instance of <see cref="WebClientConfig"/> with default values for the properties.
        /// </summary>
        public WebClientConfig()
        {
            this.MaxConnectionsPerServer = 128;
            this.RequestTimeout = Timeout.InfiniteTimeSpan;
        }
        #endregion

        #region Properties
        /// <summary>
        /// Gets or sets the timeout used when making HTTP requests.
        /// </summary>
        public int MaxConnectionsPerServer { get; set; }

        /// <summary>
        /// Gets or sets the timeout used when making HTTP requests.
        /// </summary>
        public TimeSpan RequestTimeout { get; set; }
        #endregion
    }
}

// Copyright (c) MarinAtanasov. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the project root for license information.
//
using AppBrix.Configuration;
using System;
using System.Linq;
using System.Threading;

namespace AppBrix.Web.Client.Configuration
{
    public sealed class WebClientConfig : IConfig
    {
        #region Construction
        /// <summary>
        /// Creates a new instance of <see cref="WebClientConfig"/> with default values for the properties.
        /// </summary>
        public WebClientConfig()
        {
            this.MaxConnectionsPerServer = 1024;
            this.RequestTimeout = Timeout.InfiniteTimeSpan;
        }
        #endregion

        #region Properties
        /// <summary>
        /// Gets or sets the timeout used when making HTTP requests.
        /// </summary>
        public int MaxConnectionsPerServer { get; set; }

        /// <summary>
        /// Gets or sets the timeout used when making HTTP requests.
        /// </summary>
        public TimeSpan RequestTimeout { get; set; }
        #endregion
    }
}

Set max connections per server to 1024 by default.


// 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.Collections.Generic;
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Text;

namespace Microsoft.CodeAnalysis.ExternalAccess.Razor
{
    internal sealed class RazorSpanMappingServiceWrapper : ISpanMappingService
    {
        private readonly IRazorSpanMappingService _razorSpanMappingService;

        public RazorSpanMappingServiceWrapper(IRazorSpanMappingService razorSpanMappingService)
        {
            _razorSpanMappingService = razorSpanMappingService ?? throw new ArgumentNullException(nameof(razorSpanMappingService));
        }

        public async Task<ImmutableArray<MappedSpanResult>> MapSpansAsync(Document document, IEnumerable<TextSpan> spans, CancellationToken cancellationToken)
        {
            var razorSpans = await _razorSpanMappingService.MapSpansAsync(document, spans, cancellationToken).ConfigureAwait(false);
            var roslynSpans = new MappedSpanResult[razorSpans.Length];
            for (var i = 0; i < razorSpans.Length; i++)
            {
                var razorSpan = razorSpans[i];
                roslynSpans[i] = new MappedSpanResult(razorSpan.FilePath, razorSpan.LinePositionSpan, razorSpan.Span);
            }

            return roslynSpans.ToImmutableArray();
        }
    }
}

// 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.Collections.Generic;
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Text;

namespace Microsoft.CodeAnalysis.ExternalAccess.Razor
{
    internal sealed class RazorSpanMappingServiceWrapper : ISpanMappingService
    {
        private readonly IRazorSpanMappingService _razorSpanMappingService;

        public RazorSpanMappingServiceWrapper(IRazorSpanMappingService razorSpanMappingService)
        {
            _razorSpanMappingService = razorSpanMappingService ?? throw new ArgumentNullException(nameof(razorSpanMappingService));
        }

        public async Task<ImmutableArray<MappedSpanResult>> MapSpansAsync(Document document, IEnumerable<TextSpan> spans, CancellationToken cancellationToken)
        {
            var razorSpans = await _razorSpanMappingService.MapSpansAsync(document, spans, cancellationToken).ConfigureAwait(false);
            var roslynSpans = new MappedSpanResult[razorSpans.Length];
            for (var i = 0; i < razorSpans.Length; i++)
            {
                var razorSpan = razorSpans[i];
                if (razorSpan.FilePath == null)
                {
                    // Unmapped location
                    roslynSpans[i] = default;
                }
                else
                {
                    roslynSpans[i] = new MappedSpanResult(razorSpan.FilePath, razorSpan.LinePositionSpan, razorSpan.Span);
                }
            }

            return roslynSpans.ToImmutableArray();
        }
    }
}

Enable default mapped span results for Razor.

- Default mapped span results are used to indicate that a dynamic file could not map a particular location. Prior to this change we'd always reconstruct the span mapping full-sale which would explode during mapping construction because null filepaths weren't allowed. Therefore, we needed to understand that an "unmapped" location was being handed off from Razor's runtime and in turn needed to generate a "default" unmapped span for it.

Fixes dotnet/aspnetcore#24351


using System.Linq;
using System.Web.Http;
using System.Web.Http.OData;
using NuGet.Lucene.Web.Models;
using NuGet.Lucene.Web.Util;

namespace NuGet.Lucene.Web.Controllers
{
    /// <summary>
    /// OData provider for Lucene based NuGet package repository.
    /// </summary>
    public class PackagesODataController : ODataController
    {
        public ILucenePackageRepository Repository { get; set; }
        public IMirroringPackageRepository MirroringRepository { get; set; }

        [Queryable]
        public IQueryable<ODataPackage> Get()
        {
            return Repository.LucenePackages.Select(p => p.AsDataServicePackage()).AsQueryable();
        }

        public object Get([FromODataUri] string id, [FromODataUri] string version)
        {
            SemanticVersion semanticVersion;
            if (!SemanticVersion.TryParse(version, out semanticVersion))
            {
                return BadRequest("Invalid version");
            }

            if (string.IsNullOrWhiteSpace(id))
            {
                return BadRequest("Invalid package id");
            }

            var package = MirroringRepository.FindPackage(id, semanticVersion);

            return package == null ? (object)NotFound() : package.AsDataServicePackage();
        }
    }
}

using System.Linq;
using System.Net.Http;
using System.Web.Http;
using System.Web.Http.OData;
using NuGet.Lucene.Web.Models;
using NuGet.Lucene.Web.Util;

namespace NuGet.Lucene.Web.Controllers
{
    /// <summary>
    /// OData provider for Lucene based NuGet package repository.
    /// </summary>
    public class PackagesODataController : ODataController
    {
        public ILucenePackageRepository Repository { get; set; }
        public IMirroringPackageRepository MirroringRepository { get; set; }

        [Queryable]
        public IQueryable<ODataPackage> Get()
        {
            return Repository.LucenePackages.Select(p => p.AsDataServicePackage()).AsQueryable();
        }

        public IHttpActionResult Get([FromODataUri] string id, [FromODataUri] string version)
        {
            SemanticVersion semanticVersion;
            if (!SemanticVersion.TryParse(version, out semanticVersion))
            {
                return BadRequest("Invalid version");
            }

            if (string.IsNullOrWhiteSpace(id))
            {
                return BadRequest("Invalid package id");
            }

            var package = MirroringRepository.FindPackage(id, semanticVersion);

            return package == null ? (IHttpActionResult)NotFound() : Ok(package.AsDataServicePackage());
        }
    }
}

Set more specific return type to enable application/atom+xml response formatting.


using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Threading;
using Lokad.Cqrs.Build.Client;
using Lokad.Cqrs.Build.Engine;
using Lokad.Cqrs.Core.Dispatch.Events;
using Microsoft.WindowsAzure;
using NUnit.Framework;
using System.Linq;

namespace Lokad.Cqrs
{
    [TestFixture]
    public sealed class BasicClientConfigurationTests
    {
        [DataContract]
        public sealed class Message : Define.Command
        {

        }

        // ReSharper disable InconsistentNaming
        [Test]
        public void Test()
        {
            var dev = AzureStorage.CreateConfigurationForDev();
            WipeAzureAccount.Fast(s => s.StartsWith("test-"), dev);

            var events = new Subject<ISystemEvent>();
            var b = new CqrsEngineBuilder();
            b.Azure(c => c.AddAzureProcess(dev, "test-publish",container => { }));
            b.Advanced.RegisterObserver(events);
            var engine = b.Build();
            var source = new CancellationTokenSource();
            engine.Start(source.Token);

            var builder = new CqrsClientBuilder();
            builder.Azure(c => c.AddAzureSender(dev, "test-publish"));
            var client = builder.Build();

            client.Sender.SendOne(new Message());

            using (engine)
            using (events.OfType<EnvelopeAcked>().Subscribe(e => source.Cancel()))
            {
                source.Token.WaitHandle.WaitOne(5000);
                source.Cancel();
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Threading;
using Lokad.Cqrs.Build.Client;
using Lokad.Cqrs.Build.Engine;
using Lokad.Cqrs.Core.Dispatch.Events;
using Microsoft.WindowsAzure;
using NUnit.Framework;
using System.Linq;

namespace Lokad.Cqrs
{
    [TestFixture]
    public sealed class BasicClientConfigurationTests
    {
        [DataContract]
        public sealed class Message : Define.Command
        {

        }

        // ReSharper disable InconsistentNaming
        [Test]
        public void Test()
        {
            var dev = AzureStorage.CreateConfigurationForDev();
            WipeAzureAccount.Fast(s => s.StartsWith("test-"), dev);

            var events = new Subject<ISystemEvent>();
            var b = new CqrsEngineBuilder();
            b.Azure(c => c.AddAzureProcess(dev, "test-publish",HandlerComposer.Empty));
            b.Advanced.RegisterObserver(events);
            var engine = b.Build();
            var source = new CancellationTokenSource();
            engine.Start(source.Token);

            var builder = new CqrsClientBuilder();
            builder.Azure(c => c.AddAzureSender(dev, "test-publish"));
            var client = builder.Build();

            client.Sender.SendOne(new Message());

            using (engine)
            using (events.OfType<EnvelopeAcked>().Subscribe(e => source.Cancel()))
            {
                source.Token.WaitHandle.WaitOne(5000);
                source.Cancel();
            }
        }
    }
}

Correct basic client config test

Correct basic client config test


//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.34003
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

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

[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.2.0.0")]
[assembly: AssemblyConfiguration("Release built on 2013-10-23 22:48")]
[assembly: AssemblyCopyright("Copyright © 2013 Autofac Contributors")]
[assembly: AssemblyDescription("Autofac.Configuration 3.2.0")]

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.18051
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

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

[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.2.0.0")]
[assembly: AssemblyConfiguration("Release built on 2013-12-03 10:23")]
[assembly: AssemblyCopyright("Copyright © 2013 Autofac Contributors")]
[assembly: AssemblyDescription("Autofac.Configuration 3.2.0")]

Split WCF functionality out of Autofac.Extras.Multitenant into a separate assembly/package, Autofac.Extras.Multitenant.Wcf. Both packages are versioned 3.1.0.