#region Copyright (c) 2016 Atif Aziz. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion

namespace WebLinq.Text
{
    using System;
    using System.Net.Http;
    using System.Reactive.Linq;
    using System.Text;

    public static class TextQuery
    {
        public static IObservable<string> Delimited<T>(this IObservable<T> query, string delimiter) =>
            query.Aggregate(new StringBuilder(), (sb, e) => sb.Append(e), sb => sb.ToString());

        public static IObservable<HttpFetch<string>> Text(this IObservable<HttpFetch<HttpContent>> query) =>
            // TODO fix to be non-blocking
            from fetch in query select fetch.WithContent(fetch.Content.ReadAsStringAsync().Result);
    }
}

#region Copyright (c) 2016 Atif Aziz. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
#endregion

namespace WebLinq.Text
{
    using System;
    using System.Net.Http;
    using System.Reactive.Linq;
    using System.Text;

    public static class TextQuery
    {
        public static IObservable<string> Delimited<T>(this IObservable<T> query, string delimiter) =>
            query.Aggregate(new StringBuilder(), (sb, e) => sb.Append(e), sb => sb.ToString());

        public static IObservable<HttpFetch<string>> Text(this IObservable<HttpFetch<HttpContent>> query) =>
            from fetch in query
            from text in fetch.Content.ReadAsStringAsync()
            select fetch.WithContent(text);
    }
}

Fix text translations to be non-blocking


<!DOCTYPE html>

    <title>CefSharp.Own.Example.Wpf</title>

@Model.Text

Backlog

a bug

Working

a bug

Done

a bug

<!DOCTYPE html>

    <title>CefSharp.Own.Example.Wpf</title>

@Model.Text

CefSharp + OWIN + Nancy + Razor

No network requests are made, just in memory requests to the OWIN pipeline

CefSharp.Owin has no reference to OWIN, just the known Func type that it uses

This request was rendered using Nancy and the Razor view engine

TODO

Make the example html.cshtml a little more relevant


using DataDragon;
using LolHandbook.ViewModels;
using System;
using System.Collections.Generic;
using Windows.ApplicationModel.DataTransfer;
using Windows.Storage.Streams;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;

namespace LolHandbook.Pages
{
    public sealed partial class ChampionSkinsPage : Page, ISupportSharing
    {
        public ChampionSkinsPage()
        {
            this.InitializeComponent();
        }

        private ChampionSkinsViewModel ViewModel => DataContext as ChampionSkinsViewModel;

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (e.Parameter is IList<ChampionSkin>)
            {
                ViewModel.Skins = (IList<ChampionSkin>)e.Parameter;
            }
        }

        public void OnDataRequested(DataRequest request)
        {
            request.Data.Properties.Title = ViewModel.CurrentSkinName;

            DataRequestDeferral deferral = request.GetDeferral();

            try
            {
                string filename = ViewModel.CurrentSkinName + ".jpg";
                Uri uri = ViewModel.CurrentSkinUri;

                RandomAccessStreamReference streamReference = RandomAccessStreamReference.CreateFromUri(uri);

                request.Data.Properties.Thumbnail = streamReference;
                request.Data.SetBitmap(streamReference);
            }
            finally
            {
                deferral.Complete();
            }
        }

        private void Share_Click(object sender, RoutedEventArgs e)
        {
            DataTransferManager.ShowShareUI();
        }
    }
}

using DataDragon;
using LolHandbook.ViewModels;
using System;
using System.Collections.Generic;
using Windows.ApplicationModel.DataTransfer;
using Windows.Storage.Streams;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Navigation;

namespace LolHandbook.Pages
{
    public sealed partial class ChampionSkinsPage : Page, ISupportSharing
    {
        public ChampionSkinsPage()
        {
            this.InitializeComponent();
        }

        private ChampionSkinsViewModel ViewModel => DataContext as ChampionSkinsViewModel;

        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            if (e.Parameter is IList<ChampionSkin>)
            {
                ViewModel.Skins = (IList<ChampionSkin>)e.Parameter;
            }
        }

        public void OnDataRequested(DataRequest request)
        {
            request.Data.Properties.Title = ViewModel.CurrentSkinName;
            request.Data.SetUri(ViewModel.CurrentSkinUri);

            DataRequestDeferral deferral = request.GetDeferral();

            try
            {
                string filename = ViewModel.CurrentSkinName + ".jpg";
                Uri uri = ViewModel.CurrentSkinUri;

                RandomAccessStreamReference streamReference = RandomAccessStreamReference.CreateFromUri(uri);

                request.Data.Properties.Thumbnail = streamReference;
                request.Data.SetBitmap(streamReference);
            }
            finally
            {
                deferral.Complete();
            }
        }

        private void Share_Click(object sender, RoutedEventArgs e)
        {
            DataTransferManager.ShowShareUI();
        }
    }
}

Include URI in DataPackage when sharing a skin

This opens up a significant number of share targets which support URIs but not bitmaps.


using NUnit.Framework;
using System;
using System.IO;
using Time_Table_Arranging_Program;
using Time_Table_Arranging_Program.Class;

namespace NUnit.Tests2 {
    [TestFixture]
    public class Test_StartDateEndDateFinder {
        string input = Helper.RawStringOfTestFile("SampleData-FAM-2017-2ndSem.html");

        [Test]
        public void Test_1() {
            var parser = new StartDateEndDateFinder(input);
            Assert.True(parser.GetStartDate() == new DateTime(2017 , 5 , 29 , 0 , 0 , 0));
            Assert.True(parser.GetEndDate() == new DateTime(2017 , 9 , 3 , 0 , 0 , 0));
        }

    }
}

using NUnit.Framework;
using System;
using System.IO;
using Time_Table_Arranging_Program;
using Time_Table_Arranging_Program.Class;

namespace NUnit.Tests2 {
    [TestFixture]
    public class Test_StartDateEndDateFinder {
        string input = Helper.RawStringOfTestFile("SampleData-FAM-2017-2ndSem.html");

        [Test]
        public void Test_1() {
            var parser = new StartDateEndDateFinder(input);
            Assert.True(parser.GetStartDate() == new DateTime(2017 , 10 , 16 , 0 , 0 , 0));
            Assert.True(parser.GetEndDate() == new DateTime(2017 , 12 , 3 , 0 , 0 , 0));
        }

    }
}

Update test case to suit test data

Update test case to suit test data


using Bit.Core.Contracts;
using Newtonsoft.Json;

namespace Bit.Owin.Implementations
{
    public class DefaultJsonContentFormatter : IContentFormatter
    {
        private static IContentFormatter _current;

        public static IContentFormatter Current
        {
            get
            {
                if (_current == null)
                    _current = new DefaultJsonContentFormatter();

                return _current;
            }
            set => _current = value;
        }

        public virtual T DeSerialize<T>(string objAsStr)
        {
            return JsonConvert.DeserializeObject<T>(objAsStr, new JsonSerializerSettings
            {
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
                DateFormatHandling = DateFormatHandling.IsoDateFormat,
                TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple,
                TypeNameHandling = TypeNameHandling.All
            });
        }

        public virtual string Serialize<T>(T obj)
        {
            return JsonConvert.SerializeObject(obj, new JsonSerializerSettings
            {
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
                DateFormatHandling = DateFormatHandling.IsoDateFormat
            });
        }
    }
}

using Bit.Core.Contracts;
using Newtonsoft.Json;

namespace Bit.Owin.Implementations
{
    public class DefaultJsonContentFormatter : IContentFormatter
    {
        private static IContentFormatter _current;

        public static IContentFormatter Current
        {
            get
            {
                if (_current == null)
                    _current = new DefaultJsonContentFormatter();

                return _current;
            }
            set => _current = value;
        }

        public virtual T DeSerialize<T>(string objAsStr)
        {
            return JsonConvert.DeserializeObject<T>(objAsStr, new JsonSerializerSettings
            {
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
                DateFormatHandling = DateFormatHandling.IsoDateFormat,
                TypeNameAssemblyFormatHandling = TypeNameAssemblyFormatHandling.Simple,
                TypeNameHandling = TypeNameHandling.All
            });
        }

        public virtual string Serialize<T>(T obj)
        {
            return JsonConvert.SerializeObject(obj, new JsonSerializerSettings
            {
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
                DateFormatHandling = DateFormatHandling.IsoDateFormat,
                Formatting = Formatting.Indented
            });
        }
    }
}

Use indented json formatting in json content formatter


using Microsoft.ApplicationInsights.DataContracts;
using Microsoft.ApplicationInsights.Wcf.Tests.Channels;
using Microsoft.ApplicationInsights.Wcf.Tests.Service;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Linq;

namespace Microsoft.ApplicationInsights.Wcf.Tests.Integration
{
    [TestClass]
    public class OneWayTests
    {
        [TestMethod]
        [TestCategory("Integration"), TestCategory("One-Way")]
        public void SuccessfulOneWayCallGeneratesRequestEvent()
        {
            TestTelemetryChannel.Clear();
            using ( var host = new HostingContext<OneWayService, IOneWayService>() )
            {
                host.Open();
                IOneWayService client = host.GetChannel();
                client.SuccessfullOneWayCall();
            }
            var req = TestTelemetryChannel.CollectedData()
                     .FirstOrDefault(x => x is RequestTelemetry);

            Assert.IsNotNull(req);
        }

        [TestMethod]
        [TestCategory("Integration"), TestCategory("One-Way")]
        public void FailedOneWayCallGeneratesExceptionEvent()
        {
            TestTelemetryChannel.Clear();
            var host = new HostingContext<OneWayService, IOneWayService>()
                      .ExpectFailure();
            using ( host )
            {
                host.Open();
                IOneWayService client = host.GetChannel();
                try
                {
                    client.FailureOneWayCall();
                } catch
                {
                }
            }
            var req = TestTelemetryChannel.CollectedData()
                     .FirstOrDefault(x => x is ExceptionTelemetry);

            Assert.IsNotNull(req);
        }
    }
}

using Microsoft.ApplicationInsights.DataContracts;
using Microsoft.ApplicationInsights.Wcf.Tests.Channels;
using Microsoft.ApplicationInsights.Wcf.Tests.Service;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Linq;

namespace Microsoft.ApplicationInsights.Wcf.Tests.Integration
{
    [TestClass]
    public class OneWayTests
    {
        [TestMethod]
        [TestCategory("Integration"), TestCategory("One-Way")]
        public void SuccessfulOneWayCallGeneratesRequestEvent()
        {
            TestTelemetryChannel.Clear();
            using ( var host = new HostingContext<OneWayService, IOneWayService>() )
            {
                host.Open();
                IOneWayService client = host.GetChannel();
                client.SuccessfullOneWayCall();
            }
            var req = TestTelemetryChannel.CollectedData()
                     .FirstOrDefault(x => x is RequestTelemetry);

            Assert.IsNotNull(req);
        }

        [TestMethod]
        [TestCategory("Integration"), TestCategory("One-Way")]
        public void FailedOneWayCallGeneratesExceptionEvent()
        {
            TestTelemetryChannel.Clear();
            var host = new HostingContext<OneWayService, IOneWayService>()
                      .ExpectFailure().ShouldWaitForCompletion();
            using ( host )
            {
                host.Open();
                IOneWayService client = host.GetChannel();
                try
                {
                    client.FailureOneWayCall();
                } catch
                {
                }
            }
            var req = TestTelemetryChannel.CollectedData()
                     .FirstOrDefault(x => x is ExceptionTelemetry);

            Assert.IsNotNull(req);
        }
    }
}

Improve test to avoid potential race condition


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

namespace Assent.Reporters.DiffPrograms
{
    public class VsCodeDiffProgram : DiffProgramBase
    {
        static VsCodeDiffProgram()
        {
            var paths = new List<string>();
            if (DiffReporter.IsWindows)
            {
                paths.AddRange(WindowsProgramFilePaths
                    .Select(p => $@"{p}\Microsoft VS Code\Code.exe")
                    .ToArray());
            }
            else
            {
                paths.Add("/usr/local/bin/code");
                paths.Add("/usr/bin/code");
                paths.Add("/snap/bin/code");
            }
            DefaultSearchPaths = paths;
        }

        public static readonly IReadOnlyList<string> DefaultSearchPaths;

        public VsCodeDiffProgram() : base(DefaultSearchPaths)
        {
        }

        public VsCodeDiffProgram(IReadOnlyList<string> searchPaths)
            : base(searchPaths)
        {
        }

        protected override string CreateProcessStartArgs(string receivedFile, string approvedFile)
        {
            return $"--diff --wait --new-window \"{receivedFile}\" \"{approvedFile}\"";
        }
    }
}

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

namespace Assent.Reporters.DiffPrograms
{
    public class VsCodeDiffProgram : DiffProgramBase
    {
        static VsCodeDiffProgram()
        {
            var paths = new List<string>();
            if (DiffReporter.IsWindows)
            {
                paths.AddRange(WindowsProgramFilePaths
                    .Select(p => $@"{p}\Microsoft VS Code\Code.exe")
                    .ToArray());
            }
            else
            {
                paths.Add("/usr/local/bin/code");
                paths.Add("/usr/bin/code");
                paths.Add("/snap/bin/code");
                paths.Add("/Applications/Visual Studio Code.app/Contents/Resources/app/bin/code");
            }
            DefaultSearchPaths = paths;
        }

        public static readonly IReadOnlyList<string> DefaultSearchPaths;

        public VsCodeDiffProgram() : base(DefaultSearchPaths)
        {
        }

        public VsCodeDiffProgram(IReadOnlyList<string> searchPaths)
            : base(searchPaths)
        {
        }

        protected override string CreateProcessStartArgs(string receivedFile, string approvedFile)
        {
            return $"--diff --wait --new-window \"{receivedFile}\" \"{approvedFile}\"";
        }
    }
}

Add default macOS install location

Add default macOS install location


using System;
using System.Collections.Generic;
using Mono.Cecil;

public partial class ModuleWeaver
{
    Dictionary<string, TypeDefinition> definitions = new Dictionary<string, TypeDefinition>();

    public TypeDefinition Resolve(TypeReference reference)
    {
        TypeDefinition definition;
        if (definitions.TryGetValue(reference.FullName, out definition))
        {
            return definition;
        }
        return definitions[reference.FullName] = InnerResolve(reference);
    }

    static TypeDefinition InnerResolve(TypeReference reference)
    {
        try
        {
            return reference.Resolve();
        }
        catch (Exception exception)
        {
            throw new Exception($"Could not resolve '{reference.FullName}'.", exception);
        }
    }
}

using System;
using System.Collections.Generic;
using Mono.Cecil;

public partial class ModuleWeaver
{
    Dictionary<string, TypeDefinition> definitions = new Dictionary<string, TypeDefinition>();

    public TypeDefinition Resolve(TypeReference reference)
    {
        TypeDefinition definition;
        if (definitions.TryGetValue(reference.FullName, out definition))
        {
            return definition;
        }
        return definitions[reference.FullName] = InnerResolve(reference);
    }

    static TypeDefinition InnerResolve(TypeReference reference)
    {
        TypeDefinition result = null;

        try
        {
            result = reference.Resolve();
        }
        catch (Exception exception)
        {
            throw new Exception($"Could not resolve '{reference.FullName}'.", exception);
        }

        if(result == null)
        {
            throw new Exception($"Could not resolve '{reference.FullName}'.");
        }

        return result;
    }
}

Throw an exception if InnerResolve returns null


using System;
using System.ComponentModel.DataAnnotations;

namespace HelloCoreClrApp.Data.Entities
{
    public class Greeting
    {
        [Key]
        public Guid GreetingId { get; set; }

        [Required]
        [MaxLength(20)]
        public string Name { get; set; }

        [Required]
        public DateTime TimestampUtc { get; set; }
    }
}

using System;
using System.ComponentModel.DataAnnotations;

namespace HelloCoreClrApp.Data.Entities
{
    public class Greeting
    {
        [Key]
        public Guid GreetingId { get; set; }

        [Required]
        [MaxLength(30)]
        public string Name { get; set; }

        [Required]
        public DateTime TimestampUtc { get; set; }
    }
}

Increase size since we add something to the max. 20 chars coming from the request.


// Program for rotating arrays using different Algorithms

using System;
using System.Linq;

public class RotateArray
{
    public static void Main()
    {
 // Reads ints from the Console and converts them to an array of ints

        Console.WriteLine("Please enter array of integers (integers separated by spaces)");
        var intArray = Console.ReadLine()
            .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();

        // Alternative syntaxis without Linq
        //var intArray = Array.ConvertAll(Console.ReadLine()
        //    .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries), int.Parse);

    }
}

// Program for rotating arrays using different Algorithms

using System;
using System.Linq;

public class RotateArray
{
    public static void Main()
    {
        // Reads ints from the Console and converts them to an array of ints

        Console.WriteLine("Please enter array of integers (integers separated by spaces)");
        var intArray = Console.ReadLine()
            .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();

        // Alternative syntaxis without Linq
        //var intArray = Array.ConvertAll(Console.ReadLine()
        //    .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries), int.Parse);

        Console.WriteLine("Enter the number of positions to be shifted");
        int d = int.Parse(Console.ReadLine()) % intArray.Length;

        if (d != 0)
            SubsetRotation(intArray, d);

        Console.WriteLine(string.Join(" ", intArray));

    }

    public static void SubsetRotation(int[] array, int d)
    {
        int arraySubsetsNumber = EuclideanAlgorithm(array.Length, d);
        for (int i = 0; i < arraySubsetsNumber; i++)
        {
            if (arraySubsetsNumber > 1)
            {
                /////////////////////
            }
            else
            {
                d = Math.Abs(array.Length - d);
                for (int k = 0; k < array.Length; k++)
                {
                    int position = (k * d + d) % array.Length;
                    int temp = array[0];
                    array[0] = array[position];
                    array[position] = temp;
                }
            }
        }
    }

    //Euclidian algorithm to determine the greatest common divisor
    public static int EuclideanAlgorithm(int m, int n)
    {
        m = m % n;
        if (m == 0)
        {
            return n;
        }
        else
        {
            return EuclideanAlgorithm(n, m);
        }
    }
}

Work begin on program to test different algorithms for shifting arrays


using System;
using BudgetAnalyser.Engine.BankAccount;
using Rees.UserInteraction.Contracts;

namespace BudgetAnalyser.Engine.Statement
{
    public class PersistentFiltersV1 : IPersistent
    {
        public Account Account { get; set; }
        public DateTime? BeginDate { get; set; }
        public DateTime? EndDate { get; set; }
        public int LoadSequence => 50;
    }
}

using System;
using Rees.UserInteraction.Contracts;

namespace BudgetAnalyser.Engine.Statement
{
    public class PersistentFiltersV1 : IPersistent
    {
        public DateTime? BeginDate { get; set; }
        public DateTime? EndDate { get; set; }
        public int LoadSequence => 50;
    }
}

Remove Account from the filter state persistence


using System;
using LibGit2Sharp.Core.Handles;

namespace LibGit2Sharp.Core
{
    internal class ObjectSafeWrapper : IDisposable
    {
        private readonly GitObjectSafeHandle objectPtr;

        public ObjectSafeWrapper(ObjectId id, RepositorySafeHandle handle, bool allowNullObjectId = false)
        {
            Ensure.ArgumentNotNull(handle, "handle");

            if (allowNullObjectId && id == null)
            {
                objectPtr = new NullGitObjectSafeHandle();
            }
            else
            {
                Ensure.ArgumentNotNull(id, "id");
                objectPtr = Proxy.git_object_lookup(handle, id, GitObjectType.Any);
            }
        }

        public GitObjectSafeHandle ObjectPtr
        {
            get { return objectPtr; }
        }

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

        private void Dispose(bool disposing)
        {
            objectPtr.SafeDispose();
        }

        ~ObjectSafeWrapper()
        {
            Dispose(false);
        }
    }
}

using System;
using LibGit2Sharp.Core.Handles;

namespace LibGit2Sharp.Core
{
    internal class ObjectSafeWrapper : IDisposable
    {
        private readonly GitObjectSafeHandle objectPtr;

        public ObjectSafeWrapper(ObjectId id, RepositorySafeHandle handle, bool allowNullObjectId = false)
        {
            Ensure.ArgumentNotNull(handle, "handle");

            if (allowNullObjectId && id == null)
            {
                objectPtr = new NullGitObjectSafeHandle();
            }
            else
            {
                Ensure.ArgumentNotNull(id, "id");
                objectPtr = Proxy.git_object_lookup(handle, id, GitObjectType.Any);
            }
        }

        public GitObjectSafeHandle ObjectPtr
        {
            get { return objectPtr; }
        }

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

        private void Dispose(bool disposing)
        {
            objectPtr.SafeDispose();
        }
    }
}

Remove unnecessary finalizer (cleanup already guaranteed by the SafeHandle)


using Sakuno.UserInterface.ObjectOperations;
using System;
using System.Windows.Data;
using System.Windows.Markup;

namespace Sakuno.UserInterface.Commands
{
    public class InvokeMethodExtension : MarkupExtension
    {
        string r_Method;

        object r_Parameter;

        public InvokeMethodExtension(string rpMethod) : this(rpMethod, null) { }
        public InvokeMethodExtension(string rpMethod, object rpParameter)
        {
            r_Method = rpMethod;
            r_Parameter = rpParameter;
        }

        public override object ProvideValue(IServiceProvider rpServiceProvider)
        {
            var rInvokeMethod = new InvokeMethod() { Method = r_Method };

            if (r_Parameter != null)
            {
                var rParameter = new MethodParameter();

                var rBinding = r_Parameter as Binding;
                if (rBinding == null)
                    rParameter.Value = r_Parameter;
                else
                    BindingOperations.SetBinding(rParameter, MethodParameter.ValueProperty, rBinding);

                rInvokeMethod.Parameters.Add(rParameter);
            }

            return new ObjectOperationCommand() { Operations = { rInvokeMethod } };
        }
    }
}

using Sakuno.UserInterface.ObjectOperations;
using System;
using System.Windows.Data;
using System.Windows.Markup;

namespace Sakuno.UserInterface.Commands
{
    public class InvokeMethodExtension : MarkupExtension
    {
        string r_Method;

        object r_Parameter;

        public object Target { get; set; }

        public InvokeMethodExtension(string rpMethod) : this(rpMethod, null) { }
        public InvokeMethodExtension(string rpMethod, object rpParameter)
        {
            r_Method = rpMethod;
            r_Parameter = rpParameter;
        }

        public override object ProvideValue(IServiceProvider rpServiceProvider)
        {
            var rInvokeMethod = new InvokeMethod() { Method = r_Method };

            if (r_Parameter != null)
            {
                var rParameter = new MethodParameter();

                var rBinding = r_Parameter as Binding;
                if (rBinding == null)
                    rParameter.Value = r_Parameter;
                else
                    BindingOperations.SetBinding(rParameter, MethodParameter.ValueProperty, rBinding);

                rInvokeMethod.Parameters.Add(rParameter);
            }

            if (Target != null)
            {
                var rBinding = Target as Binding;
                if (rBinding != null)
                    BindingOperations.SetBinding(rInvokeMethod, InvokeMethod.TargetProperty, rBinding);
                else
                    rInvokeMethod.Target = Target;
            }

            return new ObjectOperationCommand() { Operations = { rInvokeMethod } };
        }
    }
}

Add target property for InvokeMethod markup extension


using System;
using System.Threading;
using System.Web;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Security;
using System.Web.Routing;
using WebMatrix.WebData;

using Zk.Models;

namespace Zk
{
    public class MvcApplication : HttpApplication
    {

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute ("{resource}.axd/{*pathInfo}");

            routes.MapRoute (
                "Default",
                "{controller}/{action}/{id}",
                new { controller = "Home", action = "Index", id = "" }
            );

        }

        protected void Application_Start()
        {
            if (!WebSecurity.Initialized)
            {
                WebSecurity.InitializeDatabaseConnection("ZkTestDatabaseConnection", "Users", "UserId", "Name", autoCreateTables: true);
            }

            AreaRegistration.RegisterAllAreas();

            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AuthConfig.RegisterAuth();

        }

    }

}

using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;

using WebMatrix.WebData;

namespace Zk
{
    public class MvcApplication : HttpApplication
    {

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute ("{resource}.axd/{*pathInfo}");

            routes.MapRoute (
                "Default",
                "{controller}/{action}/{id}",
                new { controller = "Home", action = "Index", id = "" }
            );

        }

        protected void Application_Start()
        {
            if (!WebSecurity.Initialized)
            {
                WebSecurity.InitializeDatabaseConnection("ZkTestDatabaseConnection", "Users", "UserId", "Name", autoCreateTables: true);
            }

            // Insecure fix for anti forgery token exception.
            // See stackoverflow.com/questions/2206595/how-do-i-solve-an-antiforgerytoken-exception-that-occurs-after-an-iisreset-in-my#20421618
            AntiForgeryConfig.SuppressIdentityHeuristicChecks = true;

            AreaRegistration.RegisterAllAreas();

            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AuthConfig.RegisterAuth();

        }

    }

}

Add possible (insecure) fix for anti forgery token error: suppress identity heuristics


using System.Collections.Generic;
using Promact.Trappist.DomainModel.Models.Question;
using System.Linq;
using Promact.Trappist.DomainModel.DbContext;

namespace Promact.Trappist.Repository.Questions
{
    public class QuestionRepository : IQuestionRespository
    {
        private readonly TrappistDbContext _dbContext;
        public QuestionRepository(TrappistDbContext dbContext)
        {
            _dbContext = dbContext;
        }

        /// <summary>
        /// Get all questions
        /// </summary>
        /// <returns>Question list</returns>
        public List<SingleMultipleAnswerQuestion> GetAllQuestions()
        {
            var question = _dbContext.SingleMultipleAnswerQuestion.ToList();
            return question;
        }
        /// <summary>
        /// Add single multiple answer question into model
        /// </summary>
        /// <param name="singleMultipleAnswerQuestion"></param>
        /// <param name="singleMultipleAnswerQuestionOption"></param>
        public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion, SingleMultipleAnswerQuestionOption[] singleMultipleAnswerQuestionOption)
        {
            _dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion);
            foreach(SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOptionElement in singleMultipleAnswerQuestionOption)
            {
                singleMultipleAnswerQuestionOptionElement.SingleMultipleAnswerQuestionID = singleMultipleAnswerQuestion.Id;
                _dbContext.SingleMultipleAnswerQuestionOption.Add(singleMultipleAnswerQuestionOptionElement);
            }
            _dbContext.SaveChanges();
        }
    }
}

using System.Collections.Generic;
using Promact.Trappist.DomainModel.Models.Question;
using System.Linq;
using Promact.Trappist.DomainModel.DbContext;

namespace Promact.Trappist.Repository.Questions
{
    public class QuestionRepository : IQuestionRespository
    {
        private readonly TrappistDbContext _dbContext;
        public QuestionRepository(TrappistDbContext dbContext)
        {
            _dbContext = dbContext;
        }

        /// <summary>
        /// Get all questions
        /// </summary>
        /// <returns>Question list</returns>
        public List<SingleMultipleAnswerQuestion> GetAllQuestions()
        {
            var question = _dbContext.SingleMultipleAnswerQuestion.ToList();
            return question;
        }
        /// <summary>
        /// Add single multiple answer question into model
        /// </summary>
        /// <param name="singleMultipleAnswerQuestion"></param>
        /// <param name="singleMultipleAnswerQuestionOption"></param>
        public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion, SingleMultipleAnswerQuestionOption[] singleMultipleAnswerQuestionOption)
        {
            _dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion);
            foreach(SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOptionElement in singleMultipleAnswerQuestionOption)
            {
                singleMultipleAnswerQuestionOptionElement.SingleMultipleAnswerQuestionID = singleMultipleAnswerQuestion.Id;
                _dbContext.SingleMultipleAnswerQuestionOption.Add(singleMultipleAnswerQuestionOptionElement);
            }
            _dbContext.SaveChanges();
        }
        /// <summary>
        /// Adding single multiple answer question into SingleMultipleAnswerQuestion model
        /// </summary>
        /// <param name="singleMultipleAnswerQuestion"></param>
        public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion)
        {
            _dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion);
            _dbContext.SaveChanges();
        }

    }
}

Create server side API for single multiple answer question


using System.Resources;
using System.Reflection;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Configgy")]
[assembly: AssemblyDescription("Configgy: Configuration library for .NET")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
[assembly: AssemblyCompany("David Love")]
[assembly: AssemblyProduct("Configgy")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]

// Version information for an assembly consists of the following four values.
// We will increase these values in the following way:
//    Major Version : Increased when there is a release that breaks a public api
//    Minor Version : Increased for each non-api-breaking release
//    Build Number : 0 for alpha versions, 1 for beta versions, 2 for release candidates, 3 for releases
//    Revision : Always 0 for release versions, always 1+ for alpha, beta, rc versions to indicate the alpha/beta/rc number
[assembly: AssemblyVersion("2.0.3.0")]
[assembly: AssemblyFileVersion("2.0.3.0")]

// This version number will roughly follow semantic versioning : http://semver.org
// The first three numbers will always match the first the numbers of the version above.
[assembly: AssemblyInformationalVersion("2.0.3.0")]

using System.Resources;
using System.Reflection;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Configgy")]
[assembly: AssemblyDescription("Configgy: Configuration library for .NET")]
#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#else
[assembly: AssemblyConfiguration("Release")]
#endif
[assembly: AssemblyCompany("David Love")]
[assembly: AssemblyProduct("Configgy")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]

// Version information for an assembly consists of the following four values.
// We will increase these values in the following way:
//    Major Version : Increased when there is a release that breaks a public api
//    Minor Version : Increased for each non-api-breaking release
//    Build Number : 0 for alpha versions, 1 for beta versions, 2 for release candidates, 3 for releases
//    Revision : Always 0 for release versions, always 1+ for alpha, beta, rc versions to indicate the alpha/beta/rc number
[assembly: AssemblyVersion("2.0.3.0")]
[assembly: AssemblyFileVersion("2.0.3.0")]

// This version number will roughly follow semantic versioning : http://semver.org
// The first three numbers will always match the first the numbers of the version above.
[assembly: AssemblyInformationalVersion("2.0.3")]

Fix version number 2.0.3.0 => 2.0.3

Fix version number 2.0.3.0 => 2.0.3


@{
    ViewBag.Title = "Purchase Order Tracker";
}

@ViewBag.Title

    @Html.ActionLink("Add New", "Create", "PurchaseOrders", null, new { @class = "btn btn-default" })

Switch to kanban by status

Switch to kanban by status


// 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.Collections.Generic;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;

namespace osu.Framework.Testing
{
    public static class TestingExtensions
    {
        /// <summary>
        /// Find all children recursively of a specific type. As this is expensive and dangerous, it should only be used for testing purposes.
        /// </summary>
        public static IEnumerable<T> ChildrenOfType<T>(this Drawable drawable) where T : Drawable
        {
            switch (drawable)
            {
                case T found:
                    yield return found;

                    break;

                case CompositeDrawable composite:
                    foreach (var child in composite.InternalChildren)
                    {
                        foreach (var found in child.ChildrenOfType<T>())
                            yield return found;
                    }

                    break;
            }
        }
    }
}

// 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.Collections.Generic;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;

namespace osu.Framework.Testing
{
    public static class TestingExtensions
    {
        /// <summary>
        /// Find all children recursively of a specific type. As this is expensive and dangerous, it should only be used for testing purposes.
        /// </summary>
        public static IEnumerable<T> ChildrenOfType<T>(this Drawable drawable) where T : Drawable
        {
            switch (drawable)
            {
                case T found:
                    yield return found;

                    if (found is CompositeDrawable foundComposite)
                    {
                        foreach (var foundChild in handleComposite(foundComposite))
                            yield return foundChild;
                    }

                    break;

                case CompositeDrawable composite:
                    foreach (var found in handleComposite(composite))
                        yield return found;

                    break;
            }

            static IEnumerable<T> handleComposite(CompositeDrawable composite)
            {
                foreach (var child in composite.InternalChildren)
                {
                    foreach (var found in child.ChildrenOfType<T>())
                        yield return found;
                }
            }
        }
    }
}

Fix ChildrenOfType<> early exit for matching types


using CefSharp.Internals;
using System.Collections.Generic;
using System.ServiceModel;

namespace CefSharp.BrowserSubprocess
{
    public class CefRenderProcess : CefSubProcess, IRenderProcess
    {
        private DuplexChannelFactory<IBrowserProcess> channelFactory;
        private CefBrowserBase browser;
        public CefBrowserBase Browser
        {
            get { return browser; }
        }

        public CefRenderProcess(IEnumerable<string> args)
            : base(args)
        {
        }

        protected override void DoDispose(bool isDisposing)
        {
            DisposeMember(ref browser);

            base.DoDispose(isDisposing);
        }

        public override void OnBrowserCreated(CefBrowserBase cefBrowserWrapper)
        {
            browser = cefBrowserWrapper;

            if (ParentProcessId == null)
            {
                return;
            }

            var serviceName = RenderprocessClientFactory.GetServiceName(ParentProcessId.Value, cefBrowserWrapper.BrowserId);

            channelFactory = new DuplexChannelFactory<IBrowserProcess>(
                this,
                new NetNamedPipeBinding(),
                new EndpointAddress(serviceName)
            );

            channelFactory.Open();

            Bind(CreateBrowserProxy().GetRegisteredJavascriptObjects());
        }

        public object EvaluateScript(int frameId, string script, double timeout)
        {
            var result = Browser.EvaluateScript(frameId, script, timeout);
            return result;
        }

        public override IBrowserProcess CreateBrowserProxy()
        {
            return channelFactory.CreateChannel();
        }
    }
}

using CefSharp.Internals;
using System.Collections.Generic;
using System.ServiceModel;

namespace CefSharp.BrowserSubprocess
{
    public class CefRenderProcess : CefSubProcess, IRenderProcess
    {
        private DuplexChannelFactory<IBrowserProcess> channelFactory;
        private CefBrowserBase browser;
        public CefBrowserBase Browser
        {
            get { return browser; }
        }

        public CefRenderProcess(IEnumerable<string> args)
            : base(args)
        {
        }

        protected override void DoDispose(bool isDisposing)
        {
            DisposeMember(ref browser);

            base.DoDispose(isDisposing);
        }

        public override void OnBrowserCreated(CefBrowserBase cefBrowserWrapper)
        {
            browser = cefBrowserWrapper;

            if (ParentProcessId == null)
            {
                return;
            }

            var serviceName = RenderprocessClientFactory.GetServiceName(ParentProcessId.Value, cefBrowserWrapper.BrowserId);

            channelFactory = new DuplexChannelFactory<IBrowserProcess>(
                this,
                new NetNamedPipeBinding(),
                new EndpointAddress(serviceName)
            );

            channelFactory.Open();

            var proxy = CreateBrowserProxy();
            var javascriptObject = proxy.GetRegisteredJavascriptObjects();

            Bind(javascriptObject);
        }

        public object EvaluateScript(int frameId, string script, double timeout)
        {
            var result = Browser.EvaluateScript(frameId, script, timeout);
            return result;
        }

        public override IBrowserProcess CreateBrowserProxy()
        {
            return channelFactory.CreateChannel();
        }
    }
}

Split code onto multiple lines for debugging purposes


@model ICollection<CountryFood.Web.ViewModels.ProductViewModel>

Products

@foreach (var product in Model)
{

            @product.Name

            Votes:  @(int.Parse(product.PositiveVotes) + int.Parse(product.NegativeVotes))

            Number of subscriptions:  @product.NumberOfSubscriptions

            By: @product.Producer

}

@model ICollection<CountryFood.Web.ViewModels.ProductViewModel>

Products

@foreach (var product in Model)
{

            @product.Name

            Votes:  @(int.Parse(product.PositiveVotes) + int.Parse(product.NegativeVotes))

            Number of subscriptions:  @product.NumberOfSubscriptions

            By: @product.Producer

            @Html.ActionLink("Subscribe", "Create", "Subscriptions", new { productId = @product.Id }, new { })

}

Put link on the product view for subscription.


using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens;
using System.Security.Claims;

namespace SnapMD.VirtualCare.LeopardonSso
{
    public abstract class AbstractJwt
    {
        protected readonly JwtSecurityTokenHandler SecurityTokenHandler = new JwtSecurityTokenHandler();

        protected abstract string Audience { get; }

        protected abstract string Issuer { get; }

        protected virtual SignatureProvider SignatureProvider => null;

        protected abstract SigningCredentials SigningCredentials { get; }

        protected virtual TokenValidationParameters TokenValidationParameters =>
            new TokenValidationParameters
            {
                ValidAudience = Audience,
                ValidIssuer = Issuer
            };

        public virtual ClaimsPrincipal Parse(string token)
        {
            SecurityToken securityToken;
            return SecurityTokenHandler.ValidateToken(token, TokenValidationParameters, out securityToken);
        }

        protected virtual string CreateToken(List<Claim> claims, bool encrypted = true)
        {
            if (claims == null)
            {
                throw new ArgumentNullException("claims");
            }

            var token = SecurityTokenHandler.CreateToken(
                subject: new ClaimsIdentity(claims),
                audience: Audience,
                issuer: Issuer,
                signingCredentials: SigningCredentials,
                signatureProvider: SignatureProvider);

            return encrypted ? SecurityTokenHandler.WriteToken(token) : token.ToString();
        }
    }
}

using System;
using System.Collections.Generic;
using System.IdentityModel.Tokens;
using System.Security.Claims;

namespace SnapMD.VirtualCare.LeopardonSso
{
    public abstract class AbstractJwt
    {
        protected readonly JwtSecurityTokenHandler SecurityTokenHandler = new JwtSecurityTokenHandler();

        protected virtual string Audience { get; }

        protected virtual string Issuer { get; }

        protected virtual SignatureProvider SignatureProvider => null;

        protected abstract SigningCredentials SigningCredentials { get; }

        protected virtual TokenValidationParameters TokenValidationParameters =>
            new TokenValidationParameters
            {
                ValidAudience = Audience,
                ValidIssuer = Issuer
            };

        public virtual ClaimsPrincipal Parse(string token)
        {
            SecurityToken securityToken;
            return SecurityTokenHandler.ValidateToken(token, TokenValidationParameters, out securityToken);
        }

        protected virtual string CreateToken(List<Claim> claims, bool encrypted = true)
        {
            if (claims == null)
            {
                throw new ArgumentNullException("claims");
            }

            var token = SecurityTokenHandler.CreateToken(
                subject: new ClaimsIdentity(claims),
                audience: Audience,
                issuer: Issuer,
                signingCredentials: SigningCredentials,
                signatureProvider: SignatureProvider);

            return encrypted ? SecurityTokenHandler.WriteToken(token) : token.ToString();
        }
    }
}

Adjust polymorphism rules for base class


using System.Diagnostics.CodeAnalysis;
using System.Text.Json.Serialization;
using DHT.Server.Database;
using DHT.Server.Endpoints;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http.Json;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

namespace DHT.Server.Service {
	public class Startup {
		public void ConfigureServices(IServiceCollection services) {
			services.Configure<JsonOptions>(options => {
				options.SerializerOptions.NumberHandling = JsonNumberHandling.Strict;
			});

			services.AddCors(cors => {
				cors.AddDefaultPolicy(builder => {
					builder.WithOrigins("https://discord.com").AllowCredentials().AllowAnyMethod().AllowAnyHeader();
				});
			});
		}

		[SuppressMessage("ReSharper", "UnusedMember.Global")]
		public void Configure(IApplicationBuilder app, IHostApplicationLifetime lifetime, IDatabaseFile db, ServerParameters parameters) {
			app.UseRouting();
			app.UseCors();
			app.UseEndpoints(endpoints => {
				TrackChannelEndpoint trackChannel = new(db, parameters);
				endpoints.MapPost("/track-channel", async context => await trackChannel.Handle(context));

				TrackUsersEndpoint trackUsers = new(db, parameters);
				endpoints.MapPost("/track-users", async context => await trackUsers.Handle(context));

				TrackMessagesEndpoint trackMessages = new(db, parameters);
				endpoints.MapPost("/track-messages", async context => await trackMessages.Handle(context));
			});
		}
	}
}

using System.Diagnostics.CodeAnalysis;
using System.Text.Json.Serialization;
using DHT.Server.Database;
using DHT.Server.Endpoints;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http.Json;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

namespace DHT.Server.Service {
	public class Startup {
		public void ConfigureServices(IServiceCollection services) {
			services.Configure<JsonOptions>(options => {
				options.SerializerOptions.NumberHandling = JsonNumberHandling.Strict;
			});

			services.AddCors(cors => {
				cors.AddDefaultPolicy(builder => {
					builder.WithOrigins("https://discord.com", "https://discordapp.com").AllowCredentials().AllowAnyMethod().AllowAnyHeader();
				});
			});
		}

		[SuppressMessage("ReSharper", "UnusedMember.Global")]
		public void Configure(IApplicationBuilder app, IHostApplicationLifetime lifetime, IDatabaseFile db, ServerParameters parameters) {
			app.UseRouting();
			app.UseCors();
			app.UseEndpoints(endpoints => {
				TrackChannelEndpoint trackChannel = new(db, parameters);
				endpoints.MapPost("/track-channel", async context => await trackChannel.Handle(context));

				TrackUsersEndpoint trackUsers = new(db, parameters);
				endpoints.MapPost("/track-users", async context => await trackUsers.Handle(context));

				TrackMessagesEndpoint trackMessages = new(db, parameters);
				endpoints.MapPost("/track-messages", async context => await trackMessages.Handle(context));
			});
		}
	}
}

Allow tracking from old Discord domain in the app (discordapp.com)


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

using osu.Framework.Configuration.Tracking;
using osu.Game.Configuration;
using osu.Game.Rulesets.Configuration;
using osu.Game.Rulesets.Mania.UI;

namespace osu.Game.Rulesets.Mania.Configuration
{
    public class ManiaConfigManager : RulesetConfigManager<ManiaSetting>
    {
        public ManiaConfigManager(SettingsStore settings, RulesetInfo ruleset, int? variant = null)
            : base(settings, ruleset, variant)
        {
        }

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

            Set(ManiaSetting.ScrollTime, 1500.0, 50.0, 10000.0, 50.0);
            Set(ManiaSetting.ScrollDirection, ManiaScrollingDirection.Up);
        }

        public override TrackedSettings CreateTrackedSettings() => new TrackedSettings
        {
            new TrackedSetting<double>(ManiaSetting.ScrollTime, v => new SettingDescription(v, "Scroll Time", $"{v}ms"))
        };
    }

    public enum ManiaSetting
    {
        ScrollTime,
        ScrollDirection
    }
}

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

using osu.Framework.Configuration.Tracking;
using osu.Game.Configuration;
using osu.Game.Rulesets.Configuration;
using osu.Game.Rulesets.Mania.UI;

namespace osu.Game.Rulesets.Mania.Configuration
{
    public class ManiaConfigManager : RulesetConfigManager<ManiaSetting>
    {
        public ManiaConfigManager(SettingsStore settings, RulesetInfo ruleset, int? variant = null)
            : base(settings, ruleset, variant)
        {
        }

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

            Set(ManiaSetting.ScrollTime, 1500.0, 50.0, 10000.0, 50.0);
            Set(ManiaSetting.ScrollDirection, ManiaScrollingDirection.Down);
        }

        public override TrackedSettings CreateTrackedSettings() => new TrackedSettings
        {
            new TrackedSetting<double>(ManiaSetting.ScrollTime, v => new SettingDescription(v, "Scroll Time", $"{v}ms"))
        };
    }

    public enum ManiaSetting
    {
        ScrollTime,
        ScrollDirection
    }
}

Make mania scroll downwards by default

Make mania scroll downwards by default


using UnityEngine;
using System.Collections;

public class CameraAspectAdjuster : MonoBehaviour
{
	public Camera mainCamera;
	public float targetAspectRatio;

	// Use this for initialization
	void Awake ()
	{
		float windowAspectRatio = (float)Screen.width / (float)Screen.height;
		float scale = windowAspectRatio / targetAspectRatio;

		// if scaled height is less than current height, add letterbox
		if (scale < 1.0f) {
			Rect rect = mainCamera.rect;

			rect.width = 1.0f;
			rect.height = scale;
			rect.x = 0;
			rect.y = (1.0f - scale) / 2.0f;

			mainCamera.rect = rect;
		} else if (scale > 1.0f) { // add pillarbox
			float scalewidth = 1.0f / scale;

			Rect rect = mainCamera.rect;

			rect.width = scalewidth;
			rect.height = 1.0f;
			rect.x = (1.0f - scalewidth) / 2.0f;
			rect.y = 0;

			mainCamera.rect = rect;
		}
	}
}

using UnityEngine;
using System.Collections;

public class CameraAspectAdjuster : MonoBehaviour
{
	public Camera mainCamera;
	public float targetAspectRatio;

	private float latestWindowAspectRatio;

	void Awake ()
	{
		latestWindowAspectRatio = targetAspectRatio;
		AdjustIfNeeded ();
	}

	void Update ()
	{
		AdjustIfNeeded ();
	}

	void AdjustIfNeeded ()
	{
		float windowAspectRatio = (float)Screen.width / (float)Screen.height;
		if (windowAspectRatio != latestWindowAspectRatio) {
			float scale = windowAspectRatio / targetAspectRatio;

			// if scaled height is less than current height, add letterbox
			if (scale < 1.0f) {
				Rect rect = mainCamera.rect;

				rect.width = 1.0f;
				rect.height = scale;
				rect.x = 0;
				rect.y = (1.0f - scale) / 2.0f;

				mainCamera.rect = rect;
			} else if (scale > 1.0f) { // add pillarbox
				float scalewidth = 1.0f / scale;

				Rect rect = mainCamera.rect;

				rect.width = scalewidth;
				rect.height = 1.0f;
				rect.x = (1.0f - scalewidth) / 2.0f;
				rect.y = 0;

				mainCamera.rect = rect;
			} else {
				Rect rect = mainCamera.rect;

				rect.width = 1.0f;
				rect.height = 1.0f;
				rect.x = 0;
				rect.y = 0;

				mainCamera.rect = rect;
			}
			latestWindowAspectRatio = windowAspectRatio;
		}
	}
}

Fix problem when setting WebGL build to fullscreen


using System.Collections.Generic;

namespace YouTrackSharp.Tests.Infrastructure
{
    public class Connections
    {
        public static string ServerUrl
            => "https://ytsharp.myjetbrains.com/youtrack/";

        public static Connection UnauthorizedConnection =>
            new BearerTokenConnection(ServerUrl, "invalidtoken");

        public static Connection Demo1Token =>
            new BearerTokenConnection(ServerUrl, "perm:ZGVtbzE=.WW91VHJhY2tTaGFycA==.AX3uf8RYk3y2bupWA1xyd9BhAHoAxc");

        public static Connection Demo2Token =>
            new BearerTokenConnection(ServerUrl, "perm:ZGVtbzI=.WW91VHJhY2tTaGFycA==.GQEOl33LyTtmJvhWuz0Q629wbo8dk0");

        public static Connection Demo3Token =>
            new BearerTokenConnection(ServerUrl, "perm:ZGVtbzM=.WW91VHJhY2tTaGFycA==.L04RdcCnjyW2UPCVg1qyb6dQflpzFy");

        public static class TestData
        {
            public static readonly List<object[]> ValidConnections
                = new List<object[]>
                {
                    new object[] { Demo1Token },
                    new object[] { Demo2Token }
                };

            public static readonly List<object[]> InvalidConnections
                = new List<object[]>
                {
                    new object[] { UnauthorizedConnection }
                };
        }
    }
}

using System.Collections.Generic;
using System.Net.Http;
using System.Security.Authentication;

namespace YouTrackSharp.Tests.Infrastructure
{
    public class Connections
    {
        public static string ServerUrl
            => "https://ytsharp.myjetbrains.com/youtrack/";

        public static Connection UnauthorizedConnection =>
            new BearerTokenConnection(ServerUrl, "invalidtoken", handler => ConfigureTestsHandler(handler));

        public static Connection Demo1Token =>
            new BearerTokenConnection(ServerUrl, "perm:ZGVtbzE=.WW91VHJhY2tTaGFycA==.AX3uf8RYk3y2bupWA1xyd9BhAHoAxc", handler => ConfigureTestsHandler(handler));

        public static Connection Demo2Token =>
            new BearerTokenConnection(ServerUrl, "perm:ZGVtbzI=.WW91VHJhY2tTaGFycA==.GQEOl33LyTtmJvhWuz0Q629wbo8dk0", handler => ConfigureTestsHandler(handler));

        public static Connection Demo3Token =>
            new BearerTokenConnection(ServerUrl, "perm:ZGVtbzM=.WW91VHJhY2tTaGFycA==.L04RdcCnjyW2UPCVg1qyb6dQflpzFy", handler => ConfigureTestsHandler(handler));

        public static class TestData
        {
            public static readonly List<object[]> ValidConnections
                = new List<object[]>
                {
                    new object[] { Demo1Token },
                    new object[] { Demo2Token }
                };

            public static readonly List<object[]> InvalidConnections
                = new List<object[]>
                {
                    new object[] { UnauthorizedConnection }
                };
        }

        private static void ConfigureTestsHandler(HttpClientHandler handler)
        {
            handler.SslProtocols = SslProtocols.Tls12;
        }
    }
}

Use TLS 1.2 for test suite

Use TLS 1.2 for test suite


using System;
using Android.Graphics.Drawables;
using System.IO;
using FFImageLoading.Work;
using Android.Content;
using Android.Content.Res;
using System.Threading.Tasks;

namespace FFImageLoading
{
	public class ApplicationBundleStreamResolver : IStreamResolver
	{

		private Context Context {
			get {
				return global::Android.App.Application.Context.ApplicationContext;
			}
		}

		public async Task<WithLoadingResult<Stream>> GetStream(string identifier)
		{
			var resourceId = Context.Resources.GetIdentifier (identifier.ToLower (), "drawable", Context.PackageName);
			Stream stream = null;
			if (resourceId != 0)
			{
				stream = Context.Resources.OpenRawResource (resourceId);
			}
			return WithLoadingResult.Encapsulate(stream, LoadingResult.ApplicationBundle);
		}

		public void Dispose() {
		}

	}
}

using System;
using Android.Graphics.Drawables;
using System.IO;
using FFImageLoading.Work;
using Android.Content;
using Android.Content.Res;
using System.Threading.Tasks;

namespace FFImageLoading
{
	public class ApplicationBundleStreamResolver : IStreamResolver
	{

		private Context Context {
			get {
				return global::Android.App.Application.Context.ApplicationContext;
			}
		}

		public async Task<WithLoadingResult<Stream>> GetStream(string identifier)
		{
			return WithLoadingResult.Encapsulate(Context.Assets.Open(identifier, Access.Streaming), LoadingResult.ApplicationBundle);
		}

		public void Dispose() {
		}

	}
}

Revert back strategy for ImageSource - ApplicationBundle


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

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

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

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("56cfcb5a-d997-4823-929c-d8bbf3027007")]

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

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

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

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

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("56cfcb5a-d997-4823-929c-d8bbf3027007")]

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

Add company name to assembly.

Silverlight: Add company name to assembly.


using System;
using Agiil.ObjectMaps;
using Autofac;

namespace Agiil.Bootstrap.ObjectMaps
{
  public class AutomapperResolversModule : Module
  {
    protected override void Load(ContainerBuilder builder)
    {
      builder.RegisterType<IdentityValueResolver>();
      builder.RegisterGeneric(typeof(GetEntityByIdentityValueResolver<>));
      builder.RegisterGeneric(typeof(GetEntityByIdentityResolver<>));
      builder.RegisterGeneric(typeof(CreateIdentityResolver<>));
    }
  }
}

using System;
using System.Collections.Generic;
using System.Linq;
using Agiil.ObjectMaps.Resolvers;
using Autofac;

namespace Agiil.Bootstrap.ObjectMaps
{
  public class AutomapperResolversModule : Module
  {
    protected override void Load(ContainerBuilder builder)
    {
      var types = GetCandidateTypes();

      foreach(var type in types)
      {
        if(type.IsGenericTypeDefinition)
        {
          builder.RegisterGeneric(type);
        }
        else
        {
          builder.RegisterType(type);
        }
      }
    }

    IEnumerable<Type> GetCandidateTypes()
    {
      var marker = typeof(IResolversNamespaceMarker);
      var searchNamespace = marker.Namespace;

      return (from type in marker.Assembly.GetExportedTypes()
              where
                type.Namespace.StartsWith(searchNamespace, StringComparison.InvariantCulture)
                && type.IsClass
                && !type.IsAbstract
                && type.IsAssignableTo<string>()
              select type);
    }
  }
}

Rework resolvers DI registration (automatic)


namespace FluentAssertions.Specs.Execution
{
    using System.Collections.Generic;
    using FluentAssertions.Execution;

    internal class IgnoringFailuresAssertionStrategy : IAssertionStrategy
    {
        public IEnumerable<string> FailureMessages => new string[0];

        public void HandleFailure(string message)
        {
        }

        public IEnumerable<string> DiscardFailures() => new string[0];

        public void ThrowIfAny(IDictionary<string, object> context)
        {
        }
    }
}

using System.Collections.Generic;
using FluentAssertions.Execution;

namespace FluentAssertions.Specs.Execution
{
    internal class IgnoringFailuresAssertionStrategy : IAssertionStrategy
    {
        public IEnumerable<string> FailureMessages => new string[0];

        public void HandleFailure(string message)
        {
        }

        public IEnumerable<string> DiscardFailures() => new string[0];

        public void ThrowIfAny(IDictionary<string, object> context)
        {
        }
    }
}

Move using directives outside of namespace

Fixes IDE0065
"Using directives must be placed outside of a namespace declaration"


using log4net;
using spectator.Configuration;
using spectator.Metrics;
using spectator.Sources;
using StatsdClient;
using Topshelf;

namespace spectator
{
    public class Program
    {
        private static readonly ILog Log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

        public static void Main(string[] args)
        {
            var configurationResolver = new ConfigurationResolver();

            Log.Info("Starting spectator topshelf host");

            HostFactory.Run(hostConfigurator =>
            {
                hostConfigurator.Service<SpectatorService>(serviceConfigurator =>
                    {
                        var configuration = configurationResolver.Resolve();
                        serviceConfigurator.ConstructUsing(() =>
                            new SpectatorService(
                                configuration,
                                new QueryableSourceFactory(),
                                new StatsdPublisher(
                                        new Statsd(
                                                new StatsdUDP(
                                                    configuration.StatsdHost,
                                                    configuration.StatsdPort
                                                )
                                        )
                                ),
                                new MetricFormatter()
                            )
                        );
                        serviceConfigurator.WhenStarted(myService => myService.Start());
                        serviceConfigurator.WhenStopped(myService => myService.Stop());
                    });

                hostConfigurator.RunAsLocalSystem();

                hostConfigurator.SetDisplayName(@"Spectator Agent");
                hostConfigurator.SetDescription(@"Monitors system metrics and sends them to a statsd-compatible server.");
                hostConfigurator.SetServiceName(@"Spectator");
            });
        }
    }
}

using log4net;
using spectator.Configuration;
using spectator.Metrics;
using spectator.Sources;
using StatsdClient;
using Topshelf;

namespace spectator
{
    public class Program
    {
        private static readonly ILog Log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

        public static void Main(string[] args)
        {
            System.IO.Directory.SetCurrentDirectory(System.AppDomain.CurrentDomain.BaseDirectory);

            var configurationResolver = new ConfigurationResolver();

            Log.Info("Starting spectator topshelf host");

            HostFactory.Run(hostConfigurator =>
            {
                hostConfigurator.Service<SpectatorService>(serviceConfigurator =>
                    {
                        var configuration = configurationResolver.Resolve();
                        serviceConfigurator.ConstructUsing(() =>
                            new SpectatorService(
                                configuration,
                                new QueryableSourceFactory(),
                                new StatsdPublisher(
                                        new Statsd(
                                                new StatsdUDP(
                                                    configuration.StatsdHost,
                                                    configuration.StatsdPort
                                                )
                                        )
                                ),
                                new MetricFormatter()
                            )
                        );
                        serviceConfigurator.WhenStarted(myService => myService.Start());
                        serviceConfigurator.WhenStopped(myService => myService.Stop());
                    });

                hostConfigurator.RunAsLocalSystem();

                hostConfigurator.SetDisplayName(@"Spectator Agent");
                hostConfigurator.SetDescription(@"Monitors system metrics and sends them to a statsd-compatible server.");
                hostConfigurator.SetServiceName(@"Spectator");
            });
        }
    }
}

Set current directory to the executable directory, since windows services execute from system32.


using AVKit;

namespace MediaManager.Platforms.Ios.Video
{
    public class PlayerViewController : AVPlayerViewController
    {
        protected MediaManagerImplementation MediaManager => CrossMediaManager.Apple;

        public override void ViewWillDisappear(bool animated)
        {
            base.ViewWillDisappear(animated);

            if (MediaManager.MediaPlayer.VideoView == View.Superview)
                MediaManager.MediaPlayer.VideoView = null;

            Player = null;
        }
    }
}

using AVKit;

namespace MediaManager.Platforms.Ios.Video
{
    public class PlayerViewController : AVPlayerViewController
    {
        protected MediaManagerImplementation MediaManager => CrossMediaManager.Apple;

        public override void ViewWillDisappear(bool animated)
        {
            base.ViewWillDisappear(animated);

            if (MediaManager.MediaPlayer.VideoView == View.Superview)
            {
                MediaManager.MediaPlayer.VideoView = null;
            }

            Player = null;
        }
    }
}

Add curly braces around the nested statement in if block


using WebSocketSharp;
using WebSocketSharp.Server;

namespace WebSocketServerTool
{
    class ServiceBehavior : WebSocketBehavior
    {
        protected override void OnMessage(MessageEventArgs e)
        {
            base.Send(e.RawData);
        }

        protected override void OnClose(CloseEventArgs e)
        {
        }
    }
}

using WebSocketSharp;
using WebSocketSharp.Server;

namespace WebSocketServerTool
{
    class ServiceBehavior : WebSocketBehavior
    {
        protected override void OnMessage(MessageEventArgs e)
        {
            if (e.IsBinary)
                base.Send(e.RawData);
            else
                base.Send(e.Data);
        }

        protected override void OnClose(CloseEventArgs e)
        {
        }
    }
}

Maintain same message type when echoing back


using Duplicati.Library.Modules.Builtin;
using Duplicati.Library.Modules.Builtin.ResultSerialization;
using NUnit.Framework;

namespace Duplicati.UnitTest
{
    [TestFixture]
    public class ResultFormatSerializerProviderTest
    {
        [Test]
        public void TestGetSerializerGivenDuplicatiReturnsDuplicatiSerializer()
        {
            IResultFormatSerializer serializer = ResultFormatSerializerProvider.GetSerializer(ResultExportFormat.Duplicati);
            Assert.AreEqual(typeof(DuplicatiFormatSerializer), serializer.GetType());
        }

        [Test]
        public void TestGetSerializerGivenJsonReturnsJsonSerializer()
        {
            IResultFormatSerializer serializer = ResultFormatSerializerProvider.GetSerializer(ResultExportFormat.Json);
            Assert.AreEqual(typeof(JsonFormatSerializer), serializer.GetType());
        }
    }
}

using Duplicati.Library.Modules.Builtin;
using Duplicati.Library.Modules.Builtin.ResultSerialization;
using NUnit.Framework;

namespace Duplicati.UnitTest
{
    [TestFixture]
    public class ResultFormatSerializerProviderTest
    {
        [Test]
        [Category("Serialization")]
        public void TestGetSerializerGivenDuplicatiReturnsDuplicatiSerializer()
        {
            IResultFormatSerializer serializer = ResultFormatSerializerProvider.GetSerializer(ResultExportFormat.Duplicati);
            Assert.AreEqual(typeof(DuplicatiFormatSerializer), serializer.GetType());
        }

        [Test]
        [Category("Serialization")]
        public void TestGetSerializerGivenJsonReturnsJsonSerializer()
        {
            IResultFormatSerializer serializer = ResultFormatSerializerProvider.GetSerializer(ResultExportFormat.Json);
            Assert.AreEqual(typeof(JsonFormatSerializer), serializer.GetType());
        }
    }
}

Add Serialization test category to aid CI configuration.


using AVKit;

namespace MediaManager.Platforms.Ios.Video
{
    public class PlayerViewController : AVPlayerViewController
    {
        public override void ViewWillDisappear(bool animated)
        {
            base.ViewWillDisappear(animated);

            Player = null;
        }
    }
}

using AVKit;

namespace MediaManager.Platforms.Ios.Video
{
    public class PlayerViewController : AVPlayerViewController
    {
        protected MediaManagerImplementation MediaManager => CrossMediaManager.Apple;

        public override void ViewWillDisappear(bool animated)
        {
            base.ViewWillDisappear(animated);

            if (MediaManager.MediaPlayer.VideoView == View.Superview)
                MediaManager.MediaPlayer.VideoView = null;

            Player = null;
        }
    }
}

Detach VideoView on disappearing (iOS)

Detach VideoView on disappearing (iOS)


#region License
// Copyright (c) Jeremy Skinner (http://www.jeremyskinner.co.uk)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// The latest version of this file can be found at http://www.codeplex.com/FluentValidation
#endregion

namespace FluentValidation.Internal {
	using System;
	using System.ComponentModel;

	/// <summary>
	/// Represents an object that is configurable.
	/// </summary>
	/// <typeparam name="TConfiguration">Type of object being configured</typeparam>
	/// <typeparam name="TNext">Return type</typeparam>
	public interface IConfigurable<TConfiguration, out TNext> {
		/// <summary>
		/// Configures the current object.
		/// </summary>
		/// <param name="configurator">Action to configure the object.</param>
		/// <returns></returns>
		[EditorBrowsable(EditorBrowsableState.Never)]
		TNext Configure(Action<TConfiguration> configurator);
	}
}

#region License
// Copyright (c) Jeremy Skinner (http://www.jeremyskinner.co.uk)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// The latest version of this file can be found at http://www.codeplex.com/FluentValidation
#endregion

namespace FluentValidation.Internal {
	using System;
	using System.ComponentModel;

	/// <summary>
	/// Represents an object that is configurable.
	/// </summary>
	/// <typeparam name="TConfiguration">Type of object being configured</typeparam>
	/// <typeparam name="TNext">Return type</typeparam>
	public interface IConfigurable<TConfiguration, out TNext> {
		/// <summary>
		/// Configures the current object.
		/// </summary>
		/// <param name="configurator">Action to configure the object.</param>
		/// <returns></returns>
		TNext Configure(Action<TConfiguration> configurator);
	}
}

Remove editorbrowsable attribute from Configure


using System;
using Microsoft;
using System.Linq;
using Microsoft.Boogie;
using System.Diagnostics;

namespace symbooglix
{
    public class driver
    {
        public static int Main(String[] args)
        {
            if (args.Length == 0) {
                Console.WriteLine ("Pass boogie file as first arg!");
                return 1;
            }

            Debug.Listeners.Add(new TextWriterTraceListener(Console.Error));
            //Microsoft.Boogie.Program p = null;
            Program p = null;

            System.Collections.Generic.List<string> defines = null;
            int success = Parser.Parse (args[0], defines, out p);

            if (success != 0)
            {
                Console.WriteLine("Failed to parse");
                return 1;
            }

            IStateScheduler scheduler = new DFSStateScheduler();
            PrintingExecutor e = new PrintingExecutor(p, scheduler);

            // FIXME: Find a better way to choose entry point.
            Microsoft.Boogie.Implementation entry = p.TopLevelDeclarations.OfType<Implementation>().FirstOrDefault();

            return e.run(entry)? 1 : 0;

        }
    }
}

using System;
using Microsoft;
using System.Linq;
using Microsoft.Boogie;
using System.Diagnostics;
using System.Collections.Generic;

namespace symbooglix
{
    public class driver
    {
        public static int Main(String[] args)
        {
            if (args.Length == 0) {
                Console.WriteLine ("Pass boogie file as first arg!");
                return 1;
            }

            Debug.Listeners.Add(new TextWriterTraceListener(Console.Error));
            Program p = null;
            var defines = new List<String> { "FILE_0" }; // WTF??
            int errors = Parser.Parse (args[0], defines, out p);

            if (errors != 0)
            {
                Console.WriteLine("Failed to parse");
                return 1;
            }

            errors = p.Resolve();

            if (errors != 0)
            {
                Console.WriteLine("Failed to resolve.");
                return 1;
            }

            errors = p.Typecheck();

            if (errors != 0)
            {
                Console.WriteLine("Failed to resolve.");
                return 1;
            }

            IStateScheduler scheduler = new DFSStateScheduler();
            PrintingExecutor e = new PrintingExecutor(p, scheduler);

            // FIXME: Find a better way to choose entry point.
            Microsoft.Boogie.Implementation entry = p.TopLevelDeclarations.OfType<Implementation>().FirstOrDefault();

            return e.run(entry)? 1 : 0;

        }
    }
}

Copy basic Boogie parser stuff from Adam's DynamicAnalysis tool. Things are still broken. The type checker throws an exception when trying to resolve()


using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Dapper.FastCrud;
using Smooth.IoC.Cqrs.Query;
using Smooth.IoC.Cqrs.Requests;

namespace Rik.Codecamp.Entities
{
    public class Brave : IRequest, IQuery
    {
        [Key, DatabaseGeneratedDefaultValue]
        public int Id { get; set; }
        [ForeignKey("New")]
        public int NewId { get; set; }
        public New New { get; set; }
        [ForeignKey("World")]
        public int WorldId { get; set; }
        public World World { get; set; }

        [NotMapped]
        public int Version { get; } = 0;
        [NotMapped]
        public Guid QueryId { get; } = Guid.NewGuid();
        [NotMapped]
        public Guid RequestId { get; } = Guid.NewGuid();
    }
}

using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Dapper.FastCrud;
using Newtonsoft.Json;
using Smooth.IoC.Cqrs.Query;
using Smooth.IoC.Cqrs.Requests;

namespace Rik.Codecamp.Entities
{
    public class Brave : IRequest, IQuery
    {
        [Key, DatabaseGeneratedDefaultValue]
        public int Id { get; set; }
        [ForeignKey("New")]
        public int NewId { get; set; }
        public New New { get; set; }
        [ForeignKey("World")]
        public int WorldId { get; set; }
        public World World { get; set; }

        [NotMapped, JsonIgnore]
        public int Version { get; } = 0;
        [NotMapped, JsonIgnore]
        public Guid QueryId { get; } = Guid.NewGuid();
        [NotMapped, JsonIgnore]
        public Guid RequestId { get; } = Guid.NewGuid();
    }
}

Add json ignor to brave

Add json ignor to brave


@{
    ViewBag.Title = "Home Page";
}

Demo Start Page

@Html.ActionLink("Download PDF","ContributorsList")

Add link to PDF Download to make it more discoverable


using System;
using System.IO;
using Microsoft.Ajax.Utilities;

namespace AjaxMinAST {
	class Program {
		static void Main(string[] args) {
			var input = File.ReadAllText("input.js");

			Console.WriteLine("--- Raw ---");
			Console.WriteLine(input);
			Console.WriteLine("\r\n");

			Console.WriteLine("--- Minified ---");
			Console.WriteLine(new Minifier().MinifyJavaScript(input));
			Console.WriteLine("\r\n");

			Console.WriteLine("--- AST ---");
			var parser = new JSParser();
			parser.CompilerError += (_, ea) => Console.WriteLine(ea.Error);

			var functions = parser.Parse(input);
			var functionContext = parser.Parse("var functionContext = {};");

			new ObjectLiteralVisitor(functions).Visit(functionContext);

			OutputVisitor.Apply(Console.Out, functionContext, new CodeSettings() { MinifyCode = false, OutputMode = OutputMode.MultipleLines });
		}
	}

	class ObjectLiteralVisitor : TreeVisitor {
		Block functions;

		public ObjectLiteralVisitor(Block functions) {
			this.functions = functions;
		}

		public override void Visit(ObjectLiteral node) {
			base.Visit(node);
			foreach(var function in this.functions.Children) {
				node.Properties.Insert(node.Properties.Count, new ObjectLiteralProperty(node.Context) {
					Name = new ObjectLiteralField("Name", PrimitiveType.String, node.Context),
					Value = function
				});
			}
		}
	}
}

using System;
using System.IO;
using Microsoft.Ajax.Utilities;

namespace AjaxMinAST {
	class Program {
		static void Main(string[] args) {
			var input = File.ReadAllText("input.js");

			Console.WriteLine("--- Raw ---");
			Console.WriteLine(input);
			Console.WriteLine("\r\n");

			Console.WriteLine("--- Minified ---");
			Console.WriteLine(new Minifier().MinifyJavaScript(input));
			Console.WriteLine("\r\n");

			Console.WriteLine("--- AST ---");
			var parser = new JSParser();
			parser.CompilerError += (_, ea) => Console.WriteLine(ea.Error);

			var functions = parser.Parse(input);
			var functionContext = parser.Parse("var functionContext = {};");

			new ObjectLiteralVisitor(functions).Visit(functionContext);

			OutputVisitor.Apply(Console.Out, functionContext, new CodeSettings() { MinifyCode = false, OutputMode = OutputMode.MultipleLines });
		}
	}

	class ObjectLiteralVisitor : TreeVisitor {
		Block functions;

		public ObjectLiteralVisitor(Block functions) {
			this.functions = functions;
		}

		public override void Visit(ObjectLiteral node) {
			base.Visit(node);
			foreach(var function in this.functions.Children) {
				node.Properties.Insert(node.Properties.Count, new ObjectLiteralProperty(node.Context) {
					Name = new ObjectLiteralField((function as FunctionObject).Binding.Name, PrimitiveType.String, node.Context),
					Value = function
				});
			}
		}
	}
}

Set the function's name in the object literal.


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

[assembly: WebActivatorEx.PostApplicationStartMethod(typeof(IronBank.App_Start.RouteConfig), "RegisterRoutes")]

namespace IronBank.App_Start
{
    public class RouteConfig
    {
        public static void RegisterRoutes()
        {
            RouteTable.Routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            RouteTable.Routes.MapRoute(
                name: "DefaultWeb",
                url: "{controller}/{action}/{id}",
                defaults: new { id = UrlParameter.Optional }
            );
        }
    }
}

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

[assembly: WebActivatorEx.PostApplicationStartMethod(typeof(IronBank.App_Start.RouteConfig), "RegisterRoutes")]

namespace IronBank.App_Start
{
    public class RouteConfig
    {
        public static void RegisterRoutes()
        {
            RouteTable.Routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            RouteTable.Routes.MapRoute(
                name: "DefaultWebIndex",
                url: "",
                defaults: new { controller = "Home", action = "Index" }
            );

            RouteTable.Routes.MapRoute(
                name: "DefaultWeb",
                url: "{controller}/{action}/{id}",
                defaults: new { id = UrlParameter.Optional }
            );
        }
    }
}

Set the default route of the site to be /Home/Index


@using Orchard.ContentManagement;
@using Orchard.Core.Common.Models;
@using Orchard.Security;
@{
    CommonPart commonPart = Model.ContentPart;
    DateTime? modifiedUtc = commonPart.As<CommonPart>() == null ? null : commonPart.As<CommonPart>().ModifiedUtc;
    // owner isn't really who last modified this, is it?
    IUser owner = commonPart.As<CommonPart>() == null ? null : commonPart.As<CommonPart>().Owner;
}

@if (modifiedUtc.HasValue) {
        @T("Last modified: {0}", Display.DateTimeRelative(dateTimeUtc: modifiedUtc.Value))} |

@T("By {0}", owner.UserName)

@using Orchard.ContentManagement;
@using Orchard.Core.Common.Models;
@using Orchard.Security;
@{
    CommonPart commonPart = Model.ContentPart;
    DateTime? modifiedUtc = commonPart.As<CommonPart>() == null ? null : commonPart.As<CommonPart>().ModifiedUtc;
    // owner isn't really who last modified this, is it?
    IUser owner = commonPart.As<CommonPart>() == null ? null : commonPart.As<CommonPart>().Owner;
}

@if (modifiedUtc.HasValue) {
        @T("Last modified: {0}", Display.DateTimeRelative(dateTimeUtc: modifiedUtc.Value))} |

@T("By {0}", owner == null ? "<null>" : owner.UserName)

Make UI resilient to delete user

Make UI resilient to delete user

Work Item: 17101

--HG--
branch : 1.x


//
//  ReadRegisters.cs
//
//  Author:
//       Benito Palacios Sánchez <benito356@gmail.com>
//
//  Copyright (c) 2015 Benito Palacios Sánchez
//
//  This program is free software: you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
using System;

namespace NitroDebugger.RSP.Packets
{
	public class ReadRegisters : CommandPacket
	{
		public ReadRegisters()
			: base('g')
		{
		}

		protected override string PackArguments()
		{
			return "";
		}
	}
}

//
//  ReadRegisters.cs
//
//  Author:
//       Benito Palacios Sánchez <benito356@gmail.com>
//
//  Copyright (c) 2015 Benito Palacios Sánchez
//
//  This program is free software: you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program.  If not, see <http://www.gnu.org/licenses/>.
using System;

namespace NitroDebugger.RSP.Packets
{
	public class ReadRegisters : CommandPacket
	{
		public ReadRegisters()
			: base("g")
		{
		}

		protected override string PackArguments()
		{
			return "";
		}
	}
}

Fix typo that don't compile.

Fix typo that don't compile.

Why chars are not implicit casted to string?


using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;
using NServiceBus;
using SFA.DAS.EmployerFinance.Messages.Commands;

namespace SFA.DAS.EmployerFinance.Jobs.ScheduledJobs
{
    public class ImportLevyDeclarationsJob
    {
        private readonly IMessageSession _messageSession;

        public ImportLevyDeclarationsJob(IMessageSession messageSession)
        {
            _messageSession = messageSession;
        }

        public Task Run([TimerTrigger("0 0 10 24 * *")] TimerInfo timer, ILogger logger)
        {
            return _messageSession.Send(new ImportLevyDeclarationsCommand());
        }
    }
}

using System.Threading.Tasks;
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;
using NServiceBus;
using SFA.DAS.EmployerFinance.Messages.Commands;

namespace SFA.DAS.EmployerFinance.Jobs.ScheduledJobs
{
    public class ImportLevyDeclarationsJob
    {
        private readonly IMessageSession _messageSession;

        public ImportLevyDeclarationsJob(IMessageSession messageSession)
        {
            _messageSession = messageSession;
        }

        public Task Run([TimerTrigger("0 0 15 20 * *")] TimerInfo timer, ILogger logger)
        {
            return _messageSession.Send(new ImportLevyDeclarationsCommand());
        }
    }
}

Revert "Change levy run date to 24th"

Revert "Change levy run date to 24th"

This reverts commit f785dbf2b5649adcbc0431b2d9b04f31a8958a05.


using UnityEngine;

public class NoteObject : MonoBehaviour
{
    public NotePosition notePosition;
    public int noteType;
    NotesEditorModel model;
    RectTransform rectTransform;

    void Awake()
    {
        model = NotesEditorModel.Instance;
        rectTransform = GetComponent<RectTransform>();
        rectTransform.localPosition = CalcPosition(notePosition);
    }

    void LateUpdate()
    {
        rectTransform.localPosition = CalcPosition(notePosition);
    }

    Vector3 CalcPosition(NotePosition notePosition)
    {
        return new Vector3(
            model.SamplesToScreenPositionX(notePosition.samples),
            model.BlockNumToScreenPositionY(notePosition.blockNum) * model.CanvasScaleFactor.Value,
            0);
    }

    public void OnMouseEnter()
    {
        model.IsMouseOverCanvas.Value = true;
    }

    public void OnMouseDown()
    {
        model.NormalNoteObservable.OnNext(notePosition);
    }
}

using UnityEngine;

public class NoteObject : MonoBehaviour
{
    public NotePosition notePosition;
    public int noteType;
    NotesEditorModel model;
    RectTransform rectTransform;

    void Awake()
    {
        model = NotesEditorModel.Instance;
        rectTransform = GetComponent<RectTransform>();
        rectTransform.localPosition = CalcPosition(notePosition);
    }

    void LateUpdate()
    {
        rectTransform.localPosition = CalcPosition(notePosition);
    }

    Vector3 CalcPosition(NotePosition notePosition)
    {
        return new Vector3(
            model.SamplesToScreenPositionX(notePosition.samples),
            model.BlockNumToScreenPositionY(notePosition.blockNum) * model.CanvasScaleFactor.Value,
            0);
    }

    public void OnMouseEnter()
    {
        model.IsMouseOverCanvas.Value = true;
    }

    public void OnMouseDown()
    {
        if (model.ClosestNotePosition.Value.Equals(notePosition))
        {
            model.NormalNoteObservable.OnNext(notePosition);
        }
    }
}

Add notes editing only when over auxiliary line


using System;
using System.Collections.Generic;
using Microsoft.Extensions.DiagnosticAdapter.Internal;

namespace Glimpse.Agent.Internal.Inspectors.Mvc.Proxies
{
    public class ProxyAdapter
    {
        private static readonly ProxyTypeCache _cache = new ProxyTypeCache();

        public ProxyAdapter()
        {
            Listener = new Dictionary<string, Subscription>();
        }

        private IDictionary<string, Subscription> Listener { get; }

        public void Register(string typeName)
        {
            var subscription = new Subscription();

            Listener.Add(typeName, subscription);
        }

        public T Process<T>(string typeName, object target)
        {
            Subscription subscription;
            if (!Listener.TryGetValue(typeName, out subscription))
            {
                return default(T);
            }

            if (subscription.ProxiedType == null)
            {
                var proxiedType = ProxyTypeEmitter.GetProxyType(_cache, typeof(T), target.GetType());

                subscription.ProxiedType = proxiedType;
            }

            var instance = (T)Activator.CreateInstance(subscription.ProxiedType, target);

            return instance;
        }

        private class Subscription
        {
            public Type ProxiedType { get; set; }
        }
    }
}

using System;
using System.Collections.Generic;
using Microsoft.Extensions.DiagnosticAdapter.Internal;

namespace Glimpse.Agent.Internal.Inspectors.Mvc.Proxies
{
    public class ProxyAdapter
    {
        private static readonly ProxyTypeCache _cache = new ProxyTypeCache();

        public ProxyAdapter()
        {
            Listener = new Dictionary<string, Subscription>();
        }

        private IDictionary<string, Subscription> Listener { get; }

        public void Register(string typeName)
        {
            var subscription = new Subscription();

            Listener.Add(typeName, subscription);
        }

        public T Process<T>(string typeName, object target)
        {
            Subscription subscription;
            if (!Listener.TryGetValue(typeName, out subscription))
            {
                return default(T);
            }

            if (subscription.ProxiedType == null)
            {
                lock (subscription)
                {
                    if (subscription.ProxiedType == null)
                    {
                        var proxiedType = ProxyTypeEmitter.GetProxyType(_cache, typeof(T), target.GetType());

                        subscription.ProxiedType = proxiedType;
                    }
                }
            }

            var instance = (T)Activator.CreateInstance(subscription.ProxiedType, target);

            return instance;
        }

        private class Subscription
        {
            public Type ProxiedType { get; set; }
        }
    }
}

Fix for duplicate type in assembly error


//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.34003
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

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

[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.1.0.0")]
[assembly: AssemblyConfiguration("Release built on 2013-10-23 22:48")]
[assembly: AssemblyCopyright("Copyright © 2013 Autofac Contributors")]
[assembly: AssemblyDescription("Autofac.Extras.Attributed 3.1.0")]

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.18051
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

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

[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.1.0.0")]
[assembly: AssemblyConfiguration("Release built on 2013-12-03 10:23")]
[assembly: AssemblyCopyright("Copyright © 2013 Autofac Contributors")]
[assembly: AssemblyDescription("Autofac.Extras.Attributed 3.1.0")]

Split WCF functionality out of Autofac.Extras.Multitenant into a separate assembly/package, Autofac.Extras.Multitenant.Wcf. Both packages are versioned 3.1.0.