using UnityEngine;
using System.Collections;

public class Player : MonoBehaviour {

	// Movement speed, can be set in the editor
	public float speed = 1.0f;

	// Player (camera) rotation
	private Vector3 playerRotation = new Vector3 (35, 0, 0);

	// Player (camera) height
	private float playerHeight = 5.0f;

	void Start () {

		// Setup the player camera
		Camera camera = gameObject.AddComponent<Camera> ();
	}

	void Update () {

		float horizontalMovement = Input.GetAxis ("Horizontal");
		float verticalMovement = Input.GetAxis ("Vertical");
		float rotationMovement = 0.0f;

		// Handle camera rotation
		if (Input.GetKey (KeyCode.Q)) {
			rotationMovement = -1.0f;
		} else if (Input.GetKey (KeyCode.E)) {
			rotationMovement = 1.0f;
		}
		playerRotation.y += rotationMovement * (speed / 2);

		// Handle movement on the terrain
		Vector3 movement = new Vector3 (horizontalMovement, 0.0f, verticalMovement);
		GetComponent<Rigidbody>().velocity = movement * speed;

		// Keep position with a variable height
		transform.position = new Vector3 (transform.position.x, playerHeight, transform.position.z);

		// Set player rotation
		transform.rotation = Quaternion.Euler (playerRotation);

	}
}

using UnityEngine;
using System.Collections;

public class Player : MonoBehaviour {

	// Movement speed, can be set in the editor
	public float speed = 1.0f;

	// Player (camera) rotation
	private Vector3 playerRotation = new Vector3 (35, 0, 0);

	// Player (camera) height
	private float playerHeight = 5.0f;

	void Start () {

		// Setup the player camera
		Camera camera = gameObject.AddComponent<Camera> ();

		// This is probably stupid to do
		gameObject.tag = "MainCamera";
	}

	void Update () {

		float horizontalMovement = Input.GetAxis ("Horizontal");
		float verticalMovement = Input.GetAxis ("Vertical");
		float rotationMovement = 0.0f;

		// Handle camera rotation
		if (Input.GetKey (KeyCode.Q)) {
			rotationMovement = -1.0f;
		} else if (Input.GetKey (KeyCode.E)) {
			rotationMovement = 1.0f;
		}
		playerRotation.y += rotationMovement * (speed / 2);

		// Calculate movement velocity
		Vector3 velocityVertical = transform.forward * speed * verticalMovement;
		Vector3 velocityHorizontal = transform.right * speed * horizontalMovement;

		Vector3 calculatedVelocity = velocityHorizontal + velocityVertical;
		calculatedVelocity.y = 0.0f;

		// Apply calculated velocity
		GetComponent<Rigidbody>().velocity = calculatedVelocity;

		// Keep position with a variable height
		transform.position = new Vector3 (transform.position.x, playerHeight, transform.position.z);

		// Set player rotation
		transform.rotation = Quaternion.Euler (playerRotation);

	}
}

Apply velocity based on rotational value


// 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.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.LanguageServer.Protocol;

namespace Microsoft.CodeAnalysis.LanguageServer.Handler
{
    [Shared]
    [ExportLspMethod(Methods.InitializeName)]
    internal class InitializeHandler : IRequestHandler<InitializeParams, InitializeResult>
    {
        private static readonly InitializeResult s_initializeResult = new InitializeResult
        {
            Capabilities = new ServerCapabilities
            {
                DefinitionProvider = true,
                ImplementationProvider = true,
                CompletionProvider = new CompletionOptions { ResolveProvider = true, TriggerCharacters = new[] { "." } },
                SignatureHelpProvider = new SignatureHelpOptions { TriggerCharacters = new[] { "(", "," } },
                DocumentSymbolProvider = true,
                WorkspaceSymbolProvider = true,
                DocumentFormattingProvider = true,
                DocumentRangeFormattingProvider = true,
                DocumentOnTypeFormattingProvider = new DocumentOnTypeFormattingOptions { FirstTriggerCharacter = "}", MoreTriggerCharacter = new[] { ";", "\n" } },
                DocumentHighlightProvider = true,
            }
        };

        public Task<InitializeResult> HandleRequestAsync(Solution solution, InitializeParams request, ClientCapabilities clientCapabilities, CancellationToken cancellationToken)
            => Task.FromResult(s_initializeResult);
    }
}

// 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.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.VisualStudio.LanguageServer.Protocol;

namespace Microsoft.CodeAnalysis.LanguageServer.Handler
{
    [Shared]
    [ExportLspMethod(Methods.InitializeName)]
    internal class InitializeHandler : IRequestHandler<InitializeParams, InitializeResult>
    {
        private static readonly InitializeResult s_initializeResult = new InitializeResult
        {
            Capabilities = new ServerCapabilities
            {
                DefinitionProvider = true,
                ImplementationProvider = true,
                CompletionProvider = new CompletionOptions { ResolveProvider = true, TriggerCharacters = new[] { ".", " ", "#", "<", ">", "\"", ":", "[", "(", "~" } },
                SignatureHelpProvider = new SignatureHelpOptions { TriggerCharacters = new[] { "(", "," } },
                DocumentSymbolProvider = true,
                WorkspaceSymbolProvider = true,
                DocumentFormattingProvider = true,
                DocumentRangeFormattingProvider = true,
                DocumentOnTypeFormattingProvider = new DocumentOnTypeFormattingOptions { FirstTriggerCharacter = "}", MoreTriggerCharacter = new[] { ";", "\n" } },
                DocumentHighlightProvider = true,
            }
        };

        public Task<InitializeResult> HandleRequestAsync(Solution solution, InitializeParams request, ClientCapabilities clientCapabilities, CancellationToken cancellationToken)
            => Task.FromResult(s_initializeResult);
    }
}

Update completion triggers in LSP to better match local completion.


using System.Linq;
using Xunit;

namespace Bugsnag.Tests
{
  public class BreadcrumbsTests
  {
    [Fact]
    public void RestrictsMaxNumberOfBreadcrumbs()
    {
      var breadcrumbs = new Breadcrumbs(new Configuration { MaximumBreadcrumbs = 25 });

      for (int i = 0; i < 30; i++)
      {
        breadcrumbs.Leave($"{i}");
      }

      Assert.Equal(25, breadcrumbs.Retrieve().Count());
    }

    [Fact]
    public void WhenRetrievingBreadcrumbsCorrectNumberIsReturned()
    {
      var breadcrumbs = new Breadcrumbs(new Configuration { MaximumBreadcrumbs = 25 });

      for (int i = 0; i < 10; i++)
      {
        breadcrumbs.Leave($"{i}");
      }

      Assert.Equal(10, breadcrumbs.Retrieve().Count());
    }

    [Fact]
    public void CorrectBreadcrumbsAreReturned()
    {
      var breadcrumbs = new Breadcrumbs(new Configuration { MaximumBreadcrumbs = 5 });

      for (int i = 0; i < 10; i++)
      {
        breadcrumbs.Leave($"{i}");
      }

      var breadcrumbNames = breadcrumbs.Retrieve().Select(b => b.Name);

      Assert.Equal(new string[] { "5", "6", "7", "8", "9" }, breadcrumbNames);
    }
  }
}

using System.Linq;
using Xunit;

namespace Bugsnag.Tests
{
  public class BreadcrumbsTests
  {
    [Fact]
    public void RestrictsMaxNumberOfBreadcrumbs()
    {
      var breadcrumbs = new Breadcrumbs(new Configuration { MaximumBreadcrumbs = 25 });

      for (int i = 0; i < 30; i++)
      {
        breadcrumbs.Leave($"{i}");
      }

      Assert.Equal(25, breadcrumbs.Retrieve().Count());
    }

    [Fact]
    public void WhenRetrievingBreadcrumbsCorrectNumberIsReturned()
    {
      var breadcrumbs = new Breadcrumbs(new Configuration { MaximumBreadcrumbs = 25 });

      for (int i = 0; i < 10; i++)
      {
        breadcrumbs.Leave($"{i}");
      }

      Assert.Equal(10, breadcrumbs.Retrieve().Count());
    }

    [Fact]
    public void CorrectBreadcrumbsAreReturned()
    {
      var breadcrumbs = new Breadcrumbs(new Configuration { MaximumBreadcrumbs = 5 });

      for (int i = 0; i < 6; i++)
      {
        breadcrumbs.Leave($"{i}");
      }

      var breadcrumbNames = breadcrumbs.Retrieve().Select(b => b.Name);

      Assert.Equal(new string[] { "1", "2", "3", "4", "5" }, breadcrumbNames);
    }
  }
}

Update test to check that breadcrumbs are returned in correct order when MaximumBreadcrumbs is exceeded


using ManagedBass;
using System;
using System.Diagnostics;
using System.Resources;

namespace BrewLib.Audio
{
    public class AudioSample
    {
        private const int MaxSimultaneousPlayBacks = 8;

        private string path;
        public string Path => path;

        private int sample;

        public readonly AudioManager Manager;

        internal AudioSample(AudioManager audioManager, string path, ResourceManager resourceManager)
        {
            Manager = audioManager;
            this.path = path;

            sample = Bass.SampleLoad(path, 0, 0, MaxSimultaneousPlayBacks, BassFlags.Default);
            if (sample == 0)
            {
                Trace.WriteLine($"Failed to load audio sample ({path}): {Bass.LastError}");
                return;
            }
        }

        public void Play(float volume = 1)
        {
            if (sample == 0) return;
            var channel = new AudioChannel(Manager, Bass.SampleGetChannel(sample), true)
            {
                Volume = volume,
            };
            Manager.RegisterChannel(channel);
            channel.Playing = true;
        }

        #region IDisposable Support

        private bool disposedValue = false;
        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                }
                if (sample != 0)
                {
                    Bass.SampleFree(sample);
                    sample = 0;
                }
                disposedValue = true;
            }
        }

        ~AudioSample()
        {
            Dispose(false);
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        #endregion
    }
}

using ManagedBass;
using System;
using System.Diagnostics;
using System.Resources;

namespace BrewLib.Audio
{
    public class AudioSample
    {
        private const int MaxSimultaneousPlayBacks = 8;

        private string path;
        public string Path => path;

        private int sample;

        public readonly AudioManager Manager;

        internal AudioSample(AudioManager audioManager, string path, ResourceManager resourceManager)
        {
            Manager = audioManager;
            this.path = path;

            sample = Bass.SampleLoad(path, 0, 0, MaxSimultaneousPlayBacks, BassFlags.SampleOverrideLongestPlaying);
            if (sample == 0)
            {
                Trace.WriteLine($"Failed to load audio sample ({path}): {Bass.LastError}");
                return;
            }
        }

        public void Play(float volume = 1)
        {
            if (sample == 0) return;
            var channel = new AudioChannel(Manager, Bass.SampleGetChannel(sample), true)
            {
                Volume = volume,
            };
            Manager.RegisterChannel(channel);
            channel.Playing = true;
        }

        #region IDisposable Support

        private bool disposedValue = false;
        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                }
                if (sample != 0)
                {
                    Bass.SampleFree(sample);
                    sample = 0;
                }
                disposedValue = true;
            }
        }

        ~AudioSample()
        {
            Dispose(false);
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        #endregion
    }
}

Use SampleOverrideLongestPlaying for audio samples.


using System.Text;

namespace SnippetsToMarkdown.Commands
{
    class WriteHeaderHtmlCommand : ICommand
    {
        private string directory;

        public WriteHeaderHtmlCommand(string directory)
        {
            this.directory = directory;
        }

        public void WriteToOutput(StringBuilder output)
        {
            output.AppendLine("
" + directory.Substring(directory.LastIndexOf('\\') + 1) + "
");
            output.AppendLine("
");
            output.AppendLine("
");

            output.AppendLine("
");
            output.AppendLine("
");
            output.AppendLine("Shortcut	");
            output.AppendLine("Name	");
            output.AppendLine("
");
            output.AppendLine("
");

            output.AppendLine("
");
        }
    }
}

Change header size in HTML generation.

Change header size in HTML generation.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Extensions.Logging;
using JSNLog.Infrastructure;

namespace JSNLog
{
    internal class JSNlogLogger : IJSNLogLogger
    {
        private ILoggerFactory _loggerFactory;

        public JSNlogLogger(ILoggerFactory loggerFactory)
        {
            _loggerFactory = loggerFactory;
        }

        public void Log(FinalLogData finalLogData)
        {
            ILogger logger = _loggerFactory.CreateLogger(finalLogData.FinalLogger);

            Object message = LogMessageHelpers.DeserializeIfPossible(finalLogData.FinalMessage);

            switch (finalLogData.FinalLevel)
            {
                case Level.TRACE: logger.LogDebug("{logMessage}", message); break;
                case Level.DEBUG: logger.LogVerbose("{logMessage}", message); break;
                case Level.INFO: logger.LogInformation("{logMessage}", message); break;
                case Level.WARN: logger.LogWarning("{logMessage}", message); break;
                case Level.ERROR: logger.LogError("{logMessage}", message); break;
                case Level.FATAL: logger.LogCritical("{logMessage}", message); break;
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Extensions.Logging;
using JSNLog.Infrastructure;

namespace JSNLog
{
    public class JSNlogLogger : IJSNLogLogger
    {
        private ILoggerFactory _loggerFactory;

        public JSNlogLogger(ILoggerFactory loggerFactory)
        {
            _loggerFactory = loggerFactory;
        }

        public void Log(FinalLogData finalLogData)
        {
            ILogger logger = _loggerFactory.CreateLogger(finalLogData.FinalLogger);

            Object message = LogMessageHelpers.DeserializeIfPossible(finalLogData.FinalMessage);

            switch (finalLogData.FinalLevel)
            {
                case Level.TRACE: logger.LogDebug("{logMessage}", message); break;
                case Level.DEBUG: logger.LogVerbose("{logMessage}", message); break;
                case Level.INFO: logger.LogInformation("{logMessage}", message); break;
                case Level.WARN: logger.LogWarning("{logMessage}", message); break;
                case Level.ERROR: logger.LogError("{logMessage}", message); break;
                case Level.FATAL: logger.LogCritical("{logMessage}", message); break;
            }
        }
    }
}

Make JSNLogLogger available to the outside world, so it can actually be used in ASP.NET 5 apps


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

namespace osu.Game.Modes.Objects.Types
{
    /// <summary>
    /// A HitObject that has a distance.
    /// </summary>
    public interface IHasDistance : IHasEndTime
    {
        /// <summary>
        /// The distance of the HitObject.
        /// </summary>
        double Distance { get; }
    }
}

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

namespace osu.Game.Modes.Objects.Types
{
    /// <summary>
    /// A HitObject that has a positional length.
    /// </summary>
    public interface IHasDistance : IHasEndTime
    {
        /// <summary>
        /// The positional length of the HitObject.
        /// </summary>
        double Distance { get; }
    }
}

Fix up distance -> positional length comments.


namespace Nvelope
{
    public enum Month
    {
        January = 1,
        February = 2,
        March = 3,
        April = 4,
        May = 5,
        June = 6,
        July = 7,
        August = 8,
        September = 9,
        October = 10,
        November = 11,
        December = 12
    }
}

//-----------------------------------------------------------------------
// <copyright file="Month.cs" company="TWU">
// MIT Licenced
// </copyright>
//-----------------------------------------------------------------------

namespace Nvelope
{
    using System.Diagnostics.CodeAnalysis;

    /// <summary>
    /// Represents a month of the year
    /// </summary>
    [SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue",
        Justification = "There's no such thing as a 'default' or 'none' month.")]
    public enum Month
    {
        /* These doc comments are stupid, but it keeps FxCop from getting made
         * and it by looking at Microsoft's docs it seems to be in line with
         * their practices */

        /// <summary>
        /// Indicates January
        /// </summary>
        January = 1,

        /// <summary>
        /// Indicates February
        /// </summary>
        February = 2,

        /// <summary>
        /// Indicates January
        /// </summary>
        March = 3,

        /// <summary>
        /// Indicates April
        /// </summary>
        April = 4,

        /// <summary>
        /// Indicates January
        /// </summary>
        May = 5,

        /// <summary>
        /// Indicates June
        /// </summary>
        June = 6,

        /// <summary>
        /// Indicates July
        /// </summary>
        July = 7,

        /// <summary>
        /// Indicates August
        /// </summary>
        August = 8,

        /// <summary>
        /// Indicates September
        /// </summary>
        September = 9,

        /// <summary>
        /// Indicates October
        /// </summary>
        October = 10,

        /// <summary>
        /// Indicates November
        /// </summary>
        November = 11,

        /// <summary>
        /// Indicates December
        /// </summary>
        December = 12
    }
}

Document and suppress an FxCop warning

Document and suppress an FxCop warning


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

namespace Microsoft.Azure.Devices.Client
{
    public enum AuthenticationScheme
    {
        // Shared Access Signature
        SAS = 0,
        // X509 Certificate
        X509 = 1
    }
}

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

namespace Microsoft.Azure.Devices.Client
{
    /// <summary>
    /// Specifies the Authentication Scheme used by Device Client
    /// </summary>
    public enum S
    {
        // Shared Access Signature
        SAS = 0,
        // X509 Certificate
        X509 = 1
    }
}

Add XML description for Authentication Scheme


using UnityEngine;
using System.Collections;

public class Player : MonoBehaviour {
	public float baseFireCooldown;
	public float baseRotationSpeed;
	public God god;
//	public Weapon weapon;
	public Vector2 direction; // Maybe this should be private?
	public Vector2 targetDirection; // This too.

	// Temporary
	public GameObject tempProjectile;

	private float cooldownTimeStamp;

	// Use this for initialization
	void Start () {

	}

	public void Move(float horizontal, float vertical) {
		targetDirection = new Vector2 (horizontal, vertical);
	}

	public void Fire () {
		// Don't fire when the cooldown is still active.
		if (this.cooldownTimeStamp >= Time.time) {
			return;
		}

		// Fire the weapon.
		// TODO
		Moveable arrowMoveable = Instantiate(tempProjectile).GetComponent<Moveable> ();
		arrowMoveable.direction = this.direction;

		// Set the cooldown.
		this.cooldownTimeStamp = Time.time + this.baseFireCooldown;
	}

	// Update is called once per frame
	void Update () {
		float angle = Vector2.Angle (direction, targetDirection);
		this.transform.Rotate (targetDirection.x, angle * baseRotationSpeed * Time.deltaTime);
		this.direction = new Vector2 (this.transform.TransformDirection.x, this.transform.TransformDirection.y);
	}
}

using UnityEngine;
using System.Collections;

public class Player : MonoBehaviour {
	public int playerID;

	public float baseFireCooldown;
	public float baseRotationSpeed;
	public God god;
//	public Weapon weapon;
	public Vector2 direction; // Maybe this should be private?
	public Vector2 targetDirection; // This too.

	// Temporary
	public GameObject tempProjectile;

	private float cooldownTimeStamp;

	// Use this for initialization
	void Start () {

	}

	public void Move(float horizontal, float vertical) {
		targetDirection = new Vector2 (horizontal, vertical);
	}

	public void Fire () {
		// Don't fire when the cooldown is still active.
		if (this.cooldownTimeStamp >= Time.time) {
			return;
		}

		// Fire the weapon.
		// TODO
		Moveable arrowMoveable = Instantiate(tempProjectile).GetComponent<Moveable> ();
		arrowMoveable.direction = this.direction;

		// Set the cooldown.
		this.cooldownTimeStamp = Time.time + this.baseFireCooldown;
	}

	// Update is called once per frame
	void Update () {
		float angle = Vector2.Angle (direction, targetDirection);

//		this.transform.Rotate (targetDirection.x, angle * baseRotationSpeed * Time.deltaTime);
		this.direction = new Vector2 (this.transform.TransformDirection.x , this.transform.TransformDirection.y);
	}
}

Add playerID and revisit the moving.

Add playerID and revisit the moving.


using System.Diagnostics;
using System.Windows.Controls;
using System.Windows.Input;

using Junctionizer.Model;

namespace Junctionizer.UI.Styles
{
    public partial class DataGridStyles
    {
        private void DataGridRow_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (e.ChangedButton != MouseButton.Left) return;

            var dataGridRow = sender as DataGridRow;

            if (dataGridRow?.Item is GameFolder folder)
            {
                OpenInFileExplorer(folder);
            }
            else if (dataGridRow?.Item is GameFolderPair pair)
            {
                if (pair.SourceEntry?.IsJunction == false) OpenInFileExplorer(pair.SourceEntry);
                if (pair.DestinationEntry?.IsJunction == false) OpenInFileExplorer(pair.DestinationEntry);
            }
        }

        private static void OpenInFileExplorer(GameFolder folder)
        {
            var path = folder.DirectoryInfo.FullName;
            ErrorHandling.ThrowIfDirectoryNotFound(path);
            Process.Start(path);
        }
    }
}

using System.Diagnostics;
using System.Windows.Controls;
using System.Windows.Input;

using Junctionizer.Model;

namespace Junctionizer.UI.Styles
{
    public partial class DataGridStyles
    {
        private void DataGridRow_OnMouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            if (e.ChangedButton != MouseButton.Left) return;

            var dataGridRow = sender as DataGridRow;

            if (dataGridRow?.Item is GameFolder folder)
            {
                OpenInFileExplorer(folder);
            }
            else if (dataGridRow?.Item is GameFolderPair pair)
            {
                if (pair.DestinationEntry == null || pair.SourceEntry?.IsJunction == false) OpenInFileExplorer(pair.SourceEntry);
                if (pair.DestinationEntry != null) OpenInFileExplorer(pair.DestinationEntry);
            }
        }

        private static void OpenInFileExplorer(GameFolder folder)
        {
            var path = folder.DirectoryInfo.FullName;
            ErrorHandling.ThrowIfDirectoryNotFound(path);
            Process.Start(path);
        }
    }
}

Allow double click to open on junctions when lacking a destination


//------------------------------------------------------------------------------
// <copyright file="StackAnalysisToolWindow.cs" company="Microsoft">
//     Copyright (c) Microsoft.  All rights reserved.
// </copyright>
//------------------------------------------------------------------------------

namespace StackUsageAnalyzer
{
    using System;
    using System.Runtime.InteropServices;
    using Microsoft.VisualStudio.Shell;

    /// <summary>
    /// This class implements the tool window exposed by this package and hosts a user control.
    /// </summary>
    /// <remarks>
    /// In Visual Studio tool windows are composed of a frame (implemented by the shell) and a pane,
    /// usually implemented by the package implementer.
    /// <para>
    /// This class derives from the ToolWindowPane class provided from the MPF in order to use its
    /// implementation of the IVsUIElementPane interface.
    /// </para>
    /// </remarks>
    [Guid("ffbd67c0-1100-4fa5-8c20-cc10264c540b")]
    public class StackAnalysisToolWindow : ToolWindowPane
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="StackAnalysisToolWindow"/> class.
        /// </summary>
        public StackAnalysisToolWindow() : base(null)
        {
            this.Caption = "StackAnalysisToolWindow";

            // This is the user control hosted by the tool window; Note that, even if this class implements IDisposable,
            // we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on
            // the object returned by the Content property.
            this.Content = new StackAnalysisToolWindowControl();
        }
    }
}

//------------------------------------------------------------------------------
// <copyright file="StackAnalysisToolWindow.cs" company="Microsoft">
//     Copyright (c) Microsoft.  All rights reserved.
// </copyright>
//------------------------------------------------------------------------------

namespace StackUsageAnalyzer
{
    using System;
    using System.Runtime.InteropServices;
    using Microsoft.VisualStudio.Shell;

    /// <summary>
    /// This class implements the tool window exposed by this package and hosts a user control.
    /// </summary>
    /// <remarks>
    /// In Visual Studio tool windows are composed of a frame (implemented by the shell) and a pane,
    /// usually implemented by the package implementer.
    /// <para>
    /// This class derives from the ToolWindowPane class provided from the MPF in order to use its
    /// implementation of the IVsUIElementPane interface.
    /// </para>
    /// </remarks>
    [Guid("ffbd67c0-1100-4fa5-8c20-cc10264c540b")]
    public class StackAnalysisToolWindow : ToolWindowPane
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="StackAnalysisToolWindow"/> class.
        /// </summary>
        public StackAnalysisToolWindow() : base(null)
        {
            this.Caption = "Function Stack Analysis";

            // This is the user control hosted by the tool window; Note that, even if this class implements IDisposable,
            // we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on
            // the object returned by the Content property.
            this.Content = new StackAnalysisToolWindowControl();
        }
    }
}

Change caption of Tool Window

Change caption of Tool Window


using NLog;

namespace Wox.Infrastructure.Logger
{
    public class Log
    {
        private static NLog.Logger logger = LogManager.GetCurrentClassLogger();

        public static void Error(System.Exception e)
        {
#if DEBUG
            throw e;
#else
            while (e.InnerException != null)
            {
                logger.Error(e.Message);
                logger.Error(e.StackTrace);
                e = e.InnerException;
            }
#endif
        }

        public static void Debug(string msg)
        {
            System.Diagnostics.Debug.WriteLine($"DEBUG: {msg}");
            logger.Debug(msg);
        }

        public static void Info(string msg)
        {
            System.Diagnostics.Debug.WriteLine($"INFO: {msg}");
            logger.Info(msg);
        }

        public static void Warn(string msg)
        {
            System.Diagnostics.Debug.WriteLine($"WARN: {msg}");
            logger.Warn(msg);
        }

        public static void Fatal(System.Exception e)
        {
#if DEBUG
            throw e;
#else
            logger.Fatal(ExceptionFormatter.FormatExcpetion(e));
#endif
        }
    }
}

using NLog;
using Wox.Infrastructure.Exception;

namespace Wox.Infrastructure.Logger
{
    public class Log
    {
        private static NLog.Logger logger = LogManager.GetCurrentClassLogger();

        public static void Error(System.Exception e)
        {
#if DEBUG
            throw e;
#else
            while (e.InnerException != null)
            {
                logger.Error(e.Message);
                logger.Error(e.StackTrace);
                e = e.InnerException;
            }
#endif
        }

        public static void Debug(string msg)
        {
            System.Diagnostics.Debug.WriteLine($"DEBUG: {msg}");
            logger.Debug(msg);
        }

        public static void Info(string msg)
        {
            System.Diagnostics.Debug.WriteLine($"INFO: {msg}");
            logger.Info(msg);
        }

        public static void Warn(string msg)
        {
            System.Diagnostics.Debug.WriteLine($"WARN: {msg}");
            logger.Warn(msg);
        }

        public static void Fatal(System.Exception e)
        {
#if DEBUG
            throw e;
#else
            logger.Fatal(ExceptionFormatter.FormatExcpetion(e));
#endif
        }
    }
}

Fix using for Release build

Fix using for Release build


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

using System;
using System.IO;

namespace SmugMugCodeGen
{
    public class Options
    {
        public string OutputDir { get; private set; }
        public string OutputDirEnums { get; private set; }
        public string[] InputFiles { get; private set; }

        public Options(string[] args)
        {
            OutputDir = args[0];
            OutputDirEnums = Path.Combine(OutputDir, "Enums");

            // Copy the input files from the args array.
            InputFiles = new string[args.Length - 1];
            Array.Copy(args, 1, InputFiles, 0, args.Length - 1);
        }
    }
}

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

using System;
using System.IO;

namespace SmugMugCodeGen
{
    public class Options
    {
        public string OutputDir { get; private set; }
        public string OutputDirEnums { get; private set; }
        public string[] InputFiles { get; private set; }

        public Options(string[] args)
        {
            OutputDir = args[0];
            OutputDirEnums = Path.Combine(OutputDir, @"\..\Enums");

            // Copy the input files from the args array.
            InputFiles = new string[args.Length - 1];
            Array.Copy(args, 1, InputFiles, 0, args.Length - 1);
        }
    }
}

Change the location of where the Enums are generated to be at the same level as the types.


using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace Samples.AspNetCore
{
    public class Startup
    {
        public Startup(IConfiguration configuration, IHostingEnvironment env)
        {
            Configuration = configuration;
            HostingEnvironment = env;
        }

        public IConfiguration Configuration { get; }
        public IHostingEnvironment HostingEnvironment { get; }

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc();
            // Make IOptions<ExceptionalSettings> available for injection everywhere
            services.AddExceptional(Configuration.GetSection("Exceptional"), settings =>
            {
                //settings.ApplicationName = "Samples.AspNetCore";
                settings.UseExceptionalPageOnThrow = HostingEnvironment.IsDevelopment();
            });
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app)
        {
            // Boilerplate we're no longer using with Exceptional
            //if (env.IsDevelopment())
            //{
            //    app.UseDeveloperExceptionPage();
            //    app.UseBrowserLink();
            //}
            //else
            //{
            //    app.UseExceptionHandler("/Home/Error");
            //}
            app.UseExceptional();
            app.UseStaticFiles();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }
    }
}

using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace Samples.AspNetCore
{
    public class Startup
    {
        public Startup(IConfiguration configuration, IHostingEnvironment env)
        {
            Configuration = configuration;
            HostingEnvironment = env;
        }

        public IConfiguration Configuration { get; }
        public IHostingEnvironment HostingEnvironment { get; }

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc();
            // Make IOptions<ExceptionalSettings> available for injection everywhere
            services.AddExceptional(Configuration.GetSection("Exceptional"), settings =>
            {
                //settings.DefaultStore.ApplicationName = "Samples.AspNetCore";
                settings.UseExceptionalPageOnThrow = HostingEnvironment.IsDevelopment();
            });
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app)
        {
            // Boilerplate we're no longer using with Exceptional
            //if (env.IsDevelopment())
            //{
            //    app.UseDeveloperExceptionPage();
            //    app.UseBrowserLink();
            //}
            //else
            //{
            //    app.UseExceptionHandler("/Home/Error");
            //}
            app.UseExceptional();
            app.UseStaticFiles();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }
    }
}

Update ASP.NET Core sample code to match actual


using System;
using System.Collections;
using UnityEngine;
using System.Threading;
using UnityEngine.Networking;

namespace GLTF {

    class GLTFComponent : MonoBehaviour
    {
        public string Url;
	    public Shader Shader;
	    public bool Multithreaded = true;

        IEnumerator Start()
        {
            var loader = new GLTFLoader(Url, Shader, gameObject.transform);
	        loader.Multithreaded = Multithreaded;
            yield return loader.Load();
            IntegrationTest.Pass();
        }
    }
}

using System;
using System.Collections;
using UnityEngine;
using System.Threading;
using UnityEngine.Networking;

namespace GLTF {

    class GLTFComponent : MonoBehaviour
    {
        public string Url;
	    public Shader Shader;
	    public bool Multithreaded = true;

        IEnumerator Start()
        {
            var loader = new GLTFLoader(Url, Shader, gameObject.transform);
	        loader.Multithreaded = Multithreaded;
            yield return loader.Load();
        }
    }
}

Remove stray integration test call.

Remove stray integration test call.


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

using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Session;

namespace Microsoft.Extensions.DependencyInjection
{
    /// <summary>
    /// Extension methods for adding session services to the DI container.
    /// </summary>
    public static class SessionServiceCollectionExtensions
    {
        /// <summary>
        /// Adds services required for application session state.
        /// </summary>
        /// <param name="services">The <see cref="IServiceCollection"/> to add the services to.</param>
        public static void AddSession(this IServiceCollection services)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }

            services.AddTransient<ISessionStore, DistributedSessionStore>();
        }

        /// <summary>
        /// Adds services required for application session state.
        /// </summary>
        /// <param name="services">The <see cref="IServiceCollection"/> to add the services to.</param>
        /// <param name="configure">The session options to configure the middleware with.</param>
        public static void AddSession(this IServiceCollection services, Action<SessionOptions> configure)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }

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

            services.Configure(configure);
            services.AddSession();
        }
    }
}

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

using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Session;

namespace Microsoft.Extensions.DependencyInjection
{
    /// <summary>
    /// Extension methods for adding session services to the DI container.
    /// </summary>
    public static class SessionServiceCollectionExtensions
    {
        /// <summary>
        /// Adds services required for application session state.
        /// </summary>
        /// <param name="services">The <see cref="IServiceCollection"/> to add the services to.</param>
        /// <returns>The <see cref="IServiceCollection"/> so that additional calls can be chained.</returns>
        public static IServiceCollection AddSession(this IServiceCollection services)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }

            services.AddTransient<ISessionStore, DistributedSessionStore>();
            return services;
        }

        /// <summary>
        /// Adds services required for application session state.
        /// </summary>
        /// <param name="services">The <see cref="IServiceCollection"/> to add the services to.</param>
        /// <param name="configure">The session options to configure the middleware with.</param>
        /// <returns>The <see cref="IServiceCollection"/> so that additional calls can be chained.</returns>
        public static IServiceCollection AddSession(this IServiceCollection services, Action<SessionOptions> configure)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }

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

            services.Configure(configure);
            services.AddSession();

            return services;
        }
    }
}

Return IServiceCollection from AddSession extension methods


// 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.

namespace osu.Game.Online.Chat
{
    public enum ChannelType
    {
        Public,
        Private,
        Multiplayer,
        Spectator,
        Temporary,
        PM,
        Group,
        System,
    }
}

// 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.

namespace osu.Game.Online.Chat
{
    public enum ChannelType
    {
        Public,
        Private,
        Multiplayer,
        Spectator,
        Temporary,
        PM,
        Group,
        System,
        Announce,
    }
}

Add missing "announce" channel type

Add missing "announce" channel type

Of note, this doesn't mean the channels will display, but it does fix
parsing errors which cause the whole chat display to fail.


using System;
using Microsoft.Extensions.Logging;

namespace Gibraltar.Agent
{
    /// <summary>
    /// This enumerates the severity levels used by Loupe log messages.
    /// </summary>
    /// <remarks>The values for these levels are chosen to directly map to the TraceEventType enum
    /// for the five levels we support.  These also can be mapped from Log4Net event levels,
    /// with slight name changes for Fatal->Critical and for Debug->Verbose.</remarks>
    [Flags]
    public enum LogMessageSeverity
    {
        /// <summary>
        /// The severity level is uninitialized and thus unknown.
        /// </summary>
        None = 0,  // FxCop demands we have a defined 0.

        /// <summary>
        /// Fatal error or application crash.
        /// </summary>
        Critical = LogLevel.Critical,

        /// <summary>
        /// Recoverable error.
        /// </summary>
        Error = LogLevel.Error,

        /// <summary>
        /// Noncritical problem.
        /// </summary>
        Warning = LogLevel.Warning,

        /// <summary>
        /// Informational message.
        /// </summary>
        Information = LogLevel.Information,

        /// <summary>
        /// Debugging trace.
        /// </summary>
        Verbose = LogLevel.Debug,
    }
}

using System;
using Microsoft.Extensions.Logging;

namespace Gibraltar.Agent
{
    /// <summary>
    /// This enumerates the severity levels used by Loupe log messages.
    /// </summary>
    /// <remarks>The values for these levels are chosen to directly map to the TraceEventType enum
    /// for the five levels we support.  These also can be mapped from Log4Net event levels,
    /// with slight name changes for Fatal->Critical and for Debug->Verbose.</remarks>
    [Flags]
    public enum LogMessageSeverity
    {
        /// <summary>
        /// The severity level is uninitialized and thus unknown.
        /// </summary>
        None = 0,  // FxCop demands we have a defined 0.

        /// <summary>
        /// Fatal error or application crash.
        /// </summary>
        Critical = Loupe.Extensibility.Data.LogMessageSeverity.Critical,

        /// <summary>
        /// Recoverable error.
        /// </summary>
        Error = Loupe.Extensibility.Data.LogMessageSeverity.Error,

        /// <summary>
        /// Noncritical problem.
        /// </summary>
        Warning = Loupe.Extensibility.Data.LogMessageSeverity.Warning,

        /// <summary>
        /// Informational message.
        /// </summary>
        Information = Loupe.Extensibility.Data.LogMessageSeverity.Information,

        /// <summary>
        /// Debugging trace.
        /// </summary>
        Verbose = Loupe.Extensibility.Data.LogMessageSeverity.Verbose,
    }
}

Correct second copy of severity mappings to be compatible with Loupe.


// 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();
            }
        }
    }
}

// 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);
        }

        [Test]
        public void TestUsingLocalScheduler()
        {
            AddStep("add box", () => Child = box = new AsyncPerformingBox());
            AddAssert("scheduler null", () => box.Scheduler == null);
            AddStep("trigger", () => box.Trigger());
            AddUntilStep("scheduler non-null", () => box.Scheduler != null);
        }

        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();
            }
        }
    }
}

Add test of scheduler usage

Add test of scheduler usage


using System;

namespace Eluant
{
    public static class LuaValueExtensions
    {
        public static bool IsNil(this LuaValue self)
        {
            return self == null || self == LuaNil.Instance;
        }
    }
}

using System;
using System.Collections.Generic;

namespace Eluant
{
    public static class LuaValueExtensions
    {
        public static bool IsNil(this LuaValue self)
        {
            return self == null || self == LuaNil.Instance;
        }

        public static IEnumerable<LuaValue> EnumerateArray(this LuaTable self)
        {
            if (self == null) { throw new ArgumentNullException("self"); }

            return CreateEnumerateArrayEnumerable(self);
        }

        private static IEnumerable<LuaValue> CreateEnumerateArrayEnumerable(LuaTable self)
        {
            // By convention, the 'n' field refers to the array length, if present.
            using (var n = self["n"]) {
                var num = n as LuaNumber;
                if (num != null) {
                    var length = (int)num.Value;

                    for (int i = 1; i <= length; ++i) {
                        yield return self[i];
                    }

                    yield break;
                }
            }

            // If no 'n' then stop at the first nil element.
            for (int i = 1; ; ++i) {
                var value = self[i];
                if (value.IsNil()) {
                    yield break;
                }

                yield return value;
            }
        }
    }
}

Add EnumerateArray() extension for tables


using Mapsui.Fetcher;
using Mapsui.Geometries;
using Mapsui.Providers;
using System.Collections.Generic;
using System.Threading.Tasks;
using Mapsui.Styles;

namespace Mapsui.Layers
{
    public  class MemoryLayer : BaseLayer
    {
        public IProvider DataSource { get; set; }

        public override IEnumerable<IFeature> GetFeaturesInView(BoundingBox box, double resolution)
        {
            var biggerBox = box.Grow(SymbolStyle.DefaultWidth * 2 * resolution, SymbolStyle.DefaultHeight * 2 * resolution);
            return DataSource.GetFeaturesInView(biggerBox, resolution);
        }

        public override BoundingBox Envelope => DataSource?.GetExtents();

        public override void AbortFetch()
        {
            // do nothing. This is not an async layer
        }

        public override void ViewChanged(bool majorChange, BoundingBox extent, double resolution)
        {
            //The MemoryLayer always has it's data ready so can fire a DataChanged event immediately so that listeners can act on it.
            Task.Run(() => OnDataChanged(new DataChangedEventArgs()));
        }

        public override void ClearCache()
        {
            // do nothing. This is not an async layer
        }
    }
}

using Mapsui.Fetcher;
using Mapsui.Geometries;
using Mapsui.Providers;
using System.Collections.Generic;
using System.Threading.Tasks;
using Mapsui.Styles;

namespace Mapsui.Layers
{
    public  class MemoryLayer : BaseLayer
    {
        public IProvider DataSource { get; set; }

        public override IEnumerable<IFeature> GetFeaturesInView(BoundingBox box, double resolution)
        {
            // Safeguard in case BoundingBox is null, most likely due to no features in layer
            if (box == null) { return new List<IFeature>(); }

            var biggerBox = box.Grow(SymbolStyle.DefaultWidth * 2 * resolution, SymbolStyle.DefaultHeight * 2 * resolution);
            return DataSource.GetFeaturesInView(biggerBox, resolution);
        }

        public override BoundingBox Envelope => DataSource?.GetExtents();

        public override void AbortFetch()
        {
            // do nothing. This is not an async layer
        }

        public override void ViewChanged(bool majorChange, BoundingBox extent, double resolution)
        {
            //The MemoryLayer always has it's data ready so can fire a DataChanged event immediately so that listeners can act on it.
            Task.Run(() => OnDataChanged(new DataChangedEventArgs()));
        }

        public override void ClearCache()
        {
            // do nothing. This is not an async layer
        }
    }
}

Fix NullException ocurring in GetFeaturesInView() when BoundingBox is null

This can happen if no features have been added to a layer, since MemoryProvider.GetExtents() will not find any feature to create a BoundingBox, and return null.


using Advanced_Combat_Tracker;
using CefSharp;
using CefSharp.Wpf;
using System;
using System.Windows.Forms;

namespace Cactbot
{
    public class ACTPlugin : IActPluginV1
    {
        SettingsTab settingsTab = new SettingsTab();
        BrowserWindow browserWindow;

        #region IActPluginV1 Members
        public void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText)
        {
            settingsTab.Initialize(pluginStatusText);

            browserWindow = new BrowserWindow();
            browserWindow.ShowInTaskbar = false;
            browserWindow.BrowserControl.CreationHandlers += OnBrowserCreated;
            browserWindow.Show();

            pluginScreenSpace.Controls.Add(settingsTab);
        }

        public void DeInitPlugin()
        {
            browserWindow.Hide();
            settingsTab.Shutdown();

            // FIXME: This needs to be called from the right thread, so it can't happen automatically.
            // However, calling it here means the plugin can never be reinitialized, oops.
            Cef.Shutdown();
        }
        #endregion

        private void OnBrowserCreated(object sender, IWpfWebBrowser browser)
        {
            browser.RegisterJsObject("act", new BrowserBindings());
            // FIXME: Make it possible to create more than one window.
            // Tie loading html to the browser window creation and bindings to the
            // browser creation.
            browser.Load(settingsTab.HTMLFile());
            browser.ShowDevTools();
        }
    }
}

using Advanced_Combat_Tracker;
using CefSharp;
using CefSharp.Wpf;
using System;
using System.Windows.Forms;

namespace Cactbot
{
    public class ACTPlugin : IActPluginV1
    {
        SettingsTab settingsTab = new SettingsTab();
        BrowserWindow browserWindow;

        #region IActPluginV1 Members
        public void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText)
        {
            settingsTab.Initialize(pluginStatusText);

            browserWindow = new BrowserWindow();
            browserWindow.ShowInTaskbar = false;
            browserWindow.BrowserControl.CreationHandlers += OnBrowserCreated;
            browserWindow.Show();

            pluginScreenSpace.Controls.Add(settingsTab);

            Application.ApplicationExit += OnACTShutdown;
        }

        public void DeInitPlugin()
        {
            browserWindow.Hide();
            settingsTab.Shutdown();
        }
        #endregion

        private void OnBrowserCreated(object sender, IWpfWebBrowser browser)
        {
            browser.RegisterJsObject("act", new BrowserBindings());
            // FIXME: Make it possible to create more than one window.
            // Tie loading html to the browser window creation and bindings to the
            // browser creation.
            browser.Load(settingsTab.HTMLFile());
            browser.ShowDevTools();
        }

        private void OnACTShutdown(object sender, EventArgs args)
        {
            // Cef has to be manually shutdown on this thread, but can only be
            // shutdown once.
            Cef.Shutdown();
        }
    }
}

Allow cactbot to be restarted

Allow cactbot to be restarted


using System;
using System.Threading.Tasks;
using Carrot.Configuration;
using Carrot.Extensions;
using RabbitMQ.Client;
using RabbitMQ.Client.Events;

namespace Carrot.Messages
{
    public abstract class ConsumedMessageBase
    {
        protected readonly BasicDeliverEventArgs Args;

        protected ConsumedMessageBase(BasicDeliverEventArgs args)
        {
            Args = args;
        }

        internal abstract Object Content { get; }

        internal abstract Task<AggregateConsumingResult> ConsumeAsync(SubscriptionConfiguration configuration);

        internal ConsumedMessage<TMessage> As<TMessage>() where TMessage : class
        {
            var content = Content as TMessage;

            if (content == null)
                throw new InvalidCastException(String.Format("cannot cast '{0}' to '{1}'",
                                                             Content.GetType(),
                                                             typeof(TMessage)));

            return new ConsumedMessage<TMessage>(content, HeaderCollection.Parse(Args));
        }

        internal abstract Boolean Match(Type type);

        internal void Acknowledge(IModel model)
        {
            model.BasicAck(Args.DeliveryTag, false);
        }

        internal void Requeue(IModel model)
        {
            model.BasicNack(Args.DeliveryTag, false, true);
        }

        internal void ForwardTo(IModel model, Func<String, String> exchangeNameBuilder)
        {
            var exchange = Exchange.DurableDirect(exchangeNameBuilder(Args.Exchange));
            exchange.Declare(model);
            var properties = Args.BasicProperties.Copy();
            properties.Persistent = true;
            model.BasicPublish(exchange.Name,
                               String.Empty,
                               properties,
                               Args.Body);
        }
    }
}

using System;
using System.Threading.Tasks;
using Carrot.Configuration;
using Carrot.Extensions;
using RabbitMQ.Client;
using RabbitMQ.Client.Events;

namespace Carrot.Messages
{
    public abstract class ConsumedMessageBase
    {
        protected readonly BasicDeliverEventArgs Args;

        protected ConsumedMessageBase(BasicDeliverEventArgs args)
        {
            Args = args;
        }

        internal abstract Object Content { get; }

        internal abstract Task<AggregateConsumingResult> ConsumeAsync(SubscriptionConfiguration configuration);

        internal ConsumedMessage<TMessage> As<TMessage>() where TMessage : class
        {
            var content = Content as TMessage;

            if (content == null)
                throw new InvalidCastException(String.Format("cannot cast '{0}' to '{1}'",
                                                             Content.GetType(),
                                                             typeof(TMessage)));

            return new ConsumedMessage<TMessage>(content, HeaderCollection.Parse(Args));
        }

        internal abstract Boolean Match(Type type);

        internal void Acknowledge(IModel model)
        {
            model.BasicAck(Args.DeliveryTag, false);
        }

        internal void Requeue(IModel model)
        {
            model.BasicNack(Args.DeliveryTag, false, true);
        }

        internal void ForwardTo(IModel model, Func<String, String> exchangeNameBuilder)
        {
            var exchange = Exchange.Direct(exchangeNameBuilder(Args.Exchange)).Durable();
            exchange.Declare(model);
            var properties = Args.BasicProperties.Copy();
            properties.Persistent = true;
            model.BasicPublish(exchange.Name,
                               String.Empty,
                               properties,
                               Args.Body);
        }
    }
}

Use new API to build durable Exchange

Use new API to build durable Exchange


using UnityEngine;
using UnityEditor;
using System;
using System.Collections;

namespace mLogger {

    public class LoggerWindow : EditorWindow {

        private Logger loggerInstance;

        public Logger LoggerInstance {
            get {
                if (loggerInstance == null) {
                    loggerInstance = FindObjectOfType<Logger>();
                    if (loggerInstance == null) {
                        GameObject loggerGO = new GameObject();
                        loggerGO.AddComponent<Logger>();
                        loggerInstance = loggerGO.GetComponent<Logger>();
                    }
                }
                return loggerInstance;
            }
        }

        [MenuItem("Debug/Logger")]
        public static void Init() {
            LoggerWindow window =
                (LoggerWindow)EditorWindow.GetWindow(typeof(LoggerWindow));
            window.title = "Logger";
            window.minSize = new Vector2(100f, 60f);
        }

        private void OnGUI() {
            EditorGUILayout.BeginHorizontal();

            // Draw Start/Stop button.
            LoggerInstance.LoggingEnabled =
                InspectorControls.DrawStartStopButton(
                    LoggerInstance.LoggingEnabled,
                    LoggerInstance.EnableOnPlay,
                    null,
                    () => LoggerInstance.LogWriter.Add("[PAUSE]", true),
                    () => LoggerInstance.LogWriter.WriteAll(
                        LoggerInstance.FilePath,
                        false));

            // Draw -> button.
            if (GUILayout.Button("->", GUILayout.Width(30))) {
                EditorGUIUtility.PingObject(LoggerInstance);
                Selection.activeGameObject = LoggerInstance.gameObject;
            }

            EditorGUILayout.EndHorizontal();

            Repaint();
        }
    }
}

using UnityEngine;
using UnityEditor;
using System;
using System.Collections;

namespace mLogger {

    public class LoggerWindow : EditorWindow {

        private Logger loggerInstance;

        public Logger LoggerInstance {
            get {
                if (loggerInstance == null) {
                    loggerInstance = FindObjectOfType<Logger>();
                    if (loggerInstance == null) {
                        GameObject loggerGO = new GameObject();
                        loggerGO.AddComponent<Logger>();
                        loggerInstance = loggerGO.GetComponent<Logger>();
                    }
                }
                return loggerInstance;
            }
        }

        [MenuItem("Window/mLogger")]
        public static void Init() {
            LoggerWindow window =
                (LoggerWindow)EditorWindow.GetWindow(typeof(LoggerWindow));
            window.title = "Logger";
            window.minSize = new Vector2(100f, 60f);
        }

        private void OnGUI() {
            EditorGUILayout.BeginHorizontal();

            // Draw Start/Stop button.
            LoggerInstance.LoggingEnabled =
                InspectorControls.DrawStartStopButton(
                    LoggerInstance.LoggingEnabled,
                    LoggerInstance.EnableOnPlay,
                    null,
                    () => LoggerInstance.LogWriter.Add("[PAUSE]", true),
                    () => LoggerInstance.LogWriter.WriteAll(
                        LoggerInstance.FilePath,
                        false));

            // Draw -> button.
            if (GUILayout.Button("->", GUILayout.Width(30))) {
                EditorGUIUtility.PingObject(LoggerInstance);
                Selection.activeGameObject = LoggerInstance.gameObject;
            }

            EditorGUILayout.EndHorizontal();

            Repaint();
        }
    }
}

Add mLogger to Unity Window menu

Add mLogger to Unity Window menu


using System;

namespace Yeamul.Test {
	class Program {
		static void Main(string[] args) {
			Node nn = Node.Null;
			Console.WriteLine(nn);

			Node nbt = true;
			Console.WriteLine(nbt);

			Node nbf = false;
			Console.WriteLine(nbf);

			Node n16 = short.MinValue;
			Console.WriteLine(n16);

			Node n32 = int.MinValue;
			Console.WriteLine(n32);

			Node n64 = long.MinValue;
			Console.WriteLine(n64);

			Node nu16 = ushort.MaxValue;
			Console.WriteLine(nu16);

			Node nu32 = uint.MaxValue;
			Console.WriteLine(nu32);

			Node nu64 = ulong.MaxValue;
			Console.WriteLine(nu64);

			Node nf = 1.2f;
			Console.WriteLine(nf);

			Node nd = Math.PI;
			Console.WriteLine(nd);

			Node nm = 1.2345678901234567890m;
			Console.WriteLine(nm);

			Node ng = Guid.NewGuid();
			Console.WriteLine(ng);

			Node ns = "derp";
			Console.WriteLine(ns);

			Console.ReadKey();
		}
	}
}

using System;

namespace Yeamul.Test {
	class Program {
		static void Main() {
			Node nn = Node.Null;
			Console.WriteLine(nn);

			Node nbt = true;
			Console.WriteLine(nbt);

			Node nbf = false;
			Console.WriteLine(nbf);

			Node n16 = short.MinValue;
			Console.WriteLine(n16);

			Node n32 = int.MinValue;
			Console.WriteLine(n32);

			Node n64 = long.MinValue;
			Console.WriteLine(n64);

			Node nu16 = ushort.MaxValue;
			Console.WriteLine(nu16);

			Node nu32 = uint.MaxValue;
			Console.WriteLine(nu32);

			Node nu64 = ulong.MaxValue;
			Console.WriteLine(nu64);

			Node nf = 1.2f;
			Console.WriteLine(nf);

			Node nd = Math.PI;
			Console.WriteLine(nd);

			Node nm = 1.2345678901234567890m;
			Console.WriteLine(nm);

			Node ng = Guid.NewGuid();
			Console.WriteLine(ng);

			Node ns = "derp";
			Console.WriteLine(ns);

			Console.ReadKey();
		}
	}
}

Remove Main()'s unused args parameter

Remove Main()'s unused args parameter


using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace LivrariaTest
{
    [TestClass]
    public class AutorTest
    {
        [TestMethod]
        public void TestMethod1()
        {
            Assert.AreEqual(true, true);
        }

    }
}

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Livraria;

namespace LivrariaTest
{
    [TestClass]
    public class AutorTest
    {

        [TestMethod]
        public void TestProperties()
        {
            Autor autor = new Autor();

            autor.CodAutor = 999;
            autor.Nome = "George R. R. Martin";
            autor.Cpf = "012.345.678.90";
            autor.DtNascimento = new DateTime(1948, 9, 20);

            Assert.AreEqual(autor.CodAutor, 999);
            Assert.AreEqual(autor.Nome, "George R. R. Martin");
            Assert.AreEqual(autor.Cpf, "012.345.678.90");
            Assert.AreEqual<DateTime>(autor.DtNascimento, new DateTime(1948, 9, 20));
        }

    }
}

Add test for autor properties

Add test for autor properties


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

using osu.Framework.Configuration;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;

namespace osu.Game.Screens.Multi.Components
{
    public abstract class DisableableTabControl<T> : TabControl<T>
    {
        public readonly BindableBool ReadOnly = new BindableBool();

        protected override void AddTabItem(TabItem<T> tab, bool addToDropdown = true)
        {
            if (tab is DisableableTabItem<T> disableable)
                disableable.ReadOnly.BindTo(ReadOnly);
            base.AddTabItem(tab, addToDropdown);
        }

        protected abstract class DisableableTabItem<T> : TabItem<T>
        {
            public readonly BindableBool ReadOnly = new BindableBool();

            protected DisableableTabItem(T value)
                : base(value)
            {
                ReadOnly.BindValueChanged(updateReadOnly);
            }

            private void updateReadOnly(bool readOnly)
            {
                Alpha = readOnly ? 0.2f : 1;
            }

            protected override bool OnClick(ClickEvent e)
            {
                if (ReadOnly)
                    return true;
                return base.OnClick(e);
            }
        }
    }
}

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

using osu.Framework.Configuration;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osuTK.Graphics;

namespace osu.Game.Screens.Multi.Components
{
    public abstract class DisableableTabControl<T> : TabControl<T>
    {
        public readonly BindableBool ReadOnly = new BindableBool();

        protected override void AddTabItem(TabItem<T> tab, bool addToDropdown = true)
        {
            if (tab is DisableableTabItem<T> disableable)
                disableable.ReadOnly.BindTo(ReadOnly);
            base.AddTabItem(tab, addToDropdown);
        }

        protected abstract class DisableableTabItem<T> : TabItem<T>
        {
            public readonly BindableBool ReadOnly = new BindableBool();

            protected DisableableTabItem(T value)
                : base(value)
            {
                ReadOnly.BindValueChanged(updateReadOnly);
            }

            private void updateReadOnly(bool readOnly)
            {
                Colour = readOnly ? Color4.Gray : Color4.White;
            }

            protected override bool OnClick(ClickEvent e)
            {
                if (ReadOnly)
                    return true;
                return base.OnClick(e);
            }
        }
    }
}

Use graying rather than alpha

Use graying rather than alpha


using System;

namespace OpenTkApp
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
        }
    }
}

using System;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Graphics.OpenGL;
using OpenTK.Input;

namespace OpenTkApp
{
    class Game : GameWindow
    {
        public Game()
            : base(800, 600, GraphicsMode.Default, "OpenTK Quick Start Sample")
        {
            VSync = VSyncMode.On;
        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            GL.ClearColor(0.1f, 0.2f, 0.5f, 0.0f);
            GL.Enable(EnableCap.DepthTest);
        }

        protected override void OnResize(EventArgs e)
        {
            base.OnResize(e);

            GL.Viewport(ClientRectangle.X, ClientRectangle.Y, ClientRectangle.Width, ClientRectangle.Height);

            Matrix4 projection = Matrix4.CreatePerspectiveFieldOfView((float)Math.PI / 4, Width / (float)Height, 1.0f, 64.0f);
            GL.MatrixMode(MatrixMode.Projection);
            GL.LoadMatrix(ref projection);
        }

        protected override void OnUpdateFrame(FrameEventArgs e)
        {
            base.OnUpdateFrame(e);

            if (Keyboard[Key.Escape])
                Exit();
        }

        protected override void OnRenderFrame(FrameEventArgs e)
        {
            base.OnRenderFrame(e);

            GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);

            Matrix4 modelview = Matrix4.LookAt(Vector3.Zero, Vector3.UnitZ, Vector3.UnitY);
            GL.MatrixMode(MatrixMode.Modelview);
            GL.LoadMatrix(ref modelview);

            GL.Begin(BeginMode.Triangles);

            GL.Color3(1.0f, 1.0f, 0.0f); GL.Vertex3(-1.0f, -1.0f, 4.0f);
            GL.Color3(1.0f, 0.0f, 0.0f); GL.Vertex3(1.0f, -1.0f, 4.0f);
            GL.Color3(0.2f, 0.9f, 1.0f); GL.Vertex3(0.0f, 1.0f, 4.0f);

            GL.End();

            SwapBuffers();
        }
    }

    class Program
    {
        [STAThread]
        static void Main(string[] args)
        {
            using (Game game = new Game())
            {
                game.Run(30.0);
            }
        }
    }
}

Use OpenTK triangle sample in OpenTkApp project


// --------------------------------------------------------------------------------------------------------------------
// <copyright file="AssemblyInfo.cs" company="WinAPI.NET">
//   Copyright (c) Marek Dzikiewicz, All Rights Reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

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

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WinApiNet")]
[assembly: AssemblyDescription("")]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("01efe7d3-2f81-420a-9ba7-290c1d5554e4")]

// Assembly is CLS-compliant
[assembly: CLSCompliant(true)]

// --------------------------------------------------------------------------------------------------------------------
// <copyright file="AssemblyInfo.cs" company="WinAPI.NET">
//   Copyright (c) Marek Dzikiewicz, All Rights Reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

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

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("WinApiNet")]
[assembly: AssemblyDescription("")]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("01efe7d3-2f81-420a-9ba7-290c1d5554e4")]

// Assembly is not CLS-compliant
[assembly: CLSCompliant(false)]

Mark WinApiNet assembly as not CLS-compliant


// <copyright file="DotNetFileSystem.cs" company="Fubar Development Junker">
// Copyright (c) Fubar Development Junker. All rights reserved.
// </copyright>

using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;

using FubarDev.WebDavServer.Props.Store;

using Microsoft.VisualStudio.Threading;

namespace FubarDev.WebDavServer.FileSystem.DotNet
{
    public class DotNetFileSystem : ILocalFileSystem
    {
        private readonly PathTraversalEngine _pathTraversalEngine;

        public DotNetFileSystem(DotNetFileSystemOptions options, string rootFolder, PathTraversalEngine pathTraversalEngine, IPropertyStoreFactory propertyStoreFactory = null)
        {
            RootDirectoryPath = rootFolder;
            _pathTraversalEngine = pathTraversalEngine;
            var rootDir = new DotNetDirectory(this, null, new DirectoryInfo(rootFolder), new Uri(string.Empty, UriKind.Relative));
            Root = new AsyncLazy<ICollection>(() => Task.FromResult<ICollection>(rootDir));
            Options = options;
            PropertyStore = propertyStoreFactory?.Create(this);
        }

        public string RootDirectoryPath { get; }

        public AsyncLazy<ICollection> Root { get; }

        public DotNetFileSystemOptions Options { get; }

        public IPropertyStore PropertyStore { get; }

        public Task<SelectionResult> SelectAsync(string path, CancellationToken ct)
        {
            return _pathTraversalEngine.TraverseAsync(this, path, ct);
        }
    }
}

// <copyright file="DotNetFileSystem.cs" company="Fubar Development Junker">
// Copyright (c) Fubar Development Junker. All rights reserved.
// </copyright>

using System;
using System.IO;
using System.Threading;
using System.Threading.Tasks;

using FubarDev.WebDavServer.Props.Store;

using Microsoft.VisualStudio.Threading;

namespace FubarDev.WebDavServer.FileSystem.DotNet
{
    public class DotNetFileSystem : ILocalFileSystem
    {
        private readonly PathTraversalEngine _pathTraversalEngine;

        public DotNetFileSystem(DotNetFileSystemOptions options, string rootFolder, PathTraversalEngine pathTraversalEngine, IPropertyStoreFactory propertyStoreFactory = null)
        {
            RootDirectoryPath = rootFolder;
            _pathTraversalEngine = pathTraversalEngine;
            Options = options;
            PropertyStore = propertyStoreFactory?.Create(this);
            var rootDir = new DotNetDirectory(this, null, new DirectoryInfo(rootFolder), new Uri(string.Empty, UriKind.Relative));
            Root = new AsyncLazy<ICollection>(() => Task.FromResult<ICollection>(rootDir));
        }

        public string RootDirectoryPath { get; }

        public AsyncLazy<ICollection> Root { get; }

        public DotNetFileSystemOptions Options { get; }

        public IPropertyStore PropertyStore { get; }

        public Task<SelectionResult> SelectAsync(string path, CancellationToken ct)
        {
            return _pathTraversalEngine.TraverseAsync(this, path, ct);
        }
    }
}

Set property store before creating the root collection to make the property store available for some internal file hiding logic


namespace PrimusFlex.Web.Areas.Admin.ViewModels.Employees
{
    using System.ComponentModel.DataAnnotations;

    using Infrastructure.Mapping;

    using Data.Models.Types;
    using Data.Models;

    public class CreateEmployeeViewModel : IMapFrom<Employee>, IMapTo<Employee>
    {
        [Required]
        [StringLength(60, MinimumLength = 3)]
        public string Name { get; set; }

        [Required]
        public string Email { get; set; }

        [Required]
        public string Password { get; set; }

        [Required]
        public string ConfirmPassword { get; set; }

        public string PhoneNumber { get; set; }

        // Bank details

        [Required]
        public BankName BankName { get; set; }

        [Required]
        public string SortCode { get; set; }

        [Required]
        public string Account { get; set; }
    }
}

namespace PrimusFlex.Web.Areas.Admin.ViewModels.Employees
{
    using System.ComponentModel.DataAnnotations;

    using Infrastructure.Mapping;

    using Data.Models.Types;
    using Data.Models;

    public class CreateEmployeeViewModel : IMapFrom<Employee>, IMapTo<Employee>
    {
        [Required]
        [StringLength(60, MinimumLength = 3)]
        public string Name { get; set; }

        [Required]
        public string Email { get; set; }

        [Required]
        [StringLength(100, ErrorMessage = "The {0} must be at least {2} characters long.", MinimumLength = 6)]
        [DataType(DataType.Password)]
        [Display(Name = "Password")]
        public string Password { get; set; }

        [DataType(DataType.Password)]
        [Display(Name = "Confirm password")]
        [Compare("Password", ErrorMessage = "The password and confirmation password do not match.")]
        public string ConfirmPassword { get; set; }

        public string PhoneNumber { get; set; }

        // Bank details

        [Required]
        public BankName BankName { get; set; }

        [Required]
        public string SortCode { get; set; }

        [Required]
        public string Account { get; set; }
    }
}

Add attribute for checking if password and conformation password match


using System;

namespace Sharper.C.Data
{

using static UnitModule;

public static class FunctionModule
{
    public static Func<A, B> Fun<A, B>(Func<A, B> f)
    =>
        f;

    public static Func<A, Unit> Fun<A>(Action<A> f)
    =>
        ToFunc(f);

     public static Action<A> Act<A>(Action<A> f)
     =>
        f;

    public static A Id<A>(A a)
    =>
        a;

    public static Func<B, A> Const<A, B>(A a)
    =>
        b => a;

    public static Func<B, A, C> Flip<A, B, C>(Func<A, B, C> f)
    =>
        (b, a) => f(a, b);

    public static Func<A, C> Compose<A, B, C>(this Func<B, C> f, Func<A, B> g)
    =>
        a => f(g(a));

    public static Func<A, C> Then<A, B, C>(this Func<A, B> f, Func<B, C> g)
    =>
        a => g(f(a));

    public static Func<A, Func<B, C>> Curry<A, B, C>(Func<A, B, C> f)
    =>
        a => b => f(a, b);

    public static Func<A, B, C> Uncurry<A, B, C>(Func<A, Func<B, C>> f)
    =>
        (a, b) => f(a)(b);
}

}

using System;

namespace Sharper.C.Data
{

using static UnitModule;

public static class FunctionModule
{
    public static Func<A, B> Fun<A, B>(Func<A, B> f)
    =>
        f;

    public static Func<A, Unit> Fun<A>(Action<A> f)
    =>
        ToFunc(f);

     public static Action<A> Act<A>(Action<A> f)
     =>
        f;

    public static A Id<A>(A a)
    =>
        a;

    public static Func<B, A> Const<A, B>(A a)
    =>
        b => a;

    public static Func<B, A, C> Flip<A, B, C>(Func<A, B, C> f)
    =>
        (b, a) => f(a, b);

    public static Func<A, C> Compose<A, B, C>(Func<B, C> f, Func<A, B> g)
    =>
        a => f(g(a));

    public static Func<A, C> Then<A, B, C>(this Func<A, B> f, Func<B, C> g)
    =>
        a => g(f(a));

    public static Func<A, Func<B, C>> Curry<A, B, C>(Func<A, B, C> f)
    =>
        a => b => f(a, b);

    public static Func<A, B, C> Uncurry<A, B, C>(Func<A, Func<B, C>> f)
    =>
        (a, b) => f(a)(b);
}

}

Make Compose a non-extension method

Make Compose a non-extension method


namespace Siftables
{
    public partial class MainWindowView
    {
        public MainWindowView()
        {
            InitializeComponent();
            DoAllOfTheThings();
        }
    }
}

namespace Siftables
{
    public partial class MainWindowView
    {
        public MainWindowView()
        {
            InitializeComponent();
        }
    }
}

Fix build issues for TeamCity.

Fix build issues for TeamCity.

Signed-off-by: Alexander J Mullans <60c6d277a8bd81de7fdde19201bf9c58a3df08f4@alexmullans.com>


using Autofac;
using SceneJect.Autofac;
using SceneJect.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;

namespace SceneJect.Autofac
{
	public class AutofacServiceAdapter : ContainerServiceProvider, IResolver, IServiceRegister
	{
		private readonly AutofacRegisterationStrat registerationStrat = new AutofacRegisterationStrat(new ContainerBuilder());
		public override IServiceRegister Registry { get { return registerationStrat; } }

		private IResolver resolver = null;
		public override IResolver Resolver { get { return GenerateResolver(); } }

		private readonly object syncObj = new object();

		private IResolver GenerateResolver()
		{
			if(resolver == null)
			{
				//double check locking
				lock(syncObj)
					if (resolver == null)
						resolver = new AutofacResolverStrat(registerationStrat.Build());
            }

			return resolver;
		}
	}
}

using Autofac;
using SceneJect.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;

namespace SceneJect.Autofac
{
	public class AutofacServiceAdapter : ContainerServiceProvider, IResolver, IServiceRegister
	{
		private readonly AutofacRegisterationStrat registerationStrat = new AutofacRegisterationStrat(new ContainerBuilder());
		public override IServiceRegister Registry { get { return registerationStrat; } }

		private IResolver resolver = null;
		public override IResolver Resolver { get { return GenerateResolver(); } }

		private readonly object syncObj = new object();

		private IResolver GenerateResolver()
		{
			if(resolver == null)
			{
				//double check locking
				lock(syncObj)
					if (resolver == null)
						resolver = new AutofacResolverStrat(registerationStrat.Build());
            }

			return resolver;
		}
	}
}

Fix travis/mono by remove SUO

Fix travis/mono by remove SUO


using System.IO;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Scripting;
using Microsoft.CodeAnalysis.CSharp.Scripting;

namespace UserInputMacro
{
	static class ScriptExecuter
	{
		public static async Task ExecuteAsync( string scriptPath )
		{
			using( var hook = new UserInputHook() ) {
				HookSetting( hook );

				var script = CSharpScript.Create( File.ReadAllText( scriptPath ), ScriptOptions.Default, typeof( MacroScript ) );
				await script.RunAsync( new MacroScript() );
			}
		}

		private static void LoggingMouseMacro( MouseHookStruct mouseHookStr, int mouseEvent )
		{
			if( CommonUtil.CheckMode( ModeKind.CreateLog ) ) {
				Logger.WriteMouseEvent( mouseHookStr, ( MouseHookEvent ) mouseEvent );
			}
		}

		private static void LoggingKeyMacro( KeyHookStruct keyHookStr, int keyEvent )
		{
			if( CommonUtil.CheckMode( ModeKind.CreateLog ) ) {
				Logger.WriteKeyEventAsync( keyHookStr, ( KeyHookEvent ) keyEvent ).Wait();
			}
		}

		private static void HookSetting( UserInputHook hook )
		{
			hook.MouseHook = LoggingMouseMacro;
			hook.KeyHook = LoggingKeyMacro;
			hook.HookErrorProc = CommonUtil.HandleException;

			hook.RegisterKeyHook();
			hook.RegisterMouseHook();
		}
	}
}

using System.IO;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Scripting;
using Microsoft.CodeAnalysis.CSharp.Scripting;

namespace UserInputMacro
{
	static class ScriptExecuter
	{
		public static async Task ExecuteAsync( string scriptPath )
		{
			using( var hook = new UserInputHook() ) {
				HookSetting( hook );

				var script = CSharpScript.Create( File.ReadAllText( scriptPath ), ScriptOptions.Default, typeof( MacroScript ) );
				await script.RunAsync( new MacroScript() );
			}
		}

		private static void LoggingMouseMacro( MouseHookStruct mouseHookStr, int mouseEvent )
		{
			if( CommonUtil.CheckMode( ModeKind.CreateLog ) ) {
				Logger.WriteMouseEvent( mouseHookStr, ( MouseHookEvent ) mouseEvent );
			}
		}

		private static void LoggingKeyMacro( KeyHookStruct keyHookStr, int keyEvent )
		{
			if( CommonUtil.CheckMode( ModeKind.CreateLog ) ) {
				Logger.WriteKeyEvent( keyHookStr, ( KeyHookEvent ) keyEvent );
			}
		}

		private static void HookSetting( UserInputHook hook )
		{
			hook.MouseHook = LoggingMouseMacro;
			hook.KeyHook = LoggingKeyMacro;
			hook.HookErrorProc = CommonUtil.HandleException;

			hook.RegisterKeyHook();
			hook.RegisterMouseHook();
		}
	}
}

Correct in order not to use "Wait" method for synchronized method


namespace ElectronicCash
{
    public struct ActorName
    {
        private readonly string _firstName;
        private readonly string _middleName;
        private readonly string _lastName;
        private readonly string _title;
        private readonly string _entityName;

        public ActorName(string firstName, string middleName, string lastName, string title)
        {
            _firstName = firstName;
            _middleName = middleName;
            _lastName = lastName;
            _title = title;
            _entityName = null;
        }

        public ActorName(string entityName)
        {
            _firstName = null;
            _middleName = null;
            _lastName = null;
            _title = null;
            _entityName = entityName;
        }

        public string FirstName => _firstName;
        public string MiddleName => _middleName;
        public string LastName => _lastName;
        public string Title => _title;
        public string EntityName => _entityName;
    }
}

using System;

namespace ElectronicCash
{
    public struct ActorName
    {
        private readonly string _firstName;
        private readonly string _middleName;
        private readonly string _lastName;
        private readonly string _title;
        private readonly string _entityName;

        public ActorName(string firstName, string middleName, string lastName, string title)
        {
            if (string.IsNullOrEmpty(firstName))
            {
                throw new ArgumentException("First name must not be empty");
            }
            if (string.IsNullOrEmpty(middleName))
            {
                throw new ArgumentException("Middle name must not be empty");
            }
            if (string.IsNullOrEmpty(lastName))
            {
                throw new ArgumentException("Last name must not be empty");
            }

            _firstName = firstName;
            _middleName = middleName;
            _lastName = lastName;
            _title = title;
            _entityName = null;
        }

        public ActorName(string entityName)
        {
            if (string.IsNullOrEmpty(entityName))
            {
                throw new ArgumentException("Entity name must be provided");
            }

            _firstName = null;
            _middleName = null;
            _lastName = null;
            _title = null;
            _entityName = entityName;
        }

        public string FirstName => _firstName;
        public string MiddleName => _middleName;
        public string LastName => _lastName;
        public string Title => _title;
        public string EntityName => _entityName;
    }
}

Validate data in the ctors

Validate data in the ctors


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

namespace AppBrix.Time
{
    /// <summary>
    /// Service which operates with <see cref="DateTime"/>.
    /// </summary>
    public interface ITimeService
    {
        /// <summary>
        /// Gets the current time.
        /// This should be used instead of DateTime.Now or DateTime.UtcNow.
        /// </summary>
        /// <returns></returns>
        DateTime GetTime();

        /// <summary>
        /// Converts the specified time to the configured application time kind.
        /// </summary>
        /// <param name="time">The specified time.</param>
        /// <returns>The converted time.</returns>
        DateTime ToAppTime(DateTime time);

        /// <summary>
        /// Converts a given <see cref="DateTime"/> to a predefined <see cref="string"/> representation.
        /// </summary>
        /// <param name="time">The time.</param>
        /// <returns>The string representation of the time.</returns>
        string ToString(DateTime time);

        /// <summary>
        /// Converts a given <see cref="string"/> to a <see cref="DateTime"/> in a system time kind.
        /// </summary>
        /// <param name="time"></param>
        /// <returns></returns>
        DateTime ToDateTime(string time);
    }
}

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

namespace AppBrix.Time
{
    /// <summary>
    /// Service which operates with <see cref="DateTime"/>.
    /// </summary>
    public interface ITimeService
    {
        /// <summary>
        /// Gets the current time.
        /// This should be used instead of <see cref="DateTime.Now"/> or <see cref="DateTime.UtcNow"/>.
        /// </summary>
        /// <returns>The current date and time.</returns>
        DateTime GetTime();

        /// <summary>
        /// Converts the specified time to the configured application <see cref="DateTimeKind"/>.
        /// </summary>
        /// <param name="time">The specified time.</param>
        /// <returns>The converted time.</returns>
        DateTime ToAppTime(DateTime time);

        /// <summary>
        /// Converts a given <see cref="DateTime"/> to a predefined <see cref="string"/> representation.
        /// </summary>
        /// <param name="time">The time.</param>
        /// <returns>The string representation of the time.</returns>
        string ToString(DateTime time);

        /// <summary>
        /// Converts a given <see cref="string"/> to a <see cref="DateTime"/> in the configured <see cref="DateTimeKind"/>.
        /// </summary>
        /// <param name="time">The date and time in string representation.</param>
        /// <returns>The date and time.</returns>
        DateTime ToDateTime(string time);
    }
}

Improve time service interface documentation


using System;
using System.IO;

namespace Kyru.Core
{
	internal sealed class Config
	{
		internal string storeDirectory;

		internal Config()
		{
			storeDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Kyru", "objects");
		}
	}
}

using System;
using System.IO;

namespace Kyru.Core
{
	internal sealed class Config
	{
		internal string storeDirectory;

		internal Config()
		{
			storeDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Kyru", "objects");
		}
	}
}

Fix to make path independant to the version


using System.Reflection;

[assembly: AssemblyTitle("Autofac.Extras.Tests.CommonServiceLocator")]
[assembly: AssemblyDescription("")]

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


using ToSic.Razor.Blade;

// todo: change to use Get
public class Links : Custom.Hybrid.Code12
{
  // Returns a safe url to a post details page
  public dynamic LinkToDetailsPage(dynamic post) {
    var detailsPageTabId = Text.Has(Settings.DetailsPage)
      ? int.Parse((AsEntity(App.Settings).GetBestValue("DetailsPage")).Split(':')[1])
      : CmsContext.Page.Id;

    return Link.To(pageId: detailsPageTabId, parameters: "details=" + post.UrlKey);
  }
}

using ToSic.Razor.Blade;

public class Links : Custom.Hybrid.Code12
{
  /// <Summary>
  /// Returns a safe url to a post details page
  /// </Summary>
  public dynamic LinkToDetailsPage(dynamic post) {
    return Link.To(pageId: DetailsPageId, parameters: "details=" + post.UrlKey);
  }

  /// <Summary>
  /// Get / cache the page which will show the details of a post
  /// </Summary>
  private int DetailsPageId
  {
    get
    {
      if (_detailsPageId != 0) return _detailsPageId;
      if (Text.Has(Settings.DetailsPage))
        _detailsPageId = int.Parse((App.Settings.Get("DetailsPage", convertLinks: false)).Split(':')[1]);
      else
        _detailsPageId = CmsContext.Page.Id;
      return _detailsPageId;
    }
  }
  private int _detailsPageId;
}

Improve how the link is made and page is cached


#load "LogHelper.csx"
#load "FunctionNameHelper.csx"

using System.Configuration;

public static class AppSettingsHelper
{
    public static string GetAppSetting(string SettingName, bool LogValue = true )
    {

        string SettingValue = "";
        string methodName = this.GetType().FullName;

        try
        {
            SettingValue = ConfigurationManager.AppSettings[SettingName].ToString();

            if ((!String.IsNullOrEmpty(SettingValue)) && LogValue)
            {
                LogHelper.Info($"{FunctionnameHelper} {GetFunctionName()} {methodName} Retreived AppSetting {SettingName} with a value of {SettingValue}");
            }
            else if((!String.IsNullOrEmpty(SettingValue)) && !LogValue)
            {
                 LogHelper.Info($"{FunctionnameHelper} {methodName} Retreived AppSetting {SettingName} but logging value was turned off");
            }
            else if(!String.IsNullOrEmpty(SettingValue))
            {
                LogHelper.Info($"{FunctionnameHelper} {methodName} AppSetting {SettingName} was null or empty");
            }

        }
        catch (ConfigurationErrorsException ex)
        {
            LogHelper.Error($"{FunctionnameHelper} {methodName} Unable to find AppSetting {SettingName} with exception of {ex.Message}");
        }
        catch (System.Exception ex)
        {
            LogHelper.Error($"{FunctionnameHelper} {methodName} Looking for AppSetting {SettingName} caused an exception of {ex.Message}");
        }

        return SettingValue;

    }

}

#load "LogHelper.csx"
#load "FunctionNameHelper.csx"

using System.Configuration;

public static class AppSettingsHelper
{
    public static string GetAppSetting(string SettingName, bool LogValue = true )
    {

        string SettingValue = "";
        string methodName = this.GetType().FullName;

        try
        {
            SettingValue = ConfigurationManager.AppSettings[SettingName].ToString();

            if ((!String.IsNullOrEmpty(SettingValue)) && LogValue)
            {
                LogHelper.Info($"{FunctionnameHelper.GetFunctionName()} {GetFunctionName()} {methodName} Retreived AppSetting {SettingName} with a value of {SettingValue}");
            }
            else if((!String.IsNullOrEmpty(SettingValue)) && !LogValue)
            {
                 LogHelper.Info($"{FunctionnameHelper.GetFunctionName()} {methodName} Retreived AppSetting {SettingName} but logging value was turned off");
            }
            else if(!String.IsNullOrEmpty(SettingValue))
            {
                LogHelper.Info($"{FunctionnameHelper.GetFunctionName()} {methodName} AppSetting {SettingName} was null or empty");
            }

        }
        catch (ConfigurationErrorsException ex)
        {
            LogHelper.Error($"{FunctionnameHelper.GetFunctionName()} {methodName} Unable to find AppSetting {SettingName} with exception of {ex.Message}");
        }
        catch (System.Exception ex)
        {
            LogHelper.Error($"{FunctionnameHelper.GetFunctionName()} {methodName} Looking for AppSetting {SettingName} caused an exception of {ex.Message}");
        }

        return SettingValue;

    }

}

Use the correct call to FunctionNameHelper


namespace PKHeX.WinForms
{
    partial class Main
    {
        public System.Windows.Forms.ToolStripMenuItem EnableAutoLegality(System.ComponentModel.ComponentResourceManager resources)
        {
            this.Menu_ShowdownImportPKMModded = new System.Windows.Forms.ToolStripMenuItem();
            this.Menu_ShowdownImportPKMModded.Image = ((System.Drawing.Image)(resources.GetObject("Menu_ShowdownImportPKM.Image")));
            this.Menu_ShowdownImportPKMModded.Name = "Menu_ShowdownImportPKMModded";
            this.Menu_ShowdownImportPKMModded.Size = new System.Drawing.Size(231, 22);
            this.Menu_ShowdownImportPKMModded.Text = "Modded Showdown Import";
            this.Menu_ShowdownImportPKMModded.Click += new System.EventHandler(this.ClickShowdownImportPKMModded);
            return this.Menu_ShowdownImportPKMModded;
        }
        private System.Windows.Forms.ToolStripMenuItem Menu_ShowdownImportPKMModded;
    }
}

namespace PKHeX.WinForms
{
    partial class Main
    {
        public System.Windows.Forms.ToolStripMenuItem EnableAutoLegality(System.ComponentModel.ComponentResourceManager resources)
        {
            this.Menu_ShowdownImportPKMModded = new System.Windows.Forms.ToolStripMenuItem();
            this.Menu_ShowdownImportPKMModded.Image = ((System.Drawing.Image)(resources.GetObject("Menu_ShowdownImportPKM.Image")));
            this.Menu_ShowdownImportPKMModded.Name = "Menu_ShowdownImportPKMModded";
            this.Menu_ShowdownImportPKMModded.Size = new System.Drawing.Size(231, 22);
            this.Menu_ShowdownImportPKMModded.Text = "Import with Auto-Legality Mod";
            this.Menu_ShowdownImportPKMModded.Click += new System.EventHandler(this.ClickShowdownImportPKMModded);
            return this.Menu_ShowdownImportPKMModded;
        }
        private System.Windows.Forms.ToolStripMenuItem Menu_ShowdownImportPKMModded;
    }
}

Change aliasing of Modded Showdown Import

New Alias: Import with Auto-Legality Mod