using System;
using CanoePoloLeagueOrganiser;
using System.Collections.Generic;
using System.Linq;
using Xunit;

namespace CanoePoloLeagueOrganiserTests
{
    public class RubyInspiredListFunctionsTests
    {
        [Fact]
        public void EachCons2()
        {
            var list = new List<int> { 1, 2, 3, 4 };

            var actual = list.EachCons2();

            Assert.Collection(actual,
                (pair) => { Assert.Equal(1, pair.Item1); Assert.Equal(2, pair.Item2); },
                (pair) => { Assert.Equal(2, pair.Item1); Assert.Equal(3, pair.Item2); },
                (pair) => { Assert.Equal(3, pair.Item1); Assert.Equal(4, pair.Item2); }
                );
        }

        [Fact]
        public void EachCons3()
        {
            var list = new List<int> { 1, 2, 3, 4, 5 };

            var actual = list.EachCons(3);

            Assert.Collection(actual,
                (triple) => Assert.Equal("1,2,3", string.Join(",", triple)),
                (triple) => Assert.Equal("2,3,4", string.Join(",", triple)),
                (triple) => Assert.Equal("3,4,5", string.Join(",", triple))
                );
        }
    }
}

using System;
using CanoePoloLeagueOrganiser;
using System.Collections.Generic;
using System.Linq;
using Xunit;

namespace CanoePoloLeagueOrganiserTests
{
    public class RubyInspiredListFunctionsTests
    {
        [Fact]
        public void EachCons2()
        {
            var list = new List<int> { 1, 2, 3, 4 };

            var actual = list.EachCons2();

            Assert.Collection(actual,
                AssertPair(1, 2),
                AssertPair(2, 3),
                AssertPair(3, 4));
        }

        [Fact]
        public void EachCons3()
        {
            var list = new List<int> { 1, 2, 3, 4, 5 };

            var actual = list.EachCons(3);

            Assert.Collection(actual,
                AssertTriple("1,2,3"),
                AssertTriple("2,3,4"),
                AssertTriple("3,4,5"));
        }

        static Action<IEnumerable<int>> AssertTriple(string csvTriple) =>
            (triple) => Assert.Equal(csvTriple, string.Join(",", triple));

        static Action<Tuple<int, int>> AssertPair(int firstValue, int secondValue)
        {
            return (pair) =>
            {
                Assert.Equal(firstValue, pair.Item1);
                Assert.Equal(secondValue, pair.Item2);
            };
        }
    }
}

Introduce helper methods to make test clearer


// 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.Runtime;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;

namespace osu.Game.Performance
{
    public class HighPerformanceSession : Component
    {
        private readonly IBindable<bool> localUserPlaying = new Bindable<bool>();
        private GCLatencyMode originalGCMode;

        [BackgroundDependencyLoader]
        private void load(OsuGame game)
        {
            localUserPlaying.BindTo(game.LocalUserPlaying);
        }

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

            localUserPlaying.BindValueChanged(playing =>
            {
                if (playing.NewValue)
                    EnableHighPerformanceSession();
                else
                    DisableHighPerformanceSession();
            }, true);
        }

        protected virtual void EnableHighPerformanceSession()
        {
            originalGCMode = GCSettings.LatencyMode;
            GCSettings.LatencyMode = GCLatencyMode.LowLatency;
        }

        protected virtual void DisableHighPerformanceSession()
        {
            if (GCSettings.LatencyMode == GCLatencyMode.LowLatency)
                GCSettings.LatencyMode = originalGCMode;
        }
    }
}

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

using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;

namespace osu.Game.Performance
{
    public class HighPerformanceSession : Component
    {
        private readonly IBindable<bool> localUserPlaying = new Bindable<bool>();

        [BackgroundDependencyLoader]
        private void load(OsuGame game)
        {
            localUserPlaying.BindTo(game.LocalUserPlaying);
        }

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

            localUserPlaying.BindValueChanged(playing =>
            {
                if (playing.NewValue)
                    EnableHighPerformanceSession();
                else
                    DisableHighPerformanceSession();
            }, true);
        }

        protected virtual void EnableHighPerformanceSession()
        {
        }

        protected virtual void DisableHighPerformanceSession()
        {
        }
    }
}

Remove high performance GC setting

Remove high performance GC setting


using System;
using System.Linq.Expressions;
using System.Web.Mvc;
using BForms.Grid;
using BForms.Models;

namespace BForms.Html
{
    public static class BsPagerExtensions
    {
        public static BsGridPagerBuilder BsPager(this HtmlHelper html, BsPagerModel model, BsPagerSettings pagerSettings)
        {
            var builder = new BsGridPagerBuilder(model, pagerSettings, null) { viewContext = html.ViewContext };

            return builder;
        }

        public static BsGridPagerBuilder BsPager(this HtmlHelper html, BsPagerModel model)
        {
            var builder = BsPager(html, model, null);

            return builder;
        }

        public static BsGridPagerBuilder BsPagerFor<TModel>(this HtmlHelper<TModel> html, Expression<Func<TModel, BsPagerModel>> expression)
        {
            var model = expression.Compile().Invoke(html.ViewData.Model);
            return BsPager(html, model);
        }
    }
}

using System;
using System.Linq.Expressions;
using System.Web.Mvc;
using BForms.Grid;
using BForms.Models;

namespace BForms.Html
{
    public static class BsPagerExtensions
    {
        public static BsGridPagerBuilder BsPager(this HtmlHelper html, BsPagerModel model)
        {
            var builder = new BsGridPagerBuilder(model, new BsPagerSettings(), null) { viewContext = html.ViewContext };

            return builder;
        }

        public static BsGridPagerBuilder BsPagerFor<TModel>(this HtmlHelper<TModel> html, Expression<Func<TModel, BsPagerModel>> expression)
        {
            var model = expression.Compile().Invoke(html.ViewData.Model);
            return BsPager(html, model);
        }
    }
}

Revert "added BsPager HtmlHelper with settings"

This reverts commit 7465085ea96c90827ae5087ff1771c059a85193a.


// Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details

using System;
using NDesk.DBus;
using org.freedesktop.DBus;

public class ManagedDBusTest
{
	public static void Main (string[] args)
	{
		string addr;
		if (args.Length == 0)
			addr = Address.Session;
		else {
			if (args[0] == "--session")
				addr = Address.Session;
			else if (args[0] == "--system")
				addr = Address.System;
			else
				addr = args[0];
		}

		Connection conn = Connection.Open (addr);

		ObjectPath opath = new ObjectPath ("/org/freedesktop/DBus");
		string name = "org.freedesktop.DBus";

		IBus bus = conn.GetObject<IBus> (name, opath);

		bus.NameAcquired += delegate (string acquired_name) {
			Console.WriteLine ("NameAcquired: " + acquired_name);
		};

		string myName = bus.Hello ();
		Console.WriteLine ("myName: " + myName);

		Console.WriteLine ();
		string xmlData = bus.Introspect ();
		Console.WriteLine ("xmlData: " + xmlData);

		Console.WriteLine ();
		foreach (string n in bus.ListNames ())
			Console.WriteLine (n);

		Console.WriteLine ();
		foreach (string n in bus.ListNames ())
			Console.WriteLine ("Name " + n + " has owner: " + bus.NameHasOwner (n));

		Console.WriteLine ();
	}
}

// Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details

using System;
using NDesk.DBus;
using org.freedesktop.DBus;

public class ManagedDBusTest
{
	public static void Main (string[] args)
	{
		Connection conn;

		if (args.Length == 0)
			conn = Bus.Session;
		else {
			if (args[0] == "--session")
				conn = Bus.Session;
			else if (args[0] == "--system")
				conn = Bus.System;
			else
				conn = Connection.Open (args[0]);
		}

		ObjectPath opath = new ObjectPath ("/org/freedesktop/DBus");
		string name = "org.freedesktop.DBus";

		IBus bus = conn.GetObject<IBus> (name, opath);

		bus.NameAcquired += delegate (string acquired_name) {
			Console.WriteLine ("NameAcquired: " + acquired_name);
		};

		Console.WriteLine ();
		string xmlData = bus.Introspect ();
		Console.WriteLine ("xmlData: " + xmlData);

		Console.WriteLine ();
		foreach (string n in bus.ListNames ())
			Console.WriteLine (n);

		Console.WriteLine ();
		foreach (string n in bus.ListNames ())
			Console.WriteLine ("Name " + n + " has owner: " + bus.NameHasOwner (n));

		Console.WriteLine ();
	}
}

Update to avoid now internal API

Update to avoid now internal API


// Copyright (c) Microsoft.  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.Shell;
using Microsoft.VisualStudio.Shell.Interop;

namespace Microsoft.VisualStudio.IntegrationTest.Utilities.InProcess
{
    internal class Shell_InProc : InProcComponent
    {
        public static Shell_InProc Create() => new Shell_InProc();

        public string GetActiveWindowCaption()
            => InvokeOnUIThread(() => GetDTE().ActiveWindow.Caption);

        public int GetHWnd()
            => GetDTE().MainWindow.HWnd;

        public bool IsActiveTabProvisional()
            => InvokeOnUIThread(() =>
            {
                var shellMonitorSelection = GetGlobalService<SVsShellMonitorSelection, IVsMonitorSelection>();
                if (!ErrorHandler.Succeeded(shellMonitorSelection.GetCurrentElementValue((uint) VSConstants.VSSELELEMID.SEID_DocumentFrame, out var windowFrameObject)))
                {
                    throw new InvalidOperationException("Tried to get the active document frame but no documents were open.");
                }

                var windowFrame = (IVsWindowFrame)windowFrameObject;
                if (!ErrorHandler.Succeeded(windowFrame.GetProperty((int) VsFramePropID.IsProvisional, out var isProvisionalObject)))
                {
                    throw new InvalidOperationException("The active window frame did not have an 'IsProvisional' property.");
                }

                return (bool) isProvisionalObject;
            });
    }
}

// Copyright (c) Microsoft.  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.Shell;
using Microsoft.VisualStudio.Shell.Interop;

namespace Microsoft.VisualStudio.IntegrationTest.Utilities.InProcess
{
    internal class Shell_InProc : InProcComponent
    {
        public static Shell_InProc Create() => new Shell_InProc();

        public string GetActiveWindowCaption()
            => InvokeOnUIThread(() => GetDTE().ActiveWindow.Caption);

        public int GetHWnd()
            => GetDTE().MainWindow.HWnd;

        public bool IsActiveTabProvisional()
            => InvokeOnUIThread(() =>
            {
                var shellMonitorSelection = GetGlobalService<SVsShellMonitorSelection, IVsMonitorSelection>();
                if (!ErrorHandler.Succeeded(shellMonitorSelection.GetCurrentElementValue((uint)VSConstants.VSSELELEMID.SEID_DocumentFrame, out var windowFrameObject)))
                {
                    throw new InvalidOperationException("Tried to get the active document frame but no documents were open.");
                }

                var windowFrame = (IVsWindowFrame)windowFrameObject;
                if (!ErrorHandler.Succeeded(windowFrame.GetProperty((int)VsFramePropID.IsProvisional, out var isProvisionalObject)))
                {
                    throw new InvalidOperationException("The active window frame did not have an 'IsProvisional' property.");
                }

                return (bool)isProvisionalObject;
            });
    }
}

Add utility to determine if the active tab is provisional


namespace Microsoft.AspNetCore.Hosting
{
    using Microsoft.ApplicationInsights.AspNetCore.Extensions;
    using Microsoft.Extensions.Configuration;
    using Microsoft.Extensions.DependencyInjection;
    using Microsoft.Extensions.Options;

    internal class DefaultApplicationInsightsServiceConfigureOptions : IConfigureOptions<ApplicationInsightsServiceOptions>
    {
        private readonly IHostingEnvironment hostingEnvironment;

        public DefaultApplicationInsightsServiceConfigureOptions(IHostingEnvironment hostingEnvironment)
        {
            this.hostingEnvironment = hostingEnvironment;
        }

        public void Configure(ApplicationInsightsServiceOptions options)
        {
            var configBuilder = new ConfigurationBuilder()
                .SetBasePath(this.hostingEnvironment.ContentRootPath)
                .AddJsonFile("appsettings.json", true)
                .AddEnvironmentVariables();
            ApplicationInsightsExtensions.AddTelemetryConfiguration(configBuilder.Build(), options);

            if (this.hostingEnvironment.IsDevelopment())
            {
                options.DeveloperMode = true;
            }
        }
    }
}

namespace Microsoft.AspNetCore.Hosting
{
    using System.Diagnostics;
    using Microsoft.ApplicationInsights.AspNetCore.Extensions;
    using Microsoft.Extensions.Configuration;
    using Microsoft.Extensions.DependencyInjection;
    using Microsoft.Extensions.Options;

    internal class DefaultApplicationInsightsServiceConfigureOptions : IConfigureOptions<ApplicationInsightsServiceOptions>
    {
        private readonly IHostingEnvironment hostingEnvironment;

        public DefaultApplicationInsightsServiceConfigureOptions(IHostingEnvironment hostingEnvironment)
        {
            this.hostingEnvironment = hostingEnvironment;
        }

        public void Configure(ApplicationInsightsServiceOptions options)
        {
            var configBuilder = new ConfigurationBuilder()
                .SetBasePath(this.hostingEnvironment.ContentRootPath)
                .AddJsonFile("appsettings.json", true)
                .AddEnvironmentVariables();
            ApplicationInsightsExtensions.AddTelemetryConfiguration(configBuilder.Build(), options);

            if (Debugger.IsAttached)
            {
                options.DeveloperMode = true;
            }
        }
    }
}

Use Debugger.IsAttached instead of IsDevelopment to control developer mode


using System;

namespace it.unifi.dsi.stlab.networkreasoner.gas.system.terranova
{
	public class VersioningInfo
	{
		/// <summary>
		/// Gets the version number.
		///
		/// Here are the stack of versions with a brief description:
		///
		/// v1.1.0: introduce pressure regulator gadget for edges.
		///
		/// v1.0.1: enhancement to tackle turbolent behavior due to
		/// 		Reynolds number.
		///
		/// v1.0.0: basic version with checker about negative pressures
		/// 		associated to nodes with load gadget.
		///
		/// </summary>
		/// <value>The version number.</value>
		public String VersionNumber {
			get {
				return "v1.1.0";
			}
		}

		public String EngineIdentifier {
			get {
				return "Network Reasoner, stlab.dsi.unifi.it";
			}
		}
	}
}

using System;

namespace it.unifi.dsi.stlab.networkreasoner.gas.system.terranova
{
	public class VersioningInfo
	{
		/// <summary>
		/// Gets the version number.
		///
		/// Here are the stack of versions with a brief description:
		///
		/// v1.1.1: tuning computational parameter to handle middle and low pressure networks.
		///
		/// v1.1.0: introduce pressure regulator gadget for edges.
		///
		/// v1.0.1: enhancement to tackle turbolent behavior due to
		/// 		Reynolds number.
		///
		/// v1.0.0: basic version with checker about negative pressures
		/// 		associated to nodes with load gadget.
		///
		/// </summary>
		/// <value>The version number.</value>
		public String VersionNumber {
			get {
				return "v1.1.1";
			}
		}

		public String EngineIdentifier {
			get {
				return "Network Reasoner, stlab.dsi.unifi.it";
			}
		}
	}
}

Enhance version number to `v1.1.1' after inclusion of Fabio's patch.


namespace Saule
{
    /// <summary>
    /// Represents a related resource (to-one or to-many).
    /// </summary>
    public abstract class ResourceRelationship
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ResourceRelationship"/> class.
        /// </summary>
        /// <param name="name">The name of the reference on the resource that defines the relationship.</param>
        /// <param name="urlPath">
        /// The url path of this relationship relative to the resource url that holds
        /// the relationship.
        /// </param>
        /// <param name="kind">The kind of relationship.</param>
        /// <param name="relationshipResource">The specification of the related resource.</param>
        protected ResourceRelationship(
            string name,
            string urlPath,
            RelationshipKind kind,
            ApiResource relationshipResource)
        {
            Name = name.ToDashed();
            UrlPath = urlPath.ToDashed();
            RelatedResource = relationshipResource;
            Kind = kind;
        }

        /// <summary>
        /// Gets the name of this relationship.
        /// </summary>
        public string Name { get; }

        /// <summary>
        /// Gets the definition of the related resource
        /// </summary>
        public ApiResource RelatedResource { get; }

        /// <summary>
        /// Gets the pathspec of this relationship.
        /// </summary>
        public string UrlPath { get; }

        /// <summary>
        /// Gets the kind of relationship.
        /// </summary>
        public RelationshipKind Kind { get; }
    }
}

namespace Saule
{
    /// <summary>
    /// Represents a related resource (to-one or to-many).
    /// </summary>
    public abstract class ResourceRelationship
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="ResourceRelationship"/> class.
        /// </summary>
        /// <param name="name">The name of the reference on the resource that defines the relationship.</param>
        /// <param name="urlPath">
        /// The url path of this relationship relative to the resource url that holds
        /// the relationship.
        /// </param>
        /// <param name="kind">The kind of relationship.</param>
        /// <param name="relationshipResource">The specification of the related resource.</param>
        protected ResourceRelationship(
            string name,
            string urlPath,
            RelationshipKind kind,
            ApiResource relationshipResource)
        {
            Name = name.ToDashed();
            PropertyName = name.ToPascalCase();
            UrlPath = urlPath.ToDashed();
            RelatedResource = relationshipResource;
            Kind = kind;
        }

        /// <summary>
        /// Gets the name of the relationship in dashed JSON API format.
        /// </summary>
        public string Name { get; }

        /// <summary>
        /// Gets the name of the relationship in PascalCase.
        /// </summary>
        public string PropertyName { get; }

        /// <summary>
        /// Gets the definition of the related resource
        /// </summary>
        public ApiResource RelatedResource { get; }

        /// <summary>
        /// Gets the pathspec of this relationship.
        /// </summary>
        public string UrlPath { get; }

        /// <summary>
        /// Gets the kind of relationship.
        /// </summary>
        public RelationshipKind Kind { get; }
    }
}

Add PropertyName to relationship to bring in line with attribute


@model SFA.DAS.EmployerAccounts.Web.ViewModels.VacancyViewModel

        Your apprenticeship advert

You have created a vacancy for your apprenticeship.

                Title

                @(Model?.Title)

                Status

                REJECTED

            Review your vacancy

[CON-1426] Apply stlye classes to the rejectec status tag


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

using osu.Game.Rulesets.Scoring;

namespace osu.Game.Rulesets.Taiko.Judgements
{
    public class TaikoDrumRollTickJudgement : TaikoJudgement
    {
        public override HitResult MaxResult => HitResult.SmallTickHit;

        protected override double HealthIncreaseFor(HitResult result)
        {
            switch (result)
            {
                case HitResult.Great:
                    return 0.15;

                default:
                    return 0;
            }
        }
    }
}

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

using osu.Game.Rulesets.Scoring;

namespace osu.Game.Rulesets.Taiko.Judgements
{
    public class TaikoDrumRollTickJudgement : TaikoJudgement
    {
        public override HitResult MaxResult => HitResult.SmallTickHit;

        protected override double HealthIncreaseFor(HitResult result)
        {
            switch (result)
            {
                case HitResult.SmallTickHit:
                    return 0.15;

                default:
                    return 0;
            }
        }
    }
}

Adjust health increase for drum roll tick to match new max result


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

using System;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;

namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
{
    public class TimelineButton : CompositeDrawable
    {
        public Action Action;
        public readonly BindableBool Enabled = new BindableBool(true);

        public FontAwesome Icon
        {
            get { return button.Icon; }
            set { button.Icon = value; }
        }

        private readonly IconButton button;

        public TimelineButton()
        {
            InternalChild = button = new IconButton
            {
                Anchor = Anchor.Centre,
                Origin = Anchor.Centre,
                IconColour = OsuColour.FromHex("555"),
                IconHoverColour = Color4.White,
                HoverColour = OsuColour.FromHex("3A3A3A"),
                FlashColour = OsuColour.FromHex("555"),
                Action = () => Action?.Invoke()
            };

            button.Enabled.BindTo(Enabled);
            Width = button.ButtonSize.X;
        }

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

            button.ButtonSize = new Vector2(button.ButtonSize.X, DrawHeight);
        }
    }
}

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

using System;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;

namespace osu.Game.Screens.Edit.Screens.Compose.Timeline
{
    public class TimelineButton : CompositeDrawable
    {
        public Action Action;
        public readonly BindableBool Enabled = new BindableBool(true);

        public FontAwesome Icon
        {
            get { return button.Icon; }
            set { button.Icon = value; }
        }

        private readonly IconButton button;

        public TimelineButton()
        {
            InternalChild = button = new IconButton
            {
                Anchor = Anchor.Centre,
                Origin = Anchor.Centre,
                IconColour = OsuColour.Gray(0.35f),
                IconHoverColour = Color4.White,
                HoverColour = OsuColour.Gray(0.25f),
                FlashColour = OsuColour.Gray(0.5f),
                Action = () => Action?.Invoke()
            };

            button.Enabled.BindTo(Enabled);
            Width = button.ButtonSize.X;
        }

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

            button.ButtonSize = new Vector2(button.ButtonSize.X, DrawHeight);
        }
    }
}

Use Gray instead of FromHex for grays

Use Gray instead of FromHex for grays


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autofac;
using GeoChallenger.Commands.Commands;
using GeoChallenger.Commands.Config;
using NLog;

namespace GeoChallenger.Commands
{
    class Program
    {
        private static readonly Logger _log = LogManager.GetCurrentClassLogger();

        // NOTE: Only one command is supported at this moement.
        static void Main(string[] args)
        {
            try {
                var mapperConfiguration = MapperConfig.CreateMapperConfiguration();
                var container = DIConfig.RegisterDI(mapperConfiguration);

                // All components have single instance scope.
                using (var scope = container.BeginLifetimeScope()) {
                    var command = scope.Resolve<ReindexCommand>();
                    command.RunAsync().Wait();
                }
            } catch (Exception ex) {
                _log.Error(ex, "Command is failed.");
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Autofac;
using GeoChallenger.Commands.Commands;
using GeoChallenger.Commands.Config;
using NLog;
using NLog.Fluent;

namespace GeoChallenger.Commands
{
    class Program
    {
        private static readonly Logger _log = LogManager.GetCurrentClassLogger();

        // NOTE: Only one command is supported at this moement.
        static void Main(string[] args)
        {
            _log.Info("Start GeoChallenger.Commands");
            try {
                var mapperConfiguration = MapperConfig.CreateMapperConfiguration();
                var container = DIConfig.RegisterDI(mapperConfiguration);

                // All components have single instance scope.
                using (var scope = container.BeginLifetimeScope()) {
                    var command = scope.Resolve<ReindexCommand>();
                    command.RunAsync().Wait();
                }
            } catch (Exception ex) {
                _log.Error(ex, "Command is failed.");
            }
            _log.Info("End GeoChallenger.Commands");
        }
    }
}

Add start log to commands

Add start log to commands


namespace Stripe
{
    using Newtonsoft.Json;

    public class SubscriptionListOptions : ListOptionsWithCreated
    {
        /// <summary>
        /// The billing mode of the subscriptions to retrieve. One of <see cref="Billing" />.
        /// </summary>
        [JsonProperty("billing")]
        public Billing? Billing { get; set; }

        /// <summary>
        /// The ID of the customer whose subscriptions will be retrieved.
        /// </summary>
        [JsonProperty("customer")]
        public string CustomerId { get; set; }

        /// <summary>
        /// The ID of the plan whose subscriptions will be retrieved.
        /// </summary>
        [JsonProperty("plan")]
        public string PlanId { get; set; }

        /// <summary>
        /// The status of the subscriptions to retrieve. One of <see cref="SubscriptionStatuses"/> or <c>all</c>. Passing in a value of <c>canceled</c> will return all canceled subscriptions, including those belonging to deleted customers. Passing in a value of <c>all</c> will return subscriptions of all statuses.
        /// </summary>
        [JsonProperty("status")]
        public string Status { get; set; }
    }
}

namespace Stripe
{
    using System;
    using Newtonsoft.Json;

    public class SubscriptionListOptions : ListOptionsWithCreated
    {
        /// <summary>
        /// The billing mode of the subscriptions to retrieve. One of <see cref="Billing" />.
        /// </summary>
        [JsonProperty("billing")]
        public Billing? Billing { get; set; }

        /// <summary>
        /// A filter on the list based on the object current_period_end field.
        /// </summary>
        [JsonProperty("current_period_end")]
        public DateTime? CurrentPeriodEnd { get; set; }

        /// <summary>
        /// A filter on the list based on the object current_period_end field.
        /// </summary>
        [JsonProperty("current_period_end")]
        public DateRangeOptions CurrentPeriodEndRange { get; set; }

        /// <summary>
        /// A filter on the list based on the object current_period_start field.
        /// </summary>
        [JsonProperty("current_period_start")]
        public DateTime? CurrentPeriodStart { get; set; }

        /// <summary>
        /// A filter on the list based on the object current_period_start field.
        /// </summary>
        [JsonProperty("current_period_start")]
        public DateRangeOptions CurrentPeriodStartRange { get; set; }

        /// <summary>
        /// The ID of the customer whose subscriptions will be retrieved.
        /// </summary>
        [JsonProperty("customer")]
        public string CustomerId { get; set; }

        /// <summary>
        /// The ID of the plan whose subscriptions will be retrieved.
        /// </summary>
        [JsonProperty("plan")]
        public string PlanId { get; set; }

        /// <summary>
        /// The status of the subscriptions to retrieve. One of <see cref="SubscriptionStatuses"/> or <c>all</c>. Passing in a value of <c>canceled</c> will return all canceled subscriptions, including those belonging to deleted customers. Passing in a value of <c>all</c> will return subscriptions of all statuses.
        /// </summary>
        [JsonProperty("status")]
        public string Status { get; set; }
    }
}

Add `current_period_*` filters when listing Invoices


using System.Collections.Generic;
using System.Linq;
using Swashbuckle.AspNetCore.Swagger;
using Swashbuckle.AspNetCore.SwaggerGen;
using Abp.Authorization;

namespace AbpCompanyName.AbpProjectName.Web.Host.Startup
{
    public class SecurityRequirementsOperationFilter : IOperationFilter
    {
        public void Apply(Operation operation, OperationFilterContext context)
        {
            var actionAttrs = context.ApiDescription.ActionAttributes();
            if (actionAttrs.OfType<AbpAllowAnonymousAttribute>().Any())
            {
                return;
            }

            var controllerAttrs = context.ApiDescription.ControllerAttributes();
            var actionAbpAuthorizeAttrs = actionAttrs.OfType<AbpAuthorizeAttribute>();

            if (!actionAbpAuthorizeAttrs.Any() && controllerAttrs.OfType<AbpAllowAnonymousAttribute>().Any())
            {
                return;
            }

            var controllerAbpAuthorizeAttrs = controllerAttrs.OfType<AbpAuthorizeAttribute>();
            if (controllerAbpAuthorizeAttrs.Any() || actionAbpAuthorizeAttrs.Any())
            {
                operation.Responses.Add("401", new Response { Description = "Unauthorized" });

                var permissions = controllerAbpAuthorizeAttrs.Union(actionAbpAuthorizeAttrs)
                    .SelectMany(p => p.Permissions)
                    .Distinct();

                if (permissions.Any())
                {
                    operation.Responses.Add("403", new Response { Description = "Forbidden" });
                }

                operation.Security = new List<IDictionary<string, IEnumerable<string>>>
                {
                    new Dictionary<string, IEnumerable<string>>
                    {
                        { "bearerAuth", permissions }
                    }
                };
            }
        }
    }
}

Remove whitespace (leave the newline).

Remove whitespace (leave the newline).


// Copyright 2018 Google LLC
//
// 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
//
//     https://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 Google.Cloud.ClientTesting;
using System;
using Xunit;

namespace Google.Cloud.Kms.V1.Snippets
{
    [Collection(nameof(KeyManagementServiceFixture))]
    [SnippetOutputCollector]
    public class KeyManagementServiceClientSnippets
    {
        private readonly KeyManagementServiceFixture _fixture;

        public KeyManagementServiceClientSnippets(KeyManagementServiceFixture fixture) =>
            _fixture = fixture;

        [Fact]
        public void ListGlobalKeyRings()
        {
            string projectId = _fixture.ProjectId;

            // Sample: ListGlobalKeyRings
            KeyManagementServiceClient client = KeyManagementServiceClient.Create();
            LocationName globalLocation = new LocationName(projectId, "global");
            foreach (KeyRing keyRing in client.ListKeyRings(globalLocation))
            {
                Console.WriteLine(keyRing.Name);
            }
            // End sample
        }
    }
}

// Copyright 2018 Google LLC
//
// 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
//
//     https://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 Google.Api.Gax.ResourceNames;
using Google.Cloud.ClientTesting;
using System;
using Xunit;

namespace Google.Cloud.Kms.V1.Snippets
{
    [Collection(nameof(KeyManagementServiceFixture))]
    [SnippetOutputCollector]
    public class KeyManagementServiceClientSnippets
    {
        private readonly KeyManagementServiceFixture _fixture;

        public KeyManagementServiceClientSnippets(KeyManagementServiceFixture fixture) =>
            _fixture = fixture;

        [Fact]
        public void ListGlobalKeyRings()
        {
            string projectId = _fixture.ProjectId;

            // Sample: ListGlobalKeyRings
            KeyManagementServiceClient client = KeyManagementServiceClient.Create();
            LocationName globalLocation = new LocationName(projectId, "global");
            foreach (KeyRing keyRing in client.ListKeyRings(globalLocation))
            {
                Console.WriteLine(keyRing.Name);
            }
            // End sample
        }
    }
}

Fix manual KMS snippet (LocationName breaking change is expected)


using System.Collections.Generic;

namespace Glimpse.Core.Framework
{
    public class GlimpseMetadata
    {
        public GlimpseMetadata()
        {
            Plugins = new Dictionary<string, PluginMetadata>();

            Resources = new Dictionary<string, string>//TODO: once the resources below are implemented, this constructor should just instantiate variable.
                        {
                            {"glimpse_packageUpdates", "//getGlimpse.com/{?packages*}"},
                            {"paging", "NEED TO IMPLMENT RESOURCE Pager"},//TODO: Implement resource
                            {"tab", "NEED TO IMPLMENT RESOURCE test-popup.html"},//TODO: Implement resource
                        };
        }

        public string Version { get; set; }
        public IDictionary<string,PluginMetadata> Plugins { get; set; }
        public IDictionary<string,string> Resources { get; set; }
    }

    public class PluginMetadata
    {
        public string DocumentationUri { get; set; }
        public bool HasMetadata { get { return !string.IsNullOrEmpty(DocumentationUri); } }
    }
}

using System.Collections.Generic;

namespace Glimpse.Core.Framework
{
    public class GlimpseMetadata
    {
        public GlimpseMetadata()
        {
            Plugins = new Dictionary<string, PluginMetadata>();

            Resources = new Dictionary<string, string>//TODO: once the resources below are implemented, this constructor should just instantiate variable.
                        {
                            {"paging", "NEED TO IMPLMENT RESOURCE Pager"},//TODO: Implement resource
                            {"tab", "NEED TO IMPLMENT RESOURCE test-popup.html"},//TODO: Implement resource
                        };
        }

        public string Version { get; set; }
        public IDictionary<string,PluginMetadata> Plugins { get; set; }
        public IDictionary<string,string> Resources { get; set; }
    }

    public class PluginMetadata
    {
        public string DocumentationUri { get; set; }
        public bool HasMetadata { get { return !string.IsNullOrEmpty(DocumentationUri); } }
    }
}

Package updates is now fully implemented


// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

namespace Microsoft.CodeAnalysis.Editor
{
    internal static class ContentTypeNames
    {
        public const string CSharpContentType = "CSharp";
        public const string CSharpSignatureHelpContentType = "CSharp Signature Help";
        public const string RoslynContentType = "Roslyn Languages";
        public const string VisualBasicContentType = "Basic";
        public const string VisualBasicSignatureHelpContentType = "Basic Signature Help";
        public const string XamlContentType = "XAML";
    }
}

// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

namespace Microsoft.CodeAnalysis.Editor
{
    internal static class ContentTypeNames
    {
        public const string CSharpContentType = "CSharp";
        public const string CSharpSignatureHelpContentType = "CSharp Signature Help";
        public const string RoslynContentType = "Roslyn Languages";
        public const string VisualBasicContentType = "Basic";
        public const string VisualBasicSignatureHelpContentType = "Basic Signature Help";
        public const string XamlContentType = "XAML";
        public const string JavaScriptContentTypeName = "JavaScript";
        public const string TypeScriptContentTypeName = "TypeScript";
    }
}

Undo change of this file.

Undo change of this file.


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

using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Overlays;
using osu.Game.Overlays.Settings;
using osu.Game.Rulesets.Edit.Checks.Components;

namespace osu.Game.Screens.Edit.Verify
{
    internal class VisibilitySection : EditorRoundedScreenSettingsSection
    {
        [Resolved]
        private VerifyScreen verify { get; set; }

        private readonly IssueType[] configurableIssueTypes =
        {
            IssueType.Warning,
            IssueType.Error,
            IssueType.Negligible
        };

        private BindableList<IssueType> hiddenIssueTypes;

        protected override string Header => "Visibility";

        [BackgroundDependencyLoader]
        private void load(OverlayColourProvider colours)
        {
            hiddenIssueTypes = verify.HiddenIssueTypes.GetBoundCopy();

            foreach (IssueType issueType in configurableIssueTypes)
            {
                var checkbox = new SettingsCheckbox
                {
                    Anchor = Anchor.CentreLeft,
                    Origin = Anchor.CentreLeft,
                    LabelText = issueType.ToString()
                };

                checkbox.Current.Default = !hiddenIssueTypes.Contains(issueType);
                checkbox.Current.SetDefault();
                checkbox.Current.BindValueChanged(state =>
                {
                    if (!state.NewValue)
                        hiddenIssueTypes.Add(issueType);
                    else
                        hiddenIssueTypes.Remove(issueType);
                });

                Flow.Add(checkbox);
            }
        }
    }
}

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

using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Overlays;
using osu.Game.Overlays.Settings;
using osu.Game.Rulesets.Edit.Checks.Components;

namespace osu.Game.Screens.Edit.Verify
{
    internal class VisibilitySection : EditorRoundedScreenSettingsSection
    {
        [Resolved]
        private VerifyScreen verify { get; set; }

        private readonly IssueType[] configurableIssueTypes =
        {
            IssueType.Warning,
            IssueType.Error,
            IssueType.Negligible
        };

        private BindableList<IssueType> hiddenIssueTypes;

        protected override string Header => "Visibility";

        [BackgroundDependencyLoader]
        private void load(OverlayColourProvider colours)
        {
            hiddenIssueTypes = verify.HiddenIssueTypes.GetBoundCopy();

            foreach (IssueType issueType in configurableIssueTypes)
            {
                var checkbox = new SettingsCheckbox
                {
                    Anchor = Anchor.CentreLeft,
                    Origin = Anchor.CentreLeft,
                    LabelText = issueType.ToString(),
                    Current = { Default = !hiddenIssueTypes.Contains(issueType) }
                };

                checkbox.Current.SetDefault();
                checkbox.Current.BindValueChanged(state =>
                {
                    if (!state.NewValue)
                        hiddenIssueTypes.Add(issueType);
                    else
                        hiddenIssueTypes.Remove(issueType);
                });

                Flow.Add(checkbox);
            }
        }
    }
}

Set default for bindable in object initializer

Fixes the CI failure.


using System;
using System.ComponentModel;
using Windows.ApplicationModel;

#if WINDOWS_UWP

namespace Xamarin.Forms.Platform.UWP
#else

namespace Xamarin.Forms.Platform.WinRT
#endif
{
	public abstract class WindowsBasePage : Windows.UI.Xaml.Controls.Page
	{
		public WindowsBasePage()
		{
			Windows.UI.Xaml.Application.Current.Suspending += OnApplicationSuspending;
			Windows.UI.Xaml.Application.Current.Resuming += OnApplicationResuming;
		}

		protected Platform Platform { get; private set; }

		protected abstract Platform CreatePlatform();

		protected void LoadApplication(Application application)
		{
			if (application == null)
				throw new ArgumentNullException("application");

			Application.Current = application;
			Platform = CreatePlatform();
			Platform.SetPage(Application.Current.MainPage);
			application.PropertyChanged += OnApplicationPropertyChanged;

			Application.Current.SendStart();
		}

		void OnApplicationPropertyChanged(object sender, PropertyChangedEventArgs e)
		{
			if (e.PropertyName == "MainPage")
				Platform.SetPage(Application.Current.MainPage);
		}

		void OnApplicationResuming(object sender, object e)
		{
			Application.Current.SendResume();
		}

		async void OnApplicationSuspending(object sender, SuspendingEventArgs e)
		{
			SuspendingDeferral deferral = e.SuspendingOperation.GetDeferral();
			await Application.Current.SendSleepAsync();
			deferral.Complete();
		}
	}
}

using System;
using System.ComponentModel;
using Windows.ApplicationModel;

#if WINDOWS_UWP

namespace Xamarin.Forms.Platform.UWP
#else

namespace Xamarin.Forms.Platform.WinRT
#endif
{
	public abstract class WindowsBasePage : Windows.UI.Xaml.Controls.Page
	{
		public WindowsBasePage()
		{
			if (!DesignMode.DesignModeEnabled)
			{
				Windows.UI.Xaml.Application.Current.Suspending += OnApplicationSuspending;
				Windows.UI.Xaml.Application.Current.Resuming += OnApplicationResuming;
			}
		}

		protected Platform Platform { get; private set; }

		protected abstract Platform CreatePlatform();

		protected void LoadApplication(Application application)
		{
			if (application == null)
				throw new ArgumentNullException("application");

			Application.Current = application;
			Platform = CreatePlatform();
			Platform.SetPage(Application.Current.MainPage);
			application.PropertyChanged += OnApplicationPropertyChanged;

			Application.Current.SendStart();
		}

		void OnApplicationPropertyChanged(object sender, PropertyChangedEventArgs e)
		{
			if (e.PropertyName == "MainPage")
				Platform.SetPage(Application.Current.MainPage);
		}

		void OnApplicationResuming(object sender, object e)
		{
			Application.Current.SendResume();
		}

		async void OnApplicationSuspending(object sender, SuspendingEventArgs e)
		{
			SuspendingDeferral deferral = e.SuspendingOperation.GetDeferral();
			await Application.Current.SendSleepAsync();
			deferral.Complete();
		}
	}
}

Fix crash in UWP design mode

Fix crash in UWP design mode


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Chq.OAuth.Credentials;

namespace Chq.OAuth
{
    public sealed class Client
    {
        private OAuthContext _context;
        public OAuthContext Context
        {
            get { return _context; }
        }

        public TokenContainer RequestToken { get; set; }
        public TokenContainer AccessToken { get; set; }

        public Client(OAuthContext context)
        {
            _context = context;
        }

        public OAuthRequest MakeRequest(string method)
        {
            return new OAuthRequest(method, Context);
        }

        public Uri GetAuthorizationUri()
        {
            return new Uri(Context.AuthorizationUri.ToString() + "?oauth_token=" + RequestToken.Token);
        }

        public void Reset()
        {
            RequestToken = null;
            AccessToken = null;
        }

        public OAuthState State()
        {
            if (RequestToken == null) return OAuthState.RequestRequired;
            else if (AccessToken == null) return OAuthState.TokenRequired;
            else return OAuthState.Ready;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Chq.OAuth.Credentials;
using System.Reflection;

namespace Chq.OAuth
{
    public sealed class Client
    {
        private OAuthContext _context;
        public OAuthContext Context
        {
            get { return _context; }
        }

        public TokenContainer RequestToken { get; set; }
        public TokenContainer AccessToken { get; set; }

        public Client(OAuthContext context)
        {
            _context = context;
        }

        public OAuthRequest MakeRequest(string method)
        {
            return new OAuthRequest(method, Context);
        }

        public Uri GetAuthorizationUri()
        {
            return GetAuthorizationUri(null);
        }

        public Uri GetAuthorizationUri(object parameters)
        {
            string queryString = String.Empty;

            if (parameters != null)
            {
                Dictionary<string, string> queryParameters = new Dictionary<string, string>();
#if WINMD
                foreach (var parameter in parameters.GetType().GetTypeInfo().DeclaredProperties)
                {
                    if (queryParameters.ContainsKey(parameter.Name)) queryParameters.Remove(parameter.Name);
                    queryParameters.Add(parameter.Name, parameter.GetValue(parameters).ToString());
                }
#else
                foreach (var parameter in parameters.GetType().GetProperties())
                {
                    if (queryParameters.ContainsKey(parameter.Name)) queryParameters.Remove(parameter.Name);
                    queryParameters.Add(parameter.Name, parameter.GetValue(parameters, null).ToString());
                }
#endif
                foreach (var parameter in queryParameters)
                {
                    queryString = String.Format("{0}&{1}={2}", queryString, parameter.Key, Uri.EscapeDataString(parameter.Value));
                }
            }

            return new Uri(Context.AuthorizationUri.ToString() + "?oauth_token=" + RequestToken.Token + queryString);
        }

        public void Reset()
        {
            RequestToken = null;
            AccessToken = null;
        }

        public OAuthState State()
        {
            if (RequestToken == null) return OAuthState.RequestRequired;
            else if (AccessToken == null) return OAuthState.TokenRequired;
            else return OAuthState.Ready;
        }
    }
}

Allow parameters for get authorization uri

As per 2.2.  Resource Owner Authorization: "Servers MAY specify
additional parameters."
Added an overload to GetAuthorizationUri to allow arbitrary query params
to be specified.


// 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.Catch.Objects;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;

namespace osu.Game.Rulesets.Catch.Scoring
{
    internal class CatchScoreProcessor : ScoreProcessor<CatchBaseHit>
    {
        public CatchScoreProcessor()
        {
        }

        public CatchScoreProcessor(RulesetContainer<CatchBaseHit> rulesetContainer)
            : base(rulesetContainer)
        {
        }
    }
}

// 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.Beatmaps;
using osu.Game.Rulesets.Catch.Judgements;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;

namespace osu.Game.Rulesets.Catch.Scoring
{
    internal class CatchScoreProcessor : ScoreProcessor<CatchBaseHit>
    {
        public CatchScoreProcessor(RulesetContainer<CatchBaseHit> rulesetContainer)
            : base(rulesetContainer)
        {
        }

        protected override void SimulateAutoplay(Beatmap<CatchBaseHit> beatmap)
        {
            foreach (var obj in beatmap.HitObjects)
            {
                var fruit = obj as Fruit;

                if (fruit != null)
                    AddJudgement(new CatchJudgement { Result = HitResult.Perfect });
            }

            base.SimulateAutoplay(beatmap);
        }
    }
}

Add the most basic score calculation for catch


using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using MQTTnet.Adapter;
using MQTTnet.Diagnostics;
using MQTTnet.Server;

namespace MQTTnet.AspNetCore
{
    public class MqttHostedServer : MqttServer, IHostedService
    {
        private readonly MqttServerOptions _options;

        public MqttHostedServer(MqttServerOptions options, IEnumerable<IMqttServerAdapter> adapters, IMqttNetLogger logger) : base(adapters, logger)
        {
            _options = options ?? throw new ArgumentNullException(nameof(options));
        }

        public Task StartAsync(CancellationToken cancellationToken)
        {
            return StartAsync(_options);
        }

        public Task StopAsync(CancellationToken cancellationToken)
        {
            return StopAsync();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using MQTTnet.Adapter;
using MQTTnet.Diagnostics;
using MQTTnet.Server;

namespace MQTTnet.AspNetCore
{
    public class MqttHostedServer : MqttServer, IHostedService
    {
        private readonly IMqttServerOptions _options;

        public MqttHostedServer(IMqttServerOptions options, IEnumerable<IMqttServerAdapter> adapters, IMqttNetLogger logger) : base(adapters, logger)
        {
            _options = options ?? throw new ArgumentNullException(nameof(options));
        }

        public Task StartAsync(CancellationToken cancellationToken)
        {
            return StartAsync(_options);
        }

        public Task StopAsync(CancellationToken cancellationToken)
        {
            return StopAsync();
        }
    }
}

Fix broken ASP.NET Core integration.

Fix broken ASP.NET Core integration.


@model PickupMailViewer.Models.MailModel

From: @Model.FromAddress

To: @Model.ToAddress

Sent date: @Html.DisplayFor(m => m.SentOn)

Subject: @Model.Subject

@Model.Body

    @Html.ActionLink("Download mail", "DownloadMail", new { mailId = @Model.MailId })

@model PickupMailViewer.Models.MailModel

    @Html.ActionLink("Download mail", "DownloadMail", new { mailId = @Model.MailId })

From: @Model.FromAddress

To: @Model.ToAddress

Sent date: @Html.DisplayFor(m => m.SentOn)

Subject: @Model.Subject

@Model.Body

Move the download link to the top

Move the download link to the top

This has the desired side effect that the mail display is not initially scrolled to the bottom, but to the top instead


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

namespace War
{
    class VesselSetter
    {
        private List<Vessel> _Vessels;
        private int _ProcessorsNumber;
        public VesselSetter(List<Instruction> instructions)
        {
            _ProcessorsNumber = Environment.ProcessorCount;
            _Vessels = new List<Vessel>();
            createVessels();
            setAndMixVesselsInstructions(instructions);
        }
        private void createVessels()
        {
            int processorCounter= _ProcessorsNumber;
            for (; processorCounter > 0; processorCounter--)
            {
                Vessel vessel = new Vessel();
                _Vessels.Add(vessel);
            }
        }
        private void setAndMixVesselsInstructions(List<Instruction> instructions)
        {
            try
            {
                Parallel.ForEach(_Vessels, currentVessel =>
                {
                    foreach (Instruction instruction in instructions)
                    {
                        if (instruction.Id == currentVessel.Id || instruction.Id % 10 == currentVessel.Id % 10)
                        {
                            currentVessel.addInstruction(instruction);
                        }
                    }
                    currentVessel.mixInstructions();
                }
                );
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
        }
        public List<Vessel> vessels
        {
            get{
                return _Vessels;
            }
        }
    }
}

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

namespace War
{
    class VesselSetter
    {
        private List<Vessel> _Vessels;
        private int _ProcessorsNumber;
        public VesselSetter(List<Instruction> instructions)
        {
            _ProcessorsNumber = Environment.ProcessorCount;
            _Vessels = new List<Vessel>();
            createVessels();
            setVesselsInstructions(instructions);
            mixInstructions();
        }
        private void createVessels()
        {
            int processorCounter= _ProcessorsNumber;
            for (; processorCounter > 0; processorCounter--)
            {
                Vessel vessel = new Vessel();
                _Vessels.Add(vessel);
            }
        }
        private void setVesselsInstructions(List<Instruction> instructions)
        {
            try
            {
                Parallel.ForEach(_Vessels, currentVessel =>
                {
                    foreach (Instruction instruction in instructions)
                    {
                        if (instruction.Id == currentVessel.Id || instruction.Id % 10 == currentVessel.Id % 10)
                        {
                            currentVessel.addInstruction(instruction);
                        }
                    }
                }
                );
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
        }
        private void mixInstructions()
        {
            try
            {
                Parallel.ForEach(_Vessels, currentVessel =>
                {
                    currentVessel.mixInstructions();
                }
                );
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
        }
        public List<Vessel> vessels
        {
            get{
                return _Vessels;
            }
        }
    }
}

Divide Functions of mixing and setting instructions


using Discord.Commands;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace portalbot.Commands
{
    public class AskModule : ModuleBase
    {
        private List<string> _answers = new List<string>
            {
                "It is certain.",
                "It is decidedly so.",
                "Without a doubt.",
                "Yes, definitely.",
                "You may rely on it.",
                "As I see it, yes.",
                "Most likely.",
                "Outlook good.",
                "Yes.",
                "Signs point to yes.",
                "Reply hazy try again.",
                "Ask again later.",
                "Better not tell you now.",
                "Cannot predict now.",
                "Concentrate and ask again.",
                "Don't count on it.",
                "My reply is no.",
                "My sources say no.",
                "Outlook not so good.",
                "Very doubtful."
            };
        private readonly Random _random;

        public AskModule(Random random)
        {
            _random = random;
        }

        [Command("ask"), Summary("Ask a question.")]
        public async Task Ask([Remainder, Summary("Your question")] string question)
        {
            var answer = _answers[_random.Next(21)];
            var userInfo = Context.User;
            await ReplyAsync($"{userInfo.Username} asked, \"{question}\" Magic 8-ball says: ***\"{answer}\"***");
        }
    }
}

using Discord.Commands;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace portalbot.Commands
{
    public class AskModule : ModuleBase
    {
        private List<string> _answers = new List<string>
            {
                "It is certain.",
                "It is decidedly so.",
                "Without a doubt.",
                "Yes, definitely.",
                "You may rely on it.",
                "As I see it, yes.",
                "Most likely.",
                "Outlook good.",
                "Yes.",
                "Signs point to yes.",
                "Reply hazy try again.",
                "Ask again later.",
                "Better not tell you now.",
                "Cannot predict now.",
                "Concentrate and ask again.",
                "Don't count on it.",
                "My reply is no.",
                "My sources say no.",
                "Outlook not so good.",
                "Very doubtful."
            };
        private readonly Random _random;

        public AskModule(Random random)
        {
            _random = random;
        }

        [Command("ask"), Summary("Ask a question.")]
        public async Task Ask([Remainder, Summary("Your question")] string question)
        {
            var answer = _answers[_random.Next(20)];
            var userInfo = Context.User;
            await ReplyAsync($"{userInfo.Username} asked, \"{question}\" Magic 8-ball says: ***\"{answer}\"***");
        }
    }
}

Fix index out of range error

Fix index out of range error


using Moq;
using SFA.DAS.EAS.TestCommon.DbCleanup;
using SFA.DAS.EAS.TestCommon.DependencyResolution;
using SFA.DAS.EAS.Web;
using SFA.DAS.EAS.Web.Authentication;
using SFA.DAS.Messaging;
using StructureMap;
using TechTalk.SpecFlow;

namespace SFA.DAS.EAS.Transactions.AcceptanceTests.Steps.CommonSteps
{
    [Binding]
    public static class GlobalTestSteps
    {
        private static Mock<IMessagePublisher> _messagePublisher;
        private static Mock<IOwinWrapper> _owinWrapper;
        private static Container _container;
        private static Mock<ICookieService> _cookieService;

        [AfterTestRun()]
        public static void Arrange()
        {
            _messagePublisher = new Mock<IMessagePublisher>();
            _owinWrapper = new Mock<IOwinWrapper>();
            _cookieService = new Mock<ICookieService>();

            _container = IoC.CreateContainer(_messagePublisher, _owinWrapper, _cookieService);

            var cleanDownDb = _container.GetInstance<ICleanDatabase>();
            cleanDownDb.Execute().Wait();

            var cleanDownTransactionDb = _container.GetInstance<ICleanTransactionsDatabase>();
            cleanDownTransactionDb.Execute().Wait();
        }
    }
}

using Moq;
using SFA.DAS.EAS.TestCommon.DbCleanup;
using SFA.DAS.EAS.TestCommon.DependencyResolution;
using SFA.DAS.EAS.Web;
using SFA.DAS.EAS.Web.Authentication;
using SFA.DAS.Messaging;
using StructureMap;
using TechTalk.SpecFlow;

namespace SFA.DAS.EAS.Transactions.AcceptanceTests.Steps.CommonSteps
{
    [Binding]
    public static class GlobalTestSteps
    {
        private static Mock<IMessagePublisher> _messagePublisher;
        private static Mock<IOwinWrapper> _owinWrapper;
        private static Container _container;
        private static Mock<ICookieService> _cookieService;

        [AfterScenario()]
        public static void Arrange()
        {
            _messagePublisher = new Mock<IMessagePublisher>();
            _owinWrapper = new Mock<IOwinWrapper>();
            _cookieService = new Mock<ICookieService>();

            _container = IoC.CreateContainer(_messagePublisher, _owinWrapper, _cookieService);

            var cleanDownDb = _container.GetInstance<ICleanDatabase>();
            cleanDownDb.Execute().Wait();

            var cleanDownTransactionDb = _container.GetInstance<ICleanTransactionsDatabase>();
            cleanDownTransactionDb.Execute().Wait();
        }
    }
}

Change to when the cleardown is invoked

Change to when the cleardown is invoked

Change so that the levy data is cleared after each scenario to avoid
having problems with using the same scheme number in scenarios


using System.Collections.Generic;
using System.Linq;
using Spk.Common.Helpers.Guard;

namespace Spk.Common.Helpers.Service
{
    public class ServiceResult
    {
        public IEnumerable<string> Errors => _internalErrors;
        private readonly List<string> _internalErrors = new List<string>();

        public IEnumerable<string> Warnings => _internalWarnings;
        private readonly List<string> _internalWarnings = new List<string>();

        public bool Success => !Errors.Any();
        public bool HasWarnings => Warnings.Any();

        public void AddError(string error)
        {
            error.GuardIsNotNull(nameof(error));
            _internalErrors.Add(error);
        }

        public string GetFirstError()
        {
            return Errors.FirstOrDefault();
        }

        public void AddWarning(string warning)
        {
            warning.GuardIsNotNull(nameof(warning));
            _internalWarnings.Add(warning);
        }

        public string GetFirstWarning()
        {
            return Warnings.FirstOrDefault();
        }
    }

    public class ServiceResult<T> : ServiceResult
    {
        public T Data { get; private set; }

        public ServiceResult(T data)
        {
            SetData(data.GuardIsNotNull(nameof(data)));
        }

        public ServiceResult()
        {
        }

        public void SetData(T data)
        {
            Data = data;
        }
    }
}

using System.Collections.Generic;
using System.Linq;
using Spk.Common.Helpers.Guard;

namespace Spk.Common.Helpers.Service
{
    public class ServiceResult
    {
        public IEnumerable<string> Errors => _internalErrors;
        private readonly List<string> _internalErrors = new List<string>();

        public IEnumerable<string> Warnings => _internalWarnings;
        private readonly List<string> _internalWarnings = new List<string>();

        public bool Success => !Errors.Any();
        public bool HasWarnings => Warnings.Any();

        public void AddError(string error)
        {
            error.GuardIsNotNullOrWhiteSpace(nameof(error));
            _internalErrors.Add(error);
        }

        public string GetFirstError()
        {
            return Errors.FirstOrDefault();
        }

        public void AddWarning(string warning)
        {
            warning.GuardIsNotNullOrWhiteSpace(nameof(warning));
            _internalWarnings.Add(warning);
        }

        public string GetFirstWarning()
        {
            return Warnings.FirstOrDefault();
        }
    }

    public class ServiceResult<T> : ServiceResult
    {
        public T Data { get; private set; }

        public ServiceResult(T data)
        {
            SetData(data.GuardIsNotNull(nameof(data)));
        }

        public ServiceResult()
        {
        }

        public void SetData(T data)
        {
            Data = data;
        }
    }
}

Leverage 'GuardIsNotNullOrWhiteSpace' method instead of 'GuardIsNotNull'


//------------------------------------------------------------------------------
// <copyright
//  file="Generator.cs"
//  company="Schley Andrew Kutz">
//  Copyright (c) Schley Andrew Kutz. All rights reserved.
// </copyright>
// <authors>
//   <author>Schley Andrew Kutz</author>
// </authors>
//------------------------------------------------------------------------------
namespace StyleCopCmd.Core
{
    /// <summary>
    /// Available generators
    /// </summary>
    public enum Generator
    {
        /// <summary>
        /// Default generator (currently console runner)
        /// </summary>
        Default,

        /// <summary>
        /// Maps to the console runner
        /// </summary>
        Console,

        /// <summary>
        /// XML runner (output only, no reporting)
        /// </summary>
        Xml
    }
}

//------------------------------------------------------------------------------
// <copyright
//  file="FileRunner.cs"
//  company="enckse">
//  Copyright (c) All rights reserved.
// </copyright>
//------------------------------------------------------------------------------
namespace StyleCopCmd.Core
{
    /// <summary>
    /// Available generators
    /// </summary>
    public enum Generator
    {
        /// <summary>
        /// Default generator (currently console runner)
        /// </summary>
        Default,

        /// <summary>
        /// Maps to the console runner
        /// </summary>
        Console,

        /// <summary>
        /// XML runner (output only, no reporting)
        /// </summary>
        Xml
    }
}

Put the wrong header in this file

Put the wrong header in this file


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

using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
using osu.Game.Rulesets.Objects.Drawables;

namespace osu.Game.Rulesets.Mania.Objects.Drawables
{
    public class DrawableNote : DrawableManiaHitObject<Note>
    {
        private NotePiece headPiece;

        public DrawableNote(Note hitObject)
            : base(hitObject)
        {
            RelativeSizeAxes = Axes.X;
            AutoSizeAxes = Axes.Y;

            Add(headPiece = new NotePiece
            {
                Anchor = Anchor.BottomCentre,
                Origin = Anchor.BottomCentre
            });
        }

        public override Color4 AccentColour
        {
            get { return AccentColour; }
            set
            {
                if (base.AccentColour == value)
                    return;
                base.AccentColour = value;

                headPiece.AccentColour = value;
            }
        }

        protected override void UpdateState(ArmedState state)
        {
        }
    }
}

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

using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces;
using osu.Game.Rulesets.Objects.Drawables;

namespace osu.Game.Rulesets.Mania.Objects.Drawables
{
    public class DrawableNote : DrawableManiaHitObject<Note>
    {
        private NotePiece headPiece;

        public DrawableNote(Note hitObject)
            : base(hitObject)
        {
            RelativeSizeAxes = Axes.X;
            AutoSizeAxes = Axes.Y;

            Add(headPiece = new NotePiece
            {
                Anchor = Anchor.BottomCentre,
                Origin = Anchor.BottomCentre
            });
        }

        public override Color4 AccentColour
        {
            get { return AccentColour; }
            set
            {
                if (base.AccentColour == value)
                    return;
                base.AccentColour = value;

                headPiece.AccentColour = value;
            }
        }

        protected override void Update()
        {
            if (Time.Current > HitObject.StartTime)
                Colour = Color4.Green;
        }

        protected override void UpdateState(ArmedState state)
        {
        }
    }
}

Add t=0 display to notes.

Add t=0 display to notes.


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

using osu.Framework.IO.Network;
using osu.Game.Beatmaps;

namespace osu.Game.Online.API.Requests
{
    public class DownloadBeatmapSetRequest : ArchiveDownloadRequest<BeatmapSetInfo>
    {
        private readonly bool noVideo;

        public DownloadBeatmapSetRequest(BeatmapSetInfo set, bool noVideo)
            : base(set)
        {
            this.noVideo = noVideo;
        }

        protected override WebRequest CreateWebRequest()
        {
            var req = base.CreateWebRequest();
            req.Timeout = 60000;
            return req;
        }

        protected override string Target => $@"beatmapsets/{Model.OnlineBeatmapSetID}/download{(noVideo ? "?noVideo=1" : "")}";
    }
}

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

using osu.Framework.IO.Network;
using osu.Game.Beatmaps;

namespace osu.Game.Online.API.Requests
{
    public class DownloadBeatmapSetRequest : ArchiveDownloadRequest<BeatmapSetInfo>
    {
        private readonly bool noVideo;

        public DownloadBeatmapSetRequest(BeatmapSetInfo set, bool noVideo)
            : base(set)
        {
            this.noVideo = noVideo;
        }

        protected override WebRequest CreateWebRequest()
        {
            var req = base.CreateWebRequest();
            req.Timeout = 60000;
            return req;
        }

        protected override string FileExtension => ".osz";

        protected override string Target => $@"beatmapsets/{Model.OnlineBeatmapSetID}/download{(noVideo ? "?noVideo=1" : "")}";
    }
}

Fix temp files from beatmap listing imports not being cleaned up

As reported in #12718, it turns out that temporary files from beatmap
set downloads performed via the beatmap listing overlay could remain in
the user's filesystem even after the download has concluded.

The reason for the issue is a failure in component integration.
In the case of online downloads, files are first downloaded to a
temporary directory (`C:/Temp` or `/tmp`), with a randomly generated
filename, which ends in an extension of `.tmp`.

On the other side, `ArchiveModelManager`s have a `ShouldDeleteArchive()`
method, which determines whether a file should be deleted after
importing. At the time of writing, in the case of beatmap imports the
file is only automatically cleaned up if the extension of the file is
equal to `.osz`, which was not the case for temporary files.

As it turns out, `APIDownloadRequest` has a facility for adjusting the
file's extension, via the protected `FileExtension` property. Therefore,
use it in the case of `DownloadBeatmapSetRequest` to specify `.osz`,
which then will make sure that the `ShouldDeleteArchive()` check in
`BeatmapManager` picks it up for clean-up.


using System.Linq;
using System.Threading.Tasks;
using TeamCityApi.Helpers;
using TeamCityApi.Logging;

namespace TeamCityApi.UseCases
{
    public class DeleteClonedBuildChainUseCase
    {
        private static readonly ILog Log = LogProvider.GetLogger(typeof(DeleteClonedBuildChainUseCase));

        private readonly ITeamCityClient _client;

        public DeleteClonedBuildChainUseCase(ITeamCityClient client)
        {
            _client = client;
        }

        public async Task Execute(string buildConfigId, bool simulate = false)
        {
            Log.InfoFormat("Delete Cloned Build Chain.");

            var buildConfig = await _client.BuildConfigs.GetByConfigurationId(buildConfigId);
            var buildChainId = buildConfig.Parameters[ParameterName.BuildConfigChainId].Value;
            var buildConfigChain = new BuildConfigChain(_client.BuildConfigs, buildConfig);
            await DeleteClonedBuildChain(buildConfigChain, buildChainId, simulate);
        }

        private async Task DeleteClonedBuildChain(BuildConfigChain buildConfigChain, string buildChainId, bool simulate)
        {
            foreach (var node in buildConfigChain.Nodes.Where(node => node.Value.Parameters[ParameterName.BuildConfigChainId].Value == buildChainId))
            {
                Log.InfoFormat("Deleting buildConfigId: {0}", node.Value.Id);
                if (!simulate)
                {
                    await _client.BuildConfigs.DeleteBuildConfig(node.Value.Id);
                }
            }
        }
    }
}

using System.Linq;
using System.Threading.Tasks;
using TeamCityApi.Helpers;
using TeamCityApi.Logging;

namespace TeamCityApi.UseCases
{
    public class DeleteClonedBuildChainUseCase
    {
        private static readonly ILog Log = LogProvider.GetLogger(typeof(DeleteClonedBuildChainUseCase));

        private readonly ITeamCityClient _client;

        public DeleteClonedBuildChainUseCase(ITeamCityClient client)
        {
            _client = client;
        }

        public async Task Execute(string buildConfigId, bool simulate = false)
        {
            Log.InfoFormat("Delete Cloned Build Chain.");

            var buildConfig = await _client.BuildConfigs.GetByConfigurationId(buildConfigId);
            var buildChainId = buildConfig.Parameters[ParameterName.BuildConfigChainId].Value;
            var buildConfigChain = new BuildConfigChain(_client.BuildConfigs, buildConfig);
            await DeleteClonedBuildChain(buildConfigChain, buildChainId, simulate);
        }

        private async Task DeleteClonedBuildChain(BuildConfigChain buildConfigChain, string buildChainId, bool simulate)
        {
            var buildConfigIdsToDelete = buildConfigChain.Nodes
                .Where(node => node.Value.Parameters[ParameterName.BuildConfigChainId].Value == buildChainId)
                .Select(n => n.Value.Id)
                .ToList();

            buildConfigIdsToDelete.Reverse(); //to start deletion from leafs

            foreach (var buildConfigId in buildConfigIdsToDelete)
            {
                Log.InfoFormat("Deleting buildConfigId: {0}", buildConfigId);
                if (!simulate)
                {
                    await _client.BuildConfigs.DeleteBuildConfig(buildConfigId);
                }
            }
        }
    }
}

Tweak delete cloned build chain routine.

Change to delete leafs first (so it will be easier to restart
delete from root of something fails in the middle)

Also collect all build config ids to separate list before deletion,
to make it easier to inspect and debug what is about to be deleted


using System;
using System.Web;

namespace Stampsy.ImageSource
{
    public class AssetDescription : IDescription
    {
        public enum AssetImageKind
        {
            Thumbnail,
            FullResolution
        }

        public AssetImageKind Kind { get; private set; }
        public string AssetUrl { get; private set; }
        public string Extension { get; private set; }

        private Uri _url;

        public Uri Url {
            get { return _url; }
            set {
                _url = value;

                Kind = ParseImageKind (value);
                AssetUrl = GenerateAssetUrl (value, Kind);
                Extension = ParseExtension (value);
            }
        }

        static string GenerateAssetUrl (Uri url, AssetImageKind size)
        {
            if (size == AssetImageKind.Thumbnail)
                return url.AbsoluteUri.Replace ("thumbnail", "asset");

            return url.AbsoluteUri;
        }

        static AssetImageKind ParseImageKind (Uri url)
        {
            return url.Host == "thumbnail"
                ? AssetImageKind.Thumbnail
                : AssetImageKind.FullResolution;
        }

        static string ParseExtension (Uri url)
        {
            var ext = HttpUtility.ParseQueryString (url.AbsoluteUri) ["ext"];
            if (!string.IsNullOrEmpty (ext))
                ext = "." + ext.ToLower ();

            return ext;
        }
    }
}

using System;
using System.Web;

namespace Stampsy.ImageSource
{
    public class AssetDescription : IDescription
    {
        public enum AssetImageKind
        {
            Thumbnail,
            FullResolution
        }

        public AssetImageKind Kind { get; private set; }
        public string AssetUrl { get; private set; }
        public string Extension { get; private set; }

        private Uri _url;

        public Uri Url {
            get { return _url; }
            set {
                _url = value;

                Kind = ParseImageKind (value);
                AssetUrl = GenerateAssetUrl (value, Kind);
                Extension = ParseExtension (value);
            }
        }

        static string GenerateAssetUrl (Uri url, AssetImageKind size)
        {
            var builder = new UriBuilder (url);
            builder.Host = "asset";
            return builder.ToString ();
        }

        static AssetImageKind ParseImageKind (Uri url)
        {
            return url.Host == "thumbnail"
                ? AssetImageKind.Thumbnail
                : AssetImageKind.FullResolution;
        }

        static string ParseExtension (Uri url)
        {
            var ext = HttpUtility.ParseQueryString (url.AbsoluteUri) ["ext"];
            if (!string.IsNullOrEmpty (ext))
                ext = "." + ext.ToLower ();

            return ext;
        }
    }
}

Rewrite this to be shorter & consistent

Rewrite this to be shorter & consistent


//-----------------------------------------------------------------------
// <copyright file="WebConfiguration.cs" company="Marimer LLC">
//     Copyright (c) Marimer LLC. All rights reserved.
//     Website: https://cslanet.com
// </copyright>
// <summary>Implement extension methods for .NET Core configuration</summary>
//-----------------------------------------------------------------------
using System;
using Microsoft.Extensions.Hosting;

namespace Csla.Configuration
{
  /// <summary>
  /// Implement extension methods for .NET Core configuration
  /// </summary>
  public static class WindowsConfigurationExtensions
  {
    /// <summary>
    /// Configures the application to use CSLA .NET
    /// </summary>
    /// <param name="builder">IHostBuilder instance</param>
    public static HostBuilder UseCsla(this HostBuilder builder)
    {
      UseCsla(builder, null);
      return builder;
    }

    /// <summary>
    /// Configures the application to use CSLA .NET
    /// </summary>
    /// <param name="builder">IHostBuilder instance</param>
    /// <param name="config">Implement to configure CSLA .NET</param>
    public static HostBuilder UseCsla(
      this HostBuilder builder, Action<CslaConfiguration> config)
    {
      CslaConfiguration.Configure().
        ContextManager(typeof(Csla.Windows.ApplicationContextManager));
      config?.Invoke(CslaConfiguration.Configure());
      return builder;
    }
  }
}

//-----------------------------------------------------------------------
// <copyright file="WebConfiguration.cs" company="Marimer LLC">
//     Copyright (c) Marimer LLC. All rights reserved.
//     Website: https://cslanet.com
// </copyright>
// <summary>Implement extension methods for .NET Core configuration</summary>
//-----------------------------------------------------------------------
using System;
using Microsoft.Extensions.Hosting;

namespace Csla.Configuration
{
  /// <summary>
  /// Implement extension methods for .NET Core configuration
  /// </summary>
  public static class WindowsConfigurationExtensions
  {
    /// <summary>
    /// Configures the application to use CSLA .NET
    /// </summary>
    /// <param name="builder">IHostBuilder instance</param>
    public static IHostBuilder UseCsla(this IHostBuilder builder)
    {
      UseCsla(builder, null);
      return builder;
    }

    /// <summary>
    /// Configures the application to use CSLA .NET
    /// </summary>
    /// <param name="builder">IHostBuilder instance</param>
    /// <param name="config">Implement to configure CSLA .NET</param>
    public static IHostBuilder UseCsla(
      this IHostBuilder builder, Action<CslaConfiguration> config)
    {
      CslaConfiguration.Configure().
        ContextManager(typeof(Csla.Windows.ApplicationContextManager));
      config?.Invoke(CslaConfiguration.Configure());
      return builder;
    }
  }
}

Change UseCsla extension method from HostBuilder to IHostBuilder for: !NET40 and !NET45, as its not available for those.


using System.Collections.Generic;

namespace Oxide.Core.Libraries.Covalence
{
    /// <summary>
    /// Represents a generic player manager
    /// </summary>
    public interface IPlayerManager
    {
        #region Player Finding

        /// <summary>
        /// Gets all players
        /// </summary>
        /// <returns></returns>
        IEnumerable<IPlayer> All { get; }

        /// <summary>
        /// Gets all connected players
        /// </summary>
        /// <returns></returns>
        IEnumerable<IPlayer> Connected { get; }

        /// <summary>
        /// Finds a single player given a partial name or unique ID (case-insensitive, wildcards accepted, multiple matches returns null)
        /// </summary>
        /// <param name="partialNameOrId"></param>
        /// <returns></returns>
        IPlayer FindPlayer(string partialNameOrId);

        /// <summary>
        /// Finds any number of players given a partial name or unique ID (case-insensitive, wildcards accepted)
        /// </summary>
        /// <param name="partialNameOrId"></param>
        /// <returns></returns>
        IEnumerable<IPlayer> FindPlayers(string partialNameOrId);

        #endregion
    }
}

using System.Collections.Generic;

namespace Oxide.Core.Libraries.Covalence
{
    /// <summary>
    /// Represents a generic player manager
    /// </summary>
    public interface IPlayerManager
    {
        #region Player Finding

        /// <summary>
        /// Gets all players
        /// </summary>
        /// <returns></returns>
        IEnumerable<IPlayer> All { get; }

        /// <summary>
        /// Gets all connected players
        /// </summary>
        /// <returns></returns>
        IEnumerable<IPlayer> Connected { get; }

        /// <summary>
        /// Finds a single player given unique ID
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        IPlayer FindPlayerById(string id);

        /// <summary>
        /// Finds a single player given a partial name or unique ID (case-insensitive, wildcards accepted, multiple matches returns null)
        /// </summary>
        /// <param name="partialNameOrId"></param>
        /// <returns></returns>
        IPlayer FindPlayer(string partialNameOrId);

        /// <summary>
        /// Finds any number of players given a partial name or unique ID (case-insensitive, wildcards accepted)
        /// </summary>
        /// <param name="partialNameOrId"></param>
        /// <returns></returns>
        IEnumerable<IPlayer> FindPlayers(string partialNameOrId);

        #endregion
    }
}

[Covalence] Add missing interface for FindPlayerById


using System;
using System.Threading.Tasks;

namespace Glimpse.Agent
{
    public interface IAgentBroker
    {
        IObservable<MessageListenerOptions> Listen<T>();

        IObservable<MessageListenerOptions> ListenIncludeLatest<T>();

        void SendMessage(object message);
    }
}

using System;
using System.Threading.Tasks;

namespace Glimpse.Agent
{
    public interface IAgentBroker
    {
        IObservable<MessageListenerOptions> Listen<T>();

        IObservable<MessageListenerOptions> ListenIncludeLatest<T>();

        IObservable<MessageListenerOptions> ListenAll();

        IObservable<MessageListenerOptions> ListenAllIncludeLatest();

        void SendMessage(object message);
    }
}

Add some extra options to the agent broker interface


namespace Curse.NET.SocketModel
{
	public enum RequestType
	{
		Login = -2101997347,
	}

	public enum ResponseType
	{
		UserActivityChange = 1260535191,
		ChannelReference = -695526586,
		ChatMessage = -635182161,
		Login = -815187584,
		UnknownChange = 149631008
	}
}
//

namespace Curse.NET.SocketModel
{
	public enum RequestType
	{
		Login = -2101997347,
	}

	public enum ResponseType
	{
		ChannelStatusChanged = 72981382,
		UserActivityChange = 1260535191,
		ChannelMarkedRead = -695526586,
		ChatMessage = -635182161,
		Login = -815187584,
		MessageChanged = 149631008,
		Unknown1 = 705131365
	}
}
//

Add some more message types

Add some more message types


@using SFA.DAS.EmployerAccounts.Web.Extensions

<script type="text/javascript">
    window.zESettings = {
        webWidget: {
            contactForm: {
                attachments: false
            },
            chat: {
                menuOptions: {
                    emailTranscript: false
                }
            },
            helpCenter: {
                filter: {
                    section: @Html.GetZenDeskSnippetSectionId()
                }
            }
        }
    };
</script>

<script id="ze-snippet" src="https://static.zdassets.com/ekr/snippet.js?key=@Html.GetZenDeskSnippetKey()"></script>

@Html.SetZenDeskLabels(!string.IsNullOrWhiteSpace(ViewBag.Title) ? new[] {$"reg-{ViewBag.Title}"} : new string[] {ViewBag.ZenDeskLabel});

<script type="text/javascript">
    zE(function() {
        zE.identify({
            name: '@ViewBag.GaData.UserName',
            email: '@ViewBag.GaData.UserEmail',
            organization: '@ViewBag.GaData.Acc'
        });
    });
</script>

@using SFA.DAS.EmployerAccounts.Web.Extensions

<script type="text/javascript">
    window.zESettings = {
        webWidget: {
            contactForm: {
                attachments: false
            },
            chat: {
                menuOptions: {
                    emailTranscript: false
                }
            },
            helpCenter: {
                filter: {
                    section: @Html.GetZenDeskSnippetSectionId()
                }
            }
        }
    };
</script>

<script id="ze-snippet" src="https://static.zdassets.com/ekr/snippet.js?key=@Html.GetZenDeskSnippetKey()"></script>

@Html.SetZenDeskLabels(!string.IsNullOrWhiteSpace(ViewBag.Title) ? new[] {$"reg-{ViewBag.Title}"} : new string[] {ViewBag.ZenDeskLabel})

<script type="text/javascript">
    zE(function() {
        zE.identify({
            name: '@ViewBag.GaData.UserName',
            email: '@ViewBag.GaData.UserEmail',
            organization: '@ViewBag.GaData.Acc'
        });
    });
</script>

Remove semi-colon as it is being rendered in the UI


namespace TraktApiSharp.Tests.Experimental.Requests.Users.OAuth
{
    using FluentAssertions;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using TraktApiSharp.Experimental.Requests.Base.Post.Bodyless;
    using TraktApiSharp.Experimental.Requests.Users.OAuth;
    using TraktApiSharp.Objects.Get.Users;

    [TestClass]
    public class TraktUserApproveFollowerRequestTests
    {
        [TestMethod, TestCategory("Requests"), TestCategory("Users")]
        public void TestTraktUserApproveFollowerRequestIsNotAbstract()
        {
            typeof(TraktUserApproveFollowerRequest).IsAbstract.Should().BeFalse();
        }

        [TestMethod, TestCategory("Requests"), TestCategory("Users")]
        public void TestTraktUserApproveFollowerRequestIsSealed()
        {
            typeof(TraktUserApproveFollowerRequest).IsSealed.Should().BeTrue();
        }

        [TestMethod, TestCategory("Requests"), TestCategory("Users")]
        public void TestTraktUserApproveFollowerRequestIsSubclassOfATraktSingleItemBodylessPostByIdRequest()
        {
            typeof(TraktUserApproveFollowerRequest).IsSubclassOf(typeof(ATraktSingleItemBodylessPostByIdRequest<TraktUserFollower>)).Should().BeTrue();
        }
    }
}

namespace TraktApiSharp.Tests.Experimental.Requests.Users.OAuth
{
    using FluentAssertions;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using TraktApiSharp.Experimental.Requests.Base.Post.Bodyless;
    using TraktApiSharp.Experimental.Requests.Users.OAuth;
    using TraktApiSharp.Objects.Get.Users;
    using TraktApiSharp.Requests;

    [TestClass]
    public class TraktUserApproveFollowerRequestTests
    {
        [TestMethod, TestCategory("Requests"), TestCategory("Users")]
        public void TestTraktUserApproveFollowerRequestIsNotAbstract()
        {
            typeof(TraktUserApproveFollowerRequest).IsAbstract.Should().BeFalse();
        }

        [TestMethod, TestCategory("Requests"), TestCategory("Users")]
        public void TestTraktUserApproveFollowerRequestIsSealed()
        {
            typeof(TraktUserApproveFollowerRequest).IsSealed.Should().BeTrue();
        }

        [TestMethod, TestCategory("Requests"), TestCategory("Users")]
        public void TestTraktUserApproveFollowerRequestIsSubclassOfATraktSingleItemBodylessPostByIdRequest()
        {
            typeof(TraktUserApproveFollowerRequest).IsSubclassOf(typeof(ATraktSingleItemBodylessPostByIdRequest<TraktUserFollower>)).Should().BeTrue();
        }

        [TestMethod, TestCategory("Requests"), TestCategory("Users")]
        public void TestTraktUserApproveFollowerRequestHasAuthorizationRequired()
        {
            var request = new TraktUserApproveFollowerRequest(null);
            request.AuthorizationRequirement.Should().Be(TraktAuthorizationRequirement.Required);
        }
    }
}

Add test for authorization requirement in TraktUserApproveFollowerRequest


using System.Threading.Tasks;
using TTMouseclickSimulator.Core.Environment;

namespace TTMouseclickSimulator.Core.ToontownRewritten.Actions
{
    public class MouseHelpers
    {
        public static readonly Size ReferenceWindowSize = new Size(1600, 1151);

        public static async Task DoSimpleMouseClickAsync(IInteractionProvider provider,
            Coordinates coords, VerticalScaleAlignment valign = VerticalScaleAlignment.Center,
            int buttonDownTimeout = 200)
        {
            var pos = provider.GetCurrentWindowPosition();
            coords = pos.RelativeToAbsoluteCoordinates(pos.ScaleCoordinates(coords,
                ReferenceWindowSize, valign));

            provider.MoveMouse(coords);
            provider.PressMouseButton();
            await provider.WaitAsync(buttonDownTimeout);
            provider.ReleaseMouseButton();
        }

    }
}

using System.Threading.Tasks;
using TTMouseclickSimulator.Core.Environment;

namespace TTMouseclickSimulator.Core.ToontownRewritten.Actions
{
    public class MouseHelpers
    {
        public static readonly Size ReferenceWindowSize = new Size(1600, 1151);

        public static async Task DoSimpleMouseClickAsync(IInteractionProvider provider,
            Coordinates coords, VerticalScaleAlignment valign = VerticalScaleAlignment.Center,
            int buttonDownTimeout = 150)
        {
            var pos = provider.GetCurrentWindowPosition();
            coords = pos.RelativeToAbsoluteCoordinates(pos.ScaleCoordinates(coords,
                ReferenceWindowSize, valign));

            provider.MoveMouse(coords);
            provider.PressMouseButton();
            await provider.WaitAsync(buttonDownTimeout);
            provider.ReleaseMouseButton();
        }

    }
}

Reduce the default button down duration to 150 ms.


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using NitorInc.Utility;

namespace NitorInc.YuukaWater {

    public class YuukaWaterWaterdrop : MonoBehaviour {

        public float scaleSpeed = 1.0f;
        public GameObject sprayEffect;
        Rigidbody2D rigid;

        private Vector2 yuukaVel;

        void Start() {
            rigid = GetComponent<Rigidbody2D>();
            TimerManager.NewTimer(2.0f, SelfDestruct, 0);
        }

        public void SetInitialForce(Vector2 vel, Vector2 yuukaVel)
        {
            this.yuukaVel = yuukaVel;
            if (rigid == null)
                rigid = GetComponent<Rigidbody2D>();
            rigid.velocity = vel + yuukaVel;

            Update();
        }

        void SelfDestruct() {
            if (this != null) {
                Destroy(gameObject);
            }
        }

        // Update is called once per frame
        void Update() {
            transform.up = (rigid.velocity - yuukaVel) * -1.0f;
            transform.localScale += transform.localScale * scaleSpeed * Time.deltaTime;
        }

        private void OnCollisionEnter2D(Collision2D collision) {
            if (collision.gameObject.GetComponentInParent<YuukaWaterWaterdrop>() == null) {
                Instantiate(sprayEffect, collision.contacts[0].point, Quaternion.identity);
                Destroy(gameObject);
            }
        }
    }
}

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using NitorInc.Utility;

namespace NitorInc.YuukaWater {

    public class YuukaWaterWaterdrop : MonoBehaviour {

        public float scaleSpeed = 1.0f;
        public GameObject sprayEffect;
        Rigidbody2D rigid;

        private Vector2 yuukaVel;

        void Start() {
            rigid = GetComponent<Rigidbody2D>();
            TimerManager.NewTimer(2.0f, SelfDestruct, 0);
        }

        public void SetInitialForce(Vector2 vel, Vector2 yuukaVel)
        {
            this.yuukaVel = yuukaVel;
            if (rigid == null)
                rigid = GetComponent<Rigidbody2D>();
            rigid.velocity = vel + yuukaVel;

            Update();
        }

        void SelfDestruct() {
            if (this != null) {
                Destroy(gameObject);
            }
        }

        // Update is called once per frame
        void Update() {
            transform.up = (rigid.velocity - yuukaVel) * -1.0f;
            transform.localScale += transform.localScale * scaleSpeed * Time.deltaTime;
        }

        private void OnCollisionEnter2D(Collision2D collision) {
            if (collision.gameObject.GetComponentInParent<YuukaWaterWaterdrop>() == null) {
                if (collision.contacts.Length > 0)
                    Instantiate(sprayEffect, collision.contacts[0].point, Quaternion.identity);
                Destroy(gameObject);
            }
        }
    }
}

Fix YuukaWater drop creating errors on contact