using System.Reflection;

[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

using System.Reflection;

[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft Corporation")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]

Update assembly version to 1.2 to match the version set in Microsoft.Web.Xdt package.


using System;
using System.IO;
using System.Net;
using System.Text;

namespace PreMailer.Net.Downloaders
{
	public class WebDownloader : IWebDownloader
	{
		private static IWebDownloader _sharedDownloader;

		public static IWebDownloader SharedDownloader
		{
			get
			{
				if (_sharedDownloader == null)
				{
					_sharedDownloader = new WebDownloader();
				}

				return _sharedDownloader;
			}
			set
			{
				_sharedDownloader = value;
			}
		}

		public string DownloadString(Uri uri)
		{
			var request = WebRequest.Create(uri);
			using (var response = (HttpWebResponse)request.GetResponse())
			{
				var charset = response.CharacterSet;
				var encoding = Encoding.GetEncoding(charset);
				using (var stream = response.GetResponseStream())
				using (var reader = new StreamReader(stream, encoding))
				{
					return reader.ReadToEnd();
				}
			}
		}
	}
}

using System;
using System.IO;
using System.Net;
using System.Text;

namespace PreMailer.Net.Downloaders
{
	public class WebDownloader : IWebDownloader
	{
		private static IWebDownloader _sharedDownloader;

		public static IWebDownloader SharedDownloader
		{
			get
			{
				if (_sharedDownloader == null)
				{
					_sharedDownloader = new WebDownloader();
				}

				return _sharedDownloader;
			}
			set
			{
				_sharedDownloader = value;
			}
		}

		public string DownloadString(Uri uri)
		{
			var request = WebRequest.Create(uri);
			using (var response = request.GetResponse())
			{
				switch (response)
				{
					case HttpWebResponse httpWebResponse:
					{
						var charset = httpWebResponse.CharacterSet;
						var encoding = Encoding.GetEncoding(charset);
						using (var stream = httpWebResponse.GetResponseStream())
						using (var reader = new StreamReader(stream, encoding))
						{
							return reader.ReadToEnd();
						}
					}

					case FileWebResponse fileWebResponse:
					{
						using (var stream = fileWebResponse.GetResponseStream())
						using (var reader = new StreamReader(stream))
						{
							return reader.ReadToEnd();
						}
					}

					default:
						throw new NotSupportedException($"The Uri type is giving a response in unsupported type '{response.GetType()}'.");
				}
			}
		}
	}
}

Add support on fetching Uri with local filepath like "file:///C:/website/style.css"


// 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.ComponentModel;
using Xunit;

namespace Test
{
    public class ComponentModelTests
    {
        [Fact]
        public static void TestComponentModelBasic()
        {
            // dummy tests to make sure the System.ComponentModel library loaded successfully
#pragma warning disable 0219
            IRevertibleChangeTracking iRevertibleChangeTracking = null;
            IChangeTracking iChangeTracking = iRevertibleChangeTracking;
            Assert.Null(iChangeTracking);

            IEditableObject iEditableObject = null;
            CancelEventArgs cancelEventArgs = new CancelEventArgs();
            Assert.NotNull(cancelEventArgs);

            IServiceProvider iServiceProvider = null;
            Assert.Null(iServiceProvider);
#pragma warning restore 0219
        }
    }
}

// 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.ComponentModel;
using Xunit;

namespace Test
{
    public class ComponentModelTests
    {
        [Fact]
        public static void TestComponentModelBasic()
        {
            // dummy tests to make sure the System.ComponentModel library loaded successfully
#pragma warning disable 0219
            IRevertibleChangeTracking iRevertibleChangeTracking = null;
            IChangeTracking iChangeTracking = iRevertibleChangeTracking;
            Assert.Null(iChangeTracking);

            IEditableObject iEditableObject = null;
            CancelEventArgs cancelEventArgs = new CancelEventArgs();
            Assert.NotNull(cancelEventArgs);

            IServiceProvider iServiceProvider = null;
            Assert.Null(iServiceProvider);
#pragma warning restore 0219
        }

        [Fact]
        public static void TestCancelEventArgs()
        {
            // Verify the ctor parameter is passed through to Cancel
            Assert.False(new CancelEventArgs().Cancel);
            Assert.False(new CancelEventArgs(false).Cancel);
            Assert.True(new CancelEventArgs(true).Cancel);

            // Verify updates to Cancel stick
            var ce = new CancelEventArgs();
            for (int i = 0; i < 2; i++)
            {
                ce.Cancel = false;
                Assert.False(ce.Cancel);
                ce.Cancel = true;
                Assert.True(ce.Cancel);
            }
        }
    }
}

Improve test / code coverage of System.ComponentModel

Trivial fix to improve the coverage of System.ComponentModel, which only contains one concrete type in the form of CancelEventArgs.


using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using MagicOnion.Server.Glue;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;

namespace Microsoft.AspNetCore.Routing
{
    public static class MagicOnionEndpointRouteBuilderExtensions
    {
        public static GrpcServiceEndpointConventionBuilder MapMagicOnionService(this IEndpointRouteBuilder builder)
        {
            var descriptor = builder.ServiceProvider.GetRequiredService<MagicOnionServiceDefinitionGlueDescriptor>();

            // builder.MapGrpcService<GlueServiceType>();
            var mapGrpcServiceMethod = typeof(GrpcEndpointRouteBuilderExtensions)
                .GetMethod(nameof(GrpcEndpointRouteBuilderExtensions.MapGrpcService), BindingFlags.Static | BindingFlags.Public)!
                .MakeGenericMethod(descriptor.GlueServiceType);

            return (GrpcServiceEndpointConventionBuilder)mapGrpcServiceMethod.Invoke(null, new[] { builder })!;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using MagicOnion.Server.Glue;
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;

namespace Microsoft.AspNetCore.Builder
{
    public static class MagicOnionEndpointRouteBuilderExtensions
    {
        public static GrpcServiceEndpointConventionBuilder MapMagicOnionService(this IEndpointRouteBuilder builder)
        {
            var descriptor = builder.ServiceProvider.GetRequiredService<MagicOnionServiceDefinitionGlueDescriptor>();

            // builder.MapGrpcService<GlueServiceType>();
            var mapGrpcServiceMethod = typeof(GrpcEndpointRouteBuilderExtensions)
                .GetMethod(nameof(GrpcEndpointRouteBuilderExtensions.MapGrpcService), BindingFlags.Static | BindingFlags.Public)!
                .MakeGenericMethod(descriptor.GlueServiceType);

            return (GrpcServiceEndpointConventionBuilder)mapGrpcServiceMethod.Invoke(null, new[] { builder })!;
        }
    }
}

Move namespace Microsoft.AspNetCore.Routing -> Microsoft.AspNetCore.Builder


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

using System;
using CoreGraphics;
using osu.Framework.Platform;
using UIKit;

namespace osu.Framework.iOS
{
    internal class GameViewController : UIViewController
    {
        private readonly IOSGameView view;
        private readonly GameHost host;

        public override bool PrefersStatusBarHidden() => true;

        public override UIRectEdge PreferredScreenEdgesDeferringSystemGestures => UIRectEdge.All;

        public GameViewController(IOSGameView view, GameHost host)
        {
            View = view;
            this.host = host;
        }

        public override void DidReceiveMemoryWarning()
        {
            base.DidReceiveMemoryWarning();
            host.Collect();
        }

        public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
        {
            coordinator.AnimateAlongsideTransition(_ => { }, _ => UIView.AnimationsEnabled = true);
            UIView.AnimationsEnabled = false;
            base.ViewWillTransitionToSize(toSize, coordinator);

            view.RequestResizeFrameBuffer();
        }
    }
}

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

using System;
using CoreGraphics;
using osu.Framework.Platform;
using UIKit;

namespace osu.Framework.iOS
{
    internal class GameViewController : UIViewController
    {
        private readonly IOSGameView gameView;
        private readonly GameHost gameHost;

        public override bool PrefersStatusBarHidden() => true;

        public override UIRectEdge PreferredScreenEdgesDeferringSystemGestures => UIRectEdge.All;

        public GameViewController(IOSGameView view, GameHost host)
        {
            View = view;

            gameView = view;
            gameHost = host;
        }

        public override void DidReceiveMemoryWarning()
        {
            base.DidReceiveMemoryWarning();
            gameHost.Collect();
        }

        public override void ViewWillTransitionToSize(CGSize toSize, IUIViewControllerTransitionCoordinator coordinator)
        {
            coordinator.AnimateAlongsideTransition(_ => { }, _ => UIView.AnimationsEnabled = true);
            UIView.AnimationsEnabled = false;

            base.ViewWillTransitionToSize(toSize, coordinator);
            gameView.RequestResizeFrameBuffer();
        }
    }
}

Fix iOS nullref on orientation change

Fix iOS nullref on orientation change


using System;
using System.Collections.Generic;
using Microsoft.Framework.DependencyInjection;

namespace Glimpse.Web
{
    public class MasterRequestRuntime
    {
        private readonly IEnumerable<IRequestRuntime> _requestRuntimes;

        public MasterRequestRuntime(IServiceProvider serviceProvider)
        {
            _requestRuntimes = serviceProvider.GetService<IDiscoverableCollection<IRequestRuntime>>();
        }

        public void Begin(IContext newContext)
        {

        }

        public void End(IContext newContext)
        {

        }
    }
}

using System;
using System.Collections.Generic;
using Microsoft.Framework.DependencyInjection;

namespace Glimpse.Web
{
    public class MasterRequestRuntime
    {
        private readonly IDiscoverableCollection<IRequestRuntime> _requestRuntimes;

        public MasterRequestRuntime(IServiceProvider serviceProvider)
        {
            _requestRuntimes = serviceProvider.GetService<IDiscoverableCollection<IRequestRuntime>>();
            _requestRuntimes.Discover();
        }

        public void Begin(IContext newContext)
        {

        }

        public void End(IContext newContext)
        {

        }
    }
}

Set MasterReqRuntime to discover types

Set MasterReqRuntime to discover types


using System.Globalization;
using System.Reflection;
using Jint.Native;

namespace Jint.Runtime.Descriptors.Specialized
{
    public sealed class IndexDescriptor : PropertyDescriptor
    {
        private readonly Engine _engine;
        private readonly object _key;
        private readonly object _item;
        private readonly MethodInfo _getter;
        private readonly MethodInfo _setter;

        public IndexDescriptor(Engine engine, string key, object item)
        {
            _engine = engine;
            _item = item;

            _getter = item.GetType().GetMethod("get_Item", BindingFlags.Instance | BindingFlags.Public);
            _setter = item.GetType().GetMethod("set_Item", BindingFlags.Instance | BindingFlags.Public);

            _key = _engine.Options.GetTypeConverter().Convert(key, _getter.GetParameters()[0].ParameterType, CultureInfo.InvariantCulture);

            Writable = true;
        }

        public override JsValue? Value
        {
            get
            {
                object[] parameters = { _key };
                return JsValue.FromObject(_engine, _getter.Invoke(_item, parameters));
            }

            set
            {
                var defaultValue = _item.GetType().IsValueType ? System.Activator.CreateInstance(_item.GetType()) : null;
                object[] parameters = { _key, value.HasValue ? value.Value.ToObject() : null };
                _setter.Invoke(_item, parameters);
            }
        }
    }
}

using System;
using System.Globalization;
using System.Linq;
using System.Reflection;
using Jint.Native;

namespace Jint.Runtime.Descriptors.Specialized
{
    public sealed class IndexDescriptor : PropertyDescriptor
    {
        private readonly Engine _engine;
        private readonly object _key;
        private readonly object _item;
        private readonly PropertyInfo _indexer;

        public IndexDescriptor(Engine engine, string key, object item)
        {
            _engine = engine;
            _item = item;

            // get all instance indexers with exactly 1 argument
            var indexers = item
                .GetType()
                .GetProperties(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public)
                .Where(x => x.GetIndexParameters().Length == 1);

            // try to find first indexer having either public getter or setter with matching argument type
            foreach (var indexer in indexers)
            {
                if (indexer.GetGetMethod() != null || indexer.GetSetMethod() != null)
                {
                    var paramType = indexer.GetIndexParameters()[0].ParameterType;
                    try
                    {
                        _key = _engine.Options.GetTypeConverter().Convert(key, paramType, CultureInfo.InvariantCulture);
                        _indexer = indexer;
                        break;
                    }
                    catch { }
                }
            }

            // throw if no indexer found
            if(_indexer == null)
                throw new InvalidOperationException("No matching indexer found.");

            Writable = true;
        }

        public override JsValue? Value
        {
            get
            {
                var getter = _indexer.GetGetMethod();
                if(getter == null)
                    throw new InvalidOperationException("Indexer has no public getter.");

                object[] parameters = { _key };
                return JsValue.FromObject(_engine, getter.Invoke(_item, parameters));
            }

            set
            {
                var setter = _indexer.GetSetMethod();
                if (setter == null)
                    throw new InvalidOperationException("Indexer has no public setter.");

                object[] parameters = { _key, value.HasValue ? value.Value.ToObject() : null };
                setter.Invoke(_item, parameters);
            }
        }
    }
}

Fix AmbiguousMatchException in multiple indexers, make getters and setters invocation consistent

If class has more than 1 public indexers, IndexDescriptor ctor throws
AmbiguousMatchException.
If class has a public getter, and another public setter, its handled
inconsistently i.e. you will read from one property and write to another
one.


using Microsoft.AspNetCore.SignalR;
using SO115App.Models.Servizi.CQRS.Commands.GestioneUtenti.CancellazioneUtente;
using SO115App.Models.Servizi.Infrastruttura.GestioneUtenti.GetUtenti;
using SO115App.Models.Servizi.Infrastruttura.Notification.GestioneUtenti;
using System;
using System.Threading.Tasks;

namespace SO115App.SignalR.Sender.GestioneUtenti
{
    public class NotificationDeleteUtente : INotifyDeleteUtente
    {
        private readonly IHubContext<NotificationHub> _notificationHubContext;
        private readonly IGetUtenteByCF _getUtenteByCF;

        public NotificationDeleteUtente(IHubContext<NotificationHub> notificationHubContext, IGetUtenteByCF getUtenteByCF)
        {
            _notificationHubContext = notificationHubContext;
            _getUtenteByCF = getUtenteByCF;
        }

        public async Task Notify(DeleteUtenteCommand command)
        {
            await _notificationHubContext.Clients.Group(command.CodiceSede).SendAsync("NotifyRefreshUtenti", true);
            await _notificationHubContext.Clients.Group(command.UtenteRimosso.Sede.Codice).SendAsync("NotifyRefreshUtenti", true);
            await _notificationHubContext.Clients.All.SendAsync("NotifyDeleteUtente", command.UtenteRimosso.Id);
        }
    }
}

using Microsoft.AspNetCore.SignalR;
using SO115App.Models.Servizi.CQRS.Commands.GestioneUtenti.CancellazioneUtente;
using SO115App.Models.Servizi.Infrastruttura.GestioneUtenti.GetUtenti;
using SO115App.Models.Servizi.Infrastruttura.Notification.GestioneUtenti;
using System;
using System.Threading.Tasks;

namespace SO115App.SignalR.Sender.GestioneUtenti
{
    public class NotificationDeleteUtente : INotifyDeleteUtente
    {
        private readonly IHubContext<NotificationHub> _notificationHubContext;
        private readonly IGetUtenteByCF _getUtenteByCF;

        public NotificationDeleteUtente(IHubContext<NotificationHub> notificationHubContext, IGetUtenteByCF getUtenteByCF)
        {
            _notificationHubContext = notificationHubContext;
            _getUtenteByCF = getUtenteByCF;
        }

        public async Task Notify(DeleteUtenteCommand command)
        {
            var utente = _getUtenteByCF.Get(command.CodFiscale);
            await _notificationHubContext.Clients.Group(utente.Sede.Codice).SendAsync("NotifyRefreshUtenti", true);
            await _notificationHubContext.Clients.Group(command.UtenteRimosso.Sede.Codice).SendAsync("NotifyRefreshUtenti", true);
            await _notificationHubContext.Clients.All.SendAsync("NotifyDeleteUtente", command.UtenteRimosso.Id);
        }
    }
}

Fix - Notifica cancellazione utente

Fix - Notifica cancellazione utente


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

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

namespace osu.Framework.Extensions
{
    public static class TaskExtensions
    {
        /// <summary>
        /// Safe alternative to Task.Wait which ensures the calling thread is not a thread pool thread.
        /// </summary>
        public static void WaitSafely(this Task task)
        {
            if (Thread.CurrentThread.IsThreadPoolThread)
                throw new InvalidOperationException($"Can't use {nameof(WaitSafely)} from inside an async operation.");

#pragma warning disable RS0030
            task.Wait();
#pragma warning restore RS0030
        }

        /// <summary>
        /// Safe alternative to Task.Result which ensures the calling thread is not a thread pool thread.
        /// </summary>
        public static T WaitSafelyForResult<T>(this Task<T> task)
        {
            if (Thread.CurrentThread.IsThreadPoolThread)
                throw new InvalidOperationException($"Can't use {nameof(WaitSafelyForResult)} from inside an async operation.");

#pragma warning disable RS0030
            return task.Result;
#pragma warning restore RS0030
        }
    }
}

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

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

namespace osu.Framework.Extensions
{
    public static class TaskExtensions
    {
        /// <summary>
        /// Safe alternative to Task.Wait which ensures the calling thread is not a thread pool thread.
        /// </summary>
        public static void WaitSafely(this Task task)
        {
            if (Thread.CurrentThread.IsThreadPoolThread)
                throw new InvalidOperationException($"Can't use {nameof(WaitSafely)} from inside an async operation.");

#pragma warning disable RS0030
            task.Wait();
#pragma warning restore RS0030
        }

        /// <summary>
        /// Safe alternative to Task.Result which ensures the calling thread is not a thread pool thread.
        /// </summary>
        public static T WaitSafelyForResult<T>(this Task<T> task)
        {
            // We commonly access `.Result` from within `ContinueWith`, which is a safe usage (the task is guaranteed to be completed).
            // Unfortunately, the only way to allow these usages is to check whether the task is completed or not here.
            // This does mean that there could be edge cases where this safety is skipped (ie. if the majority of executions complete
            // immediately).
            if (Thread.CurrentThread.IsThreadPoolThread && !task.IsCompleted)
                throw new InvalidOperationException($"Can't use {nameof(WaitSafelyForResult)} from inside an async operation.");

#pragma warning disable RS0030
            return task.Result;
#pragma warning restore RS0030
        }
    }
}

Add exception for usage of `.Result` within `.ContinueWith` continuations


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

using System.Collections.Generic;
using OpenTK.Graphics;
using osu.Game.Beatmaps.Timing;
using osu.Game.Database;
using osu.Game.Modes.Objects;

namespace osu.Game.Beatmaps
{
    public class Beatmap
    {
        public BeatmapInfo BeatmapInfo { get; set; }
        public BeatmapMetadata Metadata => BeatmapInfo?.Metadata ?? BeatmapInfo?.BeatmapSet?.Metadata;
        public List<HitObject> HitObjects { get; set; }
        public List<ControlPoint> ControlPoints { get; set; }
        public List<Color4> ComboColors { get; set; }

        public double BeatLengthAt(double time, bool applyMultipliers = false)
        {
            int point = 0;
            int samplePoint = 0;

            for (int i = 0; i < ControlPoints.Count; i++)
                if (ControlPoints[i].Time <= time)
                {
                    if (ControlPoints[i].TimingChange)
                        point = i;
                    else
                        samplePoint = i;
                }

            double mult = 1;

            if (applyMultipliers && samplePoint > point && ControlPoints[samplePoint].BeatLength < 0)
                mult = ControlPoints[samplePoint].VelocityAdjustment;

            return ControlPoints[point].BeatLength * mult;
        }
    }
}

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

using System.Collections.Generic;
using OpenTK.Graphics;
using osu.Game.Beatmaps.Timing;
using osu.Game.Database;
using osu.Game.Modes.Objects;

namespace osu.Game.Beatmaps
{
    public class Beatmap
    {
        public BeatmapInfo BeatmapInfo { get; set; }
        public BeatmapMetadata Metadata => BeatmapInfo?.Metadata ?? BeatmapInfo?.BeatmapSet?.Metadata;
        public List<HitObject> HitObjects { get; set; }
        public List<ControlPoint> ControlPoints { get; set; }
        public List<Color4> ComboColors { get; set; }

        public double BeatLengthAt(double time, bool applyMultipliers = false)
        {
            int point = 0;
            int samplePoint = 0;

            for (int i = 0; i < ControlPoints.Count; i++)
                if (ControlPoints[i].Time <= time)
                {
                    if (ControlPoints[i].TimingChange)
                        point = i;
                    else
                        samplePoint = i;
                }

            double mult = 1;

            if (applyMultipliers && samplePoint > point)
                mult = ControlPoints[samplePoint].VelocityAdjustment;

            return ControlPoints[point].BeatLength * mult;
        }
    }
}

Fix slider velocity not being applied.

Fix slider velocity not being applied.


using Serilog.Events;

namespace Serilog
{
    /// <summary>
    /// Extension method 'ForContext' for ILogger.
    /// </summary>
    public static class ForContextExtension
    {
        /// <summary>
        /// Create a logger that enriches log events with the specified property based on log event level.
        /// </summary>
        /// <typeparam name="TValue"> The type of the property value. </typeparam>
        /// <param name="logger">The logger</param>
        /// <param name="level">The log event level used to determine if log is enriched with property.</param>
        /// <param name="propertyName">The name of the property. Must be non-empty.</param>
        /// <param name="value">The property value.</param>
        /// <param name="destructureObjects">If true, the value will be serialized as a structured
        /// object if possible; if false, the object will be recorded as a scalar or simple array.</param>
        /// <returns>A logger that will enrich log events as specified.</returns>
        /// <returns></returns>
        public static ILogger ForContext<TValue>(
            this ILogger logger,
            LogEventLevel level,
            string propertyName,
            TValue value,
            bool destructureObjects = false)
        {
            return !logger.IsEnabled(level)
                ? logger
                : logger.ForContext(propertyName, value, destructureObjects);
        }
    }
}

using System;
using Serilog.Events;

namespace Serilog
{
    /// <summary>
    /// Extension method 'ForContext' for ILogger.
    /// </summary>
    public static class ForContextExtension
    {
        /// <summary>
        /// Create a logger that enriches log events with the specified property based on log event level.
        /// </summary>
        /// <typeparam name="TValue"> The type of the property value. </typeparam>
        /// <param name="logger">The logger</param>
        /// <param name="level">The log event level used to determine if log is enriched with property.</param>
        /// <param name="propertyName">The name of the property. Must be non-empty.</param>
        /// <param name="value">The property value.</param>
        /// <param name="destructureObjects">If true, the value will be serialized as a structured
        /// object if possible; if false, the object will be recorded as a scalar or simple array.</param>
        /// <returns>A logger that will enrich log events as specified.</returns>
        /// <returns></returns>
        public static ILogger ForContext<TValue>(
            this ILogger logger,
            LogEventLevel level,
            string propertyName,
            TValue value,
            bool destructureObjects = false)
        {
            if (logger == null)
                throw new ArgumentNullException(nameof(logger));

            return !logger.IsEnabled(level)
                ? logger
                : logger.ForContext(propertyName, value, destructureObjects);
        }
    }
}

Check if logger is null and throw

Check if logger is null and throw

Part of feedback for #1002


using System;
using System.Threading;
using NUnit.Framework;

namespace JustSaying.TestingFramework
{
    public static class Patiently
    {
        public static void VerifyExpectation(Action expression)
        {
            VerifyExpectation(expression, 5.Seconds());
        }

        public static void VerifyExpectation(Action expression, TimeSpan timeout)
        {
            bool hasTimedOut;
            var started = DateTime.Now;
            do
            {
                try
                {
                    expression.Invoke();
                    return;
                }
                catch { }
                hasTimedOut = timeout < DateTime.Now - started;
                Thread.Sleep(TimeSpan.FromMilliseconds(50));
                Console.WriteLine("Waiting for {0} ms - Still Checking.", (DateTime.Now - started).TotalMilliseconds);
            } while (!hasTimedOut);
            expression.Invoke();
        }

        public static void AssertThat(Func<bool> func)
        {
            AssertThat(func, 5.Seconds());
        }

        public static void AssertThat(Func<bool> func, TimeSpan timeout)
        {
            bool result;
            bool hasTimedOut;
            var started = DateTime.Now;
            do
            {
                result = func.Invoke();
                hasTimedOut = timeout < DateTime.Now - started;
                Thread.Sleep(TimeSpan.FromMilliseconds(50));
                Console.WriteLine("Waiting for {0} ms - Still Checking.", (DateTime.Now - started).TotalMilliseconds);
            } while (!result && !hasTimedOut);

            Assert.True(result);
        }
    }
    public static class Extensions
    {
        public static TimeSpan Seconds(this int seconds)
        {
            return TimeSpan.FromSeconds(seconds);
        }
    }
}

using System;
using System.Threading;
using NUnit.Framework;

namespace JustSaying.TestingFramework
{
    public static class Patiently
    {
        public static void VerifyExpectation(Action expression)
        {
            VerifyExpectation(expression, 5.Seconds());
        }

        public static void VerifyExpectation(Action expression, TimeSpan timeout)
        {
            bool hasTimedOut;
            var started = DateTime.Now;
            do
            {
                try
                {
                    expression.Invoke();
                    return;
                }
                catch { }
                hasTimedOut = timeout < DateTime.Now - started;
                Thread.Sleep(TimeSpan.FromMilliseconds(50));
                Console.WriteLine("Waiting for {0} ms - Still Checking.", (DateTime.Now - started).TotalMilliseconds);
            } while (!hasTimedOut);
            expression.Invoke();
        }

        public static void AssertThat(Func<bool> func)
        {
            AssertThat(func, 10.Seconds());
        }

        public static void AssertThat(Func<bool> func, TimeSpan timeout)
        {
            bool result;
            bool hasTimedOut;
            var started = DateTime.Now;
            do
            {
                result = func.Invoke();
                hasTimedOut = timeout < DateTime.Now - started;
                Thread.Sleep(TimeSpan.FromMilliseconds(50));
                Console.WriteLine("Waiting for {0} ms - Still Checking.", (DateTime.Now - started).TotalMilliseconds);
            } while (!result && !hasTimedOut);

            Assert.True(result);
        }
    }
    public static class Extensions
    {
        public static TimeSpan Seconds(this int seconds)
        {
            return TimeSpan.FromSeconds(seconds);
        }
    }
}

Increase the maximum time we wait for long running tests from 5 to 10.


using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using PdfAutofill.Model;
using PdfAutofill.Service;
using PdfAutofill.Service.Impl;

namespace PdfAutofill.Controllers
{
    [Route("api/[controller]")]
    public class PdfController : Controller
    {
        private readonly IPdfService _service = new PdfService();

        [HttpGet]
        public List<string> Get([FromHeader(Name = "url")]string url)
        {
            if (!string.IsNullOrWhiteSpace(url))
            {
                _service.InitDocument(url);

                return _service.GetAcroFields().Select(x => x.Key).ToList();
            }

            return null;
        }

        [HttpPost]
        public string Post([FromBody]PdfViewModel model)
        {
            _service.InitDocument(model);

            var pdf = _service.FillPdf(model);

            // TODO Exception handling and validation

            return pdf;
        }
    }
}

using System.Linq;
using Microsoft.AspNetCore.Mvc;
using PdfAutofill.Model;
using PdfAutofill.Service;
using PdfAutofill.Service.Impl;

namespace PdfAutofill.Controllers
{
    [Route("api/[controller]")]
    public class PdfController : Controller
    {
        private readonly IPdfService _service = new PdfService();

        [HttpGet]
        public IActionResult Get([FromHeader(Name = "url")]string url)
        {
            if (!string.IsNullOrWhiteSpace(url))
            {
                _service.InitDocument(url);

                return Ok(_service.GetAcroFields().Select(x => x.Key).ToList());
            }

            ModelState.AddModelError("url", "Url is missing");
            return BadRequest(ModelState);
        }

        [HttpPost]
        public IActionResult Post([FromBody]PdfViewModel model)
        {
            _service.InitDocument(model);

            var pdf = _service.FillPdf(model);

            // TODO Exception handling and validation

            return Ok(pdf);
        }
    }
}

Improve responses from pdf controller

Improve responses from pdf controller


namespace BigEgg.Tools.PowerMode.Settings
{
    public enum ParticlesColorType
    {
        Cursor,
        Random,
        Fixed
    }
}

namespace BigEgg.Tools.PowerMode.Settings
{
    public enum ParticlesColorType
    {
        Random,
        Fixed
    }
}

Remove cursor color type for now

Remove cursor color type for now


using dotless.Infrastructure;

namespace dotless.Tree
{
  public class Quoted : Node
  {
    public string Value { get; set; }
    public string Contents { get; set; }

    public Quoted(string value, string contents)
    {
      Value = value;
      Contents = contents;
    }

    public override string ToCSS(Env env)
    {
      return Value;
    }
  }
}

using System.Text.RegularExpressions;
using dotless.Infrastructure;

namespace dotless.Tree
{
  public class Quoted : Node
  {
    public string Value { get; set; }
    public string Contents { get; set; }

    public Quoted(string value, string contents)
    {
      Value = value;
      Contents = contents;
    }

    public Quoted(string value)
      : this(value, value)
    {
    }

    public override string ToCSS(Env env)
    {
      return Value;
    }

    private readonly Regex _unescape = new Regex(@"(^|[^\\])\\(.)");
    public string UnescapeContents()
    {
      return _unescape.Replace(Contents, @"$1$2");
    }
  }
}

Add method to unescape string.

Add method to unescape string.


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

using System;
using System.IO;

#nullable enable

namespace osu.Framework.Audio.Callbacks
{
    /// <summary>
    /// Implementation of <see cref="IFileProcedures"/> that supports reading from a <see cref="Stream"/>.
    /// </summary>
    internal class DataStreamFileProcedures : IFileProcedures
    {
        private readonly Stream dataStream;

        public DataStreamFileProcedures(Stream data)
        {
            dataStream = data;
        }

        public void Close(IntPtr user)
        {
        }

        public long Length(IntPtr user)
        {
            if (!dataStream.CanSeek) return 0;

            try
            {
                return dataStream.Length;
            }
            catch
            {
                return 0;
            }
        }

        public unsafe int Read(IntPtr buffer, int length, IntPtr user)
        {
            if (!dataStream.CanRead) return 0;

            try
            {
                return dataStream.Read(new Span<byte>((void*)buffer, length));
            }
            catch
            {
                return 0;
            }
        }

        public bool Seek(long offset, IntPtr user)
        {
            if (!dataStream.CanSeek) return false;

            try
            {
                return dataStream.Seek(offset, SeekOrigin.Begin) == offset;
            }
            catch
            {
                return false;
            }
        }
    }
}

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

using System;
using System.IO;

#nullable enable

namespace osu.Framework.Audio.Callbacks
{
    /// <summary>
    /// Implementation of <see cref="IFileProcedures"/> that supports reading from a <see cref="Stream"/>.
    /// </summary>
    public class DataStreamFileProcedures : IFileProcedures
    {
        private readonly Stream dataStream;

        public DataStreamFileProcedures(Stream data)
        {
            dataStream = data ?? throw new ArgumentNullException(nameof(data));
        }

        public void Close(IntPtr user)
        {
        }

        public long Length(IntPtr user)
        {
            if (!dataStream.CanSeek) return 0;

            try
            {
                return dataStream.Length;
            }
            catch
            {
                return 0;
            }
        }

        public unsafe int Read(IntPtr buffer, int length, IntPtr user)
        {
            if (!dataStream.CanRead) return 0;

            try
            {
                return dataStream.Read(new Span<byte>((void*)buffer, length));
            }
            catch
            {
                return 0;
            }
        }

        public bool Seek(long offset, IntPtr user)
        {
            if (!dataStream.CanSeek) return false;

            try
            {
                return dataStream.Seek(offset, SeekOrigin.Begin) == offset;
            }
            catch
            {
                return false;
            }
        }
    }
}

Revert visibility change and add null check


using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class LoadTest : MonoBehaviour
{
	public void SignInButtonClicked()
	{
		GameJolt.UI.Manager.Instance.ShowSignIn((bool success) => {
			if (success)
			{
				Debug.Log("Logged In");
			}
			else
			{
				Debug.Log("Dismissed");
			}
		});
	}

	public void IsSignedInButtonClicked() {
		bool isSignedIn = GameJolt.API.Manager.Instance.CurrentUser != null;
		if (isSignedIn) {
			Debug.Log("Signed In");
		}
		else {
			Debug.Log("Not Signed In");
		}
	}

	public void LoadSceneButtonClicked(string sceneName) {
		Debug.Log("Loading Scene " + sceneName);
#if UNITY_5_0 || UNITY_5_1 || UNITY_5_2
		Application.LoadLevel(sceneName);
#else
		UnityEngine.SceneManagement.SceneManager.LoadScene(sceneName);
#endif
	}
}

using UnityEngine;
using UnityEngine.UI;
using System.Collections;

public class LoadTest : MonoBehaviour
{
	public void SignInButtonClicked()
	{
		GameJolt.UI.Manager.Instance.ShowSignIn((bool success) => {
			if (success)
			{
				GameJolt.UI.Manager.Instance.QueueNotification("Welcome");
			}
			else
			{
				GameJolt.UI.Manager.Instance.QueueNotification("Closed the window :(");
			}
		});
	}

	public void IsSignedInButtonClicked() {
		if (GameJolt.API.Manager.Instance.CurrentUser != null) {
			GameJolt.UI.Manager.Instance.QueueNotification(
				"Signed in as " + GameJolt.API.Manager.Instance.CurrentUser.Name);
		}
		else {
			GameJolt.UI.Manager.Instance.QueueNotification("Not Signed In :(");
		}
	}

	public void LoadSceneButtonClicked(string sceneName) {
		Debug.Log("Loading Scene " + sceneName);
#if UNITY_5_0 || UNITY_5_1 || UNITY_5_2
		Application.LoadLevel(sceneName);
#else
		UnityEngine.SceneManagement.SceneManager.LoadScene(sceneName);
#endif
	}
}

Use notification instead of debug to allow testing outside of editor


namespace GeneratorAPI {
    /// <summary>
    ///     Represents a generic generator which can generate any ammount of elements.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IGenerator<out T> : IGenerator {
        /// <summary>
        ///     Generate next element.
        /// </summary>
        new T Generate();
    }

    public interface IGenerator {
        object Generate();
    }
}

namespace GeneratorAPI {
    /// <summary>
    ///     Represents a generic generator which can generate any ammount of elements.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IGenerator<out T> : IGenerator {
        /// <summary>
        ///     Generate next element.
        /// </summary>
        new T Generate();
    }

    /// <summary>
    ///     Represent a generator which can generate any ammount of elements.
    /// </summary>
    public interface IGenerator {
        /// <summary>
        ///     Generate next element.
        /// </summary>
        object Generate();
    }
}

Add comments for none generic generator

Add comments for none generic generator

Former-commit-id: 33025974571043731929fbe9f947010ea503d6a5


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

public class Ball : NetworkBehaviour {

    private Rigidbody rigidBody = null;
    private Vector3 startingPosition = Vector3.zero;
    float minimumVelocity = 5;
    float startingMinVelocity = -10;
    float startingMaxVelocity = 10;

    // Use this for initialization
    void Start () {
        if (!isServer) return;

        rigidBody = GetComponent<Rigidbody>();
        startingPosition = transform.position;
    }

    private void FixedUpdate()
    {
        if (!isServer) return;

        if (rigidBody.velocity.magnitude < minimumVelocity)
        {
            rigidBody.velocity = rigidBody.velocity * 1.25f;
        }
    }

    public void ResetPosition()
    {
        if (!isServer) return;

        transform.position = startingPosition;
    }
}

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

public class Ball : NetworkBehaviour {

    private Rigidbody rigidBody = null;
    private Vector3 startingPosition = Vector3.zero;
    float minimumVelocity = 5;
    float startingMinVelocity = -10;
    float startingMaxVelocity = 10;

    // Use this for initialization
    void Start () {
        if (!isServer) return;

        rigidBody = GetComponent<Rigidbody>();
        startingPosition = transform.position;
    }

    private void FixedUpdate()
    {
        if (!isServer) return;

        if (rigidBody.velocity.magnitude < minimumVelocity)
        {
            rigidBody.velocity = rigidBody.velocity * 1.25f;
        }
    }

    public void ResetPosition()
    {
        if (!isServer) return;
        rigidBody.velocity = Vector3.zero;
        transform.forward = new Vector3(1, 0, 1);
        transform.position = startingPosition;
    }
}

Set velocity and forward vector when resetting ball position


using NuGet.OutputWindowConsole;
using NuGetConsole;

namespace NuGet.Dialog.PackageManagerUI {
    internal class SmartOutputConsoleProvider : IOutputConsoleProvider {

        private readonly IOutputConsoleProvider _baseProvider;
        private bool _isFirstTime = true;

        public SmartOutputConsoleProvider(IOutputConsoleProvider baseProvider) {
            _baseProvider = baseProvider;
        }

        public IConsole CreateOutputConsole(bool requirePowerShellHost) {
            IConsole console = _baseProvider.CreateOutputConsole(requirePowerShellHost);

            if (_isFirstTime) {
                // the first time the console is accessed after dialog is opened, we clear the console.
                console.Clear();
            }
            else {
                _isFirstTime = false;
            }

            return console;
        }
    }
}

using NuGet.OutputWindowConsole;
using NuGetConsole;

namespace NuGet.Dialog.PackageManagerUI {
    internal class SmartOutputConsoleProvider : IOutputConsoleProvider {

        private readonly IOutputConsoleProvider _baseProvider;
        private bool _isFirstTime = true;

        public SmartOutputConsoleProvider(IOutputConsoleProvider baseProvider) {
            _baseProvider = baseProvider;
        }

        public IConsole CreateOutputConsole(bool requirePowerShellHost) {
            IConsole console = _baseProvider.CreateOutputConsole(requirePowerShellHost);

            if (_isFirstTime) {
                // the first time the console is accessed after dialog is opened, we clear the console.
                console.Clear();
                _isFirstTime = false;
            }

            return console;
        }
    }
}

Fix the wrong conditional statement.

Fix the wrong conditional statement.

--HG--
branch : 1.1


namespace SuperPutty
{
    partial class ToolWindow
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ToolWindow));
            this.SuspendLayout();
            //
            // ToolWindow
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 264);
            this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Name = "ToolWindow";
            this.Text = "ToolWindow";
            this.ResumeLayout(false);

        }

        #endregion
    }
}

namespace SuperPutty
{
    partial class ToolWindow
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ToolWindow));
            this.SuspendLayout();
            //
            // ToolWindow
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(279, 253);
            this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Name = "ToolWindow";
            this.Text = "ToolWindow";
            this.ResumeLayout(false);

        }

        #endregion
    }
}

Update b/c of new dockpanel

Update b/c of new dockpanel

git-svn-id: c7824798988443d6e8397993074642516d192594@98 8d6e282c-8220-11de-b77e-d9b456c0130a


<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title</title>
    @Styles.Render("~/Content/themes/base/css", "~/Content/css")
    @Scripts.Render("~/bundles/modernizr")
</head>
<body>
    @RenderBody()

    @Scripts.Render("~/bundles/jquery")
    @RenderSection("scripts", required: false)
</body>
</html>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title</title>
    @Styles.Render("~/Content/themes/base/css", "~/Content/css")
    @Scripts.Render("~/bundles/modernizr")
</head>
<body>
    @RenderBody()

    @Scripts.Render("~/bundles/jquery")
    @RenderSection("scripts", required: false)
</body>
</html>

Set the document language to English

Set the document language to English


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

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

        private void Slapshot_SizeChanged(object sender, EventArgs e)
        {
            if (this.WindowState == FormWindowState.Minimized)
            {
                minimizeToTray();
            }
        }

        private void Slapshot_Load(object sender, EventArgs e)
        {
            minimizeToTray();
        }

        private void minimizeToTray()
        {
            ApplicationIcon.Visible = true;
            this.WindowState = FormWindowState.Minimized;
            this.ShowInTaskbar = false;
        }

        private void CaptureMenuItem_Click(object sender, EventArgs e)
        {
            var screenshot = new Screenshot(".", ImageFormat.Png);
            screenshot.CaptureEntireScreen();
        }

        private void CloseMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}

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

namespace Slapshot
{
    public partial class Slapshot : Form
    {

        private string SaveDirectory;
        private ImageFormat SaveFormat;

        public Slapshot()
        {
            SaveDirectory = ".";
            SaveFormat = ImageFormat.Png;
            InitializeComponent();
        }

        private void Slapshot_SizeChanged(object sender, EventArgs e)
        {
            if (this.WindowState == FormWindowState.Minimized)
            {
                minimizeToTray();
            }
        }

        private void Slapshot_Load(object sender, EventArgs e)
        {
            minimizeToTray();
        }

        private void minimizeToTray()
        {
            ApplicationIcon.Visible = true;
            this.WindowState = FormWindowState.Minimized;
            this.ShowInTaskbar = false;
        }

        private void CaptureMenuItem_Click(object sender, EventArgs e)
        {
            var screenshot = new Screenshot(SaveDirectory, SaveFormat);
            screenshot.CaptureEntireScreen();
        }

        private void CloseMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}

Create object fields for save directory and image type


using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;

public class MattBobke : IAmACommunityMember, IFilterMyBlogPosts
    {
        public string FirstName => "Matt";
        public string LastName => "Bobke";
        public string ShortBioOrTagLine => "Desktop Support Specialist with admninistrative tendencies excited about PowerShell and automation.";
        public string StateOrRegion => "California, United States";
        public string GravatarHash => "6f38a96cd055f95eacd1d3d102e309fa";
        public string EmailAddress => "matt@mattbobke.com";
        public string TwitterHandle => "MattBobke";
        public string GitHubHandle => "mcbobke";
        public GeoPosition Position => new GeoPosition(33.6469, -117.6861);

        public Uri WebSite => new Uri("https://blog.mattbobke.com");
        public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://blog.mattbobke.com/feed/atom/"); } }

        public bool Filter(SyndicationItem item)
        {
            // This filters out only the posts that have the "PowerShell" category
            return item.Categories.Any(c => c.Name.ToLowerInvariant().Equals("powershell"));
        }
    }

using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;

public class MattBobke : IAmACommunityMember, IFilterMyBlogPosts
    {
        public string FirstName => "Matt";
        public string LastName => "Bobke";
        public string ShortBioOrTagLine => "Desktop Support Specialist with admninistrative tendencies excited about PowerShell and automation.";
        public string StateOrRegion => "California, United States";
        public string GravatarHash => "6f38a96cd055f95eacd1d3d102e309fa";
        public string EmailAddress => "matt@mattbobke.com";
        public string TwitterHandle => "MattBobke";
        public string GitHubHandle => "mcbobke";
        public GeoPosition Position => new GeoPosition(33.6469, -117.6861);

        public Uri WebSite => new Uri("https://mattbobke.com");
        public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://mattbobke.com/feed/atom/"); } }

        public bool Filter(SyndicationItem item)
        {
            // This filters out only the posts that have the "PowerShell" category
            return item.Categories.Any(c => c.Name.ToLowerInvariant().Equals("powershell"));
        }
    }

Update website URI to root domain

Update website URI to root domain


@Html.ActionLink("Courses", "Index", "Race")

@Html.ActionLink("Catégories", "Index", "Category")

@if (User.IsInRole("Administrateur"))
{

@Html.ActionLink("Liste des points", "Index", "Point")

@Html.ActionLink("Importer les résultats", "Import", "Resultat")

}

@if (User.IsInRole("Administrateur"))
{

@Html.ActionLink("Type de Point", "Index", "TypePoint")

}

@if (Request.IsAuthenticated) {

@Html.ActionLink("Mes Inscriptions", "Index", "Participant")

}

@Html.ActionLink("Courses", "Index", "Race")

@if (User.IsInRole("Administrateur"))
{

@Html.ActionLink("Liste des points", "Index", "Point")

@Html.ActionLink("Importer les résultats", "Import", "Resultat")

}

@if (User.IsInRole("Administrateur"))
{

@Html.ActionLink("Type de Point", "Index", "TypePoint")

}

@if (Request.IsAuthenticated) {

@Html.ActionLink("Mes Inscriptions", "Index", "Participant")

}

Remove Category link in menu

Remove Category link in menu


using System;
using GitHub.Unity;
using NUnit.Framework;

namespace IntegrationTests
{
    [SetUpFixture]
    public class SetUpFixture
    {
        [SetUp]
        public void Setup()
        {
            Logging.TracingEnabled = true;

            Logging.LogAdapter = new MultipleLogAdapter(
                new FileLogAdapter($"..\\{DateTime.UtcNow.ToString("yyyyMMddHHmmss")}-integration-tests.log")
                , new ConsoleLogAdapter()
            );
        }
    }
}

using System;
using GitHub.Unity;
using NUnit.Framework;

namespace IntegrationTests
{
    [SetUpFixture]
    public class SetUpFixture
    {
        [SetUp]
        public void Setup()
        {
            Logging.TracingEnabled = true;

            Logging.LogAdapter = new MultipleLogAdapter(
                new FileLogAdapter($"..\\{DateTime.UtcNow.ToString("yyyyMMddHHmmss")}-integration-tests.log")
                //, new ConsoleLogAdapter()
            );
        }
    }
}

Disable ConsoleLogAdapter in test output


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

namespace Silverpop.Core.Performance
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var tagValue = new string(
                Enumerable.Repeat("ABC", 1000)
                    .SelectMany(x => x)
                    .ToArray());

            var personalizationTags = new TestPersonalizationTags()
            {
                TagA = tagValue,
                TagB = tagValue,
                TagC = tagValue,
                TagD = tagValue,
                TagE = tagValue,
                TagF = tagValue,
                TagG = tagValue,
                TagH = tagValue,
                TagI = tagValue,
                TagJ = tagValue,
                TagK = tagValue,
                TagL = tagValue,
                TagM = tagValue,
                TagN = tagValue,
                TagO = tagValue
            };

            var numberOfTags = personalizationTags.GetType().GetProperties().Count();

            Console.WriteLine("Testing 1 million recipients with {0} tags using batches of 5000:", numberOfTags);
            new TransactMessagePerformance()
                .InvokeGetRecipientBatchedMessages(1000000, 5000, personalizationTags);

            Console.WriteLine("Testing 5 million recipients with {0} tags using batches of 5000:", numberOfTags);
            new TransactMessagePerformance()
                .InvokeGetRecipientBatchedMessages(5000000, 5000, personalizationTags);

            Console.ReadLine();
        }
    }
}

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

namespace Silverpop.Core.Performance
{
    internal class Program
    {
        private static IEnumerable<int> TestRecipientCounts = new List<int>()
        {
            1000000,
            5000000,
        };

        private static int TestRecipientsPerBatch = 5000;

        private static void Main(string[] args)
        {
            var tagValue = new string(
                Enumerable.Repeat("ABC", 1000)
                    .SelectMany(x => x)
                    .ToArray());

            var personalizationTags = new TestPersonalizationTags()
            {
                TagA = tagValue,
                TagB = tagValue,
                TagC = tagValue,
                TagD = tagValue,
                TagE = tagValue,
                TagF = tagValue,
                TagG = tagValue,
                TagH = tagValue,
                TagI = tagValue,
                TagJ = tagValue,
                TagK = tagValue,
                TagL = tagValue,
                TagM = tagValue,
                TagN = tagValue,
                TagO = tagValue
            };

            var numberOfTags = personalizationTags.GetType().GetProperties().Count();

            foreach (var testRecipientCount in TestRecipientCounts)
            {
                Console.WriteLine(
                    "Testing {0} recipients with {1} tags using batches of {2}:",
                    testRecipientCount,
                    numberOfTags,
                    TestRecipientsPerBatch);

                new TransactMessagePerformance()
                    .InvokeGetRecipientBatchedMessages(
                        testRecipientCount,
                        TestRecipientsPerBatch,
                        personalizationTags);
            }

            Console.ReadLine();
        }
    }
}

Move hardcoded values into static fields

- Slightly changes the output, no longer prints
  "1 million" and instead prints "1000000", etc.


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

namespace Alexa.NET.Request
{
    public class SupportedInterfaces
    {

    }
}

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

namespace Alexa.NET.Request
{
    public static class SupportedInterfaces
    {
        public const string Display = "Display";
        public const string AudioPlayer = "AudioPlayer";
        public const string VideoApp = "VideoApp";
    }
}

Add SupportedInterface strings to allow discovery. Including VideoApp for new directive.


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

// Passing a very large struct by value on the stack, on arm32 and x86,
// can cause it to be copied from a temp to the outgoing space without
// probing the stack.

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

namespace BigFrames
{

    [StructLayout(LayoutKind.Explicit)]
    public struct LargeStructWithRef
    {
        [FieldOffset(0)]
        public int i1;
        [FieldOffset(65500)]
        public Object o1;
    }

    public class Test
    {
        public static int iret = 1;

        [MethodImplAttribute(MethodImplOptions.NoInlining)]
        public static void TestWrite(LargeStructWithRef s)
        {
            Console.Write("Enter TestWrite: ");
            Console.WriteLine(s.o1.GetHashCode());
            iret = 100;
        }

        [MethodImplAttribute(MethodImplOptions.NoInlining)]
        public static void Test1()
        {
            Console.WriteLine("Enter Test1");
            LargeStructWithRef s = new LargeStructWithRef();
            s.o1 = new Object();
            TestWrite(s);
        }

        public static int Main()
        {
            Test1();

            if (iret == 100)
            {
                Console.WriteLine("TEST PASSED");
            }
            else
            {
                Console.WriteLine("TEST FAILED");
            }
            return iret;
        }
    }
}

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

// Passing a very large struct by value on the stack, on arm32 and x86,
// can cause it to be copied from a temp to the outgoing space without
// probing the stack.

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

namespace BigFrames
{

    [StructLayout(LayoutKind.Explicit)]
    public struct LargeStructWithRef
    {
        [FieldOffset(0)]
        public int i1;
        [FieldOffset(65496)] // Must be 8-byte aligned for test to work on 64-bit platforms.
        public Object o1;
    }

    public class Test
    {
        public static int iret = 1;

        [MethodImplAttribute(MethodImplOptions.NoInlining)]
        public static void TestWrite(LargeStructWithRef s)
        {
            Console.Write("Enter TestWrite: ");
            Console.WriteLine(s.o1.GetHashCode());
            iret = 100;
        }

        [MethodImplAttribute(MethodImplOptions.NoInlining)]
        public static void Test1()
        {
            Console.WriteLine("Enter Test1");
            LargeStructWithRef s = new LargeStructWithRef();
            s.o1 = new Object();
            TestWrite(s);
        }

        public static int Main()
        {
            Test1();

            if (iret == 100)
            {
                Console.WriteLine("TEST PASSED");
            }
            else
            {
                Console.WriteLine("TEST FAILED");
            }
            return iret;
        }
    }
}

Fix test for 64-bit platforms

Fix test for 64-bit platforms

Object type in structs apparently must be 8 byte aligned.

Fixes #23986


using System;

using JetBrains.Application;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.Tree;
using JetBrains.ReSharper.UnitTestFramework;

namespace ReSharperFixieRunner.UnitTestProvider
{
    [FileUnitTestExplorer]
    public class FixieTestFileExplorer : IUnitTestFileExplorer
    {
        private readonly FixieTestProvider provider;
        private readonly UnitTestElementFactory unitTestElementFactory;

        public FixieTestFileExplorer(FixieTestProvider provider, UnitTestElementFactory unitTestElementFactory)
        {
            this.provider = provider;
            this.unitTestElementFactory = unitTestElementFactory;
        }

        public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
        {
            if (interrupted())
                return;

            psiFile.ProcessDescendants(new FixiePsiFileExplorer(unitTestElementFactory, consumer, psiFile, interrupted));
        }

        public IUnitTestProvider Provider { get { return provider; } }
    }
}

using System;
using System.Linq;

using JetBrains.Application;
using JetBrains.ProjectModel;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.Tree;
using JetBrains.ReSharper.UnitTestFramework;

namespace ReSharperFixieRunner.UnitTestProvider
{
    [FileUnitTestExplorer]
    public class FixieTestFileExplorer : IUnitTestFileExplorer
    {
        private readonly FixieTestProvider provider;
        private readonly UnitTestElementFactory unitTestElementFactory;

        public FixieTestFileExplorer(FixieTestProvider provider, UnitTestElementFactory unitTestElementFactory)
        {
            this.provider = provider;
            this.unitTestElementFactory = unitTestElementFactory;
        }

        public void ExploreFile(IFile psiFile, UnitTestElementLocationConsumer consumer, CheckForInterrupt interrupted)
        {
            if (interrupted())
                return;

            // don't bother going any further if there's isn't a project with a reference to the Fixie assembly
            var project = psiFile.GetProject();
            if (project == null)
                return;

            if(project.GetModuleReferences().All(module => module.Name != "Fixie"))
                return;

            psiFile.ProcessDescendants(new FixiePsiFileExplorer(unitTestElementFactory, consumer, psiFile, interrupted));
        }

        public IUnitTestProvider Provider { get { return provider; } }
    }
}

Check for Fixie library reference

Check for Fixie library reference


using Bootstrap.StructureMap;
using Manufacturing.DataCollector.Datasources.Simulation;
using StructureMap;
using StructureMap.Configuration.DSL;
using StructureMap.Graph;
using StructureMap.Pipeline;

namespace Manufacturing.DataPusher
{
    public class DataPusherContainer : IStructureMapRegistration
    {
        public void Register(IContainer container)
        {
            container.Configure(x => x.Scan(y =>
            {
                y.TheCallingAssembly();
                y.SingleImplementationsOfInterface().OnAddedPluginTypes(z => z.LifecycleIs(new TransientLifecycle()));
                y.ExcludeType<IDataPusher>();
                x.AddRegistry(new DataPusherRegistry());

                x.For<RandomDatasource>().LifecycleIs<SingletonLifecycle>();
            }));

        }
    }

    public class DataPusherRegistry : Registry
    {
        public DataPusherRegistry()
        {
            For<IDataPusher>().Use<EventHubsDataPusher>();
        }
    }
}

using Bootstrap.StructureMap;
using Manufacturing.DataCollector;
using Manufacturing.DataCollector.Datasources.Simulation;
using StructureMap;
using StructureMap.Configuration.DSL;
using StructureMap.Graph;
using StructureMap.Pipeline;

namespace Manufacturing.DataPusher
{
    public class DataPusherContainer : IStructureMapRegistration
    {
        public void Register(IContainer container)
        {
            container.Configure(x => x.Scan(y =>
            {
                y.TheCallingAssembly();
                y.SingleImplementationsOfInterface().OnAddedPluginTypes(z => z.LifecycleIs(new TransientLifecycle()));
                y.ExcludeType<IDataPusher>();
                x.AddRegistry(new DataPusherRegistry());

                x.For<RandomDatasource>().LifecycleIs<SingletonLifecycle>();

                x.For<ILocalRecordRepository>().Use<MemoryRecordRepository>();
            }));

        }
    }

    public class DataPusherRegistry : Registry
    {
        public DataPusherRegistry()
        {
            For<IDataPusher>().Use<EventHubsDataPusher>();
        }
    }
}

Switch to the memory repository

Switch to the memory repository


using System;
using System.Collections.Generic;
using GitVersion.Common;
using LibGit2Sharp;

namespace GitVersion.VersionCalculation
{
    /// <summary>
    /// Version is 0.1.0.
    /// BaseVersionSource is the "root" commit reachable from the current commit.
    /// Does not increment.
    /// </summary>
    public class FallbackVersionStrategy : VersionStrategyBase
    {
        private readonly IRepositoryMetadataProvider repositoryMetadataProvider;

        public FallbackVersionStrategy(IRepositoryMetadataProvider repositoryMetadataProvider, Lazy<GitVersionContext> versionContext) : base(versionContext)
        {
            this.repositoryMetadataProvider = repositoryMetadataProvider;
        }
        public override IEnumerable<BaseVersion> GetVersions()
        {
            Commit baseVersionSource;
            var currentBranchTip = Context.CurrentBranch.Tip;

            try
            {
                baseVersionSource = repositoryMetadataProvider.GetBaseVersionSource(currentBranchTip);
            }
            catch (NotFoundException exception)
            {
                throw new GitVersionException($"Can't find commit {currentBranchTip.Sha}. Please ensure that the repository is an unshallow clone with `git fetch --unshallow`.", exception);
            }

            yield return new BaseVersion("Fallback base version", false, new SemanticVersion(minor: 1), baseVersionSource, null);
        }
    }
}

using System;
using System.Collections.Generic;
using GitVersion.Common;
using LibGit2Sharp;

namespace GitVersion.VersionCalculation
{
    /// <summary>
    /// Version is 0.1.0.
    /// BaseVersionSource is the "root" commit reachable from the current commit.
    /// Does not increment.
    /// </summary>
    public class FallbackVersionStrategy : VersionStrategyBase
    {
        private readonly IRepositoryMetadataProvider repositoryMetadataProvider;

        public FallbackVersionStrategy(IRepositoryMetadataProvider repositoryMetadataProvider, Lazy<GitVersionContext> versionContext) : base(versionContext)
        {
            this.repositoryMetadataProvider = repositoryMetadataProvider;
        }
        public override IEnumerable<BaseVersion> GetVersions()
        {
            Commit baseVersionSource;
            var currentBranchTip = Context.CurrentBranch.Tip;
            if (currentBranchTip == null)
            {
                throw new GitVersionException("No commits found on the current branch.");
            }

            try
            {
                baseVersionSource = repositoryMetadataProvider.GetBaseVersionSource(currentBranchTip);
            }
            catch (NotFoundException exception)
            {
                throw new GitVersionException($"Can't find commit {currentBranchTip.Sha}. Please ensure that the repository is an unshallow clone with `git fetch --unshallow`.", exception);
            }

            yield return new BaseVersion("Fallback base version", false, new SemanticVersion(minor: 1), baseVersionSource, null);
        }
    }
}

Check early for commit on current branch


using System;
using System.Collections.Generic;
using System.Text;

namespace Rs317.Extended
{
	/// <summary>
	/// Operation codes for the RS317 packets.
	/// </summary>
	public enum RsNetworkOperationCode : byte
	{
		/// <summary>
		/// Operation code for packet type that indicates a login
		/// success.
		/// </summary>
		ConnectionInitialized = 0,
	}
}

using System;
using System.Collections.Generic;
using System.Text;

namespace Rs317.Extended
{
	/// <summary>
	/// Operation codes for the RS317 packets.
	/// </summary>
	public enum RsNetworkOperationCode : byte
	{

	}
}

Remove all network operation codes

Remove all network operation codes


using System.Web.Routing;

namespace RestfulRouting
{
	public abstract class Mapper
	{
		private readonly IRouteHandler _routeHandler;

		protected Mapper(IRouteHandler routeHandler)
		{
			_routeHandler = routeHandler;
		}

		protected Route GenerateRoute(string path, string controller, string action, string[] httpMethods)
		{
			return new Route(path,
				new RouteValueDictionary(new { controller, action }),
				new RouteValueDictionary(new { httpMethod = new HttpMethodConstraint(httpMethods) }),
				_routeHandler);
		}
	}
}

using System.Web.Routing;

namespace RestfulRouting
{
	public abstract class Mapper
	{
		private readonly IRouteHandler _routeHandler;

		protected Mapper(IRouteHandler routeHandler)
		{
			_routeHandler = routeHandler;
		}

		protected Route GenerateRoute(string path, string controller, string action, string[] httpMethods)
		{
			return new Route(path,
				new RouteValueDictionary(new { controller, action }),
				new RouteValueDictionary(new { httpMethod = new RestfulHttpMethodConstraint(httpMethods) }),
				_routeHandler);
		}
	}
}

Make the constraint on RestfulHttpMethodConstraint, so the match will work.


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using NUnit.Framework;
using UnityEngine;
using UnityEngine.Formats.Alembic.Importer;

namespace UnityEditor.Formats.Alembic.Exporter.UnitTests
{
    public class AssetRenameTests
    {
        readonly List<string> deleteFileList = new List<string>();
        const string copiedAbcFile = "Assets/abc.abc";
        GameObject go;

        [SetUp]
        public void SetUp()
        {
            var srcDummyFile = AssetDatabase.FindAssets("Dummy").Select(AssetDatabase.GUIDToAssetPath).SelectMany(AssetDatabase.LoadAllAssetsAtPath).OfType<AlembicStreamPlayer>().First().StreamDescriptor.PathToAbc;
            File.Copy(srcDummyFile,copiedAbcFile, true);
            AssetDatabase.Refresh();
            var asset = AssetDatabase.LoadMainAssetAtPath(copiedAbcFile);
            go = PrefabUtility.InstantiatePrefab(asset) as GameObject;
        }

        [TearDown]
        public void TearDown()
        {
            foreach (var file in deleteFileList)
            {
                AssetDatabase.DeleteAsset(file);
            }

            deleteFileList.Clear();
        }

        [Test]
        public void TestRenameDoesNotRenameInstances()
        {
            Assert.AreEqual("abc",go.name);
            var ret = AssetDatabase.RenameAsset(copiedAbcFile,"new.abc");
            AssetDatabase.Refresh();
            Assert.AreEqual("abc",go.name);
            Assert.IsEmpty(ret);
            deleteFileList.Add("Assets/new.abc");
        }
    }
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using NUnit.Framework;
using UnityEngine;
using UnityEngine.Formats.Alembic.Importer;

namespace UnityEditor.Formats.Alembic.Exporter.UnitTests
{
    public class AssetRenameTests
    {
        readonly List<string> deleteFileList = new List<string>();
        const string copiedAbcFile = "Assets/abc.abc";
        GameObject go;

        [SetUp]
        public void SetUp()
        {
            const string dummyGUID = "1a066d124049a413fb12b82470b82811"; // GUID of DummyAlembic.abc
            var path = AssetDatabase.GUIDToAssetPath(dummyGUID);
            var srcDummyFile = AssetDatabase.LoadAllAssetsAtPath(path).OfType<AlembicStreamPlayer>().First().StreamDescriptor.PathToAbc;
            File.Copy(srcDummyFile,copiedAbcFile, true);
            AssetDatabase.Refresh();
            var asset = AssetDatabase.LoadMainAssetAtPath(copiedAbcFile);
            go = PrefabUtility.InstantiatePrefab(asset) as GameObject;
        }

        [TearDown]
        public void TearDown()
        {
            foreach (var file in deleteFileList)
            {
                AssetDatabase.DeleteAsset(file);
            }

            deleteFileList.Clear();
        }

        [Test]
        public void TestRenameDoesNotRenameInstances()
        {
            Assert.AreEqual("abc",go.name);
            var ret = AssetDatabase.RenameAsset(copiedAbcFile,"new.abc");
            AssetDatabase.Refresh();
            Assert.AreEqual("abc",go.name);
            Assert.IsEmpty(ret);
            deleteFileList.Add("Assets/new.abc");
        }
    }
}

Replace string queries with GUID for DummyAlembic.abc


using System;
using System.Text.RegularExpressions;

namespace InternetSeparationAdapter
{
  public static class UtilsExtension
  {
    // http://stackoverflow.com/a/33113820
    public static string Base64UrlEncode(this byte[] arg)
    {
      var s = Convert.ToBase64String(arg); // Regular base64 encoder
      s = s.Split('=')[0]; // Remove any trailing '='s
      s = s.Replace('+', '-'); // 62nd char of encoding
      s = s.Replace('/', '_'); // 63rd char of encoding
      return s;
    }

    public static byte[] Base64UrlDecode(this string arg)
    {
      var s = arg;
      s = s.Replace('-', '+'); // 62nd char of encoding
      s = s.Replace('_', '/'); // 63rd char of encoding
      switch (s.Length % 4) // Pad with trailing '='s
      {
        case 0:
          break; // No pad chars in this case
        case 2:
          s += "==";
          break; // Two pad chars
        case 3:
          s += "=";
          break; // One pad char
        default:
          throw new InvalidOperationException("This code should never be executed");
      }
      return Convert.FromBase64String(s); // Standard base64 decoder
    }

    public static string StripSuccessiveNewLines(this string input)
    {
      const string pattern = @"(\r\n|\n|\n\r){2,}";
      var regex = new Regex(pattern);
      return regex.Replace(input, "\n\n");
    }
  }
}

using System;
using System.Text.RegularExpressions;

namespace InternetSeparationAdapter
{
  public static class UtilsExtension
  {
    // http://stackoverflow.com/a/33113820
    public static string Base64UrlEncode(this byte[] arg)
    {
      var s = Convert.ToBase64String(arg); // Regular base64 encoder
      s = s.Split('=')[0]; // Remove any trailing '='s
      s = s.Replace('+', '-'); // 62nd char of encoding
      s = s.Replace('/', '_'); // 63rd char of encoding
      return s;
    }

    public static byte[] Base64UrlDecode(this string arg)
    {
      var s = arg;
      s = s.Replace('-', '+'); // 62nd char of encoding
      s = s.Replace('_', '/'); // 63rd char of encoding
      switch (s.Length % 4) // Pad with trailing '='s
      {
        case 0:
          break; // No pad chars in this case
        case 2:
          s += "==";
          break; // Two pad chars
        case 3:
          s += "=";
          break; // One pad char
        default:
          throw new InvalidOperationException("This code should never be executed");
      }
      return Convert.FromBase64String(s); // Standard base64 decoder
    }

    public static string StripSuccessiveNewLines(this string input)
    {
      if (string.IsNullOrEmpty(input)) return input;
      const string pattern = @"(\r\n|\n|\n\r){2,}";
      var regex = new Regex(pattern);
      return regex.Replace(input, "\n\n");
    }
  }
}

Return if input is null or empty

Return if input is null or empty


// 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.Game.Online.Chat;

namespace osu.Game.Online.API.Requests
{
    public class MarkChannelAsReadRequest : APIRequest
    {
        private readonly Channel channel;
        private readonly Message message;

        public MarkChannelAsReadRequest(Channel channel, Message message)
        {
            this.channel = channel;
            this.message = message;
        }

        protected override string Target => $"/chat/channels/{channel}/mark-as-read/{message}";
    }
}

// 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.Game.Online.Chat;

namespace osu.Game.Online.API.Requests
{
    public class MarkChannelAsReadRequest : APIRequest
    {
        private readonly Channel channel;
        private readonly Message message;

        public MarkChannelAsReadRequest(Channel channel, Message message)
        {
            this.channel = channel;
            this.message = message;
        }

        protected override string Target => $"chat/channels/{channel.Id}/mark-as-read/{message.Id}";
    }
}

Change wrong values used to form target URL

Dumb mistake by me, C# used ToString() on these objects.


using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace DNTPersianUtils.Core.Tests
{
    [TestClass]
    public class PersianNumbersUtilsTests
    {
        [TestMethod]
        public void Test_ToPersianNumbers_Works()
        {
            var actual = 123.ToPersianNumbers();
            Assert.AreEqual(expected: "۱۲۳", actual: actual);
        }
    }
}

using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace DNTPersianUtils.Core.Tests
{
    [TestClass]
    public class PersianNumbersUtilsTests
    {
        [TestMethod]
        public void Test_English_ToPersianNumbers_Works()
        {
            var actual = 123.ToPersianNumbers();
            Assert.AreEqual(expected: "۱۲۳", actual: actual);
        }

        [TestMethod]
        public void Test_Arabic_ToPersianNumbers_Works()
        {
            var actual = "\u06F1\u06F2\u06F3".ToPersianNumbers();
            Assert.AreEqual(expected: "۱۲۳", actual: actual);
        }

        [TestMethod]
        public void Test_Persian_ToEnglishNumbers_Works()
        {
            var actual = "١٢٣".ToEnglishNumbers();
            Assert.AreEqual(expected: "123", actual: actual);
        }

        [TestMethod]
        public void Test_Arabic_ToEnglishNumbers_Works()
        {
            var actual = "\u06F1\u06F2\u06F3".ToEnglishNumbers();
            Assert.AreEqual(expected: "123", actual: actual);
        }
    }
}

Add more unit tests for ToPersianNumbers and ToEnglishNumbers.


using Glimpse.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Glimpse.Agent.Web
{
    public class MasterRequestProfiler : IRequestRuntime
    {
        private readonly IDiscoverableCollection<IRequestProfiler> _requestProfiliers;
        private readonly IEnumerable<IIgnoredRequestPolicy> _ignoredRequestPolicies;

        public MasterRequestProfiler(IDiscoverableCollection<IRequestProfiler> requestProfiliers, IIgnoredRequestProvider ignoredRequestProvider)
        {
            _requestProfiliers = requestProfiliers;
            _requestProfiliers.Discover();

            _ignoredRequestPolicies = ignoredRequestProvider.Policies;
        }

        public async Task Begin(IHttpContext context)
        {
            if (ShouldProfile(context))
            {
                foreach (var requestRuntime in _requestProfiliers)
                {
                    await requestRuntime.Begin(context);
                }
            }
        }

        public async Task End(IHttpContext context)
        {
            if (ShouldProfile(context))
            {
                foreach (var requestRuntime in _requestProfiliers)
                {
                    await requestRuntime.End(context);
                }
            }
        }

        public bool ShouldProfile(IHttpContext context)
        {
            if (_ignoredRequestPolicies.Any())
            {
                foreach (var policy in _ignoredRequestPolicies)
                {
                    if (policy.ShouldIgnore(context))
                    {
                        return false;
                    }
                }
            }

            return true;
        }
    }
}

using Glimpse.Web;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Glimpse.Agent.Web
{
    public class MasterRequestProfiler : IRequestRuntime
    {
        private readonly IEnumerable<IRequestProfiler> _requestProfiliers;
        private readonly IEnumerable<IIgnoredRequestPolicy> _ignoredRequestPolicies;

        public MasterRequestProfiler(IRequestProfilerProvider requestProfilerProvider, IIgnoredRequestProvider ignoredRequestProvider)
        {
            _requestProfiliers = requestProfilerProvider.Profilers;
            _ignoredRequestPolicies = ignoredRequestProvider.Policies;
        }

        public async Task Begin(IHttpContext context)
        {
            if (ShouldProfile(context))
            {
                foreach (var requestRuntime in _requestProfiliers)
                {
                    await requestRuntime.Begin(context);
                }
            }
        }

        public async Task End(IHttpContext context)
        {
            if (ShouldProfile(context))
            {
                foreach (var requestRuntime in _requestProfiliers)
                {
                    await requestRuntime.End(context);
                }
            }
        }

        public bool ShouldProfile(IHttpContext context)
        {
            if (_ignoredRequestPolicies.Any())
            {
                foreach (var policy in _ignoredRequestPolicies)
                {
                    if (policy.ShouldIgnore(context))
                    {
                        return false;
                    }
                }
            }

            return true;
        }
    }
}

Switch RequestProfiler consumers over to using provider


@inject SiteOptions Options
@inject Microsoft.AspNetCore.Identity.SignInManager<LondonTravelUser> SignInManager

@if (SignInManager.IsSignedIn(User))
{
    <form asp-route="SignOut" method="post" id="signOutForm" class="navbar-right">

                    @User.GetDisplayName()
                    <lazyimg alt="@User.Identity.Name" src="@User.GetAvatarUrl(Url.CdnContent("avatar.png", Options))" aria-hidden="true" />

                <button type="submit" class="btn btn-link navbar-btn navbar-link">
                    Sign out

                </button>

    </form>
}
else
{

Sign in

Register

}

Update title attributes for sign-in partial

Update the title attribute for the sign-in partial to match the text
used elsewhere.


using System;
using System.ComponentModel;
using DesktopWidgets.WidgetBase.Settings;

namespace DesktopWidgets.Widgets.Weather
{
    public class Settings : WidgetSettingsBase
    {
        [Category("Style")]
        [DisplayName("Unit Type")]
        public TemperatureUnitType UnitType { get; set; }

        [Category("General")]
        [DisplayName("Refresh Interval")]
        public TimeSpan RefreshInterval { get; set; } = TimeSpan.FromHours(1);

        [Category("General")]
        [DisplayName("Zip Code")]
        public int ZipCode { get; set; }

        [Category("Style")]
        [DisplayName("Show Icon")]
        public bool ShowIcon { get; set; } = true;

        [Category("Style")]
        [DisplayName("Show Temperature")]
        public bool ShowTemperature { get; set; } = true;

        [Category("Style")]
        [DisplayName("Show Temperature Range")]
        public bool ShowTempMinMax { get; set; } = false;

        [Category("Style")]
        [DisplayName("Show Description")]
        public bool ShowDescription { get; set; } = true;
    }
}

using System;
using System.ComponentModel;
using DesktopWidgets.WidgetBase.Settings;

namespace DesktopWidgets.Widgets.Weather
{
    public class Settings : WidgetSettingsBase
    {
        public Settings()
        {
            Style.FontSettings.FontSize = 16;
        }

        [Category("Style")]
        [DisplayName("Unit Type")]
        public TemperatureUnitType UnitType { get; set; }

        [Category("General")]
        [DisplayName("Refresh Interval")]
        public TimeSpan RefreshInterval { get; set; } = TimeSpan.FromHours(1);

        [Category("General")]
        [DisplayName("Zip Code")]
        public int ZipCode { get; set; }

        [Category("Style")]
        [DisplayName("Show Icon")]
        public bool ShowIcon { get; set; } = true;

        [Category("Style")]
        [DisplayName("Show Temperature")]
        public bool ShowTemperature { get; set; } = true;

        [Category("Style")]
        [DisplayName("Show Temperature Range")]
        public bool ShowTempMinMax { get; set; } = false;

        [Category("Style")]
        [DisplayName("Show Description")]
        public bool ShowDescription { get; set; } = true;
    }
}

Change "Weather" "Font Size" default value


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

namespace Finance
{
    public class PartialCandleTokenizer : AbstractCandleTokenizer
    {
        private AbstractCandleTokenizer ct;
        private int start;
        private int length;

        public PartialCandleTokenizer(AbstractCandleTokenizer ct, int start, int length)
        {
            this.ct = ct;
            this.start = start;
            this.length = length;
        }

        public override Candle this[int index]
        {
            get
            {
                return ct[index + start];
            }
        }

        public override int GetLength()
        {
            return length;
        }
    }
}

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

namespace Finance
{
    public class PartialCandleTokenizer : AbstractCandleTokenizer
    {
        private AbstractCandleTokenizer ct;
        private int start;
        private int length;

        public PartialCandleTokenizer(AbstractCandleTokenizer ct, int start, int length)
        {
            this.ct = ct;
            this.start = start;
            this.length = length;
            ticker = ct.GetTicker();
            period = ct.GetPeriod();
        }

        public override Candle this[int index]
        {
            get
            {
                return ct[index + start];
            }
        }

        public override int GetLength()
        {
            return length;
        }
    }
}

[6] Add ticker and period information to partial candle tokenizer


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

using System.IO;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.Interop;

namespace Owin
{
    public static class CookieInterop
    {
        public static ISecureDataFormat<AuthenticationTicket> CreateSharedDataFormat(DirectoryInfo keyDirectory, string authenticationType)
        {
            var dataProtector = DataProtectionProvider.Create(keyDirectory)
                .CreateProtector("Microsoft.AspNet.Authentication.Cookies.CookieAuthenticationMiddleware", // full name of the ASP.NET 5 type
                authenticationType, "v2");
            return new AspNetTicketDataFormat(new DataProtectorShim(dataProtector));
        }
    }
}

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

using System.IO;
using Microsoft.AspNetCore.DataProtection;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.Interop;

namespace Owin
{
    public static class CookieInterop
    {
        public static ISecureDataFormat<AuthenticationTicket> CreateSharedDataFormat(DirectoryInfo keyDirectory, string authenticationType)
        {
            var dataProtector = DataProtectionProvider.Create(keyDirectory)
                .CreateProtector("Microsoft.AspNetCore.Authentication.Cookies.CookieAuthenticationMiddleware", // full name of the ASP.NET 5 type
                authenticationType, "v2");
            return new AspNetTicketDataFormat(new DataProtectorShim(dataProtector));
        }
    }
}

Fix cookie middleware name for interop package


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("IntegrationEngine.Client.net40")]

// 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("446e2264-b09d-4fb2-91d6-cae870d1b4d6")]

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("IntegrationEngine.Client")]

// 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("446e2264-b09d-4fb2-91d6-cae870d1b4d6")]

Fix assembly name in Client.net40

Fix assembly name in Client.net40


namespace Hypermedia.Relations
{
    /// <summary>
    /// Collection of basic relations commonly used.
    /// For a comprehensive list <see href="https://www.iana.org/assignments/link-relations/link-relations.xhtml"/>
    /// </summary>
    public static class DefaultHypermediaRelations
    {
        /// <summary>
        /// Relation indicating that this relates to the HypermediaObject itselve.
        /// </summary>
        public const string Self = "Self";

        /// <summary>
        /// Relations commonly used for query results.
        /// </summary>
        public class Queries
        {
            public const string First = "First";
            public const string Previous = "Previous";
            public const string Next = "Next";
            public const string Last = "Last";
            public const string All = "All";
        }

        /// <summary>
        /// Relations commonly used for embedded entities.
        /// </summary>
        public class EmbeddedEntities
        {
            /// <summary>
            /// Indicates that the embedded Entity is a collection or list item.
            /// </summary>
            public const string Item = "Item";
            public const string Parent = "Parent";
            public const string Child = "Child";
        }
    }

}

namespace Hypermedia.Relations
{
    /// <summary>
    /// Collection of basic relations commonly used.
    /// For a comprehensive list <see href="https://www.iana.org/assignments/link-relations/link-relations.xhtml"/>
    /// </summary>
    public static class DefaultHypermediaRelations
    {
        /// <summary>
        /// Relation indicating that this relates to the HypermediaObject itselve.
        /// </summary>
        public const string Self = "self";

        /// <summary>
        /// Relations commonly used for query results.
        /// </summary>
        public class Queries
        {
            public const string First = "first";
            public const string Previous = "previous";
            public const string Next = "next";
            public const string Last = "last";
            public const string All = "all";
        }

        /// <summary>
        /// Relations commonly used for embedded entities.
        /// </summary>
        public class EmbeddedEntities
        {
            /// <summary>
            /// Indicates that the embedded Entity is a collection or list item.
            /// </summary>
            public const string Item = "item";
            public const string Parent = "parent";
            public const string Child = "child";
        }
    }

}

Fix wrong uper case for relations to follow iana.org