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

namespace Line.Tests
{
    [ExcludeFromCodeCoverage]
    public sealed class TestConfiguration : ILineConfiguration
    {
        private TestConfiguration()
        {
        }

        public string ChannelAccessToken => "ChannelAccessToken";

        public string ChannelSecret => "ChannelSecret";

        public static ILineConfiguration Create()
        {
            return new TestConfiguration();
        }

        public static ILineBot CreateBot()
        {
            return new LineBot(new TestConfiguration(), TestHttpClient.Create(), null);
        }

        public static ILineBot CreateBot(TestHttpClient httpClient)
        {
            return new LineBot(new TestConfiguration(), httpClient, null);
        }

        public static ILineBot CreateBot(ILineBotLogger logger)
        {
            return new LineBot(new TestConfiguration(), TestHttpClient.Create(), logger);
        }
    }
}

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

namespace Line.Tests
{
    [ExcludeFromCodeCoverage]
    public sealed class TestConfiguration : ILineConfiguration
    {
        private TestConfiguration()
        {
        }

        public string ChannelAccessToken => "ChannelAccessToken";

        public string ChannelSecret => "ChannelSecret";

        public static ILineConfiguration Create()
        {
            return new TestConfiguration();
        }

        public static ILineBot CreateBot()
        {
            return new LineBot(new TestConfiguration(), TestHttpClient.Create(), new EmptyLineBotLogger());
        }

        public static ILineBot CreateBot(TestHttpClient httpClient)
        {
            return new LineBot(new TestConfiguration(), httpClient, new EmptyLineBotLogger());
        }

        public static ILineBot CreateBot(ILineBotLogger logger)
        {
            return new LineBot(new TestConfiguration(), TestHttpClient.Create(), logger);
        }
    }
}

Use EmptyLineBotLogger in unit tests.

Use EmptyLineBotLogger in unit tests.


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

namespace NRules.RuleModel
{
    /// <summary>
    /// Sorted readonly map of named expressions.
    /// </summary>
    public class ExpressionMap : IEnumerable<NamedExpressionElement>
    {
        private readonly SortedDictionary<string, NamedExpressionElement> _expressions;

        public ExpressionMap(IEnumerable<NamedExpressionElement> expressions)
        {
            _expressions = new SortedDictionary<string, NamedExpressionElement>(expressions.ToDictionary(x => x.Name));
        }

        /// <summary>
        /// Number of expressions in the map.
        /// </summary>
        public int Count => _expressions.Count;

        /// <summary>
        /// Retrieves expression by name.
        /// </summary>
        /// <param name="name">Expression name.</param>
        /// <returns>Matching expression.</returns>
        public NamedExpressionElement this[string name]
        {
            get
            {
                var found = _expressions.TryGetValue(name, out var result);
                if (!found)
                {
                    throw new ArgumentException(
                        $"Expression with the given name not found. Name={name}", nameof(name));
                }
                return result;
            }
        }

        public IEnumerator<NamedExpressionElement> GetEnumerator()
        {
            return _expressions.Values.GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }
    }
}

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

namespace NRules.RuleModel
{
    /// <summary>
    /// Sorted readonly map of named expressions.
    /// </summary>
    public class ExpressionMap : IEnumerable<NamedExpressionElement>
    {
        private readonly SortedDictionary<string, NamedExpressionElement> _expressions;

        public ExpressionMap(IEnumerable<NamedExpressionElement> expressions)
        {
            _expressions = new SortedDictionary<string, NamedExpressionElement>(expressions.ToDictionary(x => x.Name));
        }

        /// <summary>
        /// Number of expressions in the map.
        /// </summary>
        public int Count => _expressions.Count;

        /// <summary>
        /// Retrieves expression by name.
        /// </summary>
        /// <param name="name">Expression name.</param>
        /// <returns>Matching expression.</returns>
        public NamedExpressionElement this[string name]
        {
            get
            {
                var found = _expressions.TryGetValue(name, out var result);
                if (!found)
                {
                    throw new ArgumentException(
                        $"Expression with the given name not found. Name={name}", nameof(name));
                }
                return result;
            }
        }

        /// <summary>
        /// Retrieves expression by name.
        /// </summary>
        /// <param name="name">Expression name.</param>
        /// <returns>Matching expression or <c>null</c>.</returns>
        public NamedExpressionElement Find(string name)
        {
            _expressions.TryGetValue(name, out var result);
            return result;
        }

        public IEnumerator<NamedExpressionElement> GetEnumerator()
        {
            return _expressions.Values.GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }
    }
}

Add Find method to expression map

Add Find method to expression map


using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Mono.Cecil;
using System;
using System.IO;

namespace AspectInjector.BuildTask
{
    public class AspectInjectorBuildTask : Task
    {
        [Required]
        public string Assembly { get; set; }

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

        public override bool Execute()
        {
            try
            {
                Console.WriteLine("Aspect Injector has started for {0}", Assembly);

                var assemblyResolver = new DefaultAssemblyResolver();
                assemblyResolver.AddSearchDirectory(OutputPath);

                string assemblyFile = Path.Combine(OutputPath, Assembly + ".exe");

                var assembly = AssemblyDefinition.ReadAssembly(assemblyFile,
                    new ReaderParameters
                    {
                        ReadingMode = Mono.Cecil.ReadingMode.Deferred,
                        AssemblyResolver = assemblyResolver
                    });

                Console.WriteLine("Assembly has been loaded");

                var injector = new AspectInjector();
                injector.Process(assembly);

                Console.WriteLine("Assembly has been patched");

                assembly.Write(assemblyFile);

                Console.WriteLine("Assembly has been written");
            }
            catch (Exception e)
            {
                this.Log.LogErrorFromException(e, false, true, null);
                Console.Error.WriteLine(e.Message);
                return false;
            }

            return true;
        }
    }
}

using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Mono.Cecil;
using System;
using System.IO;

namespace AspectInjector.BuildTask
{
    public class AspectInjectorBuildTask : Task
    {
        [Required]
        public string Assembly { get; set; }

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

        public override bool Execute()
        {
            try
            {
                Console.WriteLine("Aspect Injector has started for {0}", Assembly);

                var assemblyResolver = new DefaultAssemblyResolver();
                assemblyResolver.AddSearchDirectory(OutputPath);

                string assemblyFile = Path.Combine(OutputPath, Assembly + ".exe");
                string pdbFile = Path.Combine(OutputPath, Assembly + ".pdb");

                var assembly = AssemblyDefinition.ReadAssembly(assemblyFile,
                    new ReaderParameters
                    {
                        ReadingMode = Mono.Cecil.ReadingMode.Deferred,
                        AssemblyResolver = assemblyResolver,
                        ReadSymbols = true
                    });

                Console.WriteLine("Assembly has been loaded");

                var injector = new AspectInjector();
                injector.Process(assembly);

                Console.WriteLine("Assembly has been patched");

                assembly.Write(assemblyFile, new WriterParameters()
                {
                    WriteSymbols = true
                });

                Console.WriteLine("Assembly has been written");
            }
            catch (Exception e)
            {
                this.Log.LogErrorFromException(e, false, true, null);
                Console.Error.WriteLine(e.Message);
                return false;
            }

            return true;
        }
    }
}

Support debugging of modified assemblies


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

namespace AllReady.Models
{
    public class Activity
    {
        public Activity()
        {
            Tasks = new List<AllReadyTask>();
            UsersSignedUp = new List<ActivitySignup>();
            RequiredSkills = new List<ActivitySkill>();
        }

        public int Id { get; set; }

        [Display(Name = "Tenant")]
        public int TenantId { get; set; }

        public Tenant Tenant { get; set; }

        [Display(Name = "Campaign")]
        public int CampaignId { get; set; }

        public Campaign Campaign { get; set; }

        public string Name { get; set; }

        public string Description { get; set; }

        [Display(Name = "Start date")]
        public DateTime StartDateTimeUtc { get; set; }

        [Display(Name = "End date")]
        public DateTime EndDateTimeUtc { get; set; }

        public Location Location { get; set; }

        public List<AllReadyTask> Tasks { get; set; }

        public List<ActivitySignup> UsersSignedUp { get; set; }

        public ApplicationUser Organizer { get; set; }

        [Display(Name = "Image")]
        public string ImageUrl { get; set; }

        [Display(Name = "Required skills")]
        public List<ActivitySkill> RequiredSkills { get; set; }
    }
}

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

namespace AllReady.Models
{
    public class Activity
    {
        public int Id { get; set; }

        [Display(Name = "Tenant")]
        public int TenantId { get; set; }

        public Tenant Tenant { get; set; }

        [Display(Name = "Campaign")]
        public int CampaignId { get; set; }

        public Campaign Campaign { get; set; }

        public string Name { get; set; }

        public string Description { get; set; }

        [Display(Name = "Start date")]
        public DateTime StartDateTimeUtc { get; set; }

        [Display(Name = "End date")]
        public DateTime EndDateTimeUtc { get; set; }

        public Location Location { get; set; }

        public List<AllReadyTask> Tasks { get; set; } = new List<AllReadyTask>();

        public List<ActivitySignup> UsersSignedUp { get; set; } = new List<ActivitySignup>();

        public ApplicationUser Organizer { get; set; }

        [Display(Name = "Image")]
        public string ImageUrl { get; set; }

        [Display(Name = "Required skills")]
        public List<ActivitySkill> RequiredSkills { get; set; } = new List<ActivitySkill>();
    }
}

Use propert initializers instead of constructor


/*
 * SqlServerHelpers
 * SqlConnectionExtensions - Extension methods for SqlConnection
 * Authors:
 *  Josh Keegan 26/05/2015
 */

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

namespace SqlServerHelpers.ExtensionMethods
{
    public static class SqlConnectionExtensions
    {
        public static SqlCommand GetSqlCommand(this SqlConnection conn, SqlTransaction trans = null)
        {
            return getSqlCommand(null, conn, trans);
        }

        public static SqlCommand GetSqlCommand(this SqlConnection conn, string txtCmd, SqlTransaction trans = null)
        {
            return getSqlCommand(txtCmd, conn, trans);
        }

        private static SqlCommand getSqlCommand(string txtCmd, SqlConnection conn, SqlTransaction trans)
        {
            SqlCommand command = new SqlCommand(txtCmd, conn, trans);

            // Apply default command settings
            if (Settings.Command != null)
            {
                if (Settings.Command.CommandTimeout != null)
                {
                    command.CommandTimeout = (int) Settings.Command.CommandTimeout;
                }
                // TODO: Support more default settings as they're added to CommandSettings
            }

            return command;
        }
    }
}

/*
 * SqlServerHelpers
 * SqlConnectionExtensions - Extension methods for SqlConnection
 * Authors:
 *  Josh Keegan 26/05/2015
 */

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

namespace SqlServerHelpers.ExtensionMethods
{
    public static class SqlConnectionExtensions
    {
        #region Public Methods

        public static SqlCommand GetSqlCommand(this SqlConnection conn, SqlTransaction trans = null,
            CommandSettings commandSettings = null)
        {
            return getSqlCommand(null, conn, trans, commandSettings);
        }

        public static SqlCommand GetSqlCommand(this SqlConnection conn, string txtCmd, SqlTransaction trans = null,
            CommandSettings commandSettings = null)
        {
            return getSqlCommand(txtCmd, conn, trans, commandSettings);
        }

        public static SqlCommand GetSqlCommand(this SqlConnection conn, CommandSettings commandSettings)
        {
            return GetSqlCommand(conn, null, commandSettings);
        }

        #endregion

        #region Private Methods

        private static SqlCommand getSqlCommand(string txtCmd, SqlConnection conn, SqlTransaction trans,
            CommandSettings commandSettings)
        {
            // If no command settings have been supplied, use the default ones as defined statically in Settings
            if (commandSettings == null)
            {
                commandSettings = Settings.Command;
            }

            // Make the command
            SqlCommand command = new SqlCommand(txtCmd, conn, trans);

            // Apply command settings
            if (commandSettings != null)
            {
                if (commandSettings.CommandTimeout != null)
                {
                    command.CommandTimeout = (int) commandSettings.CommandTimeout;
                }
                // TODO: Support more default settings as they're added to CommandSettings
            }

            return command;
        }

        #endregion
    }
}

Allow non-default Command Settings to be passed to GetSqlCommand()


using NUnit.Framework;
using UnityEngine.Formats.Alembic.Sdk;

namespace UnityEditor.Formats.Alembic.Exporter.UnitTests
{
    class EditorTests
    {
        [Test]
        public void MarshalTests()
        {
            Assert.AreEqual(72,System.Runtime.InteropServices.Marshal.SizeOf(typeof(aePolyMeshData)));
        }
    }
}

Add whitespace on test file

Add whitespace on test file


using System;
using System.Collections.Generic;
using System.Text;
using TFG.Model;

namespace TFG.Logic {
    public class SintromLogic {

        private static SintromLogic _instance;

        public static SintromLogic Instance() {
            if (_instance == null)  {
                _instance = new SintromLogic();
            }

            return _instance;
        }

        private SintromLogic() { }

        public NotificationItem GetNotificationitem() {
            var sintromItems = DBHelper.Instance.GetSintromItemFromDate(DateTime.Now);
            if (sintromItems.Count > 0) {
                var sintromItem = sintromItems[0];
                var title = HealthModulesInfo.GetStringFromResourceName("sintrom_name");
                var description =
                    string.Format(HealthModulesInfo.GetStringFromResourceName("sintrom_notification_description"),
                        sintromItem.Fraction, sintromItem.Medicine);

                return new NotificationItem(title, description, true);
            }

            return null;
        }

    }
}

using System;
using System.Collections.Generic;
using System.Text;
using TFG.Model;

namespace TFG.Logic {
    public class SintromLogic {

        private static SintromLogic _instance;

        public static SintromLogic Instance() {
            if (_instance == null)  {
                _instance = new SintromLogic();
            }

            return _instance;
        }

        private SintromLogic() { }

        public NotificationItem GetNotificationitem() {
            var controlday = DBHelper.Instance.GetSintromINRItemFromDate(DateTime.Now);
            var title = HealthModulesInfo.GetStringFromResourceName("sintrom_name");
            //Control Day Notification
            if (controlday.Count > 0 && controlday[0].Control) {
                var description =
                    string.Format(HealthModulesInfo.GetStringFromResourceName("sintrom_notification_control_description"));

                return new NotificationItem(title, description, true);
            }

            //Treatment Day Notification
            var sintromItems = DBHelper.Instance.GetSintromItemFromDate(DateTime.Now);
            if (sintromItems.Count > 0) {
                var sintromItem = sintromItems[0];
                var description =
                    string.Format(HealthModulesInfo.GetStringFromResourceName("sintrom_notification_description"),
                        sintromItem.Fraction, sintromItem.Medicine);

                return new NotificationItem(title, description, true);
            }

            //No Notification
            return null;
        }

    }
}

Set notification for sintrom control days


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

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

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

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4538ca36-f57b-4bec-b9d1-3540fdd28ae3")]

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

Remove version attributes from assembly info

GitVersion MsBuild task wil fail if they are present


/*
 * ******************************************************************************
 *   Copyright 2014 Spectra Logic Corporation. All Rights Reserved.
 *   Licensed under the Apache License, Version 2.0 (the "License"). You may not use
 *   this file except in compliance with the License. A copy of the License is located at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 *   or in the "license" file accompanying this file.
 *   This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 *   CONDITIONS OF ANY KIND, either express or implied. See the License for the
 *   specific language governing permissions and limitations under the License.
 * ****************************************************************************
 */

using System.Reflection;

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

/*
 * ******************************************************************************
 *   Copyright 2014 Spectra Logic Corporation. All Rights Reserved.
 *   Licensed under the Apache License, Version 2.0 (the "License"). You may not use
 *   this file except in compliance with the License. A copy of the License is located at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 *   or in the "license" file accompanying this file.
 *   This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 *   CONDITIONS OF ANY KIND, either express or implied. See the License for the
 *   specific language governing permissions and limitations under the License.
 * ****************************************************************************
 */

using System.Reflection;

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

Change version number to 1.2.1

Change version number to 1.2.1


using SRPCommon.Interfaces;
using SRPCommon.Util;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SRPTests.TestRenderer
{
	// Implementation of IWorkspace that finds test files.
	class TestWorkspace : IWorkspace
	{
		private readonly string _baseDir;
		private readonly Dictionary<string, string> _files;

		public TestWorkspace(string baseDir)
		{
			_baseDir = baseDir;

			// Find all files in the TestScripts dir.
			_files = Directory.EnumerateFiles(_baseDir, "*", SearchOption.AllDirectories)
				.ToDictionary(path => Path.GetFileName(path));
		}

		public string FindProjectFile(string name)
		{
			string path;
			if (_files.TryGetValue(name, out path))
			{
				return path;
			}
			return null;
		}

		public string GetAbsolutePath(string path)
		{
			if (Path.IsPathRooted(path))
			{
				return path;
			}
			return Path.Combine(_baseDir, path);
		}
	}
}

using SRPCommon.Interfaces;
using SRPCommon.Util;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SRPTests.TestRenderer
{
	// Implementation of IWorkspace that finds test files.
	class TestWorkspace : IWorkspace
	{
		private readonly string _baseDir;
		private readonly Dictionary<string, string> _files;

		public TestWorkspace(string baseDir)
		{
			_baseDir = baseDir;

			// Find all files in the TestScripts dir.
			_files = Directory.EnumerateFiles(_baseDir, "*", SearchOption.AllDirectories)
				.ToDictionary(path => Path.GetFileName(path), StringComparer.OrdinalIgnoreCase);
		}

		public string FindProjectFile(string name)
		{
			string path;
			if (_files.TryGetValue(name, out path))
			{
				return path;
			}
			return null;
		}

		public string GetAbsolutePath(string path)
		{
			if (Path.IsPathRooted(path))
			{
				return path;
			}
			return Path.Combine(_baseDir, path);
		}
	}
}

Test filenames are case insensitive too.


using System.Collections.Generic;
using System.IO;
using System.Linq;
using ICSharpCode.SharpZipLib.Tar;

namespace AppHarbor
{
	public static class CompressionExtensions
	{
		public static void ToTar(this DirectoryInfo sourceDirectory, Stream output, string[] excludedDirectoryNames)
		{
			var archive = TarArchive.CreateOutputTarArchive(output);

			archive.RootPath = sourceDirectory.FullName.Replace(Path.DirectorySeparatorChar, '/').TrimEnd('/');

			var entries = GetFiles(sourceDirectory, excludedDirectoryNames)
				.Select(x => TarEntry.CreateEntryFromFile(x.FullName));

			foreach (var entry in entries)
			{
				archive.WriteEntry(entry, true);
			}

			archive.Close();
		}

		private static IEnumerable<FileInfo> GetFiles(DirectoryInfo directory, string[] excludedDirectories)
		{
			return directory.GetFiles("*", SearchOption.TopDirectoryOnly)
				.Concat(directory.GetDirectories()
				.Where(x => excludedDirectories.Contains(x.Name))
				.SelectMany(x => GetFiles(x, excludedDirectories)));
		}
	}
}

using System.Collections.Generic;
using System.IO;
using System.Linq;
using ICSharpCode.SharpZipLib.Tar;

namespace AppHarbor
{
	public static class CompressionExtensions
	{
		public static void ToTar(this DirectoryInfo sourceDirectory, Stream output, string[] excludedDirectoryNames)
		{
			var archive = TarArchive.CreateOutputTarArchive(output);

			archive.RootPath = sourceDirectory.FullName.Replace(Path.DirectorySeparatorChar, '/').TrimEnd('/');

			var entries = GetFiles(sourceDirectory, excludedDirectoryNames)
				.Select(x => TarEntry.CreateEntryFromFile(x.FullName));

			foreach (var entry in entries)
			{
				archive.WriteEntry(entry, true);
			}

			archive.Close();
		}

		private static IEnumerable<FileInfo> GetFiles(DirectoryInfo directory, string[] excludedDirectories)
		{
			return directory.GetFiles("*", SearchOption.TopDirectoryOnly)
				.Concat(directory.GetDirectories()
				.Where(x => !excludedDirectories.Contains(x.Name))
				.SelectMany(x => GetFiles(x, excludedDirectories)));
		}
	}
}

Fix bug in file selection

Fix bug in file selection


// dnlib: See LICENSE.txt for more info

using System;
using System.IO;

namespace dnlib.IO {
	static class DataReaderFactoryFactory {
		static readonly bool isUnix;

		static DataReaderFactoryFactory() {
			// See http://mono-project.com/FAQ:_Technical#Mono_Platforms for platform detection.
			int p = (int)Environment.OSVersion.Platform;
			if (p == 4 || p == 6 || p == 128)
				isUnix = true;
		}

		public static DataReaderFactory Create(string fileName, bool mapAsImage) {
			var creator = CreateDataReaderFactory(fileName, mapAsImage);
			if (creator is not null)
				return creator;

			return ByteArrayDataReaderFactory.Create(File.ReadAllBytes(fileName), fileName);
		}

		static DataReaderFactory CreateDataReaderFactory(string fileName, bool mapAsImage) {
			if (!isUnix)
				return MemoryMappedDataReaderFactory.CreateWindows(fileName, mapAsImage);
			else
				return MemoryMappedDataReaderFactory.CreateUnix(fileName, mapAsImage);
		}
	}
}

// dnlib: See LICENSE.txt for more info

using System;
using System.IO;
using System.Runtime.InteropServices;

namespace dnlib.IO {
	static class DataReaderFactoryFactory {
		static readonly bool isUnix;

		static DataReaderFactoryFactory() {
			// See http://mono-project.com/FAQ:_Technical#Mono_Platforms for platform detection.
			int p = (int)Environment.OSVersion.Platform;
			if (p == 4 || p == 6 || p == 128)
				isUnix = true;
#if NETSTANDARD
			if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
				isUnix = true;
#endif
		}

		public static DataReaderFactory Create(string fileName, bool mapAsImage) {
			var creator = CreateDataReaderFactory(fileName, mapAsImage);
			if (creator is not null)
				return creator;

			return ByteArrayDataReaderFactory.Create(File.ReadAllBytes(fileName), fileName);
		}

		static DataReaderFactory CreateDataReaderFactory(string fileName, bool mapAsImage) {
			if (!isUnix)
				return MemoryMappedDataReaderFactory.CreateWindows(fileName, mapAsImage);
			else
				return MemoryMappedDataReaderFactory.CreateUnix(fileName, mapAsImage);
		}
	}
}

Use RuntimeInformation class to check environment.


using System.Web;
using System.Web.Routing;

namespace ConsolR.Hosting
{
	public static class HttpHandlerExtensions
	{
		public static void MapHttpHandler<THandler>(this RouteCollection routes, string url) where THandler : IHttpHandler, new()
		{
			routes.MapHttpHandler<THandler>(null, url, null, null);
		}

		public static void MapHttpHandler<THandler>(this RouteCollection routes,
			string name, string url, object defaults, object constraints)
			where THandler : IHttpHandler, new()
		{
			var route = new Route(url, new HttpHandlerRouteHandler<THandler>());
			route.Defaults = new RouteValueDictionary(defaults);
			route.Constraints = new RouteValueDictionary(constraints);
			routes.Add(name, route);
		}

		private class HttpHandlerRouteHandler<THandler>
			: IRouteHandler where THandler : IHttpHandler, new()
		{
			public IHttpHandler GetHttpHandler(RequestContext requestContext)
			{
				return new THandler();
			}
		}
	}
}

using System.Web;
using System.Web.Routing;

namespace ConsolR.Hosting
{
	public static class HttpHandlerExtensions
	{
		public static void MapHttpHandler<THandler>(this RouteCollection routes, string url) where THandler : IHttpHandler, new()
		{
			routes.MapHttpHandler<THandler>(null, url, null, null);
		}

		public static void MapHttpHandler<THandler>(this RouteCollection routes,
			string name, string url, object defaults, object constraints)
			where THandler : IHttpHandler, new()
		{
			var route = new Route(url, new HttpHandlerRouteHandler<THandler>());
			route.Defaults = new RouteValueDictionary(defaults);
			route.Constraints = new RouteValueDictionary();
			route.Constraints.Add(name, constraints);
			routes.Add(name, route);
		}

		private class HttpHandlerRouteHandler<THandler>
			: IRouteHandler where THandler : IHttpHandler, new()
		{
			public IHttpHandler GetHttpHandler(RequestContext requestContext)
			{
				return new THandler();
			}
		}
	}
}

Fix bug in http handler constraints

Fix bug in http handler constraints


using System.Collections.Generic;

namespace RazorLight.Templating
{
    public class PageLookupResult
    {
	    public PageLookupResult()
	    {
		    this.Success = false;
	    }

	    public PageLookupResult(PageLookupItem item, IReadOnlyList<PageLookupItem> viewStartEntries)
	    {
		    this.ViewEntry = item;
		    this.ViewStartEntries = viewStartEntries;
		    this.Success = true;
	    }

		public bool Success { get; }

		public PageLookupItem ViewEntry { get; }

		public IReadOnlyList<PageLookupItem> ViewStartEntries { get; }
	}
}

using System.Collections.Generic;

namespace RazorLight.Templating
{
    public class PageLookupResult
    {
        public static PageLookupResult Failed => new PageLookupResult();

	    private PageLookupResult()
	    {
		    this.Success = false;
	    }

	    public PageLookupResult(PageLookupItem item, IReadOnlyList<PageLookupItem> viewStartEntries)
	    {
		    this.ViewEntry = item;
		    this.ViewStartEntries = viewStartEntries;
		    this.Success = true;
	    }

		public bool Success { get; }

		public PageLookupItem ViewEntry { get; }

		public IReadOnlyList<PageLookupItem> ViewStartEntries { get; }
	}
}

Replace default constructor with failed property on PageProvider


using System;

namespace Microsoft.Build.Logging.StructuredLogger
{
    public class TimedNode : NamedNode
    {
        public int Id { get; set; }
        public int NodeId { get; set; }

        /// <summary>
        /// Unique index of the node in the build tree, can be used as a
        /// "URL" to node
        /// </summary>
        public int Index { get; set; }

        public DateTime StartTime { get; set; }
        public DateTime EndTime { get; set; }
        public TimeSpan Duration
        {
            get
            {
                if (EndTime >= StartTime)
                {
                    return EndTime - StartTime;
                }

                return TimeSpan.Zero;
            }
        }

        public string DurationText => TextUtilities.DisplayDuration(Duration);

        public override string TypeName => nameof(TimedNode);

        public string GetTimeAndDurationText(bool fullPrecision = false)
        {
            var duration = DurationText;
            if (string.IsNullOrEmpty(duration))
            {
                duration = "0";
            }

            return $@"Start: {TextUtilities.Display(StartTime, displayDate: true, fullPrecision)}
End: {TextUtilities.Display(EndTime, displayDate: true, fullPrecision)}
Duration: {duration}";
        }

        public override string ToolTip => GetTimeAndDurationText();
    }
}

using System;

namespace Microsoft.Build.Logging.StructuredLogger
{
    public class TimedNode : NamedNode
    {
        /// <summary>
        /// The Id of a Project, ProjectEvaluation, Target and Task.
        /// Corresponds to ProjectStartedEventsArgs.ProjectId, TargetStartedEventArgs.TargetId, etc.
        /// </summary>
        public int Id { get; set; }

        /// <summary>
        /// Corresponds to BuildEventArgs.BuildEventContext.NodeId,
        /// which is the id of the MSBuild.exe node process that built the current project or
        /// executed the given target or task.
        /// </summary>
        public int NodeId { get; set; }

        /// <summary>
        /// Unique index of the node in the build tree, can be used as a
        /// "URL" to node
        /// </summary>
        public int Index { get; set; }

        public DateTime StartTime { get; set; }
        public DateTime EndTime { get; set; }
        public TimeSpan Duration
        {
            get
            {
                if (EndTime >= StartTime)
                {
                    return EndTime - StartTime;
                }

                return TimeSpan.Zero;
            }
        }

        public string DurationText => TextUtilities.DisplayDuration(Duration);

        public override string TypeName => nameof(TimedNode);

        public string GetTimeAndDurationText(bool fullPrecision = false)
        {
            var duration = DurationText;
            if (string.IsNullOrEmpty(duration))
            {
                duration = "0";
            }

            return $@"Start: {TextUtilities.Display(StartTime, displayDate: true, fullPrecision)}
End: {TextUtilities.Display(EndTime, displayDate: true, fullPrecision)}
Duration: {duration}";
        }

        public override string ToolTip => GetTimeAndDurationText();
    }
}

Add XML doc comments on Id and NodeId

Add XML doc comments on Id and NodeId


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

namespace osu.Game.Overlays.Settings.Sections.Debug
{
    public class GeneralSettings : SettingsSubsection
    {
        protected override string Header => "General";

        [BackgroundDependencyLoader]
        private void load(FrameworkDebugConfigManager config, FrameworkConfigManager frameworkConfig)
        {
            Children = new Drawable[]
            {
                new SettingsCheckbox
                {
                    LabelText = "Bypass caching",
                    Bindable = config.GetBindable<bool>(DebugSetting.BypassCaching)
                },
                new SettingsCheckbox
                {
                    LabelText = "Debug logs",
                    Bindable = frameworkConfig.GetBindable<bool>(FrameworkSetting.ShowLogOverlay)
                }
            };
        }
    }
}

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

namespace osu.Game.Overlays.Settings.Sections.Debug
{
    public class GeneralSettings : SettingsSubsection
    {
        protected override string Header => "General";

        [BackgroundDependencyLoader]
        private void load(FrameworkDebugConfigManager config, FrameworkConfigManager frameworkConfig)
        {
            Children = new Drawable[]
            {
                new SettingsCheckbox
                {
                    LabelText = "Show log overlay",
                    Bindable = frameworkConfig.GetBindable<bool>(FrameworkSetting.ShowLogOverlay)
                },
                new SettingsCheckbox
                {
                    LabelText = "Performance logging",
                    Bindable = frameworkConfig.GetBindable<bool>(FrameworkSetting.PerformanceLogging)
                },
                new SettingsCheckbox
                {
                    LabelText = "Bypass caching (slow)",
                    Bindable = config.GetBindable<bool>(DebugSetting.BypassCaching)
                },
            };
        }
    }
}

Add setting to toggle performance logging


#pragma warning disable CS1591
using System;
using Newtonsoft.Json;

namespace Discord.API
{
    internal class Embed
    {
        [JsonProperty("title")]
        public string Title { get; set; }
        [JsonProperty("description")]
        public string Description { get; set; }
        [JsonProperty("url")]
        public string Url { get; set; }
        [JsonProperty("color")]
        public uint? Color { get; set; }
        [JsonProperty("type")]
        public EmbedType Type { get; set; }
        [JsonProperty("timestamp")]
        public DateTimeOffset? Timestamp { get; set; }
        [JsonProperty("author")]
        public Optional<EmbedAuthor> Author { get; set; }
        [JsonProperty("footer")]
        public Optional<EmbedFooter> Footer { get; set; }
        [JsonProperty("video")]
        public Optional<EmbedVideo> Video { get; set; }
        [JsonProperty("thumbnail")]
        public Optional<EmbedThumbnail> Thumbnail { get; set; }
        [JsonProperty("image")]
        public Optional<EmbedImage> Image { get; set; }
        [JsonProperty("provider")]
        public Optional<EmbedProvider> Provider { get; set; }
        [JsonProperty("fields")]
        public Optional<EmbedField[]> Fields { get; set; }
    }
}

#pragma warning disable CS1591
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace Discord.API
{
    internal class Embed
    {
        [JsonProperty("title")]
        public string Title { get; set; }
        [JsonProperty("description")]
        public string Description { get; set; }
        [JsonProperty("url")]
        public string Url { get; set; }
        [JsonProperty("color")]
        public uint? Color { get; set; }
        [JsonProperty("type"), JsonConverter(typeof(StringEnumConverter))]
        public EmbedType Type { get; set; }
        [JsonProperty("timestamp")]
        public DateTimeOffset? Timestamp { get; set; }
        [JsonProperty("author")]
        public Optional<EmbedAuthor> Author { get; set; }
        [JsonProperty("footer")]
        public Optional<EmbedFooter> Footer { get; set; }
        [JsonProperty("video")]
        public Optional<EmbedVideo> Video { get; set; }
        [JsonProperty("thumbnail")]
        public Optional<EmbedThumbnail> Thumbnail { get; set; }
        [JsonProperty("image")]
        public Optional<EmbedImage> Image { get; set; }
        [JsonProperty("provider")]
        public Optional<EmbedProvider> Provider { get; set; }
        [JsonProperty("fields")]
        public Optional<EmbedField[]> Fields { get; set; }
    }
}

Use StringEnum converter in API model

Use StringEnum converter in API model


using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;
using Microsoft.Framework.DependencyInjection;
using Microsoft.AspNet.FileProviders;
using Microsoft.Dnx.Runtime;
using MakingSense.AspNet.Documentation;

namespace MakingSense.AspNet.HypermediaApi.Seed
{
    public class Startup
    {
        // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
        }

        public void Configure(IApplicationBuilder app, IApplicationEnvironment appEnv)
        {
            app.UseStaticFiles();

            UseDocumentation(app, appEnv);

            app.Run(async (context) =>
            {
                await context.Response.WriteAsync("Hello World!");
            });
        }

        private static void UseDocumentation(IApplicationBuilder app, IApplicationEnvironment appEnv)
        {
            var documentationFilesProvider = new PhysicalFileProvider(appEnv.ApplicationBasePath);
            app.UseDocumentation(new DocumentationOptions()
            {
                DefaultFileName = "index",
                RequestPath = "/docs",
                NotFoundHtmlFile = documentationFilesProvider.GetFileInfo("DocumentationTemplates\\NotFound.html"),
                LayoutFile = documentationFilesProvider.GetFileInfo("DocumentationTemplates\\Layout.html")
            });
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;
using Microsoft.Framework.DependencyInjection;
using Microsoft.AspNet.FileProviders;
using Microsoft.Dnx.Runtime;
using MakingSense.AspNet.Documentation;
using MakingSense.AspNet.HypermediaApi.Formatters;
using MakingSense.AspNet.HypermediaApi.ValidationFilters;

namespace MakingSense.AspNet.HypermediaApi.Seed
{
    public class Startup
    {
        // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc(options =>
            {
                options.OutputFormatters.Clear();
                options.OutputFormatters.Add(new HypermediaApiJsonOutputFormatter());

                options.InputFormatters.Clear();
                options.InputFormatters.Add(new HypermediaApiJsonInputFormatter());

                options.Filters.Add(new PayloadValidationFilter());
                options.Filters.Add(new RequiredPayloadFilter());
            });
        }

        public void Configure(IApplicationBuilder app, IApplicationEnvironment appEnv)
        {
            app.UseApiErrorHandler();

            app.UseMvc();

            app.UseStaticFiles();

            UseDocumentation(app, appEnv);

            app.UseNotFoundHandler();
        }

        private static void UseDocumentation(IApplicationBuilder app, IApplicationEnvironment appEnv)
        {
            var documentationFilesProvider = new PhysicalFileProvider(appEnv.ApplicationBasePath);
            app.UseDocumentation(new DocumentationOptions()
            {
                DefaultFileName = "index",
                RequestPath = "/docs",
                NotFoundHtmlFile = documentationFilesProvider.GetFileInfo("DocumentationTemplates\\NotFound.html"),
                LayoutFile = documentationFilesProvider.GetFileInfo("DocumentationTemplates\\Layout.html")
            });
        }
    }
}

Add NotFound and ErrorHandling middlewares

Along with MVC middleware because it is required.

This closes #7 and closes #8


using CupCake.Core.Log;
using CupCake.Messages.Receive;
using CupCake.Players;

namespace CupCake.Server.Muffins
{
    public class LogMuffin : CupCakeMuffin
    {
        protected override void Enable()
        {
            this.Events.Bind<SayPlayerEvent>(this.OnSay);
            this.Events.Bind<WriteReceiveEvent>(this.OnWrite);
            this.Events.Bind<InfoReceiveEvent>(this.OnInfo);
            this.Events.Bind<UpgradeReceiveEvent>(this.OnUpgrade);
        }

        private void OnUpgrade(object sender, UpgradeReceiveEvent e)
        {
            this.Logger.Log(LogPriority.Message, "The game has been updated.");
        }

        private void OnInfo(object sender, InfoReceiveEvent e)
        {
            this.Logger.LogPlatform.Log(e.Title, LogPriority.Message, e.Text);
        }

        private void OnWrite(object sender, WriteReceiveEvent e)
        {
            this.Logger.LogPlatform.Log(e.Title, LogPriority.Message, e.Text);
        }

        private void OnSay(object sender, SayPlayerEvent e)
        {
            this.Logger.LogPlatform.Log(e.Player.Username, LogPriority.Message, e.Player.Say);
        }
    }
}

using CupCake.Core.Log;
using CupCake.Messages.Receive;
using CupCake.Players;

namespace CupCake.Server.Muffins
{
    public class LogMuffin : CupCakeMuffin
    {
        protected override void Enable()
        {
            this.Events.Bind<SayPlayerEvent>(this.OnSay);
            this.Events.Bind<WriteReceiveEvent>(this.OnWrite);
            this.Events.Bind<InfoReceiveEvent>(this.OnInfo);
            this.Events.Bind<UpgradeReceiveEvent>(this.OnUpgrade);
        }

        private void OnUpgrade(object sender, UpgradeReceiveEvent e)
        {
            this.Logger.Log(LogPriority.Message, "The game has been updated.");
        }

        private void OnInfo(object sender, InfoReceiveEvent e)
        {
            this.Logger.Log(LogPriority.Message, e.Title);
            this.Logger.Log(LogPriority.Message, e.Text);
        }

        private void OnWrite(object sender, WriteReceiveEvent e)
        {
            this.Logger.LogPlatform.Log(e.Title, LogPriority.Message, e.Text);
        }

        private void OnSay(object sender, SayPlayerEvent e)
        {
            this.Logger.LogPlatform.Log(e.Player.Username, LogPriority.Message, e.Player.Say);
        }
    }
}

Make info messages look better

Make info messages look better


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

[RequireComponent(typeof(RoomGenerator))]
public class MainRoomSelector : MonoBehaviour {

	public float aboveMeanWidthFactor = 1.25f;
	public float aboveMeanLengthFactor = 1.25f;

	[HideInInspector]
	public List<Room> mainRooms;
	[HideInInspector]
	public List<Room> sideRooms;

	Room[] _rooms;

	public void Run()
	{
		var generator = this.GetComponent<RoomGenerator> ();
		_rooms = generator.generatedRooms;

		float meanWidth = 0f;
		float meanLength = 0f;

		foreach (var room in _rooms) {
			meanWidth += room.width;
			meanLength += room.length;
		}

		meanWidth /= _rooms.Length;
		meanLength /= _rooms.Length;

		foreach (var room in _rooms) {
			if (room.width >= meanWidth * aboveMeanWidthFactor
			    && room.length >= meanLength * aboveMeanLengthFactor)
			{
				mainRooms.Add (room);
				room.isMainRoom = true;
			} else {
				sideRooms.Add (room);
				room.isMainRoom = false;
			}
		}
	}
}

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

[RequireComponent(typeof(RoomGenerator))]
public class MainRoomSelector : MonoBehaviour {

	public float aboveMeanWidthFactor = 1.25f;
	public float aboveMeanLengthFactor = 1.25f;

	[HideInInspector]
	public List<Room> mainRooms;
	[HideInInspector]
	public List<Room> sideRooms;

	Room[] _rooms;

	public void Run()
	{
		mainRooms = new List<Room>();
		sideRooms = new List<Room>();

		var generator = this.GetComponent<RoomGenerator> ();
		_rooms = generator.generatedRooms;

		float meanWidth = 0f;
		float meanLength = 0f;

		foreach (var room in _rooms) {
			meanWidth += room.width;
			meanLength += room.length;
		}

		meanWidth /= _rooms.Length;
		meanLength /= _rooms.Length;

		foreach (var room in _rooms) {
			if (room.width >= meanWidth * aboveMeanWidthFactor
			    && room.length >= meanLength * aboveMeanLengthFactor)
			{
				mainRooms.Add (room);
				room.isMainRoom = true;
			} else {
				sideRooms.Add (room);
				room.isMainRoom = false;
			}
		}
	}
}

Reset list of main and side rooms on every selection


using System.Collections.Generic;

namespace Mollie.Api.Models.Order {
    public class OrderRefundRequest {
        /// <summary>
        /// An array of objects containing the order line details you want to create a refund for. If you send
        /// an empty array, the entire order will be refunded.
        /// </summary>
        public IEnumerable<OrderLineRequest> Lines { get; set; }

        /// <summary>
        /// The description of the refund you are creating. This will be shown to the consumer on their card or
        /// bank statement when possible. Max. 140 characters.
        /// </summary>
        public string Description { get; set; }
    }
}

using System.Collections.Generic;

namespace Mollie.Api.Models.Order {
    public class OrderRefundRequest {
        /// <summary>
        /// An array of objects containing the order line details you want to create a refund for. If you send
        /// an empty array, the entire order will be refunded.
        /// </summary>
        public IEnumerable<OrderLineDetails> Lines { get; set; }

        /// <summary>
        /// The description of the refund you are creating. This will be shown to the consumer on their card or
        /// bank statement when possible. Max. 140 characters.
        /// </summary>
        public string Description { get; set; }
    }
}

Fix for Order Lines in Order Refund

Fix for Order Lines in Order Refund


namespace TraktApiSharp.Example.UWP
{
    using Services.SettingsServices;
    using System.Threading.Tasks;
    using Template10.Controls;
    using Windows.ApplicationModel.Activation;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Data;

    [Bindable]
    sealed partial class App : Template10.Common.BootStrapper
    {
        public App()
        {
            InitializeComponent();
            SplashFactory = (e) => new Views.Splash(e);

            var settings = SettingsService.Instance;
            RequestedTheme = settings.AppTheme;
            CacheMaxDuration = settings.CacheMaxDuration;
            ShowShellBackButton = settings.UseShellBackButton;
        }

        public override async Task OnInitializeAsync(IActivatedEventArgs args)
        {
            if (Window.Current.Content as ModalDialog == null)
            {
                // create a new frame
                var nav = NavigationServiceFactory(BackButton.Attach, ExistingContent.Include);

                // create modal root
                Window.Current.Content = new ModalDialog
                {
                    DisableBackButtonWhenModal = true,
                    Content = new Views.Shell(nav),
                    ModalContent = new Views.Busy(),
                };
            }

            await Task.CompletedTask;
        }

        public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
        {
            NavigationService.Navigate(typeof(Views.MainPage));
            await Task.CompletedTask;
        }
    }
}

namespace TraktApiSharp.Example.UWP
{
    using Services.SettingsServices;
    using Services.TraktService;
    using System.Threading.Tasks;
    using Template10.Controls;
    using Windows.ApplicationModel;
    using Windows.ApplicationModel.Activation;
    using Windows.UI.Xaml;
    using Windows.UI.Xaml.Data;

    [Bindable]
    sealed partial class App : Template10.Common.BootStrapper
    {
        public App()
        {
            InitializeComponent();
            SplashFactory = (e) => new Views.Splash(e);

            var settings = SettingsService.Instance;
            RequestedTheme = settings.AppTheme;
            CacheMaxDuration = settings.CacheMaxDuration;
            ShowShellBackButton = settings.UseShellBackButton;
        }

        public override async Task OnInitializeAsync(IActivatedEventArgs args)
        {
            if (Window.Current.Content as ModalDialog == null)
            {
                // create a new frame
                var nav = NavigationServiceFactory(BackButton.Attach, ExistingContent.Include);

                // create modal root
                Window.Current.Content = new ModalDialog
                {
                    DisableBackButtonWhenModal = true,
                    Content = new Views.Shell(nav),
                    ModalContent = new Views.Busy(),
                };
            }

            await Task.CompletedTask;
        }

        public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
        {
            NavigationService.Navigate(typeof(Views.MainPage));
            await Task.CompletedTask;
        }

        public override async Task OnSuspendingAsync(object s, SuspendingEventArgs e, bool prelaunchActivated)
        {
            var authorization = TraktServiceProvider.Instance.Client.Authorization;
            SettingsService.Instance.TraktClientAuthorization = authorization;

            await Task.CompletedTask;
        }
    }
}

Save authorization information, when app is suspended.


// Copyright © 2010-2014 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

using System.Collections.Specialized;

namespace CefSharp
{
    public interface IRequest
    {
        string Url { get; set; }
        string Method { get; }
        string Body { get; }
        NameValueCollection Headers { get; set; }
        TransitionType TransitionType { get; }
    }
}

// Copyright © 2010-2014 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

using System.Collections.Specialized;

namespace CefSharp
{
    public interface IRequest
    {
        string Url { get; set; }
        string Method { get; }
        string Body { get; }
        NameValueCollection Headers { get; set; }

        /// <summary>
        /// Get the transition type for this request.
        /// Applies to requests that represent a main frame or sub-frame navigation.
        /// </summary>
        TransitionType TransitionType { get; }
    }
}

Add xml comment to TransitionType

Add xml comment to TransitionType


using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using live.asp.net.Data;
using live.asp.net.Services;
using live.asp.net.ViewModels;
using Microsoft.AspNet.Authorization;
using Microsoft.AspNet.Mvc;
using Microsoft.Data.Entity;

namespace live.asp.net.Controllers
{
    public class HomeController : Controller
    {
        private readonly AppDbContext _db;
        private readonly IShowsService _showsService;

        public HomeController(IShowsService showsService, AppDbContext dbContext)
        {
            _showsService = showsService;
            _db = dbContext;
        }

        [Route("/")]
        public async Task<IActionResult> Index(bool? disableCache, bool? useDesignData)
        {
            var liveShowDetails = await _db.LiveShowDetails.FirstOrDefaultAsync();
            var showList = await _showsService.GetRecordedShowsAsync(User, disableCache ?? false, useDesignData ?? false);

            return View(new HomeViewModel
            {
                AdminMessage = liveShowDetails?.AdminMessage,
                NextShowDate = liveShowDetails?.NextShowDate,
                LiveShowEmbedUrl = liveShowDetails?.LiveShowEmbedUrl,
                PreviousShows = showList.Shows,
                MoreShowsUrl = showList.MoreShowsUrl
            });
        }

        [HttpGet("error")]
        public IActionResult Error()
        {
            return View();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using live.asp.net.Data;
using live.asp.net.Services;
using live.asp.net.ViewModels;
using Microsoft.AspNet.Authorization;
using Microsoft.AspNet.Mvc;
using Microsoft.Data.Entity;

namespace live.asp.net.Controllers
{
    public class HomeController : Controller
    {
        private readonly AppDbContext _db;
        private readonly IShowsService _showsService;

        public HomeController(IShowsService showsService, AppDbContext dbContext)
        {
            _showsService = showsService;
            _db = dbContext;
        }

        [Route("/")]
        public async Task<IActionResult> Index(bool? disableCache, bool? useDesignData)
        {
            var liveShowDetails = await _db.LiveShowDetails.FirstOrDefaultAsync();
            var showList = await _showsService.GetRecordedShowsAsync(User, disableCache ?? false, useDesignData ?? false);

            DateTimeOffset? nextShowDateOffset = null;
            if (liveShowDetails != null)
            {
                nextShowDateOffset= TimeZoneInfo.ConvertTimeBySystemTimeZoneId(liveShowDetails.NextShowDate.Value, "Pacific Standard Time");
            }

            return View(new HomeViewModel
            {
                AdminMessage = liveShowDetails?.AdminMessage,
                NextShowDate = nextShowDateOffset,
                LiveShowEmbedUrl = liveShowDetails?.LiveShowEmbedUrl,
                PreviousShows = showList.Shows,
                MoreShowsUrl = showList.MoreShowsUrl
            });
        }

        [HttpGet("error")]
        public IActionResult Error()
        {
            return View();
        }
    }
}

Fix home page next show time

Fix home page next show time


using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace T4TS.Tests
{
    [TestClass]
    public class MemberOutputAppenderTests
    {
        [TestMethod]
        public void MemberOutputAppenderRespectsCompatibilityVersion()
        {
            var sb = new StringBuilder();

            var member = new TypeScriptInterfaceMember
            {
                Name = "Foo",
                //FullName = "Foo",
                Type = new BoolType()
            };

            var settings = new Settings();
            var appender = new MemberOutputAppender(sb, 0, settings);

            settings.CompatibilityVersion = new Version(0, 8, 3);
            appender.AppendOutput(member);
            Assert.IsTrue(sb.ToString().Contains("bool"));
            Assert.IsFalse(sb.ToString().Contains("boolean"));
            sb.Clear();

            settings.CompatibilityVersion = new Version(0, 9, 0);
            appender.AppendOutput(member);
            Assert.IsTrue(sb.ToString().Contains("boolean"));
            sb.Clear();

            settings.CompatibilityVersion = null;
            appender.AppendOutput(member);
            Assert.IsTrue(sb.ToString().Contains("boolean"));
        }
    }
}

using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace T4TS.Tests
{
    [TestClass]
    public class MemberOutputAppenderTests
    {
        [TestMethod]
        public void TypescriptVersion083YieldsBool()
        {
            var sb = new StringBuilder();
            var member = new TypeScriptInterfaceMember
            {
                Name = "Foo",
                Type = new BoolType()
            };

            var appender = new MemberOutputAppender(sb, 0, new Settings
            {
                CompatibilityVersion = new Version(0, 8, 3)
            });

            appender.AppendOutput(member);
            Assert.AreEqual("Foo: bool;", sb.ToString().Trim());
        }

        [TestMethod]
        public void TypescriptVersion090YieldsBoolean()
        {
            var sb = new StringBuilder();
            var member = new TypeScriptInterfaceMember
            {
                Name = "Foo",
                Type = new BoolType()
            };

            var appender = new MemberOutputAppender(sb, 0, new Settings
            {
                CompatibilityVersion = new Version(0, 9, 0)
            });

            appender.AppendOutput(member);
            Assert.AreEqual("Foo: boolean;", sb.ToString().Trim());
        }

        [TestMethod]
        public void DefaultTypescriptVersionYieldsBoolean()
        {
            var sb = new StringBuilder();
            var member = new TypeScriptInterfaceMember
            {
                Name = "Foo",
                Type = new BoolType()
            };

            var appender = new MemberOutputAppender(sb, 0, new Settings
            {
                CompatibilityVersion = null
            });

            appender.AppendOutput(member);
            Assert.AreEqual("Foo: boolean;", sb.ToString().Trim());
        }
    }
}

Split MemberOutputTests to separate asserts


namespace TestMoya.Runner.Runners
{
    using System;
    using System.Reflection;
    using System.Threading;
    using Moq;
    using Moya.Models;
    using Moya.Runner.Runners;
    using Xunit;

    public class TimerDecoratorTests
    {
        private readonly Mock<ITestRunner> testRunnerMock;
        private readonly TimerDecorator timerDecorator;

        public TimerDecoratorTests()
        {
            testRunnerMock = new Mock<ITestRunner>();
            timerDecorator = new TimerDecorator(testRunnerMock.Object);
        }

        [Fact]
        public void TimerDecoratorExecuteRunsMethod()
        {
            bool methodRun = false;
            MethodInfo method = ((Action)(() => methodRun = true)).Method;
            testRunnerMock
                .Setup(x => x.Execute(method))
                .Callback(() => methodRun = true)
                .Returns(new TestResult());

            timerDecorator.Execute(method);

            Assert.True(methodRun);
        }

        [Fact]
        public void TimerDecoratorExecuteAddsDurationToResult()
        {
            bool methodRun = false;
            MethodInfo method = ((Action)(() => Thread.Sleep(1))).Method;
            testRunnerMock
                .Setup(x => x.Execute(method))
                .Callback(() => methodRun = true)
                .Returns(new TestResult());

            var result = timerDecorator.Execute(method);

            Assert.True(result.Duration > 0);
        }
    }
}

namespace TestMoya.Runner.Runners
{
    using System;
    using System.Reflection;
    using Moq;
    using Moya.Attributes;
    using Moya.Models;
    using Moya.Runner.Runners;
    using Xunit;

    public class TimerDecoratorTests
    {
        private readonly Mock<ITestRunner> testRunnerMock;
        private TimerDecorator timerDecorator;

        public TimerDecoratorTests()
        {
            testRunnerMock = new Mock<ITestRunner>();
        }

        [Fact]
        public void TimerDecoratorExecuteRunsMethod()
        {
            timerDecorator = new TimerDecorator(testRunnerMock.Object);
            bool methodRun = false;
            MethodInfo method = ((Action)(() => methodRun = true)).Method;
            testRunnerMock
                .Setup(x => x.Execute(method))
                .Callback(() => methodRun = true)
                .Returns(new TestResult());

            timerDecorator.Execute(method);

            Assert.True(methodRun);
        }

        [Fact]
        public void TimerDecoratorExecuteAddsDurationToResult()
        {
            MethodInfo method = ((Action)TestClass.MethodWithMoyaAttribute).Method;
            timerDecorator = new TimerDecorator(new StressTestRunner());

            var result = timerDecorator.Execute(method);

            Assert.True(result.Duration > 0);
        }

        public class TestClass
        {
            [Stress]
            public static void MethodWithMoyaAttribute()
            {

            }
        }
    }
}

Update timerdecorator test to prevent failed test

The previous test could fail from time to time, because the duration could be 0. The Thread.Sleep(1) was never executed.


using System;
using System.Collections.Generic;
using CupCake.Protocol;

namespace CupCake.Client.Settings
{
    public class Settings
    {
        public Settings()
            : this(false)
        {
        }

        public Settings(bool isNew)
        {
            this.Accounts = new List<Account>();
            this.Profiles = new List<Profile>();
            this.RecentWorlds = new List<RecentWorld>();
            this.Databases = new List<Database>();

            if (isNew)
            {
                this.Profiles.Add(new Profile
                {
                    Id = SettingsManager.DefaultId,
                    Name = SettingsManager.DefaultString,
                    Folder = SettingsManager.ProfilesPath
                });

                this.Databases.Add(new Database
                {
                    Id = SettingsManager.DefaultId,
                    Name = SettingsManager.DefaultString,
                    Type = DatabaseType.SQLite,
                    ConnectionString = String.Format(Database.SQLiteFormat, SettingsManager.DefaultDatabasePath)
                });
            }
        }

        public List<Account> Accounts { get; set; }
        public List<Profile> Profiles { get; set; }
        public List<RecentWorld> RecentWorlds { get; set; }
        public List<Database> Databases { get; set; }

        public int LastProfileId { get; set; }
        public int LastAccountId { get; set; }
        public int LastRecentWorldId { get; set; }
        public int LastDatabaseId { get; set; }

        public string LastAttachAddress { get; set; }
        public string LastAttachPin { get; set; }
    }
}

using System;
using System.Collections.Generic;
using CupCake.Protocol;

namespace CupCake.Client.Settings
{
    public class Settings
    {
        public Settings()
            : this(false)
        {
        }

        public Settings(bool isNew)
        {
            this.Accounts = new List<Account>();
            this.Profiles = new List<Profile>();
            this.RecentWorlds = new List<RecentWorld>();
            this.Databases = new List<Database>();

            if (isNew)
            {
                this.Profiles.Add(new Profile
                {
                    Id = SettingsManager.DefaultId,
                    Name = SettingsManager.DefaultString,
                    Folder = SettingsManager.ProfilesPath,
                    Database = SettingsManager.DefaultId
                });

                this.Databases.Add(new Database
                {
                    Id = SettingsManager.DefaultId,
                    Name = SettingsManager.DefaultString,
                    Type = DatabaseType.SQLite,
                    ConnectionString = String.Format(Database.SQLiteFormat, SettingsManager.DefaultDatabasePath)
                });
            }
        }

        public List<Account> Accounts { get; set; }
        public List<Profile> Profiles { get; set; }
        public List<RecentWorld> RecentWorlds { get; set; }
        public List<Database> Databases { get; set; }

        public int LastProfileId { get; set; }
        public int LastAccountId { get; set; }
        public int LastRecentWorldId { get; set; }
        public int LastDatabaseId { get; set; }

        public string LastAttachAddress { get; set; }
        public string LastAttachPin { get; set; }
    }
}

Fix default database is not set properly the first time


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("DNSAgent")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DNSAgent")]
[assembly: AssemblyCopyright("Copyright ©  2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

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

[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM

[assembly: Guid("8424ad23-98aa-4697-a9e7-cb6d5b450c6c")]

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

[assembly: AssemblyVersion("0.1.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]

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("DNSAgent")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DNSAgent")]
[assembly: AssemblyCopyright("Copyright ©  2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

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

[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM

[assembly: Guid("8424ad23-98aa-4697-a9e7-cb6d5b450c6c")]

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

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

Change version number to 1.0.

Change version number to 1.0.


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

using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Platform;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Online.API.Requests.Responses;

namespace osu.Game.Overlays.Dashboard.Home.News
{
    public class NewsTitleLink : OsuHoverContainer
    {
        private readonly APINewsPost post;

        public NewsTitleLink(APINewsPost post)
        {
            this.post = post;

            RelativeSizeAxes = Axes.X;
            AutoSizeAxes = Axes.Y;
        }

        [BackgroundDependencyLoader]
        private void load(GameHost host)
        {
            Child = new TextFlowContainer(t =>
            {
                t.Font = OsuFont.GetFont(weight: FontWeight.Bold);
            })
            {
                RelativeSizeAxes = Axes.X,
                AutoSizeAxes = Axes.Y,
                Text = post.Title
            };

            TooltipText = "view in browser";
            Action = () => host.OpenUrlExternally("https://osu.ppy.sh/home/news/" + post.Slug);
        }
    }
}

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

using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Platform;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Online.API.Requests.Responses;

namespace osu.Game.Overlays.Dashboard.Home.News
{
    public class NewsTitleLink : OsuHoverContainer
    {
        private readonly APINewsPost post;

        public NewsTitleLink(APINewsPost post)
        {
            this.post = post;

            RelativeSizeAxes = Axes.X;
            AutoSizeAxes = Axes.Y;
        }

        [BackgroundDependencyLoader]
        private void load(GameHost host, OverlayColourProvider colourProvider)
        {
            Child = new TextFlowContainer(t =>
            {
                t.Font = OsuFont.GetFont(weight: FontWeight.Bold);
            })
            {
                RelativeSizeAxes = Axes.X,
                AutoSizeAxes = Axes.Y,
                Text = post.Title
            };

            HoverColour = colourProvider.Light1;

            TooltipText = "view in browser";
            Action = () => host.OpenUrlExternally("https://osu.ppy.sh/home/news/" + post.Slug);
        }
    }
}

Change hover colour for news title

Change hover colour for news title


using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CK.Glouton.Lucene;
using Microsoft.AspNetCore.Mvc;

namespace CK.Glouton.Web.Controllers
{
    [Route("api/stats")]
    public class StatisticsController : Controller
    {
        LuceneStatistics luceneStatistics;
        public StatisticsController()
        {

        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CK.Glouton.Lucene;
using CK.Glouton.Model.Lucene;
using Microsoft.AspNetCore.Mvc;

namespace CK.Glouton.Web.Controllers
{
    [Route("api/stats")]
    public class StatisticsController : Controller
    {
        private readonly ILuceneStatisticsService _luceneStatistics;
        public StatisticsController(ILuceneStatisticsService luceneStatistics)
        {
            _luceneStatistics = luceneStatistics;
        }

        [HttpGet("logperappname")]
        public Dictionary<string, int> LogPerAppName()
        {
            return _luceneStatistics.GetLogByAppName();
        }

        [HttpGet("exceptionperappname")]
        public Dictionary<string, int> ExceptionPerAppName()
        {
            return _luceneStatistics.GetExceptionByAppName();
        }

        [HttpGet("Log")]
        public int AllLogCount() => _luceneStatistics.AllLogCount();

        [HttpGet("AppName")]
        public int AppNameCount() => _luceneStatistics.AppNameCount;

        [HttpGet("Exception")]
        public int AllException() => _luceneStatistics.AllExceptionCount;

        [HttpGet("AppNames")]
        public IEnumerable<string> AppNames() => _luceneStatistics.GetAppNames;
    }
}

Add api point to controller.

Add api point to controller.


using NSubstitute;
using Ploeh.AutoFixture.Xunit;
using TeamCityApi.Domain;
using TeamCityConsole.Tests.Helpers;
using TeamCityConsole.Utils;
using Xunit.Extensions;

namespace TeamCityConsole.Tests.Utils
{
    public class FileDownloaderTests
    {
        [Theory]
        [AutoNSubstituteData]
        public void Should_unzip_when_double_star_used([Frozen]IFileSystem fileSystem, FileDownloader downloader)
        {
            var file = new File() { Name = "web.zip!**", ContentHref = ""};

            string tempFile = @"c:\temp\abc.tmp";

            fileSystem.CreateTempFile().Returns(tempFile);

            downloader.Download(@"c:\temp", file).Wait();

            fileSystem.Received().ExtractToDirectory(tempFile, @"c:\temp");
        }

        [Theory]
        [AutoNSubstituteData]
        public void Should_delete_target_directory_when_unziping([Frozen]IFileSystem fileSystem, FileDownloader downloader)
        {
            var file = new File() { Name = "web.zip!**", ContentHref = "" };

            var destPath = @"c:\temp";

            fileSystem.DirectoryExists(destPath).Returns(true);

            downloader.Download(destPath, file).Wait();

            fileSystem.Received().DeleteDirectory(destPath, true);
        }
    }
}

using NSubstitute;
using Ploeh.AutoFixture.Xunit;
using TeamCityApi.Domain;
using TeamCityConsole.Tests.Helpers;
using TeamCityConsole.Utils;
using Xunit.Extensions;

namespace TeamCityConsole.Tests.Utils
{
    public class FileDownloaderTests
    {
        [Theory]
        [AutoNSubstituteData]
        public void Should_unzip_when_double_star_used([Frozen]IFileSystem fileSystem, FileDownloader downloader)
        {
            var file = new File() { Name = "web.zip!**", ContentHref = ""};

            string tempFile = @"c:\temp\abc.tmp";

            fileSystem.CreateTempFile().Returns(tempFile);

            downloader.Download(@"c:\temp", file).Wait();

            fileSystem.Received().ExtractToDirectory(tempFile, @"c:\temp");
        }
    }
}

Remove invalid test as the directory should not be deleted since multiple artifacts / dependencies maybe be unzipping into a folder or a child folder.


using System.ComponentModel;
using DesktopWidgets.Classes;

namespace DesktopWidgets.Widgets.Search
{
    public class Settings : WidgetSettingsBase
    {
        public Settings()
        {
            Width = 150;
        }

        [Category("General")]
        [DisplayName("Base URL")]
        public string BaseUrl { get; set; }

        [Category("General")]
        [DisplayName("URL Suffix")]
        public string URLSuffix { get; set; }
    }
}

using System.ComponentModel;
using DesktopWidgets.Classes;

namespace DesktopWidgets.Widgets.Search
{
    public class Settings : WidgetSettingsBase
    {
        public Settings()
        {
            Width = 150;
        }

        [Category("General")]
        [DisplayName("URL Prefix")]
        public string BaseUrl { get; set; } = "http://";

        [Category("General")]
        [DisplayName("URL Suffix")]
        public string URLSuffix { get; set; }
    }
}

Change "Search" widget "Base URL" default value


using UnityEngine;
using System.Collections;

public class TriggerSound : MonoBehaviour
{
    public string tagName1="";
    public string tagName2 = "";
    public AudioClip triggerSound;
    public float soundVolume = 1.0f;

    private AudioSource triggerAudioSource;

    void Awake()
    {
        InitSound(out triggerAudioSource, triggerSound, soundVolume, false);
    }

    void InitSound(out AudioSource myAudioSource, AudioClip myClip, float myVolume, bool looping)
    {
        myAudioSource = gameObject.AddComponent("AudioSource") as AudioSource;
        myAudioSource.playOnAwake = false;
        myAudioSource.clip = myClip;
        myAudioSource.loop = looping;
        myAudioSource.volume = myVolume;
        //myAudioSource.rolloffMode = AudioRolloffMode.Linear;
    }

    void OnTriggerEnter(Collider other)
    {
        //if (other.gameObject.tag == tagName1 || other.gameObject.tag == tagName2) //2013-08-02
        if (other.gameObject.CompareTag(tagName1) || other.gameObject.CompareTag(tagName2)) //2013-08-02
        {
			if (other.gameObject.layer != 2) //2011-12-27
            	triggerAudioSource.Play();
        }

    }

}

using UnityEngine;
using System.Collections;

public class TriggerSound : MonoBehaviour {
    public string tagName1 = "";
    public string tagName2 = "";
    public AudioClip triggerSound;
    public float soundVolume = 1.0f;
    private AudioSource triggerAudioSource;

    void Awake() {
        InitSound(out triggerAudioSource, triggerSound, soundVolume, false);
    }

    void InitSound(out AudioSource audioSource, AudioClip clip, float volume, bool looping) {
        audioSource = gameObject.AddComponent("AudioSource") as AudioSource;
        audioSource.playOnAwake = false;
        audioSource.clip = clip;
        audioSource.loop = looping;
        audioSource.volume = (float)GameProfiles.Current.GetAudioEffectsVolume();
        //myAudioSource.rolloffMode = AudioRolloffMode.Linear;
    }

    void OnTriggerEnter(Collider other) {
        //if (other.gameObject.tag == tagName1 || other.gameObject.tag == tagName2) //2013-08-02
        if (other.gameObject.CompareTag(tagName1) || other.gameObject.CompareTag(tagName2)) { //2013-08-02
            if (other.gameObject.layer != 2) //2011-12-27
                triggerAudioSource.Play();
        }

    }

}

Update shadows. Update results screen. Update throttling speed modifier within safe range.


// Copyright (C) Pash Contributors. License: GPL/BSD. See https://github.com/Pash-Project/Pash/
using System.Management.Automation.Host;
using System.Xml.Schema;
using Pash.Implementation;

namespace System.Management.Automation.Internal
{
    public abstract class InternalCommand
    {
        internal CommandInfo CommandInfo { get; set; }
        internal PSHost PSHostInternal { get; private set; }
        internal PSObject CurrentPipelineObject { get; set; }
        internal SessionState State { get; private set; }
        internal ICommandRuntime CommandRuntime { get; set; }

        private ExecutionContext _executionContext;
        internal ExecutionContext ExecutionContext
        {
            get
            {
                return _executionContext;
            }
            set
            {
                _executionContext = value;
                State = new SessionState(_executionContext.SessionState.SessionStateGlobal);
                PSHostInternal = _executionContext.LocalHost;
            }
        }

        internal bool IsStopping
        {
            get
            {
                return ((PipelineCommandRuntime)CommandRuntime).IsStopping;
            }
        }

        internal InternalCommand() { }

        internal virtual void DoBeginProcessing() { }

        internal virtual void DoEndProcessing() { }

        internal virtual void DoProcessRecord() { }

        internal virtual void DoStopProcessing() { }

        internal void ThrowIfStopping() { }
    }
}

// Copyright (C) Pash Contributors. License: GPL/BSD. See https://github.com/Pash-Project/Pash/
using System.Management.Automation.Host;
using System.Xml.Schema;
using Pash.Implementation;

namespace System.Management.Automation.Internal
{
    public abstract class InternalCommand
    {
        internal CommandInfo CommandInfo { get; set; }
        internal PSHost PSHostInternal { get; private set; }
        internal PSObject CurrentPipelineObject { get; set; }
        internal SessionState State { get; private set; }
        public ICommandRuntime CommandRuntime { get; set; }

        private ExecutionContext _executionContext;
        internal ExecutionContext ExecutionContext
        {
            get
            {
                return _executionContext;
            }
            set
            {
                _executionContext = value;
                State = new SessionState(_executionContext.SessionState.SessionStateGlobal);
                PSHostInternal = _executionContext.LocalHost;
            }
        }

        internal bool IsStopping
        {
            get
            {
                return ((PipelineCommandRuntime)CommandRuntime).IsStopping;
            }
        }

        internal InternalCommand() { }

        internal virtual void DoBeginProcessing() { }

        internal virtual void DoEndProcessing() { }

        internal virtual void DoProcessRecord() { }

        internal virtual void DoStopProcessing() { }

        internal void ThrowIfStopping() { }
    }
}

Allow the CommandRuntime to be set for a cmdlet.

The CommandRuntime property should probably be moved to the Cmdlet class.

http://msdn.microsoft.com/en-us/library/system.management.automation.cmdlet_properties.aspx


using System;
using System.Collections.Generic;
using RepoZ.Api.IO;

namespace RepoZ.Api.Mac
{
	public class MacPathActionProvider : IPathActionProvider
	{
		public IEnumerable<PathAction> GetFor(string path)
		{
			yield return createPathAction("Open", "nil");
		}

		private PathAction createPathAction(string name, string command)
		{
			return new PathAction()
			{
				Name = name,
				Action = (sender, args) => sender = null
			};
		}

		private PathAction createDefaultPathAction(string name, string command)
		{
			var action = createPathAction(name, command);
			action.IsDefault = true;
			return action;
		}
	}
}

using System.Diagnostics;
using System.Collections.Generic;
using RepoZ.Api.IO;

namespace RepoZ.Api.Mac
{
	public class MacPathActionProvider : IPathActionProvider
	{
		public IEnumerable<PathAction> GetFor(string path)
		{
			yield return createDefaultPathAction("Open in Finder", path);
		}

		private PathAction createPathAction(string name, string command)
		{
			return new PathAction()
			{
				Name = name,
				Action = (sender, args) => startProcess(command)
			};
		}

		private PathAction createDefaultPathAction(string name, string command)
		{
			var action = createPathAction(name, command);
			action.IsDefault = true;
			return action;
		}

		private void startProcess(string command)
		{
			Process.Start(command);
		}
	}
}

Add default path action provider for Mac


namespace Nancy.AttributeRouting
{
    using System;
    using System.Reflection;

    /// <summary>
    /// The View attribute indicates the view path to render from request.
    /// </summary>
    /// <example>
    /// The following code will render <c>View/index.html</c> with routing instance.
    /// <code>
    /// View('View/index.html')
    /// </code>
    /// </example>
    [AttributeUsage(AttributeTargets.Method)]
    public class ViewAttribute : Attribute
    {
        private readonly string path;

        /// <summary>
        /// Initializes a new instance of the <see cref="ViewAttribute"/> class.
        /// </summary>
        /// <param name="path">The view path for rendering.</param>
        public ViewAttribute(string path)
        {
            this.path = path.Trim('/');
        }

        internal static string GetPath(MethodBase method)
        {
            var attr = method.GetCustomAttribute<ViewAttribute>(false);
            if (attr == null)
            {
                return string.Empty;
            }

            string prefix = ViewPrefixAttribute.GetPrefix(method.DeclaringType);
            string path = string.Format("{0}/{1}", prefix, attr.path);

            return path;
        }
    }
}

namespace Nancy.AttributeRouting
{
    using System;
    using System.Reflection;

    /// <summary>
    /// The View attribute indicates the view path to render from request.
    /// </summary>
    /// <example>
    /// The following code will render <c>View/index.html</c> with routing instance.
    /// <code>
    /// View('View/index.html')
    /// </code>
    /// </example>
    [AttributeUsage(AttributeTargets.Method)]
    public class ViewAttribute : Attribute
    {
        private readonly string path;

        /// <summary>
        /// Initializes a new instance of the <see cref="ViewAttribute"/> class.
        /// </summary>
        /// <param name="path">The view path for rendering.</param>
        public ViewAttribute(string path)
        {
            this.path = path.Trim('/');
        }

        internal static string GetPath(MethodBase method)
        {
            var attr = method.GetCustomAttribute<ViewAttribute>(false);
            if (attr == null)
            {
                return string.Empty;
            }

            string prefix = ViewPrefixAttribute.GetPrefix(method.DeclaringType);
            string path = string.Format("{0}/{1}", prefix, attr.path).Trim('/');

            return path;
        }
    }
}

Fix the failing test case.

Fix the failing test case.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

using WindowsInput;

namespace TargetClicker
{
    /// <summary>
    /// MainWindow.xaml の相互作用ロジック
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void clickButtonClick(object sender, RoutedEventArgs e)
        {
            var sim = new InputSimulator();
            sim.Mouse.MoveMouseTo(0, 0);
            sim.Mouse.RightButtonClick();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

using WindowsInput;
using NHotkey;
using NHotkey.Wpf;

namespace TargetClicker
{
    /// <summary>
    /// MainWindow.xaml の相互作用ロジック
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            HotkeyManager.Current.AddOrReplace("clickTarget", Key.D1 , ModifierKeys.Control | ModifierKeys.Alt, clickTarget);
        }

        private void clickButtonClick(object sender, RoutedEventArgs e)
        {
            var sim = new InputSimulator();
            sim.Mouse.MoveMouseTo(0, 0);
            sim.Mouse.RightButtonClick();
        }

        private void clickTarget(object sender, HotkeyEventArgs e)
        {
            var sim = new InputSimulator();
            sim.Mouse.MoveMouseTo(0, 0);
            sim.Mouse.RightButtonClick();
        }
    }
}

Add right click by a short cut key comination


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using AgateLib;

namespace Tests
{
	class Launcher
	{
		[STAThread]
		public static void Main(string[] args)
		{
			AgateFileProvider.Assemblies.AddPath("../Drivers");
			AgateFileProvider.Images.AddPath("Data");

			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);
			Application.Run(new frmLauncher());
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using AgateLib;

namespace Tests
{
	class Launcher
	{
		[STAThread]
		public static void Main(string[] args)
		{
			AgateFileProvider.Images.AddPath("Data");

			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);
			Application.Run(new frmLauncher());
		}
	}
}

Fix test launcher to not use Drivers directory.


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

namespace Schedutalk.Logic
{
    class HttpRequestor
    {
        public async Task<string> getHttpRequestAsString(Func<string, HttpRequestMessage> requestTask, string input)
        {
            HttpClient httpClient = new HttpClient();
            HttpRequestMessage request = requestTask(input);
            var response = httpClient.SendAsync(request);

            var result = await response.Result.Content.ReadAsStringAsync();
            return result;
        }

    }
}

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

namespace Schedutalk.Logic
{
    class HttpRequestor
    {
        public async Task<string> getHttpRequestAsString(Func<string, HttpRequestMessage> requestTask, string input)
        {
            HttpClient httpClient = new HttpClient();
            HttpRequestMessage request = requestTask(input);
            var response = httpClient.SendAsync(request);

            var result = await response.Result.Content.ReadAsStringAsync();
            return result;
        }

        public string getJSONAsString(Func<string, HttpRequestMessage> requestTask, string placeName)
        {
            Task<string> task = getHttpRequestAsString(requestTask, "E2");

            task.Wait();
            //Format string
            string replacement = task.Result;
            if (0 == replacement[0].CompareTo('[')) replacement = replacement.Substring(1);
            if (0 == replacement[replacement.Length - 1].CompareTo(']')) replacement = replacement.Remove(replacement.Length - 1);

            return replacement;
        }
    }
}

Implement utlity for requesting JSON as string


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

namespace System.Net.Http
{
    /// <summary>
    /// Defines default values for http handler properties which is meant to be re-used across WinHttp & UnixHttp Handlers
    /// </summary>
    internal static class HttpHandlerDefaults
    {
        public const int DefaultMaxAutomaticRedirections = 50;
        public const DecompressionMethods DefaultAutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
        public const bool DefaultAutomaticRedirection = true;
        public const bool DefaultUseCookies = true;
        public const bool DefaultPreAuthenticate = false;
    }
}

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

namespace System.Net.Http
{
    /// <summary>
    /// Defines default values for http handler properties which is meant to be re-used across WinHttp and UnixHttp Handlers
    /// </summary>
    internal static class HttpHandlerDefaults
    {
        public const int DefaultMaxAutomaticRedirections = 50;
        public const DecompressionMethods DefaultAutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate;
        public const bool DefaultAutomaticRedirection = true;
        public const bool DefaultUseCookies = true;
        public const bool DefaultPreAuthenticate = false;
    }
}

Fix XML docs containing an ampersand

Fix XML docs containing an ampersand


//******************************************************************************************************
//  Setting.cs - Gbtc
//
//  Copyright © 2021, Grid Protection Alliance.  All Rights Reserved.
//
//  Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
//  the NOTICE file distributed with this work for additional information regarding copyright ownership.
//  The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this
//  file except in compliance with the License. You may obtain a copy of the License at:
//
//      http://opensource.org/licenses/MIT
//
//  Unless agreed to in writing, the subject software distributed under the License is distributed on an
//  "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
//  License for the specific language governing permissions and limitations.
//
//  Code Modification History:
//  ----------------------------------------------------------------------------------------------------
//  06/09/2021 - Billy Ernest
//       Generated original version of source code.
//
//******************************************************************************************************

using GSF.Data.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SystemCenter.Model
{
    [ConfigFileTableNamePrefix, TableName("SystemCenter.Setting"), UseEscapedName, AllowSearch]
    [PostRoles("Administrator")]
    [DeleteRoles("Administrator")]
    [PatchRoles("Administrator")]
    public class Setting: openXDA.Model.Setting {}
}

//******************************************************************************************************
//  Setting.cs - Gbtc
//
//  Copyright © 2021, Grid Protection Alliance.  All Rights Reserved.
//
//  Licensed to the Grid Protection Alliance (GPA) under one or more contributor license agreements. See
//  the NOTICE file distributed with this work for additional information regarding copyright ownership.
//  The GPA licenses this file to you under the MIT License (MIT), the "License"; you may not use this
//  file except in compliance with the License. You may obtain a copy of the License at:
//
//      http://opensource.org/licenses/MIT
//
//  Unless agreed to in writing, the subject software distributed under the License is distributed on an
//  "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. Refer to the
//  License for the specific language governing permissions and limitations.
//
//  Code Modification History:
//  ----------------------------------------------------------------------------------------------------
//  06/09/2021 - Billy Ernest
//       Generated original version of source code.
//
//******************************************************************************************************

using GSF.Data.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SystemCenter.Model
{
    [TableName("SystemCenter.Setting"), UseEscapedName, AllowSearch]
    [PostRoles("Administrator")]
    [DeleteRoles("Administrator")]
    [PatchRoles("Administrator")]
    public class Setting: openXDA.Model.Setting {}
}

Remove configfile prefix from settings file and let tablename drive naming.