using System;

using HtmlAgilityPack;

namespace ReverseMarkdown.Converters
{
	public class Ol
		: ConverterBase
	{
		public Ol(Converter converter)
			: base(converter)
		{
			this.Converter.Register("ol", this);
			this.Converter.Register("ul", this);
		}

		public override string Convert(HtmlNode node)
		{
			return Environment.NewLine + this.TreatChildren(node);
		}
	}
}

using System;

using HtmlAgilityPack;

namespace ReverseMarkdown.Converters
{
	public class Ol
		: ConverterBase
	{
		public Ol(Converter converter)
			: base(converter)
		{
			this.Converter.Register("ol", this);
			this.Converter.Register("ul", this);
		}

		public override string Convert(HtmlNode node)
		{
			return Environment.NewLine + this.TreatChildren(node) + Environment.NewLine;
		}
	}
}

Add NewLine at the end of the list

Add NewLine at the end of the list


namespace TraktApiSharp.Objects.Get.Shows.Episodes
{
    using Basic;

    /// <summary>A collection of ids for various web services, including the Trakt id, for a Trakt episode.</summary>
    public class TraktEpisodeIds : TraktIds
    {

    }
}

namespace TraktApiSharp.Objects.Get.Shows.Episodes
{
    using Attributes;
    using Newtonsoft.Json;

    /// A collection of ids for various web services, including the Trakt id, for a Trakt episode.
    public class TraktEpisodeIds
    {
        /// Gets or sets the Trakt numeric id.
        [JsonProperty(PropertyName = "trakt")]
        public int Trakt { get; set; }

        /// Gets or sets the numeric id from thetvdb.com
        [JsonProperty(PropertyName = "tvdb")]
        public int? Tvdb { get; set; }

        /// Gets or sets the id from imdb.com<para>Nullable</para>
        [JsonProperty(PropertyName = "imdb")]
        [Nullable]
        public string Imdb { get; set; }

        /// Gets or sets the numeric id from themoviedb.org
        [JsonProperty(PropertyName = "tmdb")]
        public int? Tmdb { get; set; }

        /// Gets or sets the numeric id from tvrage.com
        [JsonProperty(PropertyName = "tvrage")]
        public int? TvRage { get; set; }

        /// Returns, whether any id has been set.
        [JsonIgnore]
        public bool HasAnyId => Trakt > 0 || Tvdb > 0 || !string.IsNullOrEmpty(Imdb) || Tmdb > 0 || TvRage > 0;

        /// Gets the most reliable id from those that have been set.
        /// <returns>The id as a string or an empty string, if no id is set.</returns>
        public string GetBestId()
        {
            if (Trakt > 0)
                return Trakt.ToString();

            if (Tvdb.HasValue && Tvdb.Value > 0)
                return Tvdb.Value.ToString();

            if (!string.IsNullOrEmpty(Imdb))
                return Imdb;

            if (Tmdb.HasValue && Tmdb.Value > 0)
                return Tmdb.Value.ToString();

            if (TvRage.HasValue && TvRage.Value > 0)
                return TvRage.Value.ToString();

            return string.Empty;
        }
    }
}

Remove slug from episode ids.

Remove slug from episode ids.


using NUnit.Framework;

namespace NSubstitute.Acceptance.Specs
{
	[TestFixture]
	public class MatchingDerivedTypesForGenerics
	{
		IGenMethod _sub;

		[SetUp]
		public void Setup()
		{
			_sub = Substitute.For<IGenMethod>();
		}

		[Test]
		public void Calls_to_generic_types_with_derived_parameters_should_be_matched ()
		{
			_sub.Call(new GMParam1());
			_sub.Call(new GMParam2());

			_sub.Received(2).Call(Arg.Any<IGMParam>());
		}

		public interface IGenMethod
		{
			void Call<T>(T param) where T : IGMParam;
		}
		public interface IGMParam { }
		public class GMParam1 : IGMParam { }
		public class GMParam2 : IGMParam { }
	}

}

using NUnit.Framework;

namespace NSubstitute.Acceptance.Specs
{
	[TestFixture]
	public class MatchingDerivedTypesForGenerics
	{
		IGenMethod _sub;

		[SetUp]
		public void Setup()
		{
			_sub = Substitute.For<IGenMethod>();
		}

		[Test]
		public void Calls_to_generic_types_with_derived_parameters_should_be_matched ()
		{
			_sub.Call(new GMParam1());
			_sub.Call(new GMParam2());

			_sub.Received(2).Call(Arg.Any<IGMParam>());
		}

		public interface IGenMethod
		{
			void Call<T>(T param) where T : IGMParam;
		}
		public interface IGMParam { }
		public class GMParam1 : IGMParam { }
		public class GMParam2 : IGMParam { }
	}

	[TestFixture]
	public class Calls_to_members_on_generic_interface
	{
		[Test]
		public void Calls_to_members_on_generic_interfaces_match_based_on_type_compatibility()
		{
			var sub = Substitute.For<IGenInterface<IGMParam>>();
			sub.Call(new GMParam1());
			sub.Call(new GMParam2());
			sub.Call(new GMParam3());

			sub.Received(2).Call(Arg.Any<IGMParam>());
			sub.Received(1).Call(Arg.Any<GMParam3>());
		}

		public interface IGenInterface<T>
		{
			void Call(T param);
			void Call(GMParam3 param);
		}

		public interface IGMParam { }
		public class GMParam1 : IGMParam { }
		public class GMParam2 : IGMParam { }
		public class GMParam3 { }

	}

}

Test demonstrating an edge case of generic interfaces


using LunaClient.Base;
using LunaClient.Base.Interface;
using LunaClient.Network;
using LunaCommon.Message.Client;
using LunaCommon.Message.Data.Vessel;
using LunaCommon.Message.Interface;
using System;

namespace LunaClient.Systems.VesselRemoveSys
{
    public class VesselRemoveMessageSender : SubSystem<VesselRemoveSystem>, IMessageSender
    {
        public void SendMessage(IMessageData msg)
        {
            TaskFactory.StartNew(() => NetworkSender.QueueOutgoingMessage(MessageFactory.CreateNew<VesselCliMsg>(msg))); ;
        }

        /// <summary>
        /// Sends a vessel remove to the server
        /// </summary>
        public void SendVesselRemove(Guid vesselId, bool keepVesselInRemoveList = true)
        {
            LunaLog.Log($"[LMP]: Removing {vesselId} from the server");
            var msgData = NetworkMain.CliMsgFactory.CreateNewMessageData<VesselRemoveMsgData>();
            msgData.VesselId = vesselId;
            msgData.AddToKillList = true;

            SendMessage(msgData);
        }
    }
}

using LunaClient.Base;
using LunaClient.Base.Interface;
using LunaClient.Network;
using LunaCommon.Message.Client;
using LunaCommon.Message.Data.Vessel;
using LunaCommon.Message.Interface;
using System;

namespace LunaClient.Systems.VesselRemoveSys
{
    public class VesselRemoveMessageSender : SubSystem<VesselRemoveSystem>, IMessageSender
    {
        public void SendMessage(IMessageData msg)
        {
            TaskFactory.StartNew(() => NetworkSender.QueueOutgoingMessage(MessageFactory.CreateNew<VesselCliMsg>(msg))); ;
        }

        /// <summary>
        /// Sends a vessel remove to the server. If keepVesselInRemoveList is set to true, the vessel will be removed for good and the server
        /// will skip future updates related to this vessel
        /// </summary>
        public void SendVesselRemove(Guid vesselId, bool keepVesselInRemoveList = true)
        {
            LunaLog.Log($"[LMP]: Removing {vesselId} from the server");
            var msgData = NetworkMain.CliMsgFactory.CreateNewMessageData<VesselRemoveMsgData>();
            msgData.VesselId = vesselId;
            msgData.AddToKillList = keepVesselInRemoveList;

            SendMessage(msgData);
        }
    }
}

Fix when reverting a vessel so they are not fully removed from server


using System;
using ValveResourceFormat.Serialization;

namespace GUI.Types.ParticleRenderer.Emitters
{
    public class InstantaneousEmitter : IParticleEmitter
    {
        public bool IsFinished { get; private set; }

        private readonly IKeyValueCollection baseProperties;

        private Action particleEmitCallback;

        private INumberProvider emitCount;
        private float startTime;

        private float time;

        public InstantaneousEmitter(IKeyValueCollection baseProperties, IKeyValueCollection keyValues)
        {
            this.baseProperties = baseProperties;

            emitCount = keyValues.GetNumberProvider("m_nParticlesToEmit");
            startTime = keyValues.GetFloatProperty("m_flStartTime");
        }

        public void Start(Action particleEmitCallback)
        {
            this.particleEmitCallback = particleEmitCallback;

            IsFinished = false;

            time = 0;
        }

        public void Stop()
        {
        }

        public void Update(float frameTime)
        {
            time += frameTime;

            if (!IsFinished && time >= startTime)
            {
                var numToEmit = emitCount.NextInt(); // Get value from number provider
                for (var i = 0; i < numToEmit; i++)
                {
                    particleEmitCallback();
                }

                IsFinished = true;
            }
        }
    }
}

using System;
using ValveResourceFormat.Serialization;

namespace GUI.Types.ParticleRenderer.Emitters
{
    public class InstantaneousEmitter : IParticleEmitter
    {
        public bool IsFinished { get; private set; }

        private readonly IKeyValueCollection baseProperties;

        private Action particleEmitCallback;

        private INumberProvider emitCount;
        private INumberProvider startTime;

        private float time;

        public InstantaneousEmitter(IKeyValueCollection baseProperties, IKeyValueCollection keyValues)
        {
            this.baseProperties = baseProperties;

            emitCount = keyValues.GetNumberProvider("m_nParticlesToEmit");
            startTime = keyValues.GetNumberProvider("m_flStartTime");
        }

        public void Start(Action particleEmitCallback)
        {
            this.particleEmitCallback = particleEmitCallback;

            IsFinished = false;

            time = 0;
        }

        public void Stop()
        {
        }

        public void Update(float frameTime)
        {
            time += frameTime;

            if (!IsFinished && time >= startTime.NextNumber())
            {
                var numToEmit = emitCount.NextInt(); // Get value from number provider
                for (var i = 0; i < numToEmit; i++)
                {
                    particleEmitCallback();
                }

                IsFinished = true;
            }
        }
    }
}

Use number provider for m_flStartTime

Use number provider for m_flStartTime


namespace LanguageServer
{
    //using Options;
    using System;
    using System.Collections.Generic;
    using System.Reflection;

    public class ManualAssemblyResolver : IDisposable
    {

        private readonly List<Assembly> _assemblies;

        public ManualAssemblyResolver()
        {
            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(OnAssemblyResolve);
            _assemblies = new List<Assembly>();
        }

        public void Add(Assembly assembly)
        {
            _assemblies.Add(assembly);
        }

        public ManualAssemblyResolver(Assembly assembly)
        {
            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(OnAssemblyResolve);
            if (assembly == null)
            {
                throw new ArgumentNullException("assembly");
            }

            _assemblies = new List<Assembly>
            {
                assembly
            };
        }

        public void Dispose()
        {
            AppDomain.CurrentDomain.AssemblyResolve -= OnAssemblyResolve;
        }

        private Assembly OnAssemblyResolve(object sender, ResolveEventArgs args)
        {
            foreach (Assembly assembly in _assemblies)
            {
                if (args.Name == assembly.FullName)
                {
                    return assembly;
                }
            }

            return null;
        }
    }

    public class GrammarDescriptionFactory
    {
        private static readonly IGrammarDescription _antlr = new AntlrGrammarDescription();
        public static List<string> AllLanguages
        {
            get
            {
                List<string> result = new List<string>
                {
                    _antlr.Name
                };
                return result;
            }
        }

        public static IGrammarDescription Create(string ffn)
        {
            if (_antlr.IsFileType(ffn))
            {
                return _antlr;
            }
            return null;
        }
    }
}

namespace LanguageServer
{
    //using Options;
    using System;
    using System.Collections.Generic;
    using System.Reflection;

    public class GrammarDescriptionFactory
    {
        private static readonly IGrammarDescription _antlr = new AntlrGrammarDescription();
        public static List<string> AllLanguages
        {
            get
            {
                List<string> result = new List<string>
                {
                    _antlr.Name
                };
                return result;
            }
        }

        public static IGrammarDescription Create(string ffn)
        {
            if (_antlr.IsFileType(ffn))
            {
                return _antlr;
            }
            return null;
        }
    }
}

Clean up---cannot utilize dynamic loading of dll in VS.


// -----------------------------------------------------------------------
// <copyright file="Program.cs" company="(none)">
//   Copyright © 2013 John Gietzen.  All Rights Reserved.
//   This source is subject to the MIT license.
//   Please see license.txt for more information.
// </copyright>
// -----------------------------------------------------------------------

namespace Weave
{
    internal class Program
    {
        private static void Main(string[] args)
        {
        }
    }
}

// -----------------------------------------------------------------------
// <copyright file="Program.cs" company="(none)">
//   Copyright © 2013 John Gietzen.  All Rights Reserved.
//   This source is subject to the MIT license.
//   Please see license.txt for more information.
// </copyright>
// -----------------------------------------------------------------------

namespace Weave
{
    using System;
    using System.IO;
    using Weave.Parser;

    internal class Program
    {
        private static void Main(string[] args)
        {
            var input = File.ReadAllText(args[0]);
            var parser = new WeaveParser();
            var output = parser.Parse(input);
            Console.WriteLine(output);
        }
    }
}

Set up the basic program structure.

Set up the basic program structure.


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

// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("NDeproxy")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("Rackspace")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("0.17.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

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

// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("NDeproxy")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("2014 Rackspace")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("0.17.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

Add year to copyright attribute.

Add year to copyright attribute.


namespace Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.Implementation
{
    using System;

    using Microsoft.ApplicationInsights.Channel;

    /// <summary>
    /// Utility class for sampling score generation.
    /// </summary>
    internal static class SamplingScoreGenerator
    {
        /// <summary>
        /// Generates telemetry sampling score between 0 and 100.
        /// </summary>
        /// <param name="telemetry">Telemetry item to score.</param>
        /// <returns>Item sampling score.</returns>
        public static double GetSamplingScore(ITelemetry telemetry)
        {
            double samplingScore = 0;

            if (telemetry.Context.User.Id != null)
            {
                samplingScore = (double)telemetry.Context.User.Id.GetSamplingHashCode() / int.MaxValue;
            }
            else if (telemetry.Context.Operation.Id != null)
            {
                samplingScore = (double)telemetry.Context.Operation.Id.GetSamplingHashCode() / int.MaxValue;
            }
            else
            {
                samplingScore = (double)WeakConcurrentRandom.Instance.Next() / ulong.MaxValue;
            }

            return samplingScore * 100;
        }

        internal static int GetSamplingHashCode(this string input)
        {
            if (input == null)
            {
                return 0;
            }

            while (input.Length < 8)
            {
                input = input + input;
            }

            int hash = 5381;

            for (int i = 0; i < input.Length; i++)
            {
                hash = ((hash << 5) + hash) + (int)input[i];
            }

            return hash == int.MinValue ? int.MaxValue : Math.Abs(hash);
        }
    }
}

namespace Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.Implementation
{
    using System;

    using Microsoft.ApplicationInsights.Channel;

    /// <summary>
    /// Utility class for sampling score generation.
    /// </summary>
    internal static class SamplingScoreGenerator
    {
        /// <summary>
        /// Generates telemetry sampling score between 0 and 100.
        /// </summary>
        /// <param name="telemetry">Telemetry item to score.</param>
        /// <returns>Item sampling score.</returns>
        public static double GetSamplingScore(ITelemetry telemetry)
        {
            double samplingScore = 0;

            if (telemetry.Context.User.Id != null)
            {
                samplingScore = (double)telemetry.Context.User.Id.GetSamplingHashCode() / int.MaxValue;
            }
            else if (telemetry.Context.Operation.Id != null)
            {
                samplingScore = (double)telemetry.Context.Operation.Id.GetSamplingHashCode() / int.MaxValue;
            }
            else
            {
                samplingScore = (double)WeakConcurrentRandom.Instance.Next() / ulong.MaxValue;
            }

            return samplingScore * 100;
        }

        internal static int GetSamplingHashCode(this string input)
        {
            if (string.IsNullOrEmpty(input))
            {
                return 0;
            }

            while (input.Length < 8)
            {
                input = input + input;
            }

            int hash = 5381;

            for (int i = 0; i < input.Length; i++)
            {
                hash = ((hash << 5) + hash) + (int)input[i];
            }

            return hash == int.MinValue ? int.MaxValue : Math.Abs(hash);
        }
    }
}

Fix null check to use string.IsNullOrEmpty. Even though unlikely, if a string.empty is passed as input it will result in an infinite loop.


using System;
using Castle.MicroKernel.Registration;
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Windsor;
using Castle.MicroKernel.Resolvers.SpecializedResolvers;

namespace AppHarbor
{
	public class AppHarborInstaller : IWindsorInstaller
	{
		public void Install(IWindsorContainer container, IConfigurationStore store)
		{
			container.Kernel.Resolver.AddSubResolver(new CollectionResolver(container.Kernel));

			container.Register(AllTypes
				.FromThisAssembly()
				.BasedOn<ICommand>()
				.WithService.AllInterfaces());

			container.Register(Component
				.For<AccessTokenConfiguration>());

			container.Register(Component
				.For<AppHarborApi>());

			container.Register(Component
				.For<AuthInfo>()
				.UsingFactoryMethod(x =>
				{
					var token = Environment.GetEnvironmentVariable("AppHarborToken", EnvironmentVariableTarget.User);
					return new AuthInfo { AccessToken = token };
				}));

			container.Register(Component
				.For<CommandDispatcher>());
		}
	}
}

using System;
using Castle.MicroKernel.Registration;
using Castle.MicroKernel.SubSystems.Configuration;
using Castle.Windsor;
using Castle.MicroKernel.Resolvers.SpecializedResolvers;

namespace AppHarbor
{
	public class AppHarborInstaller : IWindsorInstaller
	{
		public void Install(IWindsorContainer container, IConfigurationStore store)
		{
			container.Kernel.Resolver.AddSubResolver(new CollectionResolver(container.Kernel));

			container.Register(AllTypes
				.FromThisAssembly()
				.BasedOn<ICommand>()
				.WithService.AllInterfaces());

			container.Register(Component
				.For<AccessTokenConfiguration>());

			container.Register(Component
				.For<AppHarborApi>());

			container.Register(Component
				.For<AuthInfo>()
				.UsingFactoryMethod(x =>
				{
					var accessTokenConfiguration = container.Resolve<AccessTokenConfiguration>();
					return new AuthInfo { AccessToken = accessTokenConfiguration.GetAccessToken() };
				}));

			container.Register(Component
				.For<CommandDispatcher>());
		}
	}
}

Use AccessTokenConfiguration to register AuthInfo


namespace EverlastingStudent.Models
{
    using System.Collections.Generic;
    using System.ComponentModel.DataAnnotations;

    using EverlastingStudent.Common;

    public class Difficulty
    {
        private ICollection<Homework> homeworks;
        private ICollection<FreelanceProject> freelanceProjects;

        public Difficulty()
        {
            this.homeworks = new HashSet<Homework>();
            this.freelanceProjects = new HashSet<FreelanceProject>();
        }

        [Key]
        public int Id { get; set; }

        [Required]
        public int Value { get; set; }

        [Required]
        public TypeOfDifficulty type { get; set; }

        public virtual ICollection<Homework> Homeworks
        {
            get { return this.homeworks; }
            set { this.homeworks = value; }
        }

        public virtual ICollection<FreelanceProject> FreelanceProjects
        {
            get { return this.freelanceProjects; }
            set { this.freelanceProjects = value; }
        }

    }
}

namespace EverlastingStudent.Models
{
    using System.Collections.Generic;
    using System.ComponentModel.DataAnnotations;

    using EverlastingStudent.Common.Models;

    public class Difficulty
    {
        private ICollection<Homework> homeworks;
        private ICollection<FreelanceProject> freelanceProjects;

        public Difficulty()
        {
            this.homeworks = new HashSet<Homework>();
            this.freelanceProjects = new HashSet<FreelanceProject>();
        }

        [Key]
        public int Id { get; set; }

        [Required]
        public int Value { get; set; }

        [Required]
        public TypeOfDifficulty type { get; set; }

        public virtual ICollection<Homework> Homeworks
        {
            get { return this.homeworks; }
            set { this.homeworks = value; }
        }

        public virtual ICollection<FreelanceProject> FreelanceProjects
        {
            get { return this.freelanceProjects; }
            set { this.freelanceProjects = value; }
        }

    }
}

Fix path to enum namespace

Fix path to enum namespace


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

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics;
using System.Net;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
using System.Threading.Tasks;

using Microsoft.Win32.SafeHandles;

namespace System.Net.WebSockets
{
    internal partial struct WebSocketHandle
    {
        private readonly WinRTWebSocket _webSocket;

        public static WebSocketHandle Create()
        {
            return new WebSocketHandle(new WinRTWebSocket());
        }

        public static void CheckPlatformSupport()
        {
        }

        private WebSocketHandle(WinRTWebSocket webSocket)
        {
            _webSocket = webSocket;
        }

        public async Task ConnectAsyncCore(Uri uri, CancellationToken cancellationToken, ClientWebSocketOptions options)
        {
            try
            {
                await rtWebSocket.ConnectAsync(uri, cancellationToken, options).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                WebErrorStatus status = RTWebSocketError.GetStatus(ex.HResult);
                var inner = new Exception(status.ToString(), ex);
                WebSocketException wex = new WebSocketException(SR.net_webstatus_ConnectFailure, inner);
                if (Logging.On)
                {
                    Logging.Exception(Logging.WebSockets, this, "ConnectAsync", wex);
                }

                throw wex;
            }
        }
    }
}

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

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics;
using System.Net;
using System.Security.Cryptography.X509Certificates;
using System.Threading;
using System.Threading.Tasks;

using Microsoft.Win32.SafeHandles;

namespace System.Net.WebSockets
{
    internal partial struct WebSocketHandle
    {
        private readonly WinRTWebSocket _webSocket;

        public static WebSocketHandle Create()
        {
            return new WebSocketHandle(new WinRTWebSocket());
        }

        public static void CheckPlatformSupport()
        {
        }

        private WebSocketHandle(WinRTWebSocket webSocket)
        {
            _webSocket = webSocket;
        }

        public async Task ConnectAsyncCore(Uri uri, CancellationToken cancellationToken, ClientWebSocketOptions options)
        {
            try
            {
                await _webSocket.ConnectAsync(uri, cancellationToken, options).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                // TODO: ** TFS BUILD IS BROKEN **
                // This doesn't compile right now due to missing types 'WebErrorStatus' and 'RTWebSocketError'
                // Commenting out for now to allow the build to resume.
                //WebErrorStatus status = RTWebSocketError.GetStatus(ex.HResult);
                //var inner = new Exception(status.ToString(), ex);
                var inner = ex;
                WebSocketException wex = new WebSocketException(SR.net_webstatus_ConnectFailure, inner);
                if (Logging.On)
                {
                    Logging.Exception(Logging.WebSockets, this, "ConnectAsync", wex);
                }

                throw wex;
            }
        }
    }
}

Fix broken build of System.Net.WebSockets.Client.NETNative.csproj due to missing types.

Comment out code for now so that build will work.

[tfs-changeset: 1539097]


using System;
using Abp.Auditing;
using Castle.Core.Logging;
using Microsoft.AspNetCore.Http;
using Abp.Extensions;

namespace Abp.AspNetCore.Mvc.Auditing
{
    public class HttpContextClientInfoProvider : IClientInfoProvider
    {
        public string BrowserInfo => GetBrowserInfo();

        public string ClientIpAddress => GetClientIpAddress();

        public string ComputerName => GetComputerName();

        public ILogger Logger { get; set; }

        private readonly IHttpContextAccessor _httpContextAccessor;

        private readonly HttpContext _httpContext;

        /// <summary>
        /// Creates a new <see cref="HttpContextClientInfoProvider"/>.
        /// </summary>
        public HttpContextClientInfoProvider(IHttpContextAccessor httpContextAccessor)
        {
            _httpContextAccessor = httpContextAccessor;
            _httpContext = httpContextAccessor.HttpContext;

            Logger = NullLogger.Instance;
        }

        protected virtual string GetBrowserInfo()
        {
            var httpContext = _httpContextAccessor.HttpContext ?? _httpContext;
            return httpContext?.Request?.Headers?["User-Agent"];
        }

        protected virtual string GetClientIpAddress()
        {
            try
            {
                var httpContext = _httpContextAccessor.HttpContext ?? _httpContext;

                var clientIp = httpContext?.Request?.Headers["HTTP_X_FORWARDED_FOR"].ToString();

                if (clientIp.IsNullOrEmpty())
                {
                    clientIp = httpContext?.Connection?.RemoteIpAddress?.ToString();
                }

                return clientIp.Remove(clientIp.IndexOf(':'));
            }
            catch (Exception ex)
            {
                Logger.Warn(ex.ToString());
            }

            return null;
        }

        protected virtual string GetComputerName()
        {
            return null; //TODO: Implement!
        }
    }
}

using System;
using Abp.Auditing;
using Castle.Core.Logging;
using Microsoft.AspNetCore.Http;
using Abp.Extensions;

namespace Abp.AspNetCore.Mvc.Auditing
{
    public class HttpContextClientInfoProvider : IClientInfoProvider
    {
        public string BrowserInfo => GetBrowserInfo();

        public string ClientIpAddress => GetClientIpAddress();

        public string ComputerName => GetComputerName();

        public ILogger Logger { get; set; }

        private readonly IHttpContextAccessor _httpContextAccessor;

        private readonly HttpContext _httpContext;

        /// <summary>
        /// Creates a new <see cref="HttpContextClientInfoProvider"/>.
        /// </summary>
        public HttpContextClientInfoProvider(IHttpContextAccessor httpContextAccessor)
        {
            _httpContextAccessor = httpContextAccessor;
            _httpContext = httpContextAccessor.HttpContext;

            Logger = NullLogger.Instance;
        }

        protected virtual string GetBrowserInfo()
        {
            var httpContext = _httpContextAccessor.HttpContext ?? _httpContext;
            return httpContext?.Request?.Headers?["User-Agent"];
        }

        protected virtual string GetClientIpAddress()
        {
            try
            {
                var httpContext = _httpContextAccessor.HttpContext ?? _httpContext;

                return httpContext?.Connection?.RemoteIpAddress?.ToString();

            }
            catch (Exception ex)
            {
                Logger.Warn(ex.ToString());
            }

            return null;
        }

        protected virtual string GetComputerName()
        {
            return null; //TODO: Implement!
        }
    }
}

Remove read ip from header

Remove read ip from header


namespace TraktApiSharp.Requests
{
    internal struct TraktPaginationOptions
    {
        internal TraktPaginationOptions(int? page, int? limit)
        {
            Page = page;
            Limit = limit;
        }

        internal int? Page { get; set; }

        internal int? Limit { get; set; }
    }
}

namespace TraktApiSharp.Requests
{
    internal struct TraktPaginationOptions
    {
        internal TraktPaginationOptions(int? page, int? limit)
        {
            Page = page;
            Limit = limit;
        }

        internal int? Page { get; }

        internal int? Limit { get; }
    }
}

Remove unused setters of pagination properties.


namespace Boxed.Templates.Test
{
    using System;
    using System.Threading;

    public static class CancellationTokenFactory
    {
        public static CancellationToken GetCancellationToken(TimeSpan? timeout) =>
            GetCancellationToken(timeout ?? TimeSpan.FromSeconds(20));

        public static CancellationToken GetCancellationToken(TimeSpan timeout) =>
            new CancellationTokenSource(timeout).Token;
    }
}

namespace Boxed.Templates.Test
{
    using System;
    using System.Threading;

    public static class CancellationTokenFactory
    {
        public static CancellationToken GetCancellationToken(TimeSpan? timeout) =>
            GetCancellationToken(timeout ?? TimeSpan.FromSeconds(30));

        public static CancellationToken GetCancellationToken(TimeSpan timeout) =>
            new CancellationTokenSource(timeout).Token;
    }
}

Increase default timeout to 30 secs

Increase default timeout to 30 secs


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

namespace CenturyLinkCloudSDK.IntegrationTests
{
    public static class Credentials
    {
        public static string Username = "";
        public static string Password = "";
    }
}

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

namespace CenturyLinkCloudSDK.IntegrationTests
{
    public static class Credentials
    {
        public static string Username = "";
        public static string Password = "";
        public static string ObjectStorageAccessKeyId = "";
        public static string ObjectStorageSecretAccessKey = "";
    }
}

Add stub object storage credentials

Add stub object storage credentials


using System.Windows.Forms;
using TweetDuck.Plugins;
using TweetDuck.Resources;

namespace TweetDuck.Core.Notification.Example{
    sealed class FormNotificationExample : FormNotificationMain{
        public override bool RequiresResize => true;
        protected override bool CanDragWindow => Program.UserConfig.NotificationPosition == TweetNotification.Position.Custom;

        protected override FormBorderStyle NotificationBorderStyle{
            get{
                if (Program.UserConfig.NotificationSize == TweetNotification.Size.Custom){
                    switch(base.NotificationBorderStyle){
                        case FormBorderStyle.FixedSingle: return FormBorderStyle.Sizable;
                        case FormBorderStyle.FixedToolWindow: return FormBorderStyle.SizableToolWindow;
                    }
                }

                return base.NotificationBorderStyle;
            }
        }

        private readonly TweetNotification exampleNotification;

        public FormNotificationExample(FormBrowser owner, PluginManager pluginManager) : base(owner, pluginManager, false){
            string exampleTweetHTML = ScriptLoader.LoadResource("pages/example.html", true);

            #if DEBUG
            exampleTweetHTML = exampleTweetHTML.Replace("
", @"

Scrollbar test padding...
");
            #endif

            exampleNotification = TweetNotification.Example(exampleTweetHTML, 95);
        }

        public void ShowExampleNotification(bool reset){
            if (reset){
                LoadTweet(exampleNotification);
            }
            else{
                PrepareAndDisplayWindow();
            }

            UpdateTitle();
        }
    }
}

using System.Windows.Forms;
using TweetDuck.Core.Controls;
using TweetDuck.Plugins;
using TweetDuck.Resources;

namespace TweetDuck.Core.Notification.Example{
    sealed class FormNotificationExample : FormNotificationMain{
        public override bool RequiresResize => true;
        protected override bool CanDragWindow => Program.UserConfig.NotificationPosition == TweetNotification.Position.Custom;

        protected override FormBorderStyle NotificationBorderStyle{
            get{
                if (Program.UserConfig.NotificationSize == TweetNotification.Size.Custom){
                    switch(base.NotificationBorderStyle){
                        case FormBorderStyle.FixedSingle: return FormBorderStyle.Sizable;
                        case FormBorderStyle.FixedToolWindow: return FormBorderStyle.SizableToolWindow;
                    }
                }

                return base.NotificationBorderStyle;
            }
        }

        private readonly TweetNotification exampleNotification;

        public FormNotificationExample(FormBrowser owner, PluginManager pluginManager) : base(owner, pluginManager, false){
            string exampleTweetHTML = ScriptLoader.LoadResource("pages/example.html", true);

            #if DEBUG
            exampleTweetHTML = exampleTweetHTML.Replace("
", @"

Scrollbar test padding...
");
            #endif

            exampleNotification = TweetNotification.Example(exampleTweetHTML, 95);
        }

        public override void HideNotification(){
            Location = ControlExtensions.InvisibleLocation;
        }

        public void ShowExampleNotification(bool reset){
            if (reset){
                LoadTweet(exampleNotification);
            }
            else{
                PrepareAndDisplayWindow();
            }

            UpdateTitle();
        }
    }
}

Fix broken example notification after closing it and then changing options


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 System.IO;

namespace GreenMemory
{
    /// <summary>
    /// Interaction logic for PlayerView.xaml
    /// </summary>
    public partial class PlayerView : UserControl
    {
        static string[] pointImages;

        public PlayerView()
        {
            if(pointImages == null)
            {
                 pointImages = Directory.GetFiles("Game\\Score");
            }
            InitializeComponent();
        }

        public void setPoints(int points)
        {
            imgScore.Source = new BitmapImage(new Uri(pointImages[points], UriKind.Relative));
        }
    }
}

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 System.IO;

namespace GreenMemory
{
    /// <summary>
    /// Interaction logic for PlayerView.xaml
    /// </summary>
    public partial class PlayerView : UserControl
    {
        static string[] pointImages;

        public PlayerView()
        {
            if(pointImages == null)
            {
                 pointImages = Directory.GetFiles("Game\\Score\\3X");
            }
            InitializeComponent();
        }

        public void setPoints(int points)
        {
            imgScore.Source = new BitmapImage(new Uri(pointImages[points], UriKind.Relative));
        }
    }
}

Change to use higher res score image

Change to use higher res score image


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

using System.Threading;
using Microsoft.CodeAnalysis.CSharp.Extensions.ContextQuery;

namespace Microsoft.CodeAnalysis.CSharp.Completion.KeywordRecommenders
{
    internal class ParamsKeywordRecommender : AbstractSyntacticSingleKeywordRecommender
    {
        public ParamsKeywordRecommender()
            : base(SyntaxKind.ParamsKeyword)
        {
        }

        protected override bool IsValidContext(int position, CSharpSyntaxContext context, CancellationToken cancellationToken)
            => context.SyntaxTree.IsParamsModifierContext(context.Position, context.LeftToken);
    }
}

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

using System.Threading;
using Microsoft.CodeAnalysis.CSharp.Extensions.ContextQuery;

namespace Microsoft.CodeAnalysis.CSharp.Completion.KeywordRecommenders
{
    internal class ParamsKeywordRecommender : AbstractSyntacticSingleKeywordRecommender
    {
        public ParamsKeywordRecommender()
            : base(SyntaxKind.ParamsKeyword)
        {
        }

        protected override bool IsValidContext(int position, CSharpSyntaxContext context, CancellationToken cancellationToken)
        {
            var syntaxTree = context.SyntaxTree;
            return syntaxTree.IsParamsModifierContext(context.Position, context.LeftToken) ||
                syntaxTree.IsPossibleLambdaParameterModifierContext(position, context.LeftToken, cancellationToken);
        }
    }
}

Allow `params` completion in lambdas

Allow `params` completion in lambdas


using System.ComponentModel;
using System.Linq;
using System.Windows.Forms;
using SolarWinds.InformationService.Contract2;

namespace SwqlStudio
{
    public partial class QueryParameters : Form
    {
        public QueryParameters(PropertyBag queryParameters)
        {
            InitializeComponent();
            Parameters = queryParameters;
        }

        public PropertyBag Parameters
        {
            get
            {
                var bag = new PropertyBag();
                foreach (Pair pair in (BindingList<Pair>)dataGridView1.DataSource)
                    bag[pair.Key] = pair.Value;

                return bag;
            }

            private set
            {
                var pairs = value.Select(pair => new Pair(pair.Key, pair.Value.ToString()));
                dataGridView1.DataSource = new BindingList<Pair>(pairs.ToList()) {AllowNew = true};
            }
        }
    }

    public class Pair
    {
        public Pair()
        {
        }

        public Pair(string key, string value)
        {
            Key = key;
            Value = value;
        }

        public string Key { get; set; }
        public string Value { get; set; }
    }
}

using System.ComponentModel;
using System.Linq;
using System.Windows.Forms;
using SolarWinds.InformationService.Contract2;

namespace SwqlStudio
{
    public partial class QueryParameters : Form
    {
        public QueryParameters(PropertyBag queryParameters)
        {
            InitializeComponent();
            Parameters = queryParameters;
        }

        public PropertyBag Parameters
        {
            get
            {
                var bag = new PropertyBag();
                foreach (Pair pair in (BindingList<Pair>)dataGridView1.DataSource)
                    bag[pair.Key] = pair.Value;

                return bag;
            }

            private set
            {
                var pairs = value.Select(pair => new Pair(pair.Key, pair.Value?.ToString()));
                dataGridView1.DataSource = new BindingList<Pair>(pairs.ToList()) {AllowNew = true};
            }
        }
    }

    public class Pair
    {
        public Pair()
        {
        }

        public Pair(string key, string value)
        {
            Key = key;
            Value = value;
        }

        public string Key { get; set; }
        public string Value { get; set; }
    }
}

Fix crash when editing query parameters and one has a null value


using System;
using Octostache;

namespace Calamari.Integration.Processes
{
    public static class VariableDictionaryExtensions
    {
        public static void EnrichWithEnvironmentVariables(this VariableDictionary variables)
        {
            var environmentVariables = Environment.GetEnvironmentVariables();

            foreach (var name in environmentVariables.Keys)
            {
                variables["env:" + name] = (environmentVariables[name] ?? string.Empty).ToString();
            }
        }
    }
}

using System;
using Calamari.Deployment;
using Octostache;

namespace Calamari.Integration.Processes
{
    public static class VariableDictionaryExtensions
    {
        public static void EnrichWithEnvironmentVariables(this VariableDictionary variables)
        {
            var environmentVariables = Environment.GetEnvironmentVariables();

            foreach (var name in environmentVariables.Keys)
            {
                variables["env:" + name] = (environmentVariables[name] ?? string.Empty).ToString();
            }

            variables.Set(SpecialVariables.Tentacle.Agent.InstanceName, "#{env:TentacleInstanceName}");
        }
    }
}

Set Tentacle Instance Name variable

Set Tentacle Instance Name variable


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

namespace JenkinsTitleUpdater
{
	class Program
	{
		static int Main(string[] args)
		{
			if (args.Length == 0)
			{
				Usage();
				return -1;
			}

			HtmlDocument doc = new HtmlDocument();
			if (!File.Exists(args[0])) throw new ArgumentException("File does not exist " + args[0] + "\r\nWe are at " + Environment.CurrentDirectory);
			doc.Load(args[0]);
			HtmlNode root = doc.DocumentNode;
			HtmlNode titleNode = root.ChildNodes["html"].ChildNodes["head"].ChildNodes["title"];
			string buildname = " -- ";
			if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("BUILD_DISPLAY_NAME")))
			{
				return -1;
			}
			buildname += Environment.GetEnvironmentVariable("BUILD_DISPLAY_NAME");
			titleNode.InnerHtml += buildname;
			doc.Save(args[0]);
			return 0;
		}

		private static void Usage()
		{
			Console.WriteLine("Usage");
			Console.WriteLine("Usage   : CTTitleUpdater.exe full-path-to-_Layout.cshtml");
			Console.WriteLine(@"Example :  CTTitleUpdater.exe \..\..\src\Web.CTAP.Web\View\Shared\_Layout.cshtml");
		}
	}
}

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

namespace JenkinsTitleUpdater
{
	class Program
	{
		static int Main(string[] args)
		{
			if (args.Length == 0)
			{
				Usage();
				return -1;
			}

			HtmlDocument doc = new HtmlDocument();
			if (!File.Exists(args[0])) throw new ArgumentException("File does not exist " + args[0] + "\r\nWe are at " + Environment.CurrentDirectory);
			doc.Load(args[0]);
			HtmlNode root = doc.DocumentNode;
			HtmlNode titleNode = root.ChildNodes["html"].ChildNodes["head"].ChildNodes["title"];
			string buildname = " -- ";
			if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("BUILD_DISPLAY_NAME")))
			{
				return -1;
			}
			buildname += Environment.GetEnvironmentVariable("BUILD_DISPLAY_NAME");
			titleNode.InnerHtml += buildname;
			doc.Save(args[0]);
			return 0;
		}

		private static void Usage()
		{
			Console.WriteLine("Usage");
			Console.WriteLine("Usage   : JenkinsTitleUpdater.exe full-path-to-_Layout.cshtml");
			Console.WriteLine(@"Example :  JenkinsTitleUpdater.exe \..\..\src\Web\View\Shared\_Layout.cshtml");
		}
	}
}

Update help with correct name

Update help with correct name


using System;

namespace CefSharp
{
    /// <summary>
    /// Event arguments to the LoadCompleted event handler set up in IWebBrowser.
    /// </summary>
    public class NavStateChangedEventArgs : EventArgs
    {
        public bool CanGoForward { get; private set; }
        public bool CanGoBack { get; private set; }
        public bool CanReload { get; private set; }

        public NavStateChangedEventArgs(bool canGoBack, bool canGoForward, bool canReload)
        {
            CanGoBack = canGoBack;
            CanGoForward = canGoForward;
            CanReload = canReload;
        }
    };

    /// <summary>
    /// A delegate type used to listen to NavStateChanged events.
    /// </summary>
    public delegate void NavStateChangedEventHandler(object sender, NavStateChangedEventArgs args);
}

using System;

namespace CefSharp
{
    /// <summary>
    /// Event arguments to the NavStateChanged event handler set up in IWebBrowser.
    /// </summary>
    public class NavStateChangedEventArgs : EventArgs
    {
        public bool CanGoForward { get; private set; }
        public bool CanGoBack { get; private set; }
        public bool CanReload { get; private set; }

        public NavStateChangedEventArgs(bool canGoBack, bool canGoForward, bool canReload)
        {
            CanGoBack = canGoBack;
            CanGoForward = canGoForward;
            CanReload = canReload;
        }
    };

    /// <summary>
    /// A delegate type used to listen to NavStateChanged events.
    /// </summary>
    public delegate void NavStateChangedEventHandler(object sender, NavStateChangedEventArgs args);
}

Fix error in comment (should have been NavStateChanged)


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.Shapes;
using MahApps.Metro.Controls;

namespace Badger.Views
{
    /// <summary>
    /// Interaction logic for MainView.xaml
    /// </summary>
    public partial class MainView : MetroWindow
    {
        public MainView()
        {
            InitializeComponent();
        }
    }
}

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.Shapes;
using MahApps.Metro.Controls;

namespace Badger.Views
{
    /// <summary>
    /// Interaction logic for MainView.xaml
    /// </summary>
    public partial class MainView : MetroWindow
    {
        public MainView()
        {
            InitializeComponent();
        }

        public void ConfigureSettings()
        {

        }
    }
}

Add function for configuring settings

Add function for configuring settings


using System;
using Mono.Addins;
using Mono.Addins.Description;

[assembly:Addin ("TypeScript",
	Namespace = "MonoDevelop",
	Version = "0.4",
	Category = "Web Development")]

[assembly:AddinName ("TypeScript")]
[assembly:AddinDescription ("Adds TypeScript support. Updated to use TypeScript 1.4")]

[assembly:AddinDependency ("Core", "5.0")]
[assembly:AddinDependency ("Ide", "5.0")]
[assembly:AddinDependency ("SourceEditor2", "5.0")]
[assembly:AddinDependency ("Refactoring", "5.0")]

using System;
using Mono.Addins;
using Mono.Addins.Description;

[assembly:Addin ("TypeScript",
	Namespace = "MonoDevelop",
	Version = "0.5",
	Category = "Web Development")]

[assembly:AddinName ("TypeScript")]
[assembly:AddinDescription ("Adds TypeScript support. Updated to use TypeScript 1.4")]

[assembly:AddinDependency ("Core", "5.0")]
[assembly:AddinDependency ("Ide", "5.0")]
[assembly:AddinDependency ("SourceEditor2", "5.0")]
[assembly:AddinDependency ("Refactoring", "5.0")]

Update addin version to 0.5

Update addin version to 0.5


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

public class CustomSimplePlayer : MonoBehaviour {
    public int speed = 10;

    Rigidbody rigidbody;
    Vector3 velocity;

    // Use this for initialization
	void Start () {
        rigidbody = GetComponent<Rigidbody>();
	}

	// Update is called once per frame
	void Update () {
        velocity = new Vector3(Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical")).normalized * speed;
	}

    private void FixedUpdate() {
        rigidbody.MovePosition(rigidbody.position + velocity * Time.fixedDeltaTime);
        rigidbody.rotation = Quaternion.Euler(rigidbody.rotation.eulerAngles + new Vector3(0f, 1f * Input.GetAxisRaw("Mouse X"), 0f));
    }
}

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

public class CustomSimplePlayer : MonoBehaviour {
    public float speed = 10.0f;

    Rigidbody rigidbody;
    Vector3 velocity;

    // Use this for initialization
	void Start () {
        Cursor.lockState = CursorLockMode.Locked;

        rigidbody = GetComponent<Rigidbody>();
	}

	// Update is called once per frame
	void Update () {
        //velocity = new Vector3(Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical")).normalized * speed;
        // replaced above code with:
        float forwardAndBackward = Input.GetAxisRaw("Vertical") * speed;
        float strafe = Input.GetAxisRaw("Horizontal") * speed;
        forwardAndBackward *= Time.deltaTime;
        strafe *= Time.deltaTime;

        transform.Translate(strafe, 0, forwardAndBackward);

        // The position of this if statement matters.
        // If you put this in the beginning of the Update function, the code will not get to "velocity", and it will keep on staing on this if statement.
        if (Input.GetKeyDown("Escape"))
            Cursor.lockState = CursorLockMode.None;
    }

    private void FixedUpdate() {
        // Commented this out because the code in Update() made this redundant.
        //rigidbody.MovePosition(rigidbody.position + velocity * Time.fixedDeltaTime);
        rigidbody.rotation = Quaternion.Euler(rigidbody.rotation.eulerAngles + new Vector3(0f, 1f * Input.GetAxisRaw("Mouse X"), 0f));
    }
}

Add code to allow first-person character to control more like a traditional FPS.


using System.Collections.Generic;
using HarryPotterUnity.Cards.Generic;
using JetBrains.Annotations;

namespace HarryPotterUnity.Cards.Spells.Charms
{
    [UsedImplicitly]
    public class EndlessSandwiches : GenericSpell {
        protected override void SpellAction(List<GenericCard> targets)
        {
            while (Player.Hand.Cards.Count < 7)
            {
                Player.Deck.DrawCard();
            }
        }
    }
}

using System.Collections.Generic;
using HarryPotterUnity.Cards.Generic;
using JetBrains.Annotations;

namespace HarryPotterUnity.Cards.Spells.Charms
{
    [UsedImplicitly]
    public class EndlessSandwiches : GenericSpell {
        protected override void SpellAction(List<GenericCard> targets)
        {
            int amountCardsToDraw = 7 - Player.Hand.Cards.Count;
            var cardsToDraw = new List<GenericCard>();

            while (amountCardsToDraw-- > 0)
            {
                cardsToDraw.Add( Player.Deck.TakeTopCard() );
            }

            Player.Hand.AddAll(cardsToDraw);
        }
    }
}

Fix an animation bug with Endless Sandwiches


using System;

public struct Vector2
{
    public Vector2(double X, double Y)
    {
        this.x = X;
        this.Y = Y;
    }

    private double x;
    public double X { get { return x; } private set { x = value; } }
    public double Y { get; private set; }

    public double this[int i]
    {
        get { return i == 1 ? Y : X; }
        private set
        {
            if (i == 1)
                Y = value;
            else
                X = value;
        }
    }

    public double this[long i] => i == 1 ? Y : X;

    public double LengthSquared
    {
        get { return X * X + Y * Y; }
    }

    public double Length => Math.Sqrt(LengthSquared);
}

public static class Program
{
    public static void Main(string[] Args)
    {
        var vec = new Vector2(3, 4);
        Console.WriteLine(vec.X);
        Console.WriteLine(vec.Y);
        Console.WriteLine(vec[0]);
        Console.WriteLine(vec[1]);
        Console.WriteLine(vec[0L]);
        Console.WriteLine(vec[1L]);
        Console.WriteLine(vec.LengthSquared);
        Console.WriteLine(vec.Length);
    }
}

using System;

public struct Vector2
{
    public Vector2(double X, double Y)
    {
        this.x = X;
        this.Y = Y;
    }

    private double x;
    public double X { get { return x; } private set { x = value; } }
    public double Y { get; private set; }

    public double this[int i]
    {
        get { return i == 1 ? Y : X; }
        private set
        {
            if (i == 1)
                Y = value;
            else
                X = value;
        }
    }

    public double this[uint i]
    {
        get => this[(int)i];
        private set => this[(uint)i] = value;
    }

    public double this[long i] => i == 1 ? Y : X;

    public double LengthSquared
    {
        get { return X * X + Y * Y; }
    }

    public double Length => Math.Sqrt(LengthSquared);
}

public static class Program
{
    public static void Main(string[] Args)
    {
        var vec = new Vector2(3, 4);
        Console.WriteLine(vec.X);
        Console.WriteLine(vec.Y);
        Console.WriteLine(vec[0]);
        Console.WriteLine(vec[1]);
        Console.WriteLine(vec[0L]);
        Console.WriteLine(vec[1L]);
        Console.WriteLine(vec.LengthSquared);
        Console.WriteLine(vec.Length);
    }
}

Update the properties test with new-style accessor syntax


namespace Mios.Validation.Mvc {
	using System.Collections.Generic;
	using System.Web.Mvc;

	public static class ModelStateDictionaryExtensions {
		public static void AddErrors(this ModelStateDictionary modelState, IEnumerable<ValidationError> errors) {
			foreach(var error in errors) {
				modelState.AddModelError(error.Key, error.Message);
			}
		}
		public static bool Into(this IEnumerable<ValidationError> errors, ModelStateDictionary modelState) {
			var found = false;
			foreach(var error in errors) {
				modelState.AddModelError(error.Key, error.Message);
				found = true;
			}
			return found;
		}
	}
}

namespace Mios.Validation.Mvc {
	using System.Collections.Generic;
	using System.Web.Mvc;

	public static class ModelStateDictionaryExtensions {
		public static void AddErrors(this ModelStateDictionary modelState, IEnumerable<ValidationError> errors) {
			foreach(var error in errors) {
				modelState.AddModelError(error.Key, error.Message);
			}
		}
		public static bool Into(this IEnumerable<ValidationError> errors, ModelStateDictionary modelState) {
			var found = false;
			foreach(var error in errors) {
				modelState.AddModelError(error.Key, error.Message);
				found = true;
			}
			return !found;
		}
	}
}

Fix inverted result from Into(ModelState)


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

namespace Pather.CSharp.UnitTests
{
    // This project can output the Class library as a NuGet Package.
    // To enable this option, right-click on the project and select the Properties menu item. In the Build tab select "Produce outputs on build".
    public class ResolverTests
    {
        public ResolverTests()
        {
        }

        [Fact]
        public void Test()
        {
            var r = new Resolver();
        }
    }
}

using FluentAssertions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Xunit;

namespace Pather.CSharp.UnitTests
{
    // This project can output the Class library as a NuGet Package.
    // To enable this option, right-click on the project and select the Properties menu item. In the Build tab select "Produce outputs on build".
    public class ResolverTests
    {
        public ResolverTests()
        {
        }

        [Fact]
        public void SinglePropertyResolution()
        {
            var value = "1";
            var r = new Resolver();
            var o = new { Property = value };

            var result = r.Resolve(o, "Property");
            result.Should().Be(value);
        }

        [Fact]
        public void MultiplePropertyResolution()
        {
            var value = "1";
            var r = new Resolver();
            var o = new { Property1 = new { Property2 = value } };

            var result = r.Resolve(o, "Property1.Property2");
            result.Should().Be(value);
        }
    }
}

Add unit tests for simple single and multiple property resolution


Add Type Forwarder for New Appender

Add Type Forwarder for New Appender

This makes the new appender consistent with the other async ones.


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

namespace Substructio.Logging
{
    public interface IErrorReporting
    {
        void ReportError(Exception e);
        void ReportMessage(string message);
    }

    public class NullErrorReporting : IErrorReporting
    {
        public void ReportError(Exception e) { }

        public void ReportMessage(string message) { }
    }
}

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

namespace Substructio.Logging
{
    public interface IErrorReporting
    {
        string ReportError(Exception e);
        string ReportMessage(string message);
    }

    public class NullErrorReporting : IErrorReporting
    {
        public string ReportError(Exception e) { return ""; }

        public string ReportMessage(string message) { return ""; }
    }
}

Return even information in string for error reporting


@inherits DotNetNuke.Web.Mvc.Framework.DnnWebViewPage<ContingentViewModel>
@using DotNetNuke.Web.Mvc.Helpers
@using R7.University.EduProgramProfiles.ViewModels

@Model.EduProgramProfile.EduProgram.Code
@Model.EduProgramProfileTitle
@Model.EduProgramProfile.EduLevel.Title
@Model.EduFormTitle
@Model.Year.Year
@Model.ActualFB
@Model.ActualRB
@Model.ActualMB
@Model.ActualBC

@inherits DotNetNuke.Web.Mvc.Framework.DnnWebViewPage<ContingentViewModel>
@using DotNetNuke.Web.Mvc.Helpers
@using R7.University.EduProgramProfiles.ViewModels

@Model.EduProgramProfile.EduProgram.Code
@Model.EduProgramProfileTitle
@Model.EduProgramProfile.EduLevel.Title
@Model.EduFormTitle
@Model.ActualFB
@Model.ActualRB
@Model.ActualMB
@Model.ActualBC

Fix actual contingent table structure

Fix actual contingent table structure