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

namespace ModGL.Numerics
{
    public static class MatrixExtensions
    {
        public static Matrix4f Translate(this Matrix4f mat, Vector3f offset)
        {
            return MatrixHelper.Translate(offset).Multiply(mat);
        }

        public static Matrix4f Translate(this Matrix4f mat, float x, float y, float z)
        {
            return MatrixHelper.Translate(x, y, z).Multiply(mat);
        }

        public static Matrix4f Scale(this Matrix4f mat, Vector3f scale)
        {
            return MatrixHelper.Scale(scale).Multiply(mat);
        }

        public static Matrix4f Scale(this Matrix4f mat, float x, float y, float z)
        {
            return MatrixHelper.Scale(x, y, z).Multiply(mat);
        }

        public static Matrix4f RotateX(this Matrix4f mat, float angleInRadians)
        {
            return MatrixHelper.RotateX(angleInRadians).Multiply(mat);
        }

        public static Matrix4f RotateY(this Matrix4f mat, float angleInRadians)
        {
            return MatrixHelper.RotateY(angleInRadians).Multiply(mat);
        }
    }
}

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

namespace ModGL.Numerics
{
    public static class MatrixExtensions
    {
        public static Matrix4f Translate(this Matrix4f mat, Vector3f offset)
        {
            return MatrixHelper.Translate(offset).Multiply(mat);
        }

        public static Matrix4f Translate(this Matrix4f mat, float x, float y, float z)
        {
            return MatrixHelper.Translate(x, y, z).Multiply(mat);
        }

        public static Matrix4f Scale(this Matrix4f mat, Vector3f scale)
        {
            return MatrixHelper.Scale(scale).Multiply(mat);
        }

        public static Matrix4f Scale(this Matrix4f mat, float x, float y, float z)
        {
            return MatrixHelper.Scale(x, y, z).Multiply(mat);
        }

        public static Matrix4f RotateX(this Matrix4f mat, float angleInRadians)
        {
            return MatrixHelper.RotateX(angleInRadians).Multiply(mat);
        }

        public static Matrix4f RotateY(this Matrix4f mat, float angleInRadians)
        {
            return MatrixHelper.RotateY(angleInRadians).Multiply(mat);
        }

        public static Matrix4f RotateZ(this Matrix4f mat, float angleInRadians)
        {
            return MatrixHelper.RotateZ(angleInRadians).Multiply(mat);
        }
    }
}

Add missing RotateZ helper function.

Add missing RotateZ helper function.


namespace Sitecore.Courier.Runner
{
    using Sitecore.Update;
    using Sitecore.Update.Engine;
    using System;

    /// <summary>
    /// Defines the program class.
    /// </summary>
    internal class Program
    {
        /// <summary>
        /// Mains the specified args.
        /// </summary>
        /// <param name="args">The arguments.</param>
        public static void Main(string[] args)
        {
            var options = new Options();
            if (CommandLine.Parser.Default.ParseArguments(args, options))
            {
                Console.WriteLine("Source: {0}", options.Source);
                Console.WriteLine("Target: {0}", options.Target);
                Console.WriteLine("Output: {0}", options.Output);
                var diff = new DiffInfo(
                    DiffGenerator.GetDiffCommands(options.Source, options.Target),
                    "Sitecore Courier Package",
                    string.Empty,
                    string.Format("Diff between serialization folders '{0}' and '{1}'.", options.Source, options.Target));

                PackageGenerator.GeneratePackage(diff, string.Empty, options.Output);
            }
        }
    }
}

namespace Sitecore.Courier.Runner
{
    using Sitecore.Update;
    using Sitecore.Update.Engine;
    using System;

    /// <summary>
    /// Defines the program class.
    /// </summary>
    internal class Program
    {
        /// <summary>
        /// Mains the specified args.
        /// </summary>
        /// <param name="args">The arguments.</param>
        public static void Main(string[] args)
        {
            var options = new Options();
            if (CommandLine.Parser.Default.ParseArguments(args, options))
            {
                Console.WriteLine("Source: {0}", options.Source);
                Console.WriteLine("Target: {0}", options.Target);
                Console.WriteLine("Output: {0}", options.Output);
                var diff = new DiffInfo(
                    DiffGenerator.GetDiffCommands(options.Source, options.Target),
                    "Sitecore Courier Package",
                    string.Empty,
                    string.Format("Diff between serialization folders '{0}' and '{1}'.", options.Source, options.Target));

                PackageGenerator.GeneratePackage(diff, string.Empty, options.Output);
            }
            else
            {
                Console.WriteLine(options.GetUsage());
            }
        }
    }
}

Add help text when incorrect args passed in


using System;
using System.IO.Ports;
using MYCroes.ATCommands;
using MYCroes.ATCommands.Forwarding;

namespace SupportManager.Control
{
    public class ATHelper : IDisposable
    {
        private readonly SerialPort serialPort;

        public ATHelper(string port)
        {
            serialPort = new SerialPort(port);
            serialPort.Open();
        }

        public void ForwardTo(string phoneNumberWithInternationalAccessCode)
        {
            var cmd = ForwardingStatus.Set(ForwardingReason.Unconditional, ForwardingMode.Registration,
                phoneNumberWithInternationalAccessCode, ForwardingPhoneNumberType.WithInternationalAccessCode,
                ForwardingClass.Voice);

            Execute(cmd);
        }

        public string GetForwardedPhoneNumber()
        {
            var cmd = ForwardingStatus.Query(ForwardingReason.Unconditional);
            var res = Execute(cmd);

            return ForwardingStatus.Parse(res[0]).Number;
        }

        private string[] Execute(ATCommand command)
        {
            var stream = serialPort.BaseStream;
            return command.Execute(stream);
        }

        public void Dispose()
        {
            if (serialPort.IsOpen) serialPort.Close();

            serialPort.Dispose();
        }
    }
}

using System;
using System.IO.Ports;
using MYCroes.ATCommands;
using MYCroes.ATCommands.Forwarding;

namespace SupportManager.Control
{
    public class ATHelper : IDisposable
    {
        private readonly SerialPort serialPort;

        public ATHelper(string port)
        {
            serialPort = new SerialPort(port);
            serialPort.Open();
        }

        public void ForwardTo(string phoneNumberWithInternationalAccessCode)
        {
            var cmd = ForwardingStatus.Set(ForwardingReason.Unconditional, ForwardingMode.Registration,
                phoneNumberWithInternationalAccessCode, ForwardingPhoneNumberType.WithInternationalAccessCode,
                ForwardingClass.Voice);

            Execute(cmd);
        }

        public string GetForwardedPhoneNumber()
        {
            var cmd = ForwardingStatus.Query(ForwardingReason.Unconditional);
            var res = Execute(cmd);

            return ForwardingStatus.Parse(res[0]).Number;
        }

        private string[] Execute(ATCommand command)
        {
            var stream = serialPort.BaseStream;
            stream.ReadTimeout = 10000;
            stream.WriteTimeout = 10000;

            return command.Execute(stream);
        }

        public void Dispose()
        {
            if (serialPort.IsOpen) serialPort.Close();

            serialPort.Dispose();
        }
    }
}

Apply a ReadTimeout/WriteTimeout to serialport stream


using Bugsnag.Payload;
using Xunit;

namespace Bugsnag.Tests
{
  public class ReportTests
  {
    [Fact]
    public void BasicTest()
    {
      System.Exception exception = null;
      var configuration = new Configuration("123456");

      try
      {
        throw new System.Exception("test");
      }
      catch (System.Exception caughtException)
      {
        exception = caughtException;
      }

      var report = new Report(configuration, exception, Bugsnag.Payload.Severity.ForHandledException(), new Breadcrumb[] { new Breadcrumb("test", BreadcrumbType.Manual) }, new Session(), new Request());
      Assert.NotNull(report);
    }
  }
}

using Bugsnag.Payload;
using Xunit;

namespace Bugsnag.Tests
{
  public class ReportTests
  {
    [Fact]
    public void BasicTest()
    {
      System.Exception exception = null;
      var configuration = new Configuration("123456");

      try
      {
        throw new System.Exception("test");
      }
      catch (System.Exception caughtException)
      {
        exception = caughtException;
      }

      var report = new Report(configuration, exception, Bugsnag.Payload.Severity.ForHandledException(), new Breadcrumb[] { new Breadcrumb("test", BreadcrumbType.Manual) }, new Session(), new Request());
      Assert.NotNull(report);
    }

    [Fact]
    public void NonThrownException()
    {
      System.Exception exception = new System.Exception("test");
      var configuration = new Configuration("123456");

      var report = new Report(configuration, exception, Bugsnag.Payload.Severity.ForHandledException(), new Breadcrumb[] { new Breadcrumb("test", BreadcrumbType.Manual) }, new Session(), new Request());
      Assert.NotNull(report);
    }
  }
}

Test that a non thrown exception produces a report


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

using System;
using ILCompiler.DependencyAnalysisFramework;
using Internal.TypeSystem;

namespace ILCompiler.DependencyAnalysis
{
    public sealed class CppCodegenNodeFactory : NodeFactory
    {
        public CppCodegenNodeFactory(CompilerTypeSystemContext context, CompilationModuleGroup compilationModuleGroup, MetadataManager metadataManager, NameMangler nameMangler, new LazyGenericsDisabledPolicy())
            : base(context, compilationModuleGroup, metadataManager, nameMangler)
        {
        }

        public override bool IsCppCodegenTemporaryWorkaround => true;

        protected override IMethodNode CreateMethodEntrypointNode(MethodDesc method)
        {
            if (CompilationModuleGroup.ContainsMethod(method))
            {
                return new CppMethodCodeNode(method);
            }
            else
            {
                return new ExternMethodSymbolNode(this, method);
            }
        }

        protected override IMethodNode CreateUnboxingStubNode(MethodDesc method)
        {
            // TODO: this is wrong: this returns an assembly stub node
            return new UnboxingStubNode(method);
        }

        protected override ISymbolNode CreateReadyToRunHelperNode(ReadyToRunHelperKey helperCall)
        {
            // TODO: this is wrong: this returns an assembly stub node
            return new ReadyToRunHelperNode(this, helperCall.HelperId, helperCall.Target);
        }
    }
}

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

using System;
using ILCompiler.DependencyAnalysisFramework;
using Internal.TypeSystem;

namespace ILCompiler.DependencyAnalysis
{
    public sealed class CppCodegenNodeFactory : NodeFactory
    {
        public CppCodegenNodeFactory(CompilerTypeSystemContext context, CompilationModuleGroup compilationModuleGroup, MetadataManager metadataManager, NameMangler nameMangler)
            : base(context, compilationModuleGroup, metadataManager, nameMangler, new LazyGenericsDisabledPolicy())
        {
        }

        public override bool IsCppCodegenTemporaryWorkaround => true;

        protected override IMethodNode CreateMethodEntrypointNode(MethodDesc method)
        {
            if (CompilationModuleGroup.ContainsMethod(method))
            {
                return new CppMethodCodeNode(method);
            }
            else
            {
                return new ExternMethodSymbolNode(this, method);
            }
        }

        protected override IMethodNode CreateUnboxingStubNode(MethodDesc method)
        {
            // TODO: this is wrong: this returns an assembly stub node
            return new UnboxingStubNode(method);
        }

        protected override ISymbolNode CreateReadyToRunHelperNode(ReadyToRunHelperKey helperCall)
        {
            // TODO: this is wrong: this returns an assembly stub node
            return new ReadyToRunHelperNode(this, helperCall.HelperId, helperCall.Target);
        }
    }
}

Fix CppCodegen build break and hook up CppCodegen to TFS build

This project builds quickly and building it avoids unpleasant surprises coming through the mirror.

[tfs-changeset: 1658774]


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

using System.Threading;
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osuTK;

namespace osu.Framework.Tests.Visual.Drawables
{
    public class TestSceneSynchronizationContext : FrameworkTestScene
    {
        private AsyncPerformingBox box;

        [Test]
        public void TestAsyncPerformingBox()
        {
            AddStep("add box", () => Child = box = new AsyncPerformingBox());
            AddAssert("not spun", () => box.Rotation == 0);
            AddStep("trigger", () => box.Trigger());
            AddUntilStep("has spun", () => box.Rotation == 180);
        }

        public class AsyncPerformingBox : Box
        {
            private readonly SemaphoreSlim waiter = new SemaphoreSlim(0);

            public AsyncPerformingBox()
            {
                Size = new Vector2(100);

                Anchor = Anchor.Centre;
                Origin = Anchor.Centre;
            }

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

                await waiter.WaitAsync().ConfigureAwait(false);

                this.RotateTo(180, 500);
            }

            public void Trigger()
            {
                waiter.Release();
            }
        }
    }
}

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

using System.Threading;
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osuTK;

namespace osu.Framework.Tests.Visual.Drawables
{
    public class TestSceneSynchronizationContext : FrameworkTestScene
    {
        private AsyncPerformingBox box;

        [Test]
        public void TestAsyncPerformingBox()
        {
            AddStep("add box", () => Child = box = new AsyncPerformingBox());
            AddAssert("not spun", () => box.Rotation == 0);
            AddStep("trigger", () => box.Trigger());
            AddUntilStep("has spun", () => box.Rotation == 180);
        }

        public class AsyncPerformingBox : Box
        {
            private readonly SemaphoreSlim waiter = new SemaphoreSlim(0);

            public AsyncPerformingBox()
            {
                Size = new Vector2(100);

                Anchor = Anchor.Centre;
                Origin = Anchor.Centre;
            }

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

                await waiter.WaitAsync().ConfigureAwait(true);

                this.RotateTo(180, 500);
            }

            public void Trigger()
            {
                waiter.Release();
            }
        }
    }
}

Fix huge oops in test scene (we actually want ConfigureAwait(true) here)


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

using System;

using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Steeltoe.Extensions.Configuration.ConfigServer;

namespace Steeltoe.Extensions.Configuration
{

    public static class ConfigServerConfigurationBuilderExtensions
    {

        public static IConfigurationBuilder AddConfigServer(this IConfigurationBuilder configurationBuilder, ConfigServerClientSettings settings, ILoggerFactory logFactory = null)
        {
            if (configurationBuilder == null)
            {
                throw new ArgumentNullException(nameof(configurationBuilder));
            }

            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            configurationBuilder.Add(new ConfigServerConfigurationProvider(settings, logFactory));
            return configurationBuilder;
        }
    }
}

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

using System;

using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Steeltoe.Extensions.Configuration.ConfigServer;

namespace Steeltoe.Extensions.Configuration
{

    public static class ConfigServerConfigurationBuilderExtensions
    {
        public static IConfigurationBuilder AddConfigServer(this IConfigurationBuilder configurationBuilder, string environment, ILoggerFactory logFactory = null) =>
            configurationBuilder.AddConfigServer(new ConfigServerClientSettings() { Environment = environment }, logFactory);

        public static IConfigurationBuilder AddConfigServer(this IConfigurationBuilder configurationBuilder, ConfigServerClientSettings defaultSettings, ILoggerFactory logFactory = null)
        {
            if (configurationBuilder == null)
            {
                throw new ArgumentNullException(nameof(configurationBuilder));
            }

            if (defaultSettings == null)
            {
                throw new ArgumentNullException(nameof(defaultSettings));
            }

            configurationBuilder.Add(new ConfigServerConfigurationProvider(defaultSettings, logFactory));
            return configurationBuilder;
        }
    }
}

Add extension method with environment string


Add support for ctm model format

Add support for ctm model format


using System;
using System.Deployment.Application;
using System.Globalization;
using System.Windows;
using System.Windows.Documents;
using StringResources = PackageExplorer.Resources.Resources;

namespace PackageExplorer
{
    /// <summary>
    /// Interaction logic for AboutWindow.xaml
    /// </summary>
    public partial class AboutWindow : StandardDialog
    {
        public AboutWindow()
        {
            InitializeComponent();

            ProductTitle.Text = String.Format(
                CultureInfo.CurrentCulture,
                "{0} ({1})",
                StringResources.Dialog_Title,
                GetApplicationVersion());
        }

        private static Version GetApplicationVersion()
        {
            if (ApplicationDeployment.IsNetworkDeployed)
            {
                return ApplicationDeployment.CurrentDeployment.CurrentVersion;
            }
            else
            {
                return typeof(MainWindow).Assembly.GetName().Version;
            }
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            DialogResult = true;
        }

        private void Hyperlink_Click(object sender, RoutedEventArgs e)
        {
            var link = (Hyperlink) sender;
            UriHelper.OpenExternalLink(link.NavigateUri);
        }
    }
}

using System;
using System.Deployment.Application;
using System.Globalization;
using System.Reflection;
using System.Windows;
using System.Windows.Documents;
using StringResources = PackageExplorer.Resources.Resources;

namespace PackageExplorer
{
    /// <summary>
    /// Interaction logic for AboutWindow.xaml
    /// </summary>
    public partial class AboutWindow : StandardDialog
    {
        public AboutWindow()
        {
            InitializeComponent();

            ProductTitle.Text = $"{StringResources.Dialog_Title} ({ typeof(AboutWindow).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>().InformationalVersion})";
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            DialogResult = true;
        }

        private void Hyperlink_Click(object sender, RoutedEventArgs e)
        {
            var link = (Hyperlink) sender;
            UriHelper.OpenExternalLink(link.NavigateUri);
        }
    }
}

Use informational attribute for version

Use informational attribute for version


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace NativeWiFiApi_TestWinForm
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            NativeWiFiApi.wifi wifiApi = new NativeWiFiApi.wifi();
            wifiApi.EnumerateNICs();
        }
    }
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace NativeWiFiApi_TestWinForm
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //
            NativeWiFiApi.wifi wifiApi = new NativeWiFiApi.wifi();
            wifiApi.EnumerateNICs();
        }
    }
}

Test 1st commit from explorer to GitHub.


using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.SqlServer.Dts.Runtime;

namespace NBi.Core.Etl.IntegrationService
{
    abstract class EtlRunner: IEtlRunner
    {
        public IEtl Etl { get; private set; }

        public EtlRunner(IEtl etl)
        {
            Etl = etl;
        }

        public abstract IExecutionResult Run();

        public void Execute()
        {
            Run();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.SqlServer.Dts.Runtime;

namespace NBi.Core.Etl.IntegrationService
{
    abstract class EtlRunner: IEtlRunner
    {
        public IEtl Etl { get; private set; }

        public EtlRunner(IEtl etl)
        {
            Etl = etl;
        }

        public abstract IExecutionResult Run();

        public void Execute()
        {
            var result = Run();
            if (result.IsFailure)
                throw new Exception(result.Message);
        }
    }
}

Enforce an exception when the ETL has failed


using ShopifySharp.Filters;
using ShopifySharp.Infrastructure;
using System.Collections.Generic;
using System.Linq;

namespace ShopifySharp.Lists
{
    public class ListResult<T>
    {
        public IEnumerable<T> Items { get; }

        public LinkHeaderParseResult<T> LinkHeader { get; }

        public bool HasNextPage => LinkHeader?.NextLink != null;

        public bool HasPreviousPage => LinkHeader?.PreviousLink != null;

        public ListFilter<T> GetNextPageFilter(int? limit = null)
        {
            return LinkHeader?.NextLink?.GetFollowingPageFilter(limit);
        }

        public ListFilter<T> GetPreviousPageFilter(int? limit = null)
        {
            return LinkHeader?.PreviousLink?.GetFollowingPageFilter(limit);
        }

        public ListResult(IEnumerable<T> items, LinkHeaderParseResult<T> linkHeader)
        {
            Items = items;
            LinkHeader = linkHeader;
        }
    }
}

using ShopifySharp.Filters;
using ShopifySharp.Infrastructure;
using System.Collections.Generic;
using System.Linq;

namespace ShopifySharp.Lists
{
    public class ListResult<T>
    {
        public IEnumerable<T> Items { get; }

        public LinkHeaderParseResult<T> LinkHeader { get; }

        public bool HasNextPage => LinkHeader?.NextLink != null;

        public bool HasPreviousPage => LinkHeader?.PreviousLink != null;

        public ListFilter<T> GetNextPageFilter(int? limit = null, string fields = null)
        {
            return LinkHeader?.NextLink?.GetFollowingPageFilter(limit, fields);
        }

        public ListFilter<T> GetPreviousPageFilter(int? limit = null, string fields = null)
        {
            return LinkHeader?.PreviousLink?.GetFollowingPageFilter(limit, fields);
        }

        public ListResult(IEnumerable<T> items, LinkHeaderParseResult<T> linkHeader)
        {
            Items = items;
            LinkHeader = linkHeader;
        }
    }
}

Allow passing fields to next/previous page filters


using UnityEngine;
using UnityEditor;
using System.Collections;

using DialoguerEditor;

public class DialogueEditorAssetModificationProcessor : UnityEditor.AssetModificationProcessor {
	public static string[] OnWillSaveAssets(string[] paths){
		//DialogueEditorWindow window = (DialogueEditorWindow)EditorWindow.GetWindow(typeof(DialogueEditorWindow));
		if(EditorWindow.focusedWindow != null){
			if(EditorWindow.focusedWindow.title == "Dialogue Editor" || EditorWindow.focusedWindow.title == "Variable Editor" || EditorWindow.focusedWindow.title == "Theme Editor"){
				DialogueEditorDataManager.save();
				DialoguerEnumGenerator.GenerateDialoguesEnum();
			}
		}
		return paths;
	}
}

using UnityEngine;
using UnityEditor;
using System.Collections;

using DialoguerEditor;

public class DialogueEditorAssetModificationProcessor : UnityEditor.AssetModificationProcessor {
	public static string[] OnWillSaveAssets(string[] paths){
		//DialogueEditorWindow window = (DialogueEditorWindow)EditorWindow.GetWindow(typeof(DialogueEditorWindow));
		if(EditorWindow.focusedWindow != null){
            if (EditorWindow.focusedWindow.titleContent.text == "Dialogue Editor" || EditorWindow.focusedWindow.titleContent.text == "Variable Editor" || EditorWindow.focusedWindow.titleContent.text == "Theme Editor")
            {
				DialogueEditorDataManager.save();
				DialoguerEnumGenerator.GenerateDialoguesEnum();
			}
		}
		return paths;
	}
}

Fix Dialoguer using a deprecated Unity feature


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

namespace Halodi.Physics.Interfaces
{
    public abstract class IPhysicsEngine : MonoBehaviour
    {
        public abstract IRevoluteJointPhysics AddRevoluteJoint(ArticulationRevoluteJoint joint);
        public abstract IPrismaticJointPhysics AddPrismaticJoint(ArticulationPrismaticJoint joint);

        public abstract IFixedJointPhysics AddFixedJoint(ArticulationFixedJoint joint);

        public abstract IFloatingJointPhysics AddFloatingJoint(ArticulationFloatingJoint joint);

        public abstract void Simulate(float step);
    }

}

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

namespace Halodi.Physics.Interfaces
{
    public abstract class IPhysicsEngine : MonoBehaviour
    {
        public abstract IRevoluteJointPhysics AddRevoluteJoint(ArticulationRevoluteJoint joint);
        public abstract IPrismaticJointPhysics AddPrismaticJoint(ArticulationPrismaticJoint joint);

        public abstract IFixedJointPhysics AddFixedJoint(ArticulationFixedJoint joint);

        public abstract IFloatingJointPhysics AddFloatingJoint(ArticulationFloatingJoint joint);
    }

}

Add simulate call to robot

Add simulate call to robot


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Bugsnag.Sample.AspNet35
{
  public partial class Index : System.Web.UI.Page
  {
    protected void Page_Load(object sender, EventArgs e)
    {
      AspNet.Client.Current.Breadcrumbs.Leave("Page_Load");
    }

    protected void Unhandled(object sender, EventArgs e)
    {
      throw new NotImplementedException();
    }

    protected void Handled(object sender, EventArgs e)
    {
      try
      {
        throw new Exception("This could be bad");
      }
      catch (Exception exception)
      {
        AspNet.Client.Current.Notify(exception);
      }
    }
  }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Bugsnag.AspNet;

namespace Bugsnag.Sample.AspNet35
{
  public partial class Index : System.Web.UI.Page
  {
    protected void Page_Load(object sender, EventArgs e)
    {
      AspNet.Client.Current.Breadcrumbs.Leave("Page_Load");
    }

    protected void Unhandled(object sender, EventArgs e)
    {
      throw new NotImplementedException();
    }

    protected void Handled(object sender, EventArgs e)
    {
      try
      {
        throw new Exception("This could be bad");
      }
      catch (Exception exception)
      {
        AspNet.Client.Current.NotifyWithHttpContext(exception);
      }
    }
  }
}

Use the new extension method

Use the new extension method


using System.Collections.Generic;
using System.Runtime.Serialization;
using PS.Mothership.Core.Common.Template.Gen;

namespace PS.Mothership.Core.Common.Dto.Application
{
    [DataContract]
    public class ApplicationDetailsMetadataDto
    {
        [DataMember]
        public IList<GenBusinessLegalType> BusinessLegalTypes { get; set; }
    }
}

using System.Collections.Generic;
using System.Runtime.Serialization;
using PS.Mothership.Core.Common.Template.App;
using PS.Mothership.Core.Common.Template.Gen;

namespace PS.Mothership.Core.Common.Dto.Application
{
    [DataContract]
    public class ApplicationDetailsMetadataDto
    {
        [DataMember]
        public IList<GenBusinessLegalType> BusinessLegalTypes { get; set; }

        [DataMember]
        public IList<AppAdvertisingFlags> AdvertisingTypes { get; set; }
    }
}

Add missing property, needed in web

Add missing property, needed in web


// Original Work Copyright (c) Ethan Moffat 2014-2016
// This file is subject to the GPL v2 License
// For additional details, see the LICENSE file

using AutomaticTypeMapper;

namespace EOLib
{
#if LINUX
    [AutoMappedType]
    public class HDSerialNumberServiceLinux : IHDSerialNumberService
    {
        public string GetHDSerialNumber()
        {
            return "12345"; // Just like my luggage
        }
    }
#endif
}

// Original Work Copyright (c) Ethan Moffat 2014-2016
// This file is subject to the GPL v2 License
// For additional details, see the LICENSE file

using System.Diagnostics;
using System.Linq;
using System.Text.RegularExpressions;
using AutomaticTypeMapper;

namespace EOLib
{
#if LINUX
    [AutoMappedType]
    public class HDSerialNumberServiceLinux : IHDSerialNumberService
    {
        public string GetHDSerialNumber()
        {
            // use lsblk --nodeps -o serial to get serial number
            try
            {
                var serialNumber = "";

                var p = new ProcessStartInfo
                {
                    Arguments = "--nodeps -o serial",
                    CreateNoWindow = true,
                    FileName = "lsblk",
                    RedirectStandardOutput = true,
                    UseShellExecute = false
                };

                using (var process = Process.Start(p))
                {
                    process.WaitForExit();
                    if (process.ExitCode == 0)
                    {
                        var output = process.StandardOutput.ReadToEnd();
                        serialNumber = output.Split('\n').Skip(1).Where(x => !string.IsNullOrEmpty(x)).First();
                    }
                }

                // remove non-numeric characters so eoserv can handle it
                serialNumber = Regex.Replace(serialNumber, @"\D", string.Empty);

                // make the serial number shorted so eoserv can handle it
                while (ulong.TryParse(serialNumber, out var sn) && sn > uint.MaxValue)
                    serialNumber = serialNumber.Substring(0, serialNumber.Length - 1);

                return serialNumber;
            }
            catch
            {
                // if this fails for ANY reason, just give a dummy value.
                // this isn't important enough to be worth crashing or notifying the user.

                return "12345"; // Just like my luggage
            }
        }
    }
#endif
}

Update linux HD serial number to pull a real value


using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Hosting;
using Newtonsoft.Json;
using System.Net.Http;
using Newtonsoft.Json.Linq;
using GeoIP.Models;
using GeoIP.Executers;

// For more information on enabling Web API for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860

namespace GeoIP.Controllers
{
    [Route("api/[controller]")]
    public class IP2LocationController : Controller
    {
        private readonly IHostingEnvironment hostingEnvironment;

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

        // GET api/ip2location?ipaddress=123.123.123.123
        [HttpGet]
        public string GetGeoLocation([FromQuery]string ipAddress)
        {
            var dataSource = "http://localhost:3000/ip2location";

            var geolocation = new IP2LocationQuery().Query(ipAddress, dataSource);

            return geolocation.Result;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Hosting;
using Newtonsoft.Json;
using System.Net.Http;
using Newtonsoft.Json.Linq;
using GeoIP.Models;
using GeoIP.Executers;

// For more information on enabling Web API for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860

namespace GeoIP.Controllers
{
    [Route("api/[controller]")]
    public class IP2LocationController : Controller
    {
        private readonly IHostingEnvironment hostingEnvironment;

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

        // GET api/ip2location?ipaddress=123.123.123.123
        [HttpGet]
        public string GetGeoLocation([FromQuery]string ipAddress)
        {
            var dataSource = "http://localhost:4000/ip2location";

            var geolocation = new IP2LocationQuery().Query(ipAddress, dataSource);

            return geolocation.Result;
        }
    }
}

Set geoip webservice to port 4000

Set geoip webservice to port 4000


namespace DynamixelServo.Quadruped
{
    public struct Vector3
    {
        public readonly float X;
        public readonly float Y;
        public readonly float Z;

        public Vector3(float x, float y, float z)
        {
            X = x;
            Y = y;
            Z = z;
        }

        public static Vector3 operator +(Vector3 a, Vector3 b)
        {
            return new Vector3(a.X + b.X, a.Y + b.Y, a.Z + b.Z);
        }

        public static Vector3 operator -(Vector3 a, Vector3 b)
        {
            return new Vector3(a.X - b.X, a.Y - b.Y, a.Z - b.Z);
        }

        public override string ToString()
        {
            return $"[{X:f3}; {Y:f3}; {Z:f3}]";
        }
    }
}

namespace DynamixelServo.Quadruped
{
    public struct Vector3
    {
        public readonly float X;
        public readonly float Y;
        public readonly float Z;

        public Vector3(float x, float y, float z)
        {
            X = x;
            Y = y;
            Z = z;
        }

        public static Vector3 operator *(Vector3 vector, float multiplier)
        {
            return new Vector3(vector.X * multiplier, vector.Y * multiplier, vector.Z * multiplier);
        }

        public static Vector3 operator +(Vector3 a, Vector3 b)
        {
            return new Vector3(a.X + b.X, a.Y + b.Y, a.Z + b.Z);
        }

        public static Vector3 operator -(Vector3 a, Vector3 b)
        {
            return new Vector3(a.X - b.X, a.Y - b.Y, a.Z - b.Z);
        }

        public override string ToString()
        {
            return $"[{X:f3}; {Y:f3}; {Z:f3}]";
        }
    }
}

Add vector scaling method to vector3

Add vector scaling method to vector3


using System;
using Table;

public class Hangman {
  public static void Main(string[] args) {
    Console.WriteLine("Hello, World!");
    Console.WriteLine("You entered the following {0} command line arguments:",
         args.Length );
    for (int i=0; i < args.Length; i++) {
      Console.WriteLine("{0}", args[i]);
    }
  }
}

using System;
using Table;

public class Hangman {
  public static void Main(string[] args) {
    Table.Table t = new Table.Table();
    Console.WriteLine("Hello, World!");
    Console.WriteLine("You entered the following {0} command line arguments:",
         args.Length );
    for (int i=0; i < args.Length; i++) {
      Console.WriteLine("{0}", args[i]);
    }
  }
}

Define unused instance of Table

Define unused instance of Table


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

namespace System.Runtime.CompilerServices
{
    // When applied to a type this custom attribute will cause it's cctor to be executed during startup
    // rather being deferred.'order' define the order of execution relative to other cctor's marked with the same attribute.
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = false, AllowMultiple = false)]
    sealed public class EagerOrderedStaticConstructorAttribute : Attribute
    {
        private EagerStaticConstructorOrder _order;
        public EagerOrderedStaticConstructorAttribute(EagerStaticConstructorOrder order)
        {
            _order = order;
        }
        public EagerStaticConstructorOrder Order { get { return _order; } }
    }

    // Defines all the types which require eager cctor execution ,defined order is the order of execution.The enum is
    // grouped by Modules and then by types.

    public enum EagerStaticConstructorOrder : int
    {
        // System.Private.TypeLoader
        RuntimeTypeHandleEqualityComparer,
        TypeLoaderEnvirnoment,
        SystemRuntimeTypeLoaderExports,

        // System.Private.CoreLib
        SystemString,
        SystemPreallocatedOutOfMemoryException,
        SystemEnvironment, // ClassConstructorRunner.Cctor.GetCctor use Lock which inturn use current threadID , so System.Environment
                           // should come before CompilerServicesClassConstructorRunnerCctor
        CompilerServicesClassConstructorRunnerCctor,
        CompilerServicesClassConstructorRunner,

        // Interop
        InteropHeap,
        VtableIUnknown,
        McgModuleManager
    }
}

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

namespace System.Runtime.CompilerServices
{
    // When applied to a type this custom attribute will cause it's cctor to be executed during startup
    // rather being deferred.'order' define the order of execution relative to other cctor's marked with the same attribute.
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = false, AllowMultiple = false)]
    sealed public class EagerOrderedStaticConstructorAttribute : Attribute
    {
        private EagerStaticConstructorOrder _order;
        public EagerOrderedStaticConstructorAttribute(EagerStaticConstructorOrder order)
        {
            _order = order;
        }
        public EagerStaticConstructorOrder Order { get { return _order; } }
    }

    // Defines all the types which require eager cctor execution ,defined order is the order of execution.The enum is
    // grouped by Modules and then by types.

    public enum EagerStaticConstructorOrder : int
    {
        // System.Private.TypeLoader
        RuntimeTypeHandleEqualityComparer,
        TypeLoaderEnvironment,
        SystemRuntimeTypeLoaderExports,

        // System.Private.CoreLib
        SystemString,
        SystemPreallocatedOutOfMemoryException,
        SystemEnvironment, // ClassConstructorRunner.Cctor.GetCctor use Lock which inturn use current threadID , so System.Environment
                           // should come before CompilerServicesClassConstructorRunnerCctor
        CompilerServicesClassConstructorRunnerCctor,
        CompilerServicesClassConstructorRunner,

        // System.Private.Reflection.Execution
        ReflectionExecution,

        // Interop
        InteropHeap,
        VtableIUnknown,
        McgModuleManager
    }
}

Add EagerStaticConstructorOrder.ReflectionExecution, fix the typo EagerStaticConstructorOrder.TypeLoaderEnvirnoment -> TypeLoaderEnvironment

[tfs-changeset: 1550385]


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

using System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.AddObsoleteAttribute;
using Microsoft.CodeAnalysis.CodeFixes;

namespace Microsoft.CodeAnalysis.CSharp.AddObsoleteAttribute
{
    [ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(CSharpAddObsoleteAttributeCodeFixProvider)), Shared]
    internal class CSharpAddObsoleteAttributeCodeFixProvider
        : AbstractAddObsoleteAttributeCodeFixProvider
    {
        public override ImmutableArray<string> FixableDiagnosticIds { get; } =
            ImmutableArray.Create(
                "CS0612", //  'C' is obsolete
                "CS0618", //  'C' is obsolete (msg)
                "CS0672"  // Member 'D.F()' overrides obsolete member 'C.F()'
            );

        public CSharpAddObsoleteAttributeCodeFixProvider()
            : base(CSharpSyntaxFactsService.Instance, CSharpFeaturesResources.Add_Obsolete)
        {
        }
    }
}

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

using System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.AddObsoleteAttribute;
using Microsoft.CodeAnalysis.CodeFixes;

namespace Microsoft.CodeAnalysis.CSharp.AddObsoleteAttribute
{
    [ExportCodeFixProvider(LanguageNames.CSharp, Name = nameof(CSharpAddObsoleteAttributeCodeFixProvider)), Shared]
    internal class CSharpAddObsoleteAttributeCodeFixProvider
        : AbstractAddObsoleteAttributeCodeFixProvider
    {
        public override ImmutableArray<string> FixableDiagnosticIds { get; } =
            ImmutableArray.Create(
                "CS0612", //  'C' is obsolete
                "CS0618", //  'C' is obsolete (msg)
                "CS0672", // Member 'D.F()' overrides obsolete member 'C.F()'
                "CS1062", // The best overloaded Add method 'MyCollection.Add(int)' for the collection initializer element is obsolete. (msg)
                "CS1064"  // The best overloaded Add method 'MyCollection.Add(int)' for the collection initializer element is obsolete"
            );

        public CSharpAddObsoleteAttributeCodeFixProvider()
            : base(CSharpSyntaxFactsService.Instance, CSharpFeaturesResources.Add_Obsolete)
        {
        }
    }
}

Add support for obsolete collection initializers.


using OpenTK;
using OpenTK.Graphics;
using StorybrewCommon.Scripting;
using StorybrewCommon.Storyboarding;
using StorybrewCommon.Storyboarding.Util;
using StorybrewCommon.Mapset;
using StorybrewCommon.Util;
using System;
using System.Collections.Generic;

namespace StorybrewScripts
{
    public class %CLASSNAME% : StoryboardObjectGenerator
    {
        public override void Generate()
        {

        }
    }
}

using OpenTK;
using OpenTK.Graphics;
using StorybrewCommon.Mapset;
using StorybrewCommon.Scripting;
using StorybrewCommon.Storyboarding;
using StorybrewCommon.Storyboarding.Util;
using StorybrewCommon.Subtitles;
using StorybrewCommon.Mapset;
using StorybrewCommon.Util;
using System;
using System.Collections.Generic;

namespace StorybrewScripts
{
    public class %CLASSNAME% : StoryboardObjectGenerator
    {
        public override void Generate()
        {

        }
    }
}

Add more default usings to new scripts.

Add more default usings to new scripts.


using System.Diagnostics;
using Cuemon.Extensions.Xunit;
using Xunit;
using Xunit.Abstractions;

namespace Cuemon.Extensions.Diagnostics
{
    public class FileVersionInfoExtensionsTest : Test
    {
        public FileVersionInfoExtensionsTest(ITestOutputHelper output) : base(output)
        {
        }

        [Fact]
        public void ToProductVersion_ShouldConvertFileVersionInfoToVersionResult()
        {
            var sut1 = FileVersionInfo.GetVersionInfo(typeof(FileVersionInfoExtensions).Assembly.Location);
            var sut2 = sut1.ToProductVersion();

            TestOutput.WriteLine(sut1.ToString());
            TestOutput.WriteLine(sut2.ToString());

            Assert.True(sut2.HasAlphanumericVersion);
            Assert.True(sut2.IsSemanticVersion());
            Assert.Equal(sut2.AlphanumericVersion, sut1.ProductVersion);
            Assert.Equal(sut2.ToString(), sut1.ProductVersion);
        }

        [Fact]
        public void ToFileVersion_ShouldConvertFileVersionInfoToVersionResult()
        {
            var sut1 = FileVersionInfo.GetVersionInfo(typeof(FileVersionInfoExtensions).Assembly.Location);
            var sut2 = sut1.ToFileVersion();

            TestOutput.WriteLine(sut1.ToString());
            TestOutput.WriteLine(sut2.ToString());

            Assert.False(sut2.HasAlphanumericVersion);
            Assert.False(sut2.IsSemanticVersion());
            Assert.NotEqual(sut2.AlphanumericVersion, sut1.FileVersion);
            Assert.Equal(sut2.ToString(), sut1.FileVersion);
        }
    }
}

using System.Diagnostics;
using Cuemon.Extensions.Xunit;
using Xunit;
using Xunit.Abstractions;

namespace Cuemon.Extensions.Diagnostics
{
    public class FileVersionInfoExtensionsTest : Test
    {
        public FileVersionInfoExtensionsTest(ITestOutputHelper output) : base(output)
        {
        }

        [Fact]
        public void ToProductVersion_ShouldConvertFileVersionInfoToVersionResult()
        {
            var sut1 = FileVersionInfo.GetVersionInfo(typeof(FileVersionInfoExtensions).Assembly.Location);
            var sut2 = sut1.ToProductVersion();

            TestOutput.WriteLine(sut1.ToString());
            TestOutput.WriteLine(sut2.ToString());

            Assert.True(sut2.HasAlphanumericVersion);
            Assert.True(sut2.IsSemanticVersion());
            Assert.Equal(sut2.AlphanumericVersion, sut1.ProductVersion);
            Assert.Equal(sut2.ToString(), sut1.ProductVersion);
        }

        [Fact]
        public void ToFileVersion_ShouldConvertFileVersionInfoToVersionResult()
        {
            var sut1 = FileVersionInfo.GetVersionInfo(typeof(FileVersionInfoExtensions).Assembly.Location);
            var sut2 = sut1.ToFileVersion();

            TestOutput.WriteLine(sut1.ToString());
            TestOutput.WriteLine(sut2.ToString());

            Assert.True(sut2.HasAlphanumericVersion);
            Assert.False(sut2.IsSemanticVersion());
            Assert.Equal(sut2.AlphanumericVersion, sut1.FileVersion);
            Assert.Equal(sut2.ToString(), sut1.FileVersion);
        }
    }
}

Fix for changes to default fileversion (00000).


using System;
using System.Threading.Tasks;
using MediatR;
using SFA.DAS.EmployerApprenticeshipsService.Application.Messages;
using SFA.DAS.EmployerApprenticeshipsService.Domain.Data;
using SFA.DAS.Messaging;

namespace SFA.DAS.EmployerApprenticeshipsService.Application.Commands.CreateEmployerAccount
{
    public class CreateAccountCommandHandler : AsyncRequestHandler<CreateAccountCommand>
    {
        private readonly IAccountRepository _accountRepository;
        private readonly IMessagePublisher _messagePublisher;
        private readonly CreateAccountCommandValidator _validator;

        public CreateAccountCommandHandler(IAccountRepository accountRepository, IMessagePublisher messagePublisher)
        {
            if (accountRepository == null)
                throw new ArgumentNullException(nameof(accountRepository));
            if (messagePublisher == null)
                throw new ArgumentNullException(nameof(messagePublisher));
            _accountRepository = accountRepository;
            _messagePublisher = messagePublisher;
            _validator = new CreateAccountCommandValidator();
        }

        protected override async Task HandleCore(CreateAccountCommand message)
        {
            var validationResult = _validator.Validate(message);

            if (!validationResult.IsValid())
                throw new InvalidRequestException(validationResult.ValidationDictionary);

            var accountId = await _accountRepository.CreateAccount(message.UserId, message.CompanyNumber, message.CompanyName, message.EmployerRef);

            await _messagePublisher.PublishAsync(new EmployerRefreshLevyQueueMessage
            {
                AccountId = accountId
            });
        }
    }
}

using System;
using System.Threading.Tasks;
using MediatR;
using SFA.DAS.EmployerApprenticeshipsService.Application.Messages;
using SFA.DAS.EmployerApprenticeshipsService.Domain.Attributes;
using SFA.DAS.EmployerApprenticeshipsService.Domain.Data;
using SFA.DAS.Messaging;

namespace SFA.DAS.EmployerApprenticeshipsService.Application.Commands.CreateEmployerAccount
{
    public class CreateAccountCommandHandler : AsyncRequestHandler<CreateAccountCommand>
    {
        [QueueName]
        private string das_at_eas_get_employer_levy { get; set; }

        private readonly IAccountRepository _accountRepository;
        private readonly IMessagePublisher _messagePublisher;
        private readonly CreateAccountCommandValidator _validator;

        public CreateAccountCommandHandler(IAccountRepository accountRepository, IMessagePublisher messagePublisher)
        {
            if (accountRepository == null)
                throw new ArgumentNullException(nameof(accountRepository));
            if (messagePublisher == null)
                throw new ArgumentNullException(nameof(messagePublisher));
            _accountRepository = accountRepository;
            _messagePublisher = messagePublisher;
            _validator = new CreateAccountCommandValidator();
        }

        protected override async Task HandleCore(CreateAccountCommand message)
        {
            var validationResult = _validator.Validate(message);

            if (!validationResult.IsValid())
                throw new InvalidRequestException(validationResult.ValidationDictionary);

            var accountId = await _accountRepository.CreateAccount(message.UserId, message.CompanyNumber, message.CompanyName, message.EmployerRef);

            await _messagePublisher.PublishAsync(new EmployerRefreshLevyQueueMessage
            {
                AccountId = accountId
            });
        }
    }
}

Add property to use to determine the queue name to be used, and applied QueueName attribute to the property


<?cs if:len(links.alternate) ?>

Download in other formats:

<?cs each:link = links.alternate ?>
  <li<?cs if:name(link) == len(links.alternate) - #1 ?> class="last"<?cs /if ?>>
   <a href="<?cs var:link.href ?>"<?cs if:link.class ?> class="<?cs
    var:link.class ?>"<?cs /if ?>><?cs var:link.title ?>

<?cs /each ?>

<?cs /if ?>

 <img src="<?cs
     var:$htdocs_location ?>trac_logo_mini.png" height="30" width="107"
     alt="Trac Powered"/>

  Powered by Trac <?cs var:trac.version ?>

  By Edgewall Software.

  <?cs var $project.footer ?>

<?cs include "site_footer.cs" ?>

<?cs if:len(links.alternate) ?>

Download in other formats:

<?cs each:link = links.alternate ?>
  <li<?cs if:name(link) == len(links.alternate) - #1 ?> class="last"<?cs /if ?>>
   <a href="<?cs var:link.href ?>"<?cs if:link.class ?> class="<?cs
    var:link.class ?>"<?cs /if ?>><?cs var:link.title ?>

<?cs /each ?>

<?cs /if ?>

 <img src="<?cs
     var:$htdocs_location ?>trac_logo_mini.png" height="30" width="107"
     alt="Trac Powered"/>

  Powered by <a href="<?cs var:trac.href.about ?>">Trac <?cs
var:trac.version ?>

  By Edgewall Software.

  <?cs var $project.footer ?>

<?cs include "site_footer.cs" ?>

Add a link to "about trac" on the trac version number at the end

git-svn-id: f68c6b3b1dcd5d00a2560c384475aaef3bc99487@883 af82e41b-90c4-0310-8c96-b1721e28e2e2


Add a link to "about trac" on the trac version number at the end


using System.Runtime.Serialization;

namespace Omise.Models
{
    public enum OffsiteTypes
    {
        [EnumMember(Value = null)]
        None,
        [EnumMember(Value = "internet_banking_scb")]
        InternetBankingSCB,
        [EnumMember(Value = "internet_banking_bbl")]
        InternetBankingBBL,
        [EnumMember(Value = "internet_banking_ktb")]
        InternetBankingKTB,
        [EnumMember(Value = "internet_banking_bay")]
        InternetBankingBAY,
        [EnumMember(Value = "alipay")]
        AlipayOnline,
        [EnumMember(Value = "installment_bay")]
        InstallmentBAY,
        [EnumMember(Value = "installment_kbank")]
        InstallmentKBank,
        [EnumMember(Value = "bill_payment_tesco_lotus")]
        BillPaymentTescoLotus,
        [EnumMember(Value = "barcode_alipay")]
        BarcodeAlipay
    }
}

using System.Runtime.Serialization;

namespace Omise.Models
{
    public enum OffsiteTypes
    {
        [EnumMember(Value = null)]
        None,
        [EnumMember(Value = "internet_banking_scb")]
        InternetBankingSCB,
        [EnumMember(Value = "internet_banking_bbl")]
        InternetBankingBBL,
        [EnumMember(Value = "internet_banking_ktb")]
        InternetBankingKTB,
        [EnumMember(Value = "internet_banking_bay")]
        InternetBankingBAY,
        [EnumMember(Value = "alipay")]
        AlipayOnline,
        [EnumMember(Value = "installment_bay")]
        InstallmentBAY,
        [EnumMember(Value = "installment_kbank")]
        InstallmentKBank,
        [EnumMember(Value = "bill_payment_tesco_lotus")]
        BillPaymentTescoLotus,
        [EnumMember(Value = "barcode_alipay")]
        BarcodeAlipay,
        [EnumMember(Value = "paynow")]
        Paynow,
        [EnumMember(Value = "points_citi")]
        PointsCiti,
        [EnumMember(Value = "truemoney")]
        TrueMoney
    }
}

Add new payment sources (e.g. paynow etc)


/*
* Programmed by Umut Celenli umut@celenli.com
*/

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

namespace MimeBank
{
    /// <summary>
    /// This is the main class to check the file mime type
    /// Header list is loaded once
    /// </summary>
    public class MimeChecker
    {
        private static List<FileHeader> list { get; set; }
        private List<FileHeader> List
        {
            get
            {
                if (list == null)
                {
                    list = HeaderData.GetList();
                }
                return list;
            }
        }
        private byte[] Buffer;

        public MimeChecker()
        {
            Buffer = new byte[256];
        }

        public FileHeader GetFileHeader(string file)
        {
            if (!System.IO.File.Exists(file))
            {
                throw new Exception("File was not found on path " + file);
            }
            using (var fs = new FileStream(file, FileMode.Open, FileAccess.Read))
            {
                fs.Read(Buffer, 0, 256);
            }
            return this.List.FirstOrDefault(mime => mime.Check(Buffer) == true);
        }
    }
}

/*
* Programmed by Umut Celenli umut@celenli.com
*/

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

namespace MimeBank
{
    /// <summary>
    /// This is the main class to check the file mime type
    /// Header list is loaded once
    /// </summary>
    public class MimeChecker
    {
        private static List<FileHeader> list { get; set; }
        private List<FileHeader> List
        {
            get
            {
                if (list == null)
                {
                    list = HeaderData.GetList();
                }
                return list;
            }
        }
        private byte[] Buffer;

        public MimeChecker()
        {
            Buffer = new byte[256];
        }

        public FileHeader GetFileHeader(string file)
        {
            using (var fs = new FileStream(file, FileMode.Open, FileAccess.Read))
            {
                fs.Read(Buffer, 0, 256);
            }
            return this.List.FirstOrDefault(mime => mime.Check(Buffer) == true);
        }
    }
}

Remove unnecessary check and throw (already throws)


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

using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;

namespace System.ServiceModel.Channels
{
    public partial class ServiceModelHttpMessageHandler : DelegatingHandler
    {
        public DecompressionMethods AutomaticDecompression
        {
            get { return _innerHandler.AutomaticDecompression; }
            set { _innerHandler.AutomaticDecompression = value; }
        }

        public bool PreAuthenticate
        {
            get { return _innerHandler.PreAuthenticate; }
            set { _innerHandler.PreAuthenticate = value; }
        }

        public CookieContainer CookieContainer
        {
            get { return _innerHandler.CookieContainer; }
            set { _innerHandler.CookieContainer = value; }
        }

        protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
        {
            var content = request.Content as MessageContent;
            var responseMessage = await base.SendAsync(request, cancellationToken);
            await content.WriteCompletionTask;
            return responseMessage;
        }
    }
}

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

using System.Net;
using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;

namespace System.ServiceModel.Channels
{
    public partial class ServiceModelHttpMessageHandler : DelegatingHandler
    {
        public DecompressionMethods AutomaticDecompression
        {
            get { return _innerHandler.AutomaticDecompression; }
            set { _innerHandler.AutomaticDecompression = value; }
        }

        public bool PreAuthenticate
        {
            get { return _innerHandler.PreAuthenticate; }
            set { _innerHandler.PreAuthenticate = value; }
        }

        public CookieContainer CookieContainer
        {
            get { return _innerHandler.CookieContainer; }
            set { _innerHandler.CookieContainer = value; }
        }

        protected override async Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
        {
            var content = request.Content as MessageContent;
            var responseMessage = await base.SendAsync(request, cancellationToken);
            if (content != null)
            {
                await content.WriteCompletionTask;
            }

            return responseMessage;
        }
    }
}

Fix null-ref exception when doing get request


namespace TraktApiSharp.Requests.WithoutOAuth.Shows.Episodes
{
    using Enums;
    using Objects.Basic;
    using Objects.Get.Shows.Episodes;
    using System.Collections.Generic;

    internal class TraktEpisodeCommentsRequest : TraktGetByIdEpisodeRequest<TraktPaginationListResult<TraktEpisodeComment>, TraktEpisodeComment>
    {
        internal TraktEpisodeCommentsRequest(TraktClient client) : base(client) { }

        internal TraktCommentSortOrder? Sorting { get; set; }

        protected override IDictionary<string, object> GetUriPathParameters()
        {
            var uriParams = base.GetUriPathParameters();

            if (Sorting.HasValue && Sorting.Value != TraktCommentSortOrder.Unspecified)
                uriParams.Add("sorting", Sorting.Value.AsString());

            return uriParams;
        }

        protected override string UriTemplate => "shows/{id}/seasons/{season}/episodes/{episode}/comments/{sorting}";

        protected override bool SupportsPagination => true;

        protected override bool IsListResult => true;
    }
}

namespace TraktApiSharp.Requests.WithoutOAuth.Shows.Episodes
{
    using Enums;
    using Objects.Basic;
    using Objects.Get.Shows.Episodes;
    using System.Collections.Generic;

    internal class TraktEpisodeCommentsRequest : TraktGetByIdEpisodeRequest<TraktPaginationListResult<TraktEpisodeComment>, TraktEpisodeComment>
    {
        internal TraktEpisodeCommentsRequest(TraktClient client) : base(client) { }

        internal TraktCommentSortOrder? Sorting { get; set; }

        protected override IDictionary<string, object> GetUriPathParameters()
        {
            var uriParams = base.GetUriPathParameters();

            if (Sorting.HasValue && Sorting.Value != TraktCommentSortOrder.Unspecified)
                uriParams.Add("sorting", Sorting.Value.AsString());

            return uriParams;
        }

        protected override string UriTemplate => "shows/{id}/seasons/{season}/episodes/{episode}/comments{/sorting}";

        protected override bool SupportsPagination => true;

        protected override bool IsListResult => true;
    }
}

Fix uri templates in episode requests.

Fix uri templates in episode requests.


using System;
using System.Diagnostics;

namespace Fixie.Behaviors
{
    public class ExecuteCases : InstanceBehavior
    {
        public void Execute(Fixture fixture)
        {
            foreach (var @case in fixture.Cases)
            {
                var result = @case.Execution;

                using (var console = new RedirectedConsole())
                {
                    var stopwatch = new Stopwatch();
                    stopwatch.Start();

                    try
                    {
                        fixture.CaseExecutionBehavior.Execute(@case, fixture.Instance);
                    }
                    catch (Exception exception)
                    {
                        @case.Fail(exception);
                    }

                    stopwatch.Stop();

                    result.Duration = stopwatch.Elapsed;
                    result.Output = console.Output;
                }

                Console.Write(result.Output);
            }
        }
    }
}

using System;
using System.Diagnostics;

namespace Fixie.Behaviors
{
    public class ExecuteCases : InstanceBehavior
    {
        public void Execute(Fixture fixture)
        {
            foreach (var @case in fixture.Cases)
            {
                var execution = @case.Execution;

                using (var console = new RedirectedConsole())
                {
                    var stopwatch = new Stopwatch();
                    stopwatch.Start();

                    try
                    {
                        fixture.CaseExecutionBehavior.Execute(@case, fixture.Instance);
                    }
                    catch (Exception exception)
                    {
                        @case.Fail(exception);
                    }

                    stopwatch.Stop();

                    execution.Duration = stopwatch.Elapsed;
                    execution.Output = console.Output;
                }

                Console.Write(execution.Output);
            }
        }
    }
}

Rename local variable for accuracy.

Rename local variable for accuracy.


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

namespace CertManager.Test.AcmeTests
{
    [TestFixture]
    public class WhenInitializing : WithAcmeClient
    {
        public override async Task BecauseOf()
        {
            await ClassUnderTest.Initialize();
        }

        [Test]
        public void DirectoryShouldBePopulated()
        {
            Assert.That(ClassUnderTest.Directory, Is.Not.Null);
        }

        [Test]
        public void NewRegIsPopulated()
        {
            Assert.That(ClassUnderTest.Directory.NewReg, Is.Not.Null);
        }

        [Test]
        public void NewCertIsPopulated()
        {
            Assert.That(ClassUnderTest.Directory.NewCert, Is.Not.Null);
        }

        [Test]
        public void NewAuthzIsPopulated()
        {
            Assert.That(ClassUnderTest.Directory.NewAuthz, Is.Not.Null);
        }

        [Test]
        public void RecoverRegIsPopulated()
        {
            Assert.That(ClassUnderTest.Directory.RecoverReg, Is.Not.Null);
        }

        [Test]
        public void RevokeCertIsNotNull()
        {
            Assert.That(ClassUnderTest.Directory.RevokeCert, Is.Not.Null);
        }
    }
}

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

namespace CertManager.Test.AcmeTests
{
    [TestFixture]
    public class WhenInitializing : WithAcmeClient
    {
        public override async Task BecauseOf()
        {
            await ClassUnderTest.Initialize();
        }

        [Test]
        public void DirectoryShouldBePopulated()
        {
            Assert.That(ClassUnderTest.Directory, Is.Not.Null);
        }

        [Test]
        public void NewRegIsPopulated()
        {
            Assert.That(ClassUnderTest.Directory.NewReg, Is.Not.Null);
        }

        [Test]
        public void NewCertIsPopulated()
        {
            Assert.That(ClassUnderTest.Directory.NewCert, Is.Not.Null);
        }

        [Test]
        public void NewAuthzIsPopulated()
        {
            Assert.That(ClassUnderTest.Directory.NewAuthz, Is.Not.Null);
        }

        [Test]
        public void RecoverRegIsPopulated()
        {
            Assert.That(ClassUnderTest.Directory.RecoverReg, Is.Not.Null);
        }

        [Test]
        public void RevokeCertIsNotNull()
        {
            Assert.That(ClassUnderTest.Directory.RevokeCert, Is.Not.Null);
        }

        [Test]
        public void InitialNonceIsSet()
        {
            Assert.That(ClassUnderTest.LastNonce, Is.Not.Null);
        }
    }
}

Test that the initial nonce is set.

Test that the initial nonce is set.


using System;
using DrClockwork.Domain.Logic;
using DrClockwork.Domain.Models;
using DrClockwork.Nancy.ViewModels;
using Microsoft.AspNet.SignalR;
using Nancy;
using Nancy.ModelBinding;
using Nancy.Validation;
using Raven.Client;

namespace DrClockwork.Nancy.Modules
{
    public class AskModule : NancyModule
    {
        public AskModule(IDocumentSession documentSession, IHubContext hubContext)
            : base("Ask")
        {
            Get["/"] = _ =>
            {
                try
                {
                    var model = this.Bind<AskViewModel>();

                    var pathToAiml = System.Web.HttpContext.Current.Server.MapPath(@"~/aiml");

                    var drClockwork = new DoctorClockwork(pathToAiml);

                    var answer = drClockwork.AskMeAnything(model.From, model.Content);

                    ClockworkSMS.Send(model.From, answer);

                    var question = new Question
                    {
                        ToPhoneNumber = model.To,
                        FromPhoneNumber = model.From,
                        DateAsked = DateTime.Now,
                        Content = model.Content,
                        MessageId = model.Msg_Id,
                        Keyword = model.Keyword,
                        Answer = answer
                    };

                    documentSession.Store(question);
                    documentSession.SaveChanges();

                    hubContext.Clients.All.broadcastAnswer(model.Content, answer);

                    return null;
                }
                catch (Exception ex)
                {
                    return string.Format("Message: {0}\r\nDetail {1}", ex.Message, ex.StackTrace);
                }

            };
        }
    }
}

using System;
using DrClockwork.Domain.Logic;
using DrClockwork.Domain.Models;
using DrClockwork.Nancy.ViewModels;
using Microsoft.AspNet.SignalR;
using Nancy;
using Nancy.ModelBinding;
using Nancy.Validation;
using Raven.Client;

namespace DrClockwork.Nancy.Modules
{
    public class AskModule : NancyModule
    {
        public AskModule(IDocumentSession documentSession, IHubContext hubContext)
            : base("Ask")
        {
            Post["/"] = _ =>
            {
                try
                {
                    var model = this.Bind<AskViewModel>();

                    var pathToAiml = System.Web.HttpContext.Current.Server.MapPath(@"~/aiml");

                    var drClockwork = new DoctorClockwork(pathToAiml);

                    var answer = drClockwork.AskMeAnything(model.From, model.Content);

                    ClockworkSMS.Send(model.From, answer);

                    var question = new Question
                    {
                        ToPhoneNumber = model.To,
                        FromPhoneNumber = model.From,
                        DateAsked = DateTime.Now,
                        Content = model.Content,
                        MessageId = model.Msg_Id,
                        Keyword = model.Keyword,
                        Answer = answer
                    };

                    documentSession.Store(question);
                    documentSession.SaveChanges();

                    hubContext.Clients.All.broadcastAnswer(model.Content, answer);

                    return null;
                }
                catch (Exception ex)
                {
                    return string.Format("Message: {0}\r\nDetail {1}", ex.Message, ex.StackTrace);
                }

            };
        }
    }
}

Change verb from get to post

Change verb from get to post


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

using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;

namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation
{
    public class SimpleAppDesktopOnlyTest : IClassFixture<SimpleAppDesktopOnlyTest.SimpleAppDesktopOnlyTestFixture>
    {
        public SimpleAppDesktopOnlyTest(SimpleAppDesktopOnlyTestFixture fixture)
        {
            Fixture = fixture;
        }

        public ApplicationTestFixture Fixture { get; }

        [Fact]
        [OSSkipConditionAttribute(OperatingSystems.Linux)]
        [OSSkipConditionAttribute(OperatingSystems.Windows)]
        public async Task Precompilation_WorksForSimpleApps()
        {
            // Arrange
            using (var deployer = Fixture.CreateDeployment(RuntimeFlavor.Clr))
            {
                var deploymentResult = deployer.Deploy();

                // Act
                var response = await Fixture.HttpClient.GetStringWithRetryAsync(
                    deploymentResult.ApplicationBaseUri,
                    Fixture.Logger);

                // Assert
                TestEmbeddedResource.AssertContent("SimpleAppDesktopOnly.Home.Index.txt", response);
            }
        }

        public class SimpleAppDesktopOnlyTestFixture : ApplicationTestFixture
        {
            public SimpleAppDesktopOnlyTestFixture()
                : base("SimpleAppDesktopOnly")
            {
            }
        }
    }
}

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

using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
using Xunit;

namespace Microsoft.AspNetCore.Mvc.Razor.Precompilation
{
    public class SimpleAppDesktopOnlyTest : IClassFixture<SimpleAppDesktopOnlyTest.SimpleAppDesktopOnlyTestFixture>
    {
        public SimpleAppDesktopOnlyTest(SimpleAppDesktopOnlyTestFixture fixture)
        {
            Fixture = fixture;
        }

        public ApplicationTestFixture Fixture { get; }

        [ConditionalFact]
        [OSSkipConditionAttribute(OperatingSystems.Linux)]
        [OSSkipConditionAttribute(OperatingSystems.Windows)]
        public async Task Precompilation_WorksForSimpleApps()
        {
            // Arrange
            using (var deployer = Fixture.CreateDeployment(RuntimeFlavor.Clr))
            {
                var deploymentResult = deployer.Deploy();

                // Act
                var response = await Fixture.HttpClient.GetStringWithRetryAsync(
                    deploymentResult.ApplicationBaseUri,
                    Fixture.Logger);

                // Assert
                TestEmbeddedResource.AssertContent("SimpleAppDesktopOnly.Home.Index.txt", response);
            }
        }

        public class SimpleAppDesktopOnlyTestFixture : ApplicationTestFixture
        {
            public SimpleAppDesktopOnlyTestFixture()
                : base("SimpleAppDesktopOnly")
            {
            }
        }
    }
}

Use ConditionalFact to not run tests on xplat


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

using osu.Framework.Allocation;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Screens.Edit;

namespace osu.Game.Rulesets.Osu.Edit.Blueprints
{
    public abstract class OsuSelectionBlueprint<T> : HitObjectSelectionBlueprint<T>
        where T : OsuHitObject
    {
        [Resolved]
        private EditorClock editorClock { get; set; }

        protected new DrawableOsuHitObject DrawableObject => (DrawableOsuHitObject)base.DrawableObject;

        protected override bool AlwaysShowWhenSelected => true;

        protected override bool ShouldBeAlive => base.ShouldBeAlive || editorClock.CurrentTime - Item.GetEndTime() < HitCircleOverlapMarker.FADE_OUT_EXTENSION;

        protected OsuSelectionBlueprint(T hitObject)
            : base(hitObject)
        {
        }
    }
}

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

using osu.Framework.Allocation;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Screens.Edit;

namespace osu.Game.Rulesets.Osu.Edit.Blueprints
{
    public abstract class OsuSelectionBlueprint<T> : HitObjectSelectionBlueprint<T>
        where T : OsuHitObject
    {
        [Resolved]
        private EditorClock editorClock { get; set; }

        protected new DrawableOsuHitObject DrawableObject => (DrawableOsuHitObject)base.DrawableObject;

        protected override bool AlwaysShowWhenSelected => true;

        protected override bool ShouldBeAlive => base.ShouldBeAlive
                                                 || (editorClock.CurrentTime >= Item.StartTime && editorClock.CurrentTime - Item.GetEndTime() < HitCircleOverlapMarker.FADE_OUT_EXTENSION);

        protected OsuSelectionBlueprint(T hitObject)
            : base(hitObject)
        {
        }
    }
}

Fix incorrect alive criteria causing clicking future objects to be too greedy


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Yio.Utilities;

namespace Yio
{
    public class Program
    {
        private static int _port { get; set; }

        public static void Main(string[] args)
        {
            Console.OutputEncoding = System.Text.Encoding.Unicode;

            StartupUtilities.WriteStartupMessage(StartupUtilities.GetRelease(), ConsoleColor.Cyan);

            if (!File.Exists("appsettings.json")) {
                StartupUtilities.WriteFailure("configuration is missing");
                Environment.Exit(1);
            }

            StartupUtilities.WriteInfo("setting port");
            if(args == null || args.Length == 0)
            {
                _port = 5100;
                StartupUtilities.WriteSuccess("port set to " + _port + " (default)");
            }
            else
            {
                _port = args[0] == null ? 5100 : Int32.Parse(args[0]);
                StartupUtilities.WriteSuccess("port set to " + _port + " (user defined)");
            }

            StartupUtilities.WriteInfo("starting App");
            BuildWebHost(args).Run();

            Console.ResetColor();
        }

        public static IWebHost BuildWebHost(string[] args) =>
            WebHost.CreateDefaultBuilder(args)
                .UseStartup<Startup>()
                .Build();
    }
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using Yio.Utilities;

namespace Yio
{
    public class Program
    {
        private static int _port { get; set; }

        public static void Main(string[] args)
        {
            Console.OutputEncoding = System.Text.Encoding.Unicode;

            StartupUtilities.WriteStartupMessage(StartupUtilities.GetRelease(), ConsoleColor.Cyan);

            if (!File.Exists("appsettings.json")) {
                StartupUtilities.WriteFailure("configuration is missing");
                Environment.Exit(1);
            }

            StartupUtilities.WriteInfo("setting port");
            if(args == null || args.Length == 0)
            {
                _port = 5100;
                StartupUtilities.WriteSuccess("port set to " + _port + " (default)");
            }
            else
            {
                _port = args[0] == null ? 5100 : Int32.Parse(args[0]);
                StartupUtilities.WriteSuccess("port set to " + _port + " (user defined)");
            }

            StartupUtilities.WriteInfo("starting App");
            BuildWebHost(args).Run();

            Console.ResetColor();
        }

        public static IWebHost BuildWebHost(string[] args) =>
            WebHost.CreateDefaultBuilder(args)
                .UseUrls("http://0.0.0.0:" + _port.ToString() + "/")
                .UseStartup<Startup>()
                .Build();
    }
}

Fix server not starting on correct URL

Fix server not starting on correct URL


using System;
using System.Linq;
using FluentAssertions;
using NSaga;
using Xunit;

namespace Tests
{
    public class NamespaceTests
    {
        [Fact]
        public void NSaga_Contains_Only_One_Namespace()
        {
            //Arrange
            var assembly = typeof(ISagaMediator).Assembly;

            // Act
            var namespaces = assembly.GetTypes()
                                     .Where(t => t.IsPublic)
                                     .Select(t => t.Namespace)
                                     .Distinct()
                                     .ToList();

            // Assert
            var names = String.Join(", ", namespaces);
            namespaces.Should().HaveCount(1, $"Should only contain 'NSaga' namespace, but found '{names}'");
        }

        [Fact]
        public void PetaPoco_Stays_Internal()
        {
            //Arrange
            var petapocoTypes = typeof(SqlSagaRepository).Assembly
                                .GetTypes()
                                .Where(t => !String.IsNullOrEmpty(t.Namespace))
                                .Where(t => t.Namespace.StartsWith("PetaPoco", StringComparison.OrdinalIgnoreCase))
                                .Where(t => t.IsPublic)
                                .ToList();

            petapocoTypes.Should().BeEmpty();
        }

        [Fact]
        public void TinyIoc_Stays_Internal()
        {
            typeof(TinyIoCContainer).IsPublic.Should().BeFalse();
        }
    }
}

using System;
using System.Linq;
using FluentAssertions;
using NSaga;
using PetaPoco;
using Xunit;

namespace Tests
{
    public class NamespaceTests
    {
        [Fact]
        public void NSaga_Contains_Only_One_Namespace()
        {
            //Arrange
            var assembly = typeof(ISagaMediator).Assembly;

            // Act
            var namespaces = assembly.GetTypes()
                                     .Where(t => t.IsPublic)
                                     .Select(t => t.Namespace)
                                     .Distinct()
                                     .ToList();

            // Assert
            var names = String.Join(", ", namespaces);
            namespaces.Should().HaveCount(1, $"Should only contain 'NSaga' namespace, but found '{names}'");
        }

        [Fact]
        public void PetaPocoNamespace_Stays_Internal()
        {
            //Arrange
            var petapocoTypes = typeof(SqlSagaRepository).Assembly
                                .GetTypes()
                                .Where(t => !String.IsNullOrEmpty(t.Namespace))
                                .Where(t => t.Namespace.StartsWith("PetaPoco", StringComparison.OrdinalIgnoreCase))
                                .Where(t => t.IsPublic)
                                .ToList();

            petapocoTypes.Should().BeEmpty();
        }

        [Fact]
        public void TinyIoc_Stays_Internal()
        {
            typeof(TinyIoCContainer).IsPublic.Should().BeFalse();
        }

        [Fact]
        public void PetaPoco_Stays_Internal()
        {
            typeof(Database).IsPublic.Should().BeFalse();
        }
    }
}

Test for petapoco to stay internal

Test for petapoco to stay internal


// 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 System.Linq;
using NUnit.Framework;
using osu.Game.Beatmaps.Legacy;
using osu.Game.Rulesets;

namespace osu.Game.Tests.Beatmaps
{
    /// <summary>
    /// Base class for tests of converting <see cref="LegacyMods"/> enumeration flags to ruleset mod instances.
    /// </summary>
    public abstract class LegacyModConversionTest
    {
        /// <summary>
        /// Creates the <see cref="Ruleset"/> whose legacy mod conversion is to be tested.
        /// </summary>
        /// <returns></returns>
        protected abstract Ruleset CreateRuleset();

        protected void TestFromLegacy(LegacyMods legacyMods, Type[] expectedMods)
        {
            var ruleset = CreateRuleset();
            var mods = ruleset.ConvertFromLegacyMods(legacyMods).ToList();
            Assert.AreEqual(expectedMods.Length, mods.Count);

            foreach (var modType in expectedMods)
            {
                Assert.IsNotNull(mods.SingleOrDefault(mod => mod.GetType() == modType));
            }
        }
    }
}

// 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 System.Linq;
using NUnit.Framework;
using osu.Game.Beatmaps.Legacy;
using osu.Game.Rulesets;

namespace osu.Game.Tests.Beatmaps
{
    /// <summary>
    /// Base class for tests of converting <see cref="LegacyMods"/> enumeration flags to ruleset mod instances.
    /// </summary>
    public abstract class LegacyModConversionTest
    {
        /// <summary>
        /// Creates the <see cref="Ruleset"/> whose legacy mod conversion is to be tested.
        /// </summary>
        /// <returns></returns>
        protected abstract Ruleset CreateRuleset();

        protected void TestFromLegacy(LegacyMods legacyMods, Type[] expectedMods)
        {
            var ruleset = CreateRuleset();
            var mods = ruleset.ConvertFromLegacyMods(legacyMods).ToList();
            Assert.AreEqual(expectedMods.Length, mods.Count);

            foreach (var modType in expectedMods)
            {
                Assert.IsNotNull(mods.SingleOrDefault(mod => mod.GetType() == modType));
            }
        }

        protected void TestToLegacy(LegacyMods expectedLegacyMods, Type[] providedModTypes)
        {
            var ruleset = CreateRuleset();
            var modInstances = ruleset.GetAllMods()
                                      .Where(mod => providedModTypes.Contains(mod.GetType()))
                                      .ToArray();
            var actualLegacyMods = ruleset.ConvertToLegacyMods(modInstances);
            Assert.AreEqual(expectedLegacyMods, actualLegacyMods);
        }
    }
}

Add base method for testing conversion in other direction


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

namespace Glimpse.Web
{
    public class FixedRequestAuthorizerProvider : IRequestAuthorizerProvider
    {
        public FixedRequestAuthorizerProvider()
            : this(Enumerable.Empty<IRequestAuthorizer>())
        {
        }

        public FixedRequestAuthorizerProvider(IEnumerable<IRequestAuthorizer> controllerTypes)
        {
            Policies = new List<IRequestAuthorizer>(controllerTypes);
        }

        public IList<IRequestAuthorizer> Policies { get; }

        IEnumerable<IRequestAuthorizer> IRequestAuthorizerProvider.Authorizers => Policies;
    }
}

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

namespace Glimpse.Web
{
    public class FixedRequestAuthorizerProvider : IRequestAuthorizerProvider
    {
        public FixedRequestAuthorizerProvider()
            : this(Enumerable.Empty<IRequestAuthorizer>())
        {
        }

        public FixedRequestAuthorizerProvider(IEnumerable<IRequestAuthorizer> controllerTypes)
        {
            Authorizers = new List<IRequestAuthorizer>(controllerTypes);
        }

        public IList<IRequestAuthorizer> Authorizers { get; }

        IEnumerable<IRequestAuthorizer> IRequestAuthorizerProvider.Authorizers => Authorizers;
    }
}

Update field name change that got missed


using Glimpse.Agent;
using Microsoft.Framework.DependencyInjection;
using Glimpse.Server.Web;
using Microsoft.Framework.OptionsModel;

namespace Glimpse
{
    public class GlimpseServerWebServices
    {
        public static IServiceCollection GetDefaultServices()
        {
            var services = new ServiceCollection();

            //
            // Broker
            //
            services.AddSingleton<IServerBroker, DefaultServerBroker>();

            //
            // Store
            //
            services.AddSingleton<IStorage, InMemoryStorage>();

            //
            // Options
            //
            services.AddTransient<IConfigureOptions<GlimpseServerWebOptions>, GlimpseServerWebOptionsSetup>();
            services.AddTransient<IExtensionProvider<IRequestAuthorizer>, DefaultExtensionProvider<IRequestAuthorizer>>();
            services.AddTransient<IExtensionProvider<IResource>, DefaultExtensionProvider<IResource>>();
            services.AddTransient<IExtensionProvider<IResourceStartup>, DefaultExtensionProvider<IResourceStartup>>();
            services.AddSingleton<IAllowRemoteProvider, DefaultAllowRemoteProvider>();
            services.AddTransient<IResourceManager, ResourceManager>();
            services.AddTransient<IClientBroker, MessageStreamResource>();

            return services;
        }

        public static IServiceCollection GetLocalAgentServices()
        {
            var services = new ServiceCollection();

            //
            // Broker
            //
            services.AddSingleton<IMessagePublisher, InProcessChannel>();

            return services;
        }
    }
}

using Glimpse.Agent;
using Microsoft.Framework.DependencyInjection;
using Glimpse.Server.Web;
using Microsoft.Framework.OptionsModel;

namespace Glimpse
{
    public class GlimpseServerWebServices
    {
        public static IServiceCollection GetDefaultServices()
        {
            var services = new ServiceCollection();

            //
            // Broker
            //
            services.AddSingleton<IServerBroker, DefaultServerBroker>();

            //
            // Store
            //
            services.AddSingleton<IStorage, InMemoryStorage>();

            //
            // Options
            //
            services.AddTransient<IConfigureOptions<GlimpseServerWebOptions>, GlimpseServerWebOptionsSetup>();
            services.AddTransient<IExtensionProvider<IRequestAuthorizer>, DefaultExtensionProvider<IRequestAuthorizer>>();
            services.AddTransient<IExtensionProvider<IResource>, DefaultExtensionProvider<IResource>>();
            services.AddTransient<IExtensionProvider<IResourceStartup>, DefaultExtensionProvider<IResourceStartup>>();
            services.AddSingleton<IAllowRemoteProvider, DefaultAllowRemoteProvider>();
            services.AddTransient<IResourceManager, ResourceManager>();

            return services;
        }

        public static IServiceCollection GetLocalAgentServices()
        {
            var services = new ServiceCollection();

            //
            // Broker
            //
            services.AddSingleton<IMessagePublisher, InProcessChannel>();

            return services;
        }
    }
}

Remove IClientPublisher service as it doesn't exist before


using System;

using NUnit.Framework;
using MonoTorrent.BEncoding;

namespace MonoTorrent.Common
{
    [TestFixture]
    public class TorrentEditorTests
    {
        [Test]
        public void EditingCreatesCopy ()
        {
            var d = Create ("comment", "a");
            var editor = new TorrentEditor (d);
            editor.Comment = "b";
            Assert.AreEqual ("a", d ["comment"].ToString (), "#1");
        }

        [Test]
        public void EditComment ()
        {
            var d = Create ("comment", "a");
            var editor = new TorrentEditor (d);
            editor.Comment = "b";
            d = editor.ToDictionary ();
            Assert.AreEqual ("b", d ["comment"].ToString (), "#1");
        }

        BEncodedDictionary Create (string key, string value)
        {
            var d = new BEncodedDictionary ();
            d.Add (key, (BEncodedString) value);
            return d;
        }
    }
}

using System;

using NUnit.Framework;
using MonoTorrent.BEncoding;

namespace MonoTorrent.Common
{
    [TestFixture]
    public class TorrentEditorTests
    {
        [Test]
        public void EditingCreatesCopy ()
        {
            var d = Create ("comment", "a");
            var editor = new TorrentEditor (d);
            editor.Comment = "b";
            Assert.AreEqual ("a", d ["comment"].ToString (), "#1");
        }

        [Test]
        public void EditComment ()
        {
            var d = Create ("comment", "a");
            var editor = new TorrentEditor (d);
            editor.Comment = "b";
            d = editor.ToDictionary ();
            Assert.AreEqual ("b", d ["comment"].ToString (), "#1");
        }

        [Test]
        [ExpectedException (typeof (InvalidOperationException))]
        public void ReplaceInfoDict ()
        {
            var editor = new TorrentEditor (new BEncodedDictionary ()) { CanEditSecureMetadata = false };
            editor.SetCustom ("info", new BEncodedDictionary ());
        }

        [Test]
        [ExpectedException (typeof (InvalidOperationException))]
        public void EditProtectedProperty_NotAllowed ()
        {
            var editor = new TorrentEditor (new BEncodedDictionary ()) { CanEditSecureMetadata = false };
            editor.PieceLength = 16;
        }

        BEncodedDictionary Create (string key, string value)
        {
            var d = new BEncodedDictionary ();
            d.Add (key, (BEncodedString) value);
            return d;
        }
    }
}

[TorrentEditor] Add more tests to ensure secure properties are kept secure


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace GoldenTicket
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace GoldenTicket
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Registration", action = "Index", id = UrlParameter.Optional }
            );
        }
    }
}

Set default route to Registration Index

Set default route to Registration Index


using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace SO115.ApiGateway.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class PersonaleController : ControllerBase
    {
        /// <summary>
        ///   Controller che si occuperà di gestire tutte le informazioni riguardanti il Personale
        ///   mettendo insieme le informaizoni reperite dalle API Servizi e IdentityManagement e
        ///   restituendole al FrontEnd
        /// </summary>
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using SO115App.ApiGateway.Classi;
using SO115App.ApiGateway.Servizi;

namespace SO115.ApiGateway.Controllers
{
    [Route("api/[controller]")]
    [ApiController]
    public class PersonaleController : ControllerBase
    {
        private readonly PersonaleService prsonaleService;

        /// <summary>
        ///   Controller che si occuperà di gestire tutte le informazioni riguardanti il Personale
        ///   mettendo insieme le informaizoni reperite dalle API Servizi e IdentityManagement e
        ///   restituendole al FrontEnd
        /// </summary>
        public PersonaleController(PersonaleService prsonaleService)
        {
            this.prsonaleService = prsonaleService;
        }

        [HttpGet]
        public async Task<List<SquadreNelTurno>> GetSquadreNelTurno(string codiceSede, string codiceTurno)
        {
            List<SquadreNelTurno> Turno = await prsonaleService.GetSquadreNelTurno(codiceSede, codiceTurno);

            return Turno;
        }

        [HttpGet]
        public async Task<List<SquadreNelTurno>> GetSquadreBySede(string codiceSede)
        {
            List<SquadreNelTurno> Turno = await prsonaleService.GetSquadreBySede(codiceSede);

            return Turno;
        }
    }
}

Add - Aggiunto controller adibito alla gestione dei dati del Personale