using Nito.AsyncEx;
using Octokit;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Alteridem.GetChanges
{
    class Program
    {
        static int Main(string[] args)
        {
            var options = new Options();
            if (!CommandLine.Parser.Default.ParseArguments(args, options))
            {
                return -1;
            }

            AsyncContext.Run(() => MainAsync(options));

            //Console.WriteLine("*** Press ENTER to Exit ***");
            //Console.ReadLine();
            return 0;
        }

        static async void MainAsync(Options options)
        {
            var github = new GitHubApi(options.Organization, options.Repository);

            var milestones = await github.GetOpenMilestones();

            foreach (var milestone in milestones.Where(m => m.DueOn != null && m.DueOn.Value.Subtract(DateTimeOffset.Now).TotalDays < 30))
            {
                var milestoneIssues = await github.GetClosedIssuesForMilestone(milestone);
                DisplayIssuesForMilestone(options, milestone.Title, milestoneIssues);
            }
        }

        static void DisplayIssuesForMilestone(Options options, string milestone, IEnumerable<Issue> issues)
        {
            Console.WriteLine("## {0}", milestone);
            Console.WriteLine();

            foreach (var issue in issues)
            {
                if(options.LinkIssues)
                    Console.WriteLine($" * [{issue.Number:####}](https://github.com/{options.Organization}/{options.Repository}/issues/{issue.Number}) {issue.Title}");
                else
                    Console.WriteLine($" * {issue.Number:####} {issue.Title}");
            }
            Console.WriteLine();
        }
    }
}

using Nito.AsyncEx;
using Octokit;
using System;
using System.Collections.Generic;
using System.Linq;

namespace Alteridem.GetChanges
{
    class Program
    {
        static int Main(string[] args)
        {
            var options = new Options();
            if (!CommandLine.Parser.Default.ParseArguments(args, options))
            {
                return -1;
            }

            AsyncContext.Run(() => MainAsync(options));

            //Console.WriteLine("*** Press ENTER to Exit ***");
            //Console.ReadLine();
            return 0;
        }

        static async void MainAsync(Options options)
        {
            var github = new GitHubApi(options.Organization, options.Repository);

            var milestones = await github.GetOpenMilestones();

            foreach (var milestone in milestones.Where(m => m.DueOn != null && m.DueOn.Value.Subtract(DateTimeOffset.Now).TotalDays < 30))
            {
                var milestoneIssues = await github.GetClosedIssuesForMilestone(milestone);
                DisplayIssuesForMilestone(options, milestone.Title, milestoneIssues);
            }
        }

        static void DisplayIssuesForMilestone(Options options, string milestone, IEnumerable<Issue> issues)
        {
            Console.WriteLine("## {0}", milestone);
            Console.WriteLine();

            foreach (var issue in issues)
            {
                if(options.LinkIssues)
                    Console.WriteLine($"* [{issue.Number:####}](https://github.com/{options.Organization}/{options.Repository}/issues/{issue.Number}) {issue.Title}");
                else
                    Console.WriteLine($"* {issue.Number:####} {issue.Title}");
            }
            Console.WriteLine();
        }
    }
}

Update Markdown output to match linter now used in NUnit docs


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

using System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Overlays.Mods;
using osu.Game.Screens.OnlinePlay;

namespace osu.Game.Tests.Visual.Multiplayer
{
    public class TestSceneFreeModSelectScreen : MultiplayerTestScene
    {
        [Test]
        public void TestFreeModSelect()
        {
            FreeModSelectScreen freeModSelectScreen = null;

            AddStep("create free mod select screen", () => Child = freeModSelectScreen = new FreeModSelectScreen
            {
                State = { Value = Visibility.Visible }
            });

            AddAssert("all visible mods are playable",
                () => this.ChildrenOfType<ModPanel>()
                          .Where(panel => panel.IsPresent)
                          .All(panel => panel.Mod.HasImplementation && panel.Mod.UserPlayable));

            AddToggleStep("toggle visibility", visible =>
            {
                if (freeModSelectScreen != null)
                    freeModSelectScreen.State.Value = visible ? Visibility.Visible : Visibility.Hidden;
            });
        }
    }
}

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

using System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics.Containers;
using osu.Framework.Testing;
using osu.Game.Overlays.Mods;
using osu.Game.Screens.OnlinePlay;

namespace osu.Game.Tests.Visual.Multiplayer
{
    public class TestSceneFreeModSelectScreen : MultiplayerTestScene
    {
        [Test]
        public void TestFreeModSelect()
        {
            FreeModSelectScreen freeModSelectScreen = null;

            AddStep("create free mod select screen", () => Child = freeModSelectScreen = new FreeModSelectScreen
            {
                State = { Value = Visibility.Visible }
            });
            AddUntilStep("all column content loaded",
                () => freeModSelectScreen.ChildrenOfType<ModColumn>().Any()
                      && freeModSelectScreen.ChildrenOfType<ModColumn>().All(column => column.IsLoaded && column.ItemsLoaded));

            AddUntilStep("all visible mods are playable",
                () => this.ChildrenOfType<ModPanel>()
                          .Where(panel => panel.IsPresent)
                          .All(panel => panel.Mod.HasImplementation && panel.Mod.UserPlayable));

            AddToggleStep("toggle visibility", visible =>
            {
                if (freeModSelectScreen != null)
                    freeModSelectScreen.State.Value = visible ? Visibility.Visible : Visibility.Hidden;
            });
        }
    }
}

Fix flaky test in free mod select test scene


using System;

namespace Hangman {
  public class Row {
    public Cell[] Cells;

    public Row(Cell[] cells) {
      Cells = cells;
    }

    public string Draw(int width) {
      // return new String(' ', width - Text.Length) + Text;
      return "I have many cells!";
    }
  }
}

using System;

namespace Hangman {
  public class Row {
    public Cell[] Cells;

    public Row(Cell[] cells) {
      Cells = cells;
    }

    public string Draw(int width) {
      // return new String(' ', width - Text.Length) + Text;
      return String.Join("\n", Lines());
    }

    public string[] Lines() {
      return new string[] {
        "Line 1",
        "Line 2"
      };
    }
  }
}

Join up hardcoded lines in a Row

Join up hardcoded lines in a Row


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

using System;
using System.IO;
using System.Reflection;
using System.Collections.Generic;

namespace Microsoft.Extensions.DependencyModel
{
    public class DependencyContext
    {
        private const string DepsResourceSufix = ".deps.json";

        private static readonly Lazy<DependencyContext> _defaultContext = new Lazy<DependencyContext>(LoadDefault);

        public DependencyContext(string target, string runtime, CompilationOptions compilationOptions, CompilationLibrary[] compileLibraries, RuntimeLibrary[] runtimeLibraries)
        {
            Target = target;
            Runtime = runtime;
            CompilationOptions = compilationOptions;
            CompileLibraries = compileLibraries;
            RuntimeLibraries = runtimeLibraries;
        }

        public static DependencyContext Default => _defaultContext.Value;

        public string Target { get; }

        public string Runtime { get; }

        public CompilationOptions CompilationOptions { get; }

        public IReadOnlyList<CompilationLibrary> CompileLibraries { get; }

        public IReadOnlyList<RuntimeLibrary> RuntimeLibraries { get; }

        private static DependencyContext LoadDefault()
        {
            var entryAssembly = Assembly.GetEntryAssembly();
            var stream = entryAssembly?.GetManifestResourceStream(entryAssembly.GetName().Name + DepsResourceSufix);

            if (stream == null)
            {
                return null;
            }

            using (stream)
            {
                return Load(stream);
            }
        }

        public static DependencyContext Load(Stream stream)
        {
            return new DependencyContextReader().Read(stream);
        }
    }
}

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

using System;
using System.IO;
using System.Reflection;
using System.Collections.Generic;

namespace Microsoft.Extensions.DependencyModel
{
    public class DependencyContext
    {
        private const string DepsResourceSufix = ".deps.json";

        private static readonly Lazy<DependencyContext> _defaultContext = new Lazy<DependencyContext>(LoadDefault);

        public DependencyContext(string target, string runtime, CompilationOptions compilationOptions, CompilationLibrary[] compileLibraries, RuntimeLibrary[] runtimeLibraries)
        {
            Target = target;
            Runtime = runtime;
            CompilationOptions = compilationOptions;
            CompileLibraries = compileLibraries;
            RuntimeLibraries = runtimeLibraries;
        }

        public static DependencyContext Default => _defaultContext.Value;

        public string Target { get; }

        public string Runtime { get; }

        public CompilationOptions CompilationOptions { get; }

        public IReadOnlyList<CompilationLibrary> CompileLibraries { get; }

        public IReadOnlyList<RuntimeLibrary> RuntimeLibraries { get; }

        private static DependencyContext LoadDefault()
        {
            var entryAssembly = Assembly.GetEntryAssembly();
            return Load(entryAssembly);
        }

        public static DependencyContext Load(Assembly assembly)
        {
            var stream = assembly.GetManifestResourceStream(assembly.GetName().Name + DepsResourceSufix);

            if (stream == null)
            {
                return null;
            }

            using (stream)
            {
                return Load(stream);
            }
        }

        public static DependencyContext Load(Stream stream)
        {
            return new DependencyContextReader().Read(stream);
        }
    }
}

Fix dependency context bug and add load overload


using System.Numerics;
using ImGuiNET;

namespace OpenSage.Viewer.UI.Views
{
    internal abstract class GameView : AssetView
    {
        private readonly AssetViewContext _context;

        protected GameView(AssetViewContext context)
        {
            _context = context;
        }

        public override void Draw(ref bool isGameViewFocused)
        {
            var windowPos = ImGui.GetWindowPosition();
            var availableSize = ImGui.GetContentRegionAvailable();
            _context.GamePanel.EnsureFrame(
                new Mathematics.Rectangle(
                    (int) windowPos.X,
                    (int) windowPos.Y,
                    (int) availableSize.X,
                    (int) availableSize.Y));

            _context.Game.Tick();

            ImGuiNative.igSetItemAllowOverlap();

            var imagePointer = _context.ImGuiRenderer.GetOrCreateImGuiBinding(
                _context.GraphicsDevice.ResourceFactory,
                _context.Game.Panel.Framebuffer.ColorTargets[0].Target);

            if (ImGui.ImageButton(
                imagePointer,
                ImGui.GetContentRegionAvailable(),
                Vector2.Zero,
                Vector2.One,
                0,
                Vector4.Zero,
                Vector4.One))
            {
                isGameViewFocused = true;
            }
        }
    }
}

using System.Numerics;
using ImGuiNET;

namespace OpenSage.Viewer.UI.Views
{
    internal abstract class GameView : AssetView
    {
        private readonly AssetViewContext _context;

        protected GameView(AssetViewContext context)
        {
            _context = context;
        }

        public override void Draw(ref bool isGameViewFocused)
        {
            var windowPos = ImGui.GetCursorScreenPos();
            var availableSize = ImGui.GetContentRegionAvailable();
            _context.GamePanel.EnsureFrame(
                new Mathematics.Rectangle(
                    (int) windowPos.X,
                    (int) windowPos.Y,
                    (int) availableSize.X,
                    (int) availableSize.Y));

            _context.Game.Tick();

            ImGuiNative.igSetItemAllowOverlap();

            var imagePointer = _context.ImGuiRenderer.GetOrCreateImGuiBinding(
                _context.GraphicsDevice.ResourceFactory,
                _context.Game.Panel.Framebuffer.ColorTargets[0].Target);

            if (ImGui.ImageButton(
                imagePointer,
                ImGui.GetContentRegionAvailable(),
                Vector2.Zero,
                Vector2.One,
                0,
                Vector4.Zero,
                Vector4.One))
            {
                isGameViewFocused = true;
            }
        }
    }
}

Fix mouse position in game view

Fix mouse position in game view


using MoneyEntry.DataAccess.EFCore.Expenses.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;

namespace MoneyEntry.ExpensesAPI.Models
{
    public class TransactionModel
    {
        public int TransactionId { get; set; }
        [Required]
        public decimal Amount { get; set; }
        [Required, MaxLength(128)]
        public string Description { get; set; }
        [Required, Range(1,2)]
        public int TypeId { get; set; }
        [Required, Range(1,99)]
        public int CategoryId { get; set; }
        [Required, DataType(DataType.DateTime)]
        public DateTime CreatedDate { get; set; }
        [Required, Range(1,10)]
        public int PersonId { get; set; }

        public bool Reconciled { get; set; }
    }
}

using MoneyEntry.DataAccess.EFCore.Expenses.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;

namespace MoneyEntry.ExpensesAPI.Models
{
    public class TransactionModel
    {
        public int TransactionId { get; set; }
        [Required]
        public decimal Amount { get; set; }
        [Required, MaxLength(128)]
        public string Description { get; set; }
        [Required, Range(1,2)]
        public int TypeId { get; set; }
        [Required, Range(1,99)]
        public int CategoryId { get; set; }
        [Required, DataType(DataType.DateTime)]
        public DateTime CreatedDate { get; set; }
        public int PersonId { get; set; }

        public bool Reconciled { get; set; }
    }
}

Update model for transaction to not need the person id as it will get set from the jwt later


@model IEnumerable<Oogstplanner.Models.Crop>

@{
    ViewBag.Title = "Gewassen";
}

Dit zijn de gewassen in onze database:

    	Naam	Ras	Categorie	Opp. per 1
    		Opp. per zak	Prijs per zakje	Zaaimaanden	Oogstmaanden

		@foreach (var crop in Model) {

	    	@crop.Name	@crop.Race	@crop.Category	@crop.AreaPerCrop
	    		@crop.AreaPerBag	@crop.PricePerBag
	    		@crop.SowingMonths	@crop.HarvestingMonths

		}

@Html.ActionLink("Terug naar Zaaien en oogsten", "Index",  "Home",  null, null)

@model IEnumerable<Crop>

@{
    ViewBag.Title = "Gewassen";
}

Dit zijn de gewassen in onze database:

    	Naam	Ras	Categorie	Opp. per 1
    		Opp. per zak	Prijs per zakje	Zaaimaanden	Oogstmaanden

		@foreach (var crop in Model) {

	    	@crop.Name	@crop.Race	@crop.Category	@crop.AreaPerCrop
	    		@crop.AreaPerBag	@crop.PricePerBag
	    		@crop.SowingMonths	@crop.HarvestingMonths

		}

@Html.ActionLink("Terug naar Zaaien en oogsten", "Index",  "Home",  null, null)

Change model reference with old namespace to new


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

namespace WienerLinien.Api.Routing
{
    public static class RoutingUrlBuilder
    {
        private const string BaseUrl = "http://www.wienerlinien.at/ogd_routing/XML_TRIP_REQUEST2?";

        public static string Build(RoutingRequest request)
        {
            const string urlFormatString = BaseUrl +
                "type_origin=stopID&name_origin={0}&type_destination=stopID&name_destination={1}&ptOptionsActive=1&itOptionsActive=1" +
                "&itdDate={2:yyyyddMM}&idtTime={2:HHmm}&routeType={3}" +
                "&outputFormat=JSON";

            // &itdTripDateTimeDepArr={4}

            var url = String.Format(urlFormatString,
                request.FromStation, request.ToStation,
                request.When, RouteTypeToQueryStringParameter(request.RouteType));

            return url;
        }

        private static string RouteTypeToQueryStringParameter(RouteTypeOption option)
        {
            switch (option)
            {
                case RouteTypeOption.LeastTime:
                    return "LEASTTIME";
                    break;
                case RouteTypeOption.LeastInterchange:
                    return "LEASTINTERCHANGE";
                    break;
                case RouteTypeOption.LeastWalking:
                    return "LEASTWALKING";
                    break;
                default:
                    throw new ArgumentOutOfRangeException("option");
            }
        }
    }
}

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

namespace WienerLinien.Api.Routing
{
    public static class RoutingUrlBuilder
    {
        private const string BaseUrl = "http://www.wienerlinien.at/ogd_routing/XML_TRIP_REQUEST2?";

        public static string Build(RoutingRequest request)
        {
            const string urlFormatString = BaseUrl +
                "type_origin=stopID&name_origin={0}&type_destination=stopID&name_destination={1}&ptOptionsActive=1&itOptionsActive=1" +
                "&itdDate={2:yyyyMMdd}&itdTime={2:HHmm}&routeType={3}" +
                "&outputFormat=JSON";

            // &itdTripDateTimeDepArr={4}

            var url = String.Format(urlFormatString,
                request.FromStation, request.ToStation,
                request.When, RouteTypeToQueryStringParameter(request.RouteType));

            return url;
        }

        private static string RouteTypeToQueryStringParameter(RouteTypeOption option)
        {
            switch (option)
            {
                case RouteTypeOption.LeastTime:
                    return "LEASTTIME";
                    break;
                case RouteTypeOption.LeastInterchange:
                    return "LEASTINTERCHANGE";
                    break;
                case RouteTypeOption.LeastWalking:
                    return "LEASTWALKING";
                    break;
                default:
                    throw new ArgumentOutOfRangeException("option");
            }
        }
    }
}

Fix last bug in parameters

Fix last bug in parameters


using System;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
using NuGet.VisualStudio;

namespace NuGet.Options {
    public partial class GeneralOptionControl : UserControl {

        private IRecentPackageRepository _recentPackageRepository;
        private IProductUpdateSettings _productUpdateSettings;

        public GeneralOptionControl() {
            InitializeComponent();

            _productUpdateSettings = ServiceLocator.GetInstance<IProductUpdateSettings>();
            Debug.Assert(_productUpdateSettings != null);

            _recentPackageRepository = ServiceLocator.GetInstance<IRecentPackageRepository>();
            Debug.Assert(_recentPackageRepository != null);
        }

        private void OnClearRecentPackagesClick(object sender, EventArgs e) {
            _recentPackageRepository.Clear();
            MessageHelper.ShowInfoMessage(Resources.ShowInfo_ClearRecentPackages, Resources.ShowWarning_Title);
        }

        internal void OnActivated() {
            checkForUpdate.Checked = _productUpdateSettings.ShouldCheckForUpdate;
            browsePackageCacheButton.Enabled = clearPackageCacheButton.Enabled = Directory.Exists(MachineCache.Default.Source);
        }

        internal void OnApply() {
            _productUpdateSettings.ShouldCheckForUpdate = checkForUpdate.Checked;
        }

        private void OnClearPackageCacheClick(object sender, EventArgs e) {
            MachineCache.Default.Clear();
            MessageHelper.ShowInfoMessage(Resources.ShowInfo_ClearRecentPackages, Resources.ShowWarning_Title);
        }

        private void OnBrowsePackageCacheClick(object sender, EventArgs e) {
            if (Directory.Exists(MachineCache.Default.Source)) {
                Process.Start(MachineCache.Default.Source);
            }
        }
    }
}

using System;
using System.Diagnostics;
using System.IO;
using System.Windows.Forms;
using NuGet.VisualStudio;

namespace NuGet.Options {
    public partial class GeneralOptionControl : UserControl {

        private IRecentPackageRepository _recentPackageRepository;
        private IProductUpdateSettings _productUpdateSettings;

        public GeneralOptionControl() {
            InitializeComponent();

            _productUpdateSettings = ServiceLocator.GetInstance<IProductUpdateSettings>();
            Debug.Assert(_productUpdateSettings != null);

            _recentPackageRepository = ServiceLocator.GetInstance<IRecentPackageRepository>();
            Debug.Assert(_recentPackageRepository != null);
        }

        private void OnClearRecentPackagesClick(object sender, EventArgs e) {
            _recentPackageRepository.Clear();
            MessageHelper.ShowInfoMessage(Resources.ShowInfo_ClearRecentPackages, Resources.ShowWarning_Title);
        }

        internal void OnActivated() {
            checkForUpdate.Checked = _productUpdateSettings.ShouldCheckForUpdate;
            browsePackageCacheButton.Enabled = clearPackageCacheButton.Enabled = Directory.Exists(MachineCache.Default.Source);
        }

        internal void OnApply() {
            _productUpdateSettings.ShouldCheckForUpdate = checkForUpdate.Checked;
        }

        private void OnClearPackageCacheClick(object sender, EventArgs e) {
            MachineCache.Default.Clear();
            MessageHelper.ShowInfoMessage(Resources.ShowInfo_ClearPackageCache, Resources.ShowWarning_Title);
        }

        private void OnBrowsePackageCacheClick(object sender, EventArgs e) {
            if (Directory.Exists(MachineCache.Default.Source)) {
                Process.Start(MachineCache.Default.Source);
            }
        }
    }
}

Fix bug: Clearing the cache says "All items have been cleared from the recent packages list." Work items: 986


using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace GUtils.MVVM
{
    /// <summary>
    /// Implements a few utility functions for a ViewModel base
    /// </summary>
    public abstract class ViewModelBase : INotifyPropertyChanged
    {
        /// <inheritdoc/>
        public event PropertyChangedEventHandler PropertyChanged;

        /// <summary>
        /// Does the logic for calling <see cref="PropertyChanged"/> if the value has changed (and
        /// also sets the value of the field)
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="field"></param>
        /// <param name="newValue"></param>
        /// <param name="propertyName"></param>
        [MethodImpl ( MethodImplOptions.NoInlining )]
        protected virtual void SetField<T> ( ref T field, T newValue, [CallerMemberName] String propertyName = null )
        {
            if ( field.Equals ( newValue ) )
                return;
            field = newValue;
            this.OnPropertyChanged ( propertyName );
        }

        /// <summary>
        /// Invokes <see cref="PropertyChanged"/>
        /// </summary>
        /// <param name="propertyName"></param>
        /// <exception cref="ArgumentNullException">
        /// Invoked if a <paramref name="propertyName"/> is not provided (and the value isn't
        /// auto-filled by the compiler)
        /// </exception>
        [MethodImpl ( MethodImplOptions.NoInlining )]
        protected virtual void OnPropertyChanged ( [CallerMemberName] String propertyName = null ) =>
            this.PropertyChanged?.Invoke (
                this,
                new PropertyChangedEventArgs ( propertyName ?? throw new ArgumentNullException ( nameof ( propertyName ) ) ) );
    }
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace GUtils.MVVM
{
    /// <summary>
    /// Implements a few utility functions for a ViewModel base
    /// </summary>
    public abstract class ViewModelBase : INotifyPropertyChanged
    {
        /// <inheritdoc/>
        public event PropertyChangedEventHandler PropertyChanged;

        /// <summary>
        /// Does the logic for calling <see cref="PropertyChanged"/> if the value has changed (and
        /// also sets the value of the field)
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="field"></param>
        /// <param name="newValue"></param>
        /// <param name="propertyName"></param>
        [MethodImpl ( MethodImplOptions.NoInlining )]
        protected virtual void SetField<T> ( ref T field, T newValue, [CallerMemberName] String propertyName = null )
        {
            if ( EqualityComparer<T>.Default.Equals ( field, newValue ) )
                return;
            field = newValue;
            this.OnPropertyChanged ( propertyName );
        }

        /// <summary>
        /// Invokes <see cref="PropertyChanged"/>
        /// </summary>
        /// <param name="propertyName"></param>
        /// <exception cref="ArgumentNullException">
        /// Invoked if a <paramref name="propertyName"/> is not provided (and the value isn't
        /// auto-filled by the compiler)
        /// </exception>
        [MethodImpl ( MethodImplOptions.NoInlining )]
        protected virtual void OnPropertyChanged ( [CallerMemberName] String propertyName = null ) =>
            this.PropertyChanged?.Invoke (
                this,
                new PropertyChangedEventArgs ( propertyName ?? throw new ArgumentNullException ( nameof ( propertyName ) ) ) );
    }
}

Fix the possibility of a NullReferenceException


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

[assembly: ComVisible(false)]
[assembly: AssemblyProduct("Fixie")]
[assembly: AssemblyVersion("0.0.1.0")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyCopyright("Copyright (c) 2013 Patrick Lioi")]
[assembly: AssemblyCompany("Patrick Lioi")]
[assembly: AssemblyDescription("A convention-based test framework.")]
[assembly: AssemblyConfiguration("Release")]

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

[assembly: ComVisible(false)]
[assembly: AssemblyProduct("Fixie")]
[assembly: AssemblyVersion("0.0.1.0")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyCopyright("Copyright (c) 2013-2014 Patrick Lioi")]
[assembly: AssemblyCompany("Patrick Lioi")]
[assembly: AssemblyDescription("A convention-based test framework.")]
[assembly: AssemblyConfiguration("Release")]

Update copyright year span to include 2014. This change was generated by the build script.


using System;
namespace Alexa.NET.Response
{
    public static class RequestedPermission
    {
        public const string ReadHouseholdList  = "read::alexa:household:list";
        public const string WriteHouseholdList = "write::alexa:household:list";
    }
}

using System;
namespace Alexa.NET.Response
{
    public static class RequestedPermission
    {
        public const string ReadHouseholdList  = "read::alexa:household:list";
        public const string WriteHouseholdList = "write::alexa:household:list";
        public const string FullAddress = "read::alexa:device:all:address";
        public const string AddressCountryAndPostalCode = "read::alexa:device:all:address:country_and_postal_code";
    }
}

Add address permission constants for permissions card


using System;
using System.IO;
using System.Linq;

using LibGit2Sharp;

namespace GitIStage
{
    internal static class Program
    {
        private static void Main()
        {
            var repositoryPath = ResolveRepositoryPath();
            if (!Repository.IsValid(repositoryPath))
            {
                Console.WriteLine("fatal: Not a git repository");
                return;
            }

            var pathToGit = ResolveGitPath();
            if (string.IsNullOrEmpty(pathToGit))
            {
                Console.WriteLine("fatal: git is not in your path");
                return;
            }

            var application = new Application(repositoryPath, pathToGit);
            application.Run();
        }

        private static string ResolveRepositoryPath()
        {
            return Directory.GetCurrentDirectory();
        }

        private static string ResolveGitPath()
        {
            var path = Environment.GetEnvironmentVariable("PATH");
            if (string.IsNullOrEmpty(path))
                return null;

            var paths = path.Split(Path.PathSeparator);
            var searchPaths = paths.Select(p => Path.Combine(p, "git.exe"));
            return searchPaths.FirstOrDefault(File.Exists);
        }
    }
}

using System;
using System.IO;
using System.Linq;

using LibGit2Sharp;

namespace GitIStage
{
    internal static class Program
    {
        private static void Main()
        {
            var repositoryPath = ResolveRepositoryPath();
            if (!Repository.IsValid(repositoryPath))
            {
                Console.WriteLine("fatal: Not a git repository");
                return;
            }

            var pathToGit = ResolveGitPath();
            if (string.IsNullOrEmpty(pathToGit))
            {
                Console.WriteLine("fatal: git is not in your path");
                return;
            }

            var application = new Application(repositoryPath, pathToGit);
            application.Run();
        }

        private static string ResolveRepositoryPath()
        {
            return Directory.GetCurrentDirectory();
        }

        private static string ResolveGitPath()
        {
            var path = Environment.GetEnvironmentVariable("PATH");
            if (string.IsNullOrEmpty(path))
                return null;

            var paths = path.Split(Path.PathSeparator);

            // In order to have this work across all operating systems, we
            // need to include other extensions.
            //
            // NOTE: On .NET Core, we should use RuntimeInformation in order
            //       to limit the extensions based on operating system.

            var fileNames = new[] { "git.exe", "git" };
            var searchPaths = paths.SelectMany(p => fileNames.Select(f => Path.Combine(p, f)));

            return searchPaths.FirstOrDefault(File.Exists);
        }
    }
}

Fix probing for git on non-Windows machines

This fixes #2. It's not perfect, but it seems like a good first stab.


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

using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Game.Screens.Multi.Components;
using osuTK;

namespace osu.Game.Tests.Visual.Multiplayer
{
    public class TestSceneOverlinedParticipants : MultiplayerTestScene
    {
        protected override bool UseOnlineAPI => true;

        [SetUp]
        public new void Setup() => Schedule(() =>
        {
            Room.RoomID.Value = 7;
        });

        [Test]
        public void TestHorizontalLayout()
        {
            AddStep("create component", () =>
            {
                Child = new ParticipantsDisplay(Direction.Horizontal)
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Width = 500,
                };
            });
        }

        [Test]
        public void TestVerticalLayout()
        {
            AddStep("create component", () =>
            {
                Child = new ParticipantsDisplay(Direction.Vertical)
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Size = new Vector2(500)
                };
            });
        }
    }
}

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

using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Game.Screens.Multi.Components;
using osu.Game.Users;

namespace osu.Game.Tests.Visual.Multiplayer
{
    public class TestSceneOverlinedParticipants : MultiplayerTestScene
    {
        [SetUp]
        public new void Setup() => Schedule(() =>
        {
            Room.RoomID.Value = 7;

            for (int i = 0; i < 50; i++)
            {
                Room.RecentParticipants.Add(new User
                {
                    Username = "peppy",
                    Id = 2
                });
            }
        });

        [Test]
        public void TestHorizontalLayout()
        {
            AddStep("create component", () =>
            {
                Child = new ParticipantsDisplay(Direction.Horizontal)
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Width = 0.2f,
                };
            });
        }

        [Test]
        public void TestVerticalLayout()
        {
            AddStep("create component", () =>
            {
                Child = new ParticipantsDisplay(Direction.Vertical)
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Width = 0.2f,
                    Height = 0.2f,
                };
            });
        }
    }
}

Fix overlined participants test scene not working


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace MouseRx2Wpf
{
    /// <summary>
    /// MainWindow.xaml の相互作用ロジック
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace MouseRx2Wpf
{
    /// <summary>
    /// MainWindow.xaml の相互作用ロジック
    /// </summary>
    public partial class MainWindow : Window
    {
        public IObservable<IObservable<Vector>> MouseDrag { get; }

        public MainWindow()
        {
            InitializeComponent();

            // Replace events with IObservable objects.
            var mouseDown = Observable.FromEventPattern<MouseButtonEventArgs>(this, nameof(MouseDown)).Select(e => e.EventArgs);
            var mouseUp = Observable.FromEventPattern<MouseButtonEventArgs>(this, nameof(MouseUp)).Select(e => e.EventArgs);
            var mouseLeave = Observable.FromEventPattern<MouseEventArgs>(this, nameof(MouseLeave)).Select(e => e.EventArgs);
            var mouseMove = Observable.FromEventPattern<MouseEventArgs>(this, nameof(MouseMove)).Select(e => e.EventArgs);
            var mouseEnd = mouseUp.Merge(mouseLeave.Select(e => default(MouseButtonEventArgs)));

            MouseDrag = mouseDown
                .Select(e => e.GetPosition(this))
                .Select(p0 => mouseMove
                    .Select(e => e.GetPosition(this) - p0)
                    .TakeUntil(mouseEnd));
        }
    }
}

Implement mouse drag event as IObservable


using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Abstractspoon.Tdl.PluginHelpers;

namespace SampleImpExp
{
    public class SampleImpExpCore
    {
        public bool Export(TaskList srcTasks, string sDestFilePath, bool bSilent, Preferences prefs, string sKey)
        {
            int nVal = prefs.GetProfileInt("bob", "dave", 20);
            int nVal2 = prefs.GetProfileInt("bob", "phil", 20);

            // add some dummy values to prefs
            prefs.WriteProfileInt("bob", "dave", 10);

            Task task = srcTasks.GetFirstTask();

            String sTitle = task.GetTitle();

            return true;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Abstractspoon.Tdl.PluginHelpers;

namespace SampleImpExp
{
    public class SampleImpExpCore
    {
        public bool Export(TaskList srcTasks, string sDestFilePath, bool bSilent, Preferences prefs, string sKey)
        {
            // Possibly display a dialog to get input on how to
            // map ToDoList task attributes to the output format
            // TODO

            // Process the tasks
            Task task = srcTasks.GetFirstTask();

            while (task.IsValid())
            {
                if (!ExportTask(task /*, probably with some additional parameters*/ ))
                {
                    // Decide whether to stop or not
                    // TODO
                }

                task = task.GetNextTask();
            }

            return true;
        }

        protected bool ExportTask(Task task /*, probably with some additional parameters*/)
        {
            // TODO
            return true;
        }
    }
}

Make sample app more helpful

Make sample app more helpful


using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;

namespace RealmNet
{
    public class Transaction : IDisposable
    {
        private SharedRealmHandle _sharedRealmHandle;
        private bool _isOpen;

        internal Transaction(SharedRealmHandle sharedRealmHandle)
        {
            this._sharedRealmHandle = sharedRealmHandle;
            NativeSharedRealm.begin_transaction(sharedRealmHandle);
            _isOpen = true;
        }

        public void Dispose()
        {
            if (!_isOpen)
                return;

            var exceptionOccurred = Marshal.GetExceptionPointers() != IntPtr.Zero || Marshal.GetExceptionCode() != 0;
            if (exceptionOccurred)
                Rollback();
            else
                Commit();
        }

        public void Rollback()
        {
            if (!_isOpen)
                throw new Exception("Transaction was already closed. Cannot roll back");

            NativeSharedRealm.cancel_transaction(_sharedRealmHandle);
            _isOpen = false;
        }

        public void Commit()
        {
            if (!_isOpen)
                throw new Exception("Transaction was already closed. Cannot commit");

            NativeSharedRealm.commit_transaction(_sharedRealmHandle);
            _isOpen = false;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;

namespace RealmNet
{
    public class Transaction : IDisposable
    {
        private SharedRealmHandle _sharedRealmHandle;
        private bool _isOpen;

        internal Transaction(SharedRealmHandle sharedRealmHandle)
        {
            this._sharedRealmHandle = sharedRealmHandle;
            NativeSharedRealm.begin_transaction(sharedRealmHandle);
            _isOpen = true;
        }

        public void Dispose()
        {
            if (!_isOpen)
                return;

            //var exceptionOccurred = Marshal.GetExceptionPointers() != IntPtr.Zero || Marshal.GetExceptionCode() != 0;
            var exceptionOccurred = true; // TODO: Can we find this out on iOS? Otherwise, we have to remove it!
            if (exceptionOccurred)
                Rollback();
            else
                Commit();
        }

        public void Rollback()
        {
            if (!_isOpen)
                throw new Exception("Transaction was already closed. Cannot roll back");

            NativeSharedRealm.cancel_transaction(_sharedRealmHandle);
            _isOpen = false;
        }

        public void Commit()
        {
            if (!_isOpen)
                throw new Exception("Transaction was already closed. Cannot commit");

            NativeSharedRealm.commit_transaction(_sharedRealmHandle);
            _isOpen = false;
        }
    }
}

Make transaction roll back per default until we figure out what to do


using System;
using System.Text.Json.Serialization;

namespace SFA.DAS.CommitmentsV2.Types
{
    [JsonConverter(typeof(JsonStringEnumConverter))]
    public enum DeliveryModel : byte
    {
        Regular = 0,
        PortableFlexiJob = 1,

        [Obsolete("Use `Regular` instead of `Normal`", true)]
        Normal = Regular,

        [Obsolete("Use `PortableFlexiJob` instead of `Flexible`", true)]
        Flexible = PortableFlexiJob,
    }
}

using System.Text.Json.Serialization;

namespace SFA.DAS.CommitmentsV2.Types
{
    [JsonConverter(typeof(JsonStringEnumConverter))]
    public enum DeliveryModel : byte
    {
        Regular = 0,
        PortableFlexiJob = 1,
    }
}

Remove obsolete delivery model names

Remove obsolete delivery model names


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

[assembly: AssemblyCompany("Outercurve Foundation")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyConfiguration("")]

// If you change this version, make sure to change Build\build.proj accordingly
[assembly: AssemblyVersion("45.0.0.0")]
[assembly: AssemblyFileVersion("45.0.0.0")]

[assembly: ComVisible(false)]
[assembly: CLSCompliant(false)]

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

[assembly: AssemblyCompany(".NET Foundation")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: AssemblyConfiguration("")]

// If you change this version, make sure to change Build\build.proj accordingly
[assembly: AssemblyVersion("45.0.0.0")]
[assembly: AssemblyFileVersion("45.0.0.0")]

[assembly: ComVisible(false)]
[assembly: CLSCompliant(false)]

Change AssemblyCompany to .NET Foundation


using System;

using HtmlAgilityPack;

namespace ReverseMarkdown.Converters
{
	public class Br
		: ConverterBase
	{
		public Br(Converter converter)
			: base(converter)
		{
			this.Converter.Register("br", this);
		}

		public override string Convert(HtmlNode node)
		{
			return "  " + Environment.NewLine;
		}
	}
}

using System;

using HtmlAgilityPack;

namespace ReverseMarkdown.Converters
{
	public class Br
		: ConverterBase
	{
		public Br(Converter converter)
			: base(converter)
		{
			this.Converter.Register("br", this);
		}

		public override string Convert(HtmlNode node)
		{
			return Environment.NewLine;
		}
	}
}

Remove trailing spaces from <br>

Remove trailing spaces from <br>


using System;
using System.Reflection;
using System.Runtime.Remoting.Messaging;
using System.Runtime.Remoting.Proxies;

namespace Unit.Tests
{
	/// <summary>
	/// Proxy that records method invocations.
	/// </summary>
	public class MethodRecorder<T> : RealProxy
	{
		/// <summary>
		/// Creates a new interceptor that records method invocations.
		/// </summary>
		public MethodRecorder()
			: base(typeof(T))
		{
			_proxy = new Lazy<T>(() => (T)base.GetTransparentProxy());
		}

		/// <summary>
		/// The underlying proxy.
		/// </summary>
		public T Proxy
		{
			get { return _proxy.Value; }
		}

		/// <summary>
		/// The most recent invocation made on the proxy.
		/// </summary>
		public IMethodCallMessage LastInvocation { get; private set; }

		/// <see cref="RealProxy.Invoke"/>
		public override IMessage Invoke(IMessage msg)
		{
			var methodCall = msg as IMethodCallMessage;
			LastInvocation = methodCall;

			object returnValue = null;
			var method = methodCall.MethodBase as MethodInfo;
			if (method != null)
			{
				Type returnType = method.ReturnType;
				if (returnType.IsValueType && returnType != typeof(void)) // can't create an instance of Void
					returnValue = Activator.CreateInstance(returnType);
			}

			return new ReturnMessage(returnValue, new object[0], 0, methodCall.LogicalCallContext, methodCall);
		}

		private readonly Lazy<T> _proxy;
	}
}

using System;
using System.Reflection;
using System.Runtime.Remoting.Messaging;
using System.Runtime.Remoting.Proxies;
using Utilities.Reflection;

namespace Unit.Tests
{
	/// <summary>
	/// Proxy that records method invocations.
	/// </summary>
	public class MethodRecorder<T> : RealProxy
	{
		/// <summary>
		/// Creates a new interceptor that records method invocations.
		/// </summary>
		public MethodRecorder()
			: base(typeof(T))
		{
			_proxy = new Lazy<T>(() => (T)base.GetTransparentProxy());
		}

		/// <summary>
		/// The underlying proxy.
		/// </summary>
		public T Proxy
		{
			get { return _proxy.Value; }
		}

		/// <summary>
		/// The most recent invocation made on the proxy.
		/// </summary>
		public IMethodCallMessage LastInvocation { get; private set; }

		/// <see cref="RealProxy.Invoke"/>
		public override IMessage Invoke(IMessage msg)
		{
			var methodCall = msg as IMethodCallMessage;
			LastInvocation = methodCall;

			object returnValue = null;
			var method = methodCall.MethodBase as MethodInfo;
			if (method != null)
				returnValue = method.ReturnType.GetDefaultValue();

			return new ReturnMessage(returnValue, new object[0], 0, methodCall.LogicalCallContext, methodCall);
		}

		private readonly Lazy<T> _proxy;
	}
}

Use existing extension method to get default value for a type.


    @if (!User.Identity.IsAuthenticated)
    {
        Log On
        Register
    }
    else
    {
        @User.Identity.Name

            Log Off

    }

    @if (!User.Identity.IsAuthenticated)
    {
        @Html.ActionLink("Log On", "LogOn", "Authentication", new { returnUrl = Request.RequestContext.HttpContext.Request.RawUrl }, null)
        Register
    }
    else
    {
        @User.Identity.Name

            Log Off

    }

Support ReturnUrl to public pages

Support ReturnUrl to public pages


using System;
using System.Windows.Forms;

namespace elbsms_ui
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
        }
    }
}

using System;
using System.Windows.Forms;
using elb_utilities.NativeMethods;

namespace elbsms_ui
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            // set timer resolution to 1ms to try and get the sleep accurate in the wait loop
            WinMM.TimeBeginPeriod(1);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
        }
    }
}

Set system timer resolution for the sleep call in the wait loop


using Urho.Resources;

namespace Urho.Shapes
{
	public abstract class Shape : StaticModel
	{
		Material material;

		public override void OnAttachedToNode(Node node)
		{
			Model = Application.ResourceCache.GetModel(ModelResource);
			Color = color;
		}

		protected abstract string ModelResource { get; }

		Color color;
		public Color Color
		{
			set
			{
				if (material == null)
				{
					//try to restore material (after deserialization)
					material = GetMaterial(0);
					if (material == null)
					{
						material = new Material();
						material.SetTechnique(0, Application.ResourceCache.GetTechnique("Techniques/NoTextureAlpha.xml"), 1, 1);
					}
					SetMaterial(material);
				}
				material.SetShaderParameter("MatDiffColor", value);
				color = value;
			}
			get
			{
				return color;
			}
		}

		public override void OnDeserialize(IComponentDeserializer d)
		{
			color = d.Deserialize<Color>(nameof(Color));
		}

		public override void OnSerialize(IComponentSerializer s)
		{
			s.Serialize(nameof(Color), Color);
		}
	}
}

using Urho.Resources;

namespace Urho.Shapes
{
	public abstract class Shape : StaticModel
	{
		Material material;

		public override void OnAttachedToNode(Node node)
		{
			Model = Application.ResourceCache.GetModel(ModelResource);
			Color = color;
		}

		protected abstract string ModelResource { get; }

		Color color = Color.Magenta;
		public Color Color
		{
			set
			{
				if (material == null)
				{
					//try to restore material (after deserialization)
					material = GetMaterial(0);
					if (material == null)
					{
						material = new Material();
						material.SetTechnique(0, Application.ResourceCache.GetTechnique("Techniques/NoTextureAlpha.xml"), 1, 1);
					}
					SetMaterial(material);
				}
				material.SetShaderParameter("MatDiffColor", value);
				color = value;
			}
			get
			{
				return color;
			}
		}

		public override void OnDeserialize(IComponentDeserializer d)
		{
			color = d.Deserialize<Color>(nameof(Color));
		}

		public override void OnSerialize(IComponentSerializer s)
		{
			s.Serialize(nameof(Color), Color);
		}
	}
}

Set Magenta as a default color for shapes


using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Xaml.Interactivity;

namespace Avalonia.Xaml.Interactions.Custom;

/// <summary>
/// A behavior that displays cursor position on <see cref="InputElement.PointerMoved"/> event for the <see cref="Behavior{T}.AssociatedObject"/> using <see cref="TextBlock.Text"/> property.
/// </summary>
public class ShowPointerPositionBehavior : Behavior<Control>
{
    /// <summary>
    /// Identifies the <seealso cref="TargetTextBlockProperty"/> avalonia property.
    /// </summary>
    public static readonly StyledProperty<TextBlock?> TargetTextBlockProperty =
        AvaloniaProperty.Register<ShowPointerPositionBehavior, TextBlock?>(nameof(TargetTextBlock));

    /// <summary>
    /// Gets or sets the target TextBlock object in which this behavior displays cursor position on PointerMoved event.
    /// </summary>
    public TextBlock? TargetTextBlock
    {
        get => GetValue(TargetTextBlockProperty);
        set => SetValue(TargetTextBlockProperty, value);
    }

    /// <inheritdoc />
    protected override void OnAttachedToVisualTree()
    {
        if (AssociatedObject is { })
        {
            AssociatedObject.PointerMoved += AssociatedObject_PointerMoved;
        }
    }

    /// <inheritdoc />
    protected override void OnDetachedFromVisualTree()
    {
        if (AssociatedObject is { })
        {
            AssociatedObject.PointerMoved -= AssociatedObject_PointerMoved;
        }
    }

    private void AssociatedObject_PointerMoved(object? sender, PointerEventArgs e)
    {
        if (TargetTextBlock is { })
        {
            TargetTextBlock.Text = e.GetPosition(AssociatedObject).ToString();
        }
    }
}

using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Xaml.Interactivity;

namespace Avalonia.Xaml.Interactions.Custom;

/// <summary>
/// A behavior that displays cursor position on <see cref="InputElement.PointerMoved"/> event for the <see cref="Behavior{T}.AssociatedObject"/> using <see cref="TextBlock.Text"/> property.
/// </summary>
public class ShowPointerPositionBehavior : Behavior<Control>
{
    /// <summary>
    /// Identifies the <seealso cref="TargetTextBlockProperty"/> avalonia property.
    /// </summary>
    public static readonly StyledProperty<TextBlock?> TargetTextBlockProperty =
        AvaloniaProperty.Register<ShowPointerPositionBehavior, TextBlock?>(nameof(TargetTextBlock));

    /// <summary>
    /// Gets or sets the target TextBlock object in which this behavior displays cursor position on PointerMoved event.
    /// </summary>
    [ResolveByName]
    public TextBlock? TargetTextBlock
    {
        get => GetValue(TargetTextBlockProperty);
        set => SetValue(TargetTextBlockProperty, value);
    }

    /// <inheritdoc />
    protected override void OnAttachedToVisualTree()
    {
        if (AssociatedObject is { })
        {
            AssociatedObject.PointerMoved += AssociatedObject_PointerMoved;
        }
    }

    /// <inheritdoc />
    protected override void OnDetachedFromVisualTree()
    {
        if (AssociatedObject is { })
        {
            AssociatedObject.PointerMoved -= AssociatedObject_PointerMoved;
        }
    }

    private void AssociatedObject_PointerMoved(object? sender, PointerEventArgs e)
    {
        if (TargetTextBlock is { })
        {
            TargetTextBlock.Text = e.GetPosition(AssociatedObject).ToString();
        }
    }
}

Add ResolveByName attribute to TargetTextBlock property


using Opten.Umbraco.ListView.Extensions;
using System;
using System.Linq;
using Umbraco.Core;
using Umbraco.Web.Trees;

namespace ClassLibrary1
{
	public class TreeEventHandler : ApplicationEventHandler
	{

		protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
		{
			ContentTreeController.TreeNodesRendering += ContentTreeController_TreeNodesRendering;
		}

		private void ContentTreeController_TreeNodesRendering(TreeControllerBase sender, TreeNodesRenderingEventArgs e)
		{
			if (e.QueryStrings["application"].Equals("content") &&
				e.QueryStrings["isDialog"].Equals("false") &&
				string.IsNullOrWhiteSpace(e.QueryStrings["id"]) == false)
			{
				var content = sender.Services.ContentService.GetById(int.Parse(e.QueryStrings["id"]));

				e.Nodes.RemoveAll(treeNode => treeNode.AdditionalData.ContainsKey("contentType") && content.IsInListView(treeNode.AdditionalData["contentType"].ToString()));
			}
		}
	}
}

using AutoMapper;
using Opten.Umbraco.ListView.Extensions;
using System.Linq;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Web.Models.ContentEditing;
using Umbraco.Web.Trees;

namespace ClassLibrary1
{
	public class TreeEventHandler : ApplicationEventHandler
	{

		protected override void ApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
		{
			ContentTreeController.TreeNodesRendering += ContentTreeController_TreeNodesRendering;

			var typeMaps = Mapper.GetAllTypeMaps();

			var contentMapper = typeMaps.First(map => map.DestinationType.Equals(typeof(ContentItemDisplay)) && map.SourceType.Equals(typeof(IContent)));

			contentMapper.AddAfterMapAction((src, dest) =>
			{
				var srcTyped = src as IContent;
				var destTyped = dest as ContentItemDisplay;

				destTyped.IsChildOfListView = destTyped.IsChildOfListView || srcTyped.Parent().IsInListView(srcTyped.ContentType.Alias);
				destTyped.IsContainer = destTyped.IsContainer || srcTyped.FindGridListViewContentTypeAliases().Any();
			});
		}

		private void ContentTreeController_TreeNodesRendering(TreeControllerBase sender, TreeNodesRenderingEventArgs e)
		{
			if (e.QueryStrings["application"].Equals("content") &&
				e.QueryStrings["isDialog"].Equals("false") &&
				string.IsNullOrWhiteSpace(e.QueryStrings["id"]) == false)
			{
				var content = sender.Services.ContentService.GetById(int.Parse(e.QueryStrings["id"]));

				e.Nodes.RemoveAll(treeNode => treeNode.AdditionalData.ContainsKey("contentType") && content.IsInListView(treeNode.AdditionalData["contentType"].ToString()));
			}
		}
	}
}

Update ContentItemDisplay mapper to set IsContainer and IsChildOfListView correctly


namespace Moya.Runner.Runners
{
    using System.Diagnostics;
    using System.Reflection;
    using Models;
    using Statistics;

    public class TimerDecorator : ITestRunner
    {
        private readonly IDurationManager duration;

        public ITestRunner DecoratedTestRunner { get; set; }

        public TimerDecorator(ITestRunner testRunner)
        {
            DecoratedTestRunner = testRunner;
            duration = DurationManager.DefaultInstance;
        }

        public ITestResult Execute(MethodInfo methodInfo)
        {
            var stopwatch = new Stopwatch();
            stopwatch.Start();

            var result = DecoratedTestRunner.Execute(methodInfo);

            stopwatch.Stop();
            duration.AddOrUpdateDuration(methodInfo.GetHashCode(), stopwatch.ElapsedMilliseconds);

            result.Duration = stopwatch.ElapsedMilliseconds;
            return result;
        }
    }
}

namespace Moya.Runner.Runners
{
    using System.Diagnostics;
    using System.Reflection;
    using Models;

    public class TimerDecorator : ITestRunner
    {
        public ITestRunner DecoratedTestRunner { get; set; }

        public TimerDecorator(ITestRunner testRunner)
        {
            DecoratedTestRunner = testRunner;
        }

        public ITestResult Execute(MethodInfo methodInfo)
        {
            var stopwatch = new Stopwatch();
            stopwatch.Start();

            var result = DecoratedTestRunner.Execute(methodInfo);

            stopwatch.Stop();

            result.Duration = stopwatch.ElapsedMilliseconds;
            return result;
        }
    }
}

Remove reference to statistic manager from timerdecorator.


using System.Threading;
using System.Threading.Tasks;
using Microsoft.Owin;
using Foundation.Api.Contracts;
using Foundation.Core.Contracts;

namespace Foundation.Api.Middlewares
{
    public class DefaultPageMiddleware : OwinMiddleware
    {
        public DefaultPageMiddleware(OwinMiddleware next)
            : base(next)
        {

        }

        public override async Task Invoke(IOwinContext context)
        {
            IDependencyResolver dependencyResolver = context.GetDependencyResolver();

            string defaultPage = await dependencyResolver.Resolve<IDefaultHtmlPageProvider>().GetDefaultPageAsync(CancellationToken.None);

            context.Response.ContentType = "text/html; charset=utf-8";

            await context.Response.WriteAsync(defaultPage);
        }
    }
}

using System.Threading;
using System.Threading.Tasks;
using Microsoft.Owin;
using Foundation.Api.Contracts;
using Foundation.Core.Contracts;

namespace Foundation.Api.Middlewares
{
    public class DefaultPageMiddleware : OwinMiddleware
    {
        public DefaultPageMiddleware(OwinMiddleware next)
            : base(next)
        {

        }

        public override async Task Invoke(IOwinContext context)
        {
            IDependencyResolver dependencyResolver = context.GetDependencyResolver();

            string defaultPage = await dependencyResolver.Resolve<IDefaultHtmlPageProvider>().GetDefaultPageAsync(context.Request.CallCancelled);

            context.Response.ContentType = "text/html; charset=utf-8";

            await context.Response.WriteAsync(defaultPage);
        }
    }
}

Use owinContext.Request.CallCancelled in default page middleware


using System.ComponentModel.DataAnnotations;

namespace BatteryCommander.Web.Models
{
    public enum MilitaryEducationLevel : byte
    {
        Unknown,

        [Display(Name = "(AIT) Advanced Individual Training", ShortName = "AIT")]
        AIT = 1,

        [Display(Name = "(BLC) Basic Leader Course", ShortName = "BLC")]
        BLC = 2,

        [Display(Name = "(ALC) Advanced Leader Course", ShortName = "ALC")]
        ALC = 3,

        [Display(Name = "(SLC) Senior Leader Course", ShortName = "SLC")]
        SLC = 4,

        [Display(Name = "(BOLC) Basic Officer Leaders Course", ShortName = "BOLC")]
        BOLC = 10,

        [Display(Name = "(CCC) Captains Career Course", ShortName = "CCC")]
        CCC = 11
    }
}

using System.ComponentModel.DataAnnotations;

namespace BatteryCommander.Web.Models
{
    public enum MilitaryEducationLevel : byte
    {
        Unknown,

        [Display(Name = "(AIT) Advanced Individual Training", ShortName = "AIT")]
        AIT = 1,

        [Display(Name = "(BLC) Basic Leader Course", ShortName = "BLC")]
        BLC = 2,

        [Display(Name = "(ALC) Advanced Leader Course", ShortName = "ALC")]
        ALC = 3,

        [Display(Name = "(SLC) Senior Leader Course", ShortName = "SLC")]
        SLC = 4,

        [Display(Name = "(MLC) Master Leader Course", ShortName = "MLC")]
        MLC = 5,

        [Display(Name = "(SMC) Sergeants Major Course", ShortName = "SMC")]
        SMC = 6,

        [Display(Name = "(BOLC) Basic Officer Leaders Course", ShortName = "BOLC")]
        BOLC = 10,

        [Display(Name = "(CCC) Captains Career Course", ShortName = "CCC")]
        CCC = 11
    }
}

Add MLC and SMC to education levels

Add MLC and SMC to education levels


using System;
using System.Reactive.Disposables;
using SolidWorks.Interop.sldworks;

namespace SolidworksAddinFramework
{
    public static class ModelViewManagerExtensions
    {
        public static IDisposable CreateSectionView(this IModelViewManager modelViewManager, Action<SectionViewData> config)
        {
            var data = modelViewManager.CreateSectionViewData();
            config(data);
            if (!modelViewManager.CreateSectionView(data))
            {
                throw new Exception("Error while creating section view.");
            }
            return Disposable.Create(() => modelViewManager.RemoveSectionView());
        }
    }
}

using System;
using System.Reactive.Disposables;
using SolidWorks.Interop.sldworks;

namespace SolidworksAddinFramework
{
    public static class ModelViewManagerExtensions
    {
        public static IDisposable CreateSectionView(this IModelViewManager modelViewManager, Action<SectionViewData> config)
        {
            var data = modelViewManager.CreateSectionViewData();
            config(data);
            if (!modelViewManager.CreateSectionView(data))
            {
                throw new Exception("Error while creating section view.");
            }
            // TODO `modelViewManager.RemoveSectionView` always returns `false` and doesn't remove the section view
            // In 2011 this seems to have worked (see https://forum.solidworks.com/thread/47641)
            return Disposable.Create(() => modelViewManager.RemoveSectionView());
        }
    }
}

Add comment that `IModelViewManager::RemoveSectionView` doesn't work and link a forum question


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

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

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

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

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

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

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

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

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

[assembly: AssemblyTitle ("Intercom.Dotnet.Client")]
[assembly: AssemblyDescription ("")]
[assembly: AssemblyConfiguration ("")]
[assembly: AssemblyCompany ("")]
[assembly: AssemblyProduct ("")]
[assembly: AssemblyCopyright ("khalil")]
[assembly: AssemblyTrademark ("")]
[assembly: AssemblyCulture ("")]

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

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

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

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

Rename assembly to proper name

Rename assembly to proper name


using Microsoft.Cci;
using Microsoft.Cci.Extensions;

namespace Terrajobst.Cci
{
    public static class MemberExtensions
    {
        public static string GetNamespaceName(this ITypeDefinitionMember member)
        {
            return member.ContainingTypeDefinition.GetNamespaceName();
        }

        public static string GetTypeName(this ITypeDefinitionMember member)
        {
            return member.ContainingTypeDefinition.GetTypeName(false);
        }

        public static string GetMemberSignature(this ITypeDefinitionMember member)
        {
            if (member is IFieldDefinition)
                return member.Name.Value;

            return MemberHelper.GetMemberSignature(member, NameFormattingOptions.Signature |
                                                           NameFormattingOptions.TypeParameters |
                                                           NameFormattingOptions.ContractNullable |
                                                           NameFormattingOptions.OmitContainingType |
                                                           NameFormattingOptions.OmitContainingNamespace |
                                                           NameFormattingOptions.PreserveSpecialNames);
        }
    }
}

using Microsoft.Cci;
using Microsoft.Cci.Extensions;

namespace Terrajobst.Cci
{
    public static class MemberExtensions
    {
        public static string GetNamespaceName(this IDefinition definition)
        {
            if (definition is ITypeDefinitionMember member)
                return member.ContainingTypeDefinition.GetNamespaceName();

            if (definition is ITypeDefinition type)
                return type.GetNamespace().GetNamespaceName();

            if (definition is INamespaceDefinition nsp)
                return nsp.FullName();

            return string.Empty;
        }

        public static string GetTypeName(this IDefinition definition)
        {
            if (definition is ITypeDefinitionMember member)
                return member.ContainingTypeDefinition.GetTypeName(false);

            if (definition is ITypeDefinition type)
                return type.GetTypeName(includeNamespace: false);

            return string.Empty;
        }

        public static string GetMemberSignature(this IDefinition definition)
        {
            if (definition is IFieldDefinition field)
                return field.Name.Value;

            if (definition is ITypeDefinitionMember member)
                return MemberHelper.GetMemberSignature(member, NameFormattingOptions.Signature |
                                                               NameFormattingOptions.TypeParameters |
                                                               NameFormattingOptions.ContractNullable |
                                                               NameFormattingOptions.OmitContainingType |
                                                               NameFormattingOptions.OmitContainingNamespace |
                                                               NameFormattingOptions.PreserveSpecialNames);

            return string.Empty;
        }
    }
}

Define extension method over IDefinition

We can currently only answer those questions for a type member, but not
for types and namespaces.


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

using System;
using System.Buffers;
using osu.Framework.Graphics.Primitives;
using osuTK.Graphics.ES30;
using SixLabors.ImageSharp.PixelFormats;

namespace osu.Framework.Graphics.Textures
{
    public class ArrayPoolTextureUpload : ITextureUpload
    {
        private readonly ArrayPool<Rgba32> arrayPool;

        private readonly Rgba32[] data;

        /// <summary>
        /// Create an empty raw texture with an efficient shared memory backing.
        /// </summary>
        /// <param name="width">The width of the texture.</param>
        /// <param name="height">The height of the texture.</param>
        /// <param name="arrayPool">The source pool to retrieve memory from. Shared default is used if null.</param>
        public ArrayPoolTextureUpload(int width, int height, ArrayPool<Rgba32> arrayPool = null)
        {
            data = (this.arrayPool = ArrayPool<Rgba32>.Shared).Rent(width * height);
        }

        public void Dispose()
        {
            arrayPool.Return(data);
        }

        public Span<Rgba32> RawData => data;

        public ReadOnlySpan<Rgba32> Data => data;

        public int Level { get; set; }

        public virtual PixelFormat Format => PixelFormat.Rgba;

        public RectangleI Bounds { get; set; }
    }
}

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

using System;
using System.Buffers;
using osu.Framework.Graphics.Primitives;
using osuTK.Graphics.ES30;
using SixLabors.ImageSharp.PixelFormats;

namespace osu.Framework.Graphics.Textures
{
    public class ArrayPoolTextureUpload : ITextureUpload
    {
        private readonly ArrayPool<Rgba32> arrayPool;

        private readonly Rgba32[] data;

        /// <summary>
        /// Create an empty raw texture with an efficient shared memory backing.
        /// </summary>
        /// <param name="width">The width of the texture.</param>
        /// <param name="height">The height of the texture.</param>
        /// <param name="arrayPool">The source pool to retrieve memory from. Shared default is used if null.</param>
        public ArrayPoolTextureUpload(int width, int height, ArrayPool<Rgba32> arrayPool = null)
        {
            this.arrayPool = arrayPool ?? ArrayPool<Rgba32>.Shared;
            data = this.arrayPool.Rent(width * height);
        }

        public void Dispose()
        {
            arrayPool.Return(data);
        }

        public Span<Rgba32> RawData => data;

        public ReadOnlySpan<Rgba32> Data => data;

        public int Level { get; set; }

        public virtual PixelFormat Format => PixelFormat.Rgba;

        public RectangleI Bounds { get; set; }
    }
}

Fix incorrect array pool usage

Fix incorrect array pool usage


using System.Linq;
using Sitecore.Configuration;
using Sitecore.Data;
using Sitecore.Data.Serialization;
using Sitecore.Diagnostics;
using Sitecore.Eventing;
using Unicorn.Predicates;

namespace Unicorn.Pipelines.UnicornSyncEnd
{
	public class SendSerializationCompleteEvent : IUnicornSyncEndProcessor
	{
		public void Process(UnicornSyncEndPipelineArgs args)
		{
			var databases =	args.SyncedConfigurations.SelectMany(config => config.Resolve<IPredicate>().GetRootPaths())
					.Select(path => path.DatabaseName)
					.Distinct();

			foreach (var database in databases)
			{
				DeserializationComplete(database);
			}
		}

		protected virtual void DeserializationComplete(string databaseName)
		{
			Assert.ArgumentNotNullOrEmpty(databaseName, "databaseName");

			EventManager.RaiseEvent(new SerializationFinishedEvent());
			Database database = Factory.GetDatabase(databaseName, false);
			if (database != null)
			{
				database.RemoteEvents.Queue.QueueEvent(new SerializationFinishedEvent());
			}
		}
	}
}

using System.Linq;
using Sitecore.Configuration;
using Sitecore.Data;
using Sitecore.Data.Serialization;
using Sitecore.Diagnostics;
using Sitecore.Eventing;
using Sitecore.Jobs;
using Unicorn.Predicates;

namespace Unicorn.Pipelines.UnicornSyncEnd
{
	public class SendSerializationCompleteEvent : IUnicornSyncEndProcessor
	{
		public void Process(UnicornSyncEndPipelineArgs args)
		{
			var databases = args.SyncedConfigurations.SelectMany(config => config.Resolve<IPredicate>().GetRootPaths())
					.Select(path => path.DatabaseName)
					.Distinct();

			foreach (var database in databases)
			{
				DeserializationComplete(database);
			}
		}

		protected virtual void DeserializationComplete(string databaseName)
		{
			Assert.ArgumentNotNullOrEmpty(databaseName, "databaseName");

			// raising this event can take a long time. like 16 seconds. So we boot it as a job so it can go in the background.
			Job asyncSerializationFinished = new Job(new JobOptions("Raise deserialization complete async", "serialization", "shell", this, "RaiseEvent", new[] { databaseName }));
			JobManager.Start(asyncSerializationFinished);
		}

		public virtual void RaiseEvent(string databaseName)
		{
			EventManager.RaiseEvent(new SerializationFinishedEvent());
			Database database = Factory.GetDatabase(databaseName, false);
			if (database != null)
			{
				database.RemoteEvents.Queue.QueueEvent(new SerializationFinishedEvent());
			}
		}
	}
}

Raise serialization complete async, as it can take like 15 seconds


namespace PastaPricer.Tests.Acceptance
{
    using NSubstitute;

    using NUnit.Framework;

    [TestFixture]
    public class PastaPricerAcceptanceTests
    {
        [Test]
        public void Should_PublishPastaPriceOnceStartedAndMarketDataIsAvailable()
        {
            // Mocks instantiation
            var publisher = Substitute.For<IPastaPricerPublisher>();
            var marketDataProvider = new MarketDataProvider();

            var pastaPricer = new PastaPricerEngine(marketDataProvider, publisher);

            publisher.DidNotReceiveWithAnyArgs().Publish(string.Empty, 0);

            pastaPricer.Start();

            publisher.DidNotReceiveWithAnyArgs().Publish(string.Empty, 0);

            marketDataProvider.Start();

            // It publishes!
            publisher.ReceivedWithAnyArgs().Publish(string.Empty, 0);
        }
    }
}

namespace PastaPricer.Tests.Acceptance
{
    using NSubstitute;

    using NUnit.Framework;

    [TestFixture]
    public class PastaPricerAcceptanceTests
    {
        [Test]
        public void Should_Publish_Pasta_Price_Once_Started_And_MarketData_Is_Available()
        {
            // Mocks instantiation
            var publisher = Substitute.For<IPastaPricerPublisher>();
            var marketDataProvider = new MarketDataProvider();

            var pastaPricer = new PastaPricerEngine(marketDataProvider, publisher);

            publisher.DidNotReceiveWithAnyArgs().Publish(string.Empty, 0);

            pastaPricer.Start();

            publisher.DidNotReceiveWithAnyArgs().Publish(string.Empty, 0);

            marketDataProvider.Start();

            // It publishes!
            publisher.ReceivedWithAnyArgs().Publish(string.Empty, 0);
        }
    }
}

Rename acceptance test with proper underscores.


using System;
using System.Collections.Generic;

namespace LazerTagHostLibrary
{

    public class LazerTagSerial
    {

        public LazerTagSerial ()
        {
        }

        static public List<string> GetSerialPorts()
        {
            List<string> result = new List<string>();
            System.IO.DirectoryInfo di = new System.IO.DirectoryInfo("/dev");
            System.IO.FileInfo[] fi = di.GetFiles("ttyUSB*");

            foreach (System.IO.FileInfo f in fi) {
                result.Add(f.FullName);
            }

            return result;
        }
    }
}

using System;
using System.Collections.Generic;
using System.IO.Ports;

namespace LazerTagHostLibrary
{

    public class LazerTagSerial
    {

        public LazerTagSerial ()
        {
        }

        static public List<string> GetSerialPorts()
        {
            List<string> result = new List<string>();
            try {
                System.IO.DirectoryInfo di = new System.IO.DirectoryInfo("/dev");
                System.IO.FileInfo[] fi = di.GetFiles("ttyUSB*");

                foreach (System.IO.FileInfo f in fi) {
                    result.Add(f.FullName);
                }
            } catch (Exception) {
                //eh
            }

            try {
                String[] ports = SerialPort.GetPortNames();
                foreach (String p in ports) {
                    result.Add(p);
                }
            } catch (Exception) {
                //eh
            }

            return result;
        }
    }
}

Add enumerated ports to the list of serial ports, this currently causes duplicates but meh.


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

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

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

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

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

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

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

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

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

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

Update OData assembly version to 5.4.0.0


using System;
using System.IO;
using Microsoft.Win32;

namespace FreenetTray.Browsers {
    class Edge: Browser {

        private static string NTVersionRegistryKey = @"SOFTWARE\Microsoft\Windows NT\CurrentVersion";

        public Edge() {
            // for this key we want registry redirection enabled, so no registry view is used
            var reg = Registry.LocalMachine.OpenSubKey(NTVersionRegistryKey);

            string productName = reg.GetValue("ProductName") as string;

            // there's no version info but it isn't useful anyway
            _version = new System.Version(0, 0);

            _isInstalled = productName.StartsWith("Windows 10");

            _isUsable = _isInstalled;

            _args = "microsoft-edge:";

            // there is no .exe, instead a url like scheme is used with explorer.exe
            _path = Path.Combine(Environment.GetEnvironmentVariable("windir"), "explorer.exe");

            _name = "Edge";
        }

    }
}

using System;
using System.IO;
using Microsoft.Win32;

namespace FreenetTray.Browsers {
    class Edge: Browser {

        private static string NTVersionRegistryKey = @"SOFTWARE\Microsoft\Windows NT\CurrentVersion";

        public Edge() {
            RegistryKey reg = null;

            if (Environment.Is64BitOperatingSystem) {
                RegistryKey local64 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
                reg = local64.OpenSubKey(NTVersionRegistryKey);
            } else {
                RegistryKey local32 = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32);
                reg = local32.OpenSubKey(NTVersionRegistryKey);
            }

            if (reg != null) {
                string productName = reg.GetValue("ProductName") as string;

                _isInstalled = productName.StartsWith("Windows 10");
            } else {
                _isInstalled = false;
            }

            _isUsable = _isInstalled;

            // there's no version info but it isn't useful anyway
            _version = new System.Version(0, 0);

            _args = "microsoft-edge:";

            // there is no .exe, instead a url like scheme is used with explorer.exe
            _path = Path.Combine(Environment.GetEnvironmentVariable("windir"), "explorer.exe");

            _name = "Edge";
        }

    }
}

Check native registry view for Windows version

This fixes Coverity CID 171806

On Windows the CurrentVersion key is only present in the native view
of the registry, so a 32-bit application checking the
windows version on 64-bit Windows needs to check the 64-bit registry
view explicitly.

In practice, the wintray app will never be running in 32-bit mode on
64-bit Windows because we let it run in AnyCPU mode.

The default behavior of checking the native registry view should have
been correct as a result, but it is technically possible for the app
to be run in x86 mode which is where the Coverity defect comes from.

This will make sure the code does the right thing either way.


using System;
using System.Xml.Linq;

namespace Project {
  public abstract class Item: IEquatable<Item>, IConflictableItem {

    public abstract override int GetHashCode();

    public virtual string Action { get { return GetType().Name; } }
    public abstract string Key { get; }
    public bool IsResolveOption { get; set; }

    protected Item() {
      IsResolveOption = true;
    }

    public abstract bool Equals( Item other );

    public static bool operator ==( Item i1, Item i2 ) {
      if ( ReferenceEquals( null, i1 ) ^ ReferenceEquals( null, i2 ) ) {
        return false;
      }
      return ReferenceEquals( null, i1 ) || i1.Equals( i2 );
    }

    public abstract override bool Equals( object obj );

    public static bool operator !=( Item i1, Item i2 ) {
      return !( i1 == i2 );
    }

    public abstract XElement ToElement( XNamespace ns );

    public override string ToString() {
      return Key;
    }
  }
}

using System;
using System.Xml.Linq;

namespace Project {
  public abstract class Item: IEquatable<Item>, IConflictableItem {

    public abstract override int GetHashCode();

    public virtual string Action { get { return GetType().Name; } }
    public abstract string Key { get; }
    public bool IsResolveOption { get; set; }

    protected Item() {
      IsResolveOption = true;
    }

    public abstract bool Equals( Item other );

    public static bool operator ==( Item i1, Item i2 ) {
      if ( ReferenceEquals( null, i1 ) ^ ReferenceEquals( null, i2 ) ) {
        return false;
      }
      return ReferenceEquals( null, i1 ) || i1.Equals( i2 );
    }

    public abstract override bool Equals( object obj );

    public static bool operator !=( Item i1, Item i2 ) {
      return !( i1 == i2 );
    }

    public abstract XElement ToElement( XNamespace ns );

    public override string ToString() {
      var element = ToElement( "" );
      return element?.ToString() ?? Key;
    }
  }
}

Improve user question when node conflict is not auto-resolved


/* Copyright © 2018 Jeremy Herbison

This file is part of AudioWorks.

AudioWorks is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public
License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
version.

AudioWorks is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
details.

You should have received a copy of the GNU Affero General Public License along with AudioWorks. If not, see
<https://www.gnu.org/licenses/>. */

using System.Runtime.InteropServices;

namespace AudioWorks.Extensions.Flac
{
    [StructLayout(LayoutKind.Sequential)]
    readonly struct StreamInfo
    {
        readonly uint MinBlockSize;

        readonly uint MaxBlockSize;

        readonly uint MinFrameSize;

        readonly uint MaxFrameSize;

        internal readonly uint SampleRate;

        internal readonly uint Channels;

        internal readonly uint BitsPerSample;

        internal readonly ulong TotalSamples;

        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] readonly byte[] Md5Sum;
    }
}

/* Copyright © 2018 Jeremy Herbison

This file is part of AudioWorks.

AudioWorks is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public
License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later
version.

AudioWorks is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
details.

You should have received a copy of the GNU Affero General Public License along with AudioWorks. If not, see
<https://www.gnu.org/licenses/>. */

using System.Runtime.InteropServices;

namespace AudioWorks.Extensions.Flac
{
    [StructLayout(LayoutKind.Sequential)]
    unsafe struct StreamInfo
    {
        readonly uint MinBlockSize;

        readonly uint MaxBlockSize;

        readonly uint MinFrameSize;

        readonly uint MaxFrameSize;

        internal readonly uint SampleRate;

        internal readonly uint Channels;

        internal readonly uint BitsPerSample;

        internal readonly ulong TotalSamples;

        fixed byte Md5Sum[16];
    }
}

Use a fixed size buffer rather than marshalling


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

[assembly: AssemblyCompany("Yevgeniy Shunevych")]
[assembly: AssemblyProduct("Atata")]
[assembly: AssemblyCopyright("Copyright © Yevgeniy Shunevych 2016")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("0.8.0.0")]
[assembly: AssemblyFileVersion("0.8.0.0")]

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

[assembly: AssemblyCompany("Yevgeniy Shunevych")]
[assembly: AssemblyProduct("Atata")]
[assembly: AssemblyCopyright("Copyright © Yevgeniy Shunevych 2016")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("0.9.0.0")]
[assembly: AssemblyFileVersion("0.9.0.0")]

Increase project version number to 0.9.0


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

using System.ComponentModel;

namespace osu.Game.Localisation
{
    public enum Language
    {
        [Description(@"English")]
        en,

        [Description(@"日本語")]
        ja
    }
}

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

using System.ComponentModel;

namespace osu.Game.Localisation
{
    public enum Language
    {
        [Description(@"English")]
        en,

        // TODO: Requires Arabic glyphs to be added to resources (and possibly also RTL support).
        // [Description(@"اَلْعَرَبِيَّةُ")]
        // ar,

        // TODO: Some accented glyphs are missing. Revisit when adding Inter.
        // [Description(@"Беларуская мова")]
        // be,

        [Description(@"Български")]
        bg,

        [Description(@"Česky")]
        cs,

        [Description(@"Dansk")]
        da,

        [Description(@"Deutsch")]
        de,

        // TODO: Some accented glyphs are missing. Revisit when adding Inter.
        // [Description(@"Ελληνικά")]
        // el,

        [Description(@"español")]
        es,

        [Description(@"Suomi")]
        fi,

        [Description(@"français")]
        fr,

        [Description(@"Magyar")]
        hu,

        [Description(@"Bahasa Indonesia")]
        id,

        [Description(@"Italiano")]
        it,

        [Description(@"日本語")]
        ja,

        [Description(@"한국어")]
        ko,

        [Description(@"Nederlands")]
        nl,

        [Description(@"Norsk")]
        no,

        [Description(@"polski")]
        pl,

        [Description(@"Português")]
        pt,

        [Description(@"Português (Brasil)")]
        pt_br,

        [Description(@"Română")]
        ro,

        [Description(@"Русский")]
        ru,

        [Description(@"Slovenčina")]
        sk,

        [Description(@"Svenska")]
        se,

        [Description(@"ไทย")]
        th,

        [Description(@"Tagalog")]
        tl,

        [Description(@"Türkçe")]
        tr,

        // TODO: Some accented glyphs are missing. Revisit when adding Inter.
        // [Description(@"Українська мова")]
        // uk,

        [Description(@"Tiếng Việt")]
        vn,

        [Description(@"简体中文")]
        zh,

        [Description(@"繁體中文（香港）")]
        zh_hk,

        [Description(@"繁體中文（台灣）")]
        zh_tw
    }
}

Add more languages to settings dropdown

Add more languages to settings dropdown


using System;
using System.Threading.Tasks;
using Octokit;

namespace MangaRipper.Helpers
{
    public class UpdateNotification
    {
        public static async Task<string> GetLatestVersion()
        {
            var client = new GitHubClient(new ProductHeaderValue("MyAmazingApp"));
            var release = await client.Repository.Release.GetLatest("NguyenDanPhuong", "MangaRipper");
            return release.TagName;
        }

        public static long GetLatestBuildNumber(string version)
        {
            return Convert.ToInt64(version.Remove(0, version.LastIndexOf(".", StringComparison.Ordinal) + 1));
        }
    }
}

using System;
using System.Threading.Tasks;
using Octokit;
using System.Net;

namespace MangaRipper.Helpers
{
    public class UpdateNotification
    {
        public static async Task<string> GetLatestVersion()
        {
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
            var client = new GitHubClient(new ProductHeaderValue("MyAmazingApp"));
            var release = await client.Repository.Release.GetLatest("NguyenDanPhuong", "MangaRipper");
            return release.TagName;
        }

        public static long GetLatestBuildNumber(string version)
        {
            return Convert.ToInt64(version.Remove(0, version.LastIndexOf(".", StringComparison.Ordinal) + 1));
        }
    }
}

Fix SSL/TLS exception during application startup


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ProjectTracker.Library;

namespace PTWin
{
  public partial class ProjectSelect : Form
  {

    private Guid _projectId;

    public Guid ProjectId
    {
      get { return _projectId; }
    }

    public ProjectSelect()
    {
      InitializeComponent();
    }

    private void OK_Button_Click(object sender, EventArgs e)
    {
      _projectId = (Guid)this.ProjectListListBox.SelectedValue;
      this.Close();
    }

    private void Cancel_Button_Click(object sender, EventArgs e)
    {
      this.Close();
    }

    private void ProjectSelect_Load(object sender, EventArgs e)
    {
      DisplayList(ProjectList.GetProjectList());
    }

    private void DisplayList(ProjectList list)
    {
      Csla.SortedBindingList<ProjectInfo> sortedList =
        new Csla.SortedBindingList<ProjectInfo>(list);
      sortedList.ApplySort("Name", ListSortDirection.Ascending);
      this.projectListBindingSource.DataSource = sortedList;
    }

    private void GetListButton_Click(
      object sender, EventArgs e)
    {
      DisplayList(ProjectList.GetProjectList(NameTextBox.Text));
    }
  }
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ProjectTracker.Library;
using System.Linq;

namespace PTWin
{
  public partial class ProjectSelect : Form
  {

    private Guid _projectId;

    public Guid ProjectId
    {
      get { return _projectId; }
    }

    public ProjectSelect()
    {
      InitializeComponent();
    }

    private void OK_Button_Click(object sender, EventArgs e)
    {
      _projectId = (Guid)this.ProjectListListBox.SelectedValue;
      this.Close();
    }

    private void Cancel_Button_Click(object sender, EventArgs e)
    {
      this.Close();
    }

    private void ProjectSelect_Load(object sender, EventArgs e)
    {
      DisplayList(ProjectList.GetProjectList());
    }

    private void DisplayList(ProjectList list)
    {
      var sortedList = from p in list orderby p.Name select p;
      this.projectListBindingSource.DataSource = sortedList;
    }

    private void GetListButton_Click(
      object sender, EventArgs e)
    {
      DisplayList(ProjectList.GetProjectList(NameTextBox.Text));
    }
  }
}

Use LINQ to sort results.

Use LINQ to sort results.


namespace TraktSerializeAuthorizationExample
{
    class Program
    {
        static void Main(string[] args)
        {

        }
    }
}

namespace TraktSerializeAuthorizationExample
{
    using System;
    using TraktApiSharp;
    using TraktApiSharp.Authentication;
    using TraktApiSharp.Enums;
    using TraktApiSharp.Services;

    class Program
    {
        private const string CLIENT_ID = "FAKE_CLIENT_ID";
        private const string CLIENT_SECRET = "FAKE_CLIENT_SECRET";

        static void Main(string[] args)
        {
            TraktClient client = new TraktClient(CLIENT_ID, CLIENT_SECRET);

            TraktAuthorization fakeAuthorization = new TraktAuthorization
            {
                AccessToken = "FakeAccessToken",
                RefreshToken = "FakeRefreshToken",
                ExpiresIn = 90 * 24 * 3600,
                AccessScope = TraktAccessScope.Public,
                TokenType = TraktAccessTokenType.Bearer
            };

            Console.WriteLine("Fake Authorization:");
            Console.WriteLine($"Created (UTC): {fakeAuthorization.Created}");
            Console.WriteLine($"Access Scope: {fakeAuthorization.AccessScope.DisplayName}");
            Console.WriteLine($"Refresh Possible: {fakeAuthorization.IsRefreshPossible}");
            Console.WriteLine($"Valid: {fakeAuthorization.IsValid}");
            Console.WriteLine($"Token Type: {fakeAuthorization.TokenType.DisplayName}");
            Console.WriteLine($"Access Token: {fakeAuthorization.AccessToken}");
            Console.WriteLine($"Refresh Token: {fakeAuthorization.RefreshToken}");
            Console.WriteLine($"Token Expired: {fakeAuthorization.IsExpired}");
            Console.WriteLine($"Expires in {fakeAuthorization.ExpiresIn / 3600 / 24} days");

            Console.WriteLine("-------------------------------------------------------------");

            //string fakeAuthorizationJson = TraktSerializationService.Serialize(client.Authorization);
            string fakeAuthorizationJson = TraktSerializationService.Serialize(fakeAuthorization);

            if (!string.IsNullOrEmpty(fakeAuthorizationJson))
            {
                Console.WriteLine("Serialized Fake Authorization:");
                Console.WriteLine(fakeAuthorizationJson);

                Console.WriteLine("-------------------------------------------------------------");

                TraktAuthorization deserializedFakeAuthorization = TraktSerializationService.DeserializeAuthorization(fakeAuthorizationJson);

                if (deserializedFakeAuthorization != null)
                {
                    client.Authorization = deserializedFakeAuthorization;

                    Console.WriteLine("Deserialized Fake Authorization:");
                    Console.WriteLine($"Created (UTC): {deserializedFakeAuthorization.Created}");
                    Console.WriteLine($"Access Scope: {deserializedFakeAuthorization.AccessScope.DisplayName}");
                    Console.WriteLine($"Refresh Possible: {deserializedFakeAuthorization.IsRefreshPossible}");
                    Console.WriteLine($"Valid: {deserializedFakeAuthorization.IsValid}");
                    Console.WriteLine($"Token Type: {deserializedFakeAuthorization.TokenType.DisplayName}");
                    Console.WriteLine($"Access Token: {deserializedFakeAuthorization.AccessToken}");
                    Console.WriteLine($"Refresh Token: {deserializedFakeAuthorization.RefreshToken}");
                    Console.WriteLine($"Token Expired: {deserializedFakeAuthorization.IsExpired}");
                    Console.WriteLine($"Expires in {deserializedFakeAuthorization.ExpiresIn / 3600 / 24} days");
                }
            }

            Console.ReadLine();
        }
    }
}

Add implementation for authorization serialization example.