using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;

namespace MakerFarm.Models
{
    public class MakerfarmDBContext : DbContext
    {
        public MakerfarmDBContext() : base("DefaultConnection")
        {
            //Database.SetInitializer<MakerfarmDBContext>(new DropCreateDatabaseIfModelChanges<MakerfarmDBContext>());
        }

        public DbSet<PrinterType> PrinterTypes { get; set; }
        public DbSet<PrintEvent> PrintEvents { get; set; }
        public DbSet<Print> Prints { get; set; }
        public DbSet<Material> Materials { get; set; }
        public DbSet<UserProfile> UserProfiles { get; set; }
        public DbSet<PrintErrorType> PrintErrorTypes { get; set; }
        public DbSet<Printer> Printers { get; set; }
        public DbSet<PrinterStatusLog> PrinterStatusLogs { set; get; }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.Entity;

namespace MakerFarm.Models
{
    public class MakerfarmDBContext : DbContext
    {
        public MakerfarmDBContext() : base("DefaultConnection")
        {
            Database.SetInitializer<MakerfarmDBContext>(new DropCreateDatabaseIfModelChanges<MakerfarmDBContext>());
        }

        public DbSet<PrinterType> PrinterTypes { get; set; }
        public DbSet<PrintEvent> PrintEvents { get; set; }
        public DbSet<Print> Prints { get; set; }
        public DbSet<Material> Materials { get; set; }
        public DbSet<UserProfile> UserProfiles { get; set; }
        public DbSet<PrintErrorType> PrintErrorTypes { get; set; }
        public DbSet<Printer> Printers { get; set; }
        public DbSet<PrinterStatusLog> PrinterStatusLogs { set; get; }

    }
}

Set the DB Context to rebuild database when a model change is detected. Dangerous times for data =O


// 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.Collections.Generic;
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Timing;
using osu.Game.Screens.Menu;
using osuTK.Graphics;

namespace osu.Game.Tests.Visual.Menus
{
    [TestFixture]
    public class TestSceneIntroSequence : OsuTestScene
    {
        public override IReadOnlyList<Type> RequiredTypes => new[]
        {
            typeof(OsuLogo),
        };

        public TestSceneIntroSequence()
        {
            OsuLogo logo;

            var rateAdjustClock = new StopwatchClock(true);
            var framedClock = new FramedClock(rateAdjustClock);
            framedClock.ProcessFrame();

            Add(new Container
            {
                RelativeSizeAxes = Axes.Both,
                Clock = framedClock,
                Children = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour = Color4.Black,
                    },
                    logo = new OsuLogo
                    {
                        Anchor = Anchor.Centre,
                    }
                }
            });

            AddStep(@"Restart", logo.PlayIntro);
            AddSliderStep("Playback speed", 0.0, 2.0, 1, v => rateAdjustClock.Rate = v);
        }
    }
}

// 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.Collections.Generic;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Timing;
using osu.Game.Screens;
using osu.Game.Screens.Menu;
using osuTK.Graphics;

namespace osu.Game.Tests.Visual.Menus
{
    [TestFixture]
    public class TestSceneIntroSequence : OsuTestScene
    {
        public override IReadOnlyList<Type> RequiredTypes => new[]
        {
            typeof(OsuLogo),
            typeof(Intro),
            typeof(StartupScreen),
            typeof(OsuScreen)
        };

        [Cached]
        private OsuLogo logo;

        public TestSceneIntroSequence()
        {
            var rateAdjustClock = new StopwatchClock(true);
            var framedClock = new FramedClock(rateAdjustClock);
            framedClock.ProcessFrame();

            Add(new Container
            {
                RelativeSizeAxes = Axes.Both,
                Clock = framedClock,
                Children = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour = Color4.Black,
                    },
                    new OsuScreenStack(new Intro())
                    {
                        RelativeSizeAxes = Axes.Both,
                    },
                    logo = new OsuLogo
                    {
                        Anchor = Anchor.Centre,
                    },
                }
            });

            AddSliderStep("Playback speed", 0.0, 2.0, 1, v => rateAdjustClock.Rate = v);
        }
    }
}

Change intro test to test full intro screen


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

namespace borkedLabs.CrestScribe
{
    public class ScribeQueryWorker
    {
        private BlockingCollection<SsoCharacter> _queryQueue;
        private CancellationToken _cancelToken;

        public Thread Thread { get; private set; }

        public ScribeQueryWorker(BlockingCollection<SsoCharacter> queryQueue, CancellationToken cancelToken)
        {
            _queryQueue = queryQueue;
            _cancelToken = cancelToken;

            Thread = new Thread(_worker);
            Thread.Name = "scribe query worker";
            Thread.IsBackground = true;
        }

        public void Start()
        {
            Thread.Start();
        }

        private void _worker()
        {
            while (!_cancelToken.IsCancellationRequested)
            {
                var character = _queryQueue.Take(_cancelToken);

                if(character != null)
                {
                    var t = Task.Run(character.Poll);
                    t.Wait();
                }
            }
        }
    }
}

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

namespace borkedLabs.CrestScribe
{
    public class ScribeQueryWorker
    {
        private BlockingCollection<SsoCharacter> _queryQueue;
        private CancellationToken _cancelToken;

        public Thread Thread { get; private set; }

        public ScribeQueryWorker(BlockingCollection<SsoCharacter> queryQueue, CancellationToken cancelToken)
        {
            _queryQueue = queryQueue;
            _cancelToken = cancelToken;

            Thread = new Thread(_worker);
            Thread.Name = "scribe query worker";
            Thread.IsBackground = true;
        }

        public void Start()
        {
            Thread.Start();
        }

        private void _worker()
        {
            while (!_cancelToken.IsCancellationRequested)
            {
                var character = _queryQueue.Take(_cancelToken);

                if(character != null)
                {
                    var t = Task.Run(character.Poll);
                    t.Wait(_cancelToken);
                }
            }
        }
    }
}

Use cancellationToken properly in task wait.


using CefSharp;
using TweetDuck.Core.Controls;
using TweetDuck.Core.Utils;

namespace TweetDuck.Core.Handling.General{
    sealed class LifeSpanHandler : ILifeSpanHandler{
        public static bool HandleLinkClick(IWebBrowser browserControl, WindowOpenDisposition targetDisposition, string targetUrl){
            switch(targetDisposition){
                case WindowOpenDisposition.NewBackgroundTab:
                case WindowOpenDisposition.NewForegroundTab:
                case WindowOpenDisposition.NewPopup:
                case WindowOpenDisposition.NewWindow:
                    browserControl.AsControl().InvokeAsyncSafe(() => BrowserUtils.OpenExternalBrowser(targetUrl));
                    return true;

                default:
                    return false;
            }
        }

        public bool OnBeforePopup(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures, IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser){
            newBrowser = null;
            return HandleLinkClick(browserControl, targetDisposition, targetUrl);
        }

        public void OnAfterCreated(IWebBrowser browserControl, IBrowser browser){}

        public bool DoClose(IWebBrowser browserControl, IBrowser browser){
            return false;
        }

        public void OnBeforeClose(IWebBrowser browserControl, IBrowser browser){}
    }
}

using CefSharp;
using TweetDuck.Core.Controls;
using TweetDuck.Core.Utils;

namespace TweetDuck.Core.Handling.General{
    sealed class LifeSpanHandler : ILifeSpanHandler{
        private static bool IsPopupAllowed(string url){
            return url.StartsWith("https://twitter.com/teams/authorize?");
        }

        public static bool HandleLinkClick(IWebBrowser browserControl, WindowOpenDisposition targetDisposition, string targetUrl){
            switch(targetDisposition){
                case WindowOpenDisposition.NewBackgroundTab:
                case WindowOpenDisposition.NewForegroundTab:
                case WindowOpenDisposition.NewPopup when !IsPopupAllowed(targetUrl):
                case WindowOpenDisposition.NewWindow:
                    browserControl.AsControl().InvokeAsyncSafe(() => BrowserUtils.OpenExternalBrowser(targetUrl));
                    return true;

                default:
                    return false;
            }
        }

        public bool OnBeforePopup(IWebBrowser browserControl, IBrowser browser, IFrame frame, string targetUrl, string targetFrameName, WindowOpenDisposition targetDisposition, bool userGesture, IPopupFeatures popupFeatures, IWindowInfo windowInfo, IBrowserSettings browserSettings, ref bool noJavascriptAccess, out IWebBrowser newBrowser){
            newBrowser = null;
            return HandleLinkClick(browserControl, targetDisposition, targetUrl);
        }

        public void OnAfterCreated(IWebBrowser browserControl, IBrowser browser){}

        public bool DoClose(IWebBrowser browserControl, IBrowser browser){
            return false;
        }

        public void OnBeforeClose(IWebBrowser browserControl, IBrowser browser){}
    }
}

Enable popup for linking another account

Closes #269


using System;
using System.Linq;

public class Bob
{
    public string Hey(string input)
    {
        if (IsSilence(input))
        {
            return "Fine. Be that way!";
        }
        else if (IsShouting(input))
        {
            return "Whoa, chill out!";
        }
        else if (IsQuestion(input))
        {
            return "Sure.";
        }
        else
        {
            return "Whatever.";
        }
    }

    private bool IsSilence(string input)
    {
        return input.Trim().Length == 0;
    }

    private bool IsQuestion(string input)
    {
        // last character is a question mark, ignoring trailing spaces
        input = input.Trim();
        return input.LastIndexOf('?') == input.Length - 1;
    }

    private bool IsShouting(string input)
    {
        // has at least 1 character, and all upper case
        var alphas = input.Where(char.IsLetter);
        return alphas.Any() && alphas.All(char.IsUpper);
    }

}

using System.Linq;

public class Bob
{
    public string Hey(string input)
    {
        if (IsSilence(input))
        {
            return "Fine. Be that way!";
        }
        else if (IsShouting(input))
        {
            return "Whoa, chill out!";
        }
        else if (IsQuestion(input))
        {
            return "Sure.";
        }
        else
        {
            return "Whatever.";
        }
    }

    private bool IsSilence(string input)
    {
        return input.Trim().Length == 0;
    }

    private bool IsQuestion(string input)
    {
        // last character is a question mark, ignoring trailing spaces
        return input.Trim().EndsWith("?");
    }

    private bool IsShouting(string input)
    {
        // has at least 1 character, and all upper case
        var alphas = input.Where(char.IsLetter);
        return alphas.Any() && alphas.All(char.IsUpper);
    }

}

Use EndsWith - nicer than LastIndexOf...


using Microsoft.SharePoint.Administration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SPMin
{
    public class SPMinLoggingService : SPDiagnosticsServiceBase
    {
        private static string AreaName = "Mavention";
        private static SPMinLoggingService _instance;

        public static SPMinLoggingService Current
        {
            get
            {
                if (_instance == null)
                    _instance = new SPMinLoggingService();

                return _instance;
            }
        }

        private SPMinLoggingService() : base("SPMin Logging Service", SPFarm.Local) { }

        protected override IEnumerable<SPDiagnosticsArea> ProvideAreas()
        {
            List<SPDiagnosticsArea> areas = new List<SPDiagnosticsArea>
            {
                new SPDiagnosticsArea(AreaName, new List<SPDiagnosticsCategory>
                {
                    new SPDiagnosticsCategory("SPMin", TraceSeverity.Unexpected, EventSeverity.Error)
                })
            };

            return areas;
        }

        public static void LogError(string errorMessage, TraceSeverity traceSeverity)
        {
            SPDiagnosticsCategory category = Current.Areas[AreaName].Categories["SPMin"];
            Current.WriteTrace(0, category, traceSeverity, errorMessage);
        }
    }
}

using Microsoft.SharePoint.Administration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SPMin
{
    public class SPMinLoggingService : SPDiagnosticsServiceBase
    {
        private static string AreaName = "SPMin";
        private static SPMinLoggingService _instance;

        public static SPMinLoggingService Current
        {
            get
            {
                if (_instance == null)
                    _instance = new SPMinLoggingService();

                return _instance;
            }
        }

        private SPMinLoggingService() : base("SPMin Logging Service", SPFarm.Local) { }

        protected override IEnumerable<SPDiagnosticsArea> ProvideAreas()
        {
            List<SPDiagnosticsArea> areas = new List<SPDiagnosticsArea>
            {
                new SPDiagnosticsArea(AreaName, new List<SPDiagnosticsCategory>
                {
                    new SPDiagnosticsCategory("SPMin", TraceSeverity.Unexpected, EventSeverity.Error)
                })
            };

            return areas;
        }

        public static void LogError(string errorMessage, TraceSeverity traceSeverity)
        {
            SPDiagnosticsCategory category = Current.Areas[AreaName].Categories["SPMin"];
            Current.WriteTrace(0, category, traceSeverity, errorMessage);
        }
    }
}

Update logging service area name

Update logging service area name


// --------------------------------------------------------------------------------------------------------------------
// <copyright file="GlobalAssemblyInfo.cs" company="OxyPlot">
//   Copyright (c) 2014 OxyPlot contributors
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

using System.Reflection;

[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("OxyPlot")]
[assembly: AssemblyCompany("OxyPlot")]
[assembly: AssemblyCopyright("Copyright (c) 2014 OxyPlot contributors")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// The version numbers are updated by the build script. See ~/appveyor.yml
[assembly: AssemblyVersion("0.0.0")]
[assembly: AssemblyInformationalVersion("0.0.0-alpha")]
[assembly: AssemblyFileVersion("0.0.0")]

// --------------------------------------------------------------------------------------------------------------------
// <copyright file="GlobalAssemblyInfo.cs" company="OxyPlot">
//   Copyright (c) 2014 OxyPlot contributors
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

using System.Reflection;

[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("OxyPlot")]
[assembly: AssemblyCompany("OxyPlot")]
[assembly: AssemblyCopyright("Copyright (c) 2014 OxyPlot contributors")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// The version numbers are updated by the build script. See ~/appveyor.yml
[assembly: AssemblyVersion("0.0.1")]
[assembly: AssemblyInformationalVersion("0.0.1-alpha")]
[assembly: AssemblyFileVersion("0.0.1")]

Fix CA1016: Mark assemblies with AssemblyVersionAttribute

Code Analysis says that "0.0.0" is not a valid version number so pick a
different default to get rid of the warning.


using System.Collections;
using UnityEngine;

namespace TrailAdvanced.PointSource {

	public class ObjectPointSource : AbstractPointSource {
		public Transform objectToFollow;

		protected override void Update() {
			base.Update();
			points.AddToBack(objectToFollow.position);
		}
	}
}

using System.Collections;
using UnityEngine;

namespace TrailAdvanced.PointSource {

	public class ObjectPointSource : AbstractPointSource {
		public Transform objectToFollow;
		private Vector3 _lastPosition;

		protected override void Start() {
			base.Start();
			_lastPosition = objectToFollow.position;
		}

		protected override void Update() {
			base.Update();

			float distance = Vector3.SqrMagnitude(objectToFollow.position - _lastPosition);

			if (distance > 0.0001f) {
				points.AddToFront(objectToFollow.position);
			}
			_lastPosition = objectToFollow.position;
		}
	}
}

Add points to front and only add if moved a little bit


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

namespace SourceBrowser.Search.ViewModels
{
    public struct TokenViewModel
    {
        public string Id { get; }

        public string Path { get; }
        public string Username { get; }
        public string Repository { get; }
        public string FullName { get; }
        public string Name
        {
            get
            {
                if (FullName == null)
                    return null;

                var splitName = FullName.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
                return splitName.Last();
            }
        }
        public int LineNumber { get; }

        public TokenViewModel(string username, string repository, string path, string fullName, int lineNumber)
        {
            Id = System.IO.Path.Combine(username, repository, fullName);
            Username = username;
            Repository = repository;
            Path = path;
            FullName = fullName;
            LineNumber = lineNumber;
        }
    }
}

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

namespace SourceBrowser.Search.ViewModels
{
    public struct TokenViewModel
    {
        public string Id { get; }

        public string Path { get; }
        public string Username { get; }
        public string Repository { get; }
        public string FullName { get; }
        public string Name
        {
            get
            {
                if (FullName == null)
                    return null;
                string currentName = FullName;
                var parensIndex = FullName.IndexOf("(");
                if(parensIndex != -1)
                {
                    currentName = currentName.Remove(parensIndex, currentName.Length - parensIndex);
                }

                var splitName = currentName.Split(new char[] { '.' }, StringSplitOptions.RemoveEmptyEntries);
                return splitName.Last();
            }
        }
        public int LineNumber { get; }

        public TokenViewModel(string username, string repository, string path, string fullName, int lineNumber)
        {
            Id = username + "/" + repository + "/" + fullName;
            Username = username;
            Repository = repository;
            Path = path;
            FullName = fullName;
            LineNumber = lineNumber;
        }
    }
}

Handle parenthese in method name.

Handle parenthese in method name.


using System;
using BenchmarkDotNet.Running;

namespace LanguageExt.Benchmarks
{
    class Program
    {
        static void Main(string[] args)
        {
            var summary1 = BenchmarkRunner.Run<HashMapAddBenchmark>();
            Console.Write(summary1);

            var summary2 = BenchmarkRunner.Run<HashMapRandomReadBenchmark>();
            Console.Write(summary2);
        }
    }
}

using BenchmarkDotNet.Running;

namespace LanguageExt.Benchmarks
{
    class Program
    {
        static void Main(string[] args) =>
            BenchmarkSwitcher
                .FromAssembly(typeof(Program).Assembly)
                .Run(args);
    }
}

Change way how benchmarks are discovered/executed


using System.Collections.Generic;

namespace Dictator
{
    public class Rule
    {
        public string FieldPath { get; set; }
        public Constraint Constraint { get; set; }
        public List<object> Parameters { get; set; }
        public bool IsViolated { get; set; }
        public string Message { get; set; }

        public Rule()
        {
            Parameters = new List<object>();
            Message = string.Format("Field '{0}' violated '{1}' constraint rule.", FieldPath, Constraint);
        }
    }
}

using System.Collections.Generic;

namespace Dictator
{
    public class Rule
    {
        string _message = null;

        public string FieldPath { get; set; }
        public Constraint Constraint { get; set; }
        public List<object> Parameters { get; set; }
        public bool IsViolated { get; set; }

        public string Message
        {
            get
            {
                if (_message == null)
                {
                    return string.Format("Field '{0}' violated '{1}' constraint rule.", FieldPath, Constraint);
                }

                return _message;
            }
            set
            {
                _message = value;
            }
        }

        public Rule()
        {
            Parameters = new List<object>();
        }
    }
}

Fix default schema rule message.

Fix default schema rule message.


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

namespace Abc.NCrafts.Quizz.Performance.Questions._021
{
    public class Answer2
    {
        public static void Run()
        {
            var queue = new ConcurrentStack<int>();

            // begin
            var producer = Task.Run(() =>
            {
                foreach (var value in Enumerable.Range(1, 10000))
                {
                    queue.Push(value);
                }
            });

            var consumer = Task.Run(() =>
            {
                var spinWait = new SpinWait();
                var value = 0;
                while (value != 10000)
                {
                    if (!queue.TryPop(out value))
                    {
                        spinWait.SpinOnce();
                        continue;
                    }
                    Logger.Log("Value: {0}", value);
                }
            });

            Task.WaitAll(producer, consumer);
            // end
        }
    }
}

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

namespace Abc.NCrafts.Quizz.Performance.Questions._021
{
    public class Answer2
    {
        public static void Run()
        {
            var stack = new ConcurrentStack<int>();

            // begin
            var producer = Task.Run(() =>
            {
                foreach (var value in Enumerable.Range(1, 10000))
                {
                    stack.Push(value);
                }
            });

            var consumer = Task.Run(() =>
            {
                var spinWait = new SpinWait();
                var value = 0;
                while (value != 10000)
                {
                    if (!stack.TryPop(out value))
                    {
                        spinWait.SpinOnce();
                        continue;
                    }
                    Logger.Log("Value: {0}", value);
                }
            });

            Task.WaitAll(producer, consumer);
            // end
        }
    }
}

Rename queue to stack to reflect its actual type


namespace Nancy.AttributeRouting
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Reflection;
    using Nancy.Bootstrapper;
    using Nancy.TinyIoc;

    /// <inheritdoc/>
    public class AttributeRoutingRegistration : IRegistrations
    {
        static AttributeRoutingRegistration()
        {
            IEnumerable<MethodBase> methods = AppDomain.CurrentDomain.GetAssemblies()
                .SelectMany(assembly => assembly.SafeGetTypes())
                .Where(type => !type.IsAbstract && (type.IsPublic || type.IsNestedPublic))
                .SelectMany(GetMethodsWithRouteAttribute);

            foreach (MethodBase method in methods)
            {
                AttributeRoutingResolver.Routings.Register(method);
            }
        }

        /// <inheritdoc/>
        public IEnumerable<CollectionTypeRegistration> CollectionTypeRegistrations
        {
            get { return null; }
        }

        /// <inheritdoc/>
        public IEnumerable<InstanceRegistration> InstanceRegistrations
        {
            get { return null; }
        }

        /// <inheritdoc/>
        public IEnumerable<TypeRegistration> TypeRegistrations
        {
            get { yield return new TypeRegistration(typeof(IUrlBuilder), typeof(UrlBuilder)); }
        }

        private static IEnumerable<MethodBase> GetMethodsWithRouteAttribute(Type type)
        {
            IEnumerable<MethodBase> methods = type
                .GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)
                .Where(HasRouteAttribute);

            return methods;
        }

        private static bool HasRouteAttribute(MethodBase method)
        {
            return method.GetCustomAttributes<RouteAttribute>().Any();
        }
    }
}

namespace Nancy.AttributeRouting
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Reflection;
    using Nancy.Bootstrapper;
    using Nancy.TinyIoc;

    /// <inheritdoc/>
    public class AttributeRoutingRegistration : IRegistrations
    {
        static AttributeRoutingRegistration()
        {
            IEnumerable<MethodBase> methods = AppDomain.CurrentDomain.GetAssemblies()
                .SelectMany(assembly => assembly.SafeGetTypes())
                .Where(DoesSupportType)
                .SelectMany(GetMethodsWithRouteAttribute);

            foreach (MethodBase method in methods)
            {
                AttributeRoutingResolver.Routings.Register(method);
            }
        }

        /// <inheritdoc/>
        public IEnumerable<CollectionTypeRegistration> CollectionTypeRegistrations
        {
            get { return null; }
        }

        /// <inheritdoc/>
        public IEnumerable<InstanceRegistration> InstanceRegistrations
        {
            get { return null; }
        }

        /// <inheritdoc/>
        public IEnumerable<TypeRegistration> TypeRegistrations
        {
            get { yield return new TypeRegistration(typeof(IUrlBuilder), typeof(UrlBuilder)); }
        }

        private static IEnumerable<MethodBase> GetMethodsWithRouteAttribute(Type type)
        {
            IEnumerable<MethodBase> methods = type
                .GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)
                .Where(HasRouteAttribute);

            return methods;
        }

        private static bool HasRouteAttribute(MethodBase method)
        {
            return method.GetCustomAttributes<RouteAttribute>().Any();
        }

        private static bool DoesSupportType(Type type)
        {
            if (type.IsInterface)
            {
                return true;
            }
            else if (!type.IsAbstract && (type.IsPublic || type.IsNestedPublic))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}

Modify routing initialization logic to pass test case.


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

[RequireComponent(typeof(SpriteRenderer))]
public class SpriteShadow : MonoBehaviour
{
	public Sprite ShadowSprite;
	public float ShadowDist = 0.1f;
	public bool UseParentSpr = true;

	public Transform MyTr { get; private set; }
	public SpriteRenderer MySpr { get; private set; }

	public SpriteRenderer ParentSpr { get; private set; }

	private void Awake()
	{
		MyTr = transform;

		ParentSpr = MyTr.parent.GetComponent<SpriteRenderer>();

		MySpr = GetComponent<SpriteRenderer>();
	}
	private void LateUpdate()
	{
		Vector2 lightDir = ((Vector2)Water.Instance.LightDir).normalized;
		MyTr.position = MyTr.parent.position - (Vector3)(lightDir * ShadowDist);

		if (UseParentSpr)
			ShadowSprite = ParentSpr.sprite;
		MySpr.sprite = ShadowSprite;
	}
}

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

[RequireComponent(typeof(SpriteRenderer))]
public class SpriteShadow : MonoBehaviour
{
	public Sprite ShadowSprite;
	public float ShadowDist = 0.1f;
	public bool UseParentSpr = true;

	public Transform MyTr { get; private set; }
	public SpriteRenderer MySpr { get; private set; }

	public SpriteRenderer ParentSpr { get; private set; }

	private void Awake()
	{
		MyTr = transform;

		ParentSpr = MyTr.parent.GetComponent<SpriteRenderer>();

		MySpr = GetComponent<SpriteRenderer>();
	}
	private void LateUpdate()
	{
		if (!ParentSpr.enabled)
		{
			MySpr.enabled = false;
			return;
		}

		Vector2 lightDir = ((Vector2)Water.Instance.LightDir).normalized;
		MyTr.position = MyTr.parent.position - (Vector3)(lightDir * ShadowDist);

		if (UseParentSpr)
			ShadowSprite = ParentSpr.sprite;
		MySpr.sprite = ShadowSprite;
	}
}

Fix shadow bug with mines exploding

Fix shadow bug with mines exploding


namespace Codestellation.Pulsar.Cron
{
    public struct IntegerIndex
    {
        public const int NotFound = -1;

        private readonly int[] _indexArray;
        public IntegerIndex(SimpleCronField field)
        {
            _indexArray = new int[field.Settings.MaxValue + 1];

            for (int i = 0; i < _indexArray.Length; i++)
            {
                _indexArray[i] = NotFound;
            }

            foreach (var value in field.Values)
            {
                _indexArray[value] = value;
            }

            int next = NotFound;
            for (int i = _indexArray.Length - 1; i >= 0; i--)
            {
                var val = _indexArray[i];
                if (val != NotFound)
                {
                    next = val;
                }

                _indexArray[i] = next;
            }
        }

        public int GetValue(int value)
        {
            return _indexArray[value];
        }
    }
}

namespace Codestellation.Pulsar.Cron
{
    public struct IntegerIndex
    {
        public const sbyte NotFound = -1;

        private readonly sbyte[] _indexArray;
        public IntegerIndex(SimpleCronField field)
        {
            _indexArray = new sbyte[field.Settings.MaxValue + 1];

            for (int i = 0; i < _indexArray.Length; i++)
            {
                _indexArray[i] = NotFound;
            }

            foreach (var value in field.Values)
            {
                _indexArray[value] = (sbyte)value;
            }

            int next = NotFound;
            for (int i = _indexArray.Length - 1; i >= 0; i--)
            {
                var val = _indexArray[i];
                if (val != NotFound)
                {
                    next = val;
                }

                _indexArray[i] = (sbyte)next;
            }
        }

        public int GetValue(int value)
        {
            return _indexArray[value];
        }
    }
}

Use sbyte in integer index

Use sbyte in integer index


namespace Stripe
{
    using System.Collections.Generic;
    using Newtonsoft.Json;

    public class SubscriptionItemUpdateOptions : SubscriptionItemSharedOptions
    {
        /// <summary>
        /// A set of key/value pairs that you can attach to a subscription object. It can be useful for storing additional information about the subscription in a structured format.
        /// </summary>
        [JsonProperty("metadata")]
        public Dictionary<string, string> Metadata { get; set; }

        /// <summary>
        /// Use <c>error_if_incomplete</c> if you want Stripe to return an HTTP 402 status code if
        /// the invoice caused by the update cannot be paid. Otherwise use <c>allow_incomplete</c>.
        /// </summary>
        [JsonProperty("payment_behavior")]
        public string PaymentBehavior { get; set; }
    }
}

namespace Stripe
{
    using System.Collections.Generic;
    using Newtonsoft.Json;

    public class SubscriptionItemUpdateOptions : SubscriptionItemSharedOptions
    {
        /// <summary>
        /// A set of key/value pairs that you can attach to a subscription object. It can be useful for storing additional information about the subscription in a structured format.
        /// </summary>
        [JsonProperty("metadata")]
        public Dictionary<string, string> Metadata { get; set; }

        /// <summary>
        /// Indicates if your customer is on session in case this update causes an invoice to
        /// be created.
        /// </summary>
        [JsonProperty("off_session")]
        public bool? OffSession { get; set; }

        /// <summary>
        /// Use <c>error_if_incomplete</c> if you want Stripe to return an HTTP 402 status code if
        /// the invoice caused by the update cannot be paid. Otherwise use <c>allow_incomplete</c>.
        /// </summary>
        [JsonProperty("payment_behavior")]
        public string PaymentBehavior { get; set; }
    }
}

Add OffSession on SubscriptionItem update


namespace formulate.meta
{

    /// <summary>
    /// Constants relating to Formulate itself (i.e., does not
    /// include constants used by Formulate).
    /// </summary>
    public class Constants
    {

        /// <summary>
        /// This is the version of Formulate. It is used on
        /// assemblies and during the creation of the
        /// installer package.
        /// </summary>
        /// <remarks>
        /// Do not reformat this code. A grunt task reads this
        /// version number with a regular expression.
        /// </remarks>
        public const string Version = "1.3.5.0";

        /// <summary>
        /// The name of the Formulate package.
        /// </summary>
        public const string PackageName = "Formulate";

        /// <summary>
        /// The name of the Formulate package, in camel case.
        /// </summary>
        public const string PackageNameCamelCase = "formulate";

    }

}

namespace formulate.meta
{

    /// <summary>
    /// Constants relating to Formulate itself (i.e., does not
    /// include constants used by Formulate).
    /// </summary>
    public class Constants
    {

        /// <summary>
        /// This is the version of Formulate. It is used on
        /// assemblies and during the creation of the
        /// installer package.
        /// </summary>
        /// <remarks>
        /// Do not reformat this code. A grunt task reads this
        /// version number with a regular expression.
        /// </remarks>
        public const string Version = "1.3.5.1";

        /// <summary>
        /// The name of the Formulate package.
        /// </summary>
        public const string PackageName = "Formulate";

        /// <summary>
        /// The name of the Formulate package, in camel case.
        /// </summary>
        public const string PackageNameCamelCase = "formulate";

    }

}

Increment version number to 1.3.5.1

Increment version number to 1.3.5.1


@using StackExchange.Opserver.Models
@using StackExchange.Profiling
@{
    Layout = null;
}
@helper RenderTab(TopTab tab)
{
    if (tab.IsEnabled)
    {
        // Optimism!
        using (MiniProfiler.Current.Step("Render Tab: " + tab.Name))
        {
            var status = tab.GetMonitorStatus?.Invoke() ?? MonitorStatus.Good;
            var badgeCount = tab.GetBadgeCount?.Invoke();

                            @tab.Name
                            @if (badgeCount > 0)
                            {
                                @badgeCount.ToComma()
                            }

        }
    }
}
@if (!TopTabs.HideAll)
{
    using (MiniProfiler.Current.Step("TopTabs"))
    {

                    @foreach (var tab in TopTabs.Tabs.Values)
                    {
                        @RenderTab(tab)
                    }

    }
}

Make tab colors work and stuff

Make tab colors work and stuff


using System;
using System.Collections.Generic;

namespace MuffinFramework
{
    public abstract class LayerBase<TArgs> : ILayerBase<TArgs>
    {
        private readonly object _lockObj = new object();

        private readonly List<ILayerBase<TArgs>> _parts = new List<ILayerBase<TArgs>>();
        private TArgs _args;

        public bool IsEnabled { get; private set; }

        public virtual void Enable(TArgs args)
        {
            lock (this._lockObj) {
                if (this.IsEnabled)
                    throw new InvalidOperationException("LayerBase has already been enabled.");

                this.IsEnabled = true;
            }

            this._args = args;
            this.Enable();
        }

        protected abstract void Enable();

        protected TPart EnablePart<TPart, TProtocol>(TProtocol host) where TPart : class, ILayerPart<TProtocol, TArgs>, new()
        {
            var part = new TPart();
            part.Enable(host, this._args);
            this._parts.Add(part);
            return part;
        }

        protected TPart EnablePart<TPart, TProtocol>() where TPart : class, ILayerPart<TProtocol, TArgs>, new()
        {
            var host = (TProtocol) (object) this;
            return this.EnablePart<TPart, TProtocol>(host);
        }

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

        protected virtual void Dispose(bool disposing)
        {
            if (!disposing) return;

            foreach (var part in this._parts) {
                part.Dispose();
            }
        }
    }
}

using System;
using System.Collections.Generic;

namespace MuffinFramework
{
    public abstract class LayerBase<TArgs> : ILayerBase<TArgs>
    {
        private readonly object _lockObj = new object();

        private readonly List<ILayerBase<TArgs>> _parts = new List<ILayerBase<TArgs>>();
        private TArgs _args;

        public bool IsEnabled { get; private set; }

        public virtual void Enable(TArgs args)
        {
            lock (this._lockObj) {
                if (this.IsEnabled)
                    throw new InvalidOperationException("LayerBase has already been enabled.");

                this.IsEnabled = true;
            }

            this._args = args;
            this.Enable();
        }

        protected abstract void Enable();

        protected TPart EnablePart<TPart, TProtocol>(TProtocol host) where TPart : class, ILayerPart<TProtocol, TArgs>, new()
        {
            var part = new TPart();
            part.Enable(host, this._args);

            lock (this._lockObj)
            {
                this._parts.Add(part);
            }

            return part;
        }

        protected TPart EnablePart<TPart, TProtocol>() where TPart : class, ILayerPart<TProtocol, TArgs>, new()
        {
            var host = (TProtocol) (object) this;
            return this.EnablePart<TPart, TProtocol>(host);
        }

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

        protected virtual void Dispose(bool disposing)
        {
            if (!disposing) return;

            ILayerBase<TArgs>[] parts;
            lock (this._lockObj)
            {
                parts = this._parts.ToArray();
            }

            foreach (var part in parts)
            {
                part.Dispose();
            }
        }
    }
}

Fix EnablePart is not threadsafe

Fix EnablePart is not threadsafe


using CrossPlatformTintedImage;
using CrossPlatformTintedImage.iOS;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;

[assembly:ExportRendererAttribute(typeof(TintedImage), typeof(TintedImageRenderer))]

namespace CrossPlatformTintedImage.iOS
{

    public class TintedImageRenderer : ImageRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<Image> e)
        {
            base.OnElementChanged(e);

            SetTint();
        }

        protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(sender, e);

            if (e.PropertyName == TintedImage.TintColorProperty.PropertyName)
                SetTint();
        }

        void SetTint()
        {
            if (Control?.Image != null && Element != null)
            {
                Control.Image = Control.Image.ImageWithRenderingMode(UIKit.UIImageRenderingMode.AlwaysTemplate);
                Control.TintColor = ((TintedImage) Element).TintColor.ToUIColor();
            }
        }
    }
}

using CrossPlatformTintedImage;
using CrossPlatformTintedImage.iOS;
using Xamarin.Forms;
using Xamarin.Forms.Platform.iOS;

[assembly:ExportRendererAttribute(typeof(TintedImage), typeof(TintedImageRenderer))]

namespace CrossPlatformTintedImage.iOS
{

    public class TintedImageRenderer : ImageRenderer
    {
        protected override void OnElementChanged(ElementChangedEventArgs<Image> e)
        {
            base.OnElementChanged(e);

            SetTint();
        }

        protected override void OnElementPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(sender, e);

            if (e.PropertyName == TintedImage.TintColorProperty.PropertyName)
                SetTint();
        }

        void SetTint()
        {
			if (Control?.Image == null || Element == null)
				return;

			if (((TintedImage)Element).TintColor == Color.Transparent)
			{
				//Turn off tinting
				Control.Image = Control.Image.ImageWithRenderingMode(UIKit.UIImageRenderingMode.Automatic);
				Control.TintColor = null;
			}
			else
			{
				//Apply tint color
				Control.Image = Control.Image.ImageWithRenderingMode(UIKit.UIImageRenderingMode.AlwaysTemplate);
				Control.TintColor = ((TintedImage)Element).TintColor.ToUIColor();
			}
        }
    }
}

Disable tinting option on iOS

Disable tinting option on iOS


namespace QtWebKit {

	using Qyoto;

	using System;
	using System.Runtime.InteropServices;

	public class InitQtWebKit {
		[DllImport("libqtwebkit-sharp", CharSet=CharSet.Ansi)]
		static extern void Init_qtwebkit();

		public static void InitSmoke() {
			Init_qtwebkit();
		}
	}
}

namespace QtWebKit {

	using Qyoto;

	using System;
	using System.Runtime.InteropServices;

	public class InitQtWebKit {
		[DllImport("qtwebkit-sharp", CharSet=CharSet.Ansi)]
		static extern void Init_qtwebkit();

		public static void InitSmoke() {
			Init_qtwebkit();
		}
	}
}

Remove the 'lib' prefix for the native lib.

svn path=/trunk/KDE/kdebindings/csharp/; revision=1047227


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

using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;

namespace osu.Game.Rulesets.Taiko.Skinning
{
    public class LegacyHitExplosion : CompositeDrawable
    {
        public LegacyHitExplosion(Drawable sprite)
        {
            InternalChild = sprite;

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

            AutoSizeAxes = Axes.Both;
        }

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

            const double animation_time = 120;

            this.FadeInFromZero(animation_time).Then().FadeOut(animation_time * 1.5);

            this.ScaleTo(0.6f)
                .Then().ScaleTo(1.1f, animation_time * 0.8)
                .Then().ScaleTo(0.9f, animation_time * 0.4)
                .Then().ScaleTo(1f, animation_time * 0.2);
        }
    }
}

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

using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;

namespace osu.Game.Rulesets.Taiko.Skinning
{
    public class LegacyHitExplosion : CompositeDrawable
    {
        public LegacyHitExplosion(Drawable sprite)
        {
            InternalChild = sprite;

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

            AutoSizeAxes = Axes.Both;
        }

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

            const double animation_time = 120;

            this.FadeInFromZero(animation_time).Then().FadeOut(animation_time * 1.5);

            this.ScaleTo(0.6f)
                .Then().ScaleTo(1.1f, animation_time * 0.8)
                .Then().ScaleTo(0.9f, animation_time * 0.4)
                .Then().ScaleTo(1f, animation_time * 0.2);

            Expire(true);
        }
    }
}

Fix skinned taiko hit explosions not being removed on rewind


using EarTrumpet.Extensions;
using System;
using System.Windows;
using System.Windows.Controls;

namespace EarTrumpet.UI.Behaviors
{
    public class TextBoxEx
    {
        // ClearText: Clear TextBox or the parent ComboBox.
        public static bool GetClearText(DependencyObject obj) => (bool)obj.GetValue(ClearTextProperty);
        public static void SetClearText(DependencyObject obj, bool value) => obj.SetValue(ClearTextProperty, value);
        public static readonly DependencyProperty ClearTextProperty =
        DependencyProperty.RegisterAttached("ClearText", typeof(bool), typeof(TextBoxEx), new PropertyMetadata(false, ClearTextChanged));

        private static void ClearTextChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
        {
            if ((bool)e.NewValue == true)
            {
                var parent = dependencyObject.FindVisualParent<ComboBox>();
                if (parent != null)
                {
                    parent.Text = "";
                    parent.SelectedItem = null;
                }
                else
                {
                    ((TextBox)dependencyObject).Text = "";
                }
            }
        }
    }
}

using EarTrumpet.Extensions;
using System;
using System.Windows;
using System.Windows.Controls;

namespace EarTrumpet.UI.Behaviors
{
    public class TextBoxEx
    {
        // ClearText: Clear TextBox or the parent ComboBox.
        public static bool GetClearText(DependencyObject obj) => (bool)obj.GetValue(ClearTextProperty);
        public static void SetClearText(DependencyObject obj, bool value) => obj.SetValue(ClearTextProperty, value);
        public static readonly DependencyProperty ClearTextProperty =
        DependencyProperty.RegisterAttached("ClearText", typeof(bool), typeof(TextBoxEx), new PropertyMetadata(false, ClearTextChanged));

        private static void ClearTextChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e)
        {
            if ((bool)e.NewValue == true)
            {
                var parent = dependencyObject.FindVisualParent<ComboBox>();
                if (parent != null)
                {
                    parent.Text = "";
                    parent.SelectedItem = null;
                }
                else
                {
                    // Ignore !IsLoaded to cleverly allow IsPressed=False to be our trigger but also
                    // don't clear TextBoxes when they are initially created.
                    var textBox = ((TextBox)dependencyObject);
                    if (textBox.IsLoaded)
                    {
                        textBox.Text = "";
                    }
                }
            }
        }
    }
}

Fix (from SearchBox): Hotkeys are cleared constantly


using Microsoft.Extensions.DependencyInjection;

namespace MicroNetCore.Rest.Models.ViewModels.Extensions
{
    public static class ConfigurationExtensions
    {
        public static IServiceCollection AddViewModels(this IServiceCollection services)
        {
            services.AddSingleton<IViewModelTypeProvider, ViewModelTypeProvider>();
            services.AddTransient<IViewModelGenerator, ViewModelGenerator>();

            return services;
        }
    }
}

using Microsoft.Extensions.DependencyInjection;

namespace MicroNetCore.Rest.Models.ViewModels.Extensions
{
    public static class ConfigurationExtensions
    {
        public static IServiceCollection AddViewModels(this IServiceCollection services)
        {
            services.AddSingleton<IViewModelTypeProvider, ViewModelTypeProvider>();
            services.AddSingleton<IViewModelGenerator, ViewModelGenerator>();

            return services;
        }
    }
}

Change IViewModelGenerator implementation registration type from Transient to Singleton.


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

using osu.Framework.Development;
using osu.Framework.Extensions.TypeExtensions;
using osu.Framework.Graphics;
using osu.Framework.Lists;

namespace osu.Framework.Logging
{
    internal static class LoadingComponentsLogger
    {
        private static readonly WeakList<Drawable> loading_components = new WeakList<Drawable>();

        public static void Add(Drawable component)
        {
            if (!DebugUtils.IsDebugBuild) return;

            lock (loading_components)
                loading_components.Add(component);
        }

        public static void Remove(Drawable component)
        {
            if (!DebugUtils.IsDebugBuild) return;

            lock (loading_components)
                loading_components.Remove(component);
        }

        public static void LogAndFlush()
        {
            if (!DebugUtils.IsDebugBuild) return;

            lock (loading_components)
            {
                Logger.Log("⏳ Currently loading components");

                foreach (var c in loading_components)
                    Logger.Log($"- {c.GetType().ReadableName(),-16} LoadState:{c.LoadState,-5} Thread:{c.LoadThread.Name}");

                loading_components.Clear();
            }
        }
    }
}

// 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.Linq;
using osu.Framework.Development;
using osu.Framework.Extensions.TypeExtensions;
using osu.Framework.Graphics;
using osu.Framework.Lists;

namespace osu.Framework.Logging
{
    internal static class LoadingComponentsLogger
    {
        private static readonly WeakList<Drawable> loading_components = new WeakList<Drawable>();

        public static void Add(Drawable component)
        {
            if (!DebugUtils.IsDebugBuild) return;

            lock (loading_components)
                loading_components.Add(component);
        }

        public static void Remove(Drawable component)
        {
            if (!DebugUtils.IsDebugBuild) return;

            lock (loading_components)
                loading_components.Remove(component);
        }

        public static void LogAndFlush()
        {
            if (!DebugUtils.IsDebugBuild) return;

            lock (loading_components)
            {
                Logger.Log($"⏳ Currently loading components ({loading_components.Count()})");

                foreach (var c in loading_components)
                    Logger.Log($"- {c.GetType().ReadableName(),-16} LoadState:{c.LoadState,-5} Thread:{c.LoadThread.Name}");

                loading_components.Clear();
            }
        }
    }
}

Add count to loading components logging

Add count to loading components logging

When there's no components loading, it looked a bit weird. This gives
context and avoids the potential case where log output is truncated and
there may have actually been components.


using System.Web.Routing;
using SignalR;

[assembly: WebActivator.PostApplicationStartMethod(typeof(ConsolR.Hosting.Bootstrapper), "PreApplicationStart")]

namespace ConsolR.Hosting
{
	public static class Bootstrapper
	{
		public static void PreApplicationStart()
		{
			var routes = RouteTable.Routes;

			routes.MapHttpHandler<Handler>("consolr");
			routes.MapHttpHandler<Handler>("consolr/validate");
			routes.MapConnection<ExecuteEndPoint>("consolr-execute", "consolr/execute/{*operation}");
		}
	}
}

using System.Web.Routing;
using SignalR;

[assembly: WebActivator.PreApplicationStartMethod(typeof(ConsolR.Hosting.Bootstrapper), "PreApplicationStart")]

namespace ConsolR.Hosting
{
	public static class Bootstrapper
	{
		public static void PreApplicationStart()
		{
			var routes = RouteTable.Routes;

			routes.MapHttpHandler<Handler>("consolr");
			routes.MapHttpHandler<Handler>("consolr/validate");
			routes.MapConnection<ExecuteEndPoint>("consolr-execute", "consolr/execute/{*operation}");
		}
	}
}

Make sure bootstrapper runs pre application start


namespace SurveyMonkey.RequestSettings
{
    public class CreateCollectorSettings
    {
        public enum TypeOption
        {
            Weblink,
            Email
        }

        public TypeOption Type { get; set; }
        public string Name { get; set; }
    }
}

using System;
using SurveyMonkey.Containers;

namespace SurveyMonkey.RequestSettings
{
    public class CreateCollectorSettings
    {
        public Collector.CollectorType Type { get; set; }
        public string Name { get; set; }
        public string ThankYouMessage { get; set; }
        public string DisqualificationMessage { get; set; }
        public DateTime? CloseDate { get; set; }
        public string ClosedPageMessage { get; set; }
        public string RedirectUrl { get; set; }
        public bool? DisplaySurveyResults { get; set; }
        public Collector.EditResponseOption? EditResponseType { get; set; }
        public Collector.AnonymousOption? AnonymousType { get; set; }
        public bool? AllowMultipleResponses { get; set; }
        public string Password { get; set; }
        public string SenderEmail { get; set; }
    }
}

Implement all properties for collector settings


using System;

//Problem 15.* Age after 10 Years

//Write a program to read your birthday from the console and print how old you are now and how old you will be after 10 years.

class AgeAfter10Years
{
    public static int yearsNow;
    static void Main(string[] args)
    {
        Console.Write("Enter birtday year:");
        int birthdayYear = int.Parse(Console.ReadLine());
        Console.Write("Month:");
        int month = int.Parse(Console.ReadLine());
        Console.Write("Day");
        int day = int.Parse(Console.ReadLine());
        DateTime birthday = new DateTime(birthdayYear, month, day);
        DateTime now = DateTime.Now;
        Console.WriteLine(CalculateAge(birthday, now));
        Console.WriteLine(Add10Years(yearsNow));

    }

    static int CalculateAge(DateTime birthday, DateTime now)
    {
        yearsNow = now.Year - birthday.Year;
        if (birthday.Month > now.Month)
        {
            yearsNow--;
        }
        if (birthday.Month == now.Month && birthday.Day > now.Day)
        {
            yearsNow--;
        }
        return yearsNow;
    }

    static int Add10Years(int yearsNow)
    {
        int yearsAfter10 = yearsNow + 10;
        return yearsAfter10;
    }
}

using System;

//Problem 15.* Age after 10 Years

//Write a program to read your birthday from the console and print how old you are now and how old you will be after 10 years.

class AgeAfter10Years
{
    public static int yearsNow;
    static void Main(string[] args)
    {
        Console.Write("Enter birtday year:");
        string[] input = Console.ReadLine().Split(new char[] {'.'}, StringSplitOptions.RemoveEmptyEntries);
        int month = int.Parse(input[0]);
        int day = int.Parse(input[1]);
        int birthdayYear = int.Parse(input[2]);
        Console.WriteLine(day);
        if (birthdayYear > DateTime.Now.Year)
        {
            Console.WriteLine(0);
            Console.WriteLine(10);
        }
        else
        {
            DateTime birthday = new DateTime(birthdayYear, month, day);
            DateTime now = DateTime.Now;
            Console.WriteLine(CalculateAge(birthday, now));
            Console.WriteLine(Add10Years(yearsNow));
        }

    }

    static int CalculateAge(DateTime birthday, DateTime now)
    {
        yearsNow = now.Year - birthday.Year;
        if (birthday.Month > now.Month)
        {
            yearsNow--;
        }
        if (birthday.Month == now.Month && birthday.Day > now.Day)
        {
            yearsNow--;
        }
        return yearsNow;
    }

    static int Add10Years(int yearsNow)
    {
        int yearsAfter10 = yearsNow + 10;
        return yearsAfter10;
    }
}

Make some changes by the solution

Make some changes by the solution


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

using TTMouseclickSimulator.Core.Environment;

namespace TTMouseclickSimulator.Core.ToontownRewritten.Environment
{

    /// <summary>
    /// Environment interface for Toontown Rewritten.
    /// </summary>
    public class TTRWindowsEnvironment : AbstractWindowsEnvironment
    {
        private const string ProcessName = "TTREngine";

        public static TTRWindowsEnvironment Instance = new TTRWindowsEnvironment();

        private TTRWindowsEnvironment()
        {

        }

        public override Process FindProcess()
        {
            return FindProcessByName(ProcessName);
        }
    }
}

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

using TTMouseclickSimulator.Core.Environment;

namespace TTMouseclickSimulator.Core.ToontownRewritten.Environment
{

    /// <summary>
    /// Environment interface for Toontown Rewritten.
    /// </summary>
    public class TTRWindowsEnvironment : AbstractWindowsEnvironment
    {
        private const string ProcessName = "TTREngine";

        public static TTRWindowsEnvironment Instance { get; } = new TTRWindowsEnvironment();

        private TTRWindowsEnvironment()
        {

        }

        public override Process FindProcess()
        {
            return FindProcessByName(ProcessName);
        }
    }
}

Fix the singleton instance field.

Fix the singleton instance field.


using System;
namespace Xamarin.Forms.GoogleMaps.Internals
{
    internal class ProductInformation
    {
        public const string Author = "amay077";
        public const string Name = "Xamarin.Forms.GoogleMaps";
        public const string Copyright = "Copyright © amay077. 2016 - 2017";
        public const string Trademark = "";
        public const string Version = "2.2.1.5";
    }
}

using System;
namespace Xamarin.Forms.GoogleMaps.Internals
{
    internal class ProductInformation
    {
        public const string Author = "amay077";
        public const string Name = "Xamarin.Forms.GoogleMaps";
        public const string Copyright = "Copyright © amay077. 2016 - 2017";
        public const string Trademark = "";
        public const string Version = "2.2.1.6";
    }
}

Update file version to 2.2.1.6

Update file version to 2.2.1.6


using System.IO;
using System.Reflection;
using System.Xml.Serialization;

namespace IncrementalCompiler
{
    public class Settings
    {
        public DebugSymbolFileType DebugSymbolFile;
        public PrebuiltOutputReuseType PrebuiltOutputReuse;

        public static Settings Default = new Settings
        {
            DebugSymbolFile = DebugSymbolFileType.Mdb,
            PrebuiltOutputReuse = PrebuiltOutputReuseType.WhenNoChange,
        };

        public static Settings Load()
        {
            var fileName = Path.ChangeExtension(Assembly.GetEntryAssembly().Location, ".xml");
            if (File.Exists(fileName) == false)
                return null;

            using (var stream = new FileStream(fileName, FileMode.Open))
            {
                return Load(stream);
            }
        }

        public static Settings Load(Stream stream)
        {
            var deserializer = new XmlSerializer(typeof(Settings));
            return (Settings)deserializer.Deserialize(stream);
        }

        public static void Save(Stream stream, Settings settings)
        {
            var serializer = new XmlSerializer(typeof(Settings));
            serializer.Serialize(stream, settings);
        }
    }
}

using System;
using System.IO;
using System.Reflection;
using System.Xml.Linq;

namespace IncrementalCompiler
{
    public class Settings
    {
        public DebugSymbolFileType DebugSymbolFile;
        public PrebuiltOutputReuseType PrebuiltOutputReuse;

        public static Settings Default = new Settings
        {
            DebugSymbolFile = DebugSymbolFileType.Mdb,
            PrebuiltOutputReuse = PrebuiltOutputReuseType.WhenNoChange,
        };

        public static Settings Load()
        {
            var fileName = Path.ChangeExtension(Assembly.GetEntryAssembly().Location, ".xml");
            if (File.Exists(fileName) == false)
                return null;

            using (var stream = new FileStream(fileName, FileMode.Open))
            {
                return Load(stream);
            }
        }

        public static Settings Load(Stream stream)
        {
            // To reduce start-up time, do manual parsing instead of using XmlSerializer
            var xdoc = XDocument.Load(stream).Element("Settings");
            return new Settings
            {
                DebugSymbolFile = (DebugSymbolFileType)Enum.Parse(typeof(DebugSymbolFileType), xdoc.Element("DebugSymbolFile").Value),
                PrebuiltOutputReuse = (PrebuiltOutputReuseType)Enum.Parse(typeof(PrebuiltOutputReuseType), xdoc.Element("PrebuiltOutputReuse").Value),
            };
        }
    }
}

Use manual xml parsing for fast start-up


using Glimpse.Web;
using Microsoft.Framework.Logging;
using System;
using System.Threading.Tasks;

namespace Glimpse.Agent.Web
{
    public class AgentProfiler : IRequestProfiler
    {
        private readonly string _requestIdKey = "RequestId";
        private readonly IAgentBroker _messageBus;

        public AgentProfiler(IAgentBroker messageBus, ILoggerFactory loggingFactory)
        {
            _messageBus = messageBus;

            //// TODO: This is a REALLY bad place for this, not sure where else to put it
            //loggingFactory.AddProvider(new DefaultLoggerProvider(messageBus));
            //var test = loggingFactory.Create("test");
            //test.Write(LogLevel.Information, 123, new { Test = "test" }, null, (x, y) => { return ""; });
            //// TODO: This is a REALLY bad place for this, not sure where else to put it
        }

        public async Task Begin(IHttpContext newContext)
        {
            var message = new BeginRequestMessage(newContext.Request);

            // TODO: Full out message more

            await _messageBus.SendMessage(message);
        }

        public async Task End(IHttpContext newContext)
        {
            var message = new EndRequestMessage(newContext.Request);

            // TODO: Full out message more

            await _messageBus.SendMessage(message);
        }
    }
}

using Glimpse.Web;
using Microsoft.Framework.Logging;
using System;
using System.Threading.Tasks;

namespace Glimpse.Agent.Web
{
    public class AgentProfiler : IRequestProfiler
    {
        private readonly string _requestIdKey = "RequestId";
        private readonly IAgentBroker _messageBus;

        public AgentProfiler(IAgentBroker messageBus, ILoggerFactory loggingFactory)
        {
            _messageBus = messageBus;
        }

        public async Task Begin(IHttpContext newContext)
        {
            var message = new BeginRequestMessage(newContext.Request);

            // TODO: Full out message more

            await _messageBus.SendMessage(message);
        }

        public async Task End(IHttpContext newContext)
        {
            var message = new EndRequestMessage(newContext.Request);

            // TODO: Full out message more

            await _messageBus.SendMessage(message);
        }
    }
}

Remove comment no longer needed.

Remove comment no longer needed.


namespace Nancy.Demo.Hosting.Self
{
    using System;
    using System.Diagnostics;

    using Nancy.Hosting.Self;

    class Program
    {
        static void Main()
        {
            using (var nancyHost = new NancyHost(new Uri("http://localhost:8888/nancy/"), new Uri("http://127.0.0.1:8888/nancy/"), new Uri("http://localhost:8889/nancytoo/")))
            {
                nancyHost.Start();

                Console.WriteLine("Nancy now listening - navigating to http://localhost:8888/nancy/. Press enter to stop");
                try
                {
                    Process.Start("http://localhost:8888/nancy/");
                }
                catch (Exception)
                {
                }
                Console.ReadKey();
            }

            Console.WriteLine("Stopped. Good bye!");
        }
    }
}

namespace Nancy.Demo.Hosting.Self
{
    using System;
    using System.Diagnostics;

    using Nancy.Hosting.Self;

    class Program
    {
        static void Main()
        {
            using (var nancyHost = new NancyHost(new Uri("http://localhost:8888/nancy/"), new Uri("http://127.0.0.1:8898/nancy/"), new Uri("http://localhost:8889/nancytoo/")))
            {
                nancyHost.Start();

                Console.WriteLine("Nancy now listening - navigating to http://localhost:8888/nancy/. Press enter to stop");
                try
                {
                    Process.Start("http://localhost:8888/nancy/");
                }
                catch (Exception)
                {
                }
                Console.ReadKey();
            }

            Console.WriteLine("Stopped. Good bye!");
        }
    }
}

Change port number 8888 to 8898

Change port number 8888 to 8898

In linux platform, self hosting demo throws an error: "System.Net.Sockets.SocketException: Address already in use"


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

namespace PerfIt
{
    [EventSource(Name = "PerIt!Instrumentation", Guid = "{010380F8-40A7-45C3-B87B-FD4C6CC8700A}")]
    public class InstrumentationEventSource : EventSource
    {
        public static readonly InstrumentationEventSource Instance = new InstrumentationEventSource();

        private InstrumentationEventSource()
        {

        }

        [Event(1, Level = EventLevel.Informational)]
        public void WriteInstrumentationEvent(string categoryName, string instanceName, long timeTakenMilli, string instrumentationContext = null)
        {
            this.WriteEvent(1, categoryName, instanceName, timeTakenMilli, instrumentationContext);
        }
    }
}

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

namespace PerfIt
{
    [EventSource(Name = "PerfIt-Instrumentation")]
    public class InstrumentationEventSource : EventSource
    {
        public static readonly InstrumentationEventSource Instance = new InstrumentationEventSource();

        private InstrumentationEventSource()
        {

        }

        [Event(1, Level = EventLevel.Informational)]
        public void WriteInstrumentationEvent(string categoryName, string instanceName, long timeTakenMilli, string instrumentationContext = null)
        {
            this.WriteEvent(1, categoryName, instanceName, timeTakenMilli, instrumentationContext);
        }
    }
}

Remove Guid, fix typo and change to allowed seperator character

Remove EventSource guid and unsupported characters from Name


@model Tipage.Web.Models.ViewModels.ShiftListViewModel

@{
    ViewData["Title"] = "Shifts";
}

Shifts

@Html.DisplayNameFor(model => model.TotalTips) @Html.DisplayFor(model => model.TotalTips)

@Html.DisplayNameFor(model => model.AverageHourlyWage) @Html.DisplayFor(model => model.AverageHourlyWage)

    New Shift

            Date

            Total Tips

    @foreach (var item in Model.Shifts)
    {

                @item.Start.ToString("d") (@item.Start.DayOfWeek)

                @Html.DisplayFor(s => item.TotalTips)

    }

@model Tipage.Web.Models.ViewModels.ShiftListViewModel

@{
    ViewData["Title"] = "Shifts";
}

Shifts

@Html.DisplayNameFor(model => model.TotalTips) @Html.DisplayFor(model => model.TotalTips)

@Html.DisplayNameFor(model => model.AverageHourlyWage) @Html.DisplayFor(model => model.AverageHourlyWage)

    New Shift

            Date

            Tips

    @foreach (var item in Model.Shifts)
    {

                @item.Start.ToString("d") (@item.Start.DayOfWeek)

                @Html.DisplayFor(s => item.TotalTips)

    }

Rename "Total Tips" to "Tips"

Rename "Total Tips" to "Tips"


using System;
using Newtonsoft.Json;

namespace Shippo {
    [JsonObject (MemberSerialization.OptIn)]
    public class Batch : ShippoId {
        [JsonProperty (PropertyName = "object_status")]
        public string ObjectStatus { get; set; }

        [JsonProperty (PropertyName = "object_created")]
        public string ObjectCreated { get; set; }

        [JsonProperty (PropertyName = "object_updated")]
        public string ObjectUpdated { get; set; }

        [JsonProperty (PropertyName = "object_owner")]
        public string ObjectOwner { get; set; }

        [JsonProperty (PropertyName = "default_carrier_account")]
        public string DefaultCarrierAccount { get; set; }

        [JsonProperty (PropertyName = "default_servicelevel_token")]
        public string DefaultServicelevelToken { get; set; }

        [JsonProperty (PropertyName = "label_filetype")]
        public string LabelFiletype { get; set; }

        [JsonProperty (PropertyName = "metadata")]
        public string Metadata { get; set; }

        [JsonProperty (PropertyName = "batch_shipments")]
        public object BatchShipments { get; set; }

        [JsonProperty (PropertyName = "label_url")]
        public string LabelUrl { get; set; }

        [JsonProperty (PropertyName = "object_results")]
        public ObjectResults ObjectResults { get; set; }
    }
}

using System;
using System.Collections.Generic;
using Newtonsoft.Json;

namespace Shippo {
    [JsonObject (MemberSerialization.OptIn)]
    public class Batch : ShippoId {
        [JsonProperty (PropertyName = "object_status")]
        public string ObjectStatus { get; set; }

        [JsonProperty (PropertyName = "object_created")]
        public string ObjectCreated { get; set; }

        [JsonProperty (PropertyName = "object_updated")]
        public string ObjectUpdated { get; set; }

        [JsonProperty (PropertyName = "object_owner")]
        public string ObjectOwner { get; set; }

        [JsonProperty (PropertyName = "default_carrier_account")]
        public string DefaultCarrierAccount { get; set; }

        [JsonProperty (PropertyName = "default_servicelevel_token")]
        public string DefaultServicelevelToken { get; set; }

        [JsonProperty (PropertyName = "label_filetype")]
        public string LabelFiletype { get; set; }

        [JsonProperty (PropertyName = "metadata")]
        public string Metadata { get; set; }

        [JsonProperty (PropertyName = "batch_shipments")]
        public object BatchShipments { get; set; }

        [JsonProperty (PropertyName = "label_url")]
        public List<String> LabelUrl { get; set; }

        [JsonProperty (PropertyName = "object_results")]
        public ObjectResults ObjectResults { get; set; }
    }
}

Change LabelUrl property from string to List<String>


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

namespace Eff.Core
{
    public struct ExceptionLog
    {
        public string CallerMemberName;
        public string CallerFilePath;
        public int CallerLineNumber;
        public Exception Exception;
    }

    public struct ResultLog
    {
        public string CallerMemberName;
        public string CallerFilePath;
        public int CallerLineNumber;
        public object Result;
    }
}

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

namespace Eff.Core
{
    public class ExceptionLog
    {
        public string CallerMemberName { get; set; }
        public string CallerFilePath { get; set; }
        public int CallerLineNumber { get; set; }
        public Exception Exception { get; set; }
    }

    public class ResultLog
    {
        public string CallerMemberName { get; set; }
        public string CallerFilePath { get; set; }
        public int CallerLineNumber { get; set; }
        public object Result { get; set; }
    }
}

Refactor Log objects to class DTOs.

Refactor Log objects to class DTOs.


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

using System;
using System.Threading.Tasks;
using osu.Framework.Allocation;

namespace osu.Framework.Graphics.Containers
{
    /// <summary>
    /// A container which asynchronously loads its children.
    /// </summary>
    public class AsyncLoadContainer : Container
    {
        /// <summary>
        /// Called when async loading of children has completed.
        /// </summary>
        public Action<AsyncLoadContainer> FinishedLoading;

        protected override Container<Drawable> Content => content;

        private readonly Container content = new Container { RelativeSizeAxes = Axes.Both };

        private Game game;

        protected virtual bool ShouldLoadContent => true;

        [BackgroundDependencyLoader]
        private void load(Game game)
        {
            this.game = game;
            if (ShouldLoadContent)
                loadContentAsync();
        }

        protected override void Update()
        {
            base.Update();

            if (!LoadTriggered && ShouldLoadContent)
                loadContentAsync();
        }

        private Task loadTask;

        private void loadContentAsync()
        {
            loadTask = content.LoadAsync(game, d =>
            {
                AddInternal(d);
                d.FadeInFromZero(150);
                FinishedLoading?.Invoke(this);
            });
        }

        protected bool LoadTriggered => loadTask != null;
    }
}

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

using System;
using System.Threading.Tasks;
using osu.Framework.Allocation;

namespace osu.Framework.Graphics.Containers
{
    /// <summary>
    /// A container which asynchronously loads its children.
    /// </summary>
    public class AsyncLoadContainer : Container
    {
        /// <summary>
        /// Called when async loading of children has completed.
        /// </summary>
        public Action<AsyncLoadContainer> FinishedLoading;

        protected override Container<Drawable> Content => content;

        private readonly Container content = new Container { RelativeSizeAxes = Axes.Both };

        private Game game;

        protected virtual bool ShouldLoadContent => true;

        [BackgroundDependencyLoader]
        private void load(Game game)
        {
            this.game = game;
            if (ShouldLoadContent)
                loadContentAsync();
        }

        protected override void Update()
        {
            base.Update();

            if (!LoadTriggered && ShouldLoadContent)
                loadContentAsync();
        }

        private Task loadTask;

        private void loadContentAsync()
        {
            loadTask = content.LoadAsync(game, d =>
            {
                AddInternal(d);
                FinishedLoading?.Invoke(this);
            });
        }

        protected bool LoadTriggered => loadTask != null;
    }
}

Remove FadeInFromZero from base class.

Remove FadeInFromZero from base class.


using System;
using System.Drawing;

namespace TriDevs.TriCraftClassic
{
    class Program
    {
        [STAThread]
        public static void Main(string[] args)
        {
            Window window = new Window(1280, 720);
            window.Run(60.0);
        }
    }
}

using System;
using System.Drawing;

namespace TriDevs.TriCraftClassic
{
    class Program
    {
        public static void Main(string[] args)
        {
            Window window = new Window(1280, 720);
            window.Run(60.0);
        }
    }
}

Remove STAThread from main function

Remove STAThread from main function


using KenticoInspector.Core.Models;
using KenticoInspector.Core.Services.Interfaces;
using System;
using System.Collections.Generic;

namespace KenticoInspector.Core
{
    public abstract class AbstractReport<T> : IReport, IWithMetadata<T> where T : new()
    {
        protected readonly IReportMetadataService reportMetadataService;

        public AbstractReport(IReportMetadataService reportMetadataService)
        {
            this.reportMetadataService = reportMetadataService;
        }

        public string Codename => GetCodename(this.GetType());

        public static string GetCodename(Type reportType)
        {
            return GetDirectParentNamespace(reportType);
        }

        public abstract IList<Version> CompatibleVersions { get; }

        public virtual IList<Version> IncompatibleVersions => new List<Version>();

        public abstract IList<string> Tags { get; }

        public ReportMetadata<T> Metadata => reportMetadataService.GetReportMetadata<T>(Codename);

        public abstract ReportResults GetResults();

        private static string GetDirectParentNamespace(Type reportType)
        {
            var fullNameSpace = reportType.Namespace;
            var indexAfterLastPeriod = fullNameSpace.LastIndexOf('.') + 1;
            return fullNameSpace.Substring(indexAfterLastPeriod, fullNameSpace.Length - indexAfterLastPeriod);
        }
    }
}

using KenticoInspector.Core.Models;
using KenticoInspector.Core.Services.Interfaces;
using System;
using System.Collections.Generic;

namespace KenticoInspector.Core
{
    public abstract class AbstractReport<T> : IReport, IWithMetadata<T> where T : new()
    {
        private ReportMetadata<T> metadata;
        protected readonly IReportMetadataService reportMetadataService;

        public AbstractReport(IReportMetadataService reportMetadataService)
        {
            this.reportMetadataService = reportMetadataService;
        }

        public string Codename => GetCodename(this.GetType());

        public static string GetCodename(Type reportType)
        {
            return GetDirectParentNamespace(reportType);
        }

        public abstract IList<Version> CompatibleVersions { get; }

        public virtual IList<Version> IncompatibleVersions => new List<Version>();

        public abstract IList<string> Tags { get; }

        public ReportMetadata<T> Metadata
        {
            get
            {
                return metadata ?? (metadata = reportMetadataService.GetReportMetadata<T>(Codename));
            }
        }

        public abstract ReportResults GetResults();

        private static string GetDirectParentNamespace(Type reportType)
        {
            var fullNameSpace = reportType.Namespace;
            var indexAfterLastPeriod = fullNameSpace.LastIndexOf('.') + 1;
            return fullNameSpace.Substring(indexAfterLastPeriod, fullNameSpace.Length - indexAfterLastPeriod);
        }
    }
}

Use field for metadata to prevent reloading every time a term is read


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

using System;
using System.Linq;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites;
using osu.Game.Configuration;

namespace osu.Game.Rulesets.Mods
{
    public class ModWindDown : ModTimeRamp
    {
        public override string Name => "Wind Down";
        public override string Acronym => "WD";
        public override string Description => "Sloooow doooown...";
        public override IconUsage? Icon => FontAwesome.Solid.ChevronCircleDown;
        public override double ScoreMultiplier => 1.0;

        [SettingSource("Initial rate", "The starting speed of the track")]
        public override BindableNumber<double> InitialRate { get; } = new BindableDouble
        {
            MinValue = 1,
            MaxValue = 1.5,
            Default = 1,
            Value = 1,
            Precision = 0.01,
        };

        [SettingSource("Final rate", "The speed increase to ramp towards")]
        public override BindableNumber<double> FinalRate { get; } = new BindableDouble
        {
            MinValue = 0.5,
            MaxValue = 0.99,
            Default = 0.75,
            Value = 0.75,
            Precision = 0.01,
        };

        public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModWindUp)).ToArray();
    }
}

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

using System;
using System.Linq;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites;
using osu.Game.Configuration;

namespace osu.Game.Rulesets.Mods
{
    public class ModWindDown : ModTimeRamp
    {
        public override string Name => "Wind Down";
        public override string Acronym => "WD";
        public override string Description => "Sloooow doooown...";
        public override IconUsage? Icon => FontAwesome.Solid.ChevronCircleDown;
        public override double ScoreMultiplier => 1.0;

        [SettingSource("Initial rate", "The starting speed of the track")]
        public override BindableNumber<double> InitialRate { get; } = new BindableDouble
        {
            MinValue = 1,
            MaxValue = 2,
            Default = 1,
            Value = 1,
            Precision = 0.01,
        };

        [SettingSource("Final rate", "The speed increase to ramp towards")]
        public override BindableNumber<double> FinalRate { get; } = new BindableDouble
        {
            MinValue = 0.5,
            MaxValue = 0.99,
            Default = 0.75,
            Value = 0.75,
            Precision = 0.01,
        };

        public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModWindUp)).ToArray();
    }
}

Make wind down max value 200%

Make wind down max value 200%


using System;

public static class IntegerExtensions
{
	public static TimeSpan Days(this Int32 integer)
	{
		return TimeSpan.FromDays(integer);
	}

	public static TimeSpan Hours(this Int32 integer)
	{
		return TimeSpan.FromHours(integer);
	}

	public static TimeSpan Milliseconds(this Int32 integer)
	{
		return TimeSpan.FromMilliseconds(integer);
	}

	public static TimeSpan Minutes(this Int32 integer)
	{
		return TimeSpan.FromMinutes(integer);
	}

	public static TimeSpan Seconds(this Int32 integer)
	{
		return TimeSpan.FromSeconds(integer);
	}
}

using System;

public static class IntegerExtensions
{
	private static readonly DateTime UNIX_EPOCH = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);

	public static TimeSpan Days(this Int32 integer)
	{
		return TimeSpan.FromDays(integer);
	}

	public static TimeSpan Hours(this Int32 integer)
	{
		return TimeSpan.FromHours(integer);
	}

	public static TimeSpan Milliseconds(this Int32 integer)
	{
		return TimeSpan.FromMilliseconds(integer);
	}

	public static TimeSpan Minutes(this Int32 integer)
	{
		return TimeSpan.FromMinutes(integer);
	}

	public static TimeSpan Seconds(this Int32 integer)
	{
		return TimeSpan.FromSeconds(integer);
	}

	public static DateTime ToDateTime(this Int64 integer, Boolean useMilliseconds = false)
	{
		return useMilliseconds
			? UNIX_EPOCH.AddMilliseconds(integer)
			: UNIX_EPOCH.AddSeconds(integer);
	}
}

Allow converting integers (UNIX timestamps) to DateTime instances.


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

namespace osu.Game.Scoring
{
    public enum ScoreRank
    {
        [Description(@"F")]
        F,

        [Description(@"F")]
        D,

        [Description(@"C")]
        C,

        [Description(@"B")]
        B,

        [Description(@"A")]
        A,

        [Description(@"S")]
        S,

        [Description(@"S+")]
        SH,

        [Description(@"SS")]
        X,

        [Description(@"SS+")]
        XH,
    }
}

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

namespace osu.Game.Scoring
{
    public enum ScoreRank
    {
        [Description(@"D")]
        F,

        [Description(@"D")]
        D,

        [Description(@"C")]
        C,

        [Description(@"B")]
        B,

        [Description(@"A")]
        A,

        [Description(@"S")]
        S,

        [Description(@"S+")]
        SH,

        [Description(@"SS")]
        X,

        [Description(@"SS+")]
        XH,
    }
}

Rename F grade to D

Rename F grade to D


using System.Reflection;

[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]

using System.Reflection;

[assembly: AssemblyVersion("0.0.0.*")]
[assembly: AssemblyInformationalVersion("0.0.0.*")]

Correct version, managed by build script


using System;
using System.Text;
using NHibernate.Util;

namespace NHibernate.Sql {

	/// <summary>
	/// An SQL <c>DELETE</c> statement
	/// </summary>
	public class Delete {
		private string tableName;
		private string[] primaryKeyColumnNames;
		private string versionColumnName;
		private string where;

		public Delete SetTableName(string tableName) {
			this.tableName = tableName;
			return this;
		}

		public string ToStatementString() {
			StringBuilder buf = new StringBuilder( tableName.Length + 10 );
			buf.Append("delete from ")
				.Append(tableName)
				.Append(" where ")
				.Append( string.Join("=? and ", primaryKeyColumnNames) )
				.Append("=?");
			if (versionColumnName != null) {
				buf.Append(" and ")
					.Append(versionColumnName)
					.Append("=?");
				if(where!=null) {
					buf.Append(" and ")
						.Append(where);
				}
			}
			return buf.ToString();
		}

		public Delete SetWhere(string where) {
			this.where = where;
			return this;
		}

		public Delete SetPrimaryKeyColumnNames(string[] primaryKeyColumnNames) {
			this.primaryKeyColumnNames = primaryKeyColumnNames;
			return this;
		}

		public Delete SetVersionColumnName(string versionColumnName) {
			this.versionColumnName = versionColumnName;
			return this;
		}
	}
}

using System;
using System.Text;
using NHibernate.Util;

namespace NHibernate.Sql {

	/// <summary>
	/// An SQL <c>DELETE</c> statement
	/// </summary>
	public class Delete {
		private string tableName;
		private string[] primaryKeyColumnNames;
		private string versionColumnName;
		private string where;

		public Delete SetTableName(string tableName) {
			this.tableName = tableName;
			return this;
		}

		public string ToStatementString() {
			StringBuilder buf = new StringBuilder( tableName.Length + 10 );
			buf.Append("delete from ")
				.Append(tableName)
				.Append(" where ")
				.Append( string.Join("=? and ", primaryKeyColumnNames) )
				.Append("=?");
			if(where!=null) {
				buf.Append(" and ")
					.Append(where);
			}
			if (versionColumnName != null) {
				buf.Append(" and ")
					.Append(versionColumnName)
					.Append("=?");
			}
			return buf.ToString();
		}

		public Delete SetWhere(string where) {
			this.where = where;
			return this;
		}

		public Delete SetPrimaryKeyColumnNames(params string[] primaryKeyColumnNames) {
			this.primaryKeyColumnNames = primaryKeyColumnNames;
			return this;
		}

		public Delete SetVersionColumnName(string versionColumnName) {
			this.versionColumnName = versionColumnName;
			return this;
		}
	}
}

Fix bug in "where" if-statement

Fix bug in "where" if-statement

SVN: 488784591515bd4cdaa016be4ec9b172dc4e7caf@159


@using Newtonsoft.Json;

@{
    string dataFile = Server.MapPath("~/App_Data/data.json");
    string json = File.ReadAllText(dataFile);
    var data = (IEnumerable<dynamic>)JsonConvert.DeserializeObject(json);
}

<!DOCTYPE html>

    <meta name="viewport" content="width=device-width" />
    <title>Forum Scorer</title>

    Forum Scorer

        @foreach (var user in data.OrderByDescending(u=>u.WeekScore))
        {
            if (user.WeekScore == 0) { break; }

@user.Name: @user.WeekScore

        }

        @foreach (var user in data.OrderByDescending(u => u.PreviousWeekScore))
        {
            if (user.PreviousWeekScore == 0) { break; }

@user.Name: @user.PreviousWeekScore

        }

@using Newtonsoft.Json;

@{
    string dataFile = Server.MapPath("~/App_Data/data.json");
    string json = File.ReadAllText(dataFile);
    var data = (IEnumerable<dynamic>)JsonConvert.DeserializeObject(json);
}

<!DOCTYPE html>

    <meta name="viewport" content="width=device-width" />
    <title>Forum Scorer</title>

Forum Scorer

This week's leaderboard (the week ends on Friday)

        @foreach (var user in data.OrderByDescending(u=>u.WeekScore))
        {
            if (user.WeekScore == 0) { break; }

@user.Name: @user.WeekScore

        }

Last week's leaderboard

        @foreach (var user in data.OrderByDescending(u => u.PreviousWeekScore))
        {
            if (user.PreviousWeekScore == 0) { break; }

@user.Name: @user.PreviousWeekScore

        }

Scoring notes

    Click on a user's name to see their activity detail on MSDN. Points are give as follows:

20 points for quickly answering a question

15 points for answering a question

5 points for contributing a helpful post

1 for responding to a question (additional responses to the same question don't count)

Add links and more info

Add links and more info


@using Umbraco.Web.UI.NetCore
@using Umbraco.Extensions
@using Umbraco.Web.PublishedModels
@using Umbraco.Cms.Core.Models.PublishedContent
@using Microsoft.AspNetCore.Html
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, Smidge
@inject Smidge.SmidgeHelper SmidgeHelper

Add the same to the _viewimports file for the dotnet new template


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

namespace Dolstagis.Web.Lifecycle
{
    public class LoginHandler : ILoginHandler
    {
        public object GetLogin(IHttpContext context)
        {
            return new RedirectResult("/login", Status.SeeOther);
        }
    }
}

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

namespace Dolstagis.Web.Lifecycle
{
    public class LoginHandler : ILoginHandler
    {
        public string LoginUrl { get; set; }

        public LoginHandler()
        {
            LoginUrl = "~/login";
        }

        public object GetLogin(IHttpContext context)
        {
            return new RedirectResult(LoginUrl, Status.SeeOther);
        }
    }
}

Make the login URL configurable.

Make the login URL configurable.

--HG--
extra : amend_source : da22b9dee6b940c9b977e5732cbf5313991273b4


using hase.DevLib.Contract.FileSystemQuery;
using hase.DevLib.Service.FileSystemQuery;
using ProtoBuf;
using System;
using System.IO.Pipes;

namespace hase.DevLib.Service
{
    public class ServiceDispatcher
    {
        private static readonly string pipeName = nameof(FileSystemQueryService);
        private NamedPipeClientStream pipe = new NamedPipeClientStream(".", pipeName, PipeDirection.InOut, PipeOptions.None);

        public void Run()
        {
            Console.WriteLine($"{pipeName} connecting to relay.");
            pipe.ConnectAsync(5000).Wait();
            Console.WriteLine($"{pipeName} connected to relay.");

            while (true)
            {
                ProcessRequest();
            }

        }

        private void ProcessRequest()
        {
            //Console.WriteLine($"Waiting to receive {pipeName} request.");
            var request = Serializer.DeserializeWithLengthPrefix<FileSystemQueryRequest>(pipe, PrefixStyle.Base128);
            Console.WriteLine($"Received {pipeName} request: {request}.");

            var service = new FileSystemQueryService();
            FileSystemQueryResponse response = null;

            try
            {
                response = service.Execute(request);
            }
            catch (Exception ex) { }

            Console.WriteLine($"Sending {pipeName} response: {response}.");
            Serializer.SerializeWithLengthPrefix(pipe, response, PrefixStyle.Base128);
            //Console.WriteLine($"Sent {pipeName} response.");
        }
    }
}

using hase.DevLib.Contract.FileSystemQuery;
using hase.DevLib.Service.FileSystemQuery;
using ProtoBuf;
using System;
using System.IO.Pipes;

namespace hase.DevLib.Service
{
    public class ServiceDispatcher
    {
        private static readonly string pipeName = nameof(FileSystemQueryService);
        private NamedPipeClientStream pipe = new NamedPipeClientStream(".", pipeName, PipeDirection.InOut, PipeOptions.None);

        public void Run()
        {
            Console.WriteLine($"nprc:{pipeName} connecting to relay.");
            pipe.ConnectAsync(5000).Wait();
            Console.WriteLine($"nprc:{pipeName} connected to relay.");

            while (true)
            {
                ProcessRequest();
            }

        }

        private void ProcessRequest()
        {
            //Console.WriteLine($"nprc:Waiting to receive {pipeName} request.");
            var request = Serializer.DeserializeWithLengthPrefix<FileSystemQueryRequest>(pipe, PrefixStyle.Base128);
            Console.WriteLine($"nprc:Received {pipeName} request: {request}.");

            var service = new FileSystemQueryService();
            FileSystemQueryResponse response = null;

            try
            {
                response = service.Execute(request);
            }
            catch (Exception ex) { }

            Console.WriteLine($"nprc:Sending {pipeName} response: {response}.");
            Serializer.SerializeWithLengthPrefix(pipe, response, PrefixStyle.Base128);
            //Console.WriteLine($"nprc:Sent {pipeName} response.");
        }
    }
}

Add output abbreviation text for named pipe relay client to service dispatcher to match the service proxy.


using MacroGuards;
using MacroSemver;
using MacroSln;

namespace Verbot
{

    /// <summary>
    /// A location where the current version can be recorded
    /// </summary>
    ///
    public class VersionLocation
    {

        public VersionLocation(VisualStudioProject project)
        {
            Guard.NotNull(project, nameof(project));
            Project = project;
        }

        public VisualStudioProject Project { get; }

        /// <summary>
        /// A description of the location
        /// </summary>
        ///
        public string Description
        {
            get
            {
                return Project.Path;
            }
        }

        /// <summary>
        /// Get the version recorded at the location
        /// </summary>
        ///
        /// <returns>
        /// The version recorded at the location, or <c>null</c> if no version is recorded there
        /// </returns>
        ///
        public SemVersion GetVersion()
        {
            var versionString = Project.GetProperty("Version");
            return
                !string.IsNullOrWhiteSpace(versionString) ?
                    SemVersion.Parse(versionString) :
                    null;
        }

        /// <summary>
        /// Set the version recorded at the location
        /// </summary>
        ///
        public void SetVersion(SemVersion version)
        {
            Guard.NotNull(version, nameof(version));

            var assemblyVersion = $"{version.Major}.0.0.0";
            var assemblyFileVersion = $"{version.Major}.{version.Minor}.{version.Patch}.0";

            Project.SetProperty("Version", version.ToString());
            Project.SetProperty("AssemblyFileVersion", assemblyFileVersion);
            Project.SetProperty("AssemblyVersion", assemblyVersion);
            Project.Save();
        }

    }
}

Fix line endings in a file

Fix line endings in a file