using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authentication;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Wukong.Models;

namespace Wukong.Controllers
{
    [Route("oauth")]
    public class AuthController : Controller
    {
        [HttpGet("all")]
        public IEnumerable<OAuthMethod> AllSchemes()
        {
            return
                new List<OAuthMethod>{ new OAuthMethod()
                {
                    Scheme = "Microsoft",
                    DisplayName = "Microsoft",
                    Url = $"/oauth/go/{OpenIdConnectDefaults.AuthenticationScheme}"
                }};
        }

        [HttpGet("go/{any}")]
        public async Task SignIn(string any, string redirectUri = "/")
        {
            await HttpContext.ChallengeAsync(
                OpenIdConnectDefaults.AuthenticationScheme,
                new AuthenticationProperties {
                    RedirectUri = redirectUri,
                    IsPersistent = true,
                    ExpiresUtc = System.DateTime.UtcNow.AddDays(30)
                });
        }

        [HttpGet("signout")]
        public SignOutResult SignOut(string redirectUrl = "/")
        {
            return SignOut(new AuthenticationProperties { RedirectUri = redirectUrl },
                CookieAuthenticationDefaults.AuthenticationScheme,
                OpenIdConnectDefaults.AuthenticationScheme);
        }
    }
}

using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authentication;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Wukong.Models;

namespace Wukong.Controllers
{
    [Route("oauth")]
    public class AuthController : Controller
    {
        [HttpGet("all")]
        public IEnumerable<OAuthMethod> AllSchemes()
        {
            return
                new List<OAuthMethod>{ new OAuthMethod()
                {
                    Scheme = "Microsoft",
                    DisplayName = "Microsoft",
                    Url = $"/oauth/go/{OpenIdConnectDefaults.AuthenticationScheme}"
                }};
        }

        [HttpGet("go/{any}")]
        public async Task SignIn(string any, string redirectUri = "/")
        {
            await HttpContext.ChallengeAsync(
                OpenIdConnectDefaults.AuthenticationScheme,
                new AuthenticationProperties {
                    RedirectUri = redirectUri,
                    IsPersistent = true
                });
        }

        [HttpGet("signout")]
        public SignOutResult SignOut(string redirectUrl = "/")
        {
            return SignOut(new AuthenticationProperties { RedirectUri = redirectUrl },
                CookieAuthenticationDefaults.AuthenticationScheme,
                OpenIdConnectDefaults.AuthenticationScheme);
        }
    }
}

Revert "Make cookie valid for 30 days."

Revert "Make cookie valid for 30 days."

This reverts commit 148f68b7bd0f765a56122ae66fc2bc6ec31b624d.


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

namespace EchoNestNET
{
    [JsonObject]
    public class Genre
    {
        [JsonProperty(PropertyName = "name")]
        public string name { get; set; }
        [JsonProperty(PropertyName = "description")]
        public string description { get; set; }
        [JsonProperty(PropertyName = "similarity")]
        public float similarity { get; set; }

        [JsonObject]
        public class Urls
        {
            [JsonProperty(PropertyName = "wikipedia_url")]
            public string wikipediaUrl { get; set; }
        }
    }
}

Remove ConsoleApplication used for quick testing


using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using MediatR;
using SFA.DAS.EmployerApprenticeshipsService.Application.Queries.GetEmployerAccount;
using SFA.DAS.EmployerApprenticeshipsService.Application.Queries.GetEmployerAccountTransactions;
using SFA.DAS.EmployerApprenticeshipsService.Domain;

namespace SFA.DAS.EmployerApprenticeshipsService.Web.Orchestrators
{
    public class EmployerAccountTransactionsOrchestrator
    {
        private readonly IMediator _mediator;

        public EmployerAccountTransactionsOrchestrator(IMediator mediator)
        {
            if (mediator == null)
                throw new ArgumentNullException(nameof(mediator));
            _mediator = mediator;
        }

        public async Task<TransactionViewResult>  GetAccountTransactions(int accountId)
        {
            var employerAccountResult = await _mediator.SendAsync(new GetEmployerAccountQuery { Id = accountId });
            if (employerAccountResult == null)
            {
                return new TransactionViewResult();
            }

            var data = await _mediator.SendAsync(new GetEmployerAccountTransactionsQuery {AccountId = accountId});

            return new TransactionViewResult
            {
                Account = null,
                Model = new TransactionViewModel
                {
                    Data = data.Data
                }

            };

        }
    }

    public class TransactionViewResult
    {
        public Account Account { get; set; }
        public TransactionViewModel Model { get; set; }
    }

    public class TransactionViewModel
    {
        public AggregationData Data { get; set; }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using MediatR;
using SFA.DAS.EmployerApprenticeshipsService.Application.Queries.GetEmployerAccount;
using SFA.DAS.EmployerApprenticeshipsService.Application.Queries.GetEmployerAccountTransactions;
using SFA.DAS.EmployerApprenticeshipsService.Domain;

namespace SFA.DAS.EmployerApprenticeshipsService.Web.Orchestrators
{
    public class EmployerAccountTransactionsOrchestrator
    {
        private readonly IMediator _mediator;

        public EmployerAccountTransactionsOrchestrator(IMediator mediator)
        {
            if (mediator == null)
                throw new ArgumentNullException(nameof(mediator));
            _mediator = mediator;
        }

        public async Task<TransactionViewResult>  GetAccountTransactions(int accountId)
        {
            var employerAccountResult = await _mediator.SendAsync(new GetEmployerAccountQuery { Id = accountId });
            if (employerAccountResult == null)
            {
                return new TransactionViewResult();
            }

            var data = await _mediator.SendAsync(new GetEmployerAccountTransactionsQuery {AccountId = accountId});

            return new TransactionViewResult
            {
                Account = employerAccountResult.Account,
                Model = new TransactionViewModel
                {
                    Data = data.Data
                }

            };

        }
    }

    public class TransactionViewResult
    {
        public Account Account { get; set; }
        public TransactionViewModel Model { get; set; }
    }

    public class TransactionViewModel
    {
        public AggregationData Data { get; set; }
    }
}

Send Account model back for validation

Send Account model back for validation


// 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.Bindables;
using osuTK;

namespace osu.Framework.Input.Handlers.Tablet
{
    /// <summary>
    /// An interface to access OpenTabletDriverHandler.
    /// Can be considered for removal when we no longer require dual targeting against netstandard.
    /// </summary>
    public interface ITabletHandler
    {
        /// <summary>
        /// The offset of the area which should be mapped to the game window.
        /// </summary>
        Bindable<Vector2> AreaOffset { get; }

        /// <summary>
        /// The size of the area which should be mapped to the game window.
        /// </summary>
        Bindable<Vector2> AreaSize { get; }

        /// <summary>
        /// Information on the currently connected tablet device./ May be null if no tablet is detected.
        /// </summary>
        IBindable<TabletInfo> Tablet { get; }

        BindableBool Enabled { get; }
    }
}

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

using osu.Framework.Bindables;
using osuTK;

namespace osu.Framework.Input.Handlers.Tablet
{
    /// <summary>
    /// An interface to access OpenTabletDriverHandler.
    /// Can be considered for removal when we no longer require dual targeting against netstandard.
    /// </summary>
    public interface ITabletHandler
    {
        /// <summary>
        /// The offset of the area which should be mapped to the game window.
        /// </summary>
        Bindable<Vector2> AreaOffset { get; }

        /// <summary>
        /// The size of the area which should be mapped to the game window.
        /// </summary>
        Bindable<Vector2> AreaSize { get; }

        /// <summary>
        /// Information on the currently connected tablet device. May be null if no tablet is detected.
        /// </summary>
        IBindable<TabletInfo> Tablet { get; }

        BindableBool Enabled { get; }
    }
}

Fix stray character in xmldoc

Fix stray character in xmldoc


using System;
using System.Linq;
using System.Reflection;
using GraphQL.Types;

namespace GraphQL.Resolvers
{
    public class MethodModelBinderResolver<T> : IFieldResolver
    {
        private readonly IDependencyResolver _dependencyResolver;
        private readonly MethodInfo _methodInfo;
        private readonly ParameterInfo[] _parameters;
        private readonly Type _type;

        public MethodModelBinderResolver(MethodInfo methodInfo, IDependencyResolver dependencyResolver)
        {
            _dependencyResolver = dependencyResolver;
            _type = typeof(T);
            _methodInfo = methodInfo;
            _parameters = _methodInfo.GetParameters();
        }

        public object Resolve(ResolveFieldContext context)
        {
            var index = 0;
            var arguments = new object[_parameters.Length];

            if (_parameters.Any() && typeof(ResolveFieldContext) == _parameters[index].ParameterType)
            {
                arguments[index] = context;
                index++;
            }

            if (_parameters.Any() && context.Source?.GetType() == _parameters[index].ParameterType)
            {
                arguments[index] = context.Source;
                index++;
            }

            foreach (var parameter in _parameters.Skip(index))
            {
                arguments[index] = context.GetArgument(parameter.Name, parameter.ParameterType);
                index++;
            }

            var target = _dependencyResolver.Resolve(_type);

            if (target == null)
            {
                throw new InvalidOperationException($"Could not resolve an instance of {_type.Name} to execute {context.FieldName}");
            }

            return _methodInfo.Invoke(target, arguments);
        }
    }
}

using System;
using System.Linq;
using System.Reflection;
using GraphQL.Types;

namespace GraphQL.Resolvers
{
    public class MethodModelBinderResolver<T> : IFieldResolver
    {
        private readonly IDependencyResolver _dependencyResolver;
        private readonly MethodInfo _methodInfo;
        private readonly ParameterInfo[] _parameters;
        private readonly Type _type;

        public MethodModelBinderResolver(MethodInfo methodInfo, IDependencyResolver dependencyResolver)
        {
            _dependencyResolver = dependencyResolver;
            _type = typeof(T);
            _methodInfo = methodInfo;
            _parameters = _methodInfo.GetParameters();
        }

        public object Resolve(ResolveFieldContext context)
        {
            object[] arguments = null;

            if (_parameters.Any())
            {
                arguments = new object[_parameters.Length];

                var index = 0;
                if (typeof(ResolveFieldContext) == _parameters[index].ParameterType)
                {
                    arguments[index] = context;
                    index++;
                }

                if (context.Source?.GetType() == _parameters[index].ParameterType)
                {
                    arguments[index] = context.Source;
                    index++;
                }

                foreach (var parameter in _parameters.Skip(index))
                {
                    arguments[index] = context.GetArgument(parameter.Name, parameter.ParameterType);
                    index++;
                }
            }

            var target = _dependencyResolver.Resolve(_type);

            if (target == null)
            {
                var parentType = context.ParentType != null ? $"{context.ParentType.Name}." : null;
                throw new InvalidOperationException($"Could not resolve an instance of {_type.Name} to execute {parentType}{context.FieldName}");
            }

            return _methodInfo.Invoke(target, arguments);
        }
    }
}

Refactor how parameters are checked

Refactor how parameters are checked


using MultiMiner.Utility.Serialization;
using System.Linq;

namespace MultiMiner.Win.Extensions
{
    public static class ApplicationConfigurationExtensions
    {
        public static Remoting.Data.Transfer.Configuration.Application ToTransferObject(this Data.Configuration.Application modelObject)
        {
            Remoting.Data.Transfer.Configuration.Application transferObject = new Remoting.Data.Transfer.Configuration.Application();

            ObjectCopier.CopyObject(modelObject, transferObject, "HiddenColumns");
            transferObject.HiddenColumns = modelObject.HiddenColumns.ToArray();

            return transferObject;
        }

        public static Data.Configuration.Application ToModelObject(this Remoting.Data.Transfer.Configuration.Application transferObject)
        {
            Data.Configuration.Application modelObject = new Data.Configuration.Application();

            ObjectCopier.CopyObject(transferObject, modelObject, "HiddenColumns");
            modelObject.HiddenColumns = transferObject.HiddenColumns.ToList();

            return modelObject;
        }
    }
}

using MultiMiner.Utility.Serialization;
using System.Linq;

namespace MultiMiner.Win.Extensions
{
    public static class ApplicationConfigurationExtensions
    {
        public static Remoting.Data.Transfer.Configuration.Application ToTransferObject(this Data.Configuration.Application modelObject)
        {
            Remoting.Data.Transfer.Configuration.Application transferObject = new Remoting.Data.Transfer.Configuration.Application();

            ObjectCopier.CopyObject(modelObject, transferObject, "HiddenColumns");
            if (modelObject.HiddenColumns != null)
                transferObject.HiddenColumns = modelObject.HiddenColumns.ToArray();

            return transferObject;
        }

        public static Data.Configuration.Application ToModelObject(this Remoting.Data.Transfer.Configuration.Application transferObject)
        {
            Data.Configuration.Application modelObject = new Data.Configuration.Application();

            ObjectCopier.CopyObject(transferObject, modelObject, "HiddenColumns");
            if (transferObject.HiddenColumns != null)
                modelObject.HiddenColumns = transferObject.HiddenColumns.ToList();

            return modelObject;
        }
    }
}

Fix ArgumentNullException configuring pools via Remoting

Value cannot be null


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

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

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

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("71703720-56ba-4e6a-9004-239a9836693b")]

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

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

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

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

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("71703720-56ba-4e6a-9004-239a9836693b")]

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

Increment version number in assembly info


using BugsnagUnity.Payload;

namespace BugsnagUnity
{
  public interface ISessionTracker
  {
    void StartSession();

    Session CurrentSession { get; }
  }

  class SessionTracker : ISessionTracker
  {
    private IClient Client { get; }

    private Session _currentSession;

    public Session CurrentSession
    {
      get => _currentSession.Copy();
      private set => _currentSession = value;
    }

    internal SessionTracker(IClient client)
    {
      Client = client;
    }

    public void StartSession()
    {
      var session = new Session();

      CurrentSession = session;

      var payload = new SessionReport(Client.Configuration, Client.User, session);

      Client.Send(payload);
    }
  }
}

using BugsnagUnity.Payload;

namespace BugsnagUnity
{
  public interface ISessionTracker
  {
    void StartSession();

    Session CurrentSession { get; }
  }

  class SessionTracker : ISessionTracker
  {
    private IClient Client { get; }

    private Session _currentSession;

    public Session CurrentSession
    {
      get => _currentSession?.Copy();
      private set => _currentSession = value;
    }

    internal SessionTracker(IClient client)
    {
      Client = client;
    }

    public void StartSession()
    {
      var session = new Session();

      CurrentSession = session;

      var payload = new SessionReport(Client.Configuration, Client.User, session);

      Client.Send(payload);
    }
  }
}

Handle not having a current session

Handle not having a current session

We have another issue where this is not being populated as expected in newer versions of unity which will need to be resolved


namespace ACE.Network.GameEvent
{
    public class GameEventCharacterTitle : GameEventPacket
    {
        public override GameEventOpcode Opcode { get { return GameEventOpcode.CharacterTitle; } }

        public GameEventCharacterTitle(Session session) : base(session) { }

        protected override void WriteEventBody()
        {
            fragment.Payload.Write(1u);
            fragment.Payload.Write(1u); // TODO: get current title from database
            fragment.Payload.Write(1000u); // TODO: get player's title list from database
            for (uint i = 1; i <= 1000; i++)
                fragment.Payload.Write(i);
        }
    }
}

namespace ACE.Network.GameEvent
{
    public class GameEventCharacterTitle : GameEventPacket
    {
        public override GameEventOpcode Opcode { get { return GameEventOpcode.CharacterTitle; } }

        public GameEventCharacterTitle(Session session) : base(session) { }

        protected override void WriteEventBody()
        {
            fragment.Payload.Write(1u);
            fragment.Payload.Write(1u); // TODO: get current title from database
            fragment.Payload.Write(10u); // TODO: get player's title list from database
            for (uint i = 1; i <= 10; i++)
                fragment.Payload.Write(i);
        }
    }
}

Reduce temporary list of titles

Reduce temporary list of titles


using System;
using System.Web.Http;
using Agiil.Bootstrap.DiConfiguration;
using Autofac;

namespace Agiil.Web.App_Start
{
  public static class ContainerFactoryProviderExtensions
  {
    public static IContainer GetContainer(this ContainerFactoryProvider provider, HttpConfiguration config)
    {
      if(provider == null)
        throw new ArgumentNullException(nameof(provider));
      if(config == null)
        throw new ArgumentNullException(nameof(config));

      var factoryProvider = new ContainerFactoryProvider();
      var diFactory = factoryProvider.GetContainerBuilderFactory() as IContainerFactoryWithHttpConfiguration;

      if(diFactory == null)
        throw new InvalidOperationException($"The configured container builder factory must implement {nameof(IContainerFactoryWithHttpConfiguration)}.");

      diFactory.SetHttpConfiguration(config);
      return diFactory.GetContainer();
    }
  }
}

using System;
using System.Web.Http;
using Agiil.Bootstrap.DiConfiguration;
using Autofac;

namespace Agiil.Web.App_Start
{
  public static class ContainerFactoryProviderExtensions
  {
    public static IContainer GetContainer(this ContainerFactoryProvider provider, HttpConfiguration config)
    {
      if(provider == null)
        throw new ArgumentNullException(nameof(provider));
      if(config == null)
        throw new ArgumentNullException(nameof(config));

      var diFactory = provider.GetContainerBuilderFactory() as IContainerFactoryWithHttpConfiguration;

      if(diFactory == null)
        throw new InvalidOperationException($"The configured container builder factory must implement {nameof(IContainerFactoryWithHttpConfiguration)}.");

      diFactory.SetHttpConfiguration(config);
      return diFactory.GetContainer();
    }
  }
}

Fix silly mistake in DI configuration

Fix silly mistake in DI configuration


using System.Collections.Generic;

using AgateLib.Extensions.Collections.Generic;

using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace AgateLib.UnitTests.Extensions
{
	[TestClass]
	public class ListExtensions
	{
		[TestMethod]
		public void SortPrimitives()
		{
			List<int> li = new List<int> { 1, 6, 2, 3, 8, 10, 9, 7, 4, 5 };

			Assert.AreEqual(10, li.Count);

			li.InsertionSort();

			for (int i = 0; i < li.Count; i++)
				Assert.AreEqual(i + 1, li[i]);
		}
	}
}

using System.Collections.Generic;

using AgateLib.Extensions.Collections.Generic;

using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace AgateLib.UnitTests.Extensions
{
	[TestClass]
	public class ListExtensions
	{
		[TestMethod]
		public void SortPrimitives()
		{
			List<int> li = new List<int> { 1, 6, 2, 3, 8, 10, 9, 7, 4, 5 };

			Assert.AreEqual(10, li.Count);

			li.InsertionSort();

			for (int i = 0; i < li.Count; i++)
				Assert.AreEqual(i + 1, li[i]);
		}

        [TestMethod]
        public void InsertionSortTest()
        {
            List<int> list = new List<int> { 4, 2, 3, 1, 6, 7, 8, 9 };

            list.InsertionSort();

            Assert.AreEqual(1, list[0]);
            Assert.AreEqual(9, list[list.Count - 1]);
        }
	}
}

Move to modern nuget. Make Sprite compile by stubbing missing interface methods.


using System;
using System.Threading.Tasks;
using HelloCoreClrApp.Data;
using HelloCoreClrApp.WebApi.Messages;
using Serilog;

namespace HelloCoreClrApp.WebApi.Actions
{
    public class SayHelloWorldAction : ISayHelloWorldAction
    {
        private static readonly ILogger Log = Serilog.Log.ForContext<SayHelloWorldAction>();
        private readonly IDataService dataService;

        public SayHelloWorldAction(IDataService dataService)
        {
            this.dataService = dataService;
        }

        public async Task<SayHelloWorldResponse> Execute(string name)
        {
            Log.Information("Calculating result.");

            Tuple<string, bool> res = Rules.SayHelloWorldRule.Process(name);
            if (res.Item2)
                await SaveGreeting(res.Item1);

            return new SayHelloWorldResponse { Greeting = res.Item1 };
        }

        private async Task SaveGreeting(string greeting)
        {
            Log.Information("Save greeting.");
            await dataService.SaveGreeting(greeting);
        }
    }
}

using System.Threading.Tasks;
using HelloCoreClrApp.Data;
using HelloCoreClrApp.WebApi.Messages;
using Serilog;

namespace HelloCoreClrApp.WebApi.Actions
{
    public class SayHelloWorldAction : ISayHelloWorldAction
    {
        private static readonly ILogger Log = Serilog.Log.ForContext<SayHelloWorldAction>();
        private readonly IDataService dataService;

        public SayHelloWorldAction(IDataService dataService)
        {
            this.dataService = dataService;
        }

        public async Task<SayHelloWorldResponse> Execute(string name)
        {
            Log.Information("Calculating result.");

            var res = Rules.SayHelloWorldRule.Process(name);
            if (res.Item2)
                await SaveGreeting(res.Item1);

            return new SayHelloWorldResponse { Greeting = res.Item1 };
        }

        private async Task SaveGreeting(string greeting)
        {
            Log.Information("Save greeting.");
            await dataService.SaveGreeting(greeting);
        }
    }
}

Use var. Rider finally understands it here ;)


Fix Cake script not running tests from SimpSim.NET.Tests project.


@functions {
    private string GetCssClass(string actionName, string controllerName)
    {
        var currentControllerName = ViewContext.RouteData.Values["controller"].ToString();

        var isCurrentController = currentControllerName == controllerName;
        if (currentControllerName == "Home")
        {
            return GetHomeControllerLinksCssClass(actionName, isCurrentController);
        }

        return isCurrentController ? "active" : string.Empty;
    }

    private string GetHomeControllerLinksCssClass(string actionName, bool isCurrentController)
    {
        if (!isCurrentController)
        {
            return string.Empty;
        }

        var isCurrentAction = ViewContext.RouteData.Values["action"].ToString() == actionName;

        return isCurrentAction ? "active" : string.Empty;
    }

}

@helper GetMenuBarLink(string linkText, string actionName, string controllerName)
{

@Html.ActionLink(linkText, actionName, controllerName)

}

    @GetMenuBarLink("Home", "Index", "Home")
    @GetMenuBarLink("Concerts", "Index", "Concerts")
    @GetMenuBarLink("Rehearsals", "Index", "Rehearsals")
    @GetMenuBarLink("About", "About", "Home")
    @GetMenuBarLink("Contact", "Contact", "Home")

@functions {
    private string GetCssClass(string actionName, string controllerName)
    {
        var currentControllerName = ViewContext.RouteData.Values["controller"].ToString();

        var isCurrentController = currentControllerName == controllerName;
        if (currentControllerName == "Home")
        {
            return GetHomeControllerLinksCssClass(actionName, isCurrentController);
        }

        return isCurrentController ? "active" : string.Empty;
    }

    private string GetHomeControllerLinksCssClass(string actionName, bool isCurrentController)
    {
        if (!isCurrentController)
        {
            return string.Empty;
        }

        var isCurrentAction = ViewContext.RouteData.Values["action"].ToString() == actionName;

        return isCurrentAction ? "active" : string.Empty;
    }

}

@helper GetMenuBarLink(string linkText, string actionName, string controllerName)
{

        @if (controllerName == "Concerts" && Request.IsAuthenticated)
        {

                @linkText

@Html.ActionLink("Administer Concerts", "List", "Concerts")

        }
        else
        {
            @Html.ActionLink(linkText, actionName, controllerName)
        }

}

    @GetMenuBarLink("Home", "Index", "Home")
    @GetMenuBarLink("Concerts", "Index", "Concerts")
    @GetMenuBarLink("Rehearsals", "Index", "Rehearsals")
    @GetMenuBarLink("About", "About", "Home")
    @GetMenuBarLink("Contact", "Contact", "Home")

Add drop-down menu for concerts.

Add drop-down menu for concerts.

Hacky approach for now, just to get the link displayed.  A controller will be needed to wrap up this logic when the next feature is developed.


using System;
using System.Collections.Generic;

namespace CertiPay.Common.Notifications
{
    /// <summary>
    /// Represents an email notification sent a user, employee, or administrator
    /// </summary>
    public class EmailNotification : Notification
    {
        public static String QueueName { get { return "EmailNotifications"; } }

        /// <summary>
        /// Who the email notification should be FROM
        /// </summary>
        public String FromAddress { get; set; }

        /// <summary>
        /// A list of email addresses to CC
        /// </summary>
        public ICollection<String> CC { get; set; } = new List<String>();

        /// <summary>
        /// A list of email addresses to BCC
        /// </summary>
        public ICollection<String> BCC { get; set; } = new List<String>();

        /// <summary>
        /// The subject line of the email
        /// </summary>
        public String Subject { get; set; }

        /// <summary>
        /// Any attachments to the email in the form of URLs to download
        /// </summary>
        public ICollection<Attachment> Attachments { get; set; } = new List<Attachment>();

        /// <summary>
        /// A file may be attached to the email notification by providing a URL to download
        /// the file (will be downloaded by the sending process) and a filename
        /// </summary>
        public class Attachment
        {
            public String Filename { get; set; }

            public String Uri { get; set; }
        }
    }
}

using System;
using System.Collections.Generic;

namespace CertiPay.Common.Notifications
{
    /// <summary>
    /// Represents an email notification sent a user, employee, or administrator
    /// </summary>
    public class EmailNotification : Notification
    {
        public static String QueueName { get { return "EmailNotifications"; } }

        /// <summary>
        /// Who the email notification should be FROM
        /// </summary>
        public String FromAddress { get; set; }

        /// <summary>
        /// A list of email addresses to CC
        /// </summary>
        public ICollection<String> CC { get; set; } = new List<String>();

        /// <summary>
        /// A list of email addresses to BCC
        /// </summary>
        public ICollection<String> BCC { get; set; } = new List<String>();

        /// <summary>
        /// The subject line of the email
        /// </summary>
        public String Subject { get; set; }

        /// <summary>
        /// Any attachments to the email in the form of URLs to download
        /// </summary>
        public ICollection<Attachment> Attachments { get; set; } = new List<Attachment>();

        /// <summary>
        /// A file may be attached to the email notification
        /// </summary>
        public class Attachment
        {
            /// <summary>
            /// The filename of the attachment
            /// </summary>
            public String Filename { get; set; }

            /// <summary>
            /// If provided, the Base64 encoded content of the attachment
            /// </summary>
            public String Content { get; set; }

            /// <summary>
            /// If provided, an addressable URI from which the service can download the attachment
            /// </summary>
            public String Uri { get; set; }
        }
    }
}

Add the content type for notification attachments


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

namespace Nimrod
{
    public static class AssemblyLocator
    {
        static ConcurrentDictionary<string, Assembly> assemblies = new ConcurrentDictionary<string, Assembly>();

        public static void Init()
        {
            AppDomain.CurrentDomain.AssemblyLoad += new AssemblyLoadEventHandler(CurrentDomain_AssemblyLoad);
            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
        }

        static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
        {
            Assembly assembly;
            assemblies.TryGetValue(args.Name, out assembly);
            return assembly;
        }

        static void CurrentDomain_AssemblyLoad(object sender, AssemblyLoadEventArgs args)
        {
            Assembly assembly = args.LoadedAssembly;
            assemblies[assembly.FullName] = assembly;
        }
    }
}

using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace Nimrod
{
    public static class AssemblyLocator
    {
        static ConcurrentDictionary<string, Assembly> assemblies = new ConcurrentDictionary<string, Assembly>();

        public static void Init()
        {
            AppDomain.CurrentDomain.AssemblyLoad += new AssemblyLoadEventHandler(CurrentDomain_AssemblyLoad);
            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
        }

        static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
        {
            var assemblyName = new AssemblyName(args.Name);
            Assembly assembly;
            assemblies.TryGetValue(assemblyName.Name, out assembly);

            // an assembly has been requested somewhere, but we don't load it
            Debug.Assert(assembly != null);
            return assembly;
        }

        static void CurrentDomain_AssemblyLoad(object sender, AssemblyLoadEventArgs args)
        {
            var assembly = args.LoadedAssembly;
            var assemblyName = assembly.GetName();

            // Note that we load assembly by name, not full name
            // This means that we forgot the version number
            // we should handle the version number too,
            // but take into account that we want to deliver the assembly if we don't find the exact same version number
            assemblies.TryAdd(assemblyName.Name, assembly);
        }
    }
}

Return any assembly that match the name, do not look at version

If this becames a problem, and we tried to load 2 assembly with different version, further development will be needed


using System.Net;
using System.Configuration;

private static TraceWriter logger;

private static string[] LoadTopics()
{
    string TopicsAndExperts = ConfigurationManager.AppSettings["EXPERTS_LIST"].ToString();

    logger.Info($"Got TopicsAndExperts: {TopicsAndExperts}");

    // split each topic and expert pair
    string[] ExpertList = TopicsAndExperts.Split(';');

    // Create container to return
    List<string> Topics = new List<string>();

    foreach (var item in ExpertList)
    {
        // split topic from expert
        string[] TopicDetails = item.Split(',');

        // load topic
        Topics.Add(TopicDetails[0]);
        logger.Info($"Loaded topic: {TopicDetails[0]}");
    }

    return Topics.ToArray();

}

public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
{
    // save the logging context for later use
    logger = log;

    log.Info($"C# HTTP trigger function processed a request. RequestUri={req.RequestUri}");

    string[] Topics = LoadTopics();

    return Topics == null
        ? req.CreateResponse(HttpStatusCode.BadRequest, "Please pass a name on the query string or in the request body")
        : req.CreateResponse(HttpStatusCode.OK, Topics);
}

using System.Net;
using System.Configuration;

private static TraceWriter logger;

/// Extract the topics from the and topics and experts list so there is one master list
/// and topics and experts stay in sync.
private static string[] LoadTopics()
{

    string TopicsAndExperts = ConfigurationManager.AppSettings["EXPERTS_LIST"].ToString();

    logger.Info($"Got TopicsAndExperts: {TopicsAndExperts}");

    // split each topic and expert pair
    string[] ExpertList = TopicsAndExperts.Split(';');

    // Create container to return
    List<string> Topics = new List<string>();

    foreach (var item in ExpertList)
    {
        // split topic from expert
        string[] TopicDetails = item.Split(',');

        // load topic
        Topics.Add(TopicDetails[0]);
        logger.Info($"Loaded topic: {TopicDetails[0]}");
    }

    return Topics.ToArray();

}

public static async Task<HttpResponseMessage> Run(HttpRequestMessage req, TraceWriter log)
{
    // save the logging context for later use
    logger = log;

    log.Info($"C# HTTP trigger function processed a request. RequestUri={req.RequestUri}");

    string[] Topics = LoadTopics();

    return Topics == null
        ? req.CreateResponse(HttpStatusCode.BadRequest, "Please pass a name on the query string or in the request body")
        : req.CreateResponse(HttpStatusCode.OK, Topics);
}

Add a comment about the approach to loading topics


using System;
using Xunit;

namespace PagedList.Tests
{
    public class PageMetadataTests
    {
        [Fact]
        public void PageNumberIsZero_ArgumentOutOfRangeExceptionIsThrown()
        {
            Assert.True(false);
          //  Assert.Throws<ArgumentOutOfRangeException>(() => new PageMetadata(10, 0, 1));
        }

        [Fact]
        public void PageSizeIsZero_ArgumentOutOfRangeExceptionIsThrown()
        {
            Assert.Throws<ArgumentOutOfRangeException>(() => new PageMetadata(10, 1, 0));
        }
    }
}

using System;
using Xunit;

namespace PagedList.Tests
{
    public class PageMetadataTests
    {
        [Fact]
        public void PageNumberIsZero_ArgumentOutOfRangeExceptionIsThrown()
        {
            Assert.Throws<ArgumentOutOfRangeException>(() => new PageMetadata(10, 0, 1));
        }

        [Fact]
        public void PageSizeIsZero_ArgumentOutOfRangeExceptionIsThrown()
        {
            Assert.Throws<ArgumentOutOfRangeException>(() => new PageMetadata(10, 1, 0));
        }
    }
}

Revert "Testing to see if the deploy is started when a test fails"

This reverts commit 6ef734a0863fedb1baa3e77eab7eefff7a1c4856.


// Copyright (c) Narvalo.Org. All rights reserved. See LICENSE.txt in the project root for license information.

namespace Narvalo
{
    using System;

    using Xunit;

    public static class HashCodeHelpersFacts
    {
        [Fact]
        public static void Combine2_DoesNotThrow_WhenOverflowed()
            => HashCodeHelpers.Combine(Int32.MaxValue, 1);

        [Fact]
        public static void Combine3_DoesNotThrow_WhenOverflowed()
            => HashCodeHelpers.Combine(Int32.MaxValue, 1, 1);
    }
}

// Copyright (c) Narvalo.Org. All rights reserved. See LICENSE.txt in the project root for license information.

namespace Narvalo
{
    using System;

    using Xunit;

    public static class HashCodeHelpersFacts
    {
        [Fact]
        public static void Combine2_DoesNotThrow_WhenMinOverflowed()
            => HashCodeHelpers.Combine(Int32.MinValue, 1);

        [Fact]
        public static void Combine2_DoesNotThrow_WhenMaxOverflowed()
            => HashCodeHelpers.Combine(Int32.MaxValue, 1);
        [Fact]
        public static void Combine3_DoesNotThrow_WhenMinOverflowed()
            => HashCodeHelpers.Combine(Int32.MinValue, 1, 1);

        [Fact]
        public static void Combine3_DoesNotThrow_WhenMaxOverflowed()
            => HashCodeHelpers.Combine(Int32.MaxValue, 1, 1);
    }
}

Add test for overflowed by min.

Add test for overflowed by min.


// Server.cs
// <copyright file="Server.cs"> This code is protected under the MIT License. </copyright>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Networking
{
    /// <summary>
    /// A class that acts as a server for a networked game of tron.
    /// </summary>
    public class Server
    {
        /// <summary>
        /// The port used by the server.
        /// </summary>
        public static readonly int Port = 22528;
    }
}

// Server.cs
// <copyright file="Server.cs"> This code is protected under the MIT License. </copyright>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;

namespace Networking
{
    /// <summary>
    /// A class that acts as a server for a networked game of tron.
    /// </summary>
    public class Server
    {
        /// <summary>
        /// The port used by the server.
        /// </summary>
        public static readonly int Port = 22528;

        public Server()
        {
            this.Host = new UdpClient(new IPEndPoint(IPAddress.Any, Server.Port));
            this.PlayerIPs = new IPEndPoint[12];
        }

        /// <summary>
        /// The host socket.
        /// </summary>
        public UdpClient Host { get; set; }

        /// <summary>
        /// The array of player ip addresses.
        /// </summary>
        public IPEndPoint[] PlayerIPs { get; set; }

        /// <summary>
        /// Listens for an input.
        /// </summary>
        public void Listen
        {

        }

        /// <summary>
        /// Sends a message to all clients.
        /// </summary>
        public void SendToAll()
        {

        }

        /// <summary>
        /// Removes a player from the game.
        /// </summary>
        public void RemovePlayer
        {

        }
    }
}

Write properties and constructor for server


// 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.Linq;
using NUnit.Framework;
using osu.Framework.Testing;
using osu.Game.Database;
using osu.Game.Tests.Resources;

namespace osu.Game.Tests.Visual.Navigation
{
    public class TestSceneStartupImport : OsuGameTestScene
    {
        private string importFilename;

        protected override TestOsuGame CreateTestGame() => new TestOsuGame(LocalStorage, API, new[] { importFilename });

        public override void SetUpSteps()
        {
            AddStep("Prepare import beatmap", () => importFilename = TestResources.GetTestBeatmapForImport());

            base.SetUpSteps();
        }

        [Test]
        public void TestImportCreatedNotification()
        {
            AddUntilStep("Import notification was presented", () => Game.Notifications.ChildrenOfType<ImportProgressNotification>().Count() == 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 System.Linq;
using NUnit.Framework;
using osu.Framework.Testing;
using osu.Game.Overlays.Notifications;
using osu.Game.Tests.Resources;

namespace osu.Game.Tests.Visual.Navigation
{
    public class TestSceneStartupImport : OsuGameTestScene
    {
        private string importFilename;

        protected override TestOsuGame CreateTestGame() => new TestOsuGame(LocalStorage, API, new[] { importFilename });

        public override void SetUpSteps()
        {
            AddStep("Prepare import beatmap", () => importFilename = TestResources.GetTestBeatmapForImport());

            base.SetUpSteps();
        }

        [Test]
        public void TestImportCreatedNotification()
        {
            AddUntilStep("Import notification was presented", () => Game.Notifications.ChildrenOfType<ProgressCompletionNotification>().Count() == 1);
        }
    }
}

Fix startup import test waiting on potentially incorrect notification type


// --------------------------------------------------------------------------------------------------------------------
// <copyright file="TestReadModelDatabase.cs">
//   Copyright (c) 2015. All rights reserved.
//   Licensed under the MIT license. See LICENSE file in the project root for full license information.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace Spritely.ReadModel.Sql.Test
{
    using System;
    using System.Data;
    using System.Data.SqlClient;
    using System.Reflection;
    using Spritely.Test.FluentMigratorSqlDatabase;

    public class TestReadModelDatabase : ReadModelDatabase<TestReadModelDatabase>, IDisposable
    {
        public TestReadModelDatabase()
        {
            this.TestDatabase = new TestDatabase("Create_creates_runner_capable_of_populating_database.mdf");

            this.TestDatabase.Create();

            // Use TestMigration class in this assembly
            var runner = FluentMigratorRunnerFactory.Create(Assembly.GetExecutingAssembly(), this.TestDatabase.ConnectionString);
            runner.MigrateUp(0);
        }

        public TestDatabase TestDatabase { get; set; }

        public override IDbConnection CreateConnection()
        {
            var connection = new SqlConnection(this.TestDatabase.ConnectionString);

            connection.Open();

            return connection;
        }

        public void Dispose()
        {
            this.TestDatabase.Dispose();
        }
    }
}

// --------------------------------------------------------------------------------------------------------------------
// <copyright file="TestReadModelDatabase.cs">
//   Copyright (c) 2015. All rights reserved.
//   Licensed under the MIT license. See LICENSE file in the project root for full license information.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace Spritely.ReadModel.Sql.Test
{
    using System;
    using System.Data;
    using System.Data.SqlClient;
    using System.Reflection;
    using Spritely.Cqrs;
    using Spritely.Test.FluentMigratorSqlDatabase;

    public class TestReadModelDatabase : ReadModelDatabase<TestReadModelDatabase>, IDisposable
    {
        public TestReadModelDatabase()
        {
            this.TestDatabase = new TestDatabase("Create_creates_runner_capable_of_populating_database.mdf");

            this.TestDatabase.Create();

            this.ConnectionSettings = new DatabaseConnectionSettings();

            // Use TestMigration class in this assembly
            var runner = FluentMigratorRunnerFactory.Create(Assembly.GetExecutingAssembly(), this.TestDatabase.ConnectionString);
            runner.MigrateUp(0);
        }

        public TestDatabase TestDatabase { get; set; }

        public override IDbConnection CreateConnection()
        {
            var connection = new SqlConnection(this.TestDatabase.ConnectionString);

            connection.Open();

            return connection;
        }

        public void Dispose()
        {
            this.TestDatabase.Dispose();
        }
    }
}

Fix unit tests after last set of changes


using EOLib.IO.Map;

namespace EOLib.Domain.Map
{
    public class Sign : ISign
    {
        public string Title { get; private set; }

        public string Message { get; private set; }

        public Sign(SignMapEntity sign)
        {
            Title = sign.Title;
            Message = sign.Message;
        }
    }

    public interface ISign
    {
        string Title { get; }

        string Message { get; }
    }
}

using EOLib.IO.Map;
using System.Linq;

namespace EOLib.Domain.Map
{
    public class Sign : ISign
    {
        public string Title { get; private set; }

        public string Message { get; private set; }

        public Sign(SignMapEntity sign)
        {
            Title = Filter(sign.Title);
            Message = Filter(sign.Message);
        }

        private static string Filter(string input)
        {
            return new string(input.Where(x => !char.IsControl(x)).ToArray());
        }
    }

    public interface ISign
    {
        string Title { get; }

        string Message { get; }
    }
}

Fix rendering of unreadable characters in map signs


@{
    ViewBag.Title = "Home Page";
    ViewBag.ngApp = "MusicStore.Store";
    Layout = "/Views/Shared/_Layout.cshtml";
}

@section NavBarItems {

@*@Html.InlineData("GenreMenuList", "GenresApi")*@

}

@*@Html.InlineData("MostPopular", "AlbumsApi")*@

@section Scripts {

@* TODO: This is currently all the compiled TypeScript, non-minified. Need to explore options
    for alternate loading schemes, e.g. AMD loader of individual modules, min vs. non-min, etc. *@

}

Fix typo in MusicStore.Spa page

Fix typo in MusicStore.Spa page


using System.Linq;
using Should;

namespace Parsley
{
    public class GrammarRuleTests : Grammar
    {
        public void CanDefineMutuallyRecursiveRules()
        {
            var tokens = new CharLexer().Tokenize("(A)");
            var expression = new GrammarRule<string>();
            var alpha = new GrammarRule<string>();
            var parenthesizedExpresion = new GrammarRule<string>();

            expression.Rule = Choice(alpha, parenthesizedExpresion);
            alpha.Rule = from a in Token("A") select a.Literal;
            parenthesizedExpresion.Rule = Between(Token("("), expression, Token(")"));

            expression.Parses(tokens).WithValue("A");
        }

        public void HasAnOptionallyProvidedName()
        {
            var unnamed = new GrammarRule<string>();
            var named = new GrammarRule<string>("Named");

            unnamed.Name.ShouldBeNull();
            named.Name.ShouldEqual("Named");
        }

        public void ProvidesAdviceWhenRuleIsUsedBeforeBeingInitialized()
        {
            var tokens = new CharLexer().Tokenize("123").ToArray();
            var numeric = new GrammarRule<string>();
            var alpha = new GrammarRule<string>("Alpha");

            numeric.FailsToParse(tokens).WithMessage("(1, 1): An anonymous GrammarRule has not been initialized.  Try setting the Rule property.");
            alpha.FailsToParse(tokens).WithMessage("(1, 1): GrammarRule 'Alpha' has not been initialized.  Try setting the Rule property.");
        }
    }
}

using System.Linq;
using Should;

namespace Parsley
{
    public class GrammarRuleTests : Grammar
    {
        public void CanDefineMutuallyRecursiveRules()
        {
            var tokens = new CharLexer().Tokenize("(A)");
            var expression = new GrammarRule<string>();
            var alpha = new GrammarRule<string>();
            var parenthesizedExpresion = new GrammarRule<string>();

            expression.Rule = Choice(alpha, parenthesizedExpresion);
            alpha.Rule = from a in Token("A") select a.Literal;
            parenthesizedExpresion.Rule = Between(Token("("), expression, Token(")"));

            expression.Parses(tokens).WithValue("A");
        }

        public void HasAnOptionallyProvidedName()
        {
            var unnamed = new GrammarRule<string>();
            var named = new GrammarRule<string>("Named<BUG>");

            unnamed.Name.ShouldBeNull();
            named.Name.ShouldEqual("Named");
        }

        public void ProvidesAdviceWhenRuleIsUsedBeforeBeingInitialized()
        {
            var tokens = new CharLexer().Tokenize("123").ToArray();
            var numeric = new GrammarRule<string>();
            var alpha = new GrammarRule<string>("Alpha");

            numeric.FailsToParse(tokens).WithMessage("(1, 1): An anonymous GrammarRule has not been initialized.  Try setting the Rule property.");
            alpha.FailsToParse(tokens).WithMessage("(1, 1): GrammarRule 'Alpha' has not been initialized.  Try setting the Rule property.");
        }
    }
}

Introduce a bug to prove out CI integration.


using System.Linq;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNet.Mvc.Filters;
using Microsoft.AspNet.Mvc.ViewFeatures;
using Microsoft.AspNet.Mvc.ModelBinding;
using Microsoft.AspNet.Http;

namespace Microsoft.AspNet.Mvc
{
    public class AnyRolesAttribute : ActionFilterAttribute
    {
        private string[] roles;

        public AnyRolesAttribute(string Roles)
        {
            roles = Roles.Split(',');
            for (var i = 0; i < roles.Count(); i++)
                roles[i] = roles[i].Trim(' ');
        }

        public override void OnActionExecuting(ActionExecutingContext context)
        {
            foreach (var r in roles)
            {
                if (context.HttpContext.User.IsInRole(r))
                    base.OnActionExecuting(context);
            }
            HandleUnauthorizedRequest(context);
        }

        public virtual void HandleUnauthorizedRequest(ActionExecutingContext context)
        {
            var prompt = new Prompt
            {
                Title = "Permission Denied",
                StatusCode = 403,
                Details = "You must sign in with a higher power account.",
                Requires = "Roles",
                Hint = roles
            };
            var services = context.HttpContext.ApplicationServices;
            context.Result = new ViewResult
            {
                StatusCode = prompt.StatusCode,
                TempData = new TempDataDictionary(services.GetRequiredService<IHttpContextAccessor>(), services.GetRequiredService<ITempDataProvider>()),
                ViewName = "Prompt",
                ViewData = new ViewDataDictionary(new EmptyModelMetadataProvider(), context.ModelState) { Model = prompt }
            };
        }
    }
}

using System.Linq;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.AspNet.Mvc.Filters;
using Microsoft.AspNet.Mvc.ViewFeatures;
using Microsoft.AspNet.Mvc.ModelBinding;
using Microsoft.AspNet.Http;

namespace Microsoft.AspNet.Mvc
{
    public class AnyRolesAttribute : ActionFilterAttribute
    {
        private string[] roles;

        public AnyRolesAttribute(string Roles)
        {
            roles = Roles.Split(',');
            for (var i = 0; i < roles.Count(); i++)
                roles[i] = roles[i].Trim(' ');
        }

        public override void OnActionExecuting(ActionExecutingContext context)
        {
            foreach (var r in roles)
            {
                if (context.HttpContext.User.IsInRole(r))
                {
                    base.OnActionExecuting(context);
                    return;
                }
            }
            HandleUnauthorizedRequest(context);
        }

        public virtual void HandleUnauthorizedRequest(ActionExecutingContext context)
        {
            var prompt = new Prompt
            {
                Title = "Permission Denied",
                StatusCode = 403,
                Details = "You must sign in with a higher power account.",
                Requires = "Roles",
                Hint = roles
            };
            var services = context.HttpContext.ApplicationServices;
            context.Result = new ViewResult
            {
                StatusCode = prompt.StatusCode,
                TempData = new TempDataDictionary(services.GetRequiredService<IHttpContextAccessor>(), services.GetRequiredService<ITempDataProvider>()),
                ViewName = "Prompt",
                ViewData = new ViewDataDictionary(new EmptyModelMetadataProvider(), context.ModelState) { Model = prompt }
            };
        }
    }
}

Fix a bug about any roles attribute

Fix a bug about any roles attribute


@{
	Layout = "_Layout";
	ViewData["Title"] = "Guild";
}

				Übersicht

				Statistiken

				Mutes

				GuildConfig

				Server "@ViewBag.Guild.Name" (ID @ViewBag.GuildId)

			@RenderBody()

@{
	Layout = "_Layout";
	ViewData["Title"] = "Guild";
}

				Statistiken

				Mutes

				GuildConfig

				Server "@ViewBag.Guild.Name" (ID @ViewBag.GuildId)

			@RenderBody()

Remove link to guild list from GuildLayout.


namespace Line.Messaging
{
    /// <summary>
    /// Rich menu response object.
    /// https://developers.line.me/en/docs/messaging-api/reference/#rich-menu-response-object
    /// </summary>
    public class ResponseRichMenu : RichMenu
    {
        /// <summary>
        /// Rich menu ID
        /// </summary>
        public string RichMenuId { get; set; }

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="richMenuId">
        /// Rich menu ID
        /// </param>
        /// <param name="source">
        /// Rich menu object
        /// </param>
        public ResponseRichMenu(string richMenuId, RichMenu source)
        {
            RichMenuId = richMenuId;
            Size = source.Size;
            Selected = source.Selected;
            Name = source.Name;
            ChatBarText = source.ChatBarText;
            Areas = source.Areas;
        }

        internal static ResponseRichMenu CreateFrom(dynamic dynamicObject)
        {
            var menu = new RichMenu()
            {
                Name = (string)dynamicObject?.name,
                Size = new ImagemapSize((int)(dynamicObject?.size?.width ?? 0), (int)(dynamicObject?.size?.height ?? 0)),
                Selected = (bool)(dynamicObject?.selected ?? false),
                ChatBarText = (string)dynamicObject?.chatBarText
            };
            return new ResponseRichMenu((string)dynamicObject?.richMenuId, menu);
        }
    }
}

namespace Line.Messaging
{
    /// <summary>
    /// Rich menu response object.
    /// https://developers.line.me/en/docs/messaging-api/reference/#rich-menu-response-object
    /// </summary>
    public class ResponseRichMenu : RichMenu
    {
        /// <summary>
        /// Rich menu ID
        /// </summary>
        public string RichMenuId { get; set; }

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="richMenuId">
        /// Rich menu ID
        /// </param>
        /// <param name="source">
        /// Rich menu object
        /// </param>
        public ResponseRichMenu(string richMenuId, RichMenu source)
        {
            RichMenuId = richMenuId;
            Size = source.Size;
            Selected = source.Selected;
            Name = source.Name;
            ChatBarText = source.ChatBarText;
            Areas = source.Areas;
        }

        internal static ResponseRichMenu CreateFrom(dynamic dynamicObject)
        {
            var menu = new RichMenu()
            {
                Name = (string)dynamicObject?.name,
                Size = new ImagemapSize((int)(dynamicObject?.size?.width ?? 0), (int)(dynamicObject?.size?.height ?? 0)),
                Selected = (bool)(dynamicObject?.selected ?? false),
                ChatBarText = (string)dynamicObject?.chatBarText,
                Areas = ActionArea.CreateFrom(dynamicObject?.areas)
            };
            return new ResponseRichMenu((string)dynamicObject?.richMenuId, menu);
        }
    }
}

Fix Areas property is not deserialized, In the return value of the GetRichMenuListAsync method.


using NQuery.Language.Symbols;

namespace NQuery.Language.VSEditor
{
    public sealed class QuickInfoModel
    {
        private readonly SemanticModel _semanticModel;
        private readonly TextSpan _span;
        private readonly NQueryGlyph _glyph;
        private readonly SymbolMarkup _markup;

        public QuickInfoModel(SemanticModel semanticModel, TextSpan span, NQueryGlyph glyph, SymbolMarkup markup)
        {
            _semanticModel = semanticModel;
            _span = span;
            _glyph = glyph;
            _markup = markup;
        }

        public static QuickInfoModel ForSymbol(SemanticModel semanticModel, TextSpan span, Symbol symbol)
        {
            var glyph = symbol.GetGlyph();
            var symbolMarkup = SymbolMarkup.ForSymbol(symbol);
            return new QuickInfoModel(semanticModel, span, glyph, symbolMarkup);
        }

        public SemanticModel SemanticModel
        {
            get { return _semanticModel; }
        }

        public TextSpan Span
        {
            get { return _span; }
        }

        public NQueryGlyph Glyph
        {
            get { return _glyph; }
        }

        public SymbolMarkup Markup
        {
            get { return _markup; }
        }
    }
}

using NQuery.Language.Symbols;

namespace NQuery.Language.VSEditor
{
    public sealed class QuickInfoModel
    {
        private readonly SemanticModel _semanticModel;
        private readonly TextSpan _span;
        private readonly NQueryGlyph _glyph;
        private readonly SymbolMarkup _markup;

        public QuickInfoModel(SemanticModel semanticModel, TextSpan span, NQueryGlyph glyph, SymbolMarkup markup)
        {
            _semanticModel = semanticModel;
            _span = span;
            _glyph = glyph;
            _markup = markup;
        }

        public static QuickInfoModel ForSymbol(SemanticModel semanticModel, TextSpan span, Symbol symbol)
        {
            if (symbol.Kind == SymbolKind.BadSymbol || symbol.Kind == SymbolKind.BadTable)
                return null;

            var glyph = symbol.GetGlyph();
            var symbolMarkup = SymbolMarkup.ForSymbol(symbol);
            return new QuickInfoModel(semanticModel, span, glyph, symbolMarkup);
        }

        public SemanticModel SemanticModel
        {
            get { return _semanticModel; }
        }

        public TextSpan Span
        {
            get { return _span; }
        }

        public NQueryGlyph Glyph
        {
            get { return _glyph; }
        }

        public SymbolMarkup Markup
        {
            get { return _markup; }
        }
    }
}

Fix quick info to not generate models for invalid symbols


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

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

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

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0a8197ea-4420-4b56-8734-607694bf6c45")]

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

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

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

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

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("0a8197ea-4420-4b56-8734-607694bf6c45")]

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

Update assembly info and start version at 0.1


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

// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.

[assembly: AssemblyTitle("Xwt")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("Xamarin, Inc (http://www.xamarin.com)")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.

[assembly: AssemblyVersion("1.0.*")]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.

//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

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

// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.

[assembly: AssemblyTitle("Xwt")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("Xamarin, Inc (http://www.xamarin.com)")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.

[assembly: AssemblyVersion("1.0.0.0")]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.

//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

Set a static value so my references quit freaking out.


using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using GitHub.Extensions;
using GitHub.Models;
using GitHub.Services;
using Microsoft.VisualStudio.TeamFoundation.Git.Extensibility;

namespace GitHub.VisualStudio.Base
{
    [Export(typeof(IVSGitExt))]
    [PartCreationPolicy(CreationPolicy.Shared)]
    public class VSGitExt : IVSGitExt
    {
        IGitExt gitService;

        public void Refresh(IServiceProvider serviceProvider)
        {
            if (gitService != null)
                gitService.PropertyChanged -= CheckAndUpdate;
            gitService = serviceProvider.GetServiceSafe<IGitExt>();
            if (gitService != null)
                gitService.PropertyChanged += CheckAndUpdate;
        }

        void CheckAndUpdate(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            Guard.ArgumentNotNull(e, nameof(e));
            if (e.PropertyName != "ActiveRepositories" || gitService == null)
                return;
            ActiveRepositoriesChanged?.Invoke();
        }

        public IEnumerable<ILocalRepositoryModel> ActiveRepositories => gitService?.ActiveRepositories.Select(x => IGitRepositoryInfoExtensions.ToModel(x));
        public event Action ActiveRepositoriesChanged;
    }
}

using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using GitHub.Extensions;
using GitHub.Models;
using GitHub.Services;
using Microsoft.VisualStudio.TeamFoundation.Git.Extensibility;

namespace GitHub.VisualStudio.Base
{
    [Export(typeof(IVSGitExt))]
    [PartCreationPolicy(CreationPolicy.Shared)]
    public class VSGitExt : IVSGitExt
    {
        IGitExt gitService;

        public void Refresh(IServiceProvider serviceProvider)
        {
            if (gitService != null)
                gitService.PropertyChanged -= CheckAndUpdate;
            gitService = serviceProvider.GetServiceSafe<IGitExt>();
            if (gitService != null)
                gitService.PropertyChanged += CheckAndUpdate;
        }

        void CheckAndUpdate(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            Guard.ArgumentNotNull(e, nameof(e));
            if (e.PropertyName != "ActiveRepositories" || gitService == null)
                return;
            ActiveRepositoriesChanged?.Invoke();
        }

        public IEnumerable<ILocalRepositoryModel> ActiveRepositories => gitService?.ActiveRepositories.Select(x => x.ToModel());
        public event Action ActiveRepositoriesChanged;
    }
}

Call extension method as extension method.


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

using System.Linq;
using osu.Framework.Input;
using OpenTK.Input;
using osu.Framework.Allocation;

namespace osu.Framework.Graphics.Containers
{
    /// <summary>
    /// An overlay container that eagerly holds keyboard focus.
    /// </summary>
    public abstract class FocusedOverlayContainer : OverlayContainer
    {
        protected InputManager InputManager;

        public override bool RequestingFocus => State == Visibility.Visible;

        protected override bool OnFocus(InputState state) => true;

        protected override void OnFocusLost(InputState state)
        {
            if (state.Keyboard.Keys.Contains(Key.Escape))
                Hide();
            base.OnFocusLost(state);
        }

        [BackgroundDependencyLoader]
        private void load(UserInputManager inputManager)
        {
            InputManager = inputManager;
        }

        protected override void PopIn()
        {
            Schedule(InputManager.TriggerFocusContention);
        }

        protected override void PopOut()
        {
            if (HasFocus)
                InputManager.ChangeFocus(null);
        }
    }
}

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

using System.Linq;
using osu.Framework.Input;
using OpenTK.Input;
using osu.Framework.Allocation;

namespace osu.Framework.Graphics.Containers
{
    /// <summary>
    /// An overlay container that eagerly holds keyboard focus.
    /// </summary>
    public abstract class FocusedOverlayContainer : OverlayContainer
    {
        protected InputManager InputManager;

        public override bool RequestingFocus => State == Visibility.Visible;

        protected override bool OnFocus(InputState state) => true;

        protected override void OnFocusLost(InputState state)
        {
            if (state.Keyboard.Keys.Contains(Key.Escape))
                Hide();
            base.OnFocusLost(state);
        }

        [BackgroundDependencyLoader]
        private void load(UserInputManager inputManager)
        {
            InputManager = inputManager;
        }

        protected override void PopIn()
        {
            Schedule(() => InputManager.TriggerFocusContention());
        }

        protected override void PopOut()
        {
            if (HasFocus)
                InputManager.ChangeFocus(null);
        }
    }
}

Fix potential nullref due to missing lambda


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VVVV.DX11.Internals.Effects.Pins;
using VVVV.PluginInterfaces.V2;
using SlimDX.Direct3D11;
using VVVV.PluginInterfaces.V1;
using VVVV.Hosting.Pins;
using VVVV.DX11.Lib.Effects.Pins;
using FeralTic.DX11;

namespace VVVV.DX11.Internals.Effects.Pins
{
    public class SamplerShaderPin : AbstractShaderV2Pin<SamplerDescription>
    {
        private SamplerState state;

        protected override void ProcessAttribute(InputAttribute attr, EffectVariable var)
        {
            attr.IsSingle = true;
            attr.CheckIfChanged = true;
        }

        protected override bool RecreatePin(EffectVariable var)
        {
            return false;
        }

        public override void SetVariable(DX11ShaderInstance shaderinstance, int slice)
        {
            if (this.pin.PluginIO.IsConnected)
            {
                if (this.pin.IsChanged)
                {
                    if (this.state != null) { this.state.Dispose(); this.state = null; }
                }

                if (this.state == null || this.state.Disposed)
                {
                    this.state = SamplerState.FromDescription(shaderinstance.RenderContext.Device, this.pin[0]);
                }
                shaderinstance.SetByName(this.Name, this.state);
            }
            else
            {
                if (this.state != null)
                {
                    this.state.Dispose();
                    this.state = null;
                    shaderinstance.SetByName(this.Name, this.state);
                }
            }

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using VVVV.DX11.Internals.Effects.Pins;
using VVVV.PluginInterfaces.V2;
using SlimDX.Direct3D11;
using VVVV.PluginInterfaces.V1;
using VVVV.Hosting.Pins;
using VVVV.DX11.Lib.Effects.Pins;
using FeralTic.DX11;

namespace VVVV.DX11.Internals.Effects.Pins
{
    public class SamplerShaderPin : AbstractShaderV2Pin<SamplerDescription>
    {
        private SamplerState state;

        protected override void ProcessAttribute(InputAttribute attr, EffectVariable var)
        {
            attr.IsSingle = true;
            attr.CheckIfChanged = true;
        }

        protected override bool RecreatePin(EffectVariable var)
        {
            return false;
        }

        public override void SetVariable(DX11ShaderInstance shaderinstance, int slice)
        {
            if (this.pin.PluginIO.IsConnected)
            {
                using (var state = SamplerState.FromDescription(shaderinstance.RenderContext.Device, this.pin[slice]))
                {
                    shaderinstance.SetByName(this.Name, state);
                }
            }
            else
            {
                shaderinstance.Effect.GetVariableByName(this.Name).AsConstantBuffer().UndoSetConstantBuffer();
            }

        }
    }
}

Fix sampler update when connected

Fix sampler update when connected


using System;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json;
using PortableWordPressApi;
using PortableWordPressApi.Resources;

namespace ApiConsole
{
	class Program
	{
		static void Main(string[] args)
		{
			Task.WaitAll(AsyncMain());

			Console.WriteLine("Press any key to close.");
			Console.Read();
		}

		private static async Task AsyncMain()
		{
			Console.WriteLine("Enter site URL:");
			var url = Console.ReadLine();

			Console.WriteLine("Searching for API at {0}", url);

			var httpClient = new HttpClient();
			var discovery = new WordPressApiDiscovery(new Uri(url, UriKind.Absolute), httpClient);
			var api = await discovery.DiscoverApiForSite();

			Console.WriteLine("Site's API endpoint: {0}", api.ApiRootUri);

			var indexResponse = await httpClient.GetAsync(api.ApiRootUri);
			var index = JsonConvert.DeserializeObject<ApiIndex>(await indexResponse.Content.ReadAsStringAsync());
			Console.WriteLine("Supported routes: TODO");
		}
	}
}

using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json;
using PortableWordPressApi;
using PortableWordPressApi.Resources;

namespace ApiConsole
{
	class Program
	{
		static void Main(string[] args)
		{
			Task.WaitAll(AsyncMain());

			Console.WriteLine("Press any key to close.");
			Console.Read();
		}

		private static async Task AsyncMain()
		{
			Console.WriteLine("Enter site URL:");
			var url = Console.ReadLine();

			Console.WriteLine("Searching for API at {0}", url);

			var httpClient = new HttpClient();
			var discovery = new WordPressApiDiscovery(new Uri(url, UriKind.Absolute), httpClient);
			var api = await discovery.DiscoverApiForSite();

			Console.WriteLine("Site's API endpoint: {0}", api.ApiRootUri);

			var indexResponse = await httpClient.GetAsync(api.ApiRootUri);
			var index = JsonConvert.DeserializeObject<ApiIndex>(await indexResponse.Content.ReadAsStringAsync());
			Console.WriteLine("Supported routes:");
			foreach (var route in index.Routes)
			{
				Console.WriteLine("\t" + route.Key);
			}
		}
	}
}

Print supported routes in console app.

Print supported routes in console app.


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

using System;
using osu.Framework.Graphics.Containers;

namespace osu.Framework.Allocation
{
    /// <summary>
    /// Denotes a component which performs long-running tasks in its <see cref="BackgroundDependencyLoaderAttribute"/> method that are not CPU intensive.
    /// This will force a consumer to use <see cref="CompositeDrawable.LoadComponentAsync{TLoadable}"/> when loading the components, and also schedule them in a lower priority pool.
    /// </summary>
    [AttributeUsage(AttributeTargets.Class)]
    public class LongRunningLoadAttribute : Attribute
    {
    }
}

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

using System;
using osu.Framework.Graphics.Containers;

namespace osu.Framework.Allocation
{
    /// <summary>
    /// Denotes a component which performs long-running tasks in its <see cref="BackgroundDependencyLoaderAttribute"/> method that are not CPU intensive.
    /// Long-running tasks are scheduled into a lower priority thread pool.
    /// </summary>
    /// <remarks>
    /// This forces immediate consumers to use <see cref="CompositeDrawable.LoadComponentAsync{TLoadable}"/> when loading the component.
    /// </remarks>
    [AttributeUsage(AttributeTargets.Class)]
    public class LongRunningLoadAttribute : Attribute
    {
    }
}

Adjust xmldoc to mention "immediate" consumer


// 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.Configuration;
using osu.Framework.Platform;

namespace osu.Game.Tournament.Configuration
{
    public class TournamentStorageManager : IniConfigManager<StorageConfig>
    {
        protected override string Filename => "tournament.ini";

        public TournamentStorageManager(Storage storage)
            : base(storage)
        {
        }

        protected override void InitialiseDefaults()
        {
            base.InitialiseDefaults();
            Set(StorageConfig.CurrentTournament, string.Empty);
        }
    }

    public enum StorageConfig
    {
        CurrentTournament,
    }
}

// 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.Configuration;
using osu.Framework.Platform;

namespace osu.Game.Tournament.Configuration
{
    public class TournamentStorageManager : IniConfigManager<StorageConfig>
    {
        protected override string Filename => "tournament.ini";

        public TournamentStorageManager(Storage storage)
            : base(storage)
        {
        }
    }

    public enum StorageConfig
    {
        CurrentTournament,
    }
}

Remove default value in Storagemgr

Remove default value in Storagemgr


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

namespace Internal.TypeSystem
{
    // Implements canonicalization for arrays
    partial class ArrayType
    {
        protected override TypeDesc ConvertToCanonFormImpl(CanonicalFormKind kind)
        {
            TypeDesc paramTypeConverted = CanonUtilites.ConvertToCanon(ParameterType, kind);
            if (paramTypeConverted != ParameterType)
            {
                // Note: don't use the Rank property here, as that hides the difference
                // between a single dimensional MD array and an SZArray.
                return Context.GetArrayType(paramTypeConverted, _rank);
            }

            return this;
        }
    }
}

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

namespace Internal.TypeSystem
{
    // Implements canonicalization for arrays
    partial class ArrayType
    {
        protected override TypeDesc ConvertToCanonFormImpl(CanonicalFormKind kind)
        {
            TypeDesc paramTypeConverted = CanonUtilites.ConvertToCanon(ParameterType, kind);
            if (paramTypeConverted != ParameterType)
            {
                // Note: don't use the Rank property here, as that hides the difference
                // between a single dimensional MD array and an SZArray.
                return Context.GetArrayType(paramTypeConverted, _rank);
            }

            return this;
        }
    }

    // Implements canonicalization for array methods
    partial class ArrayMethod
    {
        public override bool IsCanonicalMethod(CanonicalFormKind policy)
        {
            return _owningType.IsCanonicalSubtype(policy);
        }

        public override MethodDesc GetCanonMethodTarget(CanonicalFormKind kind)
        {
            TypeDesc canonicalizedTypeOfTargetMethod = _owningType.ConvertToCanonForm(kind);
            if (canonicalizedTypeOfTargetMethod == _owningType)
                return this;

            return ((ArrayType)canonicalizedTypeOfTargetMethod).GetArrayMethod(_kind);
        }
    }
}

Add canonicalization support for array methods


using System.Configuration;

namespace NStatsD
{
    public class StatsDConfigurationSection : ConfigurationSection
    {
        [ConfigurationProperty("enabled", DefaultValue = "true", IsRequired = false)]
        public bool Enabled
        {
            get { return (bool) this["enabled"]; }
            set { this["enabled"] = value; }
        }

        [ConfigurationProperty("server")]
        public ServerElement Server
        {
            get { return (ServerElement) this["server"]; }
            set { this["server"] = value; }
        }

        [ConfigurationProperty("prefix", DefaultValue = "", IsRequired = false)]
        public string Prefix
        {
            get { return (string)this["prefix"]; }
            set { this["prefix"] = value; }
        }
    }

    public class ServerElement : ConfigurationElement
    {
        [ConfigurationProperty("host", DefaultValue = "localhost", IsRequired = true)]
        public string Host
        {
            get { return (string) this["host"]; }
            set { this["host"] = value; }
        }

        [ConfigurationProperty("port", DefaultValue = "8125", IsRequired = false)]
        public int Port
        {
            get { return (int) this["port"]; }
            set { this["port"] = value; }
        }
    }
}

using System.Configuration;

namespace NStatsD
{
    public class StatsDConfigurationSection : ConfigurationSection
    {
        [ConfigurationProperty("enabled", DefaultValue = "true", IsRequired = false)]
        public bool Enabled
        {
            get { return (bool) this["enabled"]; }
            set { this["enabled"] = value; }
        }

        [ConfigurationProperty("server")]
        public ServerElement Server
        {
            get { return (ServerElement) this["server"]; }
            set { this["server"] = value; }
        }

        [ConfigurationProperty("prefix", DefaultValue = "", IsRequired = false)]
        public string Prefix
        {
            get { return (string)this["prefix"]; }
            set { this["prefix"] = value; }
        }

        public override bool IsReadOnly()
        {
            return false;
        }
    }

    public class ServerElement : ConfigurationElement
    {
        [ConfigurationProperty("host", DefaultValue = "localhost", IsRequired = true)]
        public string Host
        {
            get { return (string) this["host"]; }
            set { this["host"] = value; }
        }

        [ConfigurationProperty("port", DefaultValue = "8125", IsRequired = false)]
        public int Port
        {
            get { return (int) this["port"]; }
            set { this["port"] = value; }
        }
    }
}

Fix exception when configuration is read


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Magecrawl.GameEngine.Actors;
using Magecrawl.Utilities;

namespace Magecrawl.GameEngine.Affects
{
    internal class Haste : AffectBase
    {
        private double m_modifier;

        public Haste() : base(0)
        {
        }

        public Haste(int strength)
            : base(new DiceRoll(1, 4, strength).Roll() * CoreTimingEngine.CTNeededForNewTurn)
        {
            m_modifier = 1 + (.2 * strength);
        }

        public override void Apply(Character appliedTo)
        {
            appliedTo.CTIncreaseModifier *= m_modifier;
        }

        public override void Remove(Character removedFrom)
        {
            removedFrom.CTIncreaseModifier /= m_modifier;
        }

        public override string Name
        {
            get
            {
                return "Haste";
            }
        }

        #region SaveLoad

        public override void ReadXml(System.Xml.XmlReader reader)
        {
            base.ReadXml(reader);
            m_modifier = reader.ReadContentAsDouble();
        }

        public override void WriteXml(System.Xml.XmlWriter writer)
        {
            base.WriteXml(writer);
            writer.WriteElementString("Modifier", m_modifier.ToString());
        }

        #endregion
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Magecrawl.GameEngine.Actors;
using Magecrawl.Utilities;

namespace Magecrawl.GameEngine.Affects
{
    internal class Haste : AffectBase
    {
        private double m_modifier;

        public Haste() : base(0)
        {
        }

        public Haste(int strength)
            : base(new DiceRoll(1, 4, strength).Roll() * CoreTimingEngine.CTNeededForNewTurn)
        {
            m_modifier = 1 + (.2 * strength);
        }

        public override void Apply(Character appliedTo)
        {
            appliedTo.CTIncreaseModifier *= m_modifier;
        }

        public override void Remove(Character removedFrom)
        {
            removedFrom.CTIncreaseModifier /= m_modifier;
        }

        public override string Name
        {
            get
            {
                return "Haste";
            }
        }

        #region SaveLoad

        public override void ReadXml(System.Xml.XmlReader reader)
        {
            base.ReadXml(reader);
            m_modifier = reader.ReadElementContentAsDouble();
        }

        public override void WriteXml(System.Xml.XmlWriter writer)
        {
            base.WriteXml(writer);
            writer.WriteElementString("Modifier", m_modifier.ToString());
        }

        #endregion
    }
}

Fix crash on loading hasted player.

Fix crash on loading hasted player.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using Sage.Platform;
using Sage.Platform.Orm.Attributes;
using Sage.Platform.Orm.Interfaces;

namespace OpenSlx.Lib.Utility
{
    /// <summary>
    /// Miscellaneous utilities dealing with SLX entities.
    /// </summary>
    public static class SlxEntityUtility
    {
        public static T CloneEntity<T>(T source)
            where T : IDynamicEntity
        {
            T target = EntityFactory.Create<T>();
            foreach (PropertyInfo prop in source.GetType().GetProperties())
            {
                if (Attribute.GetCustomAttribute(prop, typeof(FieldAttribute)) != null)
                {
                    target[prop.Name] = source[prop.Name];
                }
            }
            return target;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using Sage.Platform;
using Sage.Platform.Orm.Attributes;
using Sage.Platform.Orm.Interfaces;
using Sage.Platform.Orm.Services;

namespace OpenSlx.Lib.Utility
{
    /// <summary>
    /// Miscellaneous utilities dealing with SLX entities.
    /// </summary>
    public static class SlxEntityUtility
    {
        /// <summary>
        /// Create a copy of an existing entity
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="source"></param>
        /// <returns></returns>
        public static T CloneEntity<T>(T source)
            where T : IDynamicEntity
        {
            T target = EntityFactory.Create<T>();
            CopyEntityProperties(target, source);
            return target;
        }

        public static void CopyEntityProperties<T>(T target, T source)
            where T : IDynamicEntity
        {
            foreach (PropertyInfo prop in source.GetType().GetProperties())
            {
                // only copy the ones associated with DB fields
                // (note that this includes M-1 relationships)
                if (Attribute.GetCustomAttribute(prop, typeof(FieldAttribute)) != null)
                {
                    var extendedType =
                        (DynamicEntityDescriptorConfigurationService.ExtendedTypeInformationAttribute)
                            prop.GetCustomAttributes(
                                typeof(DynamicEntityDescriptorConfigurationService.ExtendedTypeInformationAttribute),
                                false).FirstOrDefault();
                    // don't copy ID fields - we'll pick up the reference properties instead
                    if (extendedType != null && extendedType.ExtendedTypeName ==
                        "Sage.Platform.Orm.DataTypes.StandardIdDataType,  Sage.Platform")
                    {
                        continue;
                    }
                    target[prop.Name] = source[prop.Name];
                }
            }
        }
    }
}

Add check for Standard Id in CloneEntity, and add a CopyEntityProperties method to allow calling it separately


using System;
using System.Net;
using System.Text;
using System.Threading;
using xServer.Settings;

namespace xServer.Core.Misc
{
    public static class NoIpUpdater
    {
        private static bool _running;

        public static void Start()
        {
            if (_running) return;
            Thread updateThread = new Thread(BackgroundUpdater) {IsBackground = true};
            updateThread.Start();
        }

        private static void BackgroundUpdater()
        {
            _running = true;
            while (XMLSettings.IntegrateNoIP)
            {
                try
                {
                    HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(string.Format("http://dynupdate.no-ip.com/nic/update?hostname={0}", XMLSettings.NoIPHost));
                    request.UserAgent = string.Format("xRAT No-Ip Updater/2.0 {0}", XMLSettings.NoIPUsername);
                    request.Timeout = 10000;
                    request.Headers.Add(HttpRequestHeader.Authorization, string.Format("Basic {0}", Convert.ToBase64String(Encoding.ASCII.GetBytes(string.Format("{0}:{1}", XMLSettings.NoIPUsername, XMLSettings.NoIPPassword)))));
                    request.Method = "GET";

                    using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                    {
                    }
                }
                catch
                {
                }

                Thread.Sleep(TimeSpan.FromMinutes(10));
            }
            _running = false;
        }
    }
}

using System;
using System.Net;
using System.Text;
using System.Threading;
using xServer.Settings;

namespace xServer.Core.Misc
{
    public static class NoIpUpdater
    {
        private static bool _running;

        public static void Start()
        {
            if (_running) return;
            Thread updateThread = new Thread(BackgroundUpdater) {IsBackground = true};
            updateThread.Start();
        }

        private static void BackgroundUpdater()
        {
            _running = true;
            while (XMLSettings.IntegrateNoIP)
            {
                try
                {
                    HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(string.Format("http://dynupdate.no-ip.com/nic/update?hostname={0}", XMLSettings.NoIPHost));
                    request.Proxy = null;
                    request.UserAgent = string.Format("xRAT No-Ip Updater/2.0 {0}", XMLSettings.NoIPUsername);
                    request.Timeout = 10000;
                    request.Headers.Add(HttpRequestHeader.Authorization, string.Format("Basic {0}", Convert.ToBase64String(Encoding.ASCII.GetBytes(string.Format("{0}:{1}", XMLSettings.NoIPUsername, XMLSettings.NoIPPassword)))));
                    request.Method = "GET";

                    using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
                    {
                    }
                }
                catch
                {
                }

                Thread.Sleep(TimeSpan.FromMinutes(10));
            }
            _running = false;
        }
    }
}

Set Proxy to null when sending the No-Ip DNS Update request


using revashare_svc_webapi.Logic;
using revashare_svc_webapi.Logic.Models;
using revashare_svc_webapi.Logic.RevaShareServiceReference;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;

namespace revashare_svc_webapi.Tests
{

  public class FlagTests
  {
    [Fact]
    public void test_GetFlags()
    {
      RevaShareDataServiceClient dataClient = new RevaShareDataServiceClient();

      List<FlagDAO> getflags = dataClient.GetAllFlags().ToList();

      Assert.NotNull(getflags);

    }

    [Fact]
    public void test_GetFlags_AdminLogic()
    {
      AdminLogic admLogic = new AdminLogic();
      var a = admLogic.GetUserReports();

      Assert.NotEmpty(a);

    }

    [Fact]
    public void test_RemoveReport_AdminLogic()
    {
      AdminLogic admLogic = new AdminLogic();

    }

  }
}

using revashare_svc_webapi.Logic;
using revashare_svc_webapi.Logic.Models;
using revashare_svc_webapi.Logic.RevaShareServiceReference;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;

namespace revashare_svc_webapi.Tests
{

  public class FlagTests
  {
    [Fact]
    public void test_GetFlags()
    {
      RevaShareDataServiceClient dataClient = new RevaShareDataServiceClient();

      List<FlagDAO> getflags = dataClient.GetAllFlags().ToList();

      Assert.NotNull(getflags);

    }

    [Fact]
    public void test_GetFlags_AdminLogic()
    {
      AdminLogic admLogic = new AdminLogic();
      var a = admLogic.GetUserReports();

      Assert.NotEmpty(a);

    }

    //[Fact]
    //public void test_RemoveReport_AdminLogic()
    //{
    //  AdminLogic admLogic = new AdminLogic();

    //}

  }
}

Check to see if merge worked

Check to see if merge worked