// Original Work Copyright (c) Ethan Moffat 2014-2016
// This file is subject to the GPL v2 License
// For additional details, see the LICENSE file

using EndlessClient.GameExecution;
using EndlessClient.Rendering.Factories;
using EOLib.IO.Repositories;

namespace EndlessClient
{
    //todo: move this to a different namespace
    public class TestModeLauncher : ITestModeLauncher
    {
        private readonly IEndlessGameProvider _endlessGameProvider;
        private readonly ICharacterRendererFactory _characterRendererFactory;
        private readonly IEIFFileProvider _eifFileProvider;
        private readonly IGameStateProvider _gameStateProvider;

        public TestModeLauncher(IEndlessGameProvider endlessGameProvider,
                                ICharacterRendererFactory characterRendererFactory,
                                IEIFFileProvider eifFileProvider,
                                IGameStateProvider gameStateProvider)
        {
            _endlessGameProvider = endlessGameProvider;
            _characterRendererFactory = characterRendererFactory;
            _eifFileProvider = eifFileProvider;
            _gameStateProvider = gameStateProvider;
        }

        public void LaunchTestMode()
        {
            if (_gameStateProvider.CurrentState != GameStates.Initial)
                return;

            var testMode = new CharacterStateTest(
                _endlessGameProvider.Game,
                _characterRendererFactory,
                _eifFileProvider);

            _endlessGameProvider.Game.Components.Clear();
            _endlessGameProvider.Game.Components.Add(testMode);
        }
    }

    public interface ITestModeLauncher
    {
        void LaunchTestMode();
    }
}

// Original Work Copyright (c) Ethan Moffat 2014-2016
// This file is subject to the GPL v2 License
// For additional details, see the LICENSE file

using EndlessClient.GameExecution;
using EndlessClient.Rendering.Factories;
using EOLib.IO.Repositories;

namespace EndlessClient
{
    //todo: move this to a different namespace
    public class TestModeLauncher : ITestModeLauncher
    {
        private readonly IEndlessGameProvider _endlessGameProvider;
        private readonly ICharacterRendererFactory _characterRendererFactory;
        private readonly IEIFFileProvider _eifFileProvider;
        private readonly IGameStateProvider _gameStateProvider;

        public TestModeLauncher(IEndlessGameProvider endlessGameProvider,
                                ICharacterRendererFactory characterRendererFactory,
                                IEIFFileProvider eifFileProvider,
                                IGameStateProvider gameStateProvider)
        {
            _endlessGameProvider = endlessGameProvider;
            _characterRendererFactory = characterRendererFactory;
            _eifFileProvider = eifFileProvider;
            _gameStateProvider = gameStateProvider;
        }

        public void LaunchTestMode()
        {
            if (_gameStateProvider.CurrentState != GameStates.None)
                return;

            var testMode = new CharacterStateTest(
                _endlessGameProvider.Game,
                _characterRendererFactory,
                _eifFileProvider);

            _endlessGameProvider.Game.Components.Clear();
            _endlessGameProvider.Game.Components.Add(testMode);
        }
    }

    public interface ITestModeLauncher
    {
        void LaunchTestMode();
    }
}

Fix bug where test mode wouldn't launch

Fix bug where test mode wouldn't launch


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

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

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

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

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

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

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


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

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

[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.0.0.0")]
[assembly: AssemblyConfiguration("Release built on 2013-02-22 14:39")]
[assembly: AssemblyCopyright("Copyright © 2013 Autofac Contributors")]

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

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

[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.0.0.0")]
[assembly: AssemblyConfiguration("Release built on 2013-02-28 02:03")]
[assembly: AssemblyCopyright("Copyright © 2013 Autofac Contributors")]

Build script now creates individual zip file packages to align with the NuGet packages and semantic versioning.


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

namespace ItemCollage
{
    public static class Helper
    {
        public static IEnumerable<int> Range(int start, int end, int step = 1)
        {
            if (start > end && step > 0 ||
                start < end && step < 0 ||
                step == 0)
                throw new ArgumentException("Impossible range");

            int steps = (end - start) / step;
            int i, s;
            for (i = start, s = 0; s <= steps; i += step, s++)
            {
                yield return i;
            }
        }
    }
}

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

namespace ItemCollage
{
    public static class Helper
    {
        public static IEnumerable<int> Range(int start, int end, int step = 1)
        {
            if (start > end && step > 0 ||
                start < end && step < 0 ||
                step == 0)
                throw new ArgumentException(string.Format(
                    "Impossible range: {0} to {1} with step {2}", start, end, step));

            int steps = (end - start) / step;
            int i, s;
            for (i = start, s = 0; s <= steps; i += step, s++)
            {
                yield return i;
            }
        }
    }
}

Make Range report invalid arguments when throwing


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

// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.

[assembly: AssemblyTitle("ChangeLoadingImage_beta")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.

[assembly: AssemblyVersion("1.0.*")]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.

//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

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

// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.

[assembly: AssemblyTitle("ChangeLoadingImage1.0")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.

[assembly: AssemblyVersion("1.0.*")]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.

//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

Change assembly version for release

Change assembly version for release


using System;
using System.Runtime.Serialization;

[DataContract]
class TellEntry
{
    [DataMember]
    public readonly string From;
    [DataMember]
    public readonly string Message;
    [DataMember]
    public readonly DateTimeOffset SentDate;

    public TimeSpan ElapsedTime
    {
        get
        {
            return DateTimeOffset.Now - SentDate;
        }
    }

    public TellEntry(string from, string message)
    {
        From = from;
        Message = message;
        SentDate = DateTimeOffset.Now;
    }
}

using System;
using System.Runtime.Serialization;

[DataContract]
class TellEntry
{
    [DataMember]
    public readonly string From;
    [DataMember]
    public readonly string Message;
    [DataMember]
    public readonly DateTime SentDateUtc;

    public TimeSpan ElapsedTime
    {
        get
        {
            return DateTime.UtcNow - SentDateUtc;
        }
    }

    public TellEntry(string from, string message)
    {
        From = from;
        Message = message;
        SentDateUtc = DateTime.UtcNow;
    }
}

Store sent date in UTC

Tell: Store sent date in UTC


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

[assembly: AssemblyTitle("Spring.Core Tests")]
[assembly: AssemblyDescription("Unit tests for Spring.Core assembly")]

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

#if NET_4_0
[assembly: System.Security.SecurityRules(System.Security.SecurityRuleSet.Level1)]
#endif
[assembly: AssemblyTitle("Spring.Core Tests")]
[assembly: AssemblyDescription("Unit tests for Spring.Core assembly")]

Add 'side by side' support in Framework .NET 4.0 [SPRNET-1320]


using System;
using System.IO;
using Digipost.Signature.Api.Client.Core.Internal.Asice;
using Digipost.Signature.Api.Client.Core.Internal.Extensions;

namespace Digipost.Signature.Api.Client.Core
{
    public class Document : IAsiceAttachable
    {
        public Document(string title, FileType fileType, string documentPath)
            : this(title, fileType, File.ReadAllBytes(documentPath))
        {
        }

        public Document(string title, FileType fileType, byte[] documentBytes)
        {
            Title = title;
            FileName = $"{title}{fileType.GetExtension()}";
            MimeType = fileType.ToMimeType();
            Bytes = documentBytes;
            Id = "Id_" + Guid.NewGuid();
        }

        public string Title { get; }

        public string FileName { get; }

        public string Id { get; }

        public string MimeType { get; }

        public byte[] Bytes { get; }

        public override string ToString()
        {
            return $"Title: {Title}, Id: {Id}, MimeType: {MimeType}";
        }
    }
}

using System;
using System.IO;
using Digipost.Signature.Api.Client.Core.Internal.Asice;
using Digipost.Signature.Api.Client.Core.Internal.Extensions;

namespace Digipost.Signature.Api.Client.Core
{
    public class Document : IAsiceAttachable
    {
        public Document(string title, FileType fileType, string documentPath)
            : this(title, fileType, File.ReadAllBytes(documentPath))
        {
        }

        public Document(string title, FileType fileType, byte[] documentBytes)
        {
            Title = title;
            FileName = $"{Guid.NewGuid()}{fileType.GetExtension()}";
            MimeType = fileType.ToMimeType();
            Bytes = documentBytes;
            Id = "Id_" + Guid.NewGuid();
        }

        public string Title { get; }

        public string FileName { get; }

        public string Id { get; }

        public string MimeType { get; }

        public byte[] Bytes { get; }

        public override string ToString()
        {
            return $"Title: {Title}, Id: {Id}, MimeType: {MimeType}";
        }
    }
}

Make sure filename / href in document bundle are unique


using System;
using System.Collections.Generic;
using System.Linq;
using NuGet.Packaging.Core;
using NuGet.Versioning;

namespace NuKeeper.RepositoryInspection
{
    public class PackageUpdateSet
    {
        public PackageUpdateSet(PackageIdentity newPackage, IEnumerable<PackageInProject> currentPackages)
        {
            if (newPackage == null)
            {
                throw new ArgumentNullException(nameof(newPackage));
            }

            if (currentPackages == null)
            {
                throw new ArgumentNullException(nameof(currentPackages));
            }

            if (!currentPackages.Any())
            {
                throw new ArgumentException($"{nameof(currentPackages)} is empty");
            }

            if (currentPackages.Any(p => p.Id != newPackage.Id))
            {
                throw new ArgumentException($"Updates must all be for package {newPackage.Id}");
            }

            NewPackage = newPackage;
            CurrentPackages = currentPackages.ToList();
        }

        public PackageIdentity NewPackage { get; }

        public List<PackageInProject> CurrentPackages { get; }

        public string PackageId => NewPackage.Id;
        public NuGetVersion NewVersion => NewPackage.Version;
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using NuGet.Packaging.Core;
using NuGet.Versioning;

namespace NuKeeper.RepositoryInspection
{
    public class PackageUpdateSet
    {
        public PackageUpdateSet(PackageIdentity newPackage, IEnumerable<PackageInProject> currentPackages)
        {
            if (newPackage == null)
            {
                throw new ArgumentNullException(nameof(newPackage));
            }

            if (currentPackages == null)
            {
                throw new ArgumentNullException(nameof(currentPackages));
            }

            var currentPackagesList = currentPackages.ToList();

            if (!currentPackagesList.Any())
            {
                throw new ArgumentException($"{nameof(currentPackages)} is empty");
            }

            if (currentPackagesList.Any(p => p.Id != newPackage.Id))
            {
                throw new ArgumentException($"Updates must all be for package {newPackage.Id}");
            }

            NewPackage = newPackage;
            CurrentPackages = currentPackagesList;
        }

        public PackageIdentity NewPackage { get; }

        public IReadOnlyCollection<PackageInProject> CurrentPackages { get; }

        public string PackageId => NewPackage.Id;
        public NuGetVersion NewVersion => NewPackage.Version;
    }
}

Enumerate once, make it readonly

Enumerate once, make it readonly


using System;
using LandauMedia.Telemetry.Internal;

namespace LandauMedia.Telemetry
{
    public class Counter : ITelemeter
    {
        readonly Lazy<string> _lazyName;
        Action<Lazy<string>, int> _decrement;
        Action<Lazy<string>> _decrementByOne;
        Action<Lazy<string>, int> _icnremnent;
        Action<Lazy<string>> _increamentByOne;

        internal Counter(LazyName lazyName)
        {
            _lazyName = lazyName.Get(this);
        }

        void ITelemeter.ChangeImplementation(ITelemeterImpl impl)
        {
            _increamentByOne = impl.GetCounterIncrementByOne();
            _icnremnent = impl.GetCounterIncrement();
            _decrement = impl.GetCounterDecrement();
            _decrementByOne = impl.GetCounterDecrementByOne();
        }

        public void Increment()
        {
            _increamentByOne(_lazyName);
        }

        public void Increment(int count)
        {
            _icnremnent(_lazyName, count);
        }

        public void Decrement()
        {
            _decrementByOne(_lazyName);
        }

        public void Decrement(int count)
        {
            _decrement(_lazyName, count);
        }
    }
}

using System;
using LandauMedia.Telemetry.Internal;

namespace LandauMedia.Telemetry
{
    public class Counter : ITelemeter
    {
        readonly Lazy<string> _lazyName;
        Action<Lazy<string>, int> _decrement;
        Action<Lazy<string>> _decrementByOne;
        Action<Lazy<string>, int> _icnremnent;
        Action<Lazy<string>> _increamentByOne;

        internal Counter(LazyName lazyName)
        {
            _lazyName = lazyName.Get(this);
        }

        void ITelemeter.ChangeImplementation(ITelemeterImpl impl)
        {
            _increamentByOne = impl.GetCounterIncrementByOne();
            _icnremnent = impl.GetCounterIncrement();
            _decrement = impl.GetCounterDecrement();
            _decrementByOne = impl.GetCounterDecrementByOne();
        }

        public void Increment()
        {
            _increamentByOne(_lazyName);
        }

        public void Increment(int count)
        {
            if(count==0) return;
            _icnremnent(_lazyName, count);
        }

        public void Decrement()
        {
            _decrementByOne(_lazyName);
        }

        public void Decrement(int count)
        {
            if(count==0) return;
            _decrement(_lazyName, count);
        }
    }
}

Increment and Decrement with 0 does not send any data.


using System;
using CSharpTraining;
using MonoBrickFirmware.Movement;

namespace XUnitSample.Tests
{
	/// <summary>
	/// Sample test class
	/// </summary>
	/// <remarks>
	/// It was described below URL how to use XUnit
	/// https://xunit.github.io/docs/comparisons.html
	/// </remarks>
	public class MainClassTests
	{
		[Xunit.Fact(DisplayName = "We can describe test summary by this attribute."), Xunit.Trait("Category", "Sample")]
		public void MainTest()
		{
			Xunit.Assert.True(true);
			Xunit.Assert.Equal(10, MainClass.SampleMethod());
			var foo = new Motor(MotorPort.OutA);
			var same = foo;
			Xunit.Assert.Same(foo, same); // Verify their variables are same object.
		}

		[Xunit.Fact(Skip="If you want to ignore test case, you set this attribute to the test case.")]
		public void IgnoreTest()
		{
			Xunit.Assert.True(false, "Expected this test case does not be executed.");
			MainClass.Main(new string[] { "" });
			Motor dummy = new Motor(MotorPort.OutA);
			dummy.GetSpeed();
		}
	}
}

using System;
using CSharpTraining;
using MonoBrickFirmware.Movement;

namespace XUnitSample.Tests
{
	/// <summary>
	/// Sample test class
	/// </summary>
	/// <remarks>
	/// It was described below URL how to use XUnit
	/// https://xunit.github.io/docs/comparisons.html
	/// </remarks>
	public class MainClassTests
	{
		[Xunit.Fact(DisplayName = "We can describe test summary by this attribute."), Xunit.Trait("Category", "Sample")]
		public void MainTest()
		{
			Xunit.Assert.True(true);
			Xunit.Assert.Equal(10, MainClass.SampleMethod());
			var foo = new Object();
			var same = foo;
			Xunit.Assert.Same(foo, same); // Verify their variables are same object.
		}

		[Xunit.Fact(Skip="If you want to ignore test case, you set this attribute to the test case.")]
		public void IgnoreTest()
		{
			Xunit.Assert.True(false, "Expected this test case does not be executed.");
			MainClass.Main(new string[] { "" });
			Motor dummy = new Motor(MotorPort.OutA);
			dummy.GetSpeed();
		}
	}
}

Change instance from Motor to Object in test case


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

namespace WebLinq.Zip
{
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Net.Http;

    public static class ZipQuery
    {
        public static IEnumerable<HttpFetch<Zip>> DownloadZip(this IEnumerable<HttpFetch<HttpContent>> query) =>
            from fetch in query
            select fetch.WithContent(new Zip(DownloadZip(fetch.Content)));

        static string DownloadZip(HttpContent content)
        {
            var path = Path.GetTempFileName();
            using (var output = File.Create(path))
                content.CopyToAsync(output).Wait();
            return path;
        }
    }
}

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

namespace WebLinq.Zip
{
    using System;
    using System.IO;
    using System.Net.Http;
    using System.Reactive.Linq;
    using System.Threading.Tasks;

    public static class ZipQuery
    {
        public static IObservable<HttpFetch<Zip>> DownloadZip(this IObservable<HttpFetch<HttpContent>> query) =>
            from fetch in query
            from path in DownloadZip(fetch.Content)
            select fetch.WithContent(new Zip(path));

        static async Task<string> DownloadZip(HttpContent content)
        {
            var path = Path.GetTempFileName();
            using (var output = File.Create(path))
                await content.CopyToAsync(output);
            return path;
        }
    }
}

Fix zip download to be non-blocking

Fix zip download to be non-blocking


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

using osu.Framework.Input;
using OpenTK;
using OpenTK.Input;

namespace osu.Game.Screens.Play
{
    public class KeyCounterMouse : KeyCounter
    {
        public MouseButton Button { get; }
        public KeyCounterMouse(MouseButton button) : base(button.ToString())
        {
            Button = button;
        }

        public override bool Contains(Vector2 screenSpacePos) => true;

        protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
        {
            if (args.Button == Button) IsLit = true;
            return base.OnMouseDown(state, args);
        }

        protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
        {
            if (args.Button == Button) IsLit = false;
            return base.OnMouseUp(state, args);
        }
    }
}

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

using osu.Framework.Input;
using OpenTK;
using OpenTK.Input;

namespace osu.Game.Screens.Play
{
    public class KeyCounterMouse : KeyCounter
    {
        public MouseButton Button { get; }

        public KeyCounterMouse(MouseButton button) : base(getStringRepresentation(button))
        {
            Button = button;
        }

        private static string getStringRepresentation(MouseButton button)
        {
            switch (button)
            {
                default:
                    return button.ToString();
                case MouseButton.Left:
                    return @"M1";
                case MouseButton.Right:
                    return @"M2";
            }
        }

        public override bool Contains(Vector2 screenSpacePos) => true;

        protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
        {
            if (args.Button == Button) IsLit = true;
            return base.OnMouseDown(state, args);
        }

        protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
        {
            if (args.Button == Button) IsLit = false;
            return base.OnMouseUp(state, args);
        }
    }
}

Fix KeyCounter M1 M2 display.

Fix KeyCounter M1 M2 display.


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

namespace Sample.Forms.UWP
{
	public sealed partial class MainPage
	{
		public MainPage()
		{
			this.InitializeComponent();

			LoadApplication(new Sample.Forms.App());
		}
	}
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

namespace Sample.Forms.UWP
{
	public sealed partial class MainPage
	{
		public MainPage()
		{
			this.InitializeComponent();

			LoadApplication(new Sample.Forms.App());

			ZXing.Net.Mobile.Forms.WindowsUniversal.ZXingScannerViewRenderer.Init();
			ZXing.Net.Mobile.Forms.WindowsUniversal.ZXingBarcodeImageViewRenderer.Init();

		}
	}
}

Add platform init calls for UWP

Add platform init calls for UWP

Fixes #964


using CK.Glouton.Model.Server.Handlers.Implementation;
using CK.Glouton.Model.Services;
using Microsoft.AspNetCore.Mvc;

namespace CK.Glouton.Web.Controllers
{
    [Route( "api/alert" )]
    public class AlertController : Controller
    {
        private readonly IAlertService _alertService;

        public AlertController( IAlertService alertService )
        {
            _alertService = alertService;
        }

        [HttpPost( "add" )]
        public object AddAlert( [FromBody] AlertExpressionModel alertExpressionModel )
        {
            if( _alertService.NewAlertRequest( alertExpressionModel ) )
                return Ok();
            return BadRequest();
        }

        [HttpGet( "configuration/{key}" )]
        public object GetConfiguration( string key )
        {
            if( _alertService.TryGetConfiguration( key, out var configuration ) )
                return configuration;
            return BadRequest();

        }

        [HttpGet( "configuration" )]
        public string[] GetAllConfiguration()
        {
            return _alertService.AvailableConfiguration;
        }

        [HttpGet( "all" )]
        public object GetAllAlerts()
        {
            return _alertService.GetAllAlerts();
        }
    }
}

using CK.Glouton.Model.Server.Handlers.Implementation;
using CK.Glouton.Model.Services;
using Microsoft.AspNetCore.Mvc;

namespace CK.Glouton.Web.Controllers
{
    [Route( "api/alert" )]
    public class AlertController : Controller
    {
        private readonly IAlertService _alertService;

        public AlertController( IAlertService alertService )
        {
            _alertService = alertService;
        }

        [HttpPost( "add" )]
        public object AddAlert( [FromBody] AlertExpressionModel alertExpressionModel )
        {
            if( _alertService.NewAlertRequest( alertExpressionModel ) )
                return NoContent();
            return BadRequest();
        }

        [HttpGet( "configuration/{key}" )]
        public object GetConfiguration( string key )
        {
            if( _alertService.TryGetConfiguration( key, out var configuration ) )
                return configuration;
            return BadRequest();

        }

        [HttpGet( "configuration" )]
        public string[] GetAllConfiguration()
        {
            return _alertService.AvailableConfiguration;
        }

        [HttpGet( "all" )]
        public object GetAllAlerts()
        {
            return _alertService.GetAllAlerts();
        }
    }
}

Fix issues with endpoint add of alert controller.


// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

using System;
using System.ComponentModel.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CommentSelection;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Operations;
using Microsoft.VisualStudio.Utilities;
using VSCommanding = Microsoft.VisualStudio.Commanding;

namespace Microsoft.CodeAnalysis.Editor.Implementation.CommentSelection
{
    /* TODO - Modify these once the toggle block comment handler is added.
    [Export(typeof(VSCommanding.ICommandHandler))]
    [ContentType(ContentTypeNames.RoslynContentType)]
    [Name(PredefinedCommandHandlerNames.CommentSelection)]*/
    internal class ToggleBlockCommentCommandHandler : AbstractToggleBlockCommentBase
    {
        [ImportingConstructor]
        internal ToggleBlockCommentCommandHandler(
            ITextUndoHistoryRegistry undoHistoryRegistry,
            IEditorOperationsFactoryService editorOperationsFactoryService)
            : base(undoHistoryRegistry, editorOperationsFactoryService)
        {
        }

        /// <summary>
        /// Gets the default text based document data provider for block comments.
        /// </summary>
        protected override async Task<IToggleBlockCommentDocumentDataProvider> GetBlockCommentDocumentDataProvider(Document document, ITextSnapshot snapshot,
            CommentSelectionInfo commentInfo, CancellationToken cancellationToken)
        {
            return new ToggleBlockCommentDocumentDataProvider(snapshot, commentInfo);
        }
    }
}

// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

using System;
using System.ComponentModel.Composition;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.CommentSelection;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Operations;
using Microsoft.VisualStudio.Utilities;
using VSCommanding = Microsoft.VisualStudio.Commanding;

namespace Microsoft.CodeAnalysis.Editor.Implementation.CommentSelection
{
    /* TODO - Modify these once the toggle block comment handler is added.
    [Export(typeof(VSCommanding.ICommandHandler))]
    [ContentType(ContentTypeNames.RoslynContentType)]
    [Name(PredefinedCommandHandlerNames.CommentSelection)]*/
    internal class ToggleBlockCommentCommandHandler : AbstractToggleBlockCommentBase
    {
        [ImportingConstructor]
        internal ToggleBlockCommentCommandHandler(
            ITextUndoHistoryRegistry undoHistoryRegistry,
            IEditorOperationsFactoryService editorOperationsFactoryService)
            : base(undoHistoryRegistry, editorOperationsFactoryService)
        {
        }

        /// <summary>
        /// Gets the default text based document data provider for block comments.
        /// </summary>
        protected override Task<IToggleBlockCommentDocumentDataProvider> GetBlockCommentDocumentDataProvider(Document document, ITextSnapshot snapshot,
            CommentSelectionInfo commentInfo, CancellationToken cancellationToken)
        {
            IToggleBlockCommentDocumentDataProvider provider = new ToggleBlockCommentDocumentDataProvider(snapshot, commentInfo);
            return Task.FromResult(provider);
        }
    }
}

Fix async warning in toggle block comment.


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

using OpenTK.Graphics;
using OpenTK.Input;
using osu.Framework.Input;
using System;

namespace osu.Game.Graphics.UserInterface
{
    /// <summary>
    /// A textbox which holds focus eagerly.
    /// </summary>
    public class FocusedTextBox : OsuTextBox
    {
        protected override Color4 BackgroundUnfocused => new Color4(10, 10, 10, 255);
        protected override Color4 BackgroundFocused => new Color4(10, 10, 10, 255);

        public Action Exit;

        private bool focus;
        public bool HoldFocus
        {
            get { return focus; }
            set
            {
                focus = value;
                if (!focus && HasFocus)
                    GetContainingInputManager().ChangeFocus(null);
            }
        }

        protected override void OnFocus(InputState state)
        {
            base.OnFocus(state);
            BorderThickness = 0;
        }

        protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
        {
            if (!args.Repeat && args.Key == Key.Escape)
            {
                if (Text.Length > 0)
                    Text = string.Empty;
                else
                    Exit?.Invoke();
                return true;
            }

            return base.OnKeyDown(state, args);
        }

        public override bool RequestsFocus => HoldFocus;
    }
}

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

using OpenTK.Graphics;
using OpenTK.Input;
using osu.Framework.Input;
using System;

namespace osu.Game.Graphics.UserInterface
{
    /// <summary>
    /// A textbox which holds focus eagerly.
    /// </summary>
    public class FocusedTextBox : OsuTextBox
    {
        protected override Color4 BackgroundUnfocused => new Color4(10, 10, 10, 255);
        protected override Color4 BackgroundFocused => new Color4(10, 10, 10, 255);

        public Action Exit;

        public override bool HandleLeftRightArrows => false;

        private bool focus;
        public bool HoldFocus
        {
            get { return focus; }
            set
            {
                focus = value;
                if (!focus && HasFocus)
                    GetContainingInputManager().ChangeFocus(null);
            }
        }

        protected override void OnFocus(InputState state)
        {
            base.OnFocus(state);
            BorderThickness = 0;
        }

        protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
        {
            if (!args.Repeat && args.Key == Key.Escape)
            {
                if (Text.Length > 0)
                    Text = string.Empty;
                else
                    Exit?.Invoke();
                return true;
            }

            return base.OnKeyDown(state, args);
        }

        public override bool RequestsFocus => HoldFocus;
    }
}

Add override to fix left/right arrow control


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

using System.Reflection;
using System.Resources;

[assembly: AssemblyTitle("Microsoft Azure Network Management Library")]
[assembly: AssemblyDescription("Provides Microsoft Azure Network management functions for managing the Microsoft Azure Network service.")]

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

[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Microsoft Azure .NET SDK")]
[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]

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

using System.Reflection;
using System.Resources;

[assembly: AssemblyTitle("Microsoft Azure Network Management Library")]
[assembly: AssemblyDescription("Provides Microsoft Azure Network management functions for managing the Microsoft Azure Network service.")]

[assembly: AssemblyVersion("6.0.0.0")]
[assembly: AssemblyFileVersion("6.1.1.0")]

[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Microsoft Azure .NET SDK")]
[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]

Change assembly version to be major version


using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Core;
using Microsoft.AspNet.Http.Core.Collections;
using Xunit;

namespace MusicStore.Models
{
    public class ShoppingCartTest
    {
        [Fact]
        public void GetCartId_ReturnsCartIdFromCookies()
        {
            // Arrange
            var cartId = "cartId_A";

            var httpContext = new DefaultHttpContext();
            httpContext.SetFeature<IRequestCookiesFeature>(new CookiesFeature("Session=" + cartId));

            var cart = new ShoppingCart(new MusicStoreContext());

            // Act
            var result = cart.GetCartId(httpContext);

            // Assert
            Assert.NotNull(result);
            Assert.Equal(cartId, result);
        }

        private class CookiesFeature : IRequestCookiesFeature
        {
            private readonly RequestCookiesCollection _cookies;

            public CookiesFeature(string cookiesHeader)
            {
                _cookies = new RequestCookiesCollection();
                _cookies.Reparse(cookiesHeader);
            }

            public IReadableStringCollection Cookies
            {
                get { return _cookies; }
            }
        }
    }
}

using System.Collections.Generic;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Http.Core;
using Microsoft.AspNet.Http.Core.Collections;
using Xunit;

namespace MusicStore.Models
{
    public class ShoppingCartTest
    {
        [Fact]
        public void GetCartId_ReturnsCartIdFromCookies()
        {
            // Arrange
            var cartId = "cartId_A";

            var httpContext = new DefaultHttpContext();
            httpContext.SetFeature<IRequestCookiesFeature>(new CookiesFeature("Session", cartId));

            var cart = new ShoppingCart(new MusicStoreContext());

            // Act
            var result = cart.GetCartId(httpContext);

            // Assert
            Assert.NotNull(result);
            Assert.Equal(cartId, result);
        }

        private class CookiesFeature : IRequestCookiesFeature
        {
            private readonly IReadableStringCollection _cookies;

            public CookiesFeature(string key, string value)
            {
                _cookies = new ReadableStringCollection(new Dictionary<string, string[]>()
                {
                    { key, new[] { value } }
                });
            }

            public IReadableStringCollection Cookies
            {
                get { return _cookies; }
            }
        }
    }
}

Handle change to cookie parser.

Handle change to cookie parser.


using System;
using System.Threading;
using UnityEngine;
using UnityEngine.UI;

namespace PatchKit.Unity.Patcher.Licensing
{
    public class KeyLicenseObtainer : MonoBehaviour, ILicenseObtainer
    {
        private State _state = State.None;

        private KeyLicense _keyLicense;

        private Animator _animator;

        public InputField KeyInputField;

        public GameObject ErrorMessage;

        private void Awake()
        {
            _animator = GetComponent<Animator>();
        }

        private void Update()
        {
            _animator.SetBool("IsOpened", _state == State.Obtaining);

            ErrorMessage.SetActive(ShowError);
        }

        public void Cancel()
        {
            _state = State.Cancelled;
        }

        public void Confirm()
        {
            _keyLicense = new KeyLicense
            {
                Key = KeyInputField.text
            };

            _state = State.Confirmed;
        }

        public bool ShowError { get; set; }

        ILicense ILicenseObtainer.Obtain()
        {
            _state = State.Obtaining;

            while (_state != State.Confirmed && _state != State.Cancelled)
            {
                Thread.Sleep(10);
            }

            if (_state == State.Cancelled)
            {
                throw new OperationCanceledException();
            }

            return _keyLicense;
        }

        private enum State
        {
            None,
            Obtaining,
            Confirmed,
            Cancelled
        }
    }
}

using System;
using System.Threading;
using UnityEngine;
using UnityEngine.UI;

namespace PatchKit.Unity.Patcher.Licensing
{
    public class KeyLicenseObtainer : MonoBehaviour, ILicenseObtainer
    {
        private State _state = State.None;

        private KeyLicense _keyLicense;

        private Animator _animator;

        public InputField KeyInputField;

        public GameObject ErrorMessage;

        private void Awake()
        {
            _animator = GetComponent<Animator>();
        }

        private void Update()
        {
            _animator.SetBool("IsOpened", _state == State.Obtaining);

            ErrorMessage.SetActive(ShowError);
        }

        public void Cancel()
        {
            _state = State.Cancelled;
        }

        public void Confirm()
        {
            string key = KeyInputField.text;
            key = key.ToUpper().Trim();

            _keyLicense = new KeyLicense
            {
                Key = KeyInputField.text
            };

            _state = State.Confirmed;
        }

        public bool ShowError { get; set; }

        ILicense ILicenseObtainer.Obtain()
        {
            _state = State.Obtaining;

            while (_state != State.Confirmed && _state != State.Cancelled)
            {
                Thread.Sleep(10);
            }

            if (_state == State.Cancelled)
            {
                throw new OperationCanceledException();
            }

            return _keyLicense;
        }

        private enum State
        {
            None,
            Obtaining,
            Confirmed,
            Cancelled
        }
    }
}

Fix problem with invalid whitespaces and lower characters in input license key code


using System;

namespace WorkshopManager.Forms.RequestsDatabaseView
{
    public class RequestsDatabasePresenter
    {
        private IRequestsDatabaseView _view;

        public RequestsDatabasePresenter(IRequestsDatabaseView view)
        {
            _view = view;
            _view.Presenter = this;

            Init();
        }

        public void Init()
        {
            SetActiveComboBoxDataSource();
        }

        private void SetActiveComboBoxDataSource()
        {
            _view.ActiveDataComboBox = Enum.GetValues(typeof (RequestsCategory));
        }
    }
}

namespace WorkshopManager.Forms.RequestsDatabaseView
{
    public class RequestsDatabasePresenter
    {
        public RequestsDatabasePresenter(IRequestsDatabaseView view)
        {

        }
    }
}

Revert "Added form initialization method in Presenter"

This reverts commit 938944c6b4823cac8ec02abb47794fefecf76d0a.


using System;

namespace KpdApps.Common.MsCrm2015
{
    public class BasePluginAction
    {
        public PluginState State { get; set; }

        public BasePluginAction(PluginState state)
        {
            State = state;
        }

        public virtual void Execute()
        {
            throw new NotImplementedException();
        }
    }
}

using System;
using Microsoft.Xrm.Sdk;

namespace KpdApps.Common.MsCrm2015
{
    public class BasePluginAction
    {
        public PluginState State { get; set; }

        public IOrganizationService Service => State.Service;

        public BasePluginAction(PluginState state)
        {
            State = state;
        }

        public virtual void Execute()
        {
            throw new NotImplementedException();
        }
    }
}

Add short link to Service

Add short link to Service


namespace Cassette.Configuration
{
    public interface IFileSearchModifier<T>
    {
        void Modify(FileSearch fileSearch);
    }
}

namespace Cassette.Configuration
{
// ReSharper disable UnusedTypeParameter
// The T type parameter makes it easy to distinguish between file search modifiers for the different type of bundles
    public interface IFileSearchModifier<T>
        where T : Bundle
// ReSharper restore UnusedTypeParameter
    {
        void Modify(FileSearch fileSearch);
    }
}

Clarify the apparently unused generic type parameter.


using System;

namespace Glimpse.Server
{
    public class GlimpseServerWebOptions
    {
        public bool AllowRemote { get; set; }
    }
}

using System;
using System.Collections.Generic;

namespace Glimpse.Server
{
    public class GlimpseServerWebOptions
    {
        public GlimpseServerWebOptions()
        {
            AllowedUserRoles = new List<string>();
        }

        public bool AllowRemote { get; set; }

        public IList<string> AllowedUserRoles { get; }
    }
}

Add option for allowed user roles

Add option for allowed user roles


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

namespace osu.Game.Benchmarks
{
    public static class Program
    {
        public static void Main(string[] args)
        {
            BenchmarkSwitcher
                .FromAssembly(typeof(Program).Assembly)
                .Run(args);
        }
    }
}

// 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.Configs;
using BenchmarkDotNet.Running;

namespace osu.Game.Benchmarks
{
    public static class Program
    {
        public static void Main(string[] args)
        {
            BenchmarkSwitcher
                .FromAssembly(typeof(Program).Assembly)
                .Run(args, DefaultConfig.Instance.WithOption(ConfigOptions.DisableOptimizationsValidator, true));
        }
    }
}

Disable optimisations validator (in line with framework project)


// 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.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.Rulesets;
using osu.Game.Users;

namespace osu.Game.Scoring
{
    public interface IScoreInfo : IHasOnlineID<long>
    {
        User User { get; }

        long TotalScore { get; }

        int MaxCombo { get; }

        double Accuracy { get; }

        bool HasReplay { get; }

        DateTimeOffset Date { get; }

        double? PP { get; }

        IBeatmapInfo Beatmap { get; }

        IRulesetInfo Ruleset { get; }

        public ScoreRank Rank { get; }

        // Mods is currently missing from this interface as the `IMod` class has properties which can't be fulfilled by `APIMod`,
        // but also doesn't expose `Settings`. We can consider how to implement this in the future if required.

        // Statistics is also missing. This can be reconsidered once changes in serialisation have been completed.
    }
}

// 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.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.Rulesets;
using osu.Game.Users;

namespace osu.Game.Scoring
{
    public interface IScoreInfo : IHasOnlineID<long>
    {
        User User { get; }

        long TotalScore { get; }

        int MaxCombo { get; }

        double Accuracy { get; }

        bool HasReplay { get; }

        DateTimeOffset Date { get; }

        double? PP { get; }

        IBeatmapInfo Beatmap { get; }

        IRulesetInfo Ruleset { get; }

        ScoreRank Rank { get; }

        // Mods is currently missing from this interface as the `IMod` class has properties which can't be fulfilled by `APIMod`,
        // but also doesn't expose `Settings`. We can consider how to implement this in the future if required.

        // Statistics is also missing. This can be reconsidered once changes in serialisation have been completed.
    }
}

Remove misplaced access modifier in interface specification

Co-authored-by: Bartłomiej Dach <809709723693c4e7ecc6f5379a3099c830279741@gmail.com>


// 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.Runtime.CompilerServices;

// We publish our internal attributes to other sub-projects of the framework.
// Note, that we omit visual tests as they are meant to test the framework
// behavior "in the wild".

[assembly: InternalsVisibleTo("osu.Framework.Tests")]
[assembly: InternalsVisibleTo("osu.Framework.Tests.Dynamic")]

// 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.Runtime.CompilerServices;
using Android.App;

// We publish our internal attributes to other sub-projects of the framework.
// Note, that we omit visual tests as they are meant to test the framework
// behavior "in the wild".

[assembly: InternalsVisibleTo("osu.Framework.Tests")]
[assembly: InternalsVisibleTo("osu.Framework.Tests.Dynamic")]

// https://docs.microsoft.com/en-us/answers/questions/182601/does-xamarinandroid-suppor-manifest-merging.html
[assembly: UsesPermission(Android.Manifest.Permission.ReadExternalStorage)]

Declare storage permission at assembly level


using System;
namespace CSF.Screenplay.Scenarios
{
  /// <summary>
  /// Builder service which assists in the creation of service registrations.
  /// </summary>
  public interface IServiceRegistryBuilder
  {
    /// <summary>
    /// Registers a service which will be used across all scenarios within a test run.
    /// </summary>
    /// <param name="instance">Instance.</param>
    /// <param name="name">Name.</param>
    /// <typeparam name="TService">The 1st type parameter.</typeparam>
    void RegisterSingleton<TService>(TService instance, string name = null) where TService : class;

    /// <summary>
    /// Registers a service which will be constructed afresh (using the given factory function) for
    /// each scenario within a test run.
    /// </summary>
    /// <param name="factory">Factory.</param>
    /// <param name="name">Name.</param>
    /// <typeparam name="TService">The 1st type parameter.</typeparam>
    void RegisterPerScenario<TService>(Func<IServiceResolver,TService> factory, string name = null) where TService : class;
  }
}

using System;
namespace CSF.Screenplay.Scenarios
{
  /// <summary>
  /// Builder service which assists in the creation of service registrations.
  /// </summary>
  public interface IServiceRegistryBuilder
  {
    /// <summary>
    /// Registers a service which will be used across all scenarios within a test run.
    /// </summary>
    /// <param name="instance">Instance.</param>
    /// <param name="name">Name.</param>
    /// <typeparam name="TService">The 1st type parameter.</typeparam>
    void RegisterSingleton<TService>(TService instance, string name = null) where TService : class;

    /// <summary>
    /// Registers a service which will be used across all scenarios within a test run.
    /// </summary>
    /// <param name="initialiser">Initialiser.</param>
    /// <param name="name">Name.</param>
    /// <typeparam name="TService">The 1st type parameter.</typeparam>
    void RegisterSingleton<TService>(Func<TService> initialiser, string name = null) where TService : class;

    /// <summary>
    /// Registers a service which will be constructed afresh (using the given factory function) for
    /// each scenario within a test run.
    /// </summary>
    /// <param name="factory">Factory.</param>
    /// <param name="name">Name.</param>
    /// <typeparam name="TService">The 1st type parameter.</typeparam>
    void RegisterPerScenario<TService>(Func<IServiceResolver,TService> factory, string name = null) where TService : class;
  }
}

Fix mistake in registration (method not on interface)


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

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

#if !BUILD_GENERATED_VERSION
[assembly: AssemblyCompany("Microsoft Corporation.")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
#endif
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
#if !NOT_CLS_COMPLIANT
[assembly: CLSCompliant(true)]
#endif
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyMetadata("Serviceable", "True")]

// ===========================================================================
//  DO NOT EDIT OR REMOVE ANYTHING BELOW THIS COMMENT.
//  Version numbers are automatically generated based on regular expressions.
// ===========================================================================

#if ASPNETODATA
#if !BUILD_GENERATED_VERSION
[assembly: AssemblyVersion("5.5.2.0")] // ASPNETODATA
[assembly: AssemblyFileVersion("5.5.2.0")] // ASPNETODATA
#endif
[assembly: AssemblyProduct("Microsoft OData Web API")]
#endif

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

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

#if !BUILD_GENERATED_VERSION
[assembly: AssemblyCompany("Microsoft Corporation.")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
#endif
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
#if !NOT_CLS_COMPLIANT
[assembly: CLSCompliant(true)]
#endif
[assembly: NeutralResourcesLanguage("en-US")]
[assembly: AssemblyMetadata("Serviceable", "True")]

// ===========================================================================
//  DO NOT EDIT OR REMOVE ANYTHING BELOW THIS COMMENT.
//  Version numbers are automatically generated based on regular expressions.
// ===========================================================================

#if ASPNETODATA
#if !BUILD_GENERATED_VERSION
[assembly: AssemblyVersion("5.6.0.0")] // ASPNETODATA
[assembly: AssemblyFileVersion("5.6.0.0")] // ASPNETODATA
#endif
[assembly: AssemblyProduct("Microsoft OData Web API")]
#endif

Upgrade OData WebAPI Version to 5.6.0

Upgrade OData WebAPI Version to 5.6.0


using System;
using CoreGraphics;

using Foundation;
using UIKit;

namespace TextKitDemo
{
	public partial class CollectionViewCell : UICollectionViewCell
	{
		public CollectionViewCell (IntPtr handle) : base (handle)
		{
			BackgroundColor = UIColor.DarkGray;
			Layer.CornerRadius = 5;

			UIApplication.Notifications.ObserveContentSizeCategoryChanged (delegate {
				CalculateAndSetFonts ();
			});
		}

		public void FormatCell (DemoModel demo)
		{
			containerView.Layer.CornerRadius = 2;
			labelView.Text = demo.Title;
			textView.AttributedText = demo.GetAttributedText ();

			CalculateAndSetFonts ();
		}

		void CalculateAndSetFonts ()
		{
			const float cellTitleTextScaleFactor = 0.85f;
			const float cellBodyTextScaleFactor = 0.7f;

			UIFont cellTitleFont = Font.GetPreferredFont (labelView.Font.FontDescriptor.TextStyle, cellTitleTextScaleFactor);
			UIFont cellBodyFont = Font.GetPreferredFont (textView.Font.FontDescriptor.TextStyle, cellBodyTextScaleFactor);

			labelView.Font = cellTitleFont;
			textView.Font = cellBodyFont;
		}
	}
}

using System;
using CoreGraphics;

using Foundation;
using UIKit;

namespace TextKitDemo
{
	public partial class CollectionViewCell : UICollectionViewCell
	{
		public CollectionViewCell (IntPtr handle) : base (handle)
		{
			Initialize ();
		}

		[Export ("initWithCoder:")]
		public CollectionViewCell (NSCoder coder) : base (coder)
		{
			Initialize ();
		}

		void Initialize ()
		{
			BackgroundColor = UIColor.DarkGray;
			Layer.CornerRadius = 5;

			UIApplication.Notifications.ObserveContentSizeCategoryChanged (delegate {
				CalculateAndSetFonts ();
			});
		}

		public void FormatCell (DemoModel demo)
		{
			containerView.Layer.CornerRadius = 2;
			labelView.Text = demo.Title;
			textView.AttributedText = demo.GetAttributedText ();

			CalculateAndSetFonts ();
		}

		void CalculateAndSetFonts ()
		{
			const float cellTitleTextScaleFactor = 0.85f;
			const float cellBodyTextScaleFactor = 0.7f;

			UIFont cellTitleFont = Font.GetPreferredFont (labelView.Font.FontDescriptor.TextStyle, cellTitleTextScaleFactor);
			UIFont cellBodyFont = Font.GetPreferredFont (textView.Font.FontDescriptor.TextStyle, cellBodyTextScaleFactor);

			labelView.Font = cellTitleFont;
			textView.Font = cellBodyFont;
		}
	}
}

[TextKitDemo] Fix ctor, we must use initWithCoder when loading from a storyboard

initWithCoder: is the designated initializer for views built from the storyboard
since we are not creating the Cell programatically by calling
RegisterClassForCell we must export initWithCoder: ctor to unmanaged world so
when it needs to create a new cell it calls into our managed initWithCoder:
and do the initialization we want.


using System.Threading.Tasks;
using MediatR;
using SFA.DAS.EmployerAccounts.Configuration;
using SFA.DAS.EmployerAccounts.Interfaces;

namespace SFA.DAS.EmployerAccounts.Commands.UnsubscribeProviderEmail
{
    public class UnsubscribeProviderEmailQueryHandler : AsyncRequestHandler<UnsubscribeProviderEmailQuery>
    {
        private readonly EmployerAccountsConfiguration _configuration;
        private readonly IHttpService _httpService;

        public UnsubscribeProviderEmailQueryHandler(
            IHttpServiceFactory httpServiceFactory,
            EmployerAccountsConfiguration configuration)
        {
            _configuration = configuration;
            _httpService = httpServiceFactory.Create(
                configuration.ProviderRelationsApi.ClientId,
                configuration.ProviderRelationsApi.ClientSecret,
                configuration.ProviderRelationsApi.IdentifierUri,
                configuration.ProviderRelationsApi.Tenant
            );
        }

        protected override async Task HandleCore(UnsubscribeProviderEmailQuery message)
        {
            var baseUrl = GetBaseUrl();
            var url = $"{baseUrl}unsubscribe/{message.CorrelationId.ToString()}";
            await _httpService.GetAsync(url, false);
        }

        private string GetBaseUrl()
        {
            var baseUrl = _configuration.ProviderRelationsApi.BaseUrl.EndsWith("/")
                ? _configuration.ProviderRelationsApi.BaseUrl
                : _configuration.ProviderRelationsApi.BaseUrl + "/";

            return baseUrl;
        }
    }
}

using System.Threading.Tasks;
using MediatR;
using SFA.DAS.EmployerAccounts.Configuration;
using SFA.DAS.EmployerAccounts.Interfaces;

namespace SFA.DAS.EmployerAccounts.Commands.UnsubscribeProviderEmail
{
    public class UnsubscribeProviderEmailQueryHandler : AsyncRequestHandler<UnsubscribeProviderEmailQuery>
    {
        private readonly EmployerAccountsConfiguration _configuration;
        private readonly IHttpService _httpService;

        public UnsubscribeProviderEmailQueryHandler(
            IHttpServiceFactory httpServiceFactory,
            EmployerAccountsConfiguration configuration)
        {
            _configuration = configuration;
            _httpService = httpServiceFactory.Create(
                configuration.ProviderRegistrationsApi.ClientId,
                configuration.ProviderRegistrationsApi.ClientSecret,
                configuration.ProviderRegistrationsApi.IdentifierUri,
                configuration.ProviderRegistrationsApi.Tenant
            );
        }

        protected override async Task HandleCore(UnsubscribeProviderEmailQuery message)
        {
            var baseUrl = GetBaseUrl();
            var url = $"{baseUrl}api/unsubscribe/{message.CorrelationId.ToString()}";
            await _httpService.GetAsync(url, false);
        }

        private string GetBaseUrl()
        {
            var baseUrl = _configuration.ProviderRegistrationsApi.BaseUrl.EndsWith("/")
                ? _configuration.ProviderRegistrationsApi.BaseUrl
                : _configuration.ProviderRegistrationsApi.BaseUrl + "/";

            return baseUrl;
        }
    }
}

Change to call new API

Change to call new API


using System;

namespace Dotnet.Microservice.Health
{
    /// <summary>
    /// Represents a health check response
    /// </summary>
    public struct HealthResponse
    {
        public readonly bool IsHealthy;
        public readonly string Message;

        private HealthResponse(bool isHealthy, string statusMessage)
        {
            IsHealthy = isHealthy;
            Message = statusMessage;
        }

        public static HealthResponse Healthy()
        {
            return Healthy("OK");
        }

        public static HealthResponse Healthy(string message)
        {
            return new HealthResponse(true, message);
        }

        public static HealthResponse Unhealthy()
        {
            return Unhealthy("FAILED");
        }

        public static HealthResponse Unhealthy(string message)
        {
            return new HealthResponse(false, message);
        }

        public static HealthResponse Unhealthy(Exception exception)
        {
            var message = $"EXCEPTION: {exception.GetType().Name}, {exception.Message}";
            return new HealthResponse(false, message);
        }

    }
}

using System;

namespace Dotnet.Microservice.Health
{
    /// <summary>
    /// Represents a health check response
    /// </summary>
    public struct HealthResponse
    {
        public readonly bool IsHealthy;
        public readonly object Response;

        private HealthResponse(bool isHealthy, object statusObject)
        {
            IsHealthy = isHealthy;
            Response = statusObject;
        }

        public static HealthResponse Healthy()
        {
            return Healthy("OK");
        }

        public static HealthResponse Healthy(object response)
        {
            return new HealthResponse(true, response);
        }

        public static HealthResponse Unhealthy()
        {
            return Unhealthy("FAILED");
        }

        public static HealthResponse Unhealthy(object response)
        {
            return new HealthResponse(false, response);
        }

        public static HealthResponse Unhealthy(Exception exception)
        {
            var message = $"EXCEPTION: {exception.GetType().Name}, {exception.Message}";
            return new HealthResponse(false, message);
        }

    }
}

Allow the status to be any object instead of just a string.


using System.IO;
using NUnit.Framework;

namespace BrightstarDB.InternalTests
{
    internal static class TestPaths
    {
        public static string DataPath => Path.Combine(TestContext.CurrentContext.TestDirectory, "..\\..\\..\\BrightstarDB.Tests\\Data\\");
    }
}

using System.IO;
using NUnit.Framework;

namespace BrightstarDB.InternalTests
{
    internal static class TestPaths
    {
        public static string DataPath => Path.Combine(TestContext.CurrentContext.TestDirectory, "..\\..\\..\\..\\BrightstarDB.Tests\\Data\\");
    }
}

Fix path to SPARQL test suite files

Fix path to SPARQL test suite files


using System;
using Newtonsoft.Json;

namespace BmpListener.Bmp
{
    public class BmpHeader
    {
        public BmpHeader(byte[] data)
        {
            ParseBytes(data);
        }

        public byte Version { get; private set; }

        [JsonIgnore]
        public uint Length { get; private set; }

        public MessageType Type { get; private set; }

        public void ParseBytes(byte[] data)
        {
            Version = data[0];
            //if (Version != 3)
            //{
            //    throw new Exception("invalid BMP version");
            //}
            Length = data.ToUInt32(1);
            Type = (MessageType) data[5];
        }
    }
}

using System;
using Newtonsoft.Json;
using System.Linq;
using BmpListener;

namespace BmpListener.Bmp
{
    public class BmpHeader
    {
        public BmpHeader(byte[] data)
        {
            Version = data.First();
            //if (Version != 3)
            //{
            //    throw new Exception("invalid BMP version");
            //}
            Length = data.ToUInt32(1);
            Type = (MessageType)data.ElementAt(5);
        }

        public byte Version { get; private set; }

        [JsonIgnore]
        public uint Length { get; private set; }

        public MessageType Type { get; private set; }
    }
}

Move initialization logic to ctor

Move initialization logic to ctor


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

namespace osu.Game.Database
{
    public interface IHasOnlineID
    {
        /// <summary>
        /// The server-side ID representing this instance, if one exists. -1 denotes a missing ID.
        /// </summary>
        int OnlineID { get; }
    }
}

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

namespace osu.Game.Database
{
    public interface IHasOnlineID
    {
        /// <summary>
        /// The server-side ID representing this instance, if one exists. Any value 0 or less denotes a missing ID.
        /// </summary>
        /// <remarks>
        /// Generally we use -1 when specifying "missing" in code, but values of 0 are also considered missing as the online source
        /// is generally a MySQL autoincrement value, which can never be 0.
        /// </remarks>
        int OnlineID { get; }
    }
}

Add xmldoc mention of valid `OnlineID` values


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

namespace NSuperTest.Registration
{
    public class RegistrationDiscoverer
    {
        public IEnumerable<IRegisterServers> FindRegistrations()
        {
            var type = typeof(IRegisterServers);
            var registries = AppDomain.CurrentDomain.GetAssemblies()
                .SelectMany(t => t.GetTypes())
                .Where(t => type.IsAssignableFrom(t) && !t.IsInterface)
                .Select(t => Activator.CreateInstance(t) as IRegisterServers);
            return registries;
        }
    }
}

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

namespace NSuperTest.Registration
{
    public static class AssemblyExtensions
    {
        public static IEnumerable<Type> GetLoadableTypes(this Assembly assembly)
        {
            try
            {
                return assembly.GetTypes();
            }
            catch (ReflectionTypeLoadException e)
            {
                return e.Types.Where(t => t != null);
            }
        }
    }
    public class RegistrationDiscoverer
    {
        public IEnumerable<IRegisterServers> FindRegistrations()
        {
            var type = typeof(IRegisterServers);
            var registries = AppDomain.CurrentDomain.GetAssemblies()
                .SelectMany(t => t.GetLoadableTypes())
                .Where(t => type.IsAssignableFrom(t) && !t.IsInterface)
                .Select(t => Activator.CreateInstance(t) as IRegisterServers);
            return registries;
        }
    }
}

Fix for blinking tests issue

Fix for blinking tests issue

Tests occasionally fail on build server loading a generated assembly
thats used by moq i think. (Its castle) Making sure to swallow loader
exceptions.


//using System;
using System.Collections.Generic;
using System.Dynamic;

namespace Arango.Client
{
    public class ArangoDocument
    {
        public string Handle { get; set; }
        public string Revision { get; set; }
        public dynamic JsonObject { get; set; }

        public ArangoDocument()
        {
            JsonObject = new ExpandoObject();
        }

        public bool Has(string fieldName)
        {
            if (fieldName.Contains("."))
            {
                var fields = fieldName.Split('.');
                var iteration = 1;
                var json = (IDictionary<string, object>)JsonObject;

                foreach (var field in fields)
                {
                    if (json.ContainsKey(field))
                    {
                        if (iteration == fields.Length)
                        {
                            return true;
                        }

                        json = (IDictionary<string, object>)json[field];
                        iteration++;
                    }
                    else
                    {
                        return false;
                    }
                }
            }
            else
            {
                return ((IDictionary<string, object>)JsonObject).ContainsKey(fieldName);
            }

            return false;
        }
    }
}

//using System;
using System.Collections.Generic;
using System.Dynamic;

namespace Arango.Client
{
    public class ArangoDocument
    {
        public string ID { get; set; }
        public string Revision { get; set; }
        public dynamic JsonObject { get; set; }

        public ArangoDocument()
        {
            JsonObject = new ExpandoObject();
        }

        public bool Has(string fieldName)
        {
            if (fieldName.Contains("."))
            {
                var fields = fieldName.Split('.');
                var iteration = 1;
                var json = (IDictionary<string, object>)JsonObject;

                foreach (var field in fields)
                {
                    if (json.ContainsKey(field))
                    {
                        if (iteration == fields.Length)
                        {
                            return true;
                        }

                        json = (IDictionary<string, object>)json[field];
                        iteration++;
                    }
                    else
                    {
                        return false;
                    }
                }
            }
            else
            {
                return ((IDictionary<string, object>)JsonObject).ContainsKey(fieldName);
            }

            return false;
        }
    }
}

Change document handle to id.

Change document handle to id.


namespace LibGit2Sharp
{
    /// <summary>
    ///   Git specific modes for entries.
    /// </summary>
    public enum Mode
    {
        // Inspired from http://stackoverflow.com/a/8347325/335418

        /// <summary>
        ///   000000 file mode (the entry doesn't exist)
        /// </summary>
        Nonexistent = 0,

        /// <summary>
        ///   040000 file mode
        /// </summary>
        Directory = 0x4000,

        /// <summary>
        ///   100644 file mode
        /// </summary>
        NonExecutableFile = 0x81A4,

        /// <summary>
        ///   100664 file mode
        /// </summary>
        NonExecutableGroupWritableFile = 0x81B4,

        /// <summary>
        ///   100755 file mode
        /// </summary>
        ExecutableFile = 0x81ED,

        /// <summary>
        ///   120000 file mode
        /// </summary>
        SymbolicLink = 0xA000,

        /// <summary>
        ///   160000 file mode
        /// </summary>
        GitLink = 0xE000
    }
}

namespace LibGit2Sharp
{
    /// <summary>
    ///   Git specific modes for entries.
    /// </summary>
    public enum Mode
    {
        // Inspired from http://stackoverflow.com/a/8347325/335418

        /// <summary>
        ///   000000 file mode (the entry doesn't exist)
        /// </summary>
        Nonexistent = 0,

        /// <summary>
        ///   040000 file mode
        /// </summary>
        Directory = 0x4000,

        /// <summary>
        ///   100644 file mode
        /// </summary>
        NonExecutableFile = 0x81A4,

        /// <summary>
        ///   Obsolete 100664 file mode.
        ///   <para>0100664 mode is an early Git design mistake. It's kept for
        ///     ascendant compatibility as some <see cref="Tree"/> and
        ///     <see cref="Repository.Index"/> entries may still bear
	    ///     this mode in some old git repositories, but it's now deprecated.
        ///   </para>
        /// </summary>
        NonExecutableGroupWritableFile = 0x81B4,

        /// <summary>
        ///   100755 file mode
        /// </summary>
        ExecutableFile = 0x81ED,

        /// <summary>
        ///   120000 file mode
        /// </summary>
        SymbolicLink = 0xA000,

        /// <summary>
        ///   160000 file mode
        /// </summary>
        GitLink = 0xE000
    }
}

Improve documentation of 0100664 mode usage


using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Newtonsoft.Json;
using PrintNodeNet.Http;

namespace PrintNodeNet
{
    public sealed class PrintNodeComputer
    {
        [JsonProperty("id")]
        public long Id { get; set; }

        [JsonProperty("name")]
        public string Name { get; set; }

        [JsonProperty("inet")]
        public string Inet { get; set; }

        [JsonProperty("inet6")]
        public string Inet6 { get; set; }

        [JsonProperty("hostName")]
        public string HostName { get; set; }

        [JsonProperty("jre")]
        public string Jre { get; set; }

        [JsonProperty("createTimeStamp")]
        public DateTime CreateTimeStamp { get; set; }

        [JsonProperty("state")]
        public string State { get; set; }

        public static async Task<IEnumerable<PrintNodeComputer>> ListAsync(PrintNodeRequestOptions options = null)
        {
            var response = await PrintNodeApiHelper.Get("/computers", options);

            return JsonConvert.DeserializeObject<List<PrintNodeComputer>>(response);
        }

        public static async Task<PrintNodeComputer> GetAsync(long id, PrintNodeRequestOptions options = null)
        {
            var response = await PrintNodeApiHelper.Get($"/computers/{id}", options);

            var list = JsonConvert.DeserializeObject<List<PrintNodeComputer>>(response);

            return list.FirstOrDefault();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Newtonsoft.Json;
using PrintNodeNet.Http;

namespace PrintNodeNet
{
    public sealed class PrintNodeComputer
    {
        [JsonProperty("id")]
        public long Id { get; set; }

        [JsonProperty("name")]
        public string Name { get; set; }

        [JsonProperty("inet")]
        public string Inet { get; set; }

        [JsonProperty("inet6")]
        public string Inet6 { get; set; }

        [JsonProperty("hostName")]
        public string HostName { get; set; }

        [JsonProperty("jre")]
        public string Jre { get; set; }

        [JsonProperty("createTimeStamp")]
        public DateTime CreateTimeStamp { get; set; }

        [JsonProperty("state")]
        public string State { get; set; }

        public static async Task<IEnumerable<PrintNodeComputer>> ListAsync(PrintNodeRequestOptions options = null)
        {
            var response = await PrintNodeApiHelper.Get("/computers", options);

            return JsonConvert.DeserializeObject<List<PrintNodeComputer>>(response);
        }

        public static async Task<PrintNodeComputer> GetAsync(long id, PrintNodeRequestOptions options = null)
        {
            var response = await PrintNodeApiHelper.Get($"/computers/{id}", options);

            var list = JsonConvert.DeserializeObject<List<PrintNodeComputer>>(response);

            return list.FirstOrDefault();
        }

        public async Task<IEnumerable<PrintNodePrinter>> ListPrinters(PrintNodeRequestOptions options = null)
        {
            var response = await PrintNodeApiHelper.Get($"/computers/{Id}/printers", options);

            return JsonConvert.DeserializeObject<List<PrintNodePrinter>>(response);

        }
    }
}

Add method to get a computer’s printers

Add method to get a computer’s printers


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

namespace Thinktecture.IdentityServer.Web.ViewModels
{
    public class RelyingPartyViewModel
    {
        public int ID { get; set; }
        public string DisplayName { get; set; }
    }
}

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

namespace Thinktecture.IdentityServer.Web.ViewModels
{
    public class RelyingPartyViewModel
    {
        public string ID { get; set; }
        public string DisplayName { get; set; }
        public bool Enabled { get; set; }
    }
}

Build edit page for enabled RPs

Build edit page for enabled RPs


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

using System.Data;

namespace dbms_objects_data
{
    class Table
    {
        public DataTable table = new DataTable();

        public Table()
        {

        }

        public bool insertRows(string[] listOfNames, Type[] listOfTypes)
        {
            if((listOfNames == null) || (listOfTypes == null))
            {
                return false;
            }
            for(int i = 0; i < listOfNames.Length; i++)
            {
                table.Columns.Add(listOfNames[i], listOfTypes[i]);
            }

            return true;
        }

    }
}

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

using System.Data;

namespace dbms_objects_data
{
    class Table
    {
        public DataTable table = new DataTable();

        public Table()
        {

        }

        public bool insertRows(string[] listOfNames, Type[] listOfTypes)
        {
            if((listOfNames == null) || (listOfTypes == null))
            {
                return false;
            }

            if(listOfNames.Length != listOfTypes.Length)
            {
                return false;
            }

            for(int i = 0; i < listOfNames.Length; i++)
            {
                table.Columns.Add(listOfNames[i], listOfTypes[i]);
            }

            return true;
        }

    }
}

Update in creation of table

Update in creation of table


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

namespace Thinktecture.IdentityServer.Core.Models
{
    public class ClientSecret
    {
        public string Id { get; set; }
        public string Value { get; set; }

        public ClientSecret(string value)
        {
            Value = value;
        }

        public ClientSecret(string id, string value)
        {
            Id = id;
            Value = value;
        }
    }
}

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

using System;

namespace Thinktecture.IdentityServer.Core.Models
{
    /// <summary>
    /// Models a client secret with identifier and expiration
    /// </summary>
    public class ClientSecret
    {
        /// <summary>
        /// Gets or sets the identifier.
        /// </summary>
        /// <value>
        /// The identifier.
        /// </value>
        public string Id { get; set; }

        /// <summary>
        /// Gets or sets the value.
        /// </summary>
        /// <value>
        /// The value.
        /// </value>
        public string Value { get; set; }

        /// <summary>
        /// Gets or sets the expiration.
        /// </summary>
        /// <value>
        /// The expiration.
        /// </value>
        public DateTimeOffset? Expiration { get; set; }

        /// <summary>
        /// Initializes a new instance of the <see cref="ClientSecret"/> class.
        /// </summary>
        /// <param name="value">The value.</param>
        /// <param name="expiration">The expiration.</param>
        public ClientSecret(string value, DateTimeOffset? expiration = null)
        {
            Value = value;
            Expiration = expiration;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="ClientSecret"/> class.
        /// </summary>
        /// <param name="id">The identifier.</param>
        /// <param name="value">The value.</param>
        /// <param name="expiration">The expiration.</param>
        public ClientSecret(string id, string value, DateTimeOffset? expiration = null)
        {
            Id = id;
            Value = value;
            Expiration = expiration;
        }
    }
}

Add expiration to client secret

Add expiration to client secret


using UnityEngine;

namespace NaughtyAttributes.Test
{
	public class ValidateInputTest : MonoBehaviour
	{
		[ValidateInput("NotZero0", "int0 must not be zero")]
		public int int0;

		private bool NotZero0(int value)
		{
			return value != 0;
		}

		public ValidateInputNest1 nest1;
	}

	[System.Serializable]
	public class ValidateInputNest1
	{
		[ValidateInput("NotZero1")]
		[AllowNesting] // Because it's nested we need to explicitly allow nesting
		public int int1;

		private bool NotZero1(int value)
		{
			return value != 0;
		}

		public ValidateInputNest2 nest2;
	}

	[System.Serializable]
	public class ValidateInputNest2
	{
		[ValidateInput("NotZero2")]
		[AllowNesting] // Because it's nested we need to explicitly allow nesting
		public int int2;

		private bool NotZero2(int value)
		{
			return value != 0;
		}
	}
}

using UnityEngine;

namespace NaughtyAttributes.Test
{
	public class ValidateInputTest : MonoBehaviour
	{
		[ValidateInput("NotZero0", "int0 must not be zero")]
		public int int0;

		private bool NotZero0(int value)
		{
			return value != 0;
		}

		public ValidateInputNest1 nest1;

		public ValidateInputInheritedNest inheritedNest;
	}

	[System.Serializable]
	public class ValidateInputNest1
	{
		[ValidateInput("NotZero1")]
		[AllowNesting] // Because it's nested we need to explicitly allow nesting
		public int int1;

		private bool NotZero1(int value)
		{
			return value != 0;
		}

		public ValidateInputNest2 nest2;
	}

	[System.Serializable]
	public class ValidateInputNest2
	{
		[ValidateInput("NotZero2")]
		[AllowNesting] // Because it's nested we need to explicitly allow nesting
		public int int2;

		private bool NotZero2(int value)
		{
			return value != 0;
		}
	}

	[System.Serializable]
	public class ValidateInputInheritedNest : ValidateInputNest1
	{
	}
}

Create test for inherited private validator function


using static System.Console;

public class Counter
{
    public Counter() { }

    public int Count;

    public Counter Increment()
    {
        Count++;
        return this;
    }
}

public static class Program
{
    public static readonly Counter printCounter = new Counter();

    public static void Main()
    {
        WriteLine(printCounter.Increment().Coutn);
        WriteLine(printCounter.Inrement().Count);
    }
}

using static System.Console;

public class Counter
{
    public Counter() { }

    public int Count;

    public Counter Increment()
    {
        Count++;
        return this;
    }
}

public static class Program
{
    public static readonly Counter printCounter = new Counter();

    public static void Main()
    {
        WriteLine(printCounter.Increment().Coutn);
        WriteLine(printCounter.Inrement().Count);
        WriteLine(printCoutner.Increment().Count);
    }
}

Add unqualified name lookup to the MissingMemberName test


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

namespace Xtrmstep.Extractor.Core.Tests
{
    public class FileReaderTests
    {
        const string testDataFolder = @"f:\TestData\";

        [Fact(DisplayName = "Read JSON Files / One entry")]
        public void Should_read_an_entry()
        {
            var filePath = testDataFolder + "jsonFormat.txt";
            var fileReader = new FileReader();
            var values = fileReader.Read(filePath).ToArray();

            Assert.Equal(1, values.Length);
            Assert.Equal("url_text", values[0].url);
            Assert.Equal("html_text", values[0].result);
        }

        [Fact(DisplayName = "Read JSON Files / Several entries")]
        public void Should_read_sequence()
        {
            throw new NotImplementedException();
        }

        [Fact(DisplayName = "Read JSON Files / Big file")]
        public void Should_read_big_file()
        {
            throw new NotImplementedException();
        }
    }
}

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

namespace Xtrmstep.Extractor.Core.Tests
{
    public class FileReaderTests
    {
        const string testDataFolder = @"c:\TestData\";

        [Fact(DisplayName = "Read JSON Files / One entry")]
        public void Should_read_an_entry()
        {
            var filePath = testDataFolder + "jsonFormat.txt";
            var fileReader = new FileReader();
            var values = fileReader.Read(filePath).ToArray();

            Assert.Equal(1, values.Length);
            Assert.Equal("url_text", values[0].url);
            Assert.Equal("html_text", values[0].result);
        }

        [Fact(DisplayName = "Read JSON Files / Several entries")]
        public void Should_read_sequence()
        {
            var filePath = testDataFolder + "jsonSequence.txt";
            var fileReader = new FileReader();
            var values = fileReader.Read(filePath).ToArray();

            Assert.Equal(2, values.Length);
            Assert.Equal("url_text_1", values[0].url);
            Assert.Equal("html_text_1", values[0].result);
            Assert.Equal("url_text_2", values[1].url);
            Assert.Equal("html_text_2", values[1].result);
        }

        [Fact(DisplayName = "Read JSON Files / Big file")]
        public void Should_read_big_file()
        {
            throw new NotImplementedException();
        }
    }
}

Test for sequence in JSON

Test for sequence in JSON


using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Threading;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using Newtonsoft.Json;
using VotingApplication.Data.Context;
using VotingApplication.Web.Api.Migrations;

namespace VotingApplication.Web.Api
{
    public class WebApiApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            // Fix the infinite recursion of Session.OptionSet.Options[0].OptionSets[0].Options[0].[...]
            // by not populating the Option.OptionSets after already encountering Session.OptionSet
            GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;

            //Enable automatic migrations
            //Database.SetInitializer(new MigrateDatabaseToLatestVersion<VotingContext, Configuration>());
            //new VotingContext().Database.Initialize(false);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Threading;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using Newtonsoft.Json;
using VotingApplication.Data.Context;
using VotingApplication.Web.Api.Migrations;

namespace VotingApplication.Web.Api
{
    public class WebApiApplication : System.Web.HttpApplication
    {
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            // Fix the infinite recursion of Session.OptionSet.Options[0].OptionSets[0].Options[0].[...]
            // by not populating the Option.OptionSets after already encountering Session.OptionSet
            GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;

            //Enable automatic migrations
            Database.SetInitializer(new MigrateDatabaseToLatestVersion<VotingContext, Configuration>());
            new VotingContext().Database.Initialize(false);
        }
    }
}

Revert "Force fix for new databases"

Revert "Force fix for new databases"

This reverts commit bb721dd50c2a7e59cdafab1623fb2792c009d57c.


using Hangfire;
using StructureMap;
using SupportManager.Control.Infrastructure;
using Topshelf;

namespace SupportManager.Control
{
    public class SupportManagerService : ServiceControl
    {
        private readonly IContainer container;
        private BackgroundJobServer jobServer;

        public SupportManagerService()
        {
            GlobalConfiguration.Configuration.UseSqlServerStorage("HangFire");
            container = new Container(c => c.AddRegistry<AppRegistry>());
        }

        public bool Start(HostControl hostControl)
        {
            jobServer = new BackgroundJobServer(GetJobServerOptions());
            return true;
        }

        public bool Stop(HostControl hostControl)
        {
            jobServer.Dispose();
            return true;
        }

        private BackgroundJobServerOptions GetJobServerOptions()
        {
            return new BackgroundJobServerOptions
            {
                Activator = new NestedContainerActivator(container)
            };
        }
    }
}

using Hangfire;
using StructureMap;
using SupportManager.Contracts;
using SupportManager.Control.Infrastructure;
using Topshelf;

namespace SupportManager.Control
{
    public class SupportManagerService : ServiceControl
    {
        private readonly IContainer container;
        private BackgroundJobServer jobServer;

        public SupportManagerService()
        {
            GlobalConfiguration.Configuration.UseSqlServerStorage("HangFire");
            container = new Container(c => c.AddRegistry<AppRegistry>());
        }

        public bool Start(HostControl hostControl)
        {
            jobServer = new BackgroundJobServer(GetJobServerOptions());
            RecurringJob.AddOrUpdate<IForwarder>(f => f.ReadAllTeamStatus(), Cron.Minutely);
            return true;
        }

        public bool Stop(HostControl hostControl)
        {
            jobServer.Dispose();
            return true;
        }

        private BackgroundJobServerOptions GetJobServerOptions()
        {
            return new BackgroundJobServerOptions
            {
                Activator = new NestedContainerActivator(container)
            };
        }
    }
}

Add recurring job for reading status

Add recurring job for reading status


using NUnit.Framework;
using OpenQA.Selenium;
using System.Linq;

namespace Vidyano.Test
{
    [TestFixture("chrome")]
    [TestFixture("safari")]
    [TestFixture("firefox")]
    [TestFixture("edge")]
    [TestFixture("ie")]
    [Parallelizable(ParallelScope.Fixtures)]
    public class GlobalSearch: BrowserStackTestBase
    {
        public GlobalSearch(string profile): base(profile) {}

        [Test]
        public void Search()
        {
            var search = "pei";
            var input = driver.FindElement(By.CssSelector("vi-menu vi-input-search > input"));
            input.SendKeys(search);
            input.SendKeys(Keys.Enter);

            var firstRow = driver.FindElement(By.CssSelector("vi-query-grid tr[is='vi-query-grid-table-data-row']:first-of-type"));
            Assert.That(firstRow, Is.Not.Null, "Unable to find first data row.");
            Assert.That(driver.Title.StartsWith(search), Is.True, "Invalid title after search.");

            var cells = firstRow.FindElements(By.TagName("vi-query-grid-cell-default"));
            Assert.That(cells.FirstOrDefault(c => c.Text.Contains(search)), Is.Not.Null, "No match found.");
        }
    }
}

using NUnit.Framework;
using OpenQA.Selenium;
using System.Linq;

namespace Vidyano.Test
{
    [TestFixture("chrome")]
    [TestFixture("safari")]
    [TestFixture("firefox")]
    [TestFixture("edge")]
    [TestFixture("ie")]
    [Parallelizable(ParallelScope.Fixtures)]
    public class GlobalSearch: BrowserStackTestBase
    {
        public GlobalSearch(string profile): base(profile) {}

        [Test]
        public void Search()
        {
            var search = "pei";
            var input = driver.FindElement(By.CssSelector("vi-menu vi-input-search > input"));
            input.SendKeys(search);
            input.SendKeys(Keys.Enter);

            Assert.That(driver.FindElement(By.CssSelector("vi-query-grid:not(.initializing)")), Is.Not.Null);

            var firstRow = driver.FindElement(By.CssSelector("vi-query-grid tr[is='vi-query-grid-table-data-row']:first-of-type"));
            Assert.That(firstRow, Is.Not.Null, "Unable to find first data row.");
            Assert.That(driver.Title.StartsWith(search), Is.True, "Invalid title after search.");

            var cells = firstRow.FindElements(By.TagName("vi-query-grid-cell-default"));
            Assert.That(cells.FirstOrDefault(c => c.Text.Contains(search)), Is.Not.Null, "No match found.");
        }
    }
}

Make sure grid is not still initializing when verifying its data