using System.Threading.Tasks;
using ContosoMoments.Models;
using Xamarin.Forms;
using System;

namespace ContosoMoments
{
    public class ResizeRequest
    {
        public string Id { get; set; }
        public string BlobName { get; set; }
    }

    public class ActivityIndicatorScope : IDisposable
    {
        private bool showIndicator;
        private ActivityIndicator indicator;

        public ActivityIndicatorScope(ActivityIndicator indicator, bool showIndicator)
        {
            this.indicator = indicator;
            this.showIndicator = showIndicator;

            SetIndicatorActivity(showIndicator);
        }

        private void SetIndicatorActivity(bool isActive)
        {
            this.indicator.IsVisible = isActive;
            this.indicator.IsRunning = isActive;
        }

        public void Dispose()
        {
            SetIndicatorActivity(false);
        }
    }

    public static class Utils
    {
        public static bool IsOnline()
        {
            var networkConnection = DependencyService.Get<INetworkConnection>();
            networkConnection.CheckNetworkConnection();
            return networkConnection.IsConnected;
        }

        public static async Task<bool> SiteIsOnline()
        {
            bool retVal = true;

            try {
                var res = await App.MobileService.InvokeApiAsync<string>("Getway", System.Net.Http.HttpMethod.Get, null);

                if (res == null && res.Length == 0) {
                    retVal = false;
                }
            }
            catch //(Exception ex)
            {
                retVal = false;
            }

            return retVal;
        }
    }
}

using System.Threading.Tasks;
using ContosoMoments.Models;
using Xamarin.Forms;
using System;

namespace ContosoMoments
{
    public class ResizeRequest
    {
        public string Id { get; set; }
        public string BlobName { get; set; }
    }

    public class ActivityIndicatorScope : IDisposable
    {
        private bool showIndicator;
        private ActivityIndicator indicator;

        public ActivityIndicatorScope(ActivityIndicator indicator, bool showIndicator)
        {
            this.indicator = indicator;
            this.showIndicator = showIndicator;

            SetIndicatorActivity(showIndicator);
        }

        private void SetIndicatorActivity(bool isActive)
        {
            this.indicator.IsVisible = isActive;
            this.indicator.IsRunning = isActive;
        }

        public void Dispose()
        {
            SetIndicatorActivity(false);
        }
    }

    public static class Utils
    {
        public static bool IsOnline()
        {
            var networkConnection = DependencyService.Get<INetworkConnection>();
            networkConnection.CheckNetworkConnection();
            return networkConnection.IsConnected;
        }

        public static async Task<bool> SiteIsOnline()
        {
            bool retVal = true;

            try {
                var res = await App.MobileService.InvokeApiAsync<string>("Defaults", System.Net.Http.HttpMethod.Get, null);

                if (res == null) {
                    retVal = false;
                }
            }
            catch (Exception)
            {
                retVal = false;
            }

            return retVal;
        }
    }
}

Change mobile client to use DefaultsController instead of GetwayController


using Code.Records;

namespace Code.Custom
{
    /// <summary>
    ///     Record Updater that will calculate the log of the source field.
    /// </summary>
    /// <example>
    ///     // handle the record changed event
    ///     new Code.Custom.LogFieldRecordUpdater("Source Field", "Log Field").HandleRecordChanged(eventItem, eventArgs);
    /// </example>
    public class LogFieldRecordUpdater : RecordUpdater
    {
        private readonly string logResultField;
        private readonly string sourceField;

        public LogFieldRecordUpdater(string sourceField, string logResultField)
        {
            this.sourceField = sourceField;
            this.logResultField = logResultField;
        }
        protected override void OnUpdateNewRecord(IRecord record)
        {
        }

        /// <summary>
        /// Called when the record is to be updated
        /// </summary>
        /// <param name="record">The record.</param>
        protected override void OnUpdateRecord(IRecord record)
        {
            double source = record.GetFieldValue<double>(sourceField, 0);
            if (source > 0)
            {
                double log = System.Math.Log10(source);
                record.SetFieldValue<double>(logResultField, log);
            }
            else
            {
                TraceError("{0} - Unable to calculate ['{1}'] = Math.Log10({2})  ({2} = {3})", this, logResultField, sourceField, source);
            }
        }
    }
}

Add example to get the Log of a source field.


using System;

namespace Algorithms.Strings.Search
{
    public class BoyerMoore
    {
        private int[] right;
        private const int R = 256;
        private int M;
        private string pat;
        public BoyerMoore(string pat)
        {
            this.pat = pat;
            right = new int[R];
            for (int i = 0; i < pat.Length; ++i)
            {
                right[pat[i]] = i;
            }
            M = pat.Length;
        }

        public int Search(string text)
        {
            int skip = 1;
            for (int i = 0; i < text.Length - M; i+=skip)
            {
                var j;
                for (j = M - 1; j >= 0; j--)
                {
                    if (text[i + j] != pat[j])
                    {
                        skip = Math.Max(1, j - right[text[i + j]]);
                        break;
                    }
                }
                if (j == -1) return i;
            }
            return -1;
        }

    }
}

Implement unit test for boyer moore

Implement unit test for boyer moore


using System;
using JSIL;

public static class Program {
    public static void Main (string[] args) {
        var print = Builtins.Global["pr" + "int"];
        if (print != null)
            print("printed");

        if (Builtins.Local["print"] != null)
            Builtins.Local["print"]("printed again");

        var quit = Builtins.Global["quit"];
        if (quit != null)
            quit();

        Console.WriteLine("test");
    }
}

using System;
using JSIL;

public static class Program {
    public static void Main (string[] args) {
        const string pri = "pri";
        string nt = "nt";

        var p = Builtins.Global[pri + nt];
        if (p != null)
            p("printed");

        if (Builtins.Local["p"] != null)
            Builtins.Local["p"]("printed again");

        var q = Builtins.Global["quit"];
        if (q != null)
            q();

        Console.WriteLine("test");
    }
}

Make the BuiltinThis test clearer

Make the BuiltinThis test clearer


/*
 * Copyright (c) Contributors, http://aurora-sim.org/
 * See CONTRIBUTORS.TXT for a full list of copyright holders.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of the Aurora-Sim Project nor the
 *       names of its contributors may be used to endorse or promote products
 *       derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

using System;
using System.Collections.Generic;
using C5;
using Aurora.Framework;

namespace Aurora.DataManager.Migration.Migrators
{
    public class GenericsMigrator_4 : Migrator
    {
        public GenericsMigrator_4()
        {
            Version = new Version(0, 0, 4);
            MigrationName = "Generics";

            schema = new List<Rec<string, ColumnDefinition[]>>();

            AddSchema("generics", ColDefs(
                ColDef ("OwnerID", ColumnTypes.String36, true),
                ColDef ("Type", ColumnTypes.String64, true),
                ColDef("Key", ColumnTypes.String64, true),
                ColDef ("Value", ColumnTypes.LongText)
                ));
        }

        protected override void DoCreateDefaults(IDataConnector genericData)
        {
            EnsureAllTablesInSchemaExist(genericData);
        }

        protected override bool DoValidate(IDataConnector genericData)
        {
            return TestThatAllTablesValidate(genericData);
        }

        protected override void DoMigrate(IDataConnector genericData)
        {
            DoCreateDefaults(genericData);
        }

        protected override void DoPrepareRestorePoint(IDataConnector genericData)
        {
            CopyAllTablesToTempVersions(genericData);
        }
    }
}

Reduce the size of the keys in the generics migrator. This finally fixes the long standing issue of it failing to create the table on linux sometimes. Thanks go to Hippo_Finesmith for helping find the issue with this :).


using System;
using System.Management.Automation;

namespace OPNsense.Ftpproxy {
	public class Proxy {
		#region Parameters
		public uint debuglevel { get; set; }
		public string description { get; set; }
		public bool enabled { get; set; }
		public uint idletimeout { get; set; }
		public string listenaddress { get; set; }
		public uint listenport { get; set; }
		public bool logconnections { get; set; }
		public uint maxsessions { get; set; }
		public string reverseaddress { get; set; }
		public uint reverseport { get; set; }
		public bool rewritesourceport { get; set; }
		public string sourceaddress { get; set; }
		#endregion Parameters

		public Proxy () {
			debuglevel = 5;
			description = null;
			enabled = true;
			idletimeout = 86400;
			listenaddress = "127.0.0.1";
			listenport = 8021;
			logconnections = true;
			maxsessions = 100;
			reverseaddress = null;
			reverseport = 21;
			rewritesourceport = true;
			sourceaddress = null;
		}

		public Proxy (
			uint Debuglevel,
			string Description,
			byte Enabled,
			uint Idletimeout,
			string Listenaddress,
			uint Listenport,
			byte Logconnections,
			uint Maxsessions,
			string Reverseaddress,
			uint Reverseport,
			byte Rewritesourceport,
			string Sourceaddress
		) {
			debuglevel = Debuglevel;
			description = Description;
			enabled = (Enabled == 0) ? false : true;
			idletimeout = Idletimeout;
			listenaddress = Listenaddress;
			listenport = Listenport;
			logconnections = (Logconnections == 0) ? false : true;
			maxsessions = Maxsessions;
			reverseaddress = Reverseaddress;
			reverseport = Reverseport;
			rewritesourceport = (Rewritesourceport == 0) ? false : true;
			sourceaddress = Sourceaddress;
		}
	}
}

Add datatypes for OPNsense Objects

Add datatypes for OPNsense Objects


namespace AppliedAlgebra.WaveletCodesTools.Tests
{
    using CodesResearchTools.NoiseGenerator;
    using Decoding.ListDecoderForFixedDistanceCodes;
    using Decoding.StandartDecoderForFixedDistanceCodes;
    using FixedDistanceCodesFactory;
    using GeneratingPolynomialsBuilder;
    using GfAlgorithms.CombinationsCountCalculator;
    using GfAlgorithms.ComplementaryFilterBuilder;
    using GfAlgorithms.LinearSystemSolver;
    using GfAlgorithms.PolynomialsGcdFinder;
    using GfPolynoms;
    using GfPolynoms.GaloisFields;
    using RsCodesTools.Decoding.ListDecoder;
    using RsCodesTools.Decoding.ListDecoder.GsDecoderDependencies.InterpolationPolynomialBuilder;
    using RsCodesTools.Decoding.ListDecoder.GsDecoderDependencies.InterpolationPolynomialFactorisator;
    using RsCodesTools.Decoding.StandartDecoder;
    using Xunit;

    public class StandardCodesFactoryTests
    {
        private static readonly StandardCodesFactory CodesFactory;

        static StandardCodesFactoryTests()
        {
            var gaussSolver = new GaussSolver();
            CodesFactory
                = new StandardCodesFactory(
                    new LiftingSchemeBasedBuilder(new GcdBasedBuilder(new RecursiveGcdFinder()), gaussSolver),
                    new RsBasedDecoder(new BerlekampWelchDecoder(gaussSolver), gaussSolver),
                    new GsBasedDecoder(
                        new GsDecoder(new KotterAlgorithmBasedBuilder(new PascalsTriangleBasedCalcualtor()), new RrFactorizator()),
                        gaussSolver
                    )
                );
        }

        [Fact]
        public void ShouldCreateCodeFromGeneratingPolynomial()
        {
            // Given
            var generationPolynomial = new Polynomial(
                new PrimePowerOrderField(8, new Polynomial(new PrimeOrderField(2), 1, 1, 0, 1)),
                0, 0, 2, 5, 6, 0, 1
            );

            // When
            var code = CodesFactory.Create(generationPolynomial);

            // Then
            Assert.Equal(7, code.CodewordLength);
            Assert.Equal(3, code.InformationWordLength);
            Assert.Equal(4, code.CodeDistance);
        }
    }
}

Test for code creation from generating polynomial was added


using System;
using LazyStorage.Interfaces;

namespace LazyStorage.Xml
{
    internal class StorableConverter<T> : IConverter<T> where T : IStorable<T>, IEquatable<T>, new()
    {
        public StorableObject GetStorableObject(T item)
        {
            return new StorableObject(item.GetStorageInfo());
        }

        public T GetOriginalObject(StorableObject info)
        {
            var item = new T();
            item.InitialiseWithStorageInfo(info.Info);
            return item;
        }

        public bool IsEqual(StorableObject storageObject, T realObject)
        {
            return GetOriginalObject(storageObject).Equals(realObject);
        }
    }
}

Add converter for old storable objects

Add converter for old storable objects


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

using System;
using BenchmarkDotNet.Attributes;
using osu.Framework.Logging;
using osu.Framework.Testing;

namespace osu.Framework.Benchmarks
{
    [MemoryDiagnoser]
    public class BenchmarkLogger
    {
        private const int line_count = 10000;

        [GlobalSetup]
        public void GlobalSetup()
        {
            Logger.Storage = new TemporaryNativeStorage(Guid.NewGuid().ToString());
        }

        [Benchmark]
        public void LogManyLinesDebug()
        {
            for (int i = 0; i < line_count; i++)
            {
                Logger.Log("This is a test log line.", level: LogLevel.Debug);
            }

            Logger.Flush();
        }

        [Benchmark]
        public void LogManyMultiLineLines()
        {
            for (int i = 0; i < line_count; i++)
            {
                Logger.Log("This\nis\na\ntest\nlog\nline.");
            }

            Logger.Flush();
        }

        [Benchmark]
        public void LogManyLines()
        {
            for (int i = 0; i < line_count; i++)
            {
                Logger.Log("This is a test log line.");
            }

            Logger.Flush();
        }
    }
}

Add benchmark coverage of logger

Add benchmark coverage of logger


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

using System.Reflection;

[assembly: AssemblyMetadata("Serviceable", "True")]

Add serviceable attribute to projects.

Add serviceable attribute to projects.

aspnet/DNX#1600


@using System.Threading.Tasks
@using CompetitionPlatform.Helpers
@model CompetitionPlatform.Models.ProjectViewModels.ProjectCommentPartialViewModel

<form asp-controller="ProjectDetails" asp-action="AddComment" enctype="multipart/form-data">
    @if (ClaimsHelper.GetUser(User.Identity).Email != null)
    {
        <div class="form-group">
            @Html.Hidden("projectId", Model.ProjectId)
            @Html.Hidden("ParentId", Model.ParentId)
            <input asp-for="@Model.ProjectId" type="hidden" />
            <textarea asp-for="@Model.Comment" rows="5" class="form-control" placeholder="Enter your comment here..."></textarea>
        </div>
        <input type="submit" value="Post Comment" class="btn btn-primary pull-right" />
    }
</form>

Add a partial view with form to reply to comments.


using Cassette;
using Cassette.Scripts;
using Cassette.Stylesheets;

namespace Exceptional.Web
{
    /// <summary>
    /// Configures the Cassette asset bundles for the web application.
    /// </summary>
    public class CassetteBundleConfiguration : IConfiguration<BundleCollection>
    {
        public void Configure(BundleCollection bundles)
        {
            // TODO: Configure your bundles here...
            // Please read http://getcassette.net/documentation/configuration

            // This default configuration treats each file as a separate 'bundle'.
            // In production the content will be minified, but the files are not combined.
            // So you probably want to tweak these defaults!
            bundles.AddPerIndividualFile<StylesheetBundle>("Content");
            bundles.AddPerIndividualFile<ScriptBundle>("Scripts");

            // To combine files, try something like this instead:
            //   bundles.Add<StylesheetBundle>("Content");
            // In production mode, all of ~/Content will be combined into a single bundle.

            // If you want a bundle per folder, try this:
            //   bundles.AddPerSubDirectory<ScriptBundle>("Scripts");
            // Each immediate sub-directory of ~/Scripts will be combined into its own bundle.
            // This is useful when there are lots of scripts for different areas of the website.
        }
    }
}

Drop cassette config in for less integration


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

namespace ILCompiler
{
    /// <summary>
    /// Used to mark TypeDesc types that are not part of the core type system
    /// that should never be turned into an EEType.
    /// </summary>
    public interface INonEmittableType
    { }
}

Add file missed in build

Add file missed in build

[tfs-changeset: 1649988]


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

using System.Resources;

[assembly:NeutralResourcesLanguage("en")]

Add NeutralResourcesLanguageAttribute to Channels lib


#region Copyright

/* * * * * * * * * * * * * * * * * * * * * * * * * */
/* Carl Zeiss IMT (IZfM Dresden)                   */
/* Softwaresystem PiWeb                            */
/* (c) Carl Zeiss 2020                             */
/* * * * * * * * * * * * * * * * * * * * * * * * * */

#endregion

namespace Zeiss.IMT.PiWeb.Api.Common.Utilities
{
    using System;
    using System.Security.Cryptography;
    using System.Text;
    using IdentityModel;

    /// <remarks>
    /// The following code is originated from an earlier version of the IdentityModel nuget package.
    /// </remarks>
    internal static class ProtocolHelperExtensions
    {
        private enum HashStringEncoding
        {
            Base64,
            Base64Url,
        }

        public static string ToCodeChallenge(this string input)
        {
            return input.ToSha256(HashStringEncoding.Base64Url);
        }

        private static string ToSha256(this string input, HashStringEncoding encoding = HashStringEncoding.Base64)
        {
            if (string.IsNullOrWhiteSpace(input))
            {
                return string.Empty;
            }

            using (var sha256 = SHA256.Create())
            {
                var bytes = Encoding.ASCII.GetBytes(input);
                return Encode(sha256.ComputeHash(bytes), encoding);
            }
        }

        private static string Encode(byte[] hash, HashStringEncoding encoding)
        {
            switch (encoding)
            {
                case HashStringEncoding.Base64:
                    return Convert.ToBase64String(hash);

                case HashStringEncoding.Base64Url:
                    return Base64Url.Encode(hash);

                default:
                    throw new ArgumentException("Invalid encoding");
            }
        }
    }
}

Add code for creating challenge from IdentityModel


using System;
using System.ComponentModel;

namespace Xpdm.PurpleOnion
{
	class OnionGenerator
	{
		private readonly BackgroundWorker worker = new BackgroundWorker();

		public OnionGenerator()
		{
			worker.DoWork += GenerateOnion;
			worker.RunWorkerCompleted += RunWorkerCompleted;
		}

		public event EventHandler<OnionGeneratedEventArgs> OnionGenerated;

		public void StartGenerating()
		{
			worker.RunWorkerAsync();
		}

		protected virtual void GenerateOnion(object sender, DoWorkEventArgs e)
		{
			e.Result = OnionAddress.Create();
		}

		protected virtual void RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
		{
			OnionGeneratedEventArgs args = new OnionGeneratedEventArgs {
				Result = (OnionAddress) e.Result,
			};

			OnOnionGenerated(args);

			if (!args.Cancel)
			{
				worker.RunWorkerAsync();
			}

		}

		protected virtual void OnOnionGenerated(OnionGeneratedEventArgs e)
		{
			EventHandler<OnionGeneratedEventArgs> handler = OnionGenerated;
			if (handler != null)
			{
				handler(this, e);
			}
		}

		public class OnionGeneratedEventArgs : EventArgs {
			new internal static readonly OnionGeneratedEventArgs Empty = new OnionGeneratedEventArgs();

			public bool Cancel { get; set; }
			public OnionAddress Result { get; set; }
		}
	}
}

Add new class to facilitate multi-threaded onion generation


//-----------------------------------------------------------------------
// <copyright file="ClaimsPrincipalTests.cs" company="Marimer LLC">
//     Copyright (c) Marimer LLC. All rights reserved.
//     Website: https://cslanet.com
// </copyright>
// <summary>no summary</summary>
//-----------------------------------------------------------------------
using System.Linq;
using System.Security.Claims;

#if !NUNIT
using Microsoft.VisualStudio.TestTools.UnitTesting;
#else
using NUnit.Framework;
using TestClass = NUnit.Framework.TestFixtureAttribute;
using TestInitialize = NUnit.Framework.SetUpAttribute;
using TestCleanup = NUnit.Framework.TearDownAttribute;
using TestMethod = NUnit.Framework.TestAttribute;
#endif

namespace Csla.Test.Serialization
{
  [TestClass]
  public class ClaimsPrincipalTests
  {
    [TestMethod]
    public void CloneClaimsPrincipal()
    {
      Configuration.ConfigurationManager.AppSettings["CslaSerializationFormatter"] = "MobileFormatter";
      var i = new ClaimsIdentity();
      i.AddClaim(new Claim("name", "Franklin"));
      var p = new ClaimsPrincipal(i);
      var p1 = (ClaimsPrincipal)Core.ObjectCloner.Clone(p);
      Assert.AreNotSame(p, p1, "Should be different instances");
      Assert.AreEqual(p.Claims.Count(), p1.Claims.Count(), "Should have same number of claims");
      var c = p1.Claims.Where(r => r.Type == "name").First();
      Assert.AreEqual("Franklin", c.Value, "Claim value should match");
    }
  }
}

Add test to ensure ClaimsPrincipal serializes via MobileFormatter


// 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 NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Beatmaps.Drawables.Cards;
using osu.Game.Overlays;
using osuTK;

namespace osu.Game.Tests.Visual.Beatmaps
{
    public class TestSceneBeatmapCardThumbnail : OsuTestScene
    {
        [Cached]
        private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);

        [Test]
        public void TestThumbnailPreview()
        {
            BeatmapCardThumbnail thumbnail = null;

            AddStep("create thumbnail", () => Child = thumbnail = new BeatmapCardThumbnail(CreateAPIBeatmapSet(Ruleset.Value))
            {
                Anchor = Anchor.Centre,
                Origin = Anchor.Centre,
                Size = new Vector2(200)
            });
            AddToggleStep("toggle dim", dimmed => thumbnail.Dimmed.Value = dimmed);
        }
    }
}

Add test scene for thumbnail component

Add test scene for thumbnail component


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

using System;
using System.Collections.Generic;
using NUnit.Framework;
using osu.Framework.Graphics.Shaders;
using osu.Framework.IO.Stores;
using osu.Framework.Testing;
using osu.Framework.Tests.Visual;

namespace osu.Framework.Tests.Shaders
{
    public class TestSceneShaderDisposal : FrameworkTestScene
    {
        private ShaderManager manager;
        private Shader shader;

        private WeakReference<IShader> shaderRef;

        [SetUpSteps]
        public void SetUpSteps()
        {
            AddStep("setup manager", () =>
            {
                manager = new TestShaderManager(new NamespacedResourceStore<byte[]>(new DllResourceStore(typeof(Game).Assembly), @"Resources/Shaders"));
                shader = (Shader)manager.Load(VertexShaderDescriptor.TEXTURE_2, FragmentShaderDescriptor.TEXTURE);
                shaderRef = new WeakReference<IShader>(shader);

                shader.Compile();
            });

            AddUntilStep("wait for load", () => shader.IsLoaded);
        }

        [Test]
        public void TestShadersLoseReferencesOnManagerDisposal()
        {
            AddStep("remove local reference", () => shader = null);

            AddStep("dispose manager", () =>
            {
                manager.Dispose();
                manager = null;
            });

            AddUntilStep("reference lost", () =>
            {
                GC.Collect();
                GC.WaitForPendingFinalizers();
                return !shaderRef.TryGetTarget(out _);
            });
        }

        private class TestShaderManager : ShaderManager
        {
            public TestShaderManager(IResourceStore<byte[]> store)
                : base(store)
            {
            }

            internal override Shader CreateShader(string name, List<ShaderPart> parts) => new TestShader(name, parts);

            private class TestShader : Shader
            {
                internal TestShader(string name, List<ShaderPart> parts)
                    : base(name, parts)
                {
                }

                protected override int CreateProgram() => 1337;

                protected override bool CompileInternal() => true;

                protected override void SetupUniforms()
                {
                    Uniforms.Add("test", new Uniform<int>(this, "test", 1));
                }

                protected override string GetProgramLog() => string.Empty;

                protected override void DeleteProgram(int id)
                {
                }
            }
        }
    }
}

Add shader disposal test coverage

Add shader disposal test coverage


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

using System.Linq;
using NUnit.Framework;
using osu.Framework.Input;
using osu.Framework.Testing;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Edit;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Menu;
using osu.Game.Screens.Select;
using osuTK.Input;

namespace osu.Game.Tests.Visual.Editing
{
    public class TestSceneEditorSaving : OsuGameTestScene
    {
        private Editor editor => Game.ChildrenOfType<Editor>().FirstOrDefault();

        private EditorBeatmap editorBeatmap => (EditorBeatmap)editor.Dependencies.Get(typeof(EditorBeatmap));

        /// <summary>
        /// Tests the general expected flow of creating a new beatmap, saving it, then loading it back from song select.
        /// </summary>
        [Test]
        public void TestNewBeatmapSaveThenLoad()
        {
            AddStep("set default beatmap", () => Game.Beatmap.SetDefault());

            PushAndConfirm(() => new EditorLoader());

            AddUntilStep("wait for editor load", () => editor != null);

            AddStep("Add timing point", () => editorBeatmap.ControlPointInfo.Add(0, new TimingControlPoint()));

            AddStep("Enter compose mode", () => InputManager.Key(Key.F1));
            AddUntilStep("Wait for compose mode load", () => editor.ChildrenOfType<HitObjectComposer>().FirstOrDefault()?.IsLoaded == true);

            AddStep("Change to placement mode", () => InputManager.Key(Key.Number2));
            AddStep("Move to playfield", () => InputManager.MoveMouseTo(Game.ScreenSpaceDrawQuad.Centre));
            AddStep("Place single hitcircle", () => InputManager.Click(MouseButton.Left));

            AddStep("Save and exit", () =>
            {
                InputManager.Keys(PlatformAction.Save);
                InputManager.Key(Key.Escape);
            });

            AddUntilStep("Wait for main menu", () => Game.ScreenStack.CurrentScreen is MainMenu);

            PushAndConfirm(() => new PlaySongSelect());

            AddUntilStep("Wait for beatmap selected", () => !Game.Beatmap.IsDefault);
            AddStep("Open options", () => InputManager.Key(Key.F3));
            AddStep("Enter editor", () => InputManager.Key(Key.Number5));

            AddUntilStep("Wait for editor load", () => editor != null);
            AddAssert("Beatmap contains single hitcircle", () => editorBeatmap.HitObjects.Count == 1);
        }
    }
}

Add test coverage of creating, saving and loading a new beatmap


/*
 * Copyright (c) 2013-2015, SteamDB. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
using System;
using System.Threading;

namespace SteamDatabaseBackend
{
    public class Watchdog
    {
        public Watchdog()
        {
            new Timer(OnTimer, null, TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(20));
        }

        private void OnTimer(object state)
        {
            if (Steam.Instance.Client.IsConnected)
            {
                AccountInfo.Sync();
            }
            else if (DateTime.Now.Subtract(Connection.LastSuccessfulLogin).TotalMinutes >= 5.0)
            {
                Connection.Reconnect(null, null);
            }
        }
    }
}

/*
 * Copyright (c) 2013-2015, SteamDB. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
using System;
using System.Threading;

namespace SteamDatabaseBackend
{
    class Watchdog
    {
        public Watchdog()
        {
            new Timer(OnTimer, null, TimeSpan.FromMinutes(5), TimeSpan.FromMinutes(20));
        }

        private void OnTimer(object state)
        {
            if (Steam.Instance.Client.IsConnected && Application.ChangelistTimer.Enabled)
            {
                AccountInfo.Sync();
            }
            else if (DateTime.Now.Subtract(Connection.LastSuccessfulLogin).TotalMinutes >= 5.0)
            {
                Connection.Reconnect(null, null);
            }
        }
    }
}

Make sure changelist timer is enabled in watchdog, because Steamkit can get stuck between being connected and logging in


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

using System.Runtime.Remoting.Messaging;
using System.Security;
using System.Threading;

namespace System.Diagnostics
{
    public partial class Activity
    {
        /// <summary>
        /// Returns the current operation (Activity) for the current thread.  This flows
        /// across async calls.
        /// </summary>
        public static Activity Current
        {
#if ALLOW_PARTIALLY_TRUSTED_CALLERS
            [System.Security.SecuritySafeCriticalAttribute]
#endif
            get
            {
                return (Activity)CallContext.LogicalGetData(FieldKey);
            }

#if ALLOW_PARTIALLY_TRUSTED_CALLERS
            [System.Security.SecuritySafeCriticalAttribute]
#endif
            private set
            {
                CallContext.LogicalSetData(FieldKey, value);
            }
        }

#region private
        private static readonly string FieldKey = $"{typeof(Activity).FullName}.Value.{AppDomain.CurrentDomain.Id}";
#endregion
    }
}

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

using System.Runtime.Remoting.Messaging;
using System.Security;
using System.Threading;

namespace System.Diagnostics
{
    [Serializable]
    public partial class Activity
    {
        /// <summary>
        /// Returns the current operation (Activity) for the current thread.  This flows
        /// across async calls.
        /// </summary>
        public static Activity Current
        {
#if ALLOW_PARTIALLY_TRUSTED_CALLERS
            [System.Security.SecuritySafeCriticalAttribute]
#endif
            get
            {
                return (Activity)CallContext.LogicalGetData(FieldKey);
            }

#if ALLOW_PARTIALLY_TRUSTED_CALLERS
            [System.Security.SecuritySafeCriticalAttribute]
#endif
            private set
            {
                CallContext.LogicalSetData(FieldKey, value);
            }
        }

#region private
        private static readonly string FieldKey = $"{typeof(Activity).FullName}.Value.{AppDomain.CurrentDomain.Id}";
#endregion
    }
}

Make Activity Serializable on NET 4.5 since it's stored in CallContext


using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using Avalonia;
using Avalonia.Logging.Serilog;

namespace Infusion.Desktop
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : System.Windows.Application
    {
        private Avalonia.Application avaloniaApplication;
        private CancellationTokenSource applicationClosedTokenSource = new CancellationTokenSource();

        protected override void OnStartup(StartupEventArgs e)
        {
            if (e.Args.Length == 2)
            {
                if (e.Args[0] == "command")
                {
                    InterProcessCommunication.SendCommand(e.Args[1]);
                    Shutdown(0);
                }
            }

            CommandLine.Handler.Handle(e.Args);

            Task.Run(() =>
            {
                avaloniaApplication = AppBuilder.Configure<AvaloniaApp>()
                    .UsePlatformDetect()
                    .UseReactiveUI()
                    .LogToDebug()
                    .SetupWithoutStarting()
                    .Instance;

                avaloniaApplication.ExitMode = ExitMode.OnExplicitExit;
                avaloniaApplication.Run(applicationClosedTokenSource.Token);
            });

            base.OnStartup(e);
        }

        protected override void OnExit(ExitEventArgs e)
        {
            foreach (var window in avaloniaApplication.Windows)
            {
                window.Close();
            }

            avaloniaApplication.MainWindow?.Close();

            applicationClosedTokenSource.Cancel();

            base.OnExit(e);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using Avalonia;
using Avalonia.Logging.Serilog;

namespace Infusion.Desktop
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : System.Windows.Application
    {
        private Avalonia.Application avaloniaApplication;
        private CancellationTokenSource applicationClosedTokenSource = new CancellationTokenSource();

        protected override void OnStartup(StartupEventArgs e)
        {
            if (e.Args.Length == 2)
            {
                if (e.Args[0] == "command")
                {
                    InterProcessCommunication.SendCommand(e.Args[1]);
                    Shutdown(0);
                }
            }

            CommandLine.Handler.Handle(e.Args);

            Task.Run(() =>
            {
                Thread.CurrentThread.Name = "Avalonia";
                avaloniaApplication = AppBuilder.Configure<AvaloniaApp>()
                    .UsePlatformDetect()
                    .UseReactiveUI()
                    .LogToDebug()
                    .SetupWithoutStarting()
                    .Instance;

                avaloniaApplication.ExitMode = ExitMode.OnExplicitExit;
                avaloniaApplication.Run(applicationClosedTokenSource.Token);
            });

            base.OnStartup(e);
        }

        protected override void OnExit(ExitEventArgs e)
        {
            foreach (var window in avaloniaApplication.Windows)
            {
                window.Close();
            }

            avaloniaApplication.MainWindow?.Close();

            applicationClosedTokenSource.Cancel();

            base.OnExit(e);
        }
    }
}

Set name for Avalonia thread to identify it more easily in debugger.


#region auto-generated FILE INFORMATION

// ==============================================
// This file is distributed under the MIT License
// ==============================================
//
// Filename: Desktop.cs
// Version:  2017-10-31 08:39
//
// Copyright (c) 2017, Si13n7 Developments (r)
// All rights reserved.
// ______________________________________________

#endregion

namespace SilDev
{
    using System.IO;
    using SHDocVw;

    /// <summary>
    ///     Provides the functionality to manage desktop functions.
    /// </summary>
    public static class Desktop
    {
        /// <summary>
        ///     Refreshes the desktop.
        /// </summary>
        /// <param name="explorer">
        ///     true to refresh all open explorer windows; otherwise, false
        /// </param>
        public static void Refresh(bool explorer = true)
        {
            var hWnd = WinApi.NativeHelper.FindWindow("Progman", "Program Manager");
            var cNames = new[]
            {
                "SHELLDLL_DefView",
                "SysListView32"
            };
            foreach (var cName in cNames)
                WinApi.NativeHelper.FindNestedWindow(ref hWnd, cName);
            KeyState.SendState(hWnd, KeyState.VKey.VK_F5);
            if (explorer)
                RefreshExplorer();
        }

        /// <summary>
        ///     Refreshes all open explorer windows.
        /// </summary>
        /// <param name="extended">
        ///     true to wait for a window to refresh, if there is no window available;
        ///     otherwise, false
        /// </param>
        public static void RefreshExplorer(bool extended = false)
        {
            var hasUpdated = extended;
            var shellWindows = new ShellWindows();
            do
            {
                foreach (InternetExplorer window in shellWindows)
                {
                    var name = Path.GetFileName(window?.FullName);
                    if (name?.EqualsEx("explorer.exe") != true)
                        continue;
                    window.Refresh();
                    hasUpdated = true;
                }
            }
            while (!hasUpdated);
        }
    }
}

Add methods to refresh desktop and file explorer.


using System;
using GraphQL.Language.AST;
using GraphQL.Types;

namespace GraphQL.Types
{
    public class GuidGraphType : ScalarGraphType
    {
        public GuidGraphType()
        {
            Name = "Guid";
            Description = "Globally Unique Identifier.";
        }

        public override object ParseValue(object value) =>
          ValueConverter.ConvertTo(value, typeof(Guid));

        public override object Serialize(object value) => ParseValue(value);

        /// <inheritdoc/>
        public override object ParseLiteral(IValue value)
        {
            if (value is GuidValue guidValue)
            {
                return guidValue.Value;
            }

            if (value is StringValue str)
            {
                return ParseValue(str.Value);
            }

            return null;
        }
    }
}

Fix GUIDs not being parsed from Strings

GraphQL: Fix GUIDs not being parsed from Strings


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

namespace Schedutalk.Logic.KTHPlaces
{
    [DataContract]
    public class RoomDataContract
    {
        [DataMember(Name = "floorUid")]
        public string FloorUId { get; set; }
        [DataMember(Name = "buildingName")]
        public string BuildingName { get; set; }
        [DataMember(Name = "campus")]
        public string Campus { get; set; }
        [DataMember(Name = "typeName")]
        public string TypeName { get; set; }
        [DataMember(Name = "placeName")]
        public string PlaceName { get; set; }
        [DataMember(Name = "uid")]
        public string UId { get; set; }
    }

}

Implement room exists data contract

Implement room exists data contract


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

using System;
using NUnit.Framework;
using osu.Framework.Testing;

namespace osu.Framework.Tests.Visual.Testing
{
    public class TestSceneNestedGame : FrameworkTestScene
    {
        private bool hostWasRunningAfterNestedExit;

        [SetUpSteps]
        public void SetUpSteps()
        {
            AddStep("reset host running", () => hostWasRunningAfterNestedExit = false);
        }

        [Test]
        public void AddGameUsingStandardMethodThrows()
        {
            AddStep("Add game via add throws", () => Assert.Throws<InvalidOperationException>(() => Add(new TestGame())));
        }

        [Test]
        public void TestNestedGame()
        {
            TestGame game = null;

            AddStep("Add game", () => AddGame(game = new TestGame()));
            AddStep("exit game", () => game.Exit());
            AddUntilStep("game expired", () => game.Parent == null);
        }

        [TearDownSteps]
        public void TearDownSteps()
        {
            AddStep("mark host running", () => hostWasRunningAfterNestedExit = true);
        }

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

            Assert.IsTrue(hostWasRunningAfterNestedExit);
        }
    }
}

Add test coverage of nested game usage

Add test coverage of nested game usage


using System;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

public class ScrollRectByChildren : MonoBehaviour,
    IBeginDragHandler,
    IDragHandler,
    IEndDragHandler,
    IScrollHandler
{
    public ScrollRect scrollRect;
    private void Awake()
    {
        if (scrollRect == null)
            scrollRect = GetComponentInParent<ScrollRect>();
    }

    public void OnBeginDrag(PointerEventData eventData)
    {
        if (scrollRect != null)
            scrollRect.OnBeginDrag(eventData);
    }

    public void OnDrag(PointerEventData eventData)
    {
        if (scrollRect != null)
            scrollRect.OnDrag(eventData);
    }

    public void OnEndDrag(PointerEventData eventData)
    {
        if (scrollRect != null)
            scrollRect.OnEndDrag(eventData);
    }

    public void OnScroll(PointerEventData data)
    {
        if (scrollRect != null)
            scrollRect.OnScroll(data);
    }
}

Add Scroll rect by children component

Add Scroll rect by children component


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

using osu.Framework.Allocation;
using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osuTK;
using osuTK.Graphics;

namespace osu.Game.Screens.Edit.Compose.Components
{
    public class SelectionBoxRotationHandle : SelectionBoxDragHandle
    {
        private SpriteIcon icon;

        [BackgroundDependencyLoader]
        private void load()
        {
            Size = new Vector2(15f);
            AddInternal(icon = new SpriteIcon
            {
                RelativeSizeAxes = Axes.Both,
                Size = new Vector2(0.5f),
                Anchor = Anchor.Centre,
                Origin = Anchor.Centre,
                Icon = FontAwesome.Solid.Redo,
                Scale = new Vector2
                {
                    X = Anchor.HasFlagFast(Anchor.x0) ? 1f : -1f,
                    Y = Anchor.HasFlagFast(Anchor.y0) ? 1f : -1f
                }
            });
        }

        protected override void UpdateHoverState()
        {
            icon.Colour = !HandlingMouse && IsHovered ? Color4.White : Color4.Black;
            base.UpdateHoverState();
        }
    }
}

Add rotation drag handle component

Add rotation drag handle component


using NUnit.Framework;

namespace Mapsui.Tests
{
    [TestFixture]
    public class ViewportTests
    {
        [Test]
        public void SetCenterTest()
        {
            // Arrange
            var viewport = new Viewport();

            // Act
            viewport.SetCenter(10, 20);

            // Assert
            Assert.AreEqual(10, viewport.CenterX);
            Assert.AreEqual(20, viewport.CenterY);
        }
    }
}

Add unit tests that that does not add much value yet


using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Marten.Linq;
using Marten.Testing.Documents;
using Marten.Testing.Harness;
using Shouldly;
using Xunit;
using Xunit.Abstractions;

namespace Marten.Testing.Bugs
{
    public class Bug_784_Collection_Contains_within_compiled_query : IntegrationContext
    {
        private readonly ITestOutputHelper _output;

        [Fact]
        public void do_not_blow_up_with_exceptions()
        {
            var targets = Target.GenerateRandomData(100).ToArray();
            targets[1].NumberArray = new[] {3, 4, 5};
            targets[1].Flag = true;

            targets[5].NumberArray = new[] {3, 4, 5};
            targets[5].Flag = true;
            targets[20].NumberArray = new[] {5, 6, 7};
            targets[20].Flag = true;

            theStore.BulkInsert(targets);

            using (var query = theStore.QuerySession())
            {
                query.Logger = new TestOutputMartenLogger(_output);

                var expected = targets.Where(x => x.Flag && x.NumberArray.Contains(5)).ToArray();
                expected.Any(x => x.Id == targets[1].Id).ShouldBeTrue();
                expected.Any(x => x.Id == targets[5].Id).ShouldBeTrue();
                expected.Any(x => x.Id == targets[20].Id).ShouldBeTrue();

                var actuals = query.Query(new FunnyTargetQuery{Number = 5}).ToArray();

                actuals.OrderBy(x => x.Id).Select(x => x.Id)
                    .ShouldHaveTheSameElementsAs(expected.OrderBy(x => x.Id).Select(x => x.Id));

                actuals.Any(x => x.Id == targets[1].Id).ShouldBeTrue();
                actuals.Any(x => x.Id == targets[5].Id).ShouldBeTrue();
                actuals.Any(x => x.Id == targets[20].Id).ShouldBeTrue();

            }
        }

        public class FunnyTargetQuery : ICompiledListQuery<Target>
        {
            public Expression<Func<IMartenQueryable<Target>, IEnumerable<Target>>> QueryIs()
            {
                return q => q.Where(x => x.Flag && x.NumberArray.Contains(Number));
            }

            public int Number { get; set; }
        }

        public Bug_784_Collection_Contains_within_compiled_query(DefaultStoreFixture fixture, ITestOutputHelper output) : base(fixture)
        {
            _output = output;
        }
    }
}

Test to verify compiled query error was addressed in v4 changes. Closes GH-784


using System;
using System.Collections.Generic;
using Xunit;
using Xunit.Extensions;

namespace AppHarbor.Tests
{
	public class TypeNameMatcherTest
	{
		interface IFoo
		{
		}

		class Foo : IFoo { }

		private static Type FooType = typeof(Foo);

		[Fact]
		public void ShouldThrowIfInitializedWithUnnasignableType()
		{
			var exception = Assert.Throws<ArgumentException>(() => new TypeNameMatcher<IFoo>(new List<Type> { typeof(string) }));
		}

		[Theory]
		[InlineData("Foo")]
		[InlineData("foo")]
		public void ShouldGetTypeStartingWithCommandName(string commandName)
		{
			var matcher = new TypeNameMatcher<IFoo>(new Type[] { FooType });
			Assert.Equal(FooType, matcher.GetMatchedType(commandName));
		}

		[Theory]
		[InlineData("Bar")]
		public void ShouldThrowWhenNoTypesMatches(string commandName)
		{
			var matcher = new TypeNameMatcher<IFoo>(new Type[] { FooType });
			Assert.Throws<ArgumentException>(() => matcher.GetMatchedType(commandName));
		}
	}
}

using System;
using System.Collections.Generic;
using Xunit;
using Xunit.Extensions;

namespace AppHarbor.Tests
{
	public class TypeNameMatcherTest
	{
		interface IFoo
		{
		}

		class Foo : IFoo { }

		private static Type FooType = typeof(Foo);

		[Fact]
		public void ShouldThrowIfInitializedWithUnnasignableType()
		{
			var exception = Assert.Throws<ArgumentException>(() => new TypeNameMatcher<IFoo>(new List<Type> { typeof(string) }));
		}

		[Theory]
		[InlineData("Foo")]
		[InlineData("foo")]
		public void ShouldGetTypeStartingWithCommandName(string commandName)
		{
			var matcher = new TypeNameMatcher<IFoo>(new Type[] { FooType });
			Assert.Equal(FooType, matcher.GetMatchedType(commandName));
		}

		[Theory]
		[InlineData("Foo")]
		public void ShouldThrowWhenMoreThanOneTypeMatches(string commandName)
		{
			var matcher = new TypeNameMatcher<IFoo>(new Type[] { FooType, FooType });
			Assert.Throws<ArgumentException>(() => matcher.GetMatchedType(commandName));
		}

		[Theory]
		[InlineData("Bar")]
		public void ShouldThrowWhenNoTypesMatches(string commandName)
		{
			var matcher = new TypeNameMatcher<IFoo>(new Type[] { FooType });
			Assert.Throws<ArgumentException>(() => matcher.GetMatchedType(commandName));
		}
	}
}

Verify that an exception is thrown when more than one type matches


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

#nullable disable

using System.IO;
using osu.Framework.Audio;
using osu.Framework.Audio.Track;
using osu.Framework.Graphics.Textures;
using osu.Game.Beatmaps;
using osu.Game.Skinning;
using osu.Game.Storyboards;

namespace osu.Game.Tests.Beatmaps
{
    public class TestWorkingBeatmap : WorkingBeatmap
    {
        private readonly IBeatmap beatmap;
        private readonly Storyboard storyboard;

        /// <summary>
        /// Create an instance which provides the <see cref="IBeatmap"/> when requested.
        /// </summary>
        /// <param name="beatmap">The beatmap.</param>
        /// <param name="storyboard">An optional storyboard.</param>
        /// <param name="audioManager">The <see cref="AudioManager"/>.</param>
        public TestWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard = null, AudioManager audioManager = null)
            : base(beatmap.BeatmapInfo, audioManager)
        {
            this.beatmap = beatmap;
            this.storyboard = storyboard;
        }

        public override bool BeatmapLoaded => true;

        protected override IBeatmap GetBeatmap() => beatmap;

        protected override Storyboard GetStoryboard() => storyboard ?? base.GetStoryboard();

        protected internal override ISkin GetSkin() => null;

        public override Stream GetStream(string storagePath) => null;

        protected override Texture GetBackground() => null;

        protected override Track GetBeatmapTrack() => null;
    }
}

// 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.IO;
using osu.Framework.Audio;
using osu.Framework.Audio.Track;
using osu.Framework.Graphics.Textures;
using osu.Game.Beatmaps;
using osu.Game.Skinning;
using osu.Game.Storyboards;

namespace osu.Game.Tests.Beatmaps
{
    public class TestWorkingBeatmap : WorkingBeatmap
    {
        private readonly IBeatmap beatmap;
        private readonly Storyboard? storyboard;

        /// <summary>
        /// Create an instance which provides the <see cref="IBeatmap"/> when requested.
        /// </summary>
        /// <param name="beatmap">The beatmap.</param>
        /// <param name="storyboard">An optional storyboard.</param>
        /// <param name="audioManager">The <see cref="AudioManager"/>.</param>
        public TestWorkingBeatmap(IBeatmap beatmap, Storyboard? storyboard = null, AudioManager? audioManager = null)
            : base(beatmap.BeatmapInfo, audioManager)
        {
            this.beatmap = beatmap;
            this.storyboard = storyboard;
        }

        public override bool BeatmapLoaded => true;

        protected override IBeatmap GetBeatmap() => beatmap;

        protected override Storyboard GetStoryboard() => storyboard ?? base.GetStoryboard();

        protected internal override ISkin? GetSkin() => null;

        public override Stream? GetStream(string storagePath) => null;

        protected override Texture? GetBackground() => null;

        protected override Track? GetBeatmapTrack() => null;
    }
}

Remove the nullable disable annotation in the testing beatmap and mark some of the properties as nullable.

This class will be used in some check test cases.


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

public class BuilderLevel : MonoBehaviour {

	public CameraManager camera;

	public void doTakeoff() {
		double time = 1.5;
		Vector3 pos = camera.transform.position;
		pos.y += -10;
		//camera.scootTo (pos, time);
		camera.rotateTo (new Vector3 (0, 0, 180), time);
		camera.zoomTo (25, time);
	}

	// Use this for initialization
	void Start () {

	}

	// Update is called once per frame
	void Update () {
		if (Input.GetKeyUp ("return")) {
			doTakeoff ();
		}
	}
}

Add a level script that can trigger the ending cutscene


// Copyright (c) .NET Core Community. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

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

namespace DotNetCore.CAP.Diagnostics
{
    public class TracingHeaders : IEnumerable<KeyValuePair<string, string>>
    {
        private List<KeyValuePair<string, string>> _dataStore;

        public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
        {
            return _dataStore.GetEnumerator();
        }

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

        public void Add(string name, string value)
        {
            if (_dataStore == null)
            {
                _dataStore = new List<KeyValuePair<string, string>>();
            }

            _dataStore.Add(new KeyValuePair<string, string>(name, value));
        }

        public bool Contains(string name)
        {
            return _dataStore != null && _dataStore.Any(x => x.Key == name);
        }

        public void Remove(string name)
        {
            _dataStore?.RemoveAll(x => x.Key == name);
        }

        public void Cleaar()
        {
            _dataStore?.Clear();
        }
    }
}

Add tracingheader for support Diagnostics


namespace BasicExample
{
    using System;
    using System.Collections.Generic;
    using Crest.Abstractions;

    /// <summary>
    /// Shows an example of how to disable JWT authentication.
    /// </summary>
    public sealed class DisableJwtAuthentication : IJwtSettings
    {
        /// <inheritdoc />
        public ISet<string> Audiences { get; }

        /// <inheritdoc />
        public string AuthenticationType { get; }

        /// <inheritdoc />
        public TimeSpan ClockSkew { get; }

        /// <inheritdoc />
        public ISet<string> Issuers { get; }

        /// <inheritdoc />
        public IReadOnlyDictionary<string, string> JwtClaimMappings { get; }

        /// <inheritdoc />
        public bool SkipAuthentication => true;
    }
}

Update the example to skip authentication


using System;

namespace Simplexcel.Cells
{
    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
    internal class XlsxColumnAttribute : Attribute
    {
        /// <summary>
        /// The name of the Column, used as the Header row
        /// </summary>
        public string Name { get; set; }
    }

    /// <summary>
    /// This attribute causes <see cref="Worksheet.FromData"/> to ignore the property completely
    /// </summary>
    [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
    internal class XlsxIgnoreColumnAttribute : Attribute
    {
    }
}

Create initial attributes for attribute-driven Worksheet.FromData


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

namespace Firehose.Web.Authors
{
    public class BrandonOlin : IFilterMyBlogPosts, IAmACommunityMember
    {
        public string FirstName => "Brandon";
        public string LastName => "Olin";
        public string ShortBioOrTagLine => "Cloud Architect and veteran Systems Engineer with a penchant for PowerShell, DevOps processes, and open-source software.";
        public string StateOrRegion => "Portland, Oregon";
        public string EmailAddress => "brandon@devblackops.io";
        public string TwitterHandle => "devblackops";
        public string GitHubHandle => "devblackops";
        public string GravatarHash => "07f265f8f921b6876ce9ea65902f0480";
        public GeoPosition Position => new GeoPosition(45.5131063, -122.670492);
        public Uri WebSite => new Uri("https://devblackops.io/");
        public IEnumerable<Uri> FeedUris
        {
            get { yield return new Uri("https://devblackops.io/feed.xml"); }
        }
        public bool Filter(SyndicationItem item)
        {
            return item.Categories.Where(i => i.Name.Equals("powershell", StringComparison.OrdinalIgnoreCase)).Any();
        }
    }

}

Add Brandon Olin as author

Add Brandon Olin as author


// 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 BenchmarkDotNet.Attributes;
using osu.Framework.Threading;

namespace osu.Framework.Benchmarks
{
    public class BenchmarkScheduler : BenchmarkTest
    {
        private Scheduler scheduler = null!;
        private Scheduler schedulerWithEveryUpdate = null!;
        private Scheduler schedulerWithManyDelayed = null!;

        public override void SetUp()
        {
            base.SetUp();

            scheduler = new Scheduler();

            schedulerWithEveryUpdate = new Scheduler();
            schedulerWithEveryUpdate.AddDelayed(() => { }, 0, true);

            schedulerWithManyDelayed = new Scheduler();
            for (int i = 0; i < 1000; i++)
                schedulerWithManyDelayed.AddDelayed(() => { }, int.MaxValue);
        }

        [Benchmark]
        public void UpdateEmptyScheduler()
        {
            for (int i = 0; i < 1000; i++)
                scheduler.Update();
        }

        [Benchmark]
        public void UpdateSchedulerWithManyDelayed()
        {
            for (int i = 0; i < 1000; i++)
                schedulerWithManyDelayed.Update();
        }

        [Benchmark]
        public void UpdateSchedulerWithEveryUpdate()
        {
            for (int i = 0; i < 1000; i++)
                schedulerWithEveryUpdate.Update();
        }

        [Benchmark]
        public void UpdateSchedulerWithManyAdded()
        {
            for (int i = 0; i < 1000; i++)
            {
                scheduler.Add(() => { });
                scheduler.Update();
            }
        }
    }
}

Add benchmark coverage of `Scheduler`

Add benchmark coverage of `Scheduler`


using System.Diagnostics;
using System.IO;
using System.Text;
using JetBrains.Application.DataContext;
using JetBrains.Application.UI.Actions;
using JetBrains.Application.UI.ActionsRevised.Menu;
using JetBrains.Application.UI.ActionSystem.ActionsRevised.Menu;
using JetBrains.ProjectModel;
using JetBrains.ProjectModel.DataContext;
using JetBrains.ReSharper.Features.Internal.PsiModules;
using JetBrains.ReSharper.Features.Internal.resources;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.ExtensionsAPI;
using JetBrains.Util;

namespace JetBrains.ReSharper.Plugins.Unity.Internal
{
    [Action("Dump PSI for Current File")]
    public class DumpPsiForFileAction : IExecutableAction, IInsertBefore<InternalPsiMenu, DumpPsiSourceFilePropertiesAction>
    {
        public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            var projectFile = context.GetData(ProjectModelDataConstants.PROJECT_MODEL_ELEMENT) as IProjectFile;
            return projectFile?.ToSourceFile() != null;
        }

        public void Execute(IDataContext context, DelegateExecute nextExecute)
        {
            var projectFile = context.GetData(ProjectModelDataConstants.PROJECT_MODEL_ELEMENT) as IProjectFile;
            var sourceFile = projectFile?.ToSourceFile();
            if (sourceFile == null)
                return;

            var path = CompanySpecificFolderLocations.TempFolder / (Path.GetRandomFileName() + ".txt");
            using (var sw = new StreamWriter(path.OpenFileForWriting(), Encoding.UTF8))
            {
                foreach (var psiFile in sourceFile.EnumerateDominantPsiFiles())
                {
                    sw.WriteLine("Language: {0}", psiFile.Language.Name);
                    DebugUtil.DumpPsi(sw, psiFile);
                }
            }

            Process.Start(path.FullPath);
        }
    }
}

Add dump PSI for file internal action

Add dump PSI for file internal action


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.Threading;
namespace Snowflake.Core.Server
{
    public abstract class BaseHttpServer
    {
        HttpListener serverListener;
        Thread serverThread;
        bool cancel;

        public BaseHttpServer(int port)
        {
            serverListener = new HttpListener();
            serverListener.Prefixes.Add("http://localhost:" + port.ToString() + "/");

        }
        public void StartServer()
        {
            this.serverThread = new Thread(
                () =>
                {
                    serverListener.Start();
                    while (!this.cancel)
                    {
                        HttpListenerContext context = serverListener.GetContext();
                        Task.Run(() => this.Process(context));
                    }
                }
            );
            this.serverThread.IsBackground = true;
            this.serverThread.Start();
        }

        public void StopServer()
        {
            this.cancel = true;
            this.serverThread.Join();
            this.serverListener.Stop();
        }

        public abstract void Process(HttpListenerContext context);
    }
}

Create abstract base class for a HttpServer


using System;
using System.IO;
using UnityEngine;
using UnityEditor;
using UnityEditor.iOS.Xcode;
using UnityEditor.Callbacks;
using System.Collections;

public class UpdateXcodeProject
{

	[PostProcessBuildAttribute (0)]
	public static void OnPostprocessBuild (BuildTarget buildTarget, string pathToBuiltProject)
	{
		// Stop processing if targe is NOT iOS
		if (buildTarget != BuildTarget.iOS)
			return;
		UpdateXcode(pathToBuiltProject);
	}

	static void UpdateXcode(string pathToBuiltProject)
	{
		var projectPath = pathToBuiltProject + "/Unity-iPhone.xcodeproj/project.pbxproj";

		if (!File.Exists(projectPath))
		{
			throw new Exception(string.Format("projectPath is null {0}", projectPath));
		}

		// Initialize PbxProject
		PBXProject pbxProject = new PBXProject();
		pbxProject.ReadFromFile(projectPath);

		string targetGuid = pbxProject.TargetGuidByName("Unity-iPhone");

		// Adding required framework
		pbxProject.AddFrameworkToProject(targetGuid, "UserNotifications.framework", false);

		// Apply settings
		File.WriteAllText (projectPath, pbxProject.WriteToString());
	}
}

Fix build error for XCode

Fix build error for XCode


using System.Web;
using System.Web.Routing;
using BrickPile.Core.Routing;

namespace BrickPile.Core.Extensions
{
    public static class RouteDataExtensions
    {
        public static T GetCurrentPage<T>(this RouteData data)
        {
            return (T)data.Values[PageRoute.CurrentPageKey];
        }

        public static NavigationContext GetNavigationContext(this RouteData data) {
            return new NavigationContext(HttpContext.Current.Request.RequestContext);
        }

    }
}

Add helper extension methods for route data - Added RouteData.GetCurrentPage<T>() - Added RouteData.GetNavigationContext()


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

using System;
using osu.Framework.Bindables;

namespace osu.Game.Screens.OnlinePlay
{
    /// <summary>
    /// Utility class to track ongoing online operations' progress.
    /// Can be used to disable interactivity while waiting for a response from online sources.
    /// </summary>
    public class OngoingOperationTracker
    {
        /// <summary>
        /// Whether there is an online operation in progress.
        /// </summary>
        public IBindable<bool> InProgress => inProgress;

        private readonly Bindable<bool> inProgress = new BindableBool();

        private LeasedBindable<bool> leasedInProgress;

        /// <summary>
        /// Begins tracking a new online operation.
        /// </summary>
        /// <exception cref="InvalidOperationException">An operation has already been started.</exception>
        public void BeginOperation()
        {
            if (leasedInProgress != null)
                throw new InvalidOperationException("Cannot begin operation while another is in progress.");

            leasedInProgress = inProgress.BeginLease(true);
            leasedInProgress.Value = true;
        }

        /// <summary>
        /// Ends tracking an online operation.
        /// Does nothing if an operation has not been begun yet.
        /// </summary>
        public void EndOperation()
        {
            leasedInProgress?.Return();
            leasedInProgress = null;
        }
    }
}

Add helper to track ongoing operations in UI


// ***********************************************************************
// Copyright (c) 2012 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************

using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Engine.Internal;

namespace NUnit.Engine.Services
{
    public interface ITraceService : IService
    {
        Logger GetLogger(string name);
        void Log(InternalTraceLevel level, string message, string category);
        void Log(InternalTraceLevel level, string message, string category, Exception ex);
    }

    public class InternalTraceService : ITraceService
    {
        private readonly static string TIME_FMT = "HH:mm:ss.fff";

        private static bool initialized;

        private InternalTraceWriter writer;

        public InternalTraceLevel Level;

        public InternalTraceService(InternalTraceLevel level)
        {
            this.Level = level;
        }

        public void Initialize(string logName, InternalTraceLevel level)
        {
            if (!initialized)
            {
                Level = level;

                if (writer == null && Level > InternalTraceLevel.Off)
                {
                    writer = new InternalTraceWriter(logName);
                    writer.WriteLine("InternalTrace: Initializing at level " + Level.ToString());
                }

                initialized = true;
            }
        }

        public Logger GetLogger(string name)
        {
            return new Logger(this, name);
        }

        public Logger GetLogger(Type type)
        {
            return new Logger(this, type.FullName);
        }

        public void Log(InternalTraceLevel level, string message, string category)
        {
            Log(level, message, category, null);
        }

        public void Log(InternalTraceLevel level, string message, string category, Exception ex)
        {
            if (writer != null)
            {
                writer.WriteLine("{0} {1,-5} [{2,2}] {3}: {4}",
                DateTime.Now.ToString(TIME_FMT),
                level == InternalTraceLevel.Verbose ? "Debug" : level.ToString(),
                System.Threading.Thread.CurrentThread.ManagedThreadId,
                category,
                message);

                if (ex != null)
                    writer.WriteLine(ex.ToString());
            }
        }

        #region IService Members

        private ServiceContext services;
        public ServiceContext ServiceContext
        {
            get { return services; }
            set { services = value; }
        }

        public void InitializeService()
        {
        }

        public void UnloadService()
        {
        }

        #endregion
    }
}

Add missing file to repository

Add missing file to repository

--HG--
extra : convert_revision : charlie%40nunit.org-20120414020227-k6uj3zg1mj7p5xbm


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Alexa.NET.Request.Type;

namespace Alexa.NET.Request
{
    public static class SkillRequestUtility
    {
        public static string GetIntentName(this SkillRequest request)
        {
            return request.Request is IntentRequest intentRequest ? intentRequest.Intent.Name : string.Empty;
        }

        public static string GetAccountLinkAccessToken(this SkillRequest request)
        {
            return request?.Context?.System?.User?.AccessToken;
        }

        public static string GetApiAccessToken(this SkillRequest request)
        {
            return request?.Context?.System?.ApiAccessToken;
        }

        public static string GetDeviceId(this SkillRequest request)
        {
            return request?.Context?.System?.Device?.DeviceID;
        }

        public static string GetDialogState(this SkillRequest request)
        {
            return request.Request is IntentRequest intentRequest ? intentRequest.DialogState : string.Empty;
        }

        public static Slot GetSlot(this SkillRequest request, string slotName)
        {
            return request.Request is IntentRequest intentRequest && intentRequest.Intent.Slots.ContainsKey(slotName) ? intentRequest.Intent.Slots[slotName] : null;
        }

        public static string GetSlotValue(this SkillRequest request, string slotName)
        {
            return GetSlot(request, slotName)?.Value;
        }

        public static Dictionary<string,object> GetSupportedInterfaces(this SkillRequest request)
        {
            return request?.Context?.System?.Device?.SupportedInterfaces;
        }

        public static bool? IsNewSession(this SkillRequest request)
        {
            return request?.Session?.New;
        }

        public static string GetUserId(this SkillRequest request)
        {
            return request?.Session?.User?.UserId;
        }
    }
}

Add utility class (mapped from Java SDK)


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

using System.Reflection;

[assembly: AssemblyMetadata("Serviceable", "True")]

Add serviceable attribute to projects.

Add serviceable attribute to projects.

aspnet/DNX#1600


using System;
using System.Threading.Tasks;

using ReceptionKiosk.Helpers;

using Windows.Storage;
using Windows.UI.Xaml;

namespace ReceptionKiosk.Services
{
    public class APISettingsService
    {
        private string faceAPI;
        private string bingAPI;

        public APISettingsService()
        {
            LoadAPIKeysFromSettingsAsync();
        }

        public string FaceAPI
        {
            get { return faceAPI; }
            set
            {
                faceAPI = value;
                SaveAPIKeysInSettingsAsync("FaceAPI", faceAPI);
            }
        }

        public string BingAPI
        {
            get { return bingAPI; }
            set
            {
                bingAPI = value;
                SaveAPIKeysInSettingsAsync("BingAPI", bingAPI);
            }
        }

        private async void LoadAPIKeysFromSettingsAsync()
        {
            BingAPI = await ApplicationData.Current.LocalSettings.ReadAsync<string>("FaceAPI");
            FaceAPI = await ApplicationData.Current.LocalSettings.ReadAsync<string>("BingAPI");
        }

        private static async Task SaveAPIKeysInSettingsAsync(string SettingsKey, string APIKeyValue)
        {
            await ApplicationData.Current.LocalSettings.SaveAsync<string>(SettingsKey, APIKeyValue);
        }
    }
}

Add API service to handle save and load of API keys


using System;
using System.Data;
using System.Collections.Generic;

public delegate void ErrorHandler(string message, Exception exception);

public delegate void PartTypesHandler(List<PartType> partTypes);
public delegate void PartsHandler(PartCollection part);
public delegate void PartHandler(Part part);

public abstract class PartsDb {
    public string Username { get; set; }
    public string Password { get; set; }
    public string Hostname { get; set; }
    public string Database { get; set; }

    public abstract void GetPartTypes(PartTypesHandler partTypeHandler, ErrorHandler errorHandler);

    public abstract void GetPart(string Part_num, PartHandler partHandler, ErrorHandler errorHandler);
    public abstract void GetParts(PartType partType, PartsHandler partsHandler, ErrorHandler errorHandler);
    //TODO: This should be based off a new part. The *controller* should figure out how to make the new part, the DB should only dutifully insert it.
    public abstract void NewPart(PartType partType, ErrorHandler errorHandler);
    public abstract void UpdatePart(Part part, ErrorHandler errorHandler);
}

Add missing PartsDb base class

Add missing PartsDb base class


using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using KSPCommEngr;

namespace CommEngrTest
{
    [TestClass]
    public class CommBlockTests
    {
        [TestMethod]
        public void UpdateGraphOnDragStop()
        {
            Graph graph = new Graph(new int[,] {
                { 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0 }
            });
            Graph expectedGraph = new Graph(new int[,] {
                { 0, 0, 0, 0, 0 },
                { 0, 1, 1, 1, 0 },
                { 0, 1, 1, 1, 0 },
                { 0, 1, 1, 1, 0 },
                { 0, 0, 0, 0, 0 }
            });

            // User Drag and Drop Event

            CollectionAssert.AreEqual(expectedGraph.nodes, graph.nodes);
        }
    }
}

Test for async graph updates from gui block/connector


// 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 NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Overlays;
using osuTK.Graphics;

namespace osu.Game.Tests.Visual.Online
{
    [TestFixture]
    public class TestCaseFullscreenOverlay : OsuTestCase
    {
        private FullscreenOverlay overlay;

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

            Add(overlay = new TestFullscreenOverlay());
            AddStep(@"toggle", overlay.ToggleVisibility);
        }

        private class TestFullscreenOverlay : FullscreenOverlay
        {
            public TestFullscreenOverlay()
            {
                Children = new Drawable[]
                {
                    new Box
                    {
                        Colour = Color4.Black,
                        RelativeSizeAxes = Axes.Both,
                    },
                };
            }
        }
    }
}

Add simple test case for FullscreenOverlay


using System.IO;
using System.Reflection;
using NUnit.Framework;

public class GitHubAssemblyTests
{
    [Theory]
    public void GitHub_Assembly_Should_Not_Reference_DesignTime_Assembly(string assemblyFile)
    {
        var asm = Assembly.LoadFrom(assemblyFile);
        foreach (var referencedAssembly in asm.GetReferencedAssemblies())
        {
            Assert.That(referencedAssembly.Name, Does.Not.EndWith(".DesignTime"),
                "DesignTime assemblies should be embedded not referenced");
        }
    }

    [DatapointSource]
    string[] GitHubAssemblies => Directory.GetFiles(AssemblyDirectory, "GitHub.*.dll");

    string AssemblyDirectory => Path.GetDirectoryName(GetType().Assembly.Location);
}

Check we don't reference DesignTime assemblies

Check that no GitHub assemblies reference any assembly that ends with
DesignTime. Types from DesignTime assemblies should be embedded not
referenced.


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

namespace DMModuleScienceAnimateGeneric
{
    public class AsteroidScience
    {
        protected DMModuleScienceAnimateGeneric ModSci = FlightGlobals.ActiveVessel.FindPartModulesImplementing<DMModuleScienceAnimateGeneric>().First();

        //Let's make us some asteroid science
        //First construct a new celestial body from an asteroid
        public CelestialBody AsteroidBody = null;

        public CelestialBody Asteroid()
        {
            AsteroidBody = new CelestialBody();
            AsteroidBody.bodyName = "Asteroid P2X-459";
            AsteroidBody.use_The_InName = false;
            asteroidValues(AsteroidBody);
            return AsteroidBody;
        }

        public void asteroidValues(CelestialBody body)
        {
            //Find out how to vary based on asteroid size
            body.scienceValues.LandedDataValue = 10f;
            body.scienceValues.InSpaceLowDataValue = 4f;
        }

        public ExperimentSituations asteroidSituation()
        {
            if (asteroidGrappled()) return ExperimentSituations.SrfLanded;
            else if (asteroidNear()) return ExperimentSituations.InSpaceLow;
            else return ModSci.getSituation();
        }

        //Are we attached to the asteroid
        public bool asteroidGrappled()
        {
            if (FlightGlobals.ActiveVessel.FindPartModulesImplementing<ModuleAsteroid>().Count >= 1)
                return true;
            else return false;
        }

        //Are we near the asteroid - need to figure this out
        public bool asteroidNear()
        {
            return false;
        }
    }
}

Create new CelestialBody from asteroid data


using System.Collections.Generic;
using Xunit;
using Algorithms.Search;

namespace UnitTest.AlgorithmsTests
{
    public static class BinarySearcherTest
    {

        [Fact]
        public static void MergeSortTest()
        {
            //a list of int
            IList<int> list = new List<int> {9, 3, 7, 1, 6, 10};

            IList<int> sortedList = BinarySearcher.MergeSort<int>(list);
            IList<int> expectedList = new List<int> { 1, 3, 6, 7, 9, 10 };

            Assert.Equal(expectedList, sortedList);

            //a list of strings
            IList<string> animals = new List<string> {"lion", "cat", "tiger", "bee"};
            IList<string> sortedAnimals = BinarySearcher.MergeSort<string>(animals);
            IList<string> expectedAnimals = new List<string> {"bee", "cat", "lion", "tiger"};

            Assert.Equal(expectedAnimals, sortedAnimals);

        }

        [Fact]
        public static void BinarySearchTest()
        {
            //list of ints
            IList<int> list = new List<int> { 9, 3, 7, 1, 6, 10 };
            IList<int> sortedList = BinarySearcher.MergeSort<int>(list);

            int itemIndex = BinarySearcher.BinarySearch<int>(list, 6);
            int expectedIndex = sortedList.IndexOf(6);

            Assert.Equal(expectedIndex, itemIndex);

            //list of strings
            IList<string> animals = new List<string> {"lion", "cat", "tiger", "bee", "sparrow"};
            IList<string> sortedAnimals = BinarySearcher.MergeSort<string>(animals);

            int actualIndex = BinarySearcher.BinarySearch<string>(animals, "cat");
            int expectedAnimalIndex = sortedAnimals.IndexOf("cat");

            Assert.Equal(expectedAnimalIndex, actualIndex);

        }

        [Fact]
        public static void NullCollectionExceptionTest()
        {
            IList<int> list = null;
            Assert.Throws<System.NullReferenceException>(() => BinarySearcher.BinarySearch<int>(list,0));
        }

    }
}

Add test for BinarySearcher class

Add test for BinarySearcher class


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

namespace osu.Game.Graphics.Containers
{
    public class ShakeContainer : Container
    {
        public void Shake()
        {
            const int shake_amount = 8;
            const int shake_duration = 20;

            this.MoveToX(shake_amount, shake_duration).Then()
                .MoveToX(-shake_amount, shake_duration).Then()
                .MoveToX(shake_amount, shake_duration).Then()
                .MoveToX(-shake_amount, shake_duration).Then()
                .MoveToX(shake_amount, shake_duration).Then()
                .MoveToX(0, shake_duration);
        }
    }
}

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

namespace osu.Game.Graphics.Containers
{
    public class ShakeContainer : Container
    {
        public void Shake()
        {
            const float shake_amount = 8;
            const float shake_duration = 30;

            this.MoveToX(shake_amount, shake_duration / 2, Easing.OutSine).Then()
                .MoveToX(-shake_amount, shake_duration, Easing.InOutSine).Then()
                .MoveToX(shake_amount, shake_duration, Easing.InOutSine).Then()
                .MoveToX(-shake_amount, shake_duration, Easing.InOutSine).Then()
                .MoveToX(shake_amount, shake_duration, Easing.InOutSine).Then()
                .MoveToX(0, shake_duration / 2, Easing.InSine);
        }
    }
}

Adjust transform to look better

Adjust transform to look better


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

using System;
using osu.Framework.Bindables;

namespace osu.Game.Tournament.Models
{
    /// <summary>
    /// Holds the complete data required to operate the tournament system.
    /// </summary>
    [Serializable]
    public class StableInfo
    {
        public Bindable<string> StablePath = new Bindable<string>(string.Empty);
    }
}

Introduce model to store path of stable osu!


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

namespace SCPI
{
    public class AUTOSCALE : ICommand
    {
        public string Description => "The oscilloscope will automatically adjust the vertical scale, horizontal timebase, and trigger mode according to the input signal to realize optimum waveform display";

        public string Command(params string[] parameters) => ":AUToscale";

        public string HelpMessage() => nameof(AUTOSCALE);

        public bool Parse(byte[] data) => true;
    }
}

Add the support for autoscale SCPI command


using System;
using System.Linq.Expressions;

namespace Nest.Resolvers
{
	public static class Property
	{
		/// <summary>
		/// Create a strongly typed string representation of the path to a property
		/// <para>i.e p => p.Arrary.First().SubProperty.Field will return 'array.subProperty.field'</para>
		/// </summary>
		/// <typeparam name="T">The type of the object</typeparam>
		/// <param name="path">The path we want to specify</param>
		/// <param name="boost">An optional ^boost postfix, only make sense with queries</param>
		public static PropertyPathMarker Path<T>(Expression<Func<T, object>> path, double? boost = null)
			where T : class
		{
			return PropertyPathMarker.Create(path, boost);
		}

		/// <summary>
		/// Create a strongly typed string representation of the name to a property
		/// <para>i.e p => p.Arrary.First().SubProperty.Field will return 'field'</para>
		/// </summary>
		/// <typeparam name="T">The type of the object</typeparam>
		/// <param name="path">The path we want to specify</param>
		/// <param name="boost">An optional ^boost postfix, only make sense with queries</param>
		public static PropertyNameMarker Name<T>(Expression<Func<T, object>> path, double? boost = null)
			where T : class
		{
			return PropertyNameMarker.Create(path, boost);
		}
	}
}

using System;
using System.Linq.Expressions;

namespace Nest.Resolvers
{
	public static class Property
	{
		/// <summary>
		/// Create a strongly typed string representation of the path to a property
		/// <para>i.e p => p.Array.First().SubProperty.Field will return 'array.subProperty.field'</para>
		/// </summary>
		/// <typeparam name="T">The type of the object</typeparam>
		/// <param name="path">The path we want to specify</param>
		/// <param name="boost">An optional ^boost postfix, only make sense with queries</param>
		public static PropertyPathMarker Path<T>(Expression<Func<T, object>> path, double? boost = null)
			where T : class
		{
			return PropertyPathMarker.Create(path, boost);
		}

		/// <summary>
		/// Create a strongly typed string representation of the name to a property
		/// <para>i.e p => p.Array.First().SubProperty.Field will return 'field'</para>
		/// </summary>
		/// <typeparam name="T">The type of the object</typeparam>
		/// <param name="path">The path we want to specify</param>
		/// <param name="boost">An optional ^boost postfix, only make sense with queries</param>
		public static PropertyNameMarker Name<T>(Expression<Func<T, object>> path, double? boost = null)
			where T : class
		{
			return PropertyNameMarker.Create(path, boost);
		}
	}
}

Fix typo: Arrary --> Array

Fix typo: Arrary --> Array


using System;

namespace Quartz.DynamoDB.Tests.Integration.JobStore
{
    /// <summary>
    /// Abstract class that provides common dynamo db cleanup for JobStore integration testing.
    /// </summary>
    public abstract class JobStoreIntegrationTest : IDisposable
    {
        protected DynamoDB.JobStore _sut;

        protected DynamoClientFactory _testFactory;

        #region IDisposable implementation

        bool _disposedValue = false;

        protected virtual void Dispose(bool disposing)
        {
            if (!_disposedValue)
            {
                if (disposing)
                {
                    _testFactory.CleanUpDynamo();

                    if (_sut != null)
                    {
                        _sut.Dispose();
                    }
                }

                _disposedValue = true;
            }
        }

        // This code added to correctly implement the disposable pattern.
        public void Dispose()
        {
            // Do not change this code. Put cleanup code in Dispose(bool disposing) above.
            Dispose(true);
        }

        #endregion
    }
}

Move JobStore cleanup to abstract class.


using System;
using System.Collections.Generic;

namespace KLibrary.Linq
{
    public static class Comparison
    {
        public static IComparer<T> CreateComparer<T>(Func<T, T, int> compare)
        {
            return new DelegateComparer<T>(compare);
        }

        public static IEqualityComparer<T> CreateEqualityComparer<T>(Func<T, T, bool> equals)
        {
            return new DelegateEqualityComparer<T>(equals);
        }
    }

    class DelegateComparer<T> : Comparer<T>
    {
        Func<T, T, int> _compare;

        public DelegateComparer(Func<T, T, int> compare)
        {
            if (compare == null) throw new ArgumentNullException("compare");
            _compare = compare;
        }

        public override int Compare(T x, T y)
        {
            return _compare(x, y);
        }
    }

    class DelegateEqualityComparer<T> : EqualityComparer<T>
    {
        Func<T, T, bool> _equals;

        public DelegateEqualityComparer(Func<T, T, bool> equals)
        {
            if (equals == null) throw new ArgumentNullException("equals");
            _equals = equals;
        }

        public override bool Equals(T x, T y)
        {
            return _equals(x, y);
        }

        public override int GetHashCode(T obj)
        {
            return obj != null ? obj.GetHashCode() : 0;
        }
    }
}

Copy source code from KLibrary-Labs

Copy source code from KLibrary-Labs


// 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.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Online.Multiplayer;
using osu.Game.Screens.Multi.Match.Components;

namespace osu.Game.Tests.Visual
{
    public class TestCaseMatchSettingsOverlay : OsuTestCase
    {
        public TestCaseMatchSettingsOverlay()
        {
            Child = new RoomSettingsOverlay(new Room())
            {
                RelativeSizeAxes = Axes.Both,
                State = Visibility.Visible
            };
        }
    }
}

Implement testcase for room settings

Implement testcase for room settings


using System;

namespace Glimpse.Server
{
    public class LocalBrokerPublisher : IBrokerPublisher
    {
        public void PublishMessage(IMessage message)
        {
            // TODO: push straight to the bus
        }
    }
}

Add stub implementation of local

Add stub implementation of local


using UnityEngine;
using System.Collections;
using UnityEditor;

namespace Expanse
{
    /// <summary>
    /// Exits play mode automatically when Unity performs code compilation.
    /// </summary>
    [InitializeOnLoad]
    public class ExitPlayModeOnCompile
    {
        private static ExitPlayModeOnCompile instance = null;

        static ExitPlayModeOnCompile()
        {
            instance = new ExitPlayModeOnCompile();
        }

        private ExitPlayModeOnCompile()
        {
            EditorApplication.update += OnEditorUpdate;
        }

        ~ExitPlayModeOnCompile()
        {
            EditorApplication.update -= OnEditorUpdate;

            if (instance == this)
                instance = null;
        }

        private static void OnEditorUpdate()
        {
            if (EditorApplication.isPlaying && EditorApplication.isCompiling)
            {
                EditorApplication.isPlaying = false;
            }
        }
    }
}

Add auto exit play mode on compile

Add auto exit play mode on compile


using System;
using System.Runtime.CompilerServices;

namespace NSec.Experimental
{
    public static class CryptographicUtilities
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static void FillRandomBytes(Span<byte> data)
        {
            System.Security.Cryptography.RandomNumberGenerator.Fill(data);
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static bool FixedTimeEquals(ReadOnlySpan<byte> left, ReadOnlySpan<byte> right)
        {
            return System.Security.Cryptography.CryptographicOperations.FixedTimeEquals(left, right);
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static void ZeroMemory(Span<byte> buffer)
        {
            System.Security.Cryptography.CryptographicOperations.ZeroMemory(buffer);
        }
    }
}

Add constant time functions and functions for generating random bytes

Contributes to #58


namespace TestHttpCompositionConsoleApp.ConfigurationSources
{
    using System;
    using Newtonsoft.Json;
    using Serviceable.Objects.Composition.Graph;
    using Serviceable.Objects.Composition.Graph.Stages.Configuration;
    using Serviceable.Objects.Composition.Service;
    using Serviceable.Objects.IO.NamedPipes.Server;
    using Serviceable.Objects.IO.NamedPipes.Server.Configuration;
    using Serviceable.Objects.Remote.Composition.ServiceContainer.Configuration;

    public sealed class ServiceContainerConfigurationSource : IConfigurationSource
    {
        public string GetConfigurationValueForKey(IService service, GraphContext graphContext, GraphNodeContext graphNodeContext, Type type)
        {
            switch (type)
            {
                case var t when t == typeof(NamedPipeServerContext):
                    return JsonConvert.SerializeObject(new NamedPipeServerConfiguration
                    {
                        PipeName  = "testpipe"
                    });
                case var t when t == typeof(ServiceContainerContextConfiguration):
                    return JsonConvert.SerializeObject(new ServiceContainerContextConfiguration
                    {
                        ContainerName = "container-X",
                        OrchestratorName = "orchestrator-X",
                    });
                default:
                    throw new InvalidOperationException($"Type {type.FullName} is not supported.");
            }
        }
    }
}

Add new configuration for ServiceContainer


using System;

namespace ISAAR.MSolve.Analyzers.Optimization.Commons
{
    public static class VectorOperations
    {
        public static double[] Add(double[] v1, double[] v2)
        {
            CheckDimensions(v1, v2);

            double[] result = new double[v1.Length];

            for (int i = 0; i < v1.Length; i++)
            {
                result[i] = v1[i] + v2[i];
            }
            return result;
        }

        public static double[] Scale(double scalar, double[] vector)
        {
            double[] result = new double[vector.Length];

            for (int i = 0; i < vector.Length; i++)
            {
                result[i] = scalar * vector[i];
            }
            return result;
        }

        public static double[] Subtract(double[] v1, double[] v2)
        {
            CheckDimensions(v1, v2);

            double[] result = new double[v1.Length];

            for (int i = 0; i < v1.Length; i++)
            {
                result[i] = v1[i] - v2[i];
            }
            return result;
        }

        private static void CheckDimensions(double[] v1, double[] v2)
        {
            if (v1.Length != v2.Length)
            {
                throw new ArgumentException("Vectors must have equal lengths!");
            }
        }
    }
}

Add a class to perform basic vector operations (addition, subtraction, scaling) for the optimization needs.

Signed-off-by: Manolis Georgioudakis <456a0d25592ed010f911d8d9039f21c89b888768@mail.ntua.gr>


namespace food_tracker {
    public interface IListItems {
        double calories { get; set; }
        double amount { get; set; }
        double fats { get; set; }
        double saturatedFat { get; set; }
        double carbohydrates { get; set; }
        double sugar { get; set; }
        double protein { get; set; }
        double salt { get; set; }
        double fibre { get; set; }
        string name { get; set; }
        int nutritionId { get; set; }
    }
}

Add interface for common properties

Add interface for common properties