using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.RazorPages;
using BlogTemplate.Models;
using Microsoft.AspNetCore.Mvc;
using System.Xml;
using System.Xml.Linq;
using Microsoft.AspNetCore.Authorization;

namespace BlogTemplate.Pages
{

    public class PostModel : PageModel
    {
        private Blog _blog;
        private BlogDataStore _dataStore;

        public PostModel(Blog blog, BlogDataStore dataStore)
        {
            _blog = blog;
            _dataStore = dataStore;
        }

        [BindProperty]
        public Comment Comment { get; set; }

        public Post Post { get; set; }

        [AllowAnonymous]
        public void OnGet()
        {
            InitializePost();
        }

        private void InitializePost()
        {
            string slug = RouteData.Values["slug"].ToString();

            Post = _dataStore.GetPost(slug);

            if (Post == null)
            {
                RedirectToPage("/Index");
            }
        }

        [AllowAnonymous]
        public IActionResult OnPostPublishComment()
        {
            string slug = RouteData.Values["slug"].ToString();

            Post = _dataStore.GetPost(slug);

            if (Post == null)
            {
                RedirectToPage("/Index");
            }
            else if (ModelState.IsValid)
            {
                Comment.IsPublic = true;
                Comment.UniqueId = Guid.NewGuid();
                Post.Comments.Add(Comment);
                _dataStore.SavePost(Post);
            }
            return Page();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc.RazorPages;
using BlogTemplate.Models;
using Microsoft.AspNetCore.Mvc;
using System.Xml;
using System.Xml.Linq;
using Microsoft.AspNetCore.Authorization;

namespace BlogTemplate.Pages
{

    public class PostModel : PageModel
    {
        private Blog _blog;
        private BlogDataStore _dataStore;

        public PostModel(Blog blog, BlogDataStore dataStore)
        {
            _blog = blog;
            _dataStore = dataStore;
        }

        [BindProperty]
        public Comment Comment { get; set; }

        public Post Post { get; set; }

        public void OnGet()
        {
            InitializePost();
        }

        private void InitializePost()
        {
            string slug = RouteData.Values["slug"].ToString();

            Post = _dataStore.GetPost(slug);

            if (Post == null)
            {
                RedirectToPage("/Index");
            }
        }

        public IActionResult OnPostPublishComment()
        {
            string slug = RouteData.Values["slug"].ToString();

            Post = _dataStore.GetPost(slug);

            if (Post == null)
            {
                RedirectToPage("/Index");
            }
            else if (ModelState.IsValid)
            {
                Comment.IsPublic = true;
                Comment.UniqueId = Guid.NewGuid();
                Post.Comments.Add(Comment);
                _dataStore.SavePost(Post);
            }
            return Page();
        }
    }
}

Remove [AllowAnonymous] since added by default


namespace Tvl.VisualStudio.InheritanceMargin
{
    using System.ComponentModel.Composition;
    using Microsoft.VisualStudio.Shell;
    using Microsoft.VisualStudio.Text;
    using Microsoft.VisualStudio.Text.Editor;
    using Microsoft.VisualStudio.Text.Tagging;
    using Microsoft.VisualStudio.Utilities;
    using IOutputWindowService = Tvl.VisualStudio.OutputWindow.Interfaces.IOutputWindowService;
    using TaskScheduler = System.Threading.Tasks.TaskScheduler;

    [Name("CSharp Inheritance Tagger Provider")]
    [TagType(typeof(IInheritanceTag))]
    [Export(typeof(ITaggerProvider))]
    [ContentType("CSharp")]
    internal class CSharpInheritanceTaggerProvider : ITaggerProvider
    {
        public CSharpInheritanceTaggerProvider()
        {
            TaskScheduler = TaskScheduler.Default;
        }

        ////[Import(PredefinedTaskSchedulers.BackgroundIntelliSense)]
        public TaskScheduler TaskScheduler
        {
            get;
            private set;
        }

        [Import]
        public ITextDocumentFactoryService TextDocumentFactoryService
        {
            get;
            private set;
        }

        [Import]
        public IOutputWindowService OutputWindowService
        {
            get;
            private set;
        }

        [Import]
        public SVsServiceProvider GlobalServiceProvider
        {
            get;
            private set;
        }

        public ITagger<T> CreateTagger<T>(ITextBuffer buffer) where T : ITag
        {
            if (buffer != null)
                return CSharpInheritanceTagger.CreateInstance(this, buffer) as ITagger<T>;

            return null;
        }
    }
}

Fix all violations of SA1127

Fix all violations of SA1127


using System;

namespace UniProgramGen.Helpers
{
    public class TimeSlot
    {
        public TimeSlot(DayOfWeek day, uint startHour, uint endHour)
        {
            Day = day;
            StartHour = startHour;
            EndHour = endHour;
        }

        public DayOfWeek Day { get; private set; }
        public uint StartHour { get; private set; }
        public uint EndHour { get; private set; }
    }
}

using System;

namespace UniProgramGen.Helpers
{
    public class TimeSlot
    {
        public const uint START_HOUR = 8;
        public const uint END_HOUR = 22;
        public const uint TOTAL_DAY_HOURS = END_HOUR - START_HOUR;

        public TimeSlot(DayOfWeek day, uint startHour, uint endHour)
        {
            validateHour(startHour);
            validateHour(endHour);
            if (startHour >= endHour) {
                throw new ArgumentException("Start hour has to be before end hour");
            }

            Day = day;
            StartHour = startHour;
            EndHour = endHour;
        }

        public uint Duration()
        {
            return (uint)EndHour - StartHour;
        }

        public bool Overlaps(TimeSlot other)
        {
            return inSlot(other.StartHour) || inSlot(other.EndHour);
        }

        public bool Includes(TimeSlot other)
        {
            return other.StartHour >= StartHour && other.EndHour <= EndHour;
        }

        public DayOfWeek Day { get; private set; }
        public uint StartHour { get; private set; }
        public uint EndHour { get; private set; }

        private static void validateHour(uint hour)
        {
            if (hour < START_HOUR || hour > END_HOUR) {
                throw new ArgumentOutOfRangeException("Hour outside of working hours");
            }
        }

        private bool inSlot(uint hour)
        {
            return hour > StartHour && hour < EndHour;
        }

    }
}

Add convenience methods for timeslots

Add convenience methods for timeslots


using System.Linq;
using System.Text;
using NUnit.Framework;

namespace ValveKeyValue.Test
{
    class CommentOnEndOfTheLine
    {
        [Test]
        public void CanHandleCommentOnEndOfTheLine()
        {
            var text = new StringBuilder();
            text.AppendLine(@"""test_kv""");
            text.AppendLine("{");
            text.AppendLine("//");
            text.AppendLine(@"""test""	""hello""");
            text.AppendLine("}");

            var data = KVSerializer.Create(KVSerializationFormat.KeyValues1Text).Deserialize(text.ToString());

            Assert.Multiple(() =>
            {
                Assert.That(data.Children.Count(), Is.EqualTo(1));
                Assert.That((string)data["test"], Is.EqualTo("hello"));
            });
        }
    }
}

using System.Linq;
using System.Text;
using NUnit.Framework;

namespace ValveKeyValue.Test
{
    class CommentOnEndOfTheLine
    {
        [Test]
        public void CanHandleCommentOnEndOfTheLine()
        {
            var text = new StringBuilder();
            text.Append(@"""test_kv""" + "\n");
            text.Append("{" + "\n");
            text.Append("//" + "\n");
            text.Append(@"""test""	""hello""" + "\n");
            text.Append("}" + "\n");

            var data = KVSerializer.Create(KVSerializationFormat.KeyValues1Text).Deserialize(text.ToString());

            Assert.Multiple(() =>
            {
                Assert.That(data.Children.Count(), Is.EqualTo(1));
                Assert.That((string)data["test"], Is.EqualTo("hello"));
            });
        }
    }
}

Improve the test in regards to \r\n

Improve the test in regards to \r\n


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

using System;
using System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.PickMembers;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.PickMembers;

namespace Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.Internal.PickMembers
{
    [Shared]
    [ExportWorkspaceService(typeof(IPickMembersService), ServiceLayer.Host)]
    internal class OmniSharpPickMembersService : IPickMembersService
    {
        private readonly IOmniSharpPickMembersService _omniSharpPickMembersService;

        [ImportingConstructor]
        [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
        public OmniSharpPickMembersService(IOmniSharpPickMembersService omniSharpPickMembersService)
        {
            _omniSharpPickMembersService = omniSharpPickMembersService;
        }

        public PickMembersResult PickMembers(string title, ImmutableArray<ISymbol> members, ImmutableArray<PickMembersOption> options = default)
        {
            var result = _omniSharpPickMembersService.PickMembers(title, members, options.SelectAsArray(o => new OmniSharpPickMembersOption(o)), selectAll: true);
            return new(result.Members, result.Options.SelectAsArray(o => o.PickMembersOptionInternal));
        }
    }
}

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

using System;
using System.Collections.Immutable;
using System.Composition;
using Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.PickMembers;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.PickMembers;

namespace Microsoft.CodeAnalysis.ExternalAccess.OmniSharp.Internal.PickMembers
{
    [Shared]
    [ExportWorkspaceService(typeof(IPickMembersService), ServiceLayer.Host)]
    internal class OmniSharpPickMembersService : IPickMembersService
    {
        private readonly IOmniSharpPickMembersService _omniSharpPickMembersService;

        [ImportingConstructor]
        [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
        public OmniSharpPickMembersService(IOmniSharpPickMembersService omniSharpPickMembersService)
        {
            _omniSharpPickMembersService = omniSharpPickMembersService;
        }

        public PickMembersResult PickMembers(string title, ImmutableArray<ISymbol> members, ImmutableArray<PickMembersOption> options = default, bool selectAll = true)
        {
            var result = _omniSharpPickMembersService.PickMembers(title, members, options.SelectAsArray(o => new OmniSharpPickMembersOption(o)), selectAll);
            return new(result.Members, result.Options.SelectAsArray(o => o.PickMembersOptionInternal), result.SelectedAll);
        }
    }
}

Revert "Fix up for 16.11"

Revert "Fix up for 16.11"

This reverts commit 28955d0f02e5e369dbac824f167cd87c8fd1dfb3.


// 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.Composition;
using Microsoft.CodeAnalysis.ErrorReporting;
using Microsoft.VisualStudio.Text;

namespace Microsoft.VisualStudio.IntegrationTest.Setup
{
    /// <summary>This class causes a crash if an exception is encountered by the editor.</summary>
    [Shared, Export(typeof(IExtensionErrorHandler)), Export(typeof(TestExtensionErrorHandler))]
    public class TestExtensionErrorHandler : IExtensionErrorHandler
    {
        public void HandleError(object sender, Exception exception)
        {
            if (exception is ArgumentOutOfRangeException argumentOutOfRangeException
                && argumentOutOfRangeException.ParamName == "index"
                && argumentOutOfRangeException.StackTrace.Contains("Microsoft.NodejsTools.Repl.ReplOutputClassifier.GetClassificationSpans"))
            {
                // Known issue https://github.com/Microsoft/nodejstools/issues/2138
                return;
            }

            FatalError.Report(exception);
        }
    }
}

// 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.Composition;
using Microsoft.CodeAnalysis.ErrorReporting;
using Microsoft.VisualStudio.Text;

namespace Microsoft.VisualStudio.IntegrationTest.Setup
{
    /// <summary>This class causes a crash if an exception is encountered by the editor.</summary>
    [Shared, Export(typeof(IExtensionErrorHandler)), Export(typeof(TestExtensionErrorHandler))]
    public class TestExtensionErrorHandler : IExtensionErrorHandler
    {
        public void HandleError(object sender, Exception exception)
        {
            if (exception is ArgumentOutOfRangeException argumentOutOfRangeException
                && argumentOutOfRangeException.ParamName == "index"
                && argumentOutOfRangeException.StackTrace.Contains("Microsoft.NodejsTools.Repl.ReplOutputClassifier.GetClassificationSpans"))
            {
                // Known issue https://github.com/Microsoft/nodejstools/issues/2138
                return;
            }

            if (exception is ArgumentException argumentException
                && argumentException.Message.Contains("SnapshotPoint")
                && argumentException.StackTrace.Contains("Microsoft.VisualStudio.Text.Editor.Implementation.WpfTextView.ValidateBufferPosition"))
            {
                // Known issue https://github.com/dotnet/roslyn/issues/35123
                return;
            }

            FatalError.Report(exception);
        }
    }
}

Work around failure in light bulb controller

See #35123


using System.Net.Http.Formatting;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using WebApiContrib.Formatting.Jsonp;
using WebContribContrib.Formatting.Jsonp.SampleWebHost.App_Start;

namespace WebContribContrib.Formatting.Jsonp.SampleWebHost {
    // Note: For instructions on enabling IIS6 or IIS7 classic mode,
    // visit http://go.microsoft.com/?LinkId=9394801

    public class WebApiApplication : System.Web.HttpApplication {
        protected void Application_Start() {
            AreaRegistration.RegisterAllAreas();

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

            GlobalConfiguration.Configure(config => {
                config.MapHttpAttributeRoutes();
                FormatterConfig.RegisterFormatters(config.Formatters);
            });
        }
    }
}

using System.Net.Http.Formatting;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using WebApiContrib.Formatting.Jsonp;
using WebContribContrib.Formatting.Jsonp.SampleWebHost.App_Start;

namespace WebContribContrib.Formatting.Jsonp.SampleWebHost {
    // Note: For instructions on enabling IIS6 or IIS7 classic mode,
    // visit http://go.microsoft.com/?LinkId=9394801

    public class WebApiApplication : System.Web.HttpApplication {
        protected void Application_Start() {
            AreaRegistration.RegisterAllAreas();

            GlobalConfiguration.Configure(config => {
                config.MapHttpAttributeRoutes();
                FormatterConfig.RegisterFormatters(config.Formatters);
            });

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

Fix order of route registration.

Fix order of route registration.


// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ConsoleAbstraction.cs" company="Naos Project">
//    Copyright (c) Naos Project 2019. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace [PROJECT_NAME]
{
    using System.Diagnostics;
    using System.Diagnostics.CodeAnalysis;

    using CLAP;

    using Naos.Bootstrapper;

    /// <inheritdoc />
    public class ConsoleAbstraction : ConsoleAbstractionBase
    {
        /// <summary>
        /// Does some work.
        /// </summary>
        /// <param name="debug">Optional value indicating whether to launch the debugger from inside the application (default is false).</param>
        /// <param name="requiredParameter">A required parameter to the operation.</param>
        [Verb(Aliases = "do", IsDefault = false, Description = "Does some work.")]
        [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = ObcSuppressBecause.CA1811_AvoidUncalledPrivateCode_MethodIsWiredIntoClapAsVerb)]
        public static void DoSomeWork(
            [Aliases("")] [Description("Launches the debugger.")] [DefaultValue(false)] bool debug,
            [Aliases("")] [Required] [Description("A required parameter to the operation.")] string requiredParameter)
        {
            if (debug)
            {
                Debugger.Launch();
            }

            System.Console.WriteLine(requiredParameter);
        }
    }
}

// --------------------------------------------------------------------------------------------------------------------
// <copyright file="ConsoleAbstraction.cs" company="Naos Project">
//    Copyright (c) Naos Project 2019. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace [PROJECT_NAME]
{
    using System.Diagnostics;
    using System.Diagnostics.CodeAnalysis;

    using CLAP;

    using Naos.Bootstrapper;
    using Naos.Build.Analyzers;

    /// <inheritdoc />
    public class ConsoleAbstraction : ConsoleAbstractionBase
    {
        /// <summary>
        /// Does some work.
        /// </summary>
        /// <param name="debug">Optional value indicating whether to launch the debugger from inside the application (default is false).</param>
        /// <param name="requiredParameter">A required parameter to the operation.</param>
        [Verb(Aliases = "do", IsDefault = false, Description = "Does some work.")]
        [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = NaosSuppressBecause.CA1811_AvoidUncalledPrivateCode_MethodIsWiredIntoClapAsVerb)]
        public static void DoSomeWork(
            [Aliases("")] [Description("Launches the debugger.")] [DefaultValue(false)] bool debug,
            [Aliases("")] [Required] [Description("A required parameter to the operation.")] string requiredParameter)
        {
            if (debug)
            {
                Debugger.Launch();
            }

            System.Console.WriteLine(requiredParameter);
        }
    }
}

Tweak in Console VS Project Template.

Tweak in Console VS Project Template.


// 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.ComponentModel.Composition;
using Microsoft.VisualStudio.LiveShare.LanguageServices;
using Microsoft.CodeAnalysis.Editor;
using Microsoft.VisualStudio.LanguageServer.Protocol;
using System;

namespace Microsoft.VisualStudio.LanguageServices.LiveShare
{
    [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.TextDocumentDefinitionName)]
    [Obsolete("Used for backwards compatibility with old liveshare clients.")]
    internal class RoslynGoToDefinitionHandler : AbstractGoToDefinitionWithFarHandler
    {
        [ImportingConstructor]
        public RoslynGoToDefinitionHandler([Import(AllowDefault = true)] IMetadataAsSourceFileService metadataAsSourceService)
            : base(metadataAsSourceService)
        {
        }
    }

    [ExportLspRequestHandler(LiveShareConstants.TypeScriptContractName, Methods.TextDocumentDefinitionName)]
    internal class TypeScriptGoToDefinitionHandler : AbstractGoToDefinitionWithFarHandler
    {
        [ImportingConstructor]
        public TypeScriptGoToDefinitionHandler() : base(null)
        {
        }
    }
}

// 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 Microsoft.CodeAnalysis.Editor;
using Microsoft.VisualStudio.LanguageServer.Protocol;
using Microsoft.VisualStudio.LiveShare.LanguageServices;

namespace Microsoft.VisualStudio.LanguageServices.LiveShare
{
    [ExportLspRequestHandler(LiveShareConstants.RoslynContractName, Methods.TextDocumentDefinitionName)]
    [Obsolete("Used for backwards compatibility with old liveshare clients.")]
    internal class RoslynGoToDefinitionHandler : AbstractGoToDefinitionWithFarHandler
    {
        [ImportingConstructor]
        public RoslynGoToDefinitionHandler([Import(AllowDefault = true)] IMetadataAsSourceFileService metadataAsSourceService)
            : base(metadataAsSourceService)
        {
        }
    }

    [ExportLspRequestHandler(LiveShareConstants.TypeScriptContractName, Methods.TextDocumentDefinitionName)]
    internal class TypeScriptGoToDefinitionHandler : AbstractGoToDefinitionWithFarHandler
    {
        [ImportingConstructor]
        public TypeScriptGoToDefinitionHandler() : base(null)
        {
        }
    }
}

Sort usings in gotodef exports.

Sort usings in gotodef exports.


// 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 Microsoft.VisualStudio.Shell;
using Roslyn.VisualStudio.Setup;

[assembly: ProvideRoslynBindingRedirection("Microsoft.CodeAnalysis.Scripting.dll")]
[assembly: ProvideRoslynBindingRedirection("Microsoft.CodeAnalysis.CSharp.Scripting.dll")]
[assembly: ProvideRoslynBindingRedirection("Microsoft.CodeAnalysis.Scripting.VisualBasic.dll")]

[assembly: ProvideRoslynBindingRedirection("Microsoft.CodeAnalysis.InteractiveEditorFeatures.dll")]
[assembly: ProvideRoslynBindingRedirection("Microsoft.CodeAnalysis.CSharp.InteractiveEditorFeatures.dll")]
[assembly: ProvideRoslynBindingRedirection("Microsoft.CodeAnalysis.VisualBasic.InteractiveEditorFeatures.dll")]

[assembly: ProvideRoslynBindingRedirection("Microsoft.CodeAnalysis.InteractiveFeatures.dll")]

[assembly: ProvideRoslynBindingRedirection("Microsoft.VisualStudio.InteractiveServices.dll")]

[assembly: ProvideRoslynBindingRedirection("InteractiveHost.exe")]

[assembly: ProvideCodeBase(CodeBase = "$PackageFolder$\\System.IO.FileSystem.dll")]

Include a codebase for System.IO.FileSystem


namespace Winium.Desktop.Driver.CommandExecutors
{
    #region using

    using System.Windows.Automation;

    using Winium.Cruciatus.Exceptions;
    using Winium.Cruciatus.Extensions;
    using Winium.StoreApps.Common;

    #endregion

    internal class IsElementSelectedExecutor : CommandExecutorBase
    {
        #region Methods

        protected override string DoImpl()
        {
            var registeredKey = this.ExecutedCommand.Parameters["ID"].ToString();

            var element = this.Automator.Elements.GetRegisteredElement(registeredKey);

            var isSelected = false;

            try
            {
                var isTogglePattrenAvailable =
                    element.GetAutomationPropertyValue<bool>(AutomationElement.IsTogglePatternAvailableProperty);

                if (isTogglePattrenAvailable)
                {
                    var toggleStateProperty = TogglePattern.ToggleStateProperty;
                    var toggleState = element.GetAutomationPropertyValue<ToggleState>(toggleStateProperty);

                    isSelected = toggleState == ToggleState.On;
                }
            }
            catch (CruciatusException)
            {
                var selectionItemProperty = SelectionItemPattern.IsSelectedProperty;
                isSelected = element.GetAutomationPropertyValue<bool>(selectionItemProperty);
            }

            return this.JsonResponse(ResponseStatus.Success, isSelected);
        }

        #endregion
    }
}

namespace Winium.Desktop.Driver.CommandExecutors
{
    #region using

    using System.Windows.Automation;

    using Winium.Cruciatus.Exceptions;
    using Winium.Cruciatus.Extensions;
    using Winium.StoreApps.Common;

    #endregion

    internal class IsElementSelectedExecutor : CommandExecutorBase
    {
        #region Methods

        protected override string DoImpl()
        {
            var registeredKey = this.ExecutedCommand.Parameters["ID"].ToString();

            var element = this.Automator.Elements.GetRegisteredElement(registeredKey);

            var isSelected = false;

            try
            {
                var isSelectedItemPattrenAvailable =
                    element.GetAutomationPropertyValue<bool>(AutomationElement.IsSelectionItemPatternAvailableProperty);

                if (isSelectedItemPattrenAvailable)
                {
                    var selectionItemProperty = SelectionItemPattern.IsSelectedProperty;
                    isSelected = element.GetAutomationPropertyValue<bool>(selectionItemProperty);
                }
            }
            catch (CruciatusException)
            {
                var toggleStateProperty = TogglePattern.ToggleStateProperty;
                var toggleState = element.GetAutomationPropertyValue<ToggleState>(toggleStateProperty);

                isSelected = toggleState == ToggleState.On;
            }

            return this.JsonResponse(ResponseStatus.Success, isSelected);
        }

        #endregion
    }
}

Check if using SelectedItem pattern first


#r "C:\Program Files (x86)\Luminescence Software\Metatogger 5.8\Metatogger.exe"

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

IEnumerable<AudioFile> files = new List<AudioFile>(); // list of checked audio files in the workspace

#r "C:\Program Files (x86)\Luminescence Software\Metatogger 5.9\Metatogger.exe"

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

IEnumerable<AudioFile> files = new List<AudioFile>(); // list of checked audio files in the workspace

Update Metatogger default install path

Update Metatogger default install path


using System;
using System.Linq;
using Microsoft.VisualStudio.ExtensionsExplorer;

namespace NuGet.Dialog.Providers {

    internal class PackagesSearchNode : PackagesTreeNodeBase {

        private string _searchText;
        private readonly PackagesTreeNodeBase _baseNode;

        public PackagesTreeNodeBase BaseNode {
            get {
                return _baseNode;
            }
        }

        public PackagesSearchNode(PackagesProviderBase provider, IVsExtensionsTreeNode parent, PackagesTreeNodeBase baseNode, string searchText) :
            base(parent, provider) {

            if (baseNode == null) {
                throw new ArgumentNullException("baseNode");
            }

            _searchText = searchText;
            _baseNode = baseNode;

            // Mark this node as a SearchResults node to assist navigation in ExtensionsExplorer
            IsSearchResultsNode = true;
        }

        public override string Name {
            get {
                return Resources.Dialog_RootNodeSearch;
            }
        }

        public void SetSearchText(string newSearchText) {
            if (newSearchText == null) {
                throw new ArgumentNullException("newSearchText");
            }

            if (_searchText != newSearchText) {
                _searchText = newSearchText;

                if (IsSelected) {
                    ResetQuery();
                    LoadPage(1);
                }
            }
        }

        public override IQueryable<IPackage> GetPackages() {
            return _baseNode.GetPackages().Find(_searchText);
        }
    }
}

using System;
using System.Linq;
using Microsoft.VisualStudio.ExtensionsExplorer;

namespace NuGet.Dialog.Providers {

    internal class PackagesSearchNode : PackagesTreeNodeBase {

        private string _searchText;
        private readonly PackagesTreeNodeBase _baseNode;

        public PackagesTreeNodeBase BaseNode {
            get {
                return _baseNode;
            }
        }

        public PackagesSearchNode(PackagesProviderBase provider, IVsExtensionsTreeNode parent, PackagesTreeNodeBase baseNode, string searchText) :
            base(parent, provider) {

            if (baseNode == null) {
                throw new ArgumentNullException("baseNode");
            }

            _searchText = searchText;
            _baseNode = baseNode;

            // Mark this node as a SearchResults node to assist navigation in ExtensionsExplorer
            IsSearchResultsNode = true;
        }

        public override string Name {
            get {
                return Resources.Dialog_RootNodeSearch;
            }
        }

        public void SetSearchText(string newSearchText) {
            if (newSearchText == null) {
                throw new ArgumentNullException("newSearchText");
            }

            _searchText = newSearchText;

            if (IsSelected) {
                ResetQuery();
                LoadPage(1);
            }
        }

        public override IQueryable<IPackage> GetPackages() {
            return _baseNode.GetPackages().Find(_searchText);
        }
    }
}

Fix bug: Searching too fast in dialog returns no results when enter is pressed
Work items: 598

--HG--
branch : 1.1


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

using System;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Extensions.Configuration;

namespace Microsoft.Azure.WebJobs
{
    /// <summary>
    /// Abstraction to provide storage accounts from the connection names.
    /// This gets the storage account name via the binding attribute's <see cref="IConnectionProvider.Connection"/>
    /// property.
    /// If the connection is not specified on the attribute, it uses a default account.
    /// </summary>
    public class StorageAccountProvider
    {
        private readonly IConfiguration _configuration;

        public StorageAccountProvider(IConfiguration configuration)
        {
            _configuration = configuration;
        }

        public StorageAccount Get(string name, INameResolver resolver)
        {
            var resolvedName = resolver.ResolveWholeString(name);
            return this.Get(resolvedName);
        }

        public virtual StorageAccount Get(string name)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                name = ConnectionStringNames.Storage; // default
            }

            // $$$ Where does validation happen?
            string connectionString = _configuration.GetWebJobsConnectionString(name);
            if (connectionString == null)
            {
                // Not found
                throw new InvalidOperationException($"Storage account connection string '{name}' does not exist. Make sure that it is defined in application settings.");
            }

            return StorageAccount.NewFromConnectionString(connectionString);
        }

        /// <summary>
        /// The host account is for internal storage mechanisms like load balancer queuing.
        /// </summary>
        /// <returns></returns>
        public virtual StorageAccount GetHost()
        {
            return this.Get(null);
        }
    }
}

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

using System;
using Microsoft.Azure.WebJobs.Host;
using Microsoft.Extensions.Configuration;

namespace Microsoft.Azure.WebJobs
{
    /// <summary>
    /// Abstraction to provide storage accounts from the connection names.
    /// This gets the storage account name via the binding attribute's <see cref="IConnectionProvider.Connection"/>
    /// property.
    /// If the connection is not specified on the attribute, it uses a default account.
    /// </summary>
    public class StorageAccountProvider
    {
        private readonly IConfiguration _configuration;

        public StorageAccountProvider(IConfiguration configuration)
        {
            _configuration = configuration;
        }

        public StorageAccount Get(string name, INameResolver resolver)
        {
            var resolvedName = resolver.ResolveWholeString(name);
            return this.Get(resolvedName);
        }

        public virtual StorageAccount Get(string name)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                name = ConnectionStringNames.Storage; // default
            }

            // $$$ Where does validation happen?
            string connectionString = _configuration.GetWebJobsConnectionString(name);
            if (connectionString == null)
            {
                // Not found
                throw new InvalidOperationException($"Storage account connection string '{name}' does not exist. Make sure that it a defined App Setting.");
            }

            return StorageAccount.NewFromConnectionString(connectionString);
        }

        /// <summary>
        /// The host account is for internal storage mechanisms like load balancer queuing.
        /// </summary>
        /// <returns></returns>
        public virtual StorageAccount GetHost()
        {
            return this.Get(null);
        }
    }
}

Make generic for local and production

Make generic for local and production


// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using Xunit.Sdk;

namespace Xunit
{
    /// <summary>
    /// Apply this attribute to your test method to specify this is a platform specific test.
    /// </summary>
    [TraitDiscoverer("Xunit.NetCore.Extensions.PlatformSpecificDiscoverer", "Xunit.NetCore.Extensions")]
    [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
    public class PlatformSpecificAttribute : Attribute, ITraitAttribute
    {
        public PlatformSpecificAttribute(PlatformID platform) { }
    }
}

// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using Xunit.Sdk;

namespace Xunit
{
    /// <summary>
    /// Apply this attribute to your test method to specify this is a platform specific test.
    /// </summary>
    [TraitDiscoverer("Xunit.NetCore.Extensions.PlatformSpecificDiscoverer", "Xunit.NetCore.Extensions")]
    [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, AllowMultiple = false)]
    public class PlatformSpecificAttribute : Attribute, ITraitAttribute
    {
        public PlatformSpecificAttribute(PlatformID platform) { }
    }
}

Allow PlatformSpecific on a class

Allow PlatformSpecific on a class


using UnityEngine;
using UniRx;

namespace Reduxity.Example.PlayerMovementLook {

    [RequireComponent(typeof(Camera))]
    public class MoveCamera : MonoBehaviour {

        private Camera camera_;

        private void Awake() {
            camera_ = GetComponent<Camera>();
        }

        void Start() {
            RenderLook();
        }

        void RenderLook() {
            // Debug.Log($"App.Store: {App.Store}");
            App.Store
                .Subscribe(state => {
                    // Debug.Log($"going to move character by: {distance}");
                    // camera_.transform.localRotation = state.Look.lookRotation;
                })
                .AddTo(this);
        }

        // Ripped straight out of the Standard Assets MouseLook script. (This should really be a standard function...)
		private Quaternion ClampRotationAroundXAxis(Quaternion q, float minAngle, float maxAngle) {
			q.x /= q.w;
			q.y /= q.w;
			q.z /= q.w;
			q.w = 1.0f;

			float angleX = 2.0f * Mathf.Rad2Deg * Mathf.Atan(q.x);

			angleX = Mathf.Clamp(angleX, minAngle, maxAngle);

			q.x = Mathf.Tan(0.5f * Mathf.Deg2Rad * angleX);

			return q;
		}
    }
}

using UnityEngine;
using UniRx;

namespace Reduxity.Example.PlayerMovementLook {

    [RequireComponent(typeof(Camera))]
    public class MoveCamera : MonoBehaviour {

        private Camera camera_;

        private void Awake() {
            camera_ = GetComponent<Camera>();
        }

        void Start() {
            RenderLook();
        }

        void RenderLook() {
            // Debug.Log($"App.Store: {App.Store}");
            App.Store
                .Subscribe(state => {
                    Debug.Log($"looking by rotation: {state.Camera.transform.localRotation}");
                    camera_.transform.localRotation = state.Camera.transform.localRotation;
                })
                .AddTo(this);
        }
    }
}

Apply rendering code, now need to test

WIP: Apply rendering code, now need to test


using FaqTemplate.Core.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FaqTemplate.Infrastructure.Services
{
    public class SimpleMemoryCacheService<T> : ICacheService<T>
    {
        public Task AddOrUpdate(string key, T value)
        {
            return Task.CompletedTask;
        }

        public Task Clear()
        {
            return Task.CompletedTask;
        }

        public Task<T> Get(string key)
        {
            return Task.FromResult(default(T));
        }

        public Task<T> Remove(string key)
        {
            return Task.FromResult(default(T));
        }
    }
}

using FaqTemplate.Core.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FaqTemplate.Infrastructure.Services
{
    public class SimpleMemoryCacheService<T> : ICacheService<T>
    {
        private IDictionary<string, T> _cache;

        public SimpleMemoryCacheService()
        {
            _cache = new Dictionary<string, T>();
        }

        public Task AddOrUpdate(string key, T value)
        {
            _cache.Remove(key);
            _cache.Add(key, value);
            return Task.CompletedTask;
        }

        public Task Clear()
        {
            _cache.Clear();
            return Task.CompletedTask;
        }

        public Task<T> Get(string key)
        {
            var data = _cache.ContainsKey(key) ? _cache[key] : default(T);
            return Task.FromResult(data);
        }

        public Task<T> Remove(string key)
        {
            var data = _cache.ContainsKey(key) ? _cache[key] : default(T);
            _cache.Remove(key);
            return Task.FromResult(data);
        }
    }
}

Add implementation for simple cache using Dictionary


using System.Linq;
using Sitecore.Mvc.Helpers;
using Sitecore.Mvc.Presentation;
using System.Collections.Generic;
using System.Web;

namespace DynamicPlaceholders.Mvc.Extensions
{
	public static class SitecoreHelperExtensions
	{
		public static List<string> DynamicPlaceholders = new List<string>();

		public static HtmlString DynamicPlaceholder(this SitecoreHelper helper, string placeholderName)
		{
			var placeholder = string.Format("{0}_{1}", placeholderName, RenderingContext.Current.Rendering.UniqueId);
			var count = 0;

			if ((count = DynamicPlaceholders.Count(dp => dp.StartsWith(placeholder))) > 0)
			{
				placeholder = string.Format("{0}_{1}", placeholder, count);

				DynamicPlaceholders.Add(placeholder);
			}

			return helper.Placeholder(placeholder);
		}
	}
}

using Sitecore.Mvc.Helpers;
using Sitecore.Mvc.Presentation;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;

namespace DynamicPlaceholders.Mvc.Extensions
{
	public static class SitecoreHelperExtensions
	{
		public static HtmlString DynamicPlaceholder(this SitecoreHelper helper, string placeholderName)
		{
			var currentRenderingId = RenderingContext.Current.Rendering.UniqueId;

			return helper.Placeholder(string.Format("{0}_{1}", placeholderName, currentRenderingId));
		}
	}
}

Revert "Added ability to have more than one dynamic placeholder in the same rendering"

This reverts commit c69f12278522dc585254dbeac3176c8d790c9e9c.


// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// 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 Microsoft.Azure.ServiceManagemenet.Common.Models;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Xunit;
using Xunit.Abstractions;

namespace Commands.Network.Test.ScenarioTests
{
    public class AzureFirewallFqdnTagTests : Microsoft.WindowsAzure.Commands.Test.Utilities.Common.RMTestBase
    {
        public XunitTracingInterceptor _logger;

        public AzureFirewallFqdnTagTests(ITestOutputHelper output)
        {
            _logger = new XunitTracingInterceptor(output);
            XunitTracingInterceptor.AddToContext(new XunitTracingInterceptor(output));
        }

        [Fact(Skip = "Need to re-record test after changes are deployed in Gateway Manager.")]
        [Trait(Category.AcceptanceType, Category.CheckIn)]
        public void TestAzureFirewallFqdnTagList()
        {
            NetworkResourcesController.NewInstance.RunPsTest(_logger, "Test-AzureFirewallFqdnTagList");
        }
    }
}

// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// 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 Microsoft.Azure.ServiceManagemenet.Common.Models;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Xunit;
using Xunit.Abstractions;

namespace Commands.Network.Test.ScenarioTests
{
    public class AzureFirewallFqdnTagTests : Microsoft.WindowsAzure.Commands.Test.Utilities.Common.RMTestBase
    {
        public XunitTracingInterceptor _logger;

        public AzureFirewallFqdnTagTests(ITestOutputHelper output)
        {
            _logger = new XunitTracingInterceptor(output);
            XunitTracingInterceptor.AddToContext(new XunitTracingInterceptor(output));
        }

        [Fact(Skip = "Need to re-record test after changes are deployed in Gateway Manager.")]
        [Trait(Category.AcceptanceType, Category.CheckIn)]
        [Trait(Category.Owner, "azurefirewall")]
        public void TestAzureFirewallFqdnTagList()
        {
            NetworkResourcesController.NewInstance.RunPsTest(_logger, "Test-AzureFirewallFqdnTagList");
        }
    }
}

Add test owner to FqdnTag test

Add test owner to FqdnTag test


using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.Extensions.Options;

namespace Umbraco.Cms.Web.Website.ViewEngines
{
    /// <summary>
    /// Configure view engine locations for front-end rendering
    /// </summary>
    public class RenderRazorViewEngineOptionsSetup : IConfigureOptions<RazorViewEngineOptions>
    {
        /// <inheritdoc/>
        public void Configure(RazorViewEngineOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            options.ViewLocationExpanders.Add(new ViewLocationExpander());
        }

        /// <summary>
        /// Expands the default view locations
        /// </summary>
        private class ViewLocationExpander : IViewLocationExpander
        {
            public IEnumerable<string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable<string> viewLocations)
            {
                string[] umbViewLocations = new string[]
                {
                    "/Views/Partials/{0}.cshtml",
                    "/Views/MacroPartials/{0}.cshtml",
                    "/Views/{0}.cshtml"
                };

                viewLocations = umbViewLocations.Concat(viewLocations);

                return viewLocations;
            }

            // not a dynamic expander
            public void PopulateValues(ViewLocationExpanderContext context) { }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.Extensions.Options;

namespace Umbraco.Cms.Web.Website.ViewEngines
{
    /// <summary>
    /// Configure view engine locations for front-end rendering
    /// </summary>
    public class RenderRazorViewEngineOptionsSetup : IConfigureOptions<RazorViewEngineOptions>
    {
        /// <inheritdoc/>
        public void Configure(RazorViewEngineOptions options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            options.ViewLocationExpanders.Add(new ViewLocationExpander());
        }

        /// <summary>
        /// Expands the default view locations
        /// </summary>
        private class ViewLocationExpander : IViewLocationExpander
        {
            public IEnumerable<string> ExpandViewLocations(ViewLocationExpanderContext context, IEnumerable<string> viewLocations)
            {
                string[] umbViewLocations = new string[]
                {
                    "/Views/{0}.cshtml",
                    "/Views/Shared/{0}.cshtml",
                    "/Views/Partials/{0}.cshtml",
                    "/Views/MacroPartials/{0}.cshtml",
                };

                viewLocations = umbViewLocations.Concat(viewLocations);

                return viewLocations;
            }

            // not a dynamic expander
            public void PopulateValues(ViewLocationExpanderContext context) { }
        }
    }
}

Fix ordering of views so the ordering is the same as v8


// This script is executed on the server

$MAP_ROOT = "ethernet/maps/eth1/";

$sgLightEditor::lightDBPath = $MAP_ROOT @ "lights/";
$sgLightEditor::filterDBPath = $MAP_ROOT @ "filters/";
sgLoadDataBlocks($sgLightEditor::lightDBPath);
sgLoadDataBlocks($sgLightEditor::filterDBPath);

//exec("./difs/propertymap.cs");
//exec("./scripts/env.cs");

// This script is executed on the server

$MAP_ROOT = "ethernet/maps/eth1/";

$sgLightEditor::lightDBPath = $MAP_ROOT @ "lights/";
$sgLightEditor::filterDBPath = $MAP_ROOT @ "filters/";
sgLoadDataBlocks($sgLightEditor::lightDBPath);
sgLoadDataBlocks($sgLightEditor::filterDBPath);

//------------------------------------------------------------------------------
// Material mappings
//------------------------------------------------------------------------------

%mapping = createMaterialMapping("gray3");
%mapping.sound = $MaterialMapping::Sound::Hard;
%mapping.color = "0.3 0.3 0.3 0.4 0.0";

%mapping = createMaterialMapping("grass2");
%mapping.sound = $MaterialMapping::Sound::Soft;
%mapping.color = "0.3 0.3 0.3 0.4 0.0";

%mapping = createMaterialMapping("rock");
%mapping.sound = $MaterialMapping::Sound::Hard;
%mapping.color = "0.3 0.3 0.3 0.4 0.0";

%mapping = createMaterialMapping("stone");
%mapping.sound = $MaterialMapping::Sound::Hard;
%mapping.color = "0.3 0.3 0.3 0.4 0.0";

Add material mappings to eth1.

Add material mappings to eth1.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using RightpointLabs.ConferenceRoom.Domain.Models;
using RightpointLabs.ConferenceRoom.Domain.Models.Entities;
using RightpointLabs.ConferenceRoom.Domain.Repositories;
using RightpointLabs.ConferenceRoom.Infrastructure.Services;

namespace RightpointLabs.ConferenceRoom.Services.Controllers
{
    [RoutePrefix("api/devices")]
    public class DeviceController : ApiController
    {
        private readonly IOrganizationRepository _organizationRepository;
        private readonly IDeviceRepository _deviceRepository;
        private readonly ITokenService _tokenService;

        public DeviceController(IOrganizationRepository organizationRepository, IDeviceRepository deviceRepository, ITokenService tokenService)
        {
            _organizationRepository = organizationRepository;
            _deviceRepository = deviceRepository;
            _tokenService = tokenService;
        }

        [Route("create")]
        public object PostCreate(string organizationId, string joinKey)
        {
            var org = _organizationRepository.Get(organizationId);

            if (null == org || org.JoinKey != joinKey)
            {
                return new HttpResponseMessage(HttpStatusCode.Forbidden);
            }

            var device = _deviceRepository.Create(new DeviceEntity()
            {
                OrganizationId = org.Id
            });

            var token = CreateToken(device);

            return token;
        }

        private string CreateToken(DeviceEntity device)
        {
            return _tokenService.CreateDeviceToken(device.Id);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Web.Http;
using RightpointLabs.ConferenceRoom.Domain.Models;
using RightpointLabs.ConferenceRoom.Domain.Models.Entities;
using RightpointLabs.ConferenceRoom.Domain.Repositories;
using RightpointLabs.ConferenceRoom.Infrastructure.Services;

namespace RightpointLabs.ConferenceRoom.Services.Controllers
{
    [RoutePrefix("api/devices")]
    public class DeviceController : ApiController
    {
        private readonly IOrganizationRepository _organizationRepository;
        private readonly IDeviceRepository _deviceRepository;
        private readonly ITokenService _tokenService;

        public DeviceController(IOrganizationRepository organizationRepository, IDeviceRepository deviceRepository, ITokenService tokenService)
        {
            _organizationRepository = organizationRepository;
            _deviceRepository = deviceRepository;
            _tokenService = tokenService;
        }

        [Route("create")]
        public HttpResponseMessage PostCreate(string organizationId, string joinKey)
        {
            var org = _organizationRepository.Get(organizationId);

            if (null == org || org.JoinKey != joinKey)
            {
                return new HttpResponseMessage(HttpStatusCode.Forbidden);
            }

            var device = _deviceRepository.Create(new DeviceEntity()
            {
                OrganizationId = org.Id
            });

            var token = _tokenService.CreateDeviceToken(device.Id);
            return new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(token, Encoding.UTF8) };
        }
    }
}

Update device creation to just return the raw token


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

namespace Microsoft.CodeAnalysis.CodeStyle
{
    internal static class NotificationOptionExtensions
    {
        public static string ToEditorConfigString(this NotificationOption notificationOption)
        {
            if (notificationOption == NotificationOption.Silent)
            {
                return nameof(NotificationOption.Silent).ToLowerInvariant();
            }
            else
            {
                return notificationOption.ToString().ToLowerInvariant();
            }
        }
    }
}

// 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 Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.CodeStyle
{
    internal static class NotificationOptionExtensions
    {
        public static string ToEditorConfigString(this NotificationOption notificationOption)
        {
            return notificationOption.Severity switch
            {
                ReportDiagnostic.Suppress => EditorConfigSeverityStrings.None,
                ReportDiagnostic.Hidden => EditorConfigSeverityStrings.Silent,
                ReportDiagnostic.Info => EditorConfigSeverityStrings.Suggestion,
                ReportDiagnostic.Warn => EditorConfigSeverityStrings.Warning,
                ReportDiagnostic.Error => EditorConfigSeverityStrings.Error,
                _ => throw ExceptionUtilities.Unreachable
            };
        }
    }
}

Create mapping from NotificationOption to EditorConfig severity string.


using System;
using Entitas;
using UnityEditor;

namespace Entitas.Unity.VisualDebugging {
    public class EnumTypeDrawer : ITypeDrawer {
        public bool HandlesType(Type type) {
            return type.IsEnum;
        }

        public object DrawAndGetNewValue(Type memberType, string memberName, object value, Entity entity, int index, IComponent component) {
            return EditorGUILayout.EnumPopup(memberName, (Enum)value);
        }
    }
}

using System;
using Entitas;
using UnityEditor;

namespace Entitas.Unity.VisualDebugging {
    public class EnumTypeDrawer : ITypeDrawer {
        public bool HandlesType(Type type) {
            return type.IsEnum;
        }

        public object DrawAndGetNewValue(Type memberType, string memberName, object value, Entity entity, int index, IComponent component) {
            if (memberType.IsDefined(typeof(FlagsAttribute), false)) {
                return EditorGUILayout.EnumMaskField(memberName, (Enum)value);
            }
            return EditorGUILayout.EnumPopup(memberName, (Enum)value);
        }
    }
}

Support visual debugging of enum masks.

Support visual debugging of enum masks.


using System;
using System.Collections.Generic;
using System.Linq;
using OpenQA.Selenium;

namespace Diskordia.Columbus.Bots.Host.Services.SingaporeAirlines.PageObjects
{
	public class FareDealsSectionComponent
	{
		private readonly IWebDriver driver;
		private readonly IWebElement element;

		public FareDealsSectionComponent(IWebDriver driver, IWebElement element)
		{
			if (driver == null)
			{
				throw new ArgumentNullException(nameof(driver));
			}

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

			this.driver = driver;
			this.element = element;
		}

		public string DepartureAirport
		{
			get
			{
				return this.driver.FindElement(By.ClassName("select__text")).Text;
			}
		}

		public IEnumerable<FareDealsListItemComponent> FareDeals
		{
			get
			{
				return this.driver.FindElements(By.CssSelector(".fare-deals-list li"))
					       		  .Where(e => !string.IsNullOrWhiteSpace(e.FindElement(By.ClassName("link")).Text))
					       		  .Select(e => new FareDealsListItemComponent(this.driver, e));
			}
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using OpenQA.Selenium;

namespace Diskordia.Columbus.Bots.Host.Services.SingaporeAirlines.PageObjects
{
	public class FareDealsSectionComponent
	{
		private readonly IWebDriver driver;
		private readonly IWebElement element;

		public FareDealsSectionComponent(IWebDriver driver, IWebElement element)
		{
			if (driver == null)
			{
				throw new ArgumentNullException(nameof(driver));
			}

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

			this.driver = driver;
			this.element = element;
		}

		public string DepartureAirport
		{
			get
			{
				return this.element.FindElement(By.ClassName("select__text")).Text;
			}
		}

		public IEnumerable<FareDealsListItemComponent> FareDeals
		{
			get
			{
				return this.element.FindElements(By.CssSelector(".fare-deals-list li"))
					       		  .Where(e => !string.IsNullOrWhiteSpace(e.FindElement(By.ClassName("link")).Text))
					       		  .Select(e => new FareDealsListItemComponent(this.driver, e));
			}
		}
	}
}

fix(SingaporeAirlinesBot): Make sure the departure airport gets filled correctly.


#region License
/*********************************************************************************
 * RootJsonSyntax.cs
 *
 * Copyright (c) 2004-2019 Henk Nicolai
 *
 *    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

using System.Collections.Generic;

namespace Eutherion.Text.Json
{
    /// <summary>
    /// Contains the syntax tree and list of parse errors which are the result of parsing json.
    /// </summary>
    public sealed class RootJsonSyntax
    {
        public JsonMultiValueSyntax Syntax { get; }
        public List<JsonErrorInfo> Errors { get; }

        public RootJsonSyntax(JsonMultiValueSyntax syntax, List<JsonErrorInfo> errors)
        {
            Syntax = syntax;
            Errors = errors;
        }
    }
}

#region License
/*********************************************************************************
 * RootJsonSyntax.cs
 *
 * Copyright (c) 2004-2019 Henk Nicolai
 *
 *    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

using System;
using System.Collections.Generic;

namespace Eutherion.Text.Json
{
    /// <summary>
    /// Contains the syntax tree and list of parse errors which are the result of parsing json.
    /// </summary>
    public sealed class RootJsonSyntax
    {
        public JsonMultiValueSyntax Syntax { get; }
        public List<JsonErrorInfo> Errors { get; }

        public RootJsonSyntax(JsonMultiValueSyntax syntax, List<JsonErrorInfo> errors)
        {
            Syntax = syntax ?? throw new ArgumentNullException(nameof(syntax));
            Errors = errors ?? throw new ArgumentNullException(nameof(errors));
        }
    }
}

Throw on null syntax or errors.

Throw on null syntax or errors.


using System;
using System.ComponentModel.DataAnnotations;
using System.Reflection;

namespace CertiPay.Common
{
    public static class ExtensionMethods
    {
        /// <summary>
        /// Trims the string of any whitestace and leaves null if there is no content.
        /// </summary>
        public static String TrimToNull(this String s)
        {
            return String.IsNullOrWhiteSpace(s) ? null : s.Trim();
        }

        /// <summary>
        /// Returns the display name from the display attribute on the enumeration, if available.
        /// Otherwise returns the ToString() value.
        /// </summary>
        public static string DisplayName(this Enum val)
        {
            return val.Display(e => e.GetName());
        }

        /// <summary>
        /// Returns the short name from the display attribute on the enumeration, if available.
        /// Otherwise returns the ToString() value.
        /// </summary>
        public static string ShortName(this Enum val)
        {
            return val.Display(e => e.GetShortName());
        }

        /// <summary>
        /// Returns the description from the display attribute on the enumeration, if available.
        /// Otherwise returns the ToString() value.
        /// </summary>
        public static string Description(this Enum val)
        {
            return val.Display(e => e.GetDescription());
        }

        private static String Display(this Enum val, Func<DisplayAttribute, String> selector)
        {
            FieldInfo fi = val.GetType().GetField(val.ToString());

            DisplayAttribute[] attributes = (DisplayAttribute[])fi.GetCustomAttributes(typeof(DisplayAttribute), false);

            if (attributes != null && attributes.Length > 0)
            {
                return selector.Invoke(attributes[0]);
            }

            return val.ToString();
        }
    }
}

using System;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;

namespace CertiPay.Common
{
    public static class ExtensionMethods
    {
        /// <summary>
        /// Trims the string of any whitestace and leaves null if there is no content.
        /// </summary>
        public static String TrimToNull(this String s)
        {
            return String.IsNullOrWhiteSpace(s) ? null : s.Trim();
        }

        /// <summary>
        /// Returns the display name from the display attribute on the enumeration, if available.
        /// Otherwise returns the ToString() value.
        /// </summary>
        public static string DisplayName(this Enum val)
        {
            return val.Display(e => e.GetName());
        }

        /// <summary>
        /// Returns the short name from the display attribute on the enumeration, if available.
        /// Otherwise returns the ToString() value.
        /// </summary>
        public static string ShortName(this Enum val)
        {
            return val.Display(e => e.GetShortName());
        }

        /// <summary>
        /// Returns the description from the display attribute on the enumeration, if available.
        /// Otherwise returns the ToString() value.
        /// </summary>
        public static string Description(this Enum val)
        {
            return val.Display(e => e.GetDescription());
        }

        private static String Display(this Enum val, Func<DisplayAttribute, String> selector)
        {
            FieldInfo fi = val.GetType().GetField(val.ToString());

            var attributes = fi.GetCustomAttributes<DisplayAttribute>();

            if (attributes != null && attributes.Any())
            {
                return selector.Invoke(attributes.First());
            }

            return val.ToString();
        }
    }
}

Tweak to use typed GetCustomAttributes from field


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using global::Nustache.Core;

namespace Dolstagis.Web.Views.Nustache
{
    public class NustacheViewEngine : ViewEngineBase
    {
        private static readonly string[] _extensions = new[] { "nustache" };

        public override IEnumerable<string> Extensions
        {
            get { return _extensions; }
        }

        protected override IView CreateView(VirtualPath pathToView, Static.IResourceLocator locator)
        {
            var resource = locator.GetResource(pathToView);
            if (resource == null || !resource.Exists) {
                throw new ViewNotFoundException("There is no view at " + pathToView.ToString());
            }

            return new NustacheView(this, pathToView, resource);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using global::Nustache.Core;

namespace Dolstagis.Web.Views.Nustache
{
    public class NustacheViewEngine : ViewEngineBase
    {
        private static readonly string[] _extensions = new[] { "mustache", "nustache" };

        public override IEnumerable<string> Extensions
        {
            get { return _extensions; }
        }

        protected override IView CreateView(VirtualPath pathToView, Static.IResourceLocator locator)
        {
            var resource = locator.GetResource(pathToView);
            if (resource == null || !resource.Exists) {
                throw new ViewNotFoundException("There is no view at " + pathToView.ToString());
            }

            return new NustacheView(this, pathToView, resource);
        }
    }
}

Allow .mustache extension as well for Nustache views


// Copyright Matthias Koch 2017.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE

using System;
using System.IO;
using System.Linq;
using JetBrains.Annotations;
using Nuke.Common.IO;
using Nuke.Core.Execution;
using Nuke.Core.Tooling;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NamingConventions;

[assembly: IconClass(typeof(YamlTasks), "file-empty2")]

namespace Nuke.Common.IO
{
    [PublicAPI]
    public class YamlTasks
    {
        public static void YamlSerialize<T> (T obj, string path, Configure<SerializerBuilder> configurator = null)
        {
            var builder = new SerializerBuilder()
                    .WithNamingConvention(new CamelCaseNamingConvention());
            builder = configurator.InvokeSafe(builder);

            var serializer = builder.Build();
            var content = serializer.Serialize(obj);
            File.WriteAllText(path, content);
        }

        [Pure]
        public static T YamlDeserialize<T> (string path, Configure<DeserializerBuilder> configurator = null)
        {
            var builder = new DeserializerBuilder()
                    .WithNamingConvention(new CamelCaseNamingConvention());
            builder = configurator.InvokeSafe(builder);

            var content = File.ReadAllText(path);
            var deserializer = builder.Build();
            return deserializer.Deserialize<T>(content);
        }
    }
}

// Copyright Matthias Koch 2017.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE

using System;
using System.IO;
using System.Linq;
using JetBrains.Annotations;
using Nuke.Common.IO;
using Nuke.Core.Execution;
using Nuke.Core.Tooling;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NamingConventions;

[assembly: IconClass(typeof(YamlTasks), "file-empty2")]

namespace Nuke.Common.IO
{
    [PublicAPI]
    public class YamlTasks
    {
        public static void YamlSerializeToFile (object obj, string path, Configure<SerializerBuilder> configurator = null)
        {
            File.WriteAllText(path, YamlSerialize(obj, configurator));
        }

        [Pure]
        public static T YamlDeserializeFromFile<T> (string path, Configure<DeserializerBuilder> configurator = null)
        {
            return YamlDeserialize<T>(File.ReadAllText(path), configurator);
        }

        [Pure]
        public static string YamlSerialize (object obj, Configure<SerializerBuilder> configurator = null)
        {
            var builder = new SerializerBuilder()
                    .WithNamingConvention(new CamelCaseNamingConvention());
            builder = configurator.InvokeSafe(builder);

            var serializer = builder.Build();
            return serializer.Serialize(obj);
        }

        [Pure]
        public static T YamlDeserialize<T> (string content, Configure<DeserializerBuilder> configurator = null)
        {
            var builder = new DeserializerBuilder()
                    .WithNamingConvention(new CamelCaseNamingConvention());
            builder = configurator.InvokeSafe(builder);

            var deserializer = builder.Build();
            return deserializer.Deserialize<T>(content);
        }
    }
}

Add string based YAML tasks.

Add string based YAML tasks.


// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace Microsoft.DotNet.ProjectJsonMigration
{
    internal class ConstantPackageVersions
    {
        public const string AspNetToolsVersion = "1.0.0-rc1-final";
        public const string TestSdkPackageVersion = "15.0.0-preview-20161024-02";
        public const string XUnitPackageVersion = "2.2.0-beta3-build3402";
        public const string XUnitRunnerPackageVersion = "2.2.0-beta4-build1188";
        public const string MstestTestAdapterVersion = "1.1.3-preview";
        public const string MstestTestFrameworkVersion = "1.0.4-preview";
    }
}

// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace Microsoft.DotNet.ProjectJsonMigration
{
    internal class ConstantPackageVersions
    {
        public const string AspNetToolsVersion = "1.0.0-msbuild1-final";
        public const string TestSdkPackageVersion = "15.0.0-preview-20161024-02";
        public const string XUnitPackageVersion = "2.2.0-beta3-build3402";
        public const string XUnitRunnerPackageVersion = "2.2.0-beta4-build1188";
        public const string MstestTestAdapterVersion = "1.1.3-preview";
        public const string MstestTestFrameworkVersion = "1.0.4-preview";
    }
}

Change ASP.NET tool version to reflect project format.


using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.VisualStudio.TestTools.UnitTesting;

using TestHelper;

namespace DebuggerStepThroughRemover.Test
{
    [TestClass]
    public class AnalyzerTests : DiagnosticVerifier
    {
        [TestMethod]
        public void WithEmptySourceFile_ShouldNotFindAnything()
        {
            var test = @"";

            VerifyCSharpDiagnostic(test);
        }

        [TestMethod]
        public void Analyzer_WithImportedNameSpace_ShouldReportAttribute()
        {
            var test = @"
using System.Diagnostics;

namespace ConsoleApplication1
{
    [DebuggerStepThrough]
    class TypeName
    {
    }
}";

            var expected = new DiagnosticResult
            {
                Id = "DebuggerStepThroughRemover",
                Message = $"Type 'TypeName' is decorated with DebuggerStepThrough attribute",
                Severity = DiagnosticSeverity.Warning,
                Locations =
                    new[] {
                            new DiagnosticResultLocation("Test0.cs", 6, 5)
                        }
            };

            VerifyCSharpDiagnostic(test, expected);
        }

        protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer()
        {
            return new DebuggerStepThroughRemoverAnalyzer();
        }
    }
}

using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.VisualStudio.TestTools.UnitTesting;

using TestHelper;

namespace DebuggerStepThroughRemover.Test
{
    [TestClass]
    public class AnalyzerTests : DiagnosticVerifier
    {
        [TestMethod]
        public void WithEmptySourceFile_ShouldNotFindAnything()
        {
            var test = @"";

            VerifyCSharpDiagnostic(test);
        }

        [TestMethod]
        public void Analyzer_WithImportedNameSpace_ShouldReportAttribute()
        {
            var test = @"
using System.Diagnostics;

namespace ConsoleApplication1
{
    [DebuggerStepThrough]
    class TypeName
    {
    }
}";

            var expected = new DiagnosticResult
            {
                Id = "DebuggerStepThroughRemover",
                Message = $"Type 'TypeName' is decorated with DebuggerStepThrough attribute",
                Severity = DiagnosticSeverity.Warning,
                Locations =
                    new[] {
                            new DiagnosticResultLocation("Test0.cs", 6, 5)
                        }
            };

            VerifyCSharpDiagnostic(test, expected);
        }

        [TestMethod]
        public void Analyzer_WithoutImportedNameSpace_ShouldReportAttribute()
        {
            var test = @"
namespace ConsoleApplication1
{
    [System.Diagnostics.DebuggerStepThrough]
    class TypeName
    {
    }
}";

            var expected = new DiagnosticResult
            {
                Id = "DebuggerStepThroughRemover",
                Message = $"Type 'TypeName' is decorated with DebuggerStepThrough attribute",
                Severity = DiagnosticSeverity.Warning,
                Locations =
                    new[] {
                            new DiagnosticResultLocation("Test0.cs", 4, 5)
                        }
            };

            VerifyCSharpDiagnostic(test, expected);
        }

        protected override DiagnosticAnalyzer GetCSharpDiagnosticAnalyzer()
        {
            return new DebuggerStepThroughRemoverAnalyzer();
        }
    }
}

Add unit test for analyzing class without imported namespace.


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

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

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

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

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

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

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

        public Task Run(
            [TimerTrigger("0 0 0 28 * *")] TimerInfo timer,
            ILogger logger)
        {
            return Task.FromResult(0);
            // return _messageSession.Send(new ExpireFundsCommand());
        }
    }
}

Remove code to trigger expiry of funds processing until fix has been implemented for the calculation


using System;
using System.Collections.Generic;
using System.Linq;
using NHibernate.Linq;
using Tellurium.VisualAssertions.Infrastructure;
using Tellurium.VisualAssertions.Screenshots.Domain;

namespace Tellurium.VisualAssertion.Dashboard.Services.TestResults.Queries
{
    public class FindTestResultsFromSession : IQueryAll<TestResult>
    {
        private readonly long sessionId;
        private readonly string browserName;
        private readonly TestResultStatusFilter resultStatus;

        public FindTestResultsFromSession(long sessionId, string browserName, TestResultStatusFilter resultStatus)
        {
            this.sessionId = sessionId;
            this.browserName = browserName;
            this.resultStatus = resultStatus;
        }

        public List<TestResult> GetQuery(IQueryable<TestResult> query)
        {
            var testFromSession = query.Where(x=>x.TestSession.Id == sessionId)
                .Fetch(x=>x.Pattern)
                .Where(x=>x.BrowserName == browserName);

            switch (resultStatus)
            {
                case TestResultStatusFilter.All:
                    return testFromSession.ToList();
                case TestResultStatusFilter.Passed:
                    return testFromSession.Where(x=>x.Status == TestResultStatus.Passed).ToList();
                case TestResultStatusFilter.Failed:
                    return testFromSession.Where(x => x.Status == TestResultStatus.Failed).ToList();
                case TestResultStatusFilter.New:
                    return testFromSession.Where(x => x.Status == TestResultStatus.NewPattern).ToList();
                default:
                    throw new ArgumentOutOfRangeException();
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using NHibernate.Linq;
using Tellurium.VisualAssertions.Infrastructure;
using Tellurium.VisualAssertions.Screenshots.Domain;

namespace Tellurium.VisualAssertion.Dashboard.Services.TestResults.Queries
{
    public class FindTestResultsFromSession : IQueryAll<TestResult>
    {
        private readonly long sessionId;
        private readonly string browserName;
        private readonly TestResultStatusFilter resultStatus;

        public FindTestResultsFromSession(long sessionId, string browserName, TestResultStatusFilter resultStatus)
        {
            this.sessionId = sessionId;
            this.browserName = browserName;
            this.resultStatus = resultStatus;
        }

        public List<TestResult> GetQuery(IQueryable<TestResult> query)
        {
            var testFromSession = query.Where(x=>x.TestSession.Id == sessionId)
                .Fetch(x=>x.Pattern)
                .Where(x=>x.BrowserName == browserName);

            switch (resultStatus)
            {
                case TestResultStatusFilter.All:
                    return testFromSession.ToList();
                case TestResultStatusFilter.Passed:
                    return testFromSession.Where(x=>x.Status == TestResultStatus.Passed).OrderBy(x=>x.Id).ToList();
                case TestResultStatusFilter.Failed:
                    return testFromSession.Where(x => x.Status == TestResultStatus.Failed).OrderBy(x => x.Id).ToList();
                case TestResultStatusFilter.New:
                    return testFromSession.Where(x => x.Status == TestResultStatus.NewPattern).OrderBy(x => x.Id).ToList();
                default:
                    throw new ArgumentOutOfRangeException();
            }
        }
    }
}

Fix filtered test result ordering

Fix filtered test result ordering


using System;
using System.Net;
using BmpListener.Bgp;
using System.Linq;
using BmpListener.MiscUtil.Conversion;

namespace BmpListener.Bmp
{
    public class PeerUpNotification : BmpMessage
    {
        public IPAddress LocalAddress { get; private set; }
        public int LocalPort { get; private set; }
        public int RemotePort { get; private set; }
        public BgpOpenMessage SentOpenMessage { get; private set; }
        public BgpOpenMessage ReceivedOpenMessage { get; private set; }

        public override void Decode(byte[] data, int offset)
        {
            if (((PeerHeader.Flags & (1 << 7)) != 0))
            {
                var ipBytes = new byte[16];
                Array.Copy(data, offset, ipBytes, 0, 4);
                LocalAddress = new IPAddress(ipBytes);
            }
            else
            {
                var ipBytes = new byte[4];
                Array.Copy(data, offset + 12, ipBytes, 0, 4);
                LocalAddress = new IPAddress(ipBytes);
            }

            LocalPort = EndianBitConverter.Big.ToUInt16(data, 16);
            RemotePort = EndianBitConverter.Big.ToUInt16(data, 18);

            offset += 20;
            SentOpenMessage = BgpMessage.DecodeMessage(data, offset) as BgpOpenMessage;

            offset += SentOpenMessage.Header.Length;
            ReceivedOpenMessage = BgpMessage.DecodeMessage(data, offset) as BgpOpenMessage;
        }
    }
}

using System;
using System.Net;
using BmpListener.Bgp;
using System.Linq;
using BmpListener.MiscUtil.Conversion;

namespace BmpListener.Bmp
{
    public class PeerUpNotification : BmpMessage
    {
        public IPAddress LocalAddress { get; private set; }
        public int LocalPort { get; private set; }
        public int RemotePort { get; private set; }
        public BgpOpenMessage SentOpenMessage { get; private set; }
        public BgpOpenMessage ReceivedOpenMessage { get; private set; }

        public override void Decode(byte[] data, int offset)
        {
            if (((PeerHeader.Flags & (1 << 7)) != 0))
            {
                var ipBytes = new byte[16];
                Array.Copy(data, offset, ipBytes, 0, 4);
                LocalAddress = new IPAddress(ipBytes);
                offset += 4;
            }
            else
            {
                var ipBytes = new byte[4];
                Array.Copy(data, offset + 12, ipBytes, 0, 4);
                LocalAddress = new IPAddress(ipBytes);
                offset += 16;
            }

            LocalPort = EndianBitConverter.Big.ToUInt16(data, offset);
            offset += 2;
            RemotePort = EndianBitConverter.Big.ToUInt16(data, offset);
            offset += 2;

            SentOpenMessage = BgpMessage.DecodeMessage(data, offset) as BgpOpenMessage;
            offset += SentOpenMessage.Header.Length;
            ReceivedOpenMessage = BgpMessage.DecodeMessage(data, offset) as BgpOpenMessage;
        }
    }
}

Fix peer up port decoding bug

Fix peer up port decoding bug


namespace Fixie.Tests.Execution
{
    using System;
    using Fixie.Cli;
    using Fixie.Execution;

    public class OptionsTests
    {
        public void DemandsAssemblyPathProvided()
        {
            var options = new Options(null);

            Action validate = options.Validate;

            validate.ShouldThrow<CommandLineException>(
                "Missing required test assembly path.");
        }

        public void DemandsAssemblyPathExistsOnDisk()
        {
            var options = new Options("foo.dll");

            Action validate = options.Validate;

            validate.ShouldThrow<CommandLineException>(
                "Specified test assembly does not exist: foo.dll");
        }

        public void DemandsAssemblyPathDirectoryContainsFixie()
        {
            var mscorlib = typeof(string).Assembly.Location;

            var options = new Options(mscorlib);

            Action validate = options.Validate;

            validate.ShouldThrow<CommandLineException>(
                $"Specified assembly {mscorlib} does not appear to be a test assembly. Ensure that it references Fixie.dll and try again.");
        }

        public void AcceptsExistingTestAssemblyPath()
        {
            var assemblyPath = typeof(OptionsTests).Assembly.Location;

            var options = new Options(assemblyPath);

            options.Validate();
        }
    }
}

namespace Fixie.Tests.Execution
{
    using System;
    using Fixie.Cli;
    using Fixie.Execution;

    public class OptionsTests
    {
        public void DemandsAssemblyPathProvided()
        {
            var options = new Options(null);

            Action validate = options.Validate;

            validate.ShouldThrow<CommandLineException>(
                "Missing required test assembly path.");
        }

        public void DemandsAssemblyPathExistsOnDisk()
        {
            var options = new Options("foo.dll");

            Action validate = options.Validate;

            validate.ShouldThrow<CommandLineException>(
                "Specified test assembly does not exist: foo.dll");
        }

        public void DemandsAssemblyPathDirectoryContainsFixie()
        {
            var mscorlib = typeof(string).Assembly.Location;

            var options = new Options(mscorlib);

            Action validate = options.Validate;

            validate.ShouldThrow<CommandLineException>(
                $"Specified assembly {mscorlib} does not appear to be a test assembly. Ensure that it references Fixie.dll and try again.");
        }

        public void AcceptsExistingTestAssemblyPath()
        {
            var assemblyPath = typeof(OptionsTests).Assembly.Location;

            var options = new Options(assemblyPath);

            options.Validate();
        }

        public void DemandsValidReportFileNameWhenProvided()
        {
            var assemblyPath = typeof(OptionsTests).Assembly.Location;

            var options = new Options(assemblyPath);

            Action validate = options.Validate;

            options.Report = "Report.xml";
            validate();

            options.Report = "\t";
            validate.ShouldThrow<CommandLineException>(
                "Specified report name is invalid: \t");
        }
    }
}

Test coverage for validation of the --report command line option.


using System.Security.Cryptography;
using DeviceId.Encoders;
using DeviceId.Formatters;

namespace DeviceId
{
    /// <summary>
    /// Provides access to some of the default formatters.
    /// </summary>
    public static class DeviceIdFormatters
    {
        /// <summary>
        /// Returns the default formatter used in version 5 of the DeviceId library.
        /// </summary>
        public static IDeviceIdFormatter DefaultV5 { get; } = new HashDeviceIdFormatter(() => SHA256.Create(), new Base64UrlByteArrayEncoder());

        /// <summary>
        /// Returns the default formatter used in version 4 of the DeviceId library.
        /// </summary>
        public static IDeviceIdFormatter DefaultV6 { get; } = new HashDeviceIdFormatter(() => SHA256.Create(), new Base32ByteArrayEncoder());
    }
}

using System.Security.Cryptography;
using DeviceId.Encoders;
using DeviceId.Formatters;

namespace DeviceId
{
    /// <summary>
    /// Provides access to some of the default formatters.
    /// </summary>
    public static class DeviceIdFormatters
    {
        /// <summary>
        /// Returns the default formatter used in version 5 of the DeviceId library.
        /// </summary>
        public static IDeviceIdFormatter DefaultV5 { get; } = new HashDeviceIdFormatter(() => SHA256.Create(), new Base64UrlByteArrayEncoder());

        /// <summary>
        /// Returns the default formatter used in version 4 of the DeviceId library.
        /// </summary>
        public static IDeviceIdFormatter DefaultV6 { get; } = new HashDeviceIdFormatter(() => SHA256.Create(), new Base32ByteArrayEncoder(Base32ByteArrayEncoder.CrockfordAlphabet));
    }
}

Use Crockford Base32 by default.

Use Crockford Base32 by default.


using System;
using System.Collections.Generic;
using System.Text;
using GalaSoft.MvvmLight.Views;
using ToxRt.Helpers;
using ToxRt.Model;
using ToxRt.NavigationService;

namespace ToxRt.ViewModel
{
    public class LoadProfileViewModel : NavigableViewModelBase
    {
        #region Fields

        #endregion
        #region Properties

        #endregion
        #region Commands

        #endregion
        #region Ctors and Methods
        public LoadProfileViewModel(INavigationService navigationService, IDataService dataService, IMessagesNavigationService innerNavigationService)
            : base(navigationService,dataService, innerNavigationService)
        {
        }

        #endregion
    }
}

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;
using GalaSoft.MvvmLight.Command;
using GalaSoft.MvvmLight.Views;
using ToxRt.Helpers;
using ToxRt.Model;
using ToxRt.NavigationService;

namespace ToxRt.ViewModel
{
    public class LoadProfileViewModel : NavigableViewModelBase
    {
        #region Fields
        private ObservableCollection<Profile> _listProfiles;
        private Profile _selectedProfile;
        #endregion
        #region Properties
        public ObservableCollection<Profile> ListProfilesNames
        {
            get
            {
                return _listProfiles;
            }

            set
            {
                if (_listProfiles == value)
                {
                    return;
                }

                _listProfiles = value;
                RaisePropertyChanged();
            }
        }
        public Profile SelectedProfile
        {
            get
            {
                return _selectedProfile;
            }

            set
            {
                if (_selectedProfile == value)
                {
                    return;
                }

                _selectedProfile = value;
                RaisePropertyChanged();
            }
        }
        #endregion
        #region Commands
        private RelayCommand _loadProfielCommand;
        public RelayCommand LoadProfileCommand
        {
            get
            {
                return _loadProfielCommand
                    ?? (_loadProfielCommand = new RelayCommand(
                    () =>
                    {

                    }));
            }
        }
        private RelayCommand _setDefaultProfileCommand;
        public RelayCommand SetDefaultProfileCommand
        {
            get
            {
                return _setDefaultProfileCommand
                    ?? (_setDefaultProfileCommand = new RelayCommand(
                    () =>
                    {

                    }));
            }
        }
        #endregion
        #region Ctors and Methods
        public LoadProfileViewModel(INavigationService navigationService, IDataService dataService, IMessagesNavigationService innerNavigationService)
            : base(navigationService,dataService, innerNavigationService)
        {
        }

        #endregion
    }
}

Add Needed Vm properties and cmds

Add Needed Vm properties and cmds


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

using System.Collections.Specialized;
using System.Linq;
using osu.Framework.Bindables;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;

namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
{
    /// <summary>
    /// The part of the timeline that displays the control points.
    /// </summary>
    public class ControlPointPart : TimelinePart<GroupVisualisation>
    {
        private BindableList<ControlPointGroup> controlPointGroups;

        protected override void LoadBeatmap(WorkingBeatmap beatmap)
        {
            base.LoadBeatmap(beatmap);

            controlPointGroups = (BindableList<ControlPointGroup>)beatmap.Beatmap.ControlPointInfo.Groups.GetBoundCopy();
            controlPointGroups.BindCollectionChanged((sender, args) =>
            {
                switch (args.Action)
                {
                    case NotifyCollectionChangedAction.Reset:
                        Clear();
                        break;

                    case NotifyCollectionChangedAction.Add:
                        foreach (var group in args.NewItems.OfType<ControlPointGroup>())
                            Add(new GroupVisualisation(group));
                        break;

                    case NotifyCollectionChangedAction.Remove:
                        foreach (var group in args.OldItems.OfType<ControlPointGroup>())
                        {
                            var matching = Children.SingleOrDefault(gv => gv.Group == group);

                            matching?.Expire();
                        }

                        break;
                }
            }, true);
        }
    }
}

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

using System.Collections.Specialized;
using System.Linq;
using osu.Framework.Bindables;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;

namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
{
    /// <summary>
    /// The part of the timeline that displays the control points.
    /// </summary>
    public class ControlPointPart : TimelinePart<GroupVisualisation>
    {
        private IBindableList<ControlPointGroup> controlPointGroups;

        protected override void LoadBeatmap(WorkingBeatmap beatmap)
        {
            base.LoadBeatmap(beatmap);

            controlPointGroups = beatmap.Beatmap.ControlPointInfo.Groups.GetBoundCopy();
            controlPointGroups.BindCollectionChanged((sender, args) =>
            {
                switch (args.Action)
                {
                    case NotifyCollectionChangedAction.Reset:
                        Clear();
                        break;

                    case NotifyCollectionChangedAction.Add:
                        foreach (var group in args.NewItems.OfType<ControlPointGroup>())
                            Add(new GroupVisualisation(group));
                        break;

                    case NotifyCollectionChangedAction.Remove:
                        foreach (var group in args.OldItems.OfType<ControlPointGroup>())
                        {
                            var matching = Children.SingleOrDefault(gv => gv.Group == group);

                            matching?.Expire();
                        }

                        break;
                }
            }, true);
        }
    }
}

Update to consume framework fixes

Update to consume framework fixes


using System;
using System.Collections.Generic;
using System.Reflection;
using JAGBE.Attributes;

namespace JAGBE.Stats
{
    internal static class AttributeReflector
    {
        /// <summary>
        /// Gets the methods of <paramref name="type"/> with the <see cref="Attribute"/> of type
        /// <paramref name="attribute"/>.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="attribute">The attribute.</param>
        /// <param name="parentList">The parent list.</param>
        public static void GetMethodsOfTypeWithAttribute(Type type, Type attribute, ICollection<string> parentList)
        {
            foreach (MethodInfo info in type.GetMethods(
                BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public))
            {
                Attribute a = info.GetCustomAttribute(attribute);
                if (a != null)
                {
                    parentList.Add(type.FullName + "." + info.Name);
                }
            }
        }

        /// <summary>
        /// Writes all method stubs to the console.
        /// </summary>
        public static void GetAllStubs()
        {
            // Reflection doesn't seem to grab this method.
            List<string> strs = new List<string>(0);
            foreach (Type t in typeof(AttributeReflector).Assembly.GetTypes())
            {
                GetMethodsOfTypeWithAttribute(t, typeof(StubAttribute), strs);
            }

            strs.Sort(); // TODO: sort by namespace, then class, then method (by length then by 0-9A-Za-z)
            foreach (string str in strs)
            {
                Console.WriteLine(str);
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Reflection;
using JAGBE.Attributes;

namespace JAGBE.Stats
{
    internal static class AttributeReflector
    {
        /// <summary>
        /// Gets the methods of <paramref name="type"/> with the <see cref="Attribute"/> of type
        /// <paramref name="attribute"/>.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="attribute">The attribute.</param>
        /// <param name="parentList">The parent list.</param>
        public static void GetMethodsOfTypeWithAttribute(Type type, Type attribute, ICollection<string> parentList)
        {
            foreach (MethodInfo info in type.GetMethods(
                BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public))
            {
                Attribute a = info.GetCustomAttribute(attribute);
                if (a != null)
                {
                    parentList.Add(type.FullName + "." + info.Name);
                }
            }
        }

        /// <summary>
        /// Writes all method stubs to the console.
        /// </summary>
        public static List<string> GetAllStubs()
        {
            // Reflection doesn't seem to grab this method.
            List<string> strs = new List<string>(0);
            foreach (Type t in typeof(AttributeReflector).Assembly.GetTypes())
            {
                GetMethodsOfTypeWithAttribute(t, typeof(StubAttribute), strs);
            }

            return strs;
        }
    }
}

Make GetAllStubs return a List<string> instead of immediately writing the output to console


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

public class StretchScript : MonoBehaviour {

    public float orthographicSize = 4;
    public float aspect = 0.6f;

    void Start()
    {
        Camera.main.projectionMatrix = Matrix4x4.Ortho(
                -orthographicSize * aspect, orthographicSize * aspect,
                -orthographicSize, orthographicSize,
                Camera.main.nearClipPlane, Camera.main.farClipPlane);
    }

}

using UnityEngine;

// Source: http://answers.unity3d.com/questions/464487/windowed-game-to-fullscreen.html
public class StretchScript : MonoBehaviour {

    public float orthographicSize = 4;
    public float aspect = 0.6f;

    void Start()
    {
        Camera.main.projectionMatrix = Matrix4x4.Ortho(
                -orthographicSize * aspect, orthographicSize * aspect,
                -orthographicSize, orthographicSize,
                Camera.main.nearClipPlane, Camera.main.farClipPlane);
    }

}

Add source of script and remove unnecessary usings