// Copyright 2017 by PeopleWare n.v..
//
// 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 NHibernate.Mapping.ByCode.Conformist;

using PPWCode.Vernacular.NHibernate.I.Tests.DictionariesAndLists.Models;

namespace PPWCode.Vernacular.NHibernate.I.Tests.DictionariesAndLists.Mappers
{
    public class PlaneMapper : ComponentMapping<Plane>
    {
        public PlaneMapper()
        {
            Component(p => p.Normal);
            Component(p => p.Translation);
        }
    }
}

// Copyright 2017 by PeopleWare n.v..
//
// 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 NHibernate.Mapping.ByCode.Conformist;

using PPWCode.Vernacular.NHibernate.I.Tests.DictionariesAndLists.Models;

namespace PPWCode.Vernacular.NHibernate.I.Tests.DictionariesAndLists.Mappers
{
    public class PlaneMapper : ComponentMapping<Plane>
    {
        public PlaneMapper()
        {
            Component(p => p.Normal);
            Property(p => p.Translation);
        }
    }
}

Fix wrong mapping for Translation, should be mapped as a property instead of Component


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

#nullable disable
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Testing;
using osu.Game.Rulesets.Mods;

namespace osu.Game.Tests.Visual.Gameplay
{
    [HeadlessTest]
    public class TestSceneModValidity : TestSceneAllRulesetPlayers
    {
        protected override void AddCheckSteps()
        {
            AddStep("Check all mod acronyms are unique", () =>
            {
                var mods = Ruleset.Value.CreateInstance().AllMods;

                IEnumerable<string> acronyms = mods.Select(m => m.Acronym);

                Assert.That(acronyms, Is.Unique);
            });

            AddStep("Check all mods are two-way incompatible", () =>
            {
                var mods = Ruleset.Value.CreateInstance().AllMods;

                IEnumerable<Mod> modInstances = mods.Select(mod => mod.CreateInstance());

                foreach (var mod in modInstances)
                {
                    var modIncompatibilities = mod.IncompatibleMods;

                    foreach (var incompatibleModType in modIncompatibilities)
                    {
                        var incompatibleMod = modInstances.First(m => incompatibleModType.IsInstanceOfType(m));
                        Assert.That(
                            incompatibleMod.IncompatibleMods.Any(m => m.IsInstanceOfType(mod)),
                            $"{mod} has {incompatibleMod} in it's incompatible mods, but {incompatibleMod} does not have {mod} in it's incompatible mods."
                        );
                    }
                }
            });
        }
    }
}

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

using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;
using osu.Framework.Testing;
using osu.Game.Rulesets.Mods;

namespace osu.Game.Tests.Visual.Gameplay
{
    [HeadlessTest]
    public class TestSceneModValidity : TestSceneAllRulesetPlayers
    {
        protected override void AddCheckSteps()
        {
            AddStep("Check all mod acronyms are unique", () =>
            {
                var mods = Ruleset.Value.CreateInstance().AllMods;

                IEnumerable<string> acronyms = mods.Select(m => m.Acronym);

                Assert.That(acronyms, Is.Unique);
            });

            AddStep("Check all mods are two-way incompatible", () =>
            {
                var mods = Ruleset.Value.CreateInstance().AllMods;

                IEnumerable<Mod> modInstances = mods.Select(mod => mod.CreateInstance());

                foreach (var modToCheck in modInstances)
                {
                    var incompatibleMods = modToCheck.IncompatibleMods;

                    foreach (var incompatible in incompatibleMods)
                    {
                        foreach (var incompatibleMod in modInstances.Where(m => incompatible.IsInstanceOfType(m)))
                        {
                            Assert.That(
                                incompatibleMod.IncompatibleMods.Any(m => m.IsInstanceOfType(modToCheck)),
                                $"{modToCheck} has {incompatibleMod} in it's incompatible mods, but {incompatibleMod} does not have {modToCheck} in it's incompatible mods."
                            );
                        }
                    }
                }
            });
        }
    }
}

Fix check not accounting for mods not existing in certain rulesets

Also check all instances, rather than first.


// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// 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.
// ----------------------------------------------------------------------------------

namespace Microsoft.WindowsAzure.Management.CloudService.Test.Utilities
{
    using System.Management.Automation;
    using VisualStudio.TestTools.UnitTesting;
    using Microsoft.WindowsAzure.Management.Test.Tests.Utilities;

    [TestClass]
    public class PowerShellTest
    {
        protected PowerShell powershell;
        protected string[] modules;

        public PowerShellTest(params string[] modules)
        {
            this.modules = modules;
        }

        protected void AddScenarioScript(string script)
        {
            powershell.AddScript(Testing.GetTestResourceContents(script));
        }

        [TestInitialize]
        public virtual void SetupTest()
        {
            powershell = PowerShell.Create();

            foreach (string moduleName in modules)
            {
                powershell.AddScript(string.Format("Import-Module \"{0}\"", Testing.GetTestResourcePath(moduleName)));
            }

            powershell.AddScript("$verbosepreference='continue'");
        }

        [TestCleanup]
        public virtual void TestCleanup()
        {
            powershell.Dispose();
        }
    }
}

// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// 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.
// ----------------------------------------------------------------------------------

namespace Microsoft.WindowsAzure.Management.CloudService.Test.Utilities
{
    using System.Management.Automation;
    using VisualStudio.TestTools.UnitTesting;
    using Microsoft.WindowsAzure.Management.Test.Tests.Utilities;

    [TestClass]
    public class PowerShellTest
    {
        protected PowerShell powershell;
        protected string[] modules;

        public PowerShellTest(params string[] modules)
        {
            this.modules = modules;
        }

        protected void AddScenarioScript(string script)
        {
            powershell.AddScript(Testing.GetTestResourceContents(script));
        }

        [TestInitialize]
        public virtual void SetupTest()
        {
            powershell = PowerShell.Create();

            foreach (string moduleName in modules)
            {
                powershell.AddScript(string.Format("Import-Module \"{0}\"", Testing.GetTestResourcePath(moduleName)));
            }

            powershell.AddScript("$VerbosePreference='Continue'");
            powershell.AddScript("$DebugPreference='Continue'");
        }

        [TestCleanup]
        public virtual void TestCleanup()
        {
            powershell.Dispose();
        }
    }
}

Enable debug by default in scenario tests


<?xml version="1.0"?>
<!-- RSS generated by Trac v<?cs var:trac.version ?> on <?cs var:trac.time ?> -->
<rss version="2.0">
 <channel><?cs
  if:project.name_encoded ?>
   <title><?cs var:project.name_encoded ?>: Revisions of <?cs var:log.path ?></title><?cs
  else ?>
   <title>Revisions of <?cs var:log.path ?></title><?cs
  /if ?>
  <link><?cs var:base_host ?><?cs var:log.log_href ?></link>
  <description>Trac Log - Revisions of <?cs var:log.path ?></description>
  <language>en-us</language>
  <generator>Trac v<?cs var:trac.version ?></generator><?cs
  each:item = log.items ?><?cs
   with:change = log.changes[item.rev] ?>
    <item>
     <author><?cs var:change.author ?></author>
     <pubDate><?cs var:change.date ?></pubDate>
     <title>Revision <?cs var:item.rev ?>: <?cs var:change.shortlog ?></title>
     <link><?cs var:base_host ?><?cs var:item.changeset_href ?></link>
     <description><?cs var:change.message ?></description>
     <category>Report</category>
    </item><?cs
   /with ?><?cs
  /each ?>
 </channel>
</rss>

<?xml version="1.0"?>
<!-- RSS generated by Trac v<?cs var:trac.version ?> on <?cs var:trac.time ?> -->
<rss version="2.0">
 <channel><?cs
  if:project.name_encoded ?>
   <title><?cs var:project.name_encoded ?>: Revisions of <?cs var:log.path ?></title><?cs
  else ?>
   <title>Revisions of <?cs var:log.path ?></title><?cs
  /if ?>
  <link><?cs var:base_host ?><?cs var:log.log_href ?></link>
  <description>Trac Log - Revisions of <?cs var:log.path ?></description>
  <language>en-us</language>
  <generator>Trac v<?cs var:trac.version ?></generator><?cs
  each:item = log.items ?><?cs
   with:change = log.changes[item.rev] ?>
    <item>
     <author><?cs var:change.author ?></author>
     <pubDate><?cs var:change.date ?></pubDate>
     <title>Revision <?cs var:item.rev ?>: <?cs var:change.shortlog ?></title>
     <link><?cs var:base_host ?><?cs var:item.changeset_href ?></link>
     <description><?cs var:change.message ?></description>
     <category>Log</category>
    </item><?cs
   /with ?><?cs
  /each ?>
 </channel>
</rss>

Fix category of revision log RSS feeds.

Fix category of revision log RSS feeds.

git-svn-id: 0d96b0c1a6983ccc08b3732614f4d6bfcf9cbb42@2261 af82e41b-90c4-0310-8c96-b1721e28e2e2


using System.ComponentModel;

namespace SFA.DAS.EAS.Account.Api.Types
{
    public enum EmployerAgreementStatus
    {
        [Description("Not signed")]
        Pending = 1,
        [Description("Signed")]
        Signed = 2,
        [Description("Expired")]
        Expired = 3,
        [Description("Superceded")]
        Superceded = 4
    }
}

using System.ComponentModel;

namespace SFA.DAS.EAS.Account.Api.Types
{
    public enum EmployerAgreementStatus
    {
        [Description("Not signed")]
        Pending = 1,
        [Description("Signed")]
        Signed = 2,
        [Description("Expired")]
        Expired = 3,
        [Description("Superseded")]
        Superceded = 4
    }
}

Update spelling mistake in api types

Update spelling mistake in api types


using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Threading;

namespace Countdown.Views
{
    internal class ScrollTo
    {
        public static void SetItem(UIElement element, object value)
        {
            element.SetValue(ItemProperty, value);
        }

        public static object GetItem(UIElement element)
        {
            return element.GetValue(ItemProperty);
        }

        public static readonly DependencyProperty ItemProperty =
            DependencyProperty.RegisterAttached("Item",
                typeof(object),
                typeof(ScrollTo),
                new FrameworkPropertyMetadata(OnScrollToItemPropertyChanged));

        private static void OnScrollToItemPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            if ((e.NewValue is not null) && (source is ListBox list))
            {
                list.SelectedItem = e.NewValue;

                if (list.IsGrouping)
                {
                    // Work around a bug that stops ScrollIntoView() working on Net5.0
                    // see https://github.com/dotnet/wpf/issues/4797

                    _ = list.Dispatcher.BeginInvoke(DispatcherPriority.Loaded,
                                                        new Action(() => list.ScrollIntoView(e.NewValue)));
                }
                else
                {
                    list.ScrollIntoView(e.NewValue);
                }
            }
        }
    }
}

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Threading;

namespace Countdown.Views
{
    internal class ScrollTo
    {
        public static void SetItem(UIElement element, object value)
        {
            element.SetValue(ItemProperty, value);
        }

        public static object GetItem(UIElement element)
        {
            return element.GetValue(ItemProperty);
        }

        public static readonly DependencyProperty ItemProperty =
            DependencyProperty.RegisterAttached("Item",
                typeof(object),
                typeof(ScrollTo),
                new FrameworkPropertyMetadata(OnScrollToItemPropertyChanged));

        private static void OnScrollToItemPropertyChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            if ((e.NewValue is not null) && (source is ListBox list))
            {
                list.SelectedItem = e.NewValue;

                if (list.IsGrouping)
                {
                    // Work around a bug that stops ScrollIntoView() working on Net5.0
                    // see https://github.com/dotnet/wpf/issues/4797

                    _ = list.Dispatcher.BeginInvoke(DispatcherPriority.Loaded,
                                                        new Action(() =>
                                                            {
                                                                list.ScrollIntoView(e.NewValue);
                                                                _ = list.Focus();
                                                            }));
                }
                else
                {
                    list.ScrollIntoView(e.NewValue);
                    _ = list.Focus();
                }

            }
        }
    }
}

Add a list focus call

Add a list focus call

If the item is important enough to scroll it into view then its container should also get focus.


using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;

namespace BatteryCommander.Web.Models
{
    public class EvaluationListViewModel
    {
        public IEnumerable<Evaluation> Evaluations { get; set; } = Enumerable.Empty<Evaluation>();

        [Display(Name = "Delinquent > 60 Days")]
        public int Delinquent => Evaluations.Where(_ => _.IsDelinquent).Count();

        public int Due => Evaluations.Where(_ => !_.IsDelinquent).Where(_ => _.ThruDate < DateTime.Today).Count();

        [Display(Name = "Next 30")]
        public int Next30 => Evaluations.Where(_ => 0 <= _.Delinquency.TotalDays && _.Delinquency.TotalDays <= 30).Count();

        [Display(Name = "Next 60")]
        public int Next60 => Evaluations.Where(_ => 30 < _.Delinquency.TotalDays && _.Delinquency.TotalDays <= 60).Count();

        [Display(Name = "Next 90")]
        public int Next90 => Evaluations.Where(_ => 60 < _.Delinquency.TotalDays && _.Delinquency.TotalDays <= 90).Count();
    }
}

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;

namespace BatteryCommander.Web.Models
{
    public class EvaluationListViewModel
    {
        public IEnumerable<Evaluation> Evaluations { get; set; } = Enumerable.Empty<Evaluation>();

        [Display(Name = "Delinquent > 60 Days")]
        public int Delinquent => Evaluations.Where(_ => !_.IsCompleted).Where(_ => _.IsDelinquent).Count();

        public int Due => Evaluations.Where(_ => !_.IsCompleted).Where(_ => !_.IsDelinquent).Where(_ => _.ThruDate < DateTime.Today).Count();

        [Display(Name = "Next 30")]
        public int Next30 => Evaluations.Where(_ => !_.IsCompleted).Where(_ => 0 <= _.Delinquency.TotalDays && _.Delinquency.TotalDays <= 30).Count();

        [Display(Name = "Next 60")]
        public int Next60 => Evaluations.Where(_ => !_.IsCompleted).Where(_ => 30 < _.Delinquency.TotalDays && _.Delinquency.TotalDays <= 60).Count();

        [Display(Name = "Next 90")]
        public int Next90 => Evaluations.Where(_ => !_.IsCompleted).Where(_ => 60 < _.Delinquency.TotalDays && _.Delinquency.TotalDays <= 90).Count();
    }
}

Make sure to take into account completed when looking at ALL


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Luval.Common;

namespace Luval.Orm
{
    public class SqlServerLanguageProvider : AnsiSqlLanguageProvider
    {
        public SqlServerLanguageProvider() : this(DbConfiguration.Get<ISqlExpressionProvider>(), DbConfiguration.Get<IObjectAccesor>())
        {

        }

        public SqlServerLanguageProvider(ISqlExpressionProvider expressionProvider, IObjectAccesor objectAccesor) : base(expressionProvider, new SqlServerDialectProvider(), objectAccesor)
        {
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Luval.Common;

namespace Luval.Orm
{
    public class SqlServerLanguageProvider : AnsiSqlLanguageProvider
    {
        public SqlServerLanguageProvider() : this(DbConfiguration.Get<ISqlExpressionProvider>(), DbConfiguration.Get<IObjectAccesor>())
        {

        }

        public SqlServerLanguageProvider(ISqlExpressionProvider expressionProvider, IObjectAccesor objectAccesor) : base(expressionProvider, new SqlServerDialectProvider(), objectAccesor)
        {
        }

        public override string GetLastIdentityInsert()
        {
            return "SELECT SCOPE_IDENTITY()";
        }
    }
}

Fix bug in the Sql Server implementation


@model IEnumerable<Discord.WebSocket.SocketGuild>

				@Html.DisplayName("GuildId")

				@Html.DisplayName("GuildName")

		@foreach(var guild in Model) {

					@Html.DisplayFor(modelItem => guild.Id)

					@Html.DisplayFor(modelItem => guild.Name)

					Details

		}

@model IEnumerable<Discord.WebSocket.SocketGuild>

	@foreach(var guild in Model) {
		@guild.Name
	}

Use list-group instead of a table.

Use list-group instead of a table.


using System;
using System.Web.Mvc;
using System.Web.Routing;
using Castle.MicroKernel;

namespace SnittListan.IoC
{
	public class WindsorControllerFactory : DefaultControllerFactory
	{
		private readonly IKernel kernel;

		public WindsorControllerFactory(IKernel kernel)
		{
			this.kernel = kernel;
		}

		public override IController CreateController(RequestContext requestContext, string controllerName)
		{
			if (requestContext == null)
			{
				throw new ArgumentNullException("requestContext");
			}

			if (controllerName == null)
			{
				throw new ArgumentNullException("controllerName");
			}

			try
			{
				return kernel.Resolve<IController>(controllerName + "controller");
			}
			catch (ComponentNotFoundException ex)
			{
				throw new ApplicationException(string.Format("No controller with name '{0}' found", controllerName), ex);
			}
		}

		public override void ReleaseController(IController controller)
		{
			if (controller == null)
			{
				throw new ArgumentNullException("controller");
			}

			kernel.ReleaseComponent(controller);
		}
	}
}

using System;
using System.Web.Mvc;
using System.Web.Routing;
using Castle.MicroKernel;
using System.Web;

namespace SnittListan.IoC
{
	public class WindsorControllerFactory : DefaultControllerFactory
	{
		private readonly IKernel kernel;

		public WindsorControllerFactory(IKernel kernel)
		{
			this.kernel = kernel;
		}

		public override IController CreateController(RequestContext requestContext, string controllerName)
		{
			if (requestContext == null)
			{
				throw new ArgumentNullException("requestContext");
			}

			if (controllerName == null)
			{
				throw new HttpException(404, string.Format("The controller path '{0}' could not be found.", controllerName));
			}

			try
			{
				return kernel.Resolve<IController>(controllerName + "controller");
			}
			catch (ComponentNotFoundException ex)
			{
				throw new ApplicationException(string.Format("No controller with name '{0}' found", controllerName), ex);
			}
		}

		public override void ReleaseController(IController controller)
		{
			if (controller == null)
			{
				throw new ArgumentNullException("controller");
			}

			kernel.ReleaseComponent(controller);
		}
	}
}

Throw HttpException when trying to resolve unknown controller


using System.Security.Cryptography.X509Certificates;
using PeNet.Structures;

namespace PeNet.Parser
{
    internal class PKCS7Parser : SafeParser<X509Certificate2>
    {
        private readonly WIN_CERTIFICATE _winCertificate;

        internal PKCS7Parser(WIN_CERTIFICATE winCertificate)
            : base(null, 0)
        {
            _winCertificate = winCertificate;
        }

        protected override X509Certificate2 ParseTarget()
        {
            if (_winCertificate?.wCertificateType !=
                (ushort) Constants.WinCertificateType.WIN_CERT_TYPE_PKCS_SIGNED_DATA)
            {
                return null;
            }

            var cert = _winCertificate.bCertificate;
            return new X509Certificate2(cert);
        }
    }
}

using System.Security.Cryptography.X509Certificates;
using PeNet.Structures;

namespace PeNet.Parser
{
    internal class PKCS7Parser : SafeParser<X509Certificate2>
    {
        private readonly WIN_CERTIFICATE _winCertificate;

        internal PKCS7Parser(WIN_CERTIFICATE winCertificate)
            : base(null, 0)
        {
            _winCertificate = winCertificate;
        }

        protected override X509Certificate2 ParseTarget()
        {
            if (_winCertificate?.wCertificateType !=
                (ushort) Constants.WinCertificateType.WIN_CERT_TYPE_PKCS_SIGNED_DATA)
            {
                return null;
            }

            var pkcs7 = _winCertificate.bCertificate;

            var collection = new X509Certificate2Collection();
            collection.Import(pkcs7);

            if (collection.Count == 0)
                return null;

            return collection[0];
        }
    }
}

Use collection of certificates to parse pkcs7


using System;
using Microsoft.CodeAnalysis.Scripting;
using Microsoft.CodeAnalysis.CSharp.Scripting;

namespace ScriptSharp.ScriptEngine
{
    public class CSharpScriptEngine
    {
        private static ScriptState<object> scriptState = null;
        public static object Execute(string code)
        {
            scriptState = scriptState == null ? CSharpScript.RunAsync(code).Result : scriptState.ContinueWithAsync(code).Result;
            if (scriptState.ReturnValue != null && !string.IsNullOrEmpty(scriptState.ReturnValue.ToString()))
                return scriptState.ReturnValue;
            return "";
        }
    }
}

using System;
using Microsoft.CodeAnalysis.Scripting;
using Microsoft.CodeAnalysis.CSharp.Scripting;

namespace ScriptSharp.ScriptEngine
{
    public class CSharpScriptEngine
    {
        private static ScriptState<object> scriptState = null;
        public static object Execute(string code)
        {
            scriptState = scriptState == null ? CSharpScript.RunAsync(code).Result : scriptState.ContinueWithAsync(code).Result;
            if (scriptState.ReturnValue != null && !string.IsNullOrEmpty(scriptState.ReturnValue.ToString()))
                return scriptState.ReturnValue;
            return null;
        }
    }
}

Change return type of script engine

Change return type of script engine


using Starcounter;
using System;

namespace RealEstateAgencyFranchise.Controllers
{
    internal class OfficeController
    {
        public Json Get(long officeObjectNo)
        {
            throw new NotImplementedException();
        }
    }
}

using RealEstateAgencyFranchise.Database;
using Starcounter;
using System.Linq;

namespace RealEstateAgencyFranchise.Controllers
{
    internal class OfficeController
    {
        public Json Get(ulong officeObjectNo)
        {
            return Db.Scope(() =>
            {
                var offices = Db.SQL<Office>(
                    "select o from Office o where o.ObjectNo = ?",
                    officeObjectNo);
                if (offices == null || !offices.Any())
                {
                    return new Response()
                    {
                        StatusCode = 404,
                        StatusDescription = "Office not found"
                    };
                }

                var office = offices.First;

                var json = new OfficeListJson
                {
                    Data = office
                };

                if (Session.Current == null)
                {
                    Session.Current = new Session(SessionOptions.PatchVersioning);
                }

                json.Session = Session.Current;
                return json;
            });
        }
    }
}

Implement getting data for office details


using System;

namespace Criteo.Profiling.Tracing.Utils
{
    internal static class TimeUtils
    {

        private static readonly DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);

        public static DateTime UtcNow
        {
            get
            {
                return HighResolutionDateTime.IsAvailable ? HighResolutionDateTime.UtcNow : DateTime.UtcNow;
            }
        }

        /// <summary>
        /// Create a UNIX timestamp from a UTC date time. Time is expressed in microseconds and not seconds.
        /// </summary>
        /// <see href="https://en.wikipedia.org/wiki/Unix_time"/>
        /// <param name="utcDateTime"></param>
        /// <returns></returns>
        public static long ToUnixTimestamp(DateTime utcDateTime)
        {
            return (long)(utcDateTime.Subtract(Epoch).TotalMilliseconds * 1000L);
        }
    }
}

using System;

namespace Criteo.Profiling.Tracing.Utils
{
    public static class TimeUtils
    {

        private static readonly DateTime Epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);

        public static DateTime UtcNow
        {
            get
            {
                return HighResolutionDateTime.IsAvailable ? HighResolutionDateTime.UtcNow : DateTime.UtcNow;
            }
        }

        /// <summary>
        /// Create a UNIX timestamp from a UTC date time. Time is expressed in microseconds and not seconds.
        /// </summary>
        /// <see href="https://en.wikipedia.org/wiki/Unix_time"/>
        /// <param name="utcDateTime"></param>
        /// <returns></returns>
        public static long ToUnixTimestamp(DateTime utcDateTime)
        {
            return (long)(utcDateTime.Subtract(Epoch).TotalMilliseconds * 1000L);
        }
    }
}

Change time utils visibility from internal to public

Change-Id: Ifc984cd613e3daeea243467392652c5efd9ba34b


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

using SharpGraphEditor.Graph.Core.Elements;

namespace SharpGraphEditor.Graph.Core.Algorithms
{
    public class DepthFirstSearchAlgorithm : IAlgorithm
    {
        public string Name => "Depth first search";

        public string Description => "Depth first search";

        public void Run(IGraph graph, AlgorithmParameter p)
        {
            if (graph.Vertices.Count() == 0)
            {
                return;
            }

            graph.ChangeColor(graph.Vertices.ElementAt(0), VertexColor.Gray);
            var dfs = new Helpers.DepthFirstSearch(graph)
            {
                ProcessEdge = (v1, v2) =>
                {
                    graph.ChangeColor(v2, VertexColor.Gray);
                },
                ProcessVertexLate = (v) =>
                {
                    graph.ChangeColor(v, VertexColor.Black);
                }
            };
            dfs.Run(graph.Vertices.First());
        }
    }
}

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

using SharpGraphEditor.Graph.Core.Elements;

namespace SharpGraphEditor.Graph.Core.Algorithms
{
    public class DepthFirstSearchAlgorithm : IAlgorithm
    {
        public string Name => "Depth first search";

        public string Description => "Depth first search";

        public void Run(IGraph graph, AlgorithmParameter p)
        {
            if (graph.Vertices.Count() == 0)
            {
                return;
            }

            graph.ChangeColor(graph.Vertices.ElementAt(0), VertexColor.Gray);
            var dfs = new Helpers.DepthFirstSearch(graph)
            {
                ProcessEdge = (v1, v2) =>
                {
                    if (v2.Color != VertexColor.Gray)
                    {
                        graph.ChangeColor(v2, VertexColor.Gray);
                    }
                },
                ProcessVertexLate = (v) =>
                {
                    graph.ChangeColor(v, VertexColor.Black);
                }
            };
            dfs.Run(graph.Vertices.First());
        }
    }
}

Fix bug with DFS when some vertices painted in gray twice


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

[assembly: AssemblyTitle("Autofac.Extras.AggregateService")]
[assembly: AssemblyDescription("Autofac Aggregate Service Module")]
[assembly: ComVisible(false)]

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

[assembly: AssemblyTitle("Autofac.Extras.AggregateService")]
[assembly: ComVisible(false)]

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


using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using NLog;
using SFA.DAS.EmployerApprenticeshipsService.Domain.Configuration;
using SFA.DAS.EmployerApprenticeshipsService.Domain.Interfaces;

namespace SFA.DAS.EmployerApprenticeshipsService.Infrastructure.Services
{
    public class HttpClientWrapper : IHttpClientWrapper
    {
        private readonly ILogger _logger;
        private readonly EmployerApprenticeshipsServiceConfiguration _configuration;

        public HttpClientWrapper(ILogger logger, EmployerApprenticeshipsServiceConfiguration configuration)
        {
            _logger = logger;
            _configuration = configuration;
        }

        public async Task<string> SendMessage<T>(T content, string url)
        {
            try
            {
                using (var httpClient = CreateHttpClient())
                {
                    var serializeObject = JsonConvert.SerializeObject(content);
                    var response = await httpClient.SendAsync(new HttpRequestMessage(HttpMethod.Post, url)
                    {
                        Content = new StringContent(serializeObject, Encoding.UTF8, "application/json")
                    });

                    return response.Content.ToString();
                }
            }
            catch (Exception ex)
            {
                _logger.Error(ex);
            }

            return null;
        }

        private HttpClient CreateHttpClient()
        {
            return new HttpClient
            {
                BaseAddress = new Uri(_configuration.Hmrc.BaseUrl)
            };
        }
    }
}

using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using NLog;
using SFA.DAS.EmployerApprenticeshipsService.Domain.Configuration;
using SFA.DAS.EmployerApprenticeshipsService.Domain.Interfaces;

namespace SFA.DAS.EmployerApprenticeshipsService.Infrastructure.Services
{
    public class HttpClientWrapper : IHttpClientWrapper
    {
        private readonly ILogger _logger;
        private readonly EmployerApprenticeshipsServiceConfiguration _configuration;

        public HttpClientWrapper(ILogger logger, EmployerApprenticeshipsServiceConfiguration configuration)
        {
            _logger = logger;
            _configuration = configuration;
        }

        public async Task<string> SendMessage<T>(T content, string url)
        {
            try
            {
                using (var httpClient = CreateHttpClient())
                {

                    var serializeObject = JsonConvert.SerializeObject(content);
                    var response = await httpClient.SendAsync(new HttpRequestMessage(HttpMethod.Post, url)
                    {
                        Content = new StringContent(serializeObject, Encoding.UTF8, "application/json")
                    });

                    return await response.Content.ReadAsStringAsync();
                }
            }
            catch (Exception ex)
            {
                _logger.Error(ex);
            }

            return null;
        }

        private HttpClient CreateHttpClient()
        {
            return new HttpClient
            {
                BaseAddress = new Uri(_configuration.Hmrc.BaseUrl)
            };
        }
    }
}

Change httpclientwrapper to return the content as string async.


using System;
using RestSharp;
using Newtonsoft.Json;
using RestSharp.Portable;
using RestSharp.Portable.Authenticators;
using RestSharp.Portable.HttpClient;

namespace AsterNET.ARI.Middleware.Default
{
    public class Command : IRestCommand
    {
        internal RestClient Client;
        internal RestRequest Request;

        public Command(StasisEndpoint info, string path)
        {
            Client = new RestClient(info.AriEndPoint)
            {
                Authenticator = new HttpBasicAuthenticator(info.Username, info.Password)
            };
            Request = new RestRequest(path);
        }

        public string UniqueId { get; set; }
        public string Url { get; set; }

        public string Method
        {
            get { return Request.Method.ToString(); }
            set { Request.Method = (RestSharp.Portable.Method) Enum.Parse(typeof (RestSharp.Portable.Method), value); }
        }

        public string Body { get; private set; }

        public void AddUrlSegment(string segName, string value)
        {
            Request.AddUrlSegment(segName, value);
        }

        public void AddParameter(string name, object value, Middleware.ParameterType type)
        {
            if (type == ParameterType.RequestBody)
            {
                Request.Serializer = new RestSharp.Portable.Serializers.JsonSerializer();
                Request.AddParameter(name, JsonConvert.SerializeObject(value), (RestSharp.Portable.ParameterType)Enum.Parse(typeof(RestSharp.Portable.ParameterType), type.ToString()));
            }
            else
            {
                Request.AddParameter(name, value, (RestSharp.Portable.ParameterType)Enum.Parse(typeof(RestSharp.Portable.ParameterType), type.ToString()));
            }
        }
    }
}

using System;
using RestSharp.Portable;
using RestSharp.Portable.Authenticators;
using RestSharp.Portable.HttpClient;

namespace AsterNET.ARI.Middleware.Default
{
    public class Command : IRestCommand
    {
        internal RestClient Client;
        internal RestRequest Request;

        public Command(StasisEndpoint info, string path)
        {
            Client = new RestClient(info.AriEndPoint)
            {
                Authenticator = new HttpBasicAuthenticator(info.Username, info.Password)
            };

            Request = new RestRequest(path) {Serializer = new RestSharp.Portable.Serializers.JsonSerializer()};
        }

        public string UniqueId { get; set; }
        public string Url { get; set; }

        public string Method
        {
            get { return Request.Method.ToString(); }
            set { Request.Method = (RestSharp.Portable.Method) Enum.Parse(typeof (RestSharp.Portable.Method), value); }
        }

        public string Body { get; private set; }

        public void AddUrlSegment(string segName, string value)
        {
            Request.AddUrlSegment(segName, value);
        }

        public void AddParameter(string name, object value, Middleware.ParameterType type)
        {
            Request.AddParameter(name, value, (RestSharp.Portable.ParameterType)Enum.Parse(typeof(RestSharp.Portable.ParameterType), type.ToString()));
        }
    }
}

Fix bug with double serialization

Fix bug with double serialization


using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Random = UnityEngine.Random;
using Object = UnityEngine.Object;

[CreateAssetMenu(fileName = "Example.asset", menuName = "New Example ScriptableObject")]
public class ScriptableObjectExample : ScriptableObject
{
    [EasyButtons.Button]
    public void SayHello()
    {
        Debug.Log("Hello");
    }
}

using UnityEngine;

[CreateAssetMenu(fileName = "Example.asset", menuName = "New Example ScriptableObject")]
public class ScriptableObjectExample : ScriptableObject
{
    [EasyButtons.Button]
    public void SayHello()
    {
        Debug.Log("Hello");
    }
}

Remove unnecessary usings in example script


using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using ExpressionToCodeLib;
using Xunit;

namespace ExpressionToCodeTest {
    public class ValueTupleTests {
        [Fact]
        public void ExpressionCompileValueTupleEqualsWorks() {
            var tuple = (1, 3);
            var tuple2 = (1, "123".Length);
            Expression<Func<bool>> expr = () => tuple.Equals(tuple2);
            Assert.True(expr.Compile()());
        }

        [Fact]
        public void FastExpressionCompileValueTupleEqualsWorks() {
            var tuple = (1, 3);
            (int, int Length) tuple2 = (1, "123".Length);
            ValueTuple<int,int> x;
            var expr = FastExpressionCompiler.ExpressionCompiler.Compile(() => tuple.Equals(tuple2));
            Assert.True(expr());
        }

        [Fact]
        public void AssertingOnValueTupleEqualsWorks() {
            var tuple = (1, 3);
            var tuple2 = (1, "123".Length);
            Expression<Func<bool>> expr = () => tuple.Equals(tuple2);
            Assert.True(expr.Compile()());
            PAssert.That(() => tuple.Equals(tuple2));
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using ExpressionToCodeLib;
using Xunit;

namespace ExpressionToCodeTest {
    public class ValueTupleTests {
        [Fact]
        public void ExpressionWithValueTupleEqualsCanCompile() {
            var tuple = (1, 3);
            var tuple2 = (1, "123".Length);

            Expression<Func<int>> ok1 = () => tuple.Item1;
            Expression<Func<int>> ok2 = () => tuple.GetHashCode();
            Expression<Func<Tuple<int, int>>> ok3 = () => tuple.ToTuple();
            ok1.Compile();
            ok2.Compile();
            ok3.Compile();

            Expression<Func<bool>> err1 = () => tuple.Equals(tuple2);
            Expression<Func<int>> err2 = () => tuple.CompareTo(tuple2);
            err1.Compile();//crash
            err2.Compile();//crash
        }

        [Fact]
        public void FastExpressionCompileValueTupleEqualsWorks() {
            var tuple = (1, 3);
            (int, int Length) tuple2 = (1, "123".Length);
            var expr = FastExpressionCompiler.ExpressionCompiler.Compile(() => tuple.Equals(tuple2));
            Assert.True(expr());
        }

        [Fact]
        public void AssertingOnValueTupleEqualsWorks() {
            var tuple = (1, 3);
            var tuple2 = (1, "123".Length);
            Expression<Func<bool>> expr = () => tuple.Equals(tuple2);
            Assert.True(expr.Compile()());
            PAssert.That(() => tuple.Equals(tuple2));
        }
    }
}

Rearrange test to better self-document what currently works and what does not.


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

using osu.Game.Rulesets.Objects.Types;
using osu.Game.Database;
using osu.Game.Beatmaps.ControlPoints;

namespace osu.Game.Rulesets.Osu.Objects
{
    public class Spinner : OsuHitObject, IHasEndTime
    {
        public double EndTime { get; set; }
        public double Duration => EndTime - StartTime;

        /// <summary>
        /// Number of spins required to finish the spinner without miss.
        /// </summary>
        public int SpinsRequired { get; protected set; } = 1;

        public override bool NewCombo => true;

        public override void ApplyDefaults(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
        {
            base.ApplyDefaults(controlPointInfo, difficulty);

            SpinsRequired = (int)(Duration / 1000 * BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 3, 5, 7.5));
        }
    }
}

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

using osu.Game.Rulesets.Objects.Types;
using osu.Game.Database;
using osu.Game.Beatmaps.ControlPoints;

namespace osu.Game.Rulesets.Osu.Objects
{
    public class Spinner : OsuHitObject, IHasEndTime
    {
        public double EndTime { get; set; }
        public double Duration => EndTime - StartTime;

        /// <summary>
        /// Number of spins required to finish the spinner without miss.
        /// </summary>
        public int SpinsRequired { get; protected set; } = 1;

        public override bool NewCombo => true;

        public override void ApplyDefaults(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty)
        {
            base.ApplyDefaults(controlPointInfo, difficulty);

            SpinsRequired = (int)(Duration / 1000 * BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 3, 5, 7.5));

            // spinning doesn't match 1:1 with stable, so let's fudge them easier for the time being.
            SpinsRequired = (int)(SpinsRequired * 0.6);
        }
    }
}

Make spinners easier for now

Make spinners easier for now

The underlying spin counting doesn't match stabnle, so they have been near impossible to complete until now.


// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using Microsoft.VisualStudio.Editor.Razor;
using Microsoft.VisualStudio.Text.Editor;
using MonoDevelop.Ide.CodeCompletion;

namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor.Editor
{
    internal class DefaultVisualStudioCompletionBroker : VisualStudioCompletionBroker
    {
        public override bool IsCompletionActive(ITextView textView)
        {
            if (textView == null)
            {
                throw new ArgumentNullException(nameof(textView));
            }

            if (textView.HasAggregateFocus)
            {
                return CompletionWindowManager.IsVisible ||
                                              (textView.Properties.TryGetProperty<bool>("RoslynCompletionPresenterSession.IsCompletionActive", out var visible)
                                               && visible);
            }

            // Text view does not have focus, if the completion window is visible it's for a different text view.
            return false;
        }
    }
}

// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using Microsoft.VisualStudio.Editor.Razor;
using Microsoft.VisualStudio.Text.Editor;
using MonoDevelop.Ide.CodeCompletion;

namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor.Editor
{
    internal class DefaultVisualStudioCompletionBroker : VisualStudioCompletionBroker
    {
        private const string IsCompletionActiveKey = "RoslynCompletionPresenterSession.IsCompletionActive";

        public override bool IsCompletionActive(ITextView textView)
        {
            if (textView == null)
            {
                throw new ArgumentNullException(nameof(textView));
            }

            if (!textView.HasAggregateFocus)
            {
                // Text view does not have focus, if the completion window is visible it's for a different text view.
                return false;
            }

            if (CompletionWindowManager.IsVisible)
            {
                return true;
            }

            if (textView.Properties.TryGetProperty<bool>(IsCompletionActiveKey, out var visible))
            {
                return visible;
            }

            return false;
        }
    }
}

Clean up mac completion broker.

Clean up mac completion broker.


using Contentful.Core.Configuration;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;

namespace Contentful.Core.Models.Management
{
    [JsonConverter(typeof(EditorInterfaceControlJsonConverter))]
    public class EditorInterfaceControl
    {
        public string FieldId { get; set; }
        public string WidgetId { get; set; }
        public EditorInterfaceControlSettings Settings { get; set; }
    }
}

using Contentful.Core.Configuration;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;

namespace Contentful.Core.Models.Management
{
    [JsonConverter(typeof(EditorInterfaceControlJsonConverter))]
    public class EditorInterfaceControl
    {
        public string FieldId { get; set; }
        public string WidgetId { get; set; }
        [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
        public EditorInterfaceControlSettings Settings { get; set; }
    }
}

Add null handling for editorinterface settings


// AssemblyInfo.cs
// Script#/Libraries/CoreLib
// This source code is subject to terms and conditions of the Apache License, Version 2.0.
//

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

[assembly: AssemblyTitle("mscorlib")]
[assembly: AssemblyDescription("Script# Core Assembly")]
[assembly: ScriptAssembly("core")]

// AssemblyInfo.cs
// Script#/Libraries/CoreLib
// This source code is subject to terms and conditions of the Apache License, Version 2.0.
//

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

[assembly: AssemblyTitle("mscorlib")]
[assembly: AssemblyDescription("Script# Core Assembly")]
[assembly: ScriptAssembly("ss")]

Update mscorlib assembly name to match eventual module name


// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using Microsoft.VisualStudio.Shell;

// Add binding redirects for each assembly we ship in VS. This is required so that these assemblies show
// up in the Load context, which means that we can use ServiceHub and other nice things.
[assembly: ProvideBindingRedirection(
    AssemblyName = "Microsoft.AspNetCore.Blazor.AngleSharp",
    GenerateCodeBase = true,
    PublicKeyToken = "",
    OldVersionLowerBound = "0.0.0.0",
    OldVersionUpperBound = "0.9.9.0",
    NewVersion = "0.9.9.0")]
[assembly: ProvideBindingRedirection(
    AssemblyName = "Microsoft.AspNetCore.Blazor.Razor.Extensions",
    GenerateCodeBase = true,
    PublicKeyToken = "",
    OldVersionLowerBound = "0.0.0.0",
    OldVersionUpperBound = "1.0.0.0",
    NewVersion = "1.0.0.0")]
[assembly: ProvideBindingRedirection(
    AssemblyName = "Microsoft.VisualStudio.LanguageServices.Blazor",
    GenerateCodeBase = true,
    PublicKeyToken = "",
    OldVersionLowerBound = "0.0.0.0",
    OldVersionUpperBound = "1.0.0.0",
    NewVersion = "1.0.0.0")]

// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using Microsoft.VisualStudio.Shell;

// Add binding redirects for each assembly we ship in VS. This is required so that these assemblies show
// up in the Load context, which means that we can use ServiceHub and other nice things.
[assembly: ProvideBindingRedirection(
    AssemblyName = "Microsoft.VisualStudio.LanguageServices.Blazor",
    GenerateCodeBase = true,
    PublicKeyToken = "",
    OldVersionLowerBound = "0.0.0.0",
    OldVersionUpperBound = "1.0.0.0",
    NewVersion = "1.0.0.0")]

Remove binding redirects for missing assemblies


using System;
using NUnit.Framework;

namespace Atata.Tests
{
    public class AtataContextBuilderTests : UITestFixtureBase
    {
        [Test]
        public void AtataContextBuilder_Build_WithoutDriver()
        {
            InvalidOperationException exception = Assert.Throws<InvalidOperationException>(() =>
               AtataContext.Configure().Build());

            Assert.That(exception.Message, Does.Contain("no driver is specified"));
        }

        [Test]
        public void AtataContextBuilder_OnDriverCreated()
        {
            int executionsCount = 0;

            AtataContext.Configure().
                UseChrome().
                OnDriverCreated(driver =>
                {
                    executionsCount++;
                }).
                Build();

            Assert.That(executionsCount, Is.EqualTo(1));
        }

        [Test]
        public void AtataContextBuilder_OnDriverCreated_RestartDriver()
        {
            int executionsCount = 0;

            AtataContext.Configure().
                UseChrome().
                OnDriverCreated(() =>
                {
                    executionsCount++;
                }).
                Build();

            AtataContext.Current.RestartDriver();

            Assert.That(executionsCount, Is.EqualTo(2));
        }
    }
}

using System;
using NUnit.Framework;

namespace Atata.Tests
{
    public class AtataContextBuilderTests : UITestFixtureBase
    {
        [Test]
        public void AtataContextBuilder_Build_WithoutDriver()
        {
            InvalidOperationException exception = Assert.Throws<InvalidOperationException>(() =>
               AtataContext.Configure().Build());

            Assert.That(exception.Message, Does.Contain("no driver is specified"));
        }

        [Test]
        public void AtataContextBuilder_OnBuilding()
        {
            int executionsCount = 0;

            AtataContext.Configure().
                UseChrome().
                OnBuilding(() => executionsCount++).
                Build();

            Assert.That(executionsCount, Is.EqualTo(1));
        }

        [Test]
        public void AtataContextBuilder_OnBuilding_WithoutDriver()
        {
            int executionsCount = 0;

            Assert.Throws<InvalidOperationException>(() =>
                AtataContext.Configure().
                    UseDriver(() => null).
                    OnBuilding(() => executionsCount++).
                    Build());

            Assert.That(executionsCount, Is.EqualTo(1));
        }

        [Test]
        public void AtataContextBuilder_OnDriverCreated()
        {
            int executionsCount = 0;

            AtataContext.Configure().
                UseChrome().
                OnDriverCreated(driver => executionsCount++).
                Build();

            Assert.That(executionsCount, Is.EqualTo(1));
        }

        [Test]
        public void AtataContextBuilder_OnDriverCreated_RestartDriver()
        {
            int executionsCount = 0;

            AtataContext.Configure().
                UseChrome().
                OnDriverCreated(() => executionsCount++).
                Build();

            AtataContext.Current.RestartDriver();

            Assert.That(executionsCount, Is.EqualTo(2));
        }
    }
}

Add AtataContextBuilder_OnBuilding and AtataContextBuilder_OnBuilding_WithoutDriver tests


// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.Framework.Configuration;
using Microsoft.Framework.DependencyInjection;

namespace Microsoft.AspNet.Identity
{
    /// <summary>
    /// Default services
    /// </summary>
    public class IdentityEntityFrameworkServices
    {
        public static IServiceCollection GetDefaultServices(Type userType, Type roleType, Type contextType, Type keyType = null, IConfiguration config = null)
        {
            Type userStoreType;
            Type roleStoreType;
            if (keyType != null)
            {
                userStoreType = typeof(UserStore<,,,>).MakeGenericType(userType, roleType, contextType, keyType);
                roleStoreType = typeof(RoleStore<,,>).MakeGenericType(roleType, contextType, keyType);
            }
            else
            {
                userStoreType = typeof(UserStore<,,>).MakeGenericType(userType, roleType, contextType);
                roleStoreType = typeof(RoleStore<,>).MakeGenericType(roleType, contextType);
            }

            var services = new ServiceCollection();
            services.AddScoped(
                typeof(IUserStore<>).MakeGenericType(userType),
                userStoreType);
            services.AddScoped(
                typeof(IRoleStore<>).MakeGenericType(roleType),
                roleStoreType);
            return services;
        }
    }
}

// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.Framework.Configuration;
using Microsoft.Framework.DependencyInjection;

namespace Microsoft.AspNet.Identity
{
    /// <summary>
    /// Default services
    /// </summary>
    public class IdentityEntityFrameworkServices
    {
        public static IServiceCollection GetDefaultServices(Type userType, Type roleType, Type contextType, Type keyType = null)
        {
            Type userStoreType;
            Type roleStoreType;
            if (keyType != null)
            {
                userStoreType = typeof(UserStore<,,,>).MakeGenericType(userType, roleType, contextType, keyType);
                roleStoreType = typeof(RoleStore<,,>).MakeGenericType(roleType, contextType, keyType);
            }
            else
            {
                userStoreType = typeof(UserStore<,,>).MakeGenericType(userType, roleType, contextType);
                roleStoreType = typeof(RoleStore<,>).MakeGenericType(roleType, contextType);
            }

            var services = new ServiceCollection();
            services.AddScoped(
                typeof(IUserStore<>).MakeGenericType(userType),
                userStoreType);
            services.AddScoped(
                typeof(IRoleStore<>).MakeGenericType(roleType),
                roleStoreType);
            return services;
        }
    }
}

Remove extra config param that's not used


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

using System;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2;

namespace osu.Game.Screens.Edit.Setup
{
    internal abstract class LabelledTextBoxWithPopover : LabelledTextBox, IHasPopover
    {
        public abstract Popover GetPopover();

        protected override OsuTextBox CreateTextBox() =>
            new PopoverTextBox
            {
                Anchor = Anchor.Centre,
                Origin = Anchor.Centre,
                RelativeSizeAxes = Axes.X,
                CornerRadius = CORNER_RADIUS,
                OnFocused = this.ShowPopover
            };

        internal class PopoverTextBox : OsuTextBox
        {
            public Action OnFocused;

            protected override bool OnDragStart(DragStartEvent e)
            {
                // This text box is intended to be "read only" without actually specifying that.
                // As such we don't want to allow the user to select its content with a drag.
                return false;
            }

            protected override void OnFocus(FocusEvent e)
            {
                OnFocused?.Invoke();
                base.OnFocus(e);

                GetContainingInputManager().TriggerFocusContention(this);
            }
        }
    }
}

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

using System;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2;

namespace osu.Game.Screens.Edit.Setup
{
    internal abstract class LabelledTextBoxWithPopover : LabelledTextBox, IHasPopover
    {
        public abstract Popover GetPopover();

        protected override OsuTextBox CreateTextBox() =>
            new PopoverTextBox
            {
                Anchor = Anchor.Centre,
                Origin = Anchor.Centre,
                RelativeSizeAxes = Axes.X,
                CornerRadius = CORNER_RADIUS,
                OnFocused = this.ShowPopover
            };

        internal class PopoverTextBox : OsuTextBox
        {
            public Action OnFocused;

            protected override bool OnDragStart(DragStartEvent e)
            {
                // This text box is intended to be "read only" without actually specifying that.
                // As such we don't want to allow the user to select its content with a drag.
                return false;
            }

            protected override void OnFocus(FocusEvent e)
            {
                if (Current.Disabled)
                    return;

                OnFocused?.Invoke();
                base.OnFocus(e);

                GetContainingInputManager().TriggerFocusContention(this);
            }
        }
    }
}

Fix interaction with popover when textbox is disabled


using System.IO;
using System.Linq;

namespace ELFinder.Connector.Drivers.FileSystem.Extensions
{

    /// <summary>
    /// File system info extensions
    /// </summary>
    public static class FIleSystemInfoExtensions
    {

        #region Extension methods

        /// <summary>
        /// Get visible files in directory
        /// </summary>
        /// <param name="info">Directory info</param>
        /// <returns>Result directories</returns>
        public static FileInfo[] GetVisibleFiles(this DirectoryInfo info)
        {

            return info.GetFiles().Where(x => !x.IsHidden()).ToArray();

        }

        /// <summary>
        /// Get visible directories
        /// </summary>
        /// <param name="info">Directory info</param>
        /// <returns>Result directories</returns>
        public static DirectoryInfo[] GetVisibleDirectories(this DirectoryInfo info)
        {
            return info.GetDirectories().Where(x => !x.IsHidden()).ToArray();
        }

        /// <summary>
        /// Get if file is hidden
        /// </summary>
        /// <param name="info">File info</param>
        /// <returns>True/False based on result</returns>
        public static bool IsHidden(this FileSystemInfo info)
        {
            return (info.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden;
        }

        #endregion

    }
}

using System.IO;
using System.Linq;

namespace ELFinder.Connector.Drivers.FileSystem.Extensions
{

    /// <summary>
    /// File system info extensions
    /// </summary>
    public static class FIleSystemInfoExtensions
    {

        #region Extension methods

        /// <summary>
        /// Get visible files in directory
        /// </summary>
        /// <param name="info">Directory info</param>
        /// <returns>Result directories</returns>
        public static FileInfo[] GetVisibleFiles(this DirectoryInfo info)
        {
            try
            {
                return info.GetFiles().Where(x => !x.IsHidden()).ToArray();
            }
            catch (System.Exception)
            {
                return new FileInfo[0];
            }
        }

        /// <summary>
        /// Get visible directories
        /// </summary>
        /// <param name="info">Directory info</param>
        /// <returns>Result directories</returns>
        public static DirectoryInfo[] GetVisibleDirectories(this DirectoryInfo info)
        {
            try
            {
                return info.GetDirectories().Where(x => !x.IsHidden()).ToArray();
            }
            catch (System.Exception)
            {
                return new DirectoryInfo[0];
            }
        }

        /// <summary>
        /// Get if file is hidden
        /// </summary>
        /// <param name="info">File info</param>
        /// <returns>True/False based on result</returns>
        public static bool IsHidden(this FileSystemInfo info)
        {
            return (info.Attributes & FileAttributes.Hidden) == FileAttributes.Hidden;
        }

        #endregion

    }
}

Fix Unable to connect to backend on access denied


// MvxPhoneCallTask.cs
// (c) Copyright Cirrious Ltd. http://www.cirrious.com
// MvvmCross is licensed using Microsoft Public License (Ms-PL)
// Contributions and inspirations noted in readme.md and license.txt
//
// Project Lead - Stuart Lodge, @slodge, me@slodge.com

using System;
using Windows.System;

namespace Cirrious.MvvmCross.Plugins.PhoneCall.WindowsStore
{
    public class MvxPhoneCallTask : IMvxPhoneCallTask
    {
        public void MakePhoneCall(string name, string number)
        {
            // TODO! This is far too skype specific
            // TODO! name/number need looking at
            // this is the best I can do so far...
            var uri = new Uri("skype:" + number + "?call", UriKind.Absolute);
            Launcher.LaunchUriAsync(uri);
        }
    }
}

// MvxPhoneCallTask.cs
// (c) Copyright Cirrious Ltd. http://www.cirrious.com
// MvvmCross is licensed using Microsoft Public License (Ms-PL)
// Contributions and inspirations noted in readme.md and license.txt
//
// Project Lead - Stuart Lodge, @slodge, me@slodge.com

using System;
using Windows.System;

namespace Cirrious.MvvmCross.Plugins.PhoneCall.WindowsStore
{
    public class MvxPhoneCallTask : IMvxPhoneCallTask
    {
        public void MakePhoneCall(string name, string number)
        {
            //The tel URI for Telephone Numbers : http://tools.ietf.org/html/rfc3966
            //Handled by skype
            var uri = new Uri("tel:" + Uri.EscapeDataString(phoneNumber), UriKind.Absolute);
            Launcher.LaunchUriAsync(uri);
        }
    }
}

Use the tel uri in windows store for phone calls

This is handled by Skype but not Skype specific (RFC3966).


using System;
using System.Linq;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;

namespace HealthNet.AspNetCore
{
  public static class HealthNetMiddlewareExtensions
  {
    private static readonly Type VersionProviderType = typeof(IVersionProvider);
    private static readonly Type SystemCheckerType = typeof(ISystemChecker);
    public static IApplicationBuilder UseHealthNet(this IApplicationBuilder builder)
    {
      return builder.UseMiddleware<HealthNetMiddleware>();
    }

    public static IServiceCollection AddHealthNet(this IServiceCollection service)
    {
      return service.AddTransient<HealthCheckService>();
    }

    public static IServiceCollection AddHealthNet<THealthNetConfig>(this IServiceCollection service) where THealthNetConfig : class, IHealthNetConfiguration
    {
      var assembyTypes = typeof(THealthNetConfig).Assembly.GetTypes();

      service.AddSingleton<IHealthNetConfiguration, THealthNetConfig>();

      var versionProvider = assembyTypes
        .FirstOrDefault(x => x.IsClass && !x.IsAbstract && VersionProviderType.IsAssignableFrom(x));

      service.AddSingleton(VersionProviderType, versionProvider ?? typeof(AssemblyFileVersionProvider));

      var systemCheckers = assembyTypes
        .Where(x => x.IsClass && !x.IsAbstract && SystemCheckerType.IsAssignableFrom(x));

      foreach (var checkerType in systemCheckers)
      {
        service.AddTransient(SystemCheckerType, checkerType);
      }

      return service.AddHealthNet();
    }
  }
}

using System;
using System.Linq;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;

namespace HealthNet.AspNetCore
{
  public static class HealthNetMiddlewareExtensions
  {
    private static readonly Type VersionProviderType = typeof(IVersionProvider);
    private static readonly Type SystemCheckerType = typeof(ISystemChecker);
    public static IApplicationBuilder UseHealthNet(this IApplicationBuilder builder)
    {
      return builder.UseMiddleware<HealthNetMiddleware>();
    }

    public static IServiceCollection AddHealthNet(this IServiceCollection service)
    {
      return service.AddTransient<HealthCheckService>();
    }

    public static IServiceCollection AddHealthNet<THealthNetConfig>(this IServiceCollection service, bool autoRegisterCheckers = true) where THealthNetConfig : class, IHealthNetConfiguration
    {
      var assembyTypes = typeof(THealthNetConfig).Assembly.GetTypes();

      service.AddSingleton<IHealthNetConfiguration, THealthNetConfig>();

      var versionProvider = assembyTypes
        .FirstOrDefault(x => x.IsClass && !x.IsAbstract && VersionProviderType.IsAssignableFrom(x));

      service.AddSingleton(VersionProviderType, versionProvider ?? typeof(AssemblyFileVersionProvider));

      if (autoRegisterCheckers)
      {
        var systemCheckers = assembyTypes
          .Where(x => x.IsClass && !x.IsAbstract && SystemCheckerType.IsAssignableFrom(x));

        foreach (var checkerType in systemCheckers)
        {
          service.AddTransient(SystemCheckerType, checkerType);
        }
      }

      return service.AddHealthNet();
    }
  }
}

Allow option to prevent system checkers from being auto registered


using Newtonsoft.Json;
using Telegram.Bot.Types.ReplyMarkups;
using Xunit;

namespace Telegram.Bot.Tests.Unit.Serialization
{
    public class ReplyMarkupSerializationTests
    {
        [Theory(DisplayName = "Should serialize request poll keyboard button")]
        [InlineData(null)]
        [InlineData("regular")]
        [InlineData("quiz")]
        public void Should_Serialize_Request_Poll_Keyboard_Button(string type)
        {
            IReplyMarkup replyMarkup = new ReplyKeyboardMarkup(
                KeyboardButton.WithRequestPoll("Create a poll", type)
            );

            string serializedReplyMarkup = JsonConvert.SerializeObject(replyMarkup);

            string expectedType = string.IsNullOrEmpty(type)
                ? "{}"
                : @$"{{""type"":""{type}""}}";

            Assert.Contains(@$"""request_poll"":{expectedType}", serializedReplyMarkup);
        }
    }
}

using Newtonsoft.Json;
using Telegram.Bot.Types.ReplyMarkups;
using Xunit;

namespace Telegram.Bot.Tests.Unit.Serialization
{
    public class ReplyMarkupSerializationTests
    {
        [Theory(DisplayName = "Should serialize request poll keyboard button")]
        [InlineData(null)]
        [InlineData("regular")]
        [InlineData("quiz")]
        public void Should_Serialize_Request_Poll_Keyboard_Button(string type)
        {
            IReplyMarkup replyMarkup = new ReplyKeyboardMarkup(
                KeyboardButton.WithRequestPoll("Create a poll", type)
            );

            string serializedReplyMarkup = JsonConvert.SerializeObject(replyMarkup);

            string expectedType = string.IsNullOrEmpty(type)
                ? "{}"
                : string.Format(@"{{""type"":""{0}""}}", type);

            Assert.Contains(@$"""request_poll"":{expectedType}", serializedReplyMarkup);
        }
    }
}

Change string formatting due to appveyor failing


using Halforbit.DataStores.FileStores.Implementation;
using Halforbit.DataStores.FileStores.LocalStorage.Implementation;
using Halforbit.Facets.Attributes;
using System;

namespace HalfOrbit.DataStores.FileStores.LocalStorage.Attributes
{
    public class RootPathAttribute : FacetParameterAttribute
    {
        public RootPathAttribute(string value = null, string configKey = null) : base(value, configKey) { }

        public override Type TargetType => typeof(LocalFileStore);

        public override string ParameterName => "rootPath";

        public override Type[] ImpliedTypes => new Type[]
        {
            typeof(FileStoreDataStore<,>)
        };
    }
}

using Halforbit.DataStores.FileStores.Implementation;
using Halforbit.DataStores.FileStores.LocalStorage.Implementation;
using Halforbit.Facets.Attributes;
using System;

namespace Halforbit.DataStores.FileStores.LocalStorage.Attributes
{
    public class RootPathAttribute : FacetParameterAttribute
    {
        public RootPathAttribute(string value = null, string configKey = null) : base(value, configKey) { }

        public override Type TargetType => typeof(LocalFileStore);

        public override string ParameterName => "rootPath";

        public override Type[] ImpliedTypes => new Type[]
        {
            typeof(FileStoreDataStore<,>)
        };
    }
}

Fix a small, old typo

Fix a small, old typo


using System;
using Platform.Data.Core.Pairs;

namespace Platform.Data.Core.Sequences
{
    public struct SequencesOptions // TODO: To use type parameter <TLink> the ILinks<TLink> must contain GetConstants function.
    {
        public ulong SequenceMarkerLink;
        public bool UseCascadeUpdate;
        public bool UseCascadeDelete;
        public bool UseSequenceMarker;
        public bool UseCompression;
        public bool UseGarbageCollection;
        public bool EnforceSingleSequenceVersionOnWrite;
        public bool EnforceSingleSequenceVersionOnRead; // TODO: Реализовать компактификацию при чтении
        public bool UseRequestMarker;
        public bool StoreRequestResults;

        public void InitOptions(ILinks<ulong> links)
        {
            if (SequenceMarkerLink == LinksConstants.Null)
                SequenceMarkerLink = links.Create(LinksConstants.Itself, LinksConstants.Itself);
        }

        public void ValidateOptions()
        {
            if (UseGarbageCollection && !UseSequenceMarker)
                throw new NotSupportedException("To use garbage collection UseSequenceMarker option must be on.");
        }
    }
}

using System;
using Platform.Data.Core.Pairs;

namespace Platform.Data.Core.Sequences
{
    public struct SequencesOptions // TODO: To use type parameter <TLink> the ILinks<TLink> must contain GetConstants function.
    {
        public ulong SequenceMarkerLink;
        public bool UseCascadeUpdate;
        public bool UseCascadeDelete;
        public bool UseSequenceMarker;
        public bool UseCompression;
        public bool UseGarbageCollection;
        public bool EnforceSingleSequenceVersionOnWrite;
        // TODO: Реализовать компактификацию при чтении
        //public bool EnforceSingleSequenceVersionOnRead;
        //public bool UseRequestMarker;
        //public bool StoreRequestResults;

        public void InitOptions(ILinks<ulong> links)
        {
            if (UseSequenceMarker && SequenceMarkerLink == LinksConstants.Null)
                SequenceMarkerLink = links.Create(LinksConstants.Itself, LinksConstants.Itself);
        }

        public void ValidateOptions()
        {
            if (UseGarbageCollection && !UseSequenceMarker)
                throw new NotSupportedException("To use garbage collection UseSequenceMarker option must be on.");
        }
    }
}

Create Sequence Marker only if it is used.


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

namespace Mios.Payment {
	[Serializable]
	public class VerificationProviderException : Exception {
		public VerificationProviderException() { }
		public VerificationProviderException(string message) : base(message) { }
		public VerificationProviderException(string message, Exception inner) : base(message, inner) { }
		protected VerificationProviderException(
		System.Runtime.Serialization.SerializationInfo info,
		System.Runtime.Serialization.StreamingContext context)
			: base(info, context) { }
	}
}

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

namespace Mios.Payment {
	[Serializable]
	public class VerificationProviderException : Exception {
		public string ResponseContent {
			get { return Data["Response"] as string; }
			set { Data["Response"] = value; }
		}

		public VerificationProviderException() { }
		public VerificationProviderException(string message) : base(message) { }
		public VerificationProviderException(string message, Exception inner) : base(message, inner) { }
		protected VerificationProviderException(
		System.Runtime.Serialization.SerializationInfo info,
		System.Runtime.Serialization.StreamingContext context)
			: base(info, context) { }
	}
}

Add property for response content, mapped to Data collection.


using System.Collections;
using System.Linq;
using System.Text.RegularExpressions;

public class BlockbustersComponentSolver : ComponentSolver
{
	public BlockbustersComponentSolver(TwitchModule module) :
		base(module)
	{
		selectables = Module.BombComponent.GetComponent<KMSelectable>().Children;
		ModInfo = ComponentSolverFactory.GetModuleInfo(GetModuleType(), "Press a tile using !{0} 2E. Tiles are specified by column then row.");
	}

	int CharacterToIndex(char character) => character >= 'a' ? character - 'a' : character - '1';

	protected internal override IEnumerator RespondToCommandInternal(string inputCommand)
	{
		inputCommand = Regex.Replace(inputCommand, @"(\W|_|^(press|submit|click|answer))", "");
		if (inputCommand.Length != 2) yield break;

		int column = CharacterToIndex(inputCommand[0]);
		int row = CharacterToIndex(inputCommand[1]);

		if (column.InRange(0, 4) && row.InRange(0, 4) && (row < 4 || column % 2 == 1))
		{
			yield return null;
			yield return DoInteractionClick(selectables[Enumerable.Range(0, column).Select(n => (n % 2 == 0) ? 4 : 5).Sum() + row]);
		}
	}

	private readonly KMSelectable[] selectables;
}

using System.Collections;
using System.Linq;
using System.Text.RegularExpressions;

public class BlockbustersComponentSolver : ComponentSolver
{
	public BlockbustersComponentSolver(TwitchModule module) :
		base(module)
	{
		selectables = Module.BombComponent.GetComponent<KMSelectable>().Children;
		ModInfo = ComponentSolverFactory.GetModuleInfo(GetModuleType(), "Press a tile using !{0} 2E. Tiles are specified by column then row.");
	}

	int CharacterToIndex(char character) => character >= 'a' ? character - 'a' : character - '1';

	protected internal override IEnumerator RespondToCommandInternal(string inputCommand)
	{
		inputCommand = Regex.Replace(inputCommand.ToLowerInvariant(), @"(\W|_|^(press|submit|click|answer))", "");
		if (inputCommand.Length != 2) yield break;

		int column = CharacterToIndex(inputCommand[0]);
		int row = CharacterToIndex(inputCommand[1]);

		if (column.InRange(0, 4) && row.InRange(0, 4) && (row < 4 || column % 2 == 1))
		{
			yield return null;
			yield return DoInteractionClick(selectables[Enumerable.Range(0, column).Select(n => (n % 2 == 0) ? 4 : 5).Sum() + row]);
		}
	}

	private readonly KMSelectable[] selectables;
}

Fix Blockbusters not accepting uppercase input


using System;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Xml.Linq;
using Xunit;

[assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly)]

//  Register test framework for assembly fixture
[assembly: TestFramework("Xunit.NetCore.Extensions.XunitTestFrameworkWithAssemblyFixture", "Xunit.NetCore.Extensions")]

[assembly: AssemblyFixture(typeof(MSBuildTestAssemblyFixture))]

public class MSBuildTestAssemblyFixture
{
    public MSBuildTestAssemblyFixture()
    {
        //  Find correct version of "dotnet", and set DOTNET_HOST_PATH so that the Roslyn tasks will use the right host

        var currentFolder = System.AppContext.BaseDirectory;

        while (currentFolder != null)
        {
            string potentialVersionsPropsPath = Path.Combine(currentFolder, "build", "Versions.props");
            if (File.Exists(potentialVersionsPropsPath))
            {
                var doc = XDocument.Load(potentialVersionsPropsPath);
                var ns = doc.Root.Name.Namespace;
                var cliVersionElement = doc.Root.Elements(ns + "PropertyGroup").Elements(ns + "DotNetCliVersion").FirstOrDefault();
                if (cliVersionElement != null)
                {
                    string cliVersion = cliVersionElement.Value;
                    string dotnetPath = Path.Combine(currentFolder, "artifacts", ".dotnet", cliVersion, "dotnet");

                    if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
                    {
                        dotnetPath += ".exe";
                    }

                    Environment.SetEnvironmentVariable("DOTNET_HOST_PATH", dotnetPath);
                }

                break;
            }

            currentFolder = Directory.GetParent(currentFolder)?.FullName;
        }
    }
}

Set DOTNET_HOST_PATH so Roslyn tasks will use the right host


namespace TraktApiSharp.Utils
{
    using Newtonsoft.Json;
    using System.Threading.Tasks;

    internal static class Json
    {
        internal static readonly JsonSerializerSettings DEFAULT_JSON_SETTINGS
            = new JsonSerializerSettings
            {
                Formatting = Formatting.None,
                NullValueHandling = NullValueHandling.Ignore
            };

        internal static string Serialize(object value)
        {
            return JsonConvert.SerializeObject(value, DEFAULT_JSON_SETTINGS);
        }

        internal static TResult Deserialize<TResult>(string value)
        {
            return JsonConvert.DeserializeObject<TResult>(value, DEFAULT_JSON_SETTINGS);
        }

        internal static async Task<string> SerializeAsync(object value)
        {
            return await Task.Run(() => JsonConvert.SerializeObject(value, DEFAULT_JSON_SETTINGS));
        }

        internal static async Task<TResult> DeserializeAsync<TResult>(string value)
        {
            return await Task.Run(() => JsonConvert.DeserializeObject<TResult>(value, DEFAULT_JSON_SETTINGS));
        }
    }
}

namespace TraktApiSharp.Utils
{
    using Newtonsoft.Json;

    internal static class Json
    {
        internal static readonly JsonSerializerSettings DEFAULT_JSON_SETTINGS
            = new JsonSerializerSettings
            {
                Formatting = Formatting.None,
                NullValueHandling = NullValueHandling.Ignore
            };

        internal static string Serialize(object value)
        {
            return JsonConvert.SerializeObject(value, DEFAULT_JSON_SETTINGS);
        }

        internal static TResult Deserialize<TResult>(string value)
        {
            return JsonConvert.DeserializeObject<TResult>(value, DEFAULT_JSON_SETTINGS);
        }
    }
}

Remove async helper methods for json serialization.


using System;

namespace UDIR.PAS2.OAuth.Client
{
	internal class AuthorizationServer
	{
		public AuthorizationServer(Uri baseAddress)
		{
			BaseAddress = baseAddress;
			TokenEndpoint = new Uri(baseAddress, "/connect/token").ToString();
		}

		public AuthorizationServer(string baseAddress) : this(new Uri(baseAddress))
		{
		}

		public string TokenEndpoint { get; }
		public Uri BaseAddress { get; }
	}
}

using System;

namespace UDIR.PAS2.OAuth.Client
{
	internal class AuthorizationServer
	{
		public AuthorizationServer(Uri baseAddress)
		{
			BaseAddress = baseAddress;
			TokenEndpoint = new Uri(baseAddress, "/connect/token").ToString();
		}

		public AuthorizationServer(string baseAddress) : this(new Uri(baseAddress))
		{
		}

		public string TokenEndpoint { get; private set; }
		public Uri BaseAddress { get; private set; }
	}
}

Use private accessor for property

Use private accessor for property


using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using MongoDB.Driver;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using Newtonsoft.Json;

namespace M101DotNet
{
    public class Program
    {
        public static void Main(string[] args)
        {
            MainAsync(args).Wait();
            Console.WriteLine();
            Console.WriteLine("Press Enter");
            Console.ReadLine();
        }

        static async Task MainAsync(string[] args)
        {
          var connectionString = "mongodb://localhost:27017";
          var client = new MongoClient(connectionString);
          var db = client.GetDatabase("test");
          var person = new Person
          {
            Name = "Jones",
            Age = 30,
            Colors = new List<string> {"red", "blue"},
            Pets = new List<Pet>
            {
              new Pet
              {
                Name = "Puffy",
                Type = "Pig"
              }
            }
          };
          Console.WriteLine(person);
          // using (var writer = new JsonWriter(Console.Out))
          // {
          //   BsonSerializer.Serialize(writer, person);
          // };
        }
    }
}

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using MongoDB.Driver;
using MongoDB.Bson;
using MongoDB.Bson.Serialization;
using MongoDB.Bson.IO;

namespace M101DotNet
{
    public class Program
    {
        public static void Main(string[] args)
        {
            MainAsync(args).Wait();
            Console.WriteLine();
            Console.WriteLine("Press Enter");
            Console.ReadLine();
        }

        static async Task MainAsync(string[] args)
        {
          var connectionString = "mongodb://localhost:27017";
          var client = new MongoClient(connectionString);
          var db = client.GetDatabase("test");
          var person = new Person
          {
            Name = "Jones",
            Age = 30,
            Colors = new List<string> {"red", "blue"},
            Pets = new List<Pet>
            {
              new Pet
              {
                Name = "Puffy",
                Type = "Pig"
              }
            }
          };
          Console.WriteLine(person);
          using (var writer = new JsonWriter(Console.Out))
          {
            BsonSerializer.Serialize(writer, person);
          };
        }
    }
}

Use builtin MongoDB Bson serialization

Use builtin MongoDB Bson serialization


using System.Collections.Generic;
using Mono.Debugger.Cli.Debugging;
using Mono.Debugger.Cli.Logging;

namespace Mono.Debugger.Cli.Commands
{
    public sealed class ThreadsCommand : ICommand
    {
        public string Name
        {
            get { return "Threads"; }
        }

        public string Description
        {
            get { return "Lists all active threads."; }
        }

        public IEnumerable<string> Arguments
        {
            get { return Argument.None(); }
        }

        public void Execute(CommandArguments args)
        {
            var session = SoftDebugger.Session;

            if (SoftDebugger.State == DebuggerState.Null)
            {
                Logger.WriteErrorLine("No session active.");
                return;
            }

            if (SoftDebugger.State == DebuggerState.Initialized)
            {
                Logger.WriteErrorLine("No process active.");
                return;
            }

            var threads = session.VirtualMachine.GetThreads();

            foreach (var thread in threads)
                Logger.WriteInfoLine("[{0}] {1}: {2}", thread.Id, thread.Name, thread.ThreadState);
        }
    }
}

using System.Collections.Generic;
using Mono.Debugger.Cli.Debugging;
using Mono.Debugger.Cli.Logging;

namespace Mono.Debugger.Cli.Commands
{
    public sealed class ThreadsCommand : ICommand
    {
        public string Name
        {
            get { return "Threads"; }
        }

        public string Description
        {
            get { return "Lists all active threads."; }
        }

        public IEnumerable<string> Arguments
        {
            get { return Argument.None(); }
        }

        public void Execute(CommandArguments args)
        {
            var session = SoftDebugger.Session;

            if (SoftDebugger.State == DebuggerState.Null)
            {
                Logger.WriteErrorLine("No session active.");
                return;
            }

            if (SoftDebugger.State == DebuggerState.Initialized)
            {
                Logger.WriteErrorLine("No process active.");
                return;
            }

            var threads = session.VirtualMachine.GetThreads();

            foreach (var thread in threads)
            {
                var id = thread.Id.ToString();
                if (thread.IsThreadPoolThread)
                    id += " (TP)";

                Logger.WriteInfoLine("[{0}: {1}] {2}: {3}", thread.Domain.FriendlyName, id, thread.Name, thread.ThreadState);
            }
        }
    }
}

Add a little more info to the thread listing.


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

namespace Assent.Reporters.DiffPrograms
{
    public class BeyondCompareDiffProgram : DiffProgramBase
    {
        static BeyondCompareDiffProgram()
        {
            var paths = new List<string>();
            if (DiffReporter.IsWindows)
            {
                paths.AddRange(WindowsProgramFilePaths
                    .SelectMany(p =>
                        new[]
                        {
                            $@"{p}\Beyond Compare 4\BCompare.exe",
                            $@"{p}\Beyond Compare 3\BCompare.exe"
                        })
                    .ToArray());
            }
            else
            {
                paths.Add("/usr/bin/bcompare");
            }
            DefaultSearchPaths = paths;
        }

        public static readonly IReadOnlyList<string> DefaultSearchPaths;

        public BeyondCompareDiffProgram() : base(DefaultSearchPaths)
        {
        }

        public BeyondCompareDiffProgram(IReadOnlyList<string> searchPaths)
            : base(searchPaths)
        {
        }

        protected override string CreateProcessStartArgs(string receivedFile, string approvedFile)
        {
            var defaultArgs = base.CreateProcessStartArgs(receivedFile, approvedFile);
            var argChar = DiffReporter.IsWindows ? "/" : "-";
            return $"{defaultArgs} {argChar}solo" ;
        }
    }
}

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

namespace Assent.Reporters.DiffPrograms
{
    public class BeyondCompareDiffProgram : DiffProgramBase
    {
        static BeyondCompareDiffProgram()
        {
            var paths = new List<string>();
            if (DiffReporter.IsWindows)
            {
                paths.AddRange(WindowsProgramFilePaths
                    .SelectMany(p =>
                        new[]
                        {
                            $@"{p}\Beyond Compare 4\BCompare.exe",
                            $@"{p}\Beyond Compare 3\BCompare.exe"
                        })
                    .ToArray());
            }
            else
            {
                paths.Add("/usr/bin/bcompare");
                paths.Add("/usr/local/bin/bcompare");
            }
            DefaultSearchPaths = paths;
        }

        public static readonly IReadOnlyList<string> DefaultSearchPaths;

        public BeyondCompareDiffProgram() : base(DefaultSearchPaths)
        {
        }

        public BeyondCompareDiffProgram(IReadOnlyList<string> searchPaths)
            : base(searchPaths)
        {
        }

        protected override string CreateProcessStartArgs(string receivedFile, string approvedFile)
        {
            var defaultArgs = base.CreateProcessStartArgs(receivedFile, approvedFile);
            var argChar = DiffReporter.IsWindows ? "/" : "-";
            return $"{defaultArgs} {argChar}solo" ;
        }
    }
}

Add OSX default install location for BeyondCompare.


using System;
using elbsms_core;

namespace elbsms_console
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine("Usage: elbsms_console <path to rom>");
                return;
            }

            string romPath = args[0];

            Cartridge cartridge = Cartridge.LoadFromFile(romPath);

            MasterSystem masterSystem = new MasterSystem(cartridge);

            try
            {
                while (true)
                {
                    masterSystem.SingleStep();
                }
            }
            catch (NotImplementedException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
    }
}

using System;
using System.Diagnostics;
using elbsms_core;

namespace elbsms_console
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine("Usage: elbsms_console <path to rom>");
                return;
            }

            string romPath = args[0];

            Cartridge cartridge = Cartridge.LoadFromFile(romPath);

            MasterSystem masterSystem = new MasterSystem(cartridge);

            Console.WriteLine($"Starting: {DateTime.Now}");
            Console.WriteLine();

            ulong instructionCount = 0;

            var sw = Stopwatch.StartNew();

            try
            {
                while (true)
                {
                    instructionCount++;
                    masterSystem.SingleStep();
                }
            }
            catch (NotImplementedException ex)
            {
                Console.WriteLine(ex.Message);
            }

            sw.Stop();

            Console.WriteLine();
            Console.WriteLine($"Finished: {DateTime.Now}");
            Console.WriteLine($"Elapsed: {sw.ElapsedMilliseconds}ms Instructions: {instructionCount}, Instructions/ms: {instructionCount/(double)sw.ElapsedMilliseconds}");
        }
    }
}

Add some simple runtime stats while implementing the Z80 core


using System.Reflection;

[assembly: AssemblyProduct("SqlStreamStore")]
[assembly: AssemblyCopyright("Copyright Damian Hickey & Contributors 2015 - 2016")]
[assembly: AssemblyVersion("0.2.0.0")]
[assembly: AssemblyFileVersion("0.2.0.0")]

using System.Reflection;

[assembly: AssemblyProduct("SqlStreamStore")]
[assembly: AssemblyCopyright("Copyright Damian Hickey & Contributors 2015 - 2016")]
[assembly: AssemblyVersion("0.1.1.0")]
[assembly: AssemblyFileVersion("0.1.1.0")]

Make the next release version 0.1.1 (bug fixes)


namespace Cash_Flow_Projection
{
    using Microsoft.AspNetCore.Hosting;
    using Microsoft.Extensions.Configuration;
    using Microsoft.Extensions.Hosting;
    using Microsoft.Extensions.Logging;
    using Serilog;
    using Serilog.Core;

    public class Program
    {
        public static LoggingLevelSwitch LogLevel { get; } = new LoggingLevelSwitch(Serilog.Events.LogEventLevel.Information);

        public static void Main(string[] args)
        {
            CreateHostBuilder(args).Build().Run();
        }

        public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder.UseStartup<Startup>();
                })
                .ConfigureLogging((context, builder) =>
                {
                    Log.Logger =
                           new LoggerConfiguration()
                           .Enrich.FromLogContext()
                           .Enrich.WithProperty("Application", context.HostingEnvironment.ApplicationName)
                           .Enrich.WithProperty("Environment", context.HostingEnvironment.EnvironmentName)
                           .Enrich.WithProperty("Version", $"{typeof(Startup).Assembly.GetName().Version}")
                           .WriteTo.Seq(serverUrl: "https://logs.redleg.app", apiKey: context.Configuration.GetValue<string>("Seq:ApiKey"), compact: true, controlLevelSwitch: LogLevel)
                           .MinimumLevel.ControlledBy(LogLevel)
                           .CreateLogger();

                    builder.AddSerilog();
                });
    }
}

namespace Cash_Flow_Projection
{
    using Microsoft.AspNetCore.Hosting;
    using Microsoft.Extensions.Configuration;
    using Microsoft.Extensions.Hosting;
    using Microsoft.Extensions.Logging;
    using Serilog;
    using Serilog.Core;

    public class Program
    {
        public static LoggingLevelSwitch LogLevel { get; } = new LoggingLevelSwitch(Serilog.Events.LogEventLevel.Information);

        public static void Main(string[] args)
        {
            CreateHostBuilder(args).Build().Run();
        }

        public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder.UseStartup<Startup>();
                })
                .ConfigureLogging((context, builder) =>
                {
                    Log.Logger =
                           new LoggerConfiguration()
                           .Enrich.FromLogContext()
                           .Enrich.WithProperty("Application", context.HostingEnvironment.ApplicationName)
                           .Enrich.WithProperty("Environment", context.HostingEnvironment.EnvironmentName)
                           .Enrich.WithProperty("Version", $"{typeof(Startup).Assembly.GetName().Version}")
                           .WriteTo.Seq(serverUrl: "https://logs.redleg.app", apiKey: context.Configuration.GetValue<string>("Seq:ApiKey"), controlLevelSwitch: LogLevel)
                           .MinimumLevel.ControlledBy(LogLevel)
                           .CreateLogger();

                    builder.AddSerilog();
                });
    }
}

Move Seq 'Compact' flag, default

Move Seq 'Compact' flag, default