namespace ChessDotNet
{
    public enum Event
    {
        Check,
        Checkmate,
        Stalemate,
        Draw,
        Custom,
        Resign,
        VariantEnd, // to be used for chess variants, which can be derived from ChessGame
        None
    }

    public class GameStatus
    {
        public Event Event
        {
            get;
            private set;
        }

        public Player PlayerWhoCausedEvent
        {
            get;
            private set;
        }

        public string EventExplanation
        {
            get;
            private set;
        }

        public GameStatus(Event _event, Player whoCausedEvent, string eventExplanation)
        {
            Event = _event;
            PlayerWhoCausedEvent = whoCausedEvent;
            EventExplanation = eventExplanation;
        }
    }
}

namespace ChessDotNet
{
    public enum Event
    {
        Check,
        Checkmate,
        Stalemate,
        Draw,
        Custom,
        Resign,
        VariantEnd, // to be used for chess variants, which can be derived from ChessGame
        None
    }

    public class GameStatus
    {
        public Event Event
        {
            get;
            private set;
        }

        public Player PlayerWhoCausedEvent
        {
            get;
            private set;
        }

        public string EventExplanation
        {
            get;
            private set;
        }

        public GameStatus(Event @event, Player whoCausedEvent, string eventExplanation)
        {
            Event = @event;
            PlayerWhoCausedEvent = whoCausedEvent;
            EventExplanation = eventExplanation;
        }
    }
}

Remove underscore from parameter name

Remove underscore from parameter name


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

using osu.Framework.Logging;
using osu.Framework.Platform;
using osu.Game.Configuration;

namespace osu.Game.IO
{
    public class OsuStorage : WrappedStorage
    {
        public OsuStorage(GameHost host)
            : base(host.Storage, string.Empty)
        {
            var storageConfig = new StorageConfigManager(host.Storage);

            var customStoragePath = storageConfig.Get<string>(StorageConfig.FullPath);

            if (!string.IsNullOrEmpty(customStoragePath))
            {
                ChangeTargetStorage(host.GetStorage(customStoragePath));
                Logger.Storage = UnderlyingStorage.GetStorageForDirectory("logs");
            }
        }
    }
}

// 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.IO;
using osu.Framework.Logging;
using osu.Framework.Platform;
using osu.Game.Configuration;

namespace osu.Game.IO
{
    public class OsuStorage : WrappedStorage
    {
        private readonly GameHost host;
        private readonly StorageConfigManager storageConfig;

        public OsuStorage(GameHost host)
            : base(host.Storage, string.Empty)
        {
            this.host = host;

            storageConfig = new StorageConfigManager(host.Storage);

            var customStoragePath = storageConfig.Get<string>(StorageConfig.FullPath);

            if (!string.IsNullOrEmpty(customStoragePath))
            {
                ChangeTargetStorage(host.GetStorage(customStoragePath));
                Logger.Storage = UnderlyingStorage.GetStorageForDirectory("logs");
            }
        }

        public void Migrate(string newLocation)
        {
            string oldLocation = GetFullPath(".");

            // ensure the new location has no files present, else hard abort
            if (Directory.Exists(newLocation))
            {
                if (Directory.GetFiles(newLocation).Length > 0)
                    throw new InvalidOperationException("Migration destination already has files present");

                Directory.Delete(newLocation, true);
            }

            Directory.Move(oldLocation, newLocation);

            Directory.CreateDirectory(newLocation);
            // temporary
            Directory.CreateDirectory(oldLocation);

            // move back exceptions for now
            Directory.Move(Path.Combine(newLocation, "cache"), Path.Combine(oldLocation, "cache"));
            File.Move(Path.Combine(newLocation, "framework.ini"), Path.Combine(oldLocation, "framework.ini"));

            ChangeTargetStorage(host.GetStorage(newLocation));

            storageConfig.Set(StorageConfig.FullPath, newLocation);
            storageConfig.Save();
        }
    }
}

Add basic blocking migration, move not copy


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

using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Textures;
using osu.Game.Graphics;
using osuTK;

namespace osu.Game.Tests.Visual.Gameplay
{
    [TestFixture]
    public class TestSceneParticleExplosion : OsuTestScene
    {
        [BackgroundDependencyLoader]
        private void load(TextureStore textures)
        {
            AddStep(@"display", () =>
            {
                Child = new ParticleExplosion(textures.Get("Cursor/cursortrail"), 150, 1200)
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Size = new Vector2(200)
                };
            });
        }
    }
}

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

using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Textures;
using osu.Game.Graphics;
using osuTK;

namespace osu.Game.Tests.Visual.Gameplay
{
    [TestFixture]
    public class TestSceneParticleExplosion : OsuTestScene
    {
        [BackgroundDependencyLoader]
        private void load(TextureStore textures)
        {
            AddRepeatStep(@"display", () =>
            {
                Child = new ParticleExplosion(textures.Get("Cursor/cursortrail"), 150, 1200)
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Size = new Vector2(400)
                };
            }, 10);
        }
    }
}

Make test run multiple times

Make test run multiple times


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

namespace System.IO.Pipelines
{
    public class DuplexPipe : IDuplexPipe
    {
        public DuplexPipe(PipeReader reader, PipeWriter writer)
        {
            Input = reader;
            Output = writer;
        }

        public PipeReader Input { get; }

        public PipeWriter Output { get; }

        public void Dispose()
        {

        }

        public static DuplexPipePair CreateConnectionPair(PipeOptions inputOptions, PipeOptions outputOptions)
        {
            var input = new Pipe(inputOptions);
            var output = new Pipe(outputOptions);

            var transportToApplication = new DuplexPipe(output.Reader, input.Writer);
            var applicationToTransport = new DuplexPipe(input.Reader, output.Writer);

            return new DuplexPipePair(applicationToTransport, transportToApplication);
        }

        // This class exists to work around issues with value tuple on .NET Framework
        public struct DuplexPipePair
        {
            public IDuplexPipe Transport { get; private set; }
            public IDuplexPipe Application { get; private set; }

            public DuplexPipePair(IDuplexPipe transport, IDuplexPipe application)
            {
                Transport = transport;
                Application = application;
            }
        }
    }
}

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

using System.IO.Pipelines;

namespace Microsoft.AspNetCore.Sockets
{
    public class DuplexPipe : IDuplexPipe
    {
        public DuplexPipe(PipeReader reader, PipeWriter writer)
        {
            Input = reader;
            Output = writer;
        }

        public PipeReader Input { get; }

        public PipeWriter Output { get; }

        public void Dispose()
        {

        }

        public static DuplexPipePair CreateConnectionPair(PipeOptions inputOptions, PipeOptions outputOptions)
        {
            var input = new Pipe(inputOptions);
            var output = new Pipe(outputOptions);

            var transportToApplication = new DuplexPipe(output.Reader, input.Writer);
            var applicationToTransport = new DuplexPipe(input.Reader, output.Writer);

            return new DuplexPipePair(applicationToTransport, transportToApplication);
        }

        // This class exists to work around issues with value tuple on .NET Framework
        public struct DuplexPipePair
        {
            public IDuplexPipe Transport { get; private set; }
            public IDuplexPipe Application { get; private set; }

            public DuplexPipePair(IDuplexPipe transport, IDuplexPipe application)
            {
                Transport = transport;
                Application = application;
            }
        }
    }
}

Change namespace to avoid conflict

Change namespace to avoid conflict


using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using HandlebarsDotNet.MemberAccessors;
using HandlebarsDotNet.ObjectDescriptors;
using HandlebarsDotNet.PathStructure;

namespace HandlebarsDotNet
{
    public readonly ref struct ObjectAccessor
    {
        private readonly object _data;
        private readonly ObjectDescriptor _descriptor;
        private readonly IMemberAccessor _memberAccessor;

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public ObjectAccessor(object data, ObjectDescriptor descriptor)
        {
            _data = data;
            _descriptor = descriptor;
            _memberAccessor = _descriptor.MemberAccessor;
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public ObjectAccessor(object data)
        {
            _data = data;
            if (data == null || !ObjectDescriptorFactory.Current.TryGetDescriptor(data.GetType(), out _descriptor))
            {
                _descriptor = ObjectDescriptor.Empty;
                _memberAccessor = null;
            }
            else
            {
                _memberAccessor = _descriptor.MemberAccessor;
            }
        }

        public IEnumerable<ChainSegment> Properties => _descriptor
            .GetProperties(_descriptor, _data)
            .OfType<object>()
            .Select(ChainSegment.Create);

        public object this[ChainSegment segment] =>
            _memberAccessor != null && _memberAccessor.TryGetValue(_data, segment, out var value)
                ? value
                : null;

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public bool TryGetValue(ChainSegment segment, out object value) =>
            _memberAccessor.TryGetValue(_data, segment, out value);
    }
}

using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using HandlebarsDotNet.MemberAccessors;
using HandlebarsDotNet.ObjectDescriptors;
using HandlebarsDotNet.PathStructure;

namespace HandlebarsDotNet
{
    public readonly ref struct ObjectAccessor
    {
        private readonly object _data;
        private readonly ObjectDescriptor _descriptor;
        private readonly IMemberAccessor _memberAccessor;

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public ObjectAccessor(object data, ObjectDescriptor descriptor)
        {
            _data = data;
            _descriptor = descriptor;
            _memberAccessor = _descriptor.MemberAccessor;
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public ObjectAccessor(object data)
        {
            _data = data;
            if (data == null || !ObjectDescriptorFactory.Current.TryGetDescriptor(data.GetType(), out _descriptor))
            {
                _descriptor = ObjectDescriptor.Empty;
                _memberAccessor = null;
            }
            else
            {
                _memberAccessor = _descriptor.MemberAccessor;
            }
        }

        public IEnumerable<ChainSegment> Properties => _descriptor
            .GetProperties(_descriptor, _data)
            .OfType<object>()
            .Select(ChainSegment.Create);

        public object this[ChainSegment segment] =>
            _memberAccessor != null && _memberAccessor.TryGetValue(_data, segment, out var value)
                ? value
                : null;

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public bool TryGetValue(ChainSegment segment, out object value)
        {
            if (_memberAccessor == null)
            {
                value = null;
                return false;
            }

            return _memberAccessor.TryGetValue(_data, segment, out value);
        }
    }
}

Fix `NullReferenceException` when `IMemberAccessor` was not resolved Related to Handlebars-Net/Handlebars.Net/issues/399


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

using osu.Game.Modes.Objects.Drawables;
using osu.Game.Modes.Osu.Judgements;
using osu.Game.Modes.Osu.Objects;
using osu.Game.Modes.Scoring;
using osu.Game.Modes.UI;

namespace osu.Game.Modes.Osu.Scoring
{
    internal class OsuScoreProcessor : ScoreProcessor<OsuHitObject, OsuJudgement>
    {
        public OsuScoreProcessor()
        {
        }

        public OsuScoreProcessor(HitRenderer<OsuHitObject, OsuJudgement> hitRenderer)
            : base(hitRenderer)
        {
        }

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

            Health.Value = 1;
            Accuracy.Value = 1;
        }

        protected override void OnNewJudgement(OsuJudgement judgement)
        {
            if (judgement != null)
            {
                switch (judgement.Result)
                {
                    case HitResult.Hit:
                        Combo.Value++;
                        Health.Value += 0.1f;
                        break;
                    case HitResult.Miss:
                        Combo.Value = 0;
                        Health.Value -= 0.2f;
                        break;
                }
            }

            int score = 0;
            int maxScore = 0;

            foreach (var j in Judgements)
            {
                score += j.ScoreValue;
                maxScore += j.MaxScoreValue;
            }

            TotalScore.Value = score;
            Accuracy.Value = (double)score / maxScore;
        }
    }
}

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

using osu.Game.Modes.Objects.Drawables;
using osu.Game.Modes.Osu.Judgements;
using osu.Game.Modes.Osu.Objects;
using osu.Game.Modes.Scoring;
using osu.Game.Modes.UI;

namespace osu.Game.Modes.Osu.Scoring
{
    internal class OsuScoreProcessor : ScoreProcessor<OsuHitObject, OsuJudgement>
    {
        public OsuScoreProcessor()
        {
        }

        public OsuScoreProcessor(HitRenderer<OsuHitObject, OsuJudgement> hitRenderer)
            : base(hitRenderer)
        {
        }

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

            Health.Value = 1;
            Accuracy.Value = 1;
        }

        protected override void OnNewJudgement(OsuJudgement judgement)
        {
            int score = 0;
            int maxScore = 0;

            foreach (var j in Judgements)
            {
                score += j.ScoreValue;
                maxScore += j.MaxScoreValue;
            }

            TotalScore.Value = score;
            Accuracy.Value = (double)score / maxScore;
        }
    }
}

Fix osu! mode adding combos twice.

Fix osu! mode adding combos twice.


using System.IO;
using EnvDTE;

namespace NuGet.VisualStudio
{
    /// <summary>
    /// This project system represents the JavaScript Metro project in Windows8
    /// </summary>
    public class JsProjectSystem : VsProjectSystem
    {
        public JsProjectSystem(Project project, IFileSystemProvider fileSystemProvider) :
            base(project, fileSystemProvider)
        {
        }

        public override string ProjectName
        {
            get
            {
                return Project.GetName();
            }
        }

        public override void AddFile(string path, Stream stream)
        {
            Project.GetProjectItems(path, createIfNotExists: true);
            base.AddFile(path, stream);
        }

        protected override void AddFileToContainer(string fullPath, ProjectItems container)
        {
            container.AddFromFile(fullPath);
        }
    }
}

using System.IO;
using EnvDTE;

namespace NuGet.VisualStudio
{
    /// <summary>
    /// This project system represents the JavaScript Metro project in Windows8
    /// </summary>
    public class JsProjectSystem : VsProjectSystem
    {
        public JsProjectSystem(Project project, IFileSystemProvider fileSystemProvider) :
            base(project, fileSystemProvider)
        {
        }

        public override string ProjectName
        {
            get
            {
                return Project.GetName();
            }
        }

        public override void AddFile(string path, Stream stream)
        {
            // ensure the parent folder is created before adding file to the project
            Project.GetProjectItems(Path.GetDirectoryName(path), createIfNotExists: true);
            base.AddFile(path, stream);
        }

        protected override void AddFileToContainer(string fullPath, ProjectItems container)
        {
            container.AddFromFile(fullPath);
        }
    }
}

Fix bug not able to install packages to JS Metro project. Work items: 1986

--HG--
branch : 1.7


using System.Collections.Generic;
using System.Xml.Serialization;

namespace PhotoStoryToBloomConverter.BloomModel.BloomHtmlModel
{
    public class Body
    {
        [XmlAttribute("bookcreationtype")]
        public string BookCreationType;
        [XmlAttribute("class")]
        public string Class;
        [XmlElement("div")]
        public List<Div> Divs;
    }
}

using System.Collections.Generic;
using System.Xml.Serialization;

namespace PhotoStoryToBloomConverter.BloomModel.BloomHtmlModel
{
    public class Body
    {
		// REVIEW: I don't think these two are necessary/useful
        [XmlAttribute("bookcreationtype")]
        public string BookCreationType;
        [XmlAttribute("class")]
        public string Class;

		// Features used to make this a "motion book"
		[XmlAttribute("data-bfautoadvance")]
		public string BloomFeature_AutoAdvance = "landscape;bloomReader";
		[XmlAttribute("data-bfcanrotate")]
		public string BloomFeature_CanRotate = "allOrientations;bloomReader";
		[XmlAttribute("data-bfplayanimations")]
		public string BloomFeature_PlayAnimations = "landscape;bloomReader";
		[XmlAttribute("data-bfplaymusic")]
		public string BloomFeature_PlayMusic = "landscape;bloomReader";
		[XmlAttribute("data-bfplaynarration")]
		public string BloomFeature_PlayNarration = "landscape;bloomReader";
		[XmlAttribute("data-bffullscreenpicture")]
		public string BloomFeature_FullScreenPicture = "landscape;bloomReader";

		[XmlElement("div")]
        public List<Div> Divs;
    }
}

Make published books "motion book"s

Make published books "motion book"s


using System;
using System.Collections.Generic;
using Rainbow.Model;
using Sitecore.Data;

namespace Rainbow.Formatting.FieldFormatters
{
	public class MultilistFormatter : FieldTypeBasedFormatter
	{
		public override string[] SupportedFieldTypes
		{
			get
			{
				return new[] { "Checklist", "Multilist", "Multilist with Search", "Treelist", "Treelist with Search", "TreelistEx" };
			}
		}

		public override string Format(IItemFieldValue field)
		{
			var values = ID.ParseArray(field.Value);

			if (values.Length == 0 && field.Value.Length > 0)
				return field.Value;

			return string.Join(Environment.NewLine, (IEnumerable<ID>)values);
		}

		public override string Unformat(string value)
		{
			if (value == null) return null;
			return value.Trim().Replace(Environment.NewLine, "|");
		}
	}
}

using System;
using System.Collections.Generic;
using Rainbow.Model;
using Sitecore.Data;

namespace Rainbow.Formatting.FieldFormatters
{
	public class MultilistFormatter : FieldTypeBasedFormatter
	{
		public override string[] SupportedFieldTypes
		{
			get
			{
				return new[] { "Checklist", "Multilist", "Multilist with Search", "Treelist", "Treelist with Search", "TreelistEx", "tree list" };
			}
		}

		public override string Format(IItemFieldValue field)
		{
			var values = ID.ParseArray(field.Value);

			if (values.Length == 0 && field.Value.Length > 0)
				return field.Value;

			return string.Join(Environment.NewLine, (IEnumerable<ID>)values);
		}

		public override string Unformat(string value)
		{
			if (value == null) return null;
			return value.Trim().Replace(Environment.NewLine, "|");
		}
	}
}

Add deprecated 'tree list' type to formatter, because that's what __base templates still is :)


using System;
using System.Diagnostics;
using System.ServiceModel;
using NUnit.Framework;
using TechTalk.SpecFlow;

namespace Host.Specs
{
    /// <summary>
    /// An **copy** of the interface specifying the contract for this service.
    /// </summary>
    [ServiceContract(
        Namespace = "http://www.thatindigogirl.com/samples/2006/06")]
    public interface IHelloIndigoService
    {
        [OperationContract]
        string HelloIndigo();
    }

    [Binding]
    public class RunServiceHostSteps
    {
        [Given(@"that I have started the host")]
        public void GivenThatIHaveStartedTheHost()
        {
            Process.Start(@"..\..\..\Host\bin\Debug\Host.exe");
        }

        [When(@"I execute the ""(.*)"" method of the service")]
        public void WhenIExecuteTheMethodOfTheService(string p0)
        {
            var endPointAddress =
                new EndpointAddress(
                    "http://localhost:8000/HelloIndigo/HelloIndigoService");
            var proxy =
                ChannelFactory<IHelloIndigoService>.CreateChannel(
                    new BasicHttpBinding(), endPointAddress);
            ScenarioContext.Current.Set(proxy);
        }

        [Then(@"I receive ""(.*)"" as a result")]
        public void ThenIReceiveAsAResult(string p0)
        {
            var proxy = ScenarioContext.Current.Get<IHelloIndigoService>();
            var result = proxy.HelloIndigo();
            Assert.That(result, Is.EqualTo("Hello Indigo"));
        }
    }
}

using System;
using System.Diagnostics;
using System.ServiceModel;
using NUnit.Framework;
using TechTalk.SpecFlow;

namespace Host.Specs
{
    /// <summary>
    /// An **copy** of the interface specifying the contract for this service.
    /// </summary>
    [ServiceContract(
        Namespace = "http://www.thatindigogirl.com/samples/2006/06")]
    public interface IHelloIndigoService
    {
        [OperationContract]
        string HelloIndigo();
    }

    [Binding]
    public class RunServiceHostSteps
    {
        [Given(@"that I have started the host")]
        public void GivenThatIHaveStartedTheHost()
        {
            Process.Start(@"..\..\..\Host\bin\Debug\Host.exe");
        }

        [When(@"I execute the ""(.*)"" method of the service")]
        public void WhenIExecuteTheMethodOfTheService(string p0)
        {
            var endPointAddress =
                new EndpointAddress(
                    "http://localhost:8733/Design_Time_Addresses/Host/HelloIndigoService");
            var proxy =
                ChannelFactory<IHelloIndigoService>.CreateChannel(
                    new BasicHttpBinding(), endPointAddress);
            ScenarioContext.Current.Set(proxy);
        }

        [Then(@"I receive ""(.*)"" as a result")]
        public void ThenIReceiveAsAResult(string p0)
        {
            var proxy = ScenarioContext.Current.Get<IHelloIndigoService>();
            var result = proxy.HelloIndigo();
            Assert.That(result, Is.EqualTo("Hello Indigo"));
        }
    }
}

Correct test client endpoint address. It worked!

Changed the endpoint address to which the test client connects to the
endpoint address specified in `Host\App.config`. The test now passes.

Now that I am "green," I can move on to other work. :)


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

using osu.Game.Graphics.UserInterface;
using osu.Framework.Graphics;
using osu.Framework.Graphics.UserInterface;

namespace osu.Game.Overlays
{
    public class OverlayHeaderBreadcrumbControl : BreadcrumbControl<string>
    {
        public OverlayHeaderBreadcrumbControl()
        {
            RelativeSizeAxes = Axes.X;
        }

        protected override TabItem<string> CreateTabItem(string value) => new ControlTabItem(value);

        private class ControlTabItem : BreadcrumbTabItem
        {
            protected override float ChevronSize => 8;

            public ControlTabItem(string value)
                : base(value)
            {
                Text.Font = Text.Font.With(size: 14);
                Chevron.Y = 3;
            }
        }
    }
}

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

using osu.Game.Graphics.UserInterface;
using osu.Framework.Graphics;
using osu.Framework.Graphics.UserInterface;

namespace osu.Game.Overlays
{
    public class OverlayHeaderBreadcrumbControl : BreadcrumbControl<string>
    {
        public OverlayHeaderBreadcrumbControl()
        {
            RelativeSizeAxes = Axes.X;
        }

        protected override TabItem<string> CreateTabItem(string value) => new ControlTabItem(value);

        private class ControlTabItem : BreadcrumbTabItem
        {
            protected override float ChevronSize => 8;

            public ControlTabItem(string value)
                : base(value)
            {
                Text.Font = Text.Font.With(size: 14);
                Chevron.Y = 3;
                Bar.Height = 0;
            }
        }
    }
}

Remove underline from breadcrumb display


// 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;
using osu.Framework.Graphics.Sprites;
using osu.Game.Screens.Select.Options;
using osuTK.Graphics;

namespace osu.Game.Tests.Visual.SongSelect
{
    [Description("bottom beatmap details")]
    public class TestSceneBeatmapOptionsOverlay : OsuTestScene
    {
        public TestSceneBeatmapOptionsOverlay()
        {
            var overlay = new BeatmapOptionsOverlay();

            overlay.AddButton(@"Remove", @"from unplayed", FontAwesome.Regular.TimesCircle, Color4.Purple, null);
            overlay.AddButton(@"Clear", @"local scores", FontAwesome.Solid.Eraser, Color4.Purple, null);
            overlay.AddButton(@"Delete", @"all difficulties", FontAwesome.Solid.Trash, Color4.Pink, null);
            overlay.AddButton(@"Edit", @"beatmap", FontAwesome.Solid.PencilAlt, Color4.Yellow, null);

            Add(overlay);

            AddStep(@"Toggle", overlay.ToggleVisibility);
        }
    }
}

// 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;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Screens.Select.Options;

namespace osu.Game.Tests.Visual.SongSelect
{
    [Description("bottom beatmap details")]
    public class TestSceneBeatmapOptionsOverlay : OsuTestScene
    {
        public TestSceneBeatmapOptionsOverlay()
        {
            var overlay = new BeatmapOptionsOverlay();

            var colours = new OsuColour();

            overlay.AddButton(@"Remove", @"from unplayed", FontAwesome.Regular.TimesCircle, colours.Purple, null);
            overlay.AddButton(@"Clear", @"local scores", FontAwesome.Solid.Eraser, colours.Purple, null);
            overlay.AddButton(@"Delete", @"all difficulties", FontAwesome.Solid.Trash, colours.Pink, null);
            overlay.AddButton(@"Edit", @"beatmap", FontAwesome.Solid.PencilAlt, colours.Yellow, null);

            Add(overlay);

            AddStep(@"Toggle", overlay.ToggleVisibility);
        }
    }
}

Fix button colors in beatmap options test


namespace SqlStreamStore
{
    using System.Threading;
    using System.Threading.Tasks;
    using Shouldly;
    using SqlStreamStore.Streams;
    using Xunit;

    public class MigrationTests
    {
        [Fact]
        public async Task Can_migrate()
        {
            // Set up an old schema + data.
            var schema = "baz";
            var v2Fixture = new MsSqlStreamStoreFixture(schema, deleteDatabaseOnDispose: false);
            var v2Store = await v2Fixture.GetMsSqlStreamStore();
            await v2Store.AppendToStream("stream-1",
                ExpectedVersion.NoStream,
                StreamStoreAcceptanceTests.CreateNewStreamMessages(1, 2, 3));
            await v2Store.AppendToStream("stream-2",
                ExpectedVersion.NoStream,
                StreamStoreAcceptanceTests.CreateNewStreamMessages(1, 2, 3));

            await v2Store.SetStreamMetadata("stream-1", ExpectedVersion.Any, maxAge: 10, maxCount: 20);
            v2Store.Dispose();
            v2Fixture.Dispose();

            // Migrate with V3 schema.
            var v3Fixture = new MsSqlStreamStoreV3Fixture(schema, databaseNameOverride: v2Fixture.DatabaseName);
            var v3Store = await v3Fixture.GetMsSqlStreamStore();

            var checkSchemaResult = await v3Store.CheckSchema();
            checkSchemaResult.IsMatch().ShouldBeFalse();

            await v3Store.Migrate(CancellationToken.None);

            checkSchemaResult = await v3Store.CheckSchema();
            checkSchemaResult.IsMatch().ShouldBeTrue();

            v3Store.Dispose();
            v3Fixture.Dispose();
        }
    }
}

namespace SqlStreamStore
{
    using System.Threading;
    using System.Threading.Tasks;
    using Shouldly;
    using SqlStreamStore.Streams;
    using Xunit;

    public class MigrationTests
    {
        [Fact]
        public async Task Can_migrate()
        {
            // Set up an old schema + data.
            var schema = "baz";
            var v2Fixture = new MsSqlStreamStoreFixture(schema, deleteDatabaseOnDispose: false);
            var v2Store = await v2Fixture.GetMsSqlStreamStore();
            await v2Store.AppendToStream("stream-1",
                ExpectedVersion.NoStream,
                StreamStoreAcceptanceTests.CreateNewStreamMessages(1, 2, 3));
            await v2Store.AppendToStream("stream-2",
                ExpectedVersion.NoStream,
                StreamStoreAcceptanceTests.CreateNewStreamMessages(1, 2, 3));

            await v2Store.SetStreamMetadata("stream-1", ExpectedVersion.Any, maxAge: 10, maxCount: 20);
            v2Store.Dispose();
            v2Fixture.Dispose();

            var settings = new MsSqlStreamStoreV3Settings(v2Fixture.ConnectionString)
            {
                Schema = schema,
            };

            var v3Store = new MsSqlStreamStoreV3(settings);

            var checkSchemaResult = await v3Store.CheckSchema();
            checkSchemaResult.IsMatch().ShouldBeFalse();

            await v3Store.Migrate(CancellationToken.None);

            checkSchemaResult = await v3Store.CheckSchema();
            checkSchemaResult.IsMatch().ShouldBeTrue();

            v3Store.Dispose();
        }
    }
}

Fix migration test - use correct database from v2 fixture.


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

using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Graphics.UserInterface;
using osu.Game.Localisation;
using osu.Game.Screens.OnlinePlay;

namespace osu.Game.Overlays.Mods
{
    public class SelectAllModsButton : ShearedButton, IKeyBindingHandler<PlatformAction>
    {
        public SelectAllModsButton(FreeModSelectOverlay modSelectOverlay)
            : base(ModSelectOverlay.BUTTON_WIDTH)
        {
            Text = CommonStrings.SelectAll;
            Action = modSelectOverlay.SelectAll;
        }

        public bool OnPressed(KeyBindingPressEvent<PlatformAction> e)
        {
            if (e.Repeat || e.Action != PlatformAction.SelectAll)
                return false;

            TriggerClick();
            return true;
        }

        public void OnReleased(KeyBindingReleaseEvent<PlatformAction> e)
        {
        }
    }
}

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

using System.Collections.Generic;
using System.Linq;
using osu.Framework.Bindables;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Game.Graphics.UserInterface;
using osu.Game.Localisation;
using osu.Game.Rulesets.Mods;
using osu.Game.Screens.OnlinePlay;

namespace osu.Game.Overlays.Mods
{
    public class SelectAllModsButton : ShearedButton, IKeyBindingHandler<PlatformAction>
    {
        private readonly Bindable<IReadOnlyList<Mod>> selectedMods = new Bindable<IReadOnlyList<Mod>>();
        private readonly Bindable<Dictionary<ModType, IReadOnlyList<ModState>>> availableMods = new Bindable<Dictionary<ModType, IReadOnlyList<ModState>>>();

        public SelectAllModsButton(FreeModSelectOverlay modSelectOverlay)
            : base(ModSelectOverlay.BUTTON_WIDTH)
        {
            Text = CommonStrings.SelectAll;
            Action = modSelectOverlay.SelectAll;

            selectedMods.BindTo(modSelectOverlay.SelectedMods);
            availableMods.BindTo(modSelectOverlay.AvailableMods);
        }

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

            selectedMods.BindValueChanged(_ => Scheduler.AddOnce(updateEnabledState));
            availableMods.BindValueChanged(_ => Scheduler.AddOnce(updateEnabledState));
            updateEnabledState();
        }

        private void updateEnabledState()
        {
            Enabled.Value = availableMods.Value
                                         .SelectMany(pair => pair.Value)
                                         .Any(modState => !modState.Active.Value && !modState.Filtered.Value);
        }

        public bool OnPressed(KeyBindingPressEvent<PlatformAction> e)
        {
            if (e.Repeat || e.Action != PlatformAction.SelectAll)
                return false;

            TriggerClick();
            return true;
        }

        public void OnReleased(KeyBindingReleaseEvent<PlatformAction> e)
        {
        }
    }
}

Disable "select all mods" button if all are selected


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

namespace System
{
    public readonly partial struct DateTime
    {
        public static DateTime UtcNow
        {
            get
            {
                // For performance, use a private constructor that does not validate arguments.
                return new DateTime(((ulong)(Interop.Sys.GetSystemTimeAsTicks() + TicksTo1970)) | KindUtc);
            }
        }
    }
}

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

namespace System
{
    public readonly partial struct DateTime
    {
        public static DateTime UtcNow
        {
            get
            {
                // For performance, use a private constructor that does not validate arguments.
                return new DateTime(((ulong)(Interop.Sys.GetSystemTimeAsTicks() + DateTime.UnixEpochTicks)) | KindUtc);
            }
        }
    }
}

Fix build error with mirroring

Fix build error with mirroring


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

[assembly: AssemblyTitle("CodeProject - EF Library")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("AREBIS")]
[assembly: AssemblyProduct("CodeProject - EF")]
[assembly: AssemblyCopyright("Copyright © Rudi Breedenraedt 2009")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: System.CLSCompliant(true)]

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

[assembly: AssemblyTitle("CodeProject - EF Library")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("AREBIS")]
[assembly: AssemblyProduct("CodeProject - EF")]
[assembly: AssemblyCopyright("Copyright © Rudi Breedenraedt 2009")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

// voorlopig geen CLS-compliante code.
// [assembly: System.CLSCompliant(true)]

Check voor CLS-compliante code verwijderd uit project CodeProject.Data

git-svn-id: 0ffdc289f568b1e7493e560395a00d06174c8a92@344 99b415e2-69d1-4072-8d93-0ed3a15484ab


using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
using Zermelo.API.Services;

namespace Zermelo.API.Tests.Services
{
    public class JsonServiceTests
    {
        [Fact]
        public void ShouldDeserializeDataInResponeData()
        {
            var sut = new JsonService();
            ObservableCollection<TestClass> expected = new ObservableCollection<TestClass>
            {
                new TestClass(5),
                new TestClass(3)
            };
            string testData = "{ \"response\": { \"data\": [ { \"Number\": 5 }, { \"Number\": 3 } ] } }";

            ObservableCollection<TestClass> result = sut.DeserializeCollection<TestClass>(testData);

            Assert.Equal(expected.Count, result.Count);
            for (int i = 0; i < expected.Count; i++)
                Assert.Equal(expected[i].Number, result[i].Number);
        }

        [Fact]
        public void ShouldReturnValue()
        {
            var sut = new JsonService();
            string expected = "value";
            string testData = "{ \"key\": \"value\" }";

            string result = sut.GetValue<string>(testData, "key");

            Assert.Equal(expected, result);
        }
    }

    internal class TestClass
    {
        public TestClass(int number)
        {
            this.Number = number;
        }

        public int Number { get; set; }
    }
}

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;
using Zermelo.API.Services;

namespace Zermelo.API.Tests.Services
{
    public class JsonServiceTests
    {
        [Fact]
        public void ShouldDeserializeDataInResponeData()
        {
            var sut = new JsonService();
            List<TestClass> expected = new List<TestClass>
            {
                new TestClass(5),
                new TestClass(3)
            };
            string testData = "{ \"response\": { \"data\": [ { \"Number\": 5 }, { \"Number\": 3 } ] } }";

            List<TestClass> result = sut.DeserializeCollection<TestClass>(testData).ToList();

            Assert.Equal(expected.Count, result.Count);
            for (int i = 0; i < expected.Count; i++)
                Assert.Equal(expected[i].Number, result[i].Number);
        }

        [Fact]
        public void ShouldReturnValue()
        {
            var sut = new JsonService();
            string expected = "value";
            string testData = "{ \"key\": \"value\" }";

            string result = sut.GetValue<string>(testData, "key");

            Assert.Equal(expected, result);
        }
    }

    internal class TestClass
    {
        public TestClass(int number)
        {
            this.Number = number;
        }

        public int Number { get; set; }
    }
}

[API] Update Json tests to reflect change to IEnumerable


using System;
using System.Linq;
using System.Text.RegularExpressions;

namespace ExcelDna.IntelliSense
{
    static class FormulaParser
    {
        // Set from IntelliSenseDisplay.Initialize
        public static char ListSeparator = ',';

        internal static bool TryGetFormulaInfo(string formulaPrefix, out string functionName, out int currentArgIndex)
        {
            formulaPrefix = Regex.Replace(formulaPrefix, "(\"[^\"]*\")|(\\([^\\(\\)]*\\))| ", string.Empty);

            while (Regex.IsMatch(formulaPrefix, "\\([^\\(\\)]*\\)"))
            {
                formulaPrefix = Regex.Replace(formulaPrefix, "\\([^\\(\\)]*\\)", string.Empty);
            }

            int lastOpeningParenthesis = formulaPrefix.LastIndexOf("(", formulaPrefix.Length - 1, StringComparison.Ordinal);

            if (lastOpeningParenthesis > -1)
            {
                var match = Regex.Match(formulaPrefix.Substring(0, lastOpeningParenthesis), @"[^\w](?<functionName>\w*)$");
                if (match.Success)
                {
                    functionName = match.Groups["functionName"].Value;
                    currentArgIndex = formulaPrefix.Substring(lastOpeningParenthesis, formulaPrefix.Length - lastOpeningParenthesis).Count(c => c == ListSeparator);
                    return true;
                }
            }

            functionName = null;
            currentArgIndex = -1;
            return false;
        }
    }
}

using System;
using System.Linq;
using System.Text.RegularExpressions;

namespace ExcelDna.IntelliSense
{
    static class FormulaParser
    {
        // Set from IntelliSenseDisplay.Initialize
        public static char ListSeparator = ',';

        internal static bool TryGetFormulaInfo(string formulaPrefix, out string functionName, out int currentArgIndex)
        {
            formulaPrefix = Regex.Replace(formulaPrefix, "(\"[^\"]*\")|(\\([^\\(\\)]*\\))| ", string.Empty);

            while (Regex.IsMatch(formulaPrefix, "\\([^\\(\\)]*\\)"))
            {
                formulaPrefix = Regex.Replace(formulaPrefix, "\\([^\\(\\)]*\\)", string.Empty);
            }

            int lastOpeningParenthesis = formulaPrefix.LastIndexOf("(", formulaPrefix.Length - 1, StringComparison.Ordinal);

            if (lastOpeningParenthesis > -1)
            {
                var match = Regex.Match(formulaPrefix.Substring(0, lastOpeningParenthesis), @"[^\w.](?<functionName>[\w.]*)$");
                if (match.Success)
                {
                    functionName = match.Groups["functionName"].Value;
                    currentArgIndex = formulaPrefix.Substring(lastOpeningParenthesis, formulaPrefix.Length - lastOpeningParenthesis).Count(c => c == ListSeparator);
                    return true;
                }
            }

            functionName = null;
            currentArgIndex = -1;
            return false;
        }
    }
}

Extend character set of function names (including ".")


namespace NuGet.Common
{
    public class CommandLineRepositoryFactory : PackageRepositoryFactory
    {
        public static readonly string UserAgent = "NuGet Command Line";

        private readonly IConsole _console;

        public CommandLineRepositoryFactory(IConsole console)
        {
            _console = console;
        }

        public override IPackageRepository CreateRepository(string packageSource)
        {
            var repository = base.CreateRepository(packageSource);
            var httpClientEvents = repository as IHttpClientEvents;

            if (httpClientEvents != null)
            {
                httpClientEvents.SendingRequest += (sender, args) =>
                {
                    if (_console.Verbosity == Verbosity.Detailed)
                    {
                        _console.WriteLine(
                            System.ConsoleColor.Green,
                            "{0} {1}", args.Request.Method, args.Request.RequestUri);
                    }
                    string userAgent = HttpUtility.CreateUserAgentString(CommandLineConstants.UserAgent);
                    HttpUtility.SetUserAgent(args.Request, userAgent);
                };
            }

            return repository;
        }
    }
}

using System.Windows;

namespace NuGet.Common
{
    public class CommandLineRepositoryFactory : PackageRepositoryFactory, IWeakEventListener
    {
        public static readonly string UserAgent = "NuGet Command Line";

        private readonly IConsole _console;

        public CommandLineRepositoryFactory(IConsole console)
        {
            _console = console;
        }

        public override IPackageRepository CreateRepository(string packageSource)
        {
            var repository = base.CreateRepository(packageSource);
            var httpClientEvents = repository as IHttpClientEvents;
            if (httpClientEvents != null)
            {
                SendingRequestEventManager.AddListener(httpClientEvents, this);
            }

            return repository;
        }

        public bool ReceiveWeakEvent(System.Type managerType, object sender, System.EventArgs e)
        {
            if (managerType == typeof(SendingRequestEventManager))
            {
                var args = (WebRequestEventArgs)e;
                if (_console.Verbosity == Verbosity.Detailed)
                {
                    _console.WriteLine(
                        System.ConsoleColor.Green,
                        "{0} {1}", args.Request.Method, args.Request.RequestUri);
                }
                string userAgent = HttpUtility.CreateUserAgentString(CommandLineConstants.UserAgent);
                HttpUtility.SetUserAgent(args.Request, userAgent);
                return true;
            }
            else
            {
                return false;
            }
        }
    }
}

Fix the problem that the web request is displayed twice when -Verbosity is set to detailed.

The cause of the duplicate output is the change to fix issue 3801 (which
was caused by incorrect use of the weak  event handler pattern). With
that fix, the SendingRequest handler will be called twice. The fix is to
use the weak event handler pattern here too.


using System;
using MonoMac.AppKit;

namespace macdoc
{
	public class AppleDocWizardDelegate : NSApplicationDelegate
	{
		AppleDocWizardController wizard;

		public override bool ApplicationShouldOpenUntitledFile (NSApplication sender)
		{
			return false;
		}

		public override void DidFinishLaunching (MonoMac.Foundation.NSNotification notification)
		{
			wizard = new AppleDocWizardController ();
			wizard.Window.Center ();
			NSApplication.SharedApplication.ArrangeInFront (this);
			NSApplication.SharedApplication.RunModalForWindow (wizard.Window);
		}
	}
}

using System;
using MonoMac.AppKit;

namespace macdoc
{
	public class AppleDocWizardDelegate : NSApplicationDelegate
	{
		AppleDocWizardController wizard;

		public override bool ApplicationShouldOpenUntitledFile (NSApplication sender)
		{
			return false;
		}

		public override void DidFinishLaunching (MonoMac.Foundation.NSNotification notification)
		{
			wizard = new AppleDocWizardController ();
			NSApplication.SharedApplication.ActivateIgnoringOtherApps (true);
			wizard.Window.MakeMainWindow ();
			wizard.Window.MakeKeyWindow ();
			wizard.Window.MakeKeyAndOrderFront (this);
			wizard.Window.Center ();
			wizard.VerifyFreshnessAndLaunchDocProcess ();
			NSApplication.SharedApplication.RunModalForWindow (wizard.Window);
		}
	}
}

[AppleDocWizard] Make the application and its window come in front when launched


using Content.Client.GameObjects.Components.Construction;
using Robust.Client.Interfaces.Graphics;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Maths;
using Robust.Shared.Utility;

namespace Content.Client.Construction
{
    public class ConstructionButton : Button
    {
        private readonly IDisplayManager _displayManager;

        public ConstructorComponent Owner
        {
            get => Menu.Owner;
            set => Menu.Owner = value;
        }
        ConstructionMenu Menu;

        public ConstructionButton(IDisplayManager displayManager)
        {
            _displayManager = displayManager;
            PerformLayout();
        }

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

            AnchorLeft = 1.0f;
            AnchorTop = 1.0f;
            AnchorRight = 1.0f;
            AnchorBottom = 1.0f;
            MarginLeft = -110.0f;
            MarginTop = -70.0f;
            MarginRight = -50.0f;
            MarginBottom = -50.0f;
            Text = "Crafting";
            OnPressed += IWasPressed;
        }

        private void PerformLayout()
        {
            Menu = new ConstructionMenu(_displayManager);
            Menu.AddToScreen();
        }

        void IWasPressed(ButtonEventArgs args)
        {
            Menu.Open();
        }

        public void AddToScreen()
        {
            UserInterfaceManager.StateRoot.AddChild(this);
        }

        public void RemoveFromScreen()
        {
            if (Parent != null)
            {
                Parent.RemoveChild(this);
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                Menu.Dispose();
            }

            base.Dispose(disposing);
        }
    }
}

using Content.Client.GameObjects.Components.Construction;
using Robust.Client.Interfaces.Graphics;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Maths;
using Robust.Shared.Utility;

namespace Content.Client.Construction
{
    public class ConstructionButton : Button
    {
        private readonly IDisplayManager _displayManager;

        public ConstructorComponent Owner
        {
            get => Menu.Owner;
            set => Menu.Owner = value;
        }
        ConstructionMenu Menu;

        public ConstructionButton(IDisplayManager displayManager)
        {
            _displayManager = displayManager;
            PerformLayout();
        }

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

            SetAnchorPreset(LayoutPreset.BottomRight);
            MarginLeft = -110.0f;
            MarginTop = -70.0f;
            MarginRight = -50.0f;
            MarginBottom = -50.0f;
            Text = "Crafting";
            OnPressed += IWasPressed;
        }

        private void PerformLayout()
        {
            Menu = new ConstructionMenu(_displayManager);
            Menu.AddToScreen();
        }

        void IWasPressed(ButtonEventArgs args)
        {
            Menu.Open();
        }

        public void AddToScreen()
        {
            UserInterfaceManager.StateRoot.AddChild(this);
        }

        public void RemoveFromScreen()
        {
            if (Parent != null)
            {
                Parent.RemoveChild(this);
            }
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                Menu.Dispose();
            }

            base.Dispose(disposing);
        }
    }
}

Use SetAnchorPreset instead of manually setting each anchor


using System.Linq;
using System.Text.RegularExpressions;
using System.Xml.Serialization;

namespace PhotoStoryToBloomConverter.PS3Model
{
    [XmlRoot("MSPhotoStoryProject", Namespace="MSPhotoStory")]
    public class PhotoStoryProject
    {
        [XmlAttribute("schemaVersion")]
        public string SchemaVersion;
        [XmlAttribute("appVersion")]
        public string AppVersion;
        [XmlAttribute("linkOnly")]
        public bool LinkOnly;
        [XmlAttribute("defaultImageDuration")]
        public int DefaultImageDuration;
        [XmlAttribute("visualUnitCount")]
        public int VisualUnitCount;
        [XmlAttribute("codecVersion")]
        public string CodecVersion;
        [XmlAttribute("sessionSeed")]
        public int SessionSeed;

        [XmlElement("VisualUnit")]
        public VisualUnit[] VisualUnits;

	    public string GetProjectName()
	    {
			var bookName = "";
			foreach (var vunit in VisualUnits.Where(vu => vu.Image?.Edits != null))
			{
				foreach (var edit in vunit.Image.Edits)
				{
					if (edit.TextOverlays.Length <= 0)
						continue;
					bookName = edit.TextOverlays[0].Text.Trim();
					bookName = Regex.Replace(bookName, @"\s+", " ");
					break;
				}
				if (bookName != "")
					break;
			}
		    return bookName;
	    }
    }
}

using System.Linq;
using System.Text.RegularExpressions;
using System.Xml.Serialization;

namespace PhotoStoryToBloomConverter.PS3Model
{
    [XmlRoot("MSPhotoStoryProject", Namespace="MSPhotoStory")]
    public class PhotoStoryProject
    {
        [XmlAttribute("schemaVersion")]
        public string SchemaVersion;
        [XmlAttribute("appVersion")]
        public string AppVersion;
        [XmlAttribute("linkOnly")]
        public bool LinkOnly;
        [XmlAttribute("defaultImageDuration")]
        public int DefaultImageDuration;
        [XmlAttribute("visualUnitCount")]
        public int VisualUnitCount;
        [XmlAttribute("codecVersion")]
        public string CodecVersion;
        [XmlAttribute("sessionSeed")]
        public int SessionSeed;

        [XmlElement("VisualUnit")]
        public VisualUnit[] VisualUnits;

	    public string GetProjectName()
	    {
			var bookName = "";
			foreach (var vunit in VisualUnits.Where(vu => vu.Image?.Edits != null))
			{
				foreach (var edit in vunit.Image.Edits)
				{
					if (edit.TextOverlays == null || edit.TextOverlays.Length <= 0)
						continue;
					bookName = edit.TextOverlays[0].Text.Trim();
					bookName = Regex.Replace(bookName, @"\s+", " ");
					break;
				}
				if (bookName != "")
					break;
			}
		    return bookName;
	    }
    }
}

Handle PS3 covers with no text

Handle PS3 covers with no text


using System.Linq;

using NUnit.Framework;

namespace Rant.Tests.Richard
{
    [TestFixture]
    public class Lists
    {
        private readonly RantEngine rant = new RantEngine();

        [Test]
        public void ListInitBare()
        {
            Assert.AreEqual("5", rant.Do("[@ x = 1, 2, 3, 4, 5; x.length ]").Main);
        }

        [Test]
        public void ListInitBrackets()
        {
            Assert.AreEqual("5", rant.Do("[@ x = [1, 2, 3, 4, 5]; x.length ]").Main);
        }

        [Test]
        public void ListInitConcat()
        {
            Assert.AreEqual("5", rant.Do("[@ x = 1, 2, 3; y = x, 4, 5; y.length ]").Main);
        }

        [Test]
        public void ListAsBlock()
        {
            string[] possibleResults = new string[] { "1", "2", "3", "4" };
            Assert.GreaterOrEqual(possibleResults.ToList().IndexOf(rant.Do("[@ 1, 2, 3, 4 ]").Main), 0);
        }

        [Test]
        public void ListInitializer()
        {
            Assert.AreEqual("12", rant.Do("[@ x = list 12; x.length ]").Main);
        }
    }
}

using System.Linq;

using NUnit.Framework;

namespace Rant.Tests.Richard
{
    [TestFixture]
    public class Lists
    {
        private readonly RantEngine rant = new RantEngine();

        [Test]
        public void ListInitBare()
        {
            Assert.AreEqual("5", rant.Do("[@ x = 1, 2, 3, 4, 5; x.length ]").Main);
        }

        [Test]
        public void ListInitBrackets()
        {
            Assert.AreEqual("5", rant.Do("[@ x = [1, 2, 3, 4, 5]; x.length ]").Main);
        }

        [Test]
        public void ListInitConcat()
        {
            Assert.AreEqual("5", rant.Do("[@ x = 1, 2, 3; y = x, 4, 5; y.length ]").Main);
        }

        [Test]
        public void ListAsBlock()
        {
            string[] possibleResults = new string[] { "1", "2", "3", "4" };
            Assert.GreaterOrEqual(possibleResults.ToList().IndexOf(rant.Do("[@ 1, 2, 3, 4 ]").Main), 0);
        }

        [Test]
        public void ListInitializer()
        {
            Assert.AreEqual("12", rant.Do("[@ x = list 12; x.length ]").Main);
        }

        [Test]
        public void ListEmptyAsBlock()
        {
            Assert.AreEqual("", rant.Do(@"[@ [] ]"));
        }
    }
}

Add test for returning empty list from script


using System;

namespace TDDUnit {
  class TestTestCase : TestCase {
    public TestTestCase(string name) : base(name) {
    }

    public void TestTemplateMethod() {
      WasRunObj test = new WasRunObj("TestMethod");
      test.Run();
      Assert.That(test.Log == "SetUp TestMethod TearDown ");
    }

    public void TestResult() {
      WasRunObj test = new WasRunObj("TestMethod");
      TestResult result = test.Run();
      Assert.That("1 run, 0 failed" == result.Summary);
    }

    public void TestFailedResult() {
      WasRunObj test = new WasRunObj("TestBrokenMethod");
      TestResult result = test.Run();
      Assert.That("1 run, 1 failed" == result.Summary);
    }

    public void TestFailedResultFormatting() {
      TestResult result = new TestResult();
      result.TestStarted();
      result.TestFailed();
      Assert.That("1 run, 1 failed" == result.Summary);
    }
  }

  class Program {
    static void Main() {
      new TestTestCase("TestTemplateMethod").Run();
      new TestTestCase("TestResult").Run();
      new TestTestCase("TestFailedResult").Run();
      new TestTestCase("TestFailedResultFormatting").Run();
    }
  }
}

using System;

namespace TDDUnit {
  class TestTestCase : TestCase {
    public TestTestCase(string name) : base(name) {
    }

    public void TestTemplateMethod() {
      WasRunObj test = new WasRunObj("TestMethod");
      test.Run();
      Assert.That(test.Log == "SetUp TestMethod TearDown ");
    }

    public void TestResult() {
      WasRunObj test = new WasRunObj("TestMethod");
      TestResult result = test.Run();
      Assert.That("1 run, 0 failed" == result.Summary);
    }

    public void TestFailedResult() {
      WasRunObj test = new WasRunObj("TestBrokenMethod");
      TestResult result = test.Run();
      Assert.That("1 run, 1 failed" == result.Summary);
    }

    public void TestFailedResultFormatting() {
      TestResult result = new TestResult();
      result.TestStarted();
      result.TestFailed();
      Assert.That("1 run, 1 failed" == result.Summary);
    }
  }

  class Program {
    static void Main() {
      Console.WriteLine(new TestTestCase("TestTemplateMethod").Run().Summary);
      Console.WriteLine(new TestTestCase("TestResult").Run().Summary);
      Console.WriteLine(new TestTestCase("TestFailedResult").Run().Summary);
      Console.WriteLine(new TestTestCase("TestFailedResultFormatting").Run().Summary);
    }
  }
}

Print results of running tests

Print results of running tests


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

using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Platform;
using osu.Framework.Testing;

namespace osu.Framework.Tests.Platform
{
    [TestFixture]
    public class UserInputManagerTest : TestCase
    {
        [Test]
        public void IsAliveTest()
        {
            AddAssert("UserInputManager is alive", () =>
            {
                using (var client = new TestHeadlessGameHost(@"client", true))
                {
                    return client.CurrentRoot.IsAlive;
                }
            });
        }

        private class TestHeadlessGameHost : HeadlessGameHost
            public Drawable CurrentRoot => Root;

            public TestHeadlessGameHost(string hostname, bool bindIPC)
                : base(hostname, bindIPC)
            {
                using (var game = new TestGame())
                {
                    Root = game.CreateUserInputManager();
                }
            }
        }
    }
}

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

using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Platform;
using osu.Framework.Testing;

namespace osu.Framework.Tests.Platform
{
    [TestFixture]
    public class UserInputManagerTest : TestCase
    {
        [Test]
        public void IsAliveTest()
        {
            AddAssert("UserInputManager is alive", () =>
            {
                using (var client = new TestHeadlessGameHost(@"client", true))
                {
                    return client.CurrentRoot.IsAlive;
                }
            });
        }

        private class TestHeadlessGameHost : HeadlessGameHost
        {
            public Drawable CurrentRoot => Root;

            public TestHeadlessGameHost(string hostname, bool bindIPC)
                : base(hostname, bindIPC)
            {
                using (var game = new TestGame())
                {
                    Root = game.CreateUserInputManager();
                }
            }
        }
    }
}

Add a bracket that somehow did not get comitted


using System.Collections.Generic;
using Stormpath.Configuration.Abstractions;
using Stormpath.Owin.Abstractions.Configuration;

namespace Stormpath.Owin.UnitTest
{
    public static class ConfigurationHelper
    {
        public static IntegrationConfiguration CreateFakeConfiguration(StormpathConfiguration config)
        {
            var compiledConfig = Configuration.ConfigurationLoader.Initialize().Load(config);

            var integrationConfig = new IntegrationConfiguration(
                compiledConfig,
                new TenantConfiguration("foo", false, false),
                new KeyValuePair<string, ProviderConfiguration>[0]);

            return integrationConfig;
        }
    }
}

using System.Collections.Generic;
using Stormpath.Configuration.Abstractions;
using Stormpath.Owin.Abstractions.Configuration;

namespace Stormpath.Owin.UnitTest
{
    public static class ConfigurationHelper
    {
        public static IntegrationConfiguration CreateFakeConfiguration(StormpathConfiguration config)
        {
            if (config.Client?.ApiKey == null)
            {
                if (config.Client == null)
                {
                    config.Client = new ClientConfiguration();
                }

                config.Client.ApiKey = new ClientApiKeyConfiguration()
                {
                    Id = "foo",
                    Secret = "bar"
                };
            };

            var compiledConfig = Configuration.ConfigurationLoader.Initialize().Load(config);

            var integrationConfig = new IntegrationConfiguration(
                compiledConfig,
                new TenantConfiguration("foo", false, false),
                new KeyValuePair<string, ProviderConfiguration>[0]);

            return integrationConfig;
        }
    }
}

Fix missing API key error on AppVeyor

Fix missing API key error on AppVeyor


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

using Oogstplanner.Common;
using Oogstplanner.Models;
using Oogstplanner.Services;

namespace Oogstplanner.Web.Controllers
{
    [AllowAnonymous]
    public class HomeController : Controller
    {
        readonly ICalendarService calendarService;

        public HomeController(ICalendarService calendarService)
        {
            if (calendarService == null)
            {
                throw new ArgumentNullException("calendarService");
            }

            this.calendarService = calendarService;
        }

        //
        // GET: /welkom
        public ActionResult Index()
        {
            return View();
        }
    }
}

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

using Oogstplanner.Common;
using Oogstplanner.Models;
using Oogstplanner.Services;

namespace Oogstplanner.Web.Controllers
{
    [AllowAnonymous]
    public class HomeController : Controller
    {
        readonly ICalendarService calendarService;

        public HomeController()
        { }

        //
        // GET: /welkom
        public ActionResult Index()
        {
            return View();
        }

        //
        // GET: /veelgesteldevragen
        public ActionResult Faq()
        {
            return View();
        }
    }
}

Remove dependency of home controller since it is no longer needed


using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Security.AccessControl;
using System.Security.Principal;

namespace TweetDck.Core.Utils{
    static class WindowsUtils{
        public static bool CheckFolderPermission(string path, FileSystemRights right){
            try{
                AuthorizationRuleCollection rules = Directory.GetAccessControl(path).GetAccessRules(true, true, typeof(SecurityIdentifier));
                WindowsIdentity identity = WindowsIdentity.GetCurrent();

                if (identity.Groups == null){
                    return false;
                }

                bool accessAllow = false, accessDeny = false;

                foreach(FileSystemAccessRule rule in rules.Cast<FileSystemAccessRule>().Where(rule => identity.Groups.Contains(rule.IdentityReference) && (right & rule.FileSystemRights) == right)){
                    switch(rule.AccessControlType){
                        case AccessControlType.Allow: accessAllow = true; break;
                        case AccessControlType.Deny: accessDeny = true; break;
                    }
                }

                return accessAllow && !accessDeny;
            }
            catch{
                return false;
            }
        }

        public static Process StartProcess(string file, string arguments, bool runElevated){
            ProcessStartInfo processInfo = new ProcessStartInfo{
                FileName = file,
                Arguments = arguments
            };

            if (runElevated){
                processInfo.Verb = "runas";
            }

            return Process.Start(processInfo);
        }
    }
}

using System.Diagnostics;
using System.IO;
using System.Security.AccessControl;
using System.Security.Principal;

namespace TweetDck.Core.Utils{
    static class WindowsUtils{
        public static bool CheckFolderPermission(string path, FileSystemRights right){
            try{
                AuthorizationRuleCollection collection = Directory.GetAccessControl(path).GetAccessRules(true, true, typeof(NTAccount));

                foreach(FileSystemAccessRule rule in collection){
                    if ((rule.FileSystemRights & right) == right){
                        return true;
                    }
                }

                return false;
            }
            catch{
                return false;
            }
        }

        public static Process StartProcess(string file, string arguments, bool runElevated){
            ProcessStartInfo processInfo = new ProcessStartInfo{
                FileName = file,
                Arguments = arguments
            };

            if (runElevated){
                processInfo.Verb = "runas";
            }

            return Process.Start(processInfo);
        }
    }
}

Rewrite folder write permission check to hopefully make it more reliable


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

namespace Mlabs.Ogg
{
    public class OggReader
    {
        private readonly Stream m_fileStream;
        private readonly bool m_owns;

        public OggReader(string fileName)
        {
            if (fileName == null) throw new ArgumentNullException("fileName");
            m_fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
            m_owns = true;
        }

        public OggReader(Stream fileStream)
        {
            if (fileStream == null) throw new ArgumentNullException("fileStream");
            m_fileStream = fileStream;
            m_owns = false;
        }

        public IOggInfo Read()
        {
            long originalOffset = m_fileStream.Position;

            var p = new PageReader();
            //read pages and break them down to streams
            var pages = p.ReadPages(m_fileStream).GroupBy(e => e.StreamSerialNumber);

            if (m_owns)
            {
                m_fileStream.Dispose();
            }
            else
            {
                //if we didn't create stream rewind it, so that user won't get any surprise :)
                m_fileStream.Seek(originalOffset, SeekOrigin.Begin);
            }
            return null;
        }
    }
}

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

namespace Mlabs.Ogg
{
    public class OggReader
    {
        private readonly Stream m_fileStream;
        private readonly bool m_owns;

        public OggReader(string fileName)
        {
            if (fileName == null) throw new ArgumentNullException("fileName");
            m_fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
            m_owns = true;
        }

        public OggReader(Stream fileStream)
        {
            if (fileStream == null) throw new ArgumentNullException("fileStream");
            if (!fileStream.CanSeek) throw new ArgumentException("Stream must be seekable", "fileStream");
            if (!fileStream.CanRead) throw new ArgumentException("Stream must be readable", "fileStream");

            m_fileStream = fileStream;
            m_owns = false;
        }

        public IOggInfo Read()
        {
            long originalOffset = m_fileStream.Position;

            var p = new PageReader();
            //read pages and break them down to streams
            var pages = p.ReadPages(m_fileStream).GroupBy(e => e.StreamSerialNumber);

            if (m_owns)
            {
                m_fileStream.Dispose();
            }
            else
            {
                //if we didn't create stream rewind it, so that user won't get any surprise :)
                m_fileStream.Seek(originalOffset, SeekOrigin.Begin);
            }
            return null;
        }
    }
}

Make sure that the stream passed in ctor can be seeked and read


using System;
using LinqToTTreeInterfacesLib;
using LINQToTTreeLib.Utils;

namespace LINQToTTreeLib.Variables
{
    /// <summary>
    /// A simple variable (like int, etc.).
    /// </summary>
    public class VarSimple : IVariable
    {
        public string VariableName { get; private set; }
        public string RawValue { get; private set; }
        public Type Type { get; private set; }

        public VarSimple(System.Type type)
        {
            if (type == null)
                throw new ArgumentNullException("Must have a good type!");

            Type = type;
            VariableName = type.CreateUniqueVariableName();
            RawValue = VariableName;
        }

        public IValue InitialValue { get; set; }

        /// <summary>
        /// Get/Set if this variable needs to be declared.
        /// </summary>
        public bool Declare { get; set; }
    }
}

using System;
using LinqToTTreeInterfacesLib;
using LINQToTTreeLib.Utils;

namespace LINQToTTreeLib.Variables
{
    /// <summary>
    /// A simple variable (like int, etc.).
    /// </summary>
    public class VarSimple : IVariable
    {
        public string VariableName { get; private set; }
        public string RawValue { get; private set; }
        public Type Type { get; private set; }

        public VarSimple(System.Type type)
        {
            if (type == null)
                throw new ArgumentNullException("Must have a good type!");

            Type = type;
            VariableName = type.CreateUniqueVariableName();
            RawValue = VariableName;
        }

        public IValue InitialValue { get; set; }

        /// <summary>
        /// Get/Set if this variable needs to be declared.
        /// </summary>
        public bool Declare { get; set; }

        /// <summary>
        /// TO help with debugging...
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return "(" + Type.Name + ") " + RawValue;
        }
    }
}

Add ToString to help with debuggign... :-)


using System;
using System.IO;
using System.Reflection;

namespace Serilog.Generator.Configuration
{
    static class CurrentDirectoryAssemblyLoader
    {
        public static void Install()
        {
            AppDomain.CurrentDomain.AssemblyResolve += (s, e) =>
            {
                var assemblyPath = Path.Combine(Environment.CurrentDirectory, e.Name + ".dll");
                return !File.Exists(assemblyPath) ? null : Assembly.LoadFrom(assemblyPath);
            };
        }
    }
}

using System;
using System.IO;
using System.Reflection;

namespace Serilog.Generator.Configuration
{
    static class CurrentDirectoryAssemblyLoader
    {
        public static void Install()
        {
            AppDomain.CurrentDomain.AssemblyResolve += (s, e) =>
            {
                var assemblyPath = Path.Combine(Environment.CurrentDirectory, new AssemblyName(e.Name).Name + ".dll");
                return !File.Exists(assemblyPath) ? null : Assembly.LoadFrom(assemblyPath);
            };
        }
    }
}

Fix assembly loading name format

Fix assembly loading name format


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

#nullable enable

namespace osu.Framework.Localisation
{
    /// <summary>
    /// A set of parameters that control the way strings are localised.
    /// </summary>
    public class LocalisationParameters
    {
        /// <summary>
        /// The <see cref="ILocalisationStore"/> to be used for string lookups and culture-specific formatting.
        /// </summary>
        public readonly ILocalisationStore? Store;

        /// <summary>
        /// Whether to prefer the "original" script of <see cref="RomanisableString"/>s.
        /// </summary>
        public readonly bool PreferOriginalScript;

        /// <summary>
        /// Creates a new instance of <see cref="LocalisationParameters"/>.
        /// </summary>
        /// <param name="store">The <see cref="ILocalisationStore"/> to be used for string lookups and culture-specific formatting.</param>
        /// <param name="preferOriginalScript">Whether to prefer the "original" script of <see cref="RomanisableString"/>s.</param>
        public LocalisationParameters(ILocalisationStore? store, bool preferOriginalScript)
        {
            Store = store;
            PreferOriginalScript = preferOriginalScript;
        }
    }
}

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

#nullable enable

namespace osu.Framework.Localisation
{
    /// <summary>
    /// A set of parameters that control the way strings are localised.
    /// </summary>
    public class LocalisationParameters
    {
        /// <summary>
        /// The <see cref="ILocalisationStore"/> to be used for string lookups and culture-specific formatting.
        /// </summary>
        public readonly ILocalisationStore? Store;

        /// <summary>
        /// Whether to prefer the "original" script of <see cref="RomanisableString"/>s.
        /// </summary>
        public readonly bool PreferOriginalScript;

        /// <summary>
        /// Creates a new instance of <see cref="LocalisationParameters"/> based off another <see cref="LocalisationParameters"/>.
        /// </summary>
        /// <param name="parameters">The <see cref="LocalisationParameters"/> to copy values from.</param>
        protected LocalisationParameters(LocalisationParameters parameters)
            : this(parameters.Store, parameters.PreferOriginalScript)
        {
        }

        /// <summary>
        /// Creates a new instance of <see cref="LocalisationParameters"/>.
        /// </summary>
        /// <param name="store">The <see cref="ILocalisationStore"/> to be used for string lookups and culture-specific formatting.</param>
        /// <param name="preferOriginalScript">Whether to prefer the "original" script of <see cref="RomanisableString"/>s.</param>
        public LocalisationParameters(ILocalisationStore? store, bool preferOriginalScript)
        {
            Store = store;
            PreferOriginalScript = preferOriginalScript;
        }
    }
}

Add protected copy constructor to avoid breaking changes


@model IEnumerable<BankingManagementClient.ProjectionStore.Projections.Client.ClientProjection>

@{
    ViewBag.Title = "Index";
}

Index

    @Html.ActionLink("Create New", "Create")

            @Html.DisplayNameFor(model => model.ElementAt(0)
                                               .ClientId)

            @Html.DisplayNameFor(model => model.ElementAt(0)
                                               .ClientName)

    @foreach (var clientProjection in Model)
    {

                @Html.ActionLink(clientProjection.ClientId.ToString(), "Details", new { id = clientProjection.ClientId })

                @Html.DisplayFor(modelItem => clientProjection.ClientName)

    }

@model IEnumerable<BankingManagementClient.ProjectionStore.Projections.Client.ClientProjection>

@{
    ViewBag.Title = "Index";
}

Clients

@if (Model.Any())
{

                @Html.DisplayNameFor(model => model.ElementAt(0)
                    .ClientId)

                @Html.DisplayNameFor(model => model.ElementAt(0)
                    .ClientName)

        @foreach (var clientProjection in Model)
        {

                    @Html.ActionLink(clientProjection.ClientId.ToString(), "Details", new {id = clientProjection.ClientId})

                    @Html.DisplayFor(modelItem => clientProjection.ClientName)

        }

}
else
{

No clients found.

}

Check if there are any Clients on the list page


using System.IO;
using ApiContractGenerator.AssemblyReferenceResolvers;
using ApiContractGenerator.MetadataReferenceResolvers;
using ApiContractGenerator.Source;
using Microsoft.Build.Framework;

namespace ApiContractGenerator.MSBuild
{
    public sealed class GenerateApiContract : ITask
    {
        public IBuildEngine BuildEngine { get; set; }

        public ITaskHost HostObject { get; set; }

        [Required]
        public ITaskItem[] Assemblies { get; set; }

        public string[] IgnoredNamespaces { get; set; }

        public bool Execute()
        {
            if (Assemblies.Length == 0) return true;

            var generator = new ApiContractGenerator();
            generator.IgnoredNamespaces.UnionWith(IgnoredNamespaces);

            foreach (var assembly in Assemblies)
            {
                var assemblyPath = assembly.GetMetadata("ResolvedAssemblyPath");
                var outputPath = assembly.GetMetadata("ResolvedOutputPath");

                var assemblyResolver = new CompositeAssemblyReferenceResolver(
                    new GacAssemblyReferenceResolver(),
                    new SameDirectoryAssemblyReferenceResolver(Path.GetDirectoryName(assemblyPath)));

                using (var metadataReferenceResolver = new MetadataReaderReferenceResolver(() => File.OpenRead(assemblyPath), assemblyResolver))
                using (var source = new MetadataReaderSource(File.OpenRead(assemblyPath), metadataReferenceResolver))
                using (var outputFile = File.CreateText(outputPath))
                    generator.Generate(source, new CSharpTextFormatter(outputFile, metadataReferenceResolver));
            }

            return true;
        }
    }
}

using System.IO;
using ApiContractGenerator.AssemblyReferenceResolvers;
using ApiContractGenerator.MetadataReferenceResolvers;
using ApiContractGenerator.Source;
using Microsoft.Build.Framework;

namespace ApiContractGenerator.MSBuild
{
    public sealed class GenerateApiContract : ITask
    {
        public IBuildEngine BuildEngine { get; set; }

        public ITaskHost HostObject { get; set; }

        [Required]
        public ITaskItem[] Assemblies { get; set; }

        public string[] IgnoredNamespaces { get; set; }

        public bool Execute()
        {
            if (Assemblies == null || Assemblies.Length == 0) return true;

            var generator = new ApiContractGenerator();
            if (IgnoredNamespaces != null) generator.IgnoredNamespaces.UnionWith(IgnoredNamespaces);

            foreach (var assembly in Assemblies)
            {
                var assemblyPath = assembly.GetMetadata("ResolvedAssemblyPath");
                var outputPath = assembly.GetMetadata("ResolvedOutputPath");

                var assemblyResolver = new CompositeAssemblyReferenceResolver(
                    new GacAssemblyReferenceResolver(),
                    new SameDirectoryAssemblyReferenceResolver(Path.GetDirectoryName(assemblyPath)));

                using (var metadataReferenceResolver = new MetadataReaderReferenceResolver(() => File.OpenRead(assemblyPath), assemblyResolver))
                using (var source = new MetadataReaderSource(File.OpenRead(assemblyPath), metadataReferenceResolver))
                using (var outputFile = File.CreateText(outputPath))
                    generator.Generate(source, new CSharpTextFormatter(outputFile, metadataReferenceResolver));
            }

            return true;
        }
    }
}

Handle null arrays when MSBuild doesn't initialize task properties


using System;
using System.Collections.Generic;
using System.ComponentModel;
using DesktopWidgets.WidgetBase.Settings;

namespace DesktopWidgets.Widgets.CountdownClock
{
    public class Settings : WidgetClockSettingsBase
    {
        public Settings()
        {
            DateTimeFormat = new List<string> {"{dd}d {hh}h {mm}m"};
        }

        [Category("End")]
        [DisplayName("Date/Time")]
        public DateTime EndDateTime { get; set; } = DateTime.Now;

        [Browsable(false)]
        [DisplayName("Last End Date/Time")]
        public DateTime LastEndDateTime { get; set; } = DateTime.Now;

        [Category("Style")]
        [DisplayName("Continue Counting")]
        public bool EndContinueCounting { get; set; } = false;

        [Category("End Sync")]
        [DisplayName("Sync Next Year")]
        public bool SyncYear { get; set; } = false;

        [Category("End Sync")]
        [DisplayName("Sync Next Month")]
        public bool SyncMonth { get; set; } = false;

        [Category("End Sync")]
        [DisplayName("Sync Next Day")]
        public bool SyncDay { get; set; } = false;

        [Category("End Sync")]
        [DisplayName("Sync Next Hour")]
        public bool SyncHour { get; set; } = false;

        [Category("End Sync")]
        [DisplayName("Sync Next Minute")]
        public bool SyncMinute { get; set; } = false;

        [Category("End Sync")]
        [DisplayName("Sync Next Second")]
        public bool SyncSecond { get; set; } = false;
    }
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using DesktopWidgets.WidgetBase.Settings;
using Xceed.Wpf.Toolkit.PropertyGrid.Attributes;

namespace DesktopWidgets.Widgets.CountdownClock
{
    public class Settings : WidgetClockSettingsBase
    {
        public Settings()
        {
            DateTimeFormat = new List<string> {"{dd}d {hh}h {mm}m"};
        }

        [Category("End")]
        [DisplayName("Date/Time")]
        public DateTime EndDateTime { get; set; } = DateTime.Now;

        [Browsable(false)]
        [DisplayName("Last End Date/Time")]
        public DateTime LastEndDateTime { get; set; } = DateTime.Now;

        [Category("Style")]
        [DisplayName("Continue Counting")]
        public bool EndContinueCounting { get; set; } = false;

        [PropertyOrder(0)]
        [Category("End Sync")]
        [DisplayName("Sync Next Year")]
        public bool SyncYear { get; set; } = false;

        [PropertyOrder(1)]
        [Category("End Sync")]
        [DisplayName("Sync Next Month")]
        public bool SyncMonth { get; set; } = false;

        [PropertyOrder(2)]
        [Category("End Sync")]
        [DisplayName("Sync Next Day")]
        public bool SyncDay { get; set; } = false;

        [PropertyOrder(3)]
        [Category("End Sync")]
        [DisplayName("Sync Next Hour")]
        public bool SyncHour { get; set; } = false;

        [PropertyOrder(4)]
        [Category("End Sync")]
        [DisplayName("Sync Next Minute")]
        public bool SyncMinute { get; set; } = false;

        [PropertyOrder(5)]
        [Category("End Sync")]
        [DisplayName("Sync Next Second")]
        public bool SyncSecond { get; set; } = false;
    }
}

Change "Countdown" "End Sync" properties order


using Abp.Authorization.Users;
using Abp.MultiTenancy;
using Abp.NHibernate.EntityMappings;

namespace Abp.Zero.NHibernate.EntityMappings
{
    /// <summary>
    /// Base class to map classes derived from <see cref="AbpTenant{TTenant,TUser}"/>
    /// </summary>
    /// <typeparam name="TTenant">Tenant type</typeparam>
    /// <typeparam name="TUser">User type</typeparam>
    public abstract class AbpTenantMap<TTenant, TUser> : EntityMap<TTenant>
        where TTenant : AbpTenant<TUser>
        where TUser : AbpUser<TUser>
    {
        /// <summary>
        /// Constructor.
        /// </summary>
        protected AbpTenantMap()
            : base("AbpTenants")
        {
            References(x => x.Edition).Column("EditionId").Nullable();

            Map(x => x.TenancyName);
            Map(x => x.Name);
            Map(x => x.IsActive);

            this.MapFullAudited();

            Polymorphism.Explicit();
        }
    }
}

using Abp.Authorization.Users;
using Abp.MultiTenancy;
using Abp.NHibernate.EntityMappings;

namespace Abp.Zero.NHibernate.EntityMappings
{
    /// <summary>
    /// Base class to map classes derived from <see cref="AbpTenant{TUser}"/>
    /// </summary>
    /// <typeparam name="TTenant">Tenant type</typeparam>
    /// <typeparam name="TUser">User type</typeparam>
    public abstract class AbpTenantMap<TTenant, TUser> : EntityMap<TTenant>
        where TTenant : AbpTenant<TUser>
        where TUser : AbpUser<TUser>
    {
        /// <summary>
        /// Constructor.
        /// </summary>
        protected AbpTenantMap()
            : base("AbpTenants")
        {
            References(x => x.Edition).Column("EditionId").Nullable();

            Map(x => x.TenancyName);
            Map(x => x.Name);
            Map(x => x.IsActive);

            this.MapFullAudited();

            Polymorphism.Explicit();
        }
    }
}

Fix cref attribute in XML comment

Fix cref attribute in XML comment


using System.Linq;
using System.Reactive.Linq;
using System.Threading.Tasks;
using Octokit.Reactive;
using Xunit;

namespace Octokit.Tests.Integration
{
    public class ObservableRepositoriesClientTests
    {
        public class TheGetMethod
        {
            [IntegrationTest]
            public async Task ReturnsSpecifiedRepository()
            {
                var github = Helper.GetAuthenticatedClient();

                var client = new ObservableRepositoriesClient(github);
                var observable = client.Get("haacked", "seegit");
                var repository = await observable;
                var repository2 = await observable;

                Assert.Equal("https://github.com/Haacked/SeeGit.git", repository.CloneUrl);
                Assert.False(repository.Private);
                Assert.False(repository.Fork);
                Assert.Equal("https://github.com/Haacked/SeeGit.git", repository2.CloneUrl);
                Assert.False(repository2.Private);
                Assert.False(repository2.Fork);
            }
        }

        public class TheGetAllPublicSinceMethod
        {
            [IntegrationTest]
            public async Task ReturnsAllPublicReposSinceLastSeen()
            {
                var github = Helper.GetAuthenticatedClient();

                var client = new ObservableRepositoriesClient(github);
                var request = new PublicRepositoryRequest
                {
                    Since = 32732250
                };
                var repositories = await client.GetAllPublic(request).ToArray();
                Assert.NotNull(repositories);
                Assert.True(repositories.Any());
                Assert.Equal(32732252, repositories[0].Id);
                Assert.False(repositories[0].Private);
                Assert.Equal("zad19", repositories[0].Name);
            }
        }
    }
}

using System.Linq;
using System.Reactive.Linq;
using System.Threading.Tasks;
using Octokit.Reactive;
using Xunit;

namespace Octokit.Tests.Integration
{
    public class ObservableRepositoriesClientTests
    {
        public class TheGetMethod
        {
            [IntegrationTest]
            public async Task ReturnsSpecifiedRepository()
            {
                var github = Helper.GetAuthenticatedClient();

                var client = new ObservableRepositoriesClient(github);
                var observable = client.Get("haacked", "seegit");
                var repository = await observable;
                var repository2 = await observable;

                Assert.Equal("https://github.com/Haacked/SeeGit.git", repository.CloneUrl);
                Assert.False(repository.Private);
                Assert.False(repository.Fork);
                Assert.Equal("https://github.com/Haacked/SeeGit.git", repository2.CloneUrl);
                Assert.False(repository2.Private);
                Assert.False(repository2.Fork);
            }
        }

        public class TheGetAllPublicSinceMethod
        {
            [IntegrationTest(Skip = "This will take a very long time to return, so will skip it for now.")]
            public async Task ReturnsAllPublicReposSinceLastSeen()
            {
                var github = Helper.GetAuthenticatedClient();

                var client = new ObservableRepositoriesClient(github);
                var request = new PublicRepositoryRequest
                {
                    Since = 32732250
                };
                var repositories = await client.GetAllPublic(request).ToArray();
                Assert.NotEmpty(repositories);
                Assert.Equal(32732252, repositories[0].Id);
                Assert.False(repositories[0].Private);
                Assert.Equal("zad19", repositories[0].Name);
            }
        }
    }
}

Update Assert call and mute the test

Update Assert call and mute the test


using System.Xml.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Tyrrrz.Extensions.Tests
{
    [TestClass]
    public class XmlTests
    {
        [TestMethod]
        public void StripNamespacesTest()
        {
            var ns = XNamespace.Get("http://schemas.domain.com/orders");
            var xml =
                new XElement(ns + "order",
                    new XElement(ns + "customer", "Foo", new XAttribute(ns + "hello", "world")),
                    new XElement("purchases",
                        new XElement(ns + "purchase", "Unicycle", new XAttribute("price", "100.00")),
                        new XElement("purchase", "Bicycle"),
                        new XElement(ns + "purchase", "Tricycle",
                            new XAttribute("price", "300.00"),
                            new XAttribute(XNamespace.Xml.GetName("space"), "preserve")
                        )
                    )
                );

            var stripped = xml.StripNamespaces();
            var xCustomer = stripped.Element("customer");
            var xHello = xCustomer?.Attribute("hello");

            Assert.IsNotNull(xCustomer);
            Assert.IsNotNull(xHello);
            Assert.AreEqual("world", xHello.Value);
        }
    }
}

using System.Xml.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Tyrrrz.Extensions.Tests
{
    [TestClass]
    public class XmlTests
    {
        [TestMethod]
        public void StripNamespacesTest()
        {
            var ns = XNamespace.Get("http://schemas.domain.com/orders");
            var xml =
                new XElement(ns + "order",
                    new XElement(ns + "customer", "Foo", new XAttribute(ns + "hello", "world")),
                    new XElement("purchases",
                        new XElement(ns + "purchase", "Unicycle", new XAttribute("price", "100.00")),
                        new XElement("purchase", "Bicycle"),
                        new XElement(ns + "purchase", "Tricycle",
                            new XAttribute("price", "300.00"),
                            new XAttribute(XNamespace.Xml.GetName("space"), "preserve")
                        )
                    )
                );

            var stripped = xml.StripNamespaces();
            var xCustomer = stripped.Element("customer");
            var xHello = xCustomer?.Attribute("hello");

            Assert.AreNotSame(xml, stripped);
            Assert.IsNotNull(xCustomer);
            Assert.IsNotNull(xHello);
            Assert.AreEqual("world", xHello.Value);
        }
    }
}

Add mutability test to StripNamespaces

Add mutability test to StripNamespaces


//-----------------------------------------------------------------------
// <copyright file="Program.cs" company="Brian Rogers">
// Copyright (c) Brian Rogers. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------

namespace LockSample
{
    using System;
    using System.Collections.Generic;
    using System.Globalization;
    using System.Threading;
    using System.Threading.Tasks;

    internal sealed class Program
    {
        private static void Main(string[] args)
        {
            Random random = new Random();
            ExclusiveLock l = new ExclusiveLock();
            List<int> list = new List<int>();

            using (CancellationTokenSource cts = new CancellationTokenSource())
            {
                Task task = LoopAsync(random, l, list, cts.Token);

                Thread.Sleep(1000);

                cts.Cancel();
                task.Wait();
            }
        }

        private static async Task LoopAsync(Random random, ExclusiveLock l, IList<int> list, CancellationToken token)
        {
            while (!token.IsCancellationRequested)
            {
                switch (random.Next(1))
                {
                    case 0:
                        await EnumerateListAsync(l, list);
                        break;
                }
            }
        }

        private static async Task EnumerateListAsync(ExclusiveLock l, IList<int> list)
        {
            ExclusiveLock.Token token = await l.AcquireAsync();
            await Task.Yield();
            try
            {
                int lastItem = 0;
                foreach (int item in list)
                {
                    if (lastItem != (item - 1))
                    {
                        throw new InvalidOperationException(string.Format(
                            CultureInfo.InvariantCulture,
                            "State corruption detected; expected {0} but saw {1} in next list entry.",
                            lastItem + 1,
                            item));
                    }

                    await Task.Yield();
                }
            }
            finally
            {
                l.Release(token);
            }
        }
    }
}

Add basic integration test skeleton

Add basic integration test skeleton