using Lidgren.Network;
using LmpCommon.Message.Types;

namespace LmpCommon.Message.Data.Vessel
{
    public class VesselProtoMsgData : VesselBaseMsgData
    {
        internal VesselProtoMsgData() { }

        public int NumBytes;
        public byte[] Data = new byte[0];

        public override VesselMessageType VesselMessageType => VesselMessageType.Proto;

        public override string ClassName { get; } = nameof(VesselProtoMsgData);

        internal override void InternalSerialize(NetOutgoingMessage lidgrenMsg)
        {
            base.InternalSerialize(lidgrenMsg);

            lidgrenMsg.Write(NumBytes);
            lidgrenMsg.Write(Data, 0, NumBytes);
        }

        internal override void InternalDeserialize(NetIncomingMessage lidgrenMsg)
        {
            base.InternalDeserialize(lidgrenMsg);

            NumBytes = lidgrenMsg.ReadInt32();
            if (Data.Length < NumBytes)
                Data = new byte[NumBytes];

            lidgrenMsg.ReadBytes(Data, 0, NumBytes);
        }

        internal override int InternalGetMessageSize()
        {
            return base.InternalGetMessageSize() + sizeof(int) + sizeof(byte) * NumBytes;
        }
    }
}

using Lidgren.Network;
using LmpCommon.Message.Types;

namespace LmpCommon.Message.Data.Vessel
{
    public class VesselProtoMsgData : VesselBaseMsgData
    {
        internal VesselProtoMsgData() { }
        public override bool CompressCondition => true;

        public int NumBytes;
        public byte[] Data = new byte[0];

        public override VesselMessageType VesselMessageType => VesselMessageType.Proto;

        public override string ClassName { get; } = nameof(VesselProtoMsgData);

        internal override void InternalSerialize(NetOutgoingMessage lidgrenMsg)
        {
            base.InternalSerialize(lidgrenMsg);

            if (CompressCondition)
            {
                var compressedData = CachedQuickLz.CachedQlz.Compress(Data, NumBytes, out NumBytes);
                CachedQuickLz.ArrayPool<byte>.Recycle(Data);
                Data = compressedData;
            }
            lidgrenMsg.Write(NumBytes);
            lidgrenMsg.Write(Data, 0, NumBytes);
            if (CompressCondition)
            {
                CachedQuickLz.ArrayPool<byte>.Recycle(Data);
            }
        }

        internal override void InternalDeserialize(NetIncomingMessage lidgrenMsg)
        {
            base.InternalDeserialize(lidgrenMsg);

            NumBytes = lidgrenMsg.ReadInt32();
            if (Data.Length < NumBytes)
                Data = new byte[NumBytes];

            lidgrenMsg.ReadBytes(Data, 0, NumBytes);

            if (Compressed)
            {
                var decompressedData = CachedQuickLz.CachedQlz.Decompress(Data, out NumBytes);
                CachedQuickLz.ArrayPool<byte>.Recycle(Data);
                Data = decompressedData;
            }
        }

        internal override int InternalGetMessageSize()
        {
            return base.InternalGetMessageSize() + sizeof(int) + sizeof(byte) * NumBytes;
        }
    }
}

Compress only the vessel proto. TEST

Compress only the vessel proto. TEST


using System;

namespace Xamarin.Forms.Xaml
{
	[ContentProperty("TypeName")]
	public class TypeExtension : IMarkupExtension<Type>
	{
		public string TypeName { get; set; }

		public Type ProvideValue(IServiceProvider serviceProvider)
		{
			if (serviceProvider == null)
				throw new ArgumentNullException("serviceProvider");
			var typeResolver = serviceProvider.GetService(typeof (IXamlTypeResolver)) as IXamlTypeResolver;
			if (typeResolver == null)
				throw new ArgumentException("No IXamlTypeResolver in IServiceProvider");

            //HACK: this fixes an extreme case in our app where we had our version of ItemsView in a ListView header, just taking this out for now and seeing what this will break
            if (string.IsNullOrEmpty(TypeName))
                return null;

			return typeResolver.Resolve(TypeName, serviceProvider);
		}

		object IMarkupExtension.ProvideValue(IServiceProvider serviceProvider)
		{
			return (this as IMarkupExtension<Type>).ProvideValue(serviceProvider);
		}
	}
}

using System;

namespace Xamarin.Forms.Xaml
{
	[ContentProperty("TypeName")]
	public class TypeExtension : IMarkupExtension<Type>
	{
		public string TypeName { get; set; }

		public Type ProvideValue(IServiceProvider serviceProvider)
		{
			if (serviceProvider == null)
				throw new ArgumentNullException("serviceProvider");
			var typeResolver = serviceProvider.GetService(typeof (IXamlTypeResolver)) as IXamlTypeResolver;
			if (typeResolver == null)
				throw new ArgumentException("No IXamlTypeResolver in IServiceProvider");

			return typeResolver.Resolve(TypeName, serviceProvider);
		}

		object IMarkupExtension.ProvideValue(IServiceProvider serviceProvider)
		{
			return (this as IMarkupExtension<Type>).ProvideValue(serviceProvider);
		}
	}
}

Revert "Fix for an odd crash we were experiencing"

This reverts commit d3720f480898332853e95815f28cc72962e60186.


using System;
using NUnit.Framework;
using Toggl.Phoebe.Data.NewModels;

namespace Toggl.Phoebe.Tests.Data.Models
{
    [TestFixture]
    public class ProjectModelTest : ModelTest<ProjectModel>
    {
    }
}

using System;
using NUnit.Framework;
using Toggl.Phoebe.Data.DataObjects;
using Toggl.Phoebe.Data.NewModels;

namespace Toggl.Phoebe.Tests.Data.Models
{
    [TestFixture]
    public class ProjectModelTest : ModelTest<ProjectModel>
    {
        [Test]
        public void TestColorEnforcing ()
        {
            var project = new ProjectModel (new ProjectData () {
                Id = Guid.NewGuid (),
                Color = 12345,
            });

            // Make sure that we return the underlying color
            Assert.AreEqual (12345, project.Color);
            Assert.That (() => project.GetHexColor (), Throws.Nothing);

            // And that we enforce to the colors we know of
            project.Color = 54321;
            Assert.AreNotEqual (54321, project.Color);
            Assert.AreEqual (54321 % ProjectModel.HexColors.Length, project.Color);
            Assert.That (() => project.GetHexColor (), Throws.Nothing);
        }
    }
}

Test project model color enforcing.

Test project model color enforcing.


// --------------------------------------------------------------------------------------------------------------------
// <copyright file="BenchmarkBase.cs" company="Catel development team">
//   Copyright (c) 2008 - 2017 Catel development team. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace Catel.Benchmarks
{
    using BenchmarkDotNet.Attributes.Jobs;
    using BenchmarkDotNet.Engines;

    // Uncomment to make all benchmarks slower (but probably more accurate)
    [SimpleJob(RunStrategy.Throughput, launchCount: 1, warmupCount: 2, targetCount: 10, invocationCount: 10)]
    public abstract class BenchmarkBase
    {
    }
}

// --------------------------------------------------------------------------------------------------------------------
// <copyright file="BenchmarkBase.cs" company="Catel development team">
//   Copyright (c) 2008 - 2017 Catel development team. All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace Catel.Benchmarks
{
    using BenchmarkDotNet.Attributes.Jobs;
    using BenchmarkDotNet.Engines;

    // Uncomment to make all benchmarks slower (but probably more accurate)
    [SimpleJob(RunStrategy.Throughput, launchCount: 1, warmupCount: 3, targetCount: 10, invocationCount: 500)]
    public abstract class BenchmarkBase
    {
    }
}

Decrease number of operations to run to decrease benchmark duration from few hours to about 30 minutes


using AvalonStudio.Extensibility;
using ReactiveUI;
using Splat;
using System;
using System.Linq;
using System.Reactive;
using System.Reactive.Linq;
using System.Threading;
using WalletWasabi.Gui.Helpers;
using WalletWasabi.Logging;
using WalletWasabi.Wallets;

namespace WalletWasabi.Gui.Controls.WalletExplorer
{
	public class ClosedWalletViewModel : WalletViewModelBase
	{
		public ClosedWalletViewModel(Wallet wallet) : base(wallet)
		{
			OpenWalletCommand = ReactiveCommand.CreateFromTask(async () =>
			{
				IsBusy = true;

				try
				{
					var global = Locator.Current.GetService<Global>();

					if (!await global.WaitForInitializationCompletedAsync(CancellationToken.None))
					{
						return;
					}

					await global.WalletManager.StartWalletAsync(Wallet);
				}
				catch (Exception e)
				{
					NotificationHelpers.Error($"Error loading Wallet: {Title}");
					Logger.LogError(e.Message);
				}
			}, this.WhenAnyValue(x => x.IsBusy).Select(x => !x));
		}

		public ReactiveCommand<Unit, Unit> OpenWalletCommand { get; }
	}
}

using AvalonStudio.Extensibility;
using ReactiveUI;
using Splat;
using System;
using System.Linq;
using System.Reactive;
using System.Reactive.Linq;
using System.Threading;
using WalletWasabi.Gui.Helpers;
using WalletWasabi.Logging;
using WalletWasabi.Wallets;

namespace WalletWasabi.Gui.Controls.WalletExplorer
{
	public class ClosedWalletViewModel : WalletViewModelBase
	{
		public ClosedWalletViewModel(Wallet wallet) : base(wallet)
		{
			OpenWalletCommand = ReactiveCommand.CreateFromTask(async () =>
			{
				IsBusy = true;

				try
				{
					var global = Locator.Current.GetService<Global>();

					if (!await global.WaitForInitializationCompletedAsync(CancellationToken.None))
					{
						return;
					}

					await global.WalletManager.StartWalletAsync(Wallet);
				}
				catch (Exception e)
				{
					NotificationHelpers.Error($"Error loading Wallet: {Title}");
					Logger.LogError(e.Message);
				}
				finally
				{
					IsBusy = false;
				}
			}, this.WhenAnyValue(x => x.IsBusy).Select(x => !x));
		}

		public ReactiveCommand<Unit, Unit> OpenWalletCommand { get; }
	}
}

Clear IsBusy on Wallet load error

Clear IsBusy on Wallet load error


using System;
using System.IO;
using Wasm.Binary;

namespace Wasm.Dump
{
    public static class Program
    {
        public static int Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.Error.WriteLine("usage: wasm-dump file.wasm");
                return 1;
            }

            var file = WasmFile.ReadBinary(args[0]);
            file.Dump(Console.Out);
            Console.WriteLine();
            return 0;
        }
    }
}

using System;
using System.IO;
using Wasm.Binary;

namespace Wasm.Dump
{
    public static class Program
    {
        private static MemoryStream ReadStdinToEnd()
        {
            // Based on Marc Gravell's answer to this StackOverflow question:
            // https://stackoverflow.com/questions/1562417/read-binary-data-from-console-in
            var memStream = new MemoryStream();
            using (var stdin = Console.OpenStandardInput())
            {
                byte[] buffer = new byte[2048];
                int bytes;
                while ((bytes = stdin.Read(buffer, 0, buffer.Length)) > 0)
                {
                    memStream.Write(buffer, 0, bytes);
                }
            }
            memStream.Seek(0, SeekOrigin.Begin);
            return memStream;
        }

        public static int Main(string[] args)
        {
            if (args.Length > 1)
            {
                Console.Error.WriteLine("usage: wasm-dump [file.wasm]");
                return 1;
            }

            var memStream = new MemoryStream();

            WasmFile file;
            if (args.Length == 0)
            {
                using (var input = ReadStdinToEnd())
                {
                    file = WasmFile.ReadBinary(input);
                }
            }
            else
            {
                file = WasmFile.ReadBinary(args[0]);
            }
            file.Dump(Console.Out);
            Console.WriteLine();
            return 0;
        }
    }
}

Support piping a WebAssembly file to wasm-dump


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

namespace DemoParser_Console
{
	class Program
	{
		static void Main(string[] args)
		{
			Console.WriteLine(DateTime.Now);
			Stream inputStream = new FileStream(args[0], FileMode.Open);
			DemoParser parser = new DemoParser(inputStream);
			parser.ParseDemo(true);
			Console.WriteLine(DateTime.Now);
			Console.ReadKey();
		}
	}
}

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

namespace DemoParser_Console
{
	class Program
	{
		static void Main(string[] args)
		{
			DateTime begin;
			DateTime end;

			Stream inputStream = new FileStream(args[0], FileMode.Open);

			Console.WriteLine("Parsing...");

			begin = DateTime.Now;

			DemoParser parser = new DemoParser(inputStream);
			parser.ParseDemo(true);

			end = DateTime.Now;

			Console.WriteLine(String.Format("Started: {0}", begin.ToString("HH:mm:ss.ffffff")));
			Console.WriteLine(String.Format("Finished: {0}", end.ToString("HH:mm:ss.ffffff")));
			Console.WriteLine(String.Format("\nTotal: {0}", (end - begin)));

			Console.ReadKey();
		}
	}
}

Update console to show parsing duration

Update console to show parsing duration


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using NUnit.Framework;

using Oogstplanner.Services;
using Oogstplanner.Controllers;
using Oogstplanner.Models;
using Oogstplanner.Repositories;

namespace Oogstplanner.Tests
{
    [TestFixture]
    public class CropControllerTest
    {
        private CropController controller;

        [TestFixtureSetUp]
        public void Setup()
        {
            // Initialize a fake database with one crop.
            var db = new FakeOogstplannerContext
            {
                Crops =
                {
                    new Crop
                    {
                        Id = 1,
                        Name = "Broccoli",
                        SowingMonths = Month.May ^ Month.June ^ Month.October ^ Month.November
                    }
                }
            };
            this.controller = new CropController(new CropProvider(new CropRepository(db)));
        }

        [Test]
        public void Controllers_Crop_Index_AllCrops()
        {
            // Arrange
            var expectedResult = "Broccoli";

            // Act
            var viewResult = controller.Index();
            var actualResult = ((IEnumerable<Crop>)viewResult.ViewData.Model).Single().Name;

            // Assert
            Assert.AreEqual(expectedResult, actualResult,
                "Since there is only a broccoli in the database the index method should return it.");
        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using NUnit.Framework;

using Oogstplanner.Services;
using Oogstplanner.Controllers;
using Oogstplanner.Models;
using Oogstplanner.Repositories;

namespace Oogstplanner.Tests
{
    [TestFixture]
    public class CropControllerTest
    {
        private CropController controller;

        [TestFixtureSetUp]
        public void Setup()
        {
            // Initialize a fake database with one crop.
            var db = new FakeOogstplannerContext
            {
                Crops =
                {
                    new Crop
                    {
                        Id = 1,
                        Name = "Broccoli",
                        SowingMonths = Month.May ^ Month.June ^ Month.October ^ Month.November
                    }
                }
            };
            this.controller = new CropController(new CropProvider(new CropRepository(db)));
        }

        [Test]
        public void Controllers_Crop_Index_AllCrops()
        {
            // Arrange
            const string expectedResult = "Broccoli";

            // Act
            var viewResult = controller.Index();
            var actualResult = ((IEnumerable<Crop>)viewResult.ViewData.Model).Single().Name;

            // Assert
            Assert.AreEqual(expectedResult, actualResult,
                "Since there is only a broccoli in the database the index method should return it.");
        }

        [Test]
        public void Controllers_Crop_All()
        {
            // Arrange
            const string expectedResult = "Broccoli";

            // Act
            var viewResult = controller.All();
            var actualResult = ((ContentResult)viewResult).Content;

            // Assert
            Assert.IsTrue(actualResult.Contains(expectedResult),
                "Since there is a broccoli in the database the JSON string returned by the all " +
                "method should contain it.");
        }

    }
}

Add unit test for all action method on CropController


@{
    ViewBag.Title = "Registreer je vandaag bij de Oogstplanner";
}

Registreer je vandaag bij de Oogstplanner

						Inloggen

					@{ Html.RenderPartial("_RegisterForm"); }

@{
    ViewBag.Title = "Registreer je vandaag bij de Oogstplanner";
}

Registreer je vandaag bij de Oogstplanner

						@Html.ActionLink("Inloggen", "Login")

					@{ Html.RenderPartial("_RegisterForm"); }

Fix login link on register page

Fix login link on register page


using System.Text;

namespace SoxSharp
{
  /// <summary>
  /// Format options to be applied to the output file. For any property not set here, SoX will infer the value from the input file.
  /// </summary>
  public class OutputFormatOptions : FormatOptions
  {
    /// <summary>
    /// Compression factor for output format.
    /// </summary>
    public double? Compression { get; set; }

    /// <summary>
    /// Set comment for output file.
    /// </summary>
    public string Comment { get; set; }

    /// <summary>
    /// Add comment to output file.
    /// </summary>
    public string AddComment { get; set; }

    /// <summary>
    /// Initializes a new instance of the <see cref="T:SoxSharp.OutputFormatOptions"/> class.
    /// </summary>
    public OutputFormatOptions()
    : base()
    {
    }

    /// <summary>
    /// Translate a <see cref="OutputFormatOptions"/> instance to a set of command arguments to be passed to SoX (adds additional command arguments to <see cref="FormatOptions.ToString()"/>).
    /// </summary>
    /// <returns>String containing SoX command arguments.</returns>
    public override string ToString()
    {
      StringBuilder outputOptions = new StringBuilder(base.ToString());

      if (Compression.HasValue)
        outputOptions.Append(" --compression " + Compression.Value);

      if (AddComment != null)
        outputOptions.Append(" --add-comment " + AddComment);

      if (Comment != null)
        outputOptions.Append(" --comment " + Comment);

      return outputOptions.ToString();
    }
  }
}

using System.Text;

namespace SoxSharp
{
  /// <summary>
  /// Format options to be applied to the output file. For any property not set here, SoX will infer the value from the input file.
  /// </summary>
  public class OutputFormatOptions : FormatOptions
  {
    /// <summary>
    /// Compression factor for output format.
    /// </summary>
    public double? Compression { get; set; }

    /// <summary>
    /// Set comment for output file.
    /// </summary>
    public string Comment { get; set; }

    /// <summary>
    /// Add comment to output file.
    /// </summary>
    public string AddComment { get; set; }

    /// <summary>
    /// Initializes a new instance of the <see cref="T:SoxSharp.OutputFormatOptions"/> class.
    /// </summary>
    public OutputFormatOptions()
    : base()
    {
    }

    /// <summary>
    /// Translate a <see cref="OutputFormatOptions"/> instance to a set of command arguments to be passed to SoX (adds additional command arguments to <see cref="FormatOptions.ToString()"/>).
    /// </summary>
    /// <returns>String containing SoX command arguments.</returns>
    public override string ToString()
    {
      StringBuilder outputOptions = new StringBuilder(base.ToString());

      if (Compression.HasValue)
        outputOptions.Append(" --compression " + Compression.Value);

      if (AddComment != null)
        outputOptions.Append(" --add-comment \"" + AddComment + "\"");

      if (Comment != null)
        outputOptions.Append(" --comment \"" + Comment + "\"");

      return outputOptions.ToString();
    }
  }
}

Put comment text between quotes

FIXED: Put comment text between quotes


using sdmap.Runtime;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Xunit;

namespace sdmap.test.IntegratedTest
{
    public class NamespaceTest
    {
        [Fact]
        public void CanReferenceOtherInOneNamespace()
        {
            var code = "namespace ns{sql v1{1#include<v2>} sql v2{2}}";
            var rt = new SdmapRuntime();
            rt.AddSourceCode(code);
            var result = rt.Emit("ns.v1", new { A = true });
            Assert.Equal("12", result);
        }

        [Fact]
        public void CanCombineTwoNs()
        {
            var code = "namespace ns1{sql sql{1#include<ns2.sql>}} namespace ns2{sql sql{2}}";
            var rt = new SdmapRuntime();
            rt.AddSourceCode(code);
            var result = rt.Emit("ns1.sql", null);
            Assert.Equal("12", result);
        }
    }
}

using sdmap.Runtime;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Xunit;

namespace sdmap.test.IntegratedTest
{
    public class NamespaceTest
    {
        [Fact]
        public void CanReferenceOtherInOneNamespace()
        {
            var code = "namespace ns{sql v1{1#include<v2>} sql v2{2}}";
            var rt = new SdmapRuntime();
            rt.AddSourceCode(code);
            var result = rt.Emit("ns.v1", new { A = true });
            Assert.Equal("12", result);
        }

        [Fact]
        public void CanCombineTwoNs()
        {
            var code =
                "namespace ns1{sql sql{1#include<ns2.sql>}} \r\n" +
                "namespace ns2{sql sql{2}}";
            var rt = new SdmapRuntime();
            rt.AddSourceCode(code);
            var result = rt.Emit("ns1.sql", null);
            Assert.Equal("12", result);
        }
    }
}

Split the CanCombineTwoNs test code into two line.


namespace JAGBE.GB.Computation
{
    internal sealed class Apu
    {
        private byte NR50;
        private byte NR51;
        private byte NR52;

        internal void Clear()
        {
            this.NR50 = 0;
            this.NR51 = 0;
        }

        internal byte GetRegister(byte num)
        {
            switch (num)
            {
                case 0x24:
                    return this.NR50;

                case 0x25:
                    return this.NR51;

                case 0x26:
                    return (byte)(this.NR52 | 0x70);

                default:
                    return 0xFF;
            }
        }

        internal bool SetRegister(byte num, byte value)
        {
            switch (num)
            {
                case 0x24:
                    this.NR50 = value;
                    return true;

                case 0x25:
                    this.NR51 = value;
                    return true;

                case 0x26:
                    this.NR52 = (byte)((value & 0x80) | (this.NR52 & 0x7F));
                    if (!this.NR52.GetBit(7))
                    {
                        Clear();
                    }
                    return true;

                default:
                    return false;
            }
        }
    }
}

using System;

namespace JAGBE.GB.Computation
{
    internal sealed class Apu
    {
        private byte NR50;
        private byte NR51;
        private byte NR52;

        internal void Clear()
        {
            this.NR50 = 0;
            this.NR51 = 0;
        }

        internal byte GetRegister(byte num)
        {
            switch (num)
            {
                case 0x24:
                    return this.NR50;

                case 0x25:
                    return this.NR51;

                case 0x26:
                    return (byte)(this.NR52 | 0x70);

                default:
                    Console.WriteLine("Possible bad Read from ALU 0x" + num.ToString("X2") + " (reg number)");
                    return 0xFF;
            }
        }

        internal bool SetRegister(byte num, byte value)
        {
            switch (num)
            {
                case 0x24:
                    this.NR50 = value;
                    return true;

                case 0x25:
                    this.NR51 = value;
                    return true;

                case 0x26:
                    this.NR52 = (byte)((value & 0x80) | (this.NR52 & 0x7F));
                    if (!this.NR52.GetBit(7))
                    {
                        Clear();
                    }
                    return true;

                default:
                    return false;
            }
        }
    }
}

Write to console on failed apu write

Write to console on failed apu write


using System;
using System.Collections.Generic;
using System.Text;
using MonoTorrent.Client;
using MonoTorrent.Common;

namespace MonoTorrent.Tracker
{
    public class RequestMonitor
    {
        #region Member Variables

        private SpeedMonitor announces;
        private SpeedMonitor scrapes;

        #endregion Member Variables

        #region Properties

        public int AnnounceRate
        {
            get { return announces.Rate; }
        }

        public int ScrapeRate
        {
            get { return scrapes.Rate; }
        }

        public int TotalAnnounces
        {
            get { return (int)announces.Total; }
        }

        public int TotalScrapes
        {
            get { return (int)scrapes.Total; }
        }

        #endregion Properties

        #region Constructors

        public RequestMonitor()
        {
            announces = new SpeedMonitor();
            scrapes = new SpeedMonitor();
        }

        #endregion Constructors

        #region Methods

        internal void AnnounceReceived()
        {
            lock (announces)
                announces.AddDelta(1);
        }

        internal void ScrapeReceived()
        {
            lock (announces)
                scrapes.AddDelta(1);
        }

        #endregion Methods

        internal void Tick()
        {
            lock (announces)
                this.announces.Tick();
            lock (scrapes)
                this.scrapes.Tick();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Text;
using MonoTorrent.Client;
using MonoTorrent.Common;

namespace MonoTorrent.Tracker
{
    public class RequestMonitor
    {
        #region Member Variables

        private SpeedMonitor announces;
        private SpeedMonitor scrapes;

        #endregion Member Variables

        #region Properties

        public int AnnounceRate
        {
            get { return announces.Rate; }
        }

        public int ScrapeRate
        {
            get { return scrapes.Rate; }
        }

        public int TotalAnnounces
        {
            get { return (int)announces.Total; }
        }

        public int TotalScrapes
        {
            get { return (int)scrapes.Total; }
        }

        #endregion Properties

        #region Constructors

        public RequestMonitor()
        {
            announces = new SpeedMonitor();
            scrapes = new SpeedMonitor();
        }

        #endregion Constructors

        #region Methods

        internal void AnnounceReceived()
        {
            lock (announces)
                announces.AddDelta(1);
        }

        internal void ScrapeReceived()
        {
            lock (scrapes)
                scrapes.AddDelta(1);
        }

        #endregion Methods

        internal void Tick()
        {
            lock (announces)
                this.announces.Tick();
            lock (scrapes)
                this.scrapes.Tick();
        }
    }
}

Fix lock of scrapes list

Fix lock of scrapes list

svn path=/trunk/bitsharp/; revision=115381


using NUnit.Framework;
using TeamCityBuildChanges.Output;
using TeamCityBuildChanges.Testing;

namespace TeamCityBuildChanges.Tests
{
    [TestFixture]
    public class HtmlOutputTests
    {
        [Test]
        public void CanRenderSimpleTemplate()
        {
            var result = new RazorOutputRenderer(@".\templates\text.cshtml").Render(TestHelpers.CreateSimpleChangeManifest());
            Assert.True(result.ToString().StartsWith("Version"));//Giddyup.
        }

    }
}

using System.Globalization;
using NUnit.Framework;
using TeamCityBuildChanges.Output;
using TeamCityBuildChanges.Testing;

namespace TeamCityBuildChanges.Tests
{
    [TestFixture]
    public class HtmlOutputTests
    {
        [Test]
        public void CanRenderSimpleTemplate()
        {
            var result = new RazorOutputRenderer(@".\templates\text.cshtml").Render(TestHelpers.CreateSimpleChangeManifest());
            Assert.True(result.ToString(CultureInfo.InvariantCulture).StartsWith("  Version"));//Giddyup.
        }

    }
}

Fix broken (admittedly crappy) test.

Fix broken (admittedly crappy) test.


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

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Shimmer.WiXUiClient")]
[assembly: AssemblyDescription("Shimmer library for creating custom Setup UIs")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("GitHub")]
[assembly: AssemblyProduct("Shimmer")]
[assembly: AssemblyCopyright("Copyright © 2012 GitHub")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components.  If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("df7541af-f05d-47ff-ad41-8582c41c9406")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

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

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Shimmer.WiXUiClient")]
[assembly: AssemblyDescription("Shimmer library for creating custom Setup UIs")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("GitHub")]
[assembly: AssemblyProduct("Shimmer")]
[assembly: AssemblyCopyright("Copyright © 2012 GitHub")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components.  If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("df7541af-f05d-47ff-ad41-8582c41c9406")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.5.0.0")]
[assembly: AssemblyFileVersion("0.5.0.0")]

Set proper version for WixUiClient

Set proper version for WixUiClient


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

namespace LiteNetLibManager.Utils
{
    public class Reflection
    {
        private static readonly Dictionary<string, ObjectActivator> objectActivators = new Dictionary<string, ObjectActivator>();
        private static string tempTypeName;

        // Improve reflection constructor performance with Linq expression (https://rogerjohansson.blog/2008/02/28/linq-expressions-creating-objects/)
        public delegate object ObjectActivator();
        public static ObjectActivator GetActivator(Type type)
        {
            tempTypeName = type.FullName;
            if (!objectActivators.ContainsKey(tempTypeName))
            {
                if (type.IsClass)
                    objectActivators.Add(tempTypeName, Expression.Lambda<ObjectActivator>(Expression.New(type)).Compile());
                else
                    objectActivators.Add(tempTypeName, Expression.Lambda<ObjectActivator>(Expression.Convert(Expression.New(type), typeof(object))).Compile());
            }
            return objectActivators[tempTypeName];
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Reflection.Emit;

namespace LiteNetLibManager.Utils
{
    public class Reflection
    {
        private static readonly Dictionary<string, Func<object>> expressionActivators = new Dictionary<string, Func<object>>();
        private static readonly Dictionary<string, DynamicMethod> dynamicMethodActivators = new Dictionary<string, DynamicMethod>();

        // Improve reflection constructor performance with Linq expression (https://rogerjohansson.blog/2008/02/28/linq-expressions-creating-objects/)
        public static object GetExpressionActivator(Type type)
        {
            if (!expressionActivators.ContainsKey(type.FullName))
            {
                if (type.IsClass)
                    expressionActivators.Add(type.FullName, Expression.Lambda<Func<object>>(Expression.New(type)).Compile());
                else
                    expressionActivators.Add(type.FullName, Expression.Lambda<Func<object>>(Expression.Convert(Expression.New(type), typeof(object))).Compile());
            }
            return expressionActivators[type.FullName].Invoke();
        }

        public static object GetDynamicMethodActivator(Type type)
        {
            if (!dynamicMethodActivators.ContainsKey(type.FullName))
            {
                DynamicMethod method = new DynamicMethod("", typeof(object), Type.EmptyTypes);
                ILGenerator il = method.GetILGenerator();

                if (type.IsValueType)
                {
                    var local = il.DeclareLocal(type);
                    il.Emit(OpCodes.Ldloc, local);
                    il.Emit(OpCodes.Box, type);
                    il.Emit(OpCodes.Ret);
                }
                else
                {
                    var ctor = type.GetConstructor(Type.EmptyTypes);
                    il.Emit(OpCodes.Newobj, ctor);
                    il.Emit(OpCodes.Ret);
                }
                dynamicMethodActivators.Add(type.FullName, method);
            }
            return dynamicMethodActivators[type.FullName].Invoke(null, null);
        }
    }
}

Add dynamic method constuctor codes (didn't use it yet, other developer may learn something from the function)


using System.Net.Sockets;
using System.Threading.Tasks;
using Version = Msg.Core.Versioning.Version;
using System.Linq;

namespace Msg.Infrastructure.Server
{
	class ClientRequestProcessor
	{
		readonly AmqpSettings settings;

		public ClientRequestProcessor (AmqpSettings settings)
		{
			this.settings = settings;
		}

		public async Task ProcessClient (TcpClient client)
		{
			var stream = client.GetStream ();
			try {
				var version = await stream.ReadVersionAsync ();
				if (IsVersionSupported (version)) {
					await stream.WriteVersionAsync (version);
				} else {
					await stream.WriteVersionAsync (this.settings.PreferredVersion);
				}
			} catch {
				await stream.WriteVersionAsync (this.settings.PreferredVersion);
			} finally {
				if (client.Connected) {
					client.Close ();
				}
			}
		}

		bool IsVersionSupported (Version version)
		{
			return this.settings.SupportedVersions.Any (range => range.Contains (version));
		}
	}
}

using System.Net.Sockets;
using System.Threading.Tasks;
using Version = Msg.Core.Versioning.Version;
using System.Linq;

namespace Msg.Infrastructure.Server
{
	class ClientRequestProcessor
	{
		readonly AmqpSettings settings;

		public ClientRequestProcessor (AmqpSettings settings)
		{
			this.settings = settings;
		}

		public async Task ProcessClient (TcpClient client)
		{
			var stream = client.GetStream ();
			try {
				var version = await stream.ReadVersionAsync ();
				if (IsVersionSupported (version)) {
					await stream.WriteVersionAsync (version);
				} else {
					await stream.WriteVersionAsync (this.settings.PreferredVersion);
				}
            } finally {
				if (client.Connected) {
					client.Close ();
				}
			}
		}

		bool IsVersionSupported (Version version)
		{
			return this.settings.SupportedVersions.Any (range => range.Contains (version));
		}
	}
}

Remove illegal await in catch block.

Remove illegal await in catch block.

This is not picked up on Mono.


using System.Collections.Generic;
using Mindscape.Raygun4Net.Messages;

namespace Mindscape.Raygun4Net.Storage
{
  public interface IRaygunOfflineStorage
  {
    /// <summary>
    /// Persist the <paramref name="message"/>> to local storage.
    /// </summary>
    /// <param name="message">The error report to store locally.</param>
    /// <param name="apiKey">The key for which these file are associated with.</param>
    /// <returns></returns>
    bool Store(RaygunMessage message, string apiKey);

    /// <summary>
    /// Retrieve all files from local storage.
    /// </summary>
    /// <param name="apiKey">The key for which these file are associated with.</param>
    /// <returns>A container of files that are currently stored locally.</returns>
    IList<IRaygunFile> FetchAll(string apiKey);

    /// <summary>
    /// Delete a file from local storage that has the following <paramref name="name"/>.
    /// </summary>
    /// <param name="name">The filename of the local file.</param>
    /// <param name="apiKey">The key for which these file are associated with.</param>
    /// <returns></returns>
    bool Remove(string name, string apiKey);
  }
}

using System.Collections.Generic;
using Mindscape.Raygun4Net.Messages;

namespace Mindscape.Raygun4Net.Storage
{
  public interface IRaygunOfflineStorage
  {
    /// <summary>
    /// Persist the <paramref name="message"/>> to local storage.
    /// </summary>
    /// <param name="message">The serialized error report to store locally.</param>
    /// <param name="apiKey">The key for which these file are associated with.</param>
    /// <returns></returns>
    bool Store(string message, string apiKey);

    /// <summary>
    /// Retrieve all files from local storage.
    /// </summary>
    /// <param name="apiKey">The key for which these file are associated with.</param>
    /// <returns>A container of files that are currently stored locally.</returns>
    IList<IRaygunFile> FetchAll(string apiKey);

    /// <summary>
    /// Delete a file from local storage that has the following <paramref name="name"/>.
    /// </summary>
    /// <param name="name">The filename of the local file.</param>
    /// <param name="apiKey">The key for which these file are associated with.</param>
    /// <returns></returns>
    bool Remove(string name, string apiKey);
  }
}

Store the already serialised RaygunMessage object.

Store the already serialised RaygunMessage object.


namespace LinqToTTreeInterfacesLib
{
    /// <summary>
    /// Interface for implementing an object that will contain a complete single query
    /// </summary>
    public interface IGeneratedCode
    {
        /// <summary>
        /// Add a new statement to the current spot where the "writing" currsor is pointed.
        /// </summary>
        /// <param name="s"></param>
        void Add(IStatement s);

        /// <summary>
        /// Book a variable at the inner most scope
        /// </summary>
        /// <param name="v"></param>
        void Add(IVariable v);

        /// <summary>
        /// This variable's inital value is "complex" and must be transfered over the wire in some way other than staight into the code
        /// (for example, a ROOT object that needs to be written to a TFile).
        /// </summary>
        /// <param name="v"></param>
        void QueueForTransfer(string key, object value);

        /// <summary>
        /// Returns the outter most coding block
        /// </summary>
        IBookingStatementBlock CodeBody { get; }
    }
}

namespace LinqToTTreeInterfacesLib
{
    /// <summary>
    /// Interface for implementing an object that will contain a complete single query
    /// </summary>
    public interface IGeneratedCode
    {
        /// <summary>
        /// Add a new statement to the current spot where the "writing" currsor is pointed.
        /// </summary>
        /// <param name="s"></param>
        void Add(IStatement s);

        /// <summary>
        /// Book a variable at the inner most scope
        /// </summary>
        /// <param name="v"></param>
        void Add(IVariable v);

        /// <summary>
        /// This variable's inital value is "complex" and must be transfered over the wire in some way other than staight into the code
        /// (for example, a ROOT object that needs to be written to a TFile).
        /// </summary>
        /// <param name="v"></param>
        void QueueForTransfer(string key, object value);

        /// <summary>
        /// Returns the outter most coding block
        /// </summary>
        IBookingStatementBlock CodeBody { get; }

        /// <summary>
        /// Adds an include file to be included for this query's C++ file.
        /// </summary>
        /// <param name="filename"></param>
        void AddIncludeFile(string filename);
    }
}

Make the include file adder well known in the interface. We may have to add IncludeFiles too in a bit.


using UnityEngine;
using UnityEditor;
using System.IO;
using System.Collections;

namespace Fungus
{

	public class FlowchartMenuItems
	{
		[MenuItem("Tools/Fungus/Create/Flowchart", false, 0)]
		static void CreateFlowchart()
		{
			GameObject go = SpawnPrefab("Flowchart");
			go.transform.position = Vector3.zero;
		}

		public static GameObject SpawnPrefab(string prefabName)
		{
			GameObject prefab = Resources.Load<GameObject>(prefabName);
			if (prefab == null)
			{
				return null;
			}

			GameObject go = PrefabUtility.InstantiatePrefab(prefab) as GameObject;
			PrefabUtility.DisconnectPrefabInstance(go);

			Camera sceneCam = SceneView.currentDrawingSceneView.camera;

			Vector3 pos = sceneCam.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 10f));
			pos.z = 0f;
			go.transform.position = pos;

			Selection.activeGameObject = go;

			Undo.RegisterCreatedObjectUndo(go, "Create Object");

			return go;
		}
	}

}

using UnityEngine;
using UnityEditor;
using System.IO;
using System.Collections;

namespace Fungus
{

	public class FlowchartMenuItems
	{
		[MenuItem("Tools/Fungus/Create/Flowchart", false, 0)]
		static void CreateFlowchart()
		{
			GameObject go = SpawnPrefab("Flowchart");
			go.transform.position = Vector3.zero;
		}

		public static GameObject SpawnPrefab(string prefabName)
		{
			GameObject prefab = Resources.Load<GameObject>(prefabName);
			if (prefab == null)
			{
				return null;
			}

			GameObject go = PrefabUtility.InstantiatePrefab(prefab) as GameObject;
			PrefabUtility.DisconnectPrefabInstance(go);

			SceneView view = SceneView.currentDrawingSceneView;
			if (view != null)
			{
				Camera sceneCam = view.camera;
				Vector3 pos = sceneCam.ViewportToWorldPoint(new Vector3(0.5f, 0.5f, 10f));
				pos.z = 0f;
				go.transform.position = pos;
			}

			Selection.activeGameObject = go;

			Undo.RegisterCreatedObjectUndo(go, "Create Object");

			return go;
		}
	}

}

Fix null reference exception when spawning Fungus objects in Unity 5.1


using System;

class Solution {
    static void Main() {
        int b;
        double c, s = 0.0;
        string line;

        while ((line = Console.ReadLine()) != null) {
            string[] numbers = line.Split(' ');
            b = Convert.ToInt16(numbers[1]);
            c = Convert.ToDouble(numbers[2]);
            s += c * b;
        }

        Console.WriteLine("VALOR A PAGAR: R$ {0:F2}", s);
    }
}

using System;

class Solution {
    static void Main() {
        int b;
        double c, s = 0.0;
        string line;
        string[] numbers;

        while ((line = Console.ReadLine()) != null) {
            numbers = line.Split(' ');
            b = Convert.ToInt16(numbers[1]);
            c = Convert.ToDouble(numbers[2]);
            s += c * b;
        }

        Console.WriteLine("VALOR A PAGAR: R$ {0:F2}", s);
    }
}

Move variable declaration to the top of method


using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Markup;

[assembly: AssemblyTitle("GitHub.UI.Recative")]
[assembly: AssemblyDescription("GitHub flavored WPF styles and controls that require Rx and RxUI")]
[assembly: Guid("885a491c-1d13-49e7-baa6-d61f424befcb")]

[assembly: ThemeInfo(
    ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
                                     //(used if a resource is not found in the page,
                                     // or application resource dictionaries)
    ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
                                              //(used if a resource is not found in the page,
                                              // app, or any theme specific resource dictionaries)
    )]

[assembly: XmlnsDefinition("https://github.com/github/VisualStudio", "GitHub.UI")]

using System.Reflection;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Markup;

[assembly: AssemblyTitle("GitHub.UI.Reactive")]
[assembly: AssemblyDescription("GitHub flavored WPF styles and controls that require Rx and RxUI")]
[assembly: Guid("885a491c-1d13-49e7-baa6-d61f424befcb")]

[assembly: ThemeInfo(
    ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
                                     //(used if a resource is not found in the page,
                                     // or application resource dictionaries)
    ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
                                              //(used if a resource is not found in the page,
                                              // app, or any theme specific resource dictionaries)
    )]

[assembly: XmlnsDefinition("https://github.com/github/VisualStudio", "GitHub.UI")]

Fix a typo in the GitHub.UI.Reactive assembly title


using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Neblina.Api.Core;
using Neblina.Api.Models.TransferViewModels;
using Neblina.Api.Core.Models;

namespace Neblina.Api.Controllers
{
    [Route("transfers")]
    public class TransferController : Controller
    {
        private IUnitOfWork _repos;
        private int _accountId;

        public TransferController(IUnitOfWork repos)
        {
            _repos = repos;
            _accountId = 1;
        }

        // POST transfers/send
        [HttpPost("send")]
        public IActionResult Send(TransactionType type, [FromBody]SendTransferViewModel transfer)
        {
            var transaction = new Transaction()
            {
                Date = DateTime.Now,
                Description = "Transfer sent",
                AccountId = _accountId,
                DestinationBankId = transfer.DestinationBankId,
                DestinationAccountId = transfer.DestinationAccountId,
                Amount = transfer.Amount * -1,
                Type = type,
                Status = TransactionStatus.Pending
            };

            _repos.Transactions.Add(transaction);
            _repos.SaveAndApply();

            var receipt = new SendTransferReceiptViewModel()
            {
                TransactionId = transaction.TransactionId,
                DestinationBankId = transfer.DestinationBankId,
                DestinationAccountId = transfer.DestinationAccountId,
                Amount = transaction.Amount
            };

            return Ok(receipt);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Neblina.Api.Core;
using Neblina.Api.Models.TransferViewModels;
using Neblina.Api.Core.Models;

namespace Neblina.Api.Controllers
{
    [Route("transfers")]
    public class TransferController : Controller
    {
        private IUnitOfWork _repos;
        private int _accountId;

        public TransferController(IUnitOfWork repos)
        {
            _repos = repos;
            _accountId = 1;
        }

        // POST transfers/send
        [HttpPost("send")]
        public IActionResult Send(string bank, bool scheduled, [FromBody]SendTransferViewModel transfer)
        {
            TransactionType type;

            switch (bank)
            {
                case "same":
                    type = scheduled ? TransactionType.SameBankScheduled : TransactionType.SameBankRealTime;
                    break;
                case "another":
                    type = scheduled ? TransactionType.AnotherBankScheduled : TransactionType.AnotherBankRealTime;
                    break;
                default:
                    return NotFound();
            }

            var transaction = new Transaction()
            {
                Date = DateTime.Now,
                Description = "Transfer sent",
                AccountId = _accountId,
                DestinationBankId = transfer.DestinationBankId,
                DestinationAccountId = transfer.DestinationAccountId,
                Amount = transfer.Amount * -1,
                Type = type,
                Status = TransactionStatus.Pending
            };

            _repos.Transactions.Add(transaction);
            _repos.SaveAndApply();

            var receipt = new SendTransferReceiptViewModel()
            {
                TransactionId = transaction.TransactionId,
                DestinationBankId = transfer.DestinationBankId,
                DestinationAccountId = transfer.DestinationAccountId,
                Amount = transaction.Amount
            };

            return Ok(receipt);
        }
    }
}

Use friendly url while sending transfer

Use friendly url while sending transfer


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Grabacr07.KanColleWrapper;
using Grabacr07.KanColleWrapper.Models;
using Livet;
using Livet.EventListeners;

namespace Grabacr07.KanColleViewer.ViewModels
{
	public class AdmiralViewModel : ViewModel
	{
		#region Model 変更通知プロパティ

		public Admiral Model
		{
			get { return KanColleClient.Current.Homeport.Admiral; }
		}

		#endregion

		public AdmiralViewModel()
		{
			this.CompositeDisposable.Add(new PropertyChangedEventListener(KanColleClient.Current.Homeport)
			{
				{"Admiral", (sender, args) => this.Update() },
			});
		}

		private void Update()
		{
			this.RaisePropertyChanged("Admiral");
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Grabacr07.KanColleWrapper;
using Grabacr07.KanColleWrapper.Models;
using Livet;
using Livet.EventListeners;

namespace Grabacr07.KanColleViewer.ViewModels
{
	public class AdmiralViewModel : ViewModel
	{
		#region Model 変更通知プロパティ

		public Admiral Model
		{
			get { return KanColleClient.Current.Homeport.Admiral; }
		}

		#endregion

		public AdmiralViewModel()
		{
			this.CompositeDisposable.Add(new PropertyChangedEventListener(KanColleClient.Current.Homeport)
			{
				{ "Admiral", (sender, args) => this.Update() },
			});
		}

		private void Update()
		{
			this.RaisePropertyChanged("Model");
		}
	}
}

Fix a bug that admiral information is not updated.

fixed #6


namespace TraktApiSharp.Objects.Basic
{
    using System.Collections.Generic;

    ///
    /// Represents results of requests supporting pagination.<para />
    /// Contains the current page, the item limitation per page, the total page count, the total item count
    /// and can also contain the total user count (e.g. in trending shows and movies requests).
    ///
    /// <typeparam name="ListItem">The underlying item type of the list results.</typeparam>
    public class TraktPaginationListResult<ListItem>
    {
        /// Gets or sets the actual list results.
        public IEnumerable<ListItem> Items { get; set; }

        /// Gets or sets the current page number.
        public int? Page { get; set; }

        /// Gets or sets the item limitation per page.
        public int? Limit { get; set; }

        /// Gets or sets the total page count.
        public int? PageCount { get; set; }

        /// Gets or sets the total item results count.
        public int? ItemCount { get; set; }

        ///
        /// Gets or sets the total user count.
        /// <para>
        /// May be only supported for trending shows and movies requests.
        /// </para>
        ///
        public int? UserCount { get; set; }
    }
}

namespace TraktApiSharp.Objects.Basic
{
    using System.Collections;
    using System.Collections.Generic;

    ///
    /// Represents results of requests supporting pagination.<para />
    /// Contains the current page, the item limitation per page, the total page count, the total item count
    /// and can also contain the total user count (e.g. in trending shows and movies requests).
    ///
    /// <typeparam name="ListItem">The underlying item type of the list results.</typeparam>
    public class TraktPaginationListResult<ListItem> : IEnumerable<ListItem>
    {
        /// Gets or sets the actual list results.
        public IEnumerable<ListItem> Items { get; set; }

        /// Gets or sets the current page number.
        public int? Page { get; set; }

        /// Gets or sets the item limitation per page.
        public int? Limit { get; set; }

        /// Gets or sets the total page count.
        public int? PageCount { get; set; }

        /// Gets or sets the total item results count.
        public int? ItemCount { get; set; }

        ///
        /// Gets or sets the total user count.
        /// <para>
        /// May be only supported for trending shows and movies requests.
        /// </para>
        ///
        public int? UserCount { get; set; }

        public IEnumerator<ListItem> GetEnumerator()
        {
            return Items.GetEnumerator();
        }

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

Make pagination list result enumerable.

Make pagination list result enumerable.


@model PhotoLife.ViewModels.News.NewsDetailsViewModel

@{
    ViewBag.Title = "NewsDetails";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

NewsDetails

NewsDetailsViewModel

            @Html.DisplayNameFor(model => model.Title)

            @Html.DisplayFor(model => model.Title)

            @Html.DisplayNameFor(model => model.Text)

            @Html.DisplayFor(model => model.Text)

            @Html.DisplayNameFor(model => model.ImageUrl)

            @Html.DisplayFor(model => model.ImageUrl)

            @Html.DisplayNameFor(model => model.DatePublished)

            @Html.DisplayFor(model => model.DatePublished)

            @Html.DisplayNameFor(model => model.Views)

            @Html.DisplayFor(model => model.Views)

    @Html.ActionLink("Edit", "Edit", new { id = Model.Id }) |
    @Html.ActionLink("Back to List", "Index")

@model PhotoLife.ViewModels.News.NewsDetailsViewModel

@{
    ViewBag.Title = "NewsDetails";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

NewsDetails

NewsDetailsViewModel

            @Html.DisplayNameFor(model => model.Title)

            @Html.DisplayFor(model => model.Title)

            @Html.DisplayNameFor(model => model.ImageUrl)

            @Html.DisplayFor(model => model.ImageUrl)

            @Html.DisplayNameFor(model => model.DatePublished)

            @Html.DisplayFor(model => model.DatePublished)

            @Html.DisplayNameFor(model => model.Views)

            @Html.DisplayFor(model => model.Views)

@Html.Raw(HttpUtility.HtmlDecode(Model.Text))

    @Html.ActionLink("Edit", "Edit", new { id = Model.Id }) |
    @Html.ActionLink("Back to List", "Index")

Add view for news details route

Add view for news details route


using System;
using System.Diagnostics;
using System.Threading;

namespace RedGate.AppHost.Server
{
    internal class StartProcessWithTimeout : IProcessStartOperation
    {
        private readonly IProcessStartOperation m_WrappedProcessStarter;

        private static readonly TimeSpan s_TimeOut = TimeSpan.FromSeconds(20);

        public StartProcessWithTimeout(IProcessStartOperation wrappedProcessStarter)
        {
            if (wrappedProcessStarter == null)
                throw new ArgumentNullException("wrappedProcessStarter");

            m_WrappedProcessStarter = wrappedProcessStarter;
        }

        public Process StartProcess(string assemblyName, string remotingId, bool openDebugConsole = false)
        {
            using (var signal = new EventWaitHandle(false, EventResetMode.ManualReset, remotingId))
            {
                var process = m_WrappedProcessStarter.StartProcess(assemblyName, remotingId, openDebugConsole);
                WaitForReadySignal(signal);
                return process;
            }
        }

        private static void WaitForReadySignal(EventWaitHandle signal)
        {
            if (!signal.WaitOne(s_TimeOut))
                throw new ApplicationException("WPF child process didn't respond quickly enough");
        }
    }
}

using System;
using System.Diagnostics;
using System.Threading;

namespace RedGate.AppHost.Server
{
    internal class StartProcessWithTimeout : IProcessStartOperation
    {
        private readonly IProcessStartOperation m_WrappedProcessStarter;

        private static readonly TimeSpan s_TimeOut = TimeSpan.FromMinutes(2);

        public StartProcessWithTimeout(IProcessStartOperation wrappedProcessStarter)
        {
            if (wrappedProcessStarter == null)
                throw new ArgumentNullException("wrappedProcessStarter");

            m_WrappedProcessStarter = wrappedProcessStarter;
        }

        public Process StartProcess(string assemblyName, string remotingId, bool openDebugConsole = false)
        {
            using (var signal = new EventWaitHandle(false, EventResetMode.ManualReset, remotingId))
            {
                var process = m_WrappedProcessStarter.StartProcess(assemblyName, remotingId, openDebugConsole);
                WaitForReadySignal(signal);
                return process;
            }
        }

        private static void WaitForReadySignal(EventWaitHandle signal)
        {
            if (!signal.WaitOne(s_TimeOut))
                throw new ApplicationException("WPF child process didn't respond quickly enough");
        }
    }
}

Increase timeout from 20s to 2 minutes.

Increase timeout from 20s to 2 minutes.

We are seeing timeouts in APP on some slower machines. We may want to make this configurable in the future.


using System;
using Ninject;
using Ninject.Parameters;

namespace Prism.Ninject
{
    public static class NinjectExtensions
    {
        public static bool IsRegistered<TService>(this IKernel kernel)
        {
            return kernel.IsRegistered(typeof(TService));
        }

        public static bool IsRegistered(this IKernel kernel, Type type)
        {
            return kernel.CanResolve(kernel.CreateRequest(type, _ => true, new IParameter[] { }, false, false));
        }

        public static void RegisterTypeIfMissing<TFrom, TTo>(this IKernel kernel, bool asSingleton)
        {
            kernel.RegisterTypeIfMissing(typeof(TFrom), typeof(TTo), asSingleton);
        }

        public static void RegisterTypeIfMissing(this IKernel kernel, Type from, Type to, bool asSingleton)
        {
            // Don't do anything if there are already bindings registered
            if (kernel.IsRegistered(from))
            {
                return;
            }

            // Register the types
            var binding = kernel.Bind(from).To(to);
            if (asSingleton)
            {
                binding.InSingletonScope();
            }
            else
            {
                binding.InTransientScope();
            }
        }
    }
}

using System;
using Ninject;
using Ninject.Modules;
using Ninject.Parameters;

namespace Prism.Ninject
{
    public static class NinjectExtensions
    {
        public static bool IsRegistered<TService>(this IKernel kernel)
        {
            return kernel.IsRegistered(typeof(TService));
        }

        public static bool IsRegistered(this IKernel kernel, Type type)
        {
            return kernel.CanResolve(kernel.CreateRequest(type, _ => true, new IParameter[] { }, false, false));
        }

        public static void RegisterTypeIfMissing<TFrom, TTo>(this IKernel kernel, bool asSingleton)
        {
            kernel.RegisterTypeIfMissing(typeof(TFrom), typeof(TTo), asSingleton);
        }

        public static void RegisterTypeIfMissing(this IKernel kernel, Type from, Type to, bool asSingleton)
        {
            // Don't do anything if there are already bindings registered
            if (kernel.IsRegistered(from))
            {
                return;
            }

            // Register the types
            var binding = kernel.Bind(from).To(to);
            if (asSingleton)
            {
                binding.InSingletonScope();
            }
            else
            {
                binding.InTransientScope();
            }
        }
        public static void RegisterTypeForNavigation<T>(this NinjectModule ninjectModule)
        {
            ninjectModule.Bind<object>().To<T>().Named(typeof(T).Name);
        }

        public static void RegisterTypeForNavigation<T>(this IKernel kernel)
        {
            kernel.Bind<object>().To<T>().Named(typeof(T).Name);
        }
    }
}

Add RegisterTypeForNavigation to IKernel and NinjectModule

Add extensions for RegisterTypeForNavigation to IKernel  and Ninjectmodule, similar to the method available on Container for Unity/MEF.


namespace ImGuiNET
{
    public unsafe delegate int ImGuiInputTextCallback(ImGuiInputTextCallbackData* data);
}

using System.Runtime.InteropServices;

namespace ImGuiNET
{
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
    public unsafe delegate int ImGuiInputTextCallback(ImGuiInputTextCallbackData* data);
}

Change calling convention of ImGuiInputTextCallback


<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Test relying party</title>

        @if (User.Identity.IsAuthenticated)
        {
            Change Email
            Change Password
            Logout
        }
        else
        {
            Login
        }

        @RenderBody()

Update test RP to include client id in change email / password links


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

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("XNAControls")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("XNAControls")]
[assembly: AssemblyCopyright("Copyright ©  2014")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components.  If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8314a04c-752e-49fb-828d-40ef66d2ce39")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

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

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("XNAControls")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("XNAControls")]
[assembly: AssemblyCopyright("Copyright © Ethan Moffat 2014-2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components.  If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("8314a04c-752e-49fb-828d-40ef66d2ce39")]

// Version information for an assembly consists of the following four values:
//
//      Major Version
//      Minor Version
//      Build Number
//      Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

[assembly:InternalsVisibleTo("XNAControls.Test")]

Make XNAControls internals visible to XNAControls.Test


using System.Text;

namespace Miningcore.Blockchain.Ergo;

public partial class ErgoClient
{
    public Dictionary<string, string> RequestHeaders { get; } = new();

    private Task PrepareRequestAsync(HttpClient client, HttpRequestMessage request, StringBuilder url, CancellationToken ct)
    {
        foreach(var pair in RequestHeaders)
            request.Headers.Add(pair.Key, pair.Value);

        return Task.CompletedTask;
    }

    private Task PrepareRequestAsync(HttpClient client, HttpRequestMessage request, String url, CancellationToken ct)
    {
        foreach(var pair in RequestHeaders)
            request.Headers.Add(pair.Key, pair.Value);

        return Task.CompletedTask;
    }

    private Task PrepareRequestAsync(HttpClient client, HttpRequestMessage request, string url)
    {
        return Task.CompletedTask;
    }

    private static Task ProcessResponseAsync(HttpClient client, HttpResponseMessage response, CancellationToken ct)
    {
        return Task.CompletedTask;
    }
}

using System.Text;

namespace Miningcore.Blockchain.Ergo;

public partial class ErgoClient
{
    public Dictionary<string, string> RequestHeaders { get; } = new();

    private Task PrepareRequestAsync(HttpClient client, HttpRequestMessage request, StringBuilder url, CancellationToken ct)
    {
        foreach(var pair in RequestHeaders)
            request.Headers.Add(pair.Key, pair.Value);

        return Task.CompletedTask;
    }

    private Task PrepareRequestAsync(HttpClient client, HttpRequestMessage request, String url, CancellationToken ct)
    {
        return Task.CompletedTask;
    }

    private Task PrepareRequestAsync(HttpClient client, HttpRequestMessage request, string url)
    {
        return Task.CompletedTask;
    }

    private static Task ProcessResponseAsync(HttpClient client, HttpResponseMessage response, CancellationToken ct)
    {
        return Task.CompletedTask;
    }
}

Fix double Ergo auth request header problem


// 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;
using System.Collections.Generic;
using Microsoft.AspNetCore.Razor.Evolution.Legacy;

namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate
{
    public class SetTagHelperPropertyIRNode : RazorIRNode
    {
        public override IList<RazorIRNode> Children { get; } = new List<RazorIRNode>();

        public override RazorIRNode Parent { get; set; }

        public override SourceSpan? Source { get; set; }

        public string TagHelperTypeName { get; set; }

        public string PropertyName { get; set; }

        public string AttributeName { get; set; }

        internal HtmlAttributeValueStyle ValueStyle { get; set; }

        internal TagHelperAttributeDescriptor Descriptor { get; set; }

        public override void Accept(RazorIRNodeVisitor visitor)
        {
            if (visitor == null)
            {
                throw new ArgumentNullException(nameof(visitor));
            }

            visitor.VisitSetTagHelperProperty(this);
        }

        public override TResult Accept<TResult>(RazorIRNodeVisitor<TResult> visitor)
        {
            if (visitor == null)
            {
                throw new ArgumentNullException(nameof(visitor));
            }

            return visitor.VisitSetTagHelperProperty(this);
        }
    }
}

// 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;
using System.Collections.Generic;
using Microsoft.AspNetCore.Razor.Evolution.Legacy;

namespace Microsoft.AspNetCore.Razor.Evolution.Intermediate
{
    public class SetTagHelperPropertyIRNode : RazorIRNode
    {
        public override IList<RazorIRNode> Children { get; } = new List<RazorIRNode>();

        public override RazorIRNode Parent { get; set; }

        public override SourceSpan? Source { get; set; }

        public string TagHelperTypeName { get; set; }

        public string PropertyName { get; set; }

        public string AttributeName { get; set; }

        internal HtmlAttributeValueStyle ValueStyle { get; set; }

        public TagHelperAttributeDescriptor Descriptor { get; set; }

        public override void Accept(RazorIRNodeVisitor visitor)
        {
            if (visitor == null)
            {
                throw new ArgumentNullException(nameof(visitor));
            }

            visitor.VisitSetTagHelperProperty(this);
        }

        public override TResult Accept<TResult>(RazorIRNodeVisitor<TResult> visitor)
        {
            if (visitor == null)
            {
                throw new ArgumentNullException(nameof(visitor));
            }

            return visitor.VisitSetTagHelperProperty(this);
        }
    }
}

Make property attributes public in IR

Make property attributes public in IR


using OmniSharp.Services;
using TestUtility;
using Xunit;
using Xunit.Abstractions;

namespace OmniSharp.Tests
{
    public class DotNetCliServiceFacts : AbstractTestFixture
    {
        public DotNetCliServiceFacts(ITestOutputHelper output)
            : base(output)
        {
        }

        [Fact]
        public void GetVersion()
        {
            using (var host = CreateOmniSharpHost(dotNetCliVersion: DotNetCliVersion.Current))
            {
                var dotNetCli = host.GetExport<IDotNetCliService>();

                var version = dotNetCli.GetVersion();

                Assert.Equal(3, version.Major);
                Assert.Equal(1, version.Minor);
                Assert.Equal(201, version.Patch);
                Assert.Equal("", version.Release);
            }
        }

        [Fact]
        public void GetInfo()
        {
            using (var host = CreateOmniSharpHost(dotNetCliVersion: DotNetCliVersion.Current))
            {
                var dotNetCli = host.GetExport<IDotNetCliService>();

                var info = dotNetCli.GetInfo();

                Assert.Equal(3, info.Version.Major);
                Assert.Equal(1, info.Version.Minor);
                Assert.Equal(201, info.Version.Patch);
                Assert.Equal("", info.Version.Release);
            }
        }
    }
}

using OmniSharp.Services;
using TestUtility;
using Xunit;
using Xunit.Abstractions;

namespace OmniSharp.Tests
{
    public class DotNetCliServiceFacts : AbstractTestFixture
    {
        public DotNetCliServiceFacts(ITestOutputHelper output)
            : base(output)
        {
        }

        [Fact]
        public void GetVersion()
        {
            using (var host = CreateOmniSharpHost(dotNetCliVersion: DotNetCliVersion.Current))
            {
                var dotNetCli = host.GetExport<IDotNetCliService>();

                var version = dotNetCli.GetVersion();

                Assert.Equal(3, version.Major);
                Assert.Equal(1, version.Minor);
                Assert.Equal(302, version.Patch);
                Assert.Equal("", version.Release);
            }
        }

        [Fact]
        public void GetInfo()
        {
            using (var host = CreateOmniSharpHost(dotNetCliVersion: DotNetCliVersion.Current))
            {
                var dotNetCli = host.GetExport<IDotNetCliService>();

                var info = dotNetCli.GetInfo();

                Assert.Equal(3, info.Version.Major);
                Assert.Equal(1, info.Version.Minor);
                Assert.Equal(302, info.Version.Patch);
                Assert.Equal("", info.Version.Release);
            }
        }
    }
}

Update dotnet tests for 3.1.302.

Update dotnet tests for 3.1.302.


// 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.Collections.Generic;

namespace Microsoft.AspNetCore.Mvc.ApplicationParts
{
    /// <summary>
    /// A provider for a given <typeparamref name="TFeature"/> feature.
    /// </summary>
    /// <typeparam name="TFeature">The type of the feature.</typeparam>
    public interface IApplicationFeatureProvider<TFeature> : IApplicationFeatureProvider
    {
        /// <summary>
        /// Updates the <paramref name="feature"/> intance.
        /// </summary>
        /// <param name="parts">The list of <see cref="ApplicationPart"/>s of the
        /// application.
        /// </param>
        /// <param name="feature">The feature instance to populate.</param>
        void PopulateFeature(IEnumerable<ApplicationPart> parts, TFeature feature);
    }
}

// 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.Collections.Generic;

namespace Microsoft.AspNetCore.Mvc.ApplicationParts
{
    /// <summary>
    /// A provider for a given <typeparamref name="TFeature"/> feature.
    /// </summary>
    /// <typeparam name="TFeature">The type of the feature.</typeparam>
    public interface IApplicationFeatureProvider<TFeature> : IApplicationFeatureProvider
    {
        /// <summary>
        /// Updates the <paramref name="feature"/> instance.
        /// </summary>
        /// <param name="parts">The list of <see cref="ApplicationPart"/>s of the
        /// application.
        /// </param>
        /// <param name="feature">The feature instance to populate.</param>
        void PopulateFeature(IEnumerable<ApplicationPart> parts, TFeature feature);
    }
}

Fix typo in XML doc

Fix typo in XML doc


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

using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Tournament.IO;

namespace osu.Game.Tournament.Screens.Setup
{
    internal class TournamentSwitcher : ActionableInfo
    {
        private OsuDropdown<string> dropdown;

        [Resolved]
        private TournamentGameBase game { get; set; }

        [BackgroundDependencyLoader]
        private void load(TournamentStorage storage)
        {
            string startupTournament = storage.CurrentTournament.Value;

            dropdown.Current = storage.CurrentTournament;
            dropdown.Items = storage.ListTournaments();
            dropdown.Current.BindValueChanged(v => Button.Enabled.Value = v.NewValue != startupTournament, true);

            Action = () => game.GracefullyExit();

            ButtonText = "Close osu!";
        }

        protected override Drawable CreateComponent()
        {
            var drawable = base.CreateComponent();

            FlowContainer.Insert(-1, dropdown = new OsuDropdown<string>
            {
                Width = 510
            });

            return drawable;
        }
    }
}

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

using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Tournament.IO;

namespace osu.Game.Tournament.Screens.Setup
{
    internal class TournamentSwitcher : ActionableInfo
    {
        private OsuDropdown<string> dropdown;
        private OsuButton folderButton;

        [Resolved]
        private TournamentGameBase game { get; set; }

        [BackgroundDependencyLoader]
        private void load(TournamentStorage storage)
        {
            string startupTournament = storage.CurrentTournament.Value;

            dropdown.Current = storage.CurrentTournament;
            dropdown.Items = storage.ListTournaments();
            dropdown.Current.BindValueChanged(v => Button.Enabled.Value = v.NewValue != startupTournament, true);

            Action = () => game.GracefullyExit();
            folderButton.Action = storage.PresentExternally;

            ButtonText = "Close osu!";
        }

        protected override Drawable CreateComponent()
        {
            var drawable = base.CreateComponent();

            FlowContainer.Insert(-1, dropdown = new OsuDropdown<string>
            {
                Width = 510
            });

            FlowContainer.Insert(-2, folderButton = new TriangleButton
            {
                Text = "Open folder",
                Width = 100
            });

            return drawable;
        }
    }
}

Add open folder button to open currently selected tournament


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

#nullable enable

namespace osu.Framework.Extensions
{
    public static class PopoverExtensions
    {
        /// <summary>
        /// Shows the popover for <paramref name="hasPopover"/> on its nearest <see cref="PopoverContainer"/> ancestor.
        /// </summary>
        public static void ShowPopover(this IHasPopover hasPopover) => setTargetOnNearestPopover((Drawable)hasPopover, hasPopover);

        /// <summary>
        /// Hides the popover shown on <paramref name="drawable"/>'s nearest <see cref="PopoverContainer"/> ancestor.
        /// </summary>
        public static void HidePopover(this Drawable drawable) => setTargetOnNearestPopover(drawable, null);

        private static void setTargetOnNearestPopover(Drawable origin, IHasPopover? target)
            => origin.FindClosestParent<PopoverContainer>()?.SetTarget(target);
    }
}

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

using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Cursor;

#nullable enable

namespace osu.Framework.Extensions
{
    public static class PopoverExtensions
    {
        /// <summary>
        /// Shows the popover for <paramref name="hasPopover"/> on its nearest <see cref="PopoverContainer"/> ancestor.
        /// </summary>
        public static void ShowPopover(this IHasPopover hasPopover) => setTargetOnNearestPopover((Drawable)hasPopover, hasPopover);

        /// <summary>
        /// Hides the popover shown on <paramref name="drawable"/>'s nearest <see cref="PopoverContainer"/> ancestor.
        /// </summary>
        public static void HidePopover(this Drawable drawable) => setTargetOnNearestPopover(drawable, null);

        private static void setTargetOnNearestPopover(Drawable origin, IHasPopover? target)
        {
            var popoverContainer = origin.FindClosestParent<PopoverContainer>()
                                   ?? throw new InvalidOperationException($"Cannot show or hide a popover without a parent {nameof(PopoverContainer)} in the hierarchy");

            popoverContainer.SetTarget(target);
        }
    }
}

Throw an exception if a popover is attempted to be shown without a parent `PopoverContainer`

The intention is to help framework consumers to understand how this
component should be used, if they happen to be attempting to misuse it
(rather than silently failing).


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

namespace Silverpop.Core.Performance
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var tagValue = new string(
                Enumerable.Repeat("ABC", 1000)
                    .SelectMany(x => x)
                    .ToArray());

            var personalizationTags = new TestPersonalizationTags()
            {
                TagA = tagValue,
                TagB = tagValue,
                TagC = tagValue,
                TagD = tagValue,
                TagE = tagValue,
                TagF = tagValue,
                TagG = tagValue,
                TagH = tagValue,
                TagI = tagValue,
                TagJ = tagValue,
                TagK = tagValue,
                TagL = tagValue,
                TagM = tagValue,
                TagN = tagValue,
                TagO = tagValue
            };

            var numberOfTags = personalizationTags.GetType().GetProperties().Count();

            Console.WriteLine("Testing 1 million recipients with {0} tags using batches of 5000:", numberOfTags);
            new TransactMessagePerformance()
                .InvokeGetRecipientBatchedMessages(1000000, 5000, personalizationTags);

            Console.WriteLine("Testing 3 million recipients with {0} tags using batches of 5000:", numberOfTags);
            new TransactMessagePerformance()
                .InvokeGetRecipientBatchedMessages(3000000, 5000, personalizationTags);

            Console.ReadLine();
        }
    }
}

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

namespace Silverpop.Core.Performance
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            var tagValue = new string(
                Enumerable.Repeat("ABC", 1000)
                    .SelectMany(x => x)
                    .ToArray());

            var personalizationTags = new TestPersonalizationTags()
            {
                TagA = tagValue,
                TagB = tagValue,
                TagC = tagValue,
                TagD = tagValue,
                TagE = tagValue,
                TagF = tagValue,
                TagG = tagValue,
                TagH = tagValue,
                TagI = tagValue,
                TagJ = tagValue,
                TagK = tagValue,
                TagL = tagValue,
                TagM = tagValue,
                TagN = tagValue,
                TagO = tagValue
            };

            var numberOfTags = personalizationTags.GetType().GetProperties().Count();

            Console.WriteLine("Testing 1 million recipients with {0} tags using batches of 5000:", numberOfTags);
            new TransactMessagePerformance()
                .InvokeGetRecipientBatchedMessages(1000000, 5000, personalizationTags);

            Console.WriteLine("Testing 5 million recipients with {0} tags using batches of 5000:", numberOfTags);
            new TransactMessagePerformance()
                .InvokeGetRecipientBatchedMessages(5000000, 5000, personalizationTags);

            Console.ReadLine();
        }
    }
}

Change 3M performance test to 5M

Change 3M performance test to 5M


using BTCPayServer.Services.Mails;
using Microsoft.AspNetCore.Mvc.Rendering;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;

namespace BTCPayServer.Models.ServerViewModels
{
    public class EmailsViewModel
    {
        public string StatusMessage
        {
            get; set;
        }
        public EmailSettings Settings
        {
            get; set;
        }

        [EmailAddress]
        public string TestEmail
        {
            get; set;
        }
    }
}

using BTCPayServer.Services.Mails;
using Microsoft.AspNetCore.Mvc.Rendering;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;

namespace BTCPayServer.Models.ServerViewModels
{
    public class EmailsViewModel
    {
        public string StatusMessage
        {
            get; set;
        }
        public EmailSettings Settings
        {
            get; set;
        }

        [EmailAddress]
        [Display(Name = "Test Email")]
        public string TestEmail
        {
            get; set;
        }
    }
}

Add a space between "Test" and "Email" in the UI.


using System;
using System.IO;
using System.Linq;
using NUnit.Framework;

namespace photo.exif.unit.test
{
    [TestFixture("Images/Canon PowerShot SX500 IS.JPG")]
    [TestFixture("Images/Nikon COOLPIX P510.JPG")]
    [TestFixture("Images/Panasonic Lumix DMC-FZ200.JPG")]
    [TestFixture("Images/Samsung SIII.jpg")]
    public class ParserTest
    {
        public ParserTest(string path)
        {
            _path = path;
            _parser = new Parser();
        }

        private readonly string _path;
        private readonly Parser _parser;

        [Test]
        public void Test_parse_path_return_some_data()
        {
            var data = _parser.Parse(_path);
            data.ToList().ForEach(Console.WriteLine);
            Assert.That(data, Is.Not.Null);
            Assert.That(data, Is.Not.Empty);
        }

        [Test]
        public void Test_parse_stream_return_some_data()
        {
            var data = _parser.Parse(new FileStream(_path,FileMode.Open));
            data.ToList().ForEach(Console.WriteLine);
            Assert.That(data, Is.Not.Null);
            Assert.That(data, Is.Not.Empty);
        }
    }
}

using System;
using System.IO;
using System.Linq;
using NUnit.Framework;

namespace photo.exif.unit.test
{
    public class ParserTest
    {
        public ParserTest()
        {
            _parser = new Parser();
        }

        private readonly Parser _parser;

        static string[] paths = Directory.GetFiles( Environment.CurrentDirectory, "*.jpg", SearchOption.AllDirectories);

        [Test, TestCaseSource("paths")]
        public void Test_parse_path_return_some_data(string path)
        {
            var data = _parser.Parse(path);
            data.ToList().ForEach(Console.WriteLine);
            Assert.That(data, Is.Not.Null);
            Assert.That(data, Is.Not.Empty);
        }

        [Test, TestCaseSource("paths")]
        public void Test_parse_stream_return_some_data(string path)
        {
            var data = _parser.Parse(new FileStream(path,FileMode.Open));
            data.ToList().ForEach(Console.WriteLine);
            Assert.That(data, Is.Not.Null);
            Assert.That(data, Is.Not.Empty);
        }
    }
}

Load images in the test folder

Load images in the test folder


namespace Miruken.Callback
{
    using System;

    public abstract class HandlerDecorator  : Handler, IDecorator
    {
        protected HandlerDecorator(IHandler decoratee)
        {
            if (decoratee == null)
                throw new ArgumentNullException(nameof(decoratee));
            Decoratee = decoratee;
        }

        public IHandler Decoratee { get; }

        object IDecorator.Decoratee => Decoratee;

        protected override bool HandleCallback(
            object callback, ref bool greedy, IHandler composer)
        {
            return Decoratee.Handle(callback, ref greedy, composer);
        }
    }
}

namespace Miruken.Callback
{
    using System;

    public abstract class HandlerDecorator  : Handler, IDecorator
    {
        protected HandlerDecorator(IHandler decoratee)
        {
            if (decoratee == null)
                throw new ArgumentNullException(nameof(decoratee));
            Decoratee = decoratee;
        }

        public IHandler Decoratee { get; }

        object IDecorator.Decoratee => Decoratee;

        protected override bool HandleCallback(
            object callback, ref bool greedy, IHandler composer)
        {
            return Decoratee.Handle(callback, ref greedy, composer)
                || base.HandleCallback(callback, ref greedy, composer);
        }
    }
}

Call base Handle if Decoratee not handled


using System;
using AzureStorage.Queue;
using Common.Log;
using CompetitionPlatform.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;

namespace CompetitionPlatform.Exceptions
{
    public class GlobalExceptionFilter : IExceptionFilter, IDisposable
    {
        private readonly ILog _log;
        private readonly IAzureQueue<SlackMessage> _slackMessageQueue;

        public GlobalExceptionFilter(ILog log, string slackNotificationsConnString)
        {
            _log = log;

            if (!string.IsNullOrEmpty(slackNotificationsConnString))
            {
                _slackMessageQueue = new AzureQueue<SlackMessage>(slackNotificationsConnString, "slack-notifications");
            }
            _slackMessageQueue = new QueueInMemory<SlackMessage>();
        }

        public void OnException(ExceptionContext context)
        {
            var controller = context.RouteData.Values["controller"];
            var action = context.RouteData.Values["action"];

            _log.WriteError("Exception", "LykkeStreams", $"Controller: {controller}, action: {action}", context.Exception).Wait();

            var message = new SlackMessage
            {
                Type = "Errors", //Errors, Info
                Sender = "Lykke Streams",
                Message = "Message occured in: " + controller + ", " + action + " - " + context.Exception
            };

            _slackMessageQueue.PutMessageAsync(message).Wait();
        }

        public void Dispose()
        {

        }
    }
}

using System;
using AzureStorage.Queue;
using Common.Log;
using CompetitionPlatform.Models;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;

namespace CompetitionPlatform.Exceptions
{
    public class GlobalExceptionFilter : IExceptionFilter, IDisposable
    {
        private readonly ILog _log;
        private readonly IAzureQueue<SlackMessage> _slackMessageQueue;

        public GlobalExceptionFilter(ILog log, string slackNotificationsConnString)
        {
            _log = log;

            if (!string.IsNullOrEmpty(slackNotificationsConnString))
            {
                _slackMessageQueue = new AzureQueue<SlackMessage>(slackNotificationsConnString, "slack-notifications");
            }
            else
            {
                _slackMessageQueue = new QueueInMemory<SlackMessage>();
            }
        }

        public void OnException(ExceptionContext context)
        {
            var controller = context.RouteData.Values["controller"];
            var action = context.RouteData.Values["action"];

            _log.WriteError("Exception", "LykkeStreams", $"Controller: {controller}, action: {action}", context.Exception).Wait();

            var message = new SlackMessage
            {
                Type = "Errors", //Errors, Info
                Sender = "Lykke Streams",
                Message = "Occured in: " + controller + "Controller, " + action + " - " + context.Exception.GetType()
            };

            _slackMessageQueue.PutMessageAsync(message).Wait();
        }

        public void Dispose()
        {

        }
    }
}

Change slack error message text.

Change slack error message text.


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

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

namespace osu.Game.Overlays.Settings
{
    public class SettingsEnumDropdown<T> : SettingsDropdown<T>
        where T : struct, Enum
    {
        protected override OsuDropdown<T> CreateDropdown() => new DropdownControl();

        protected new class DropdownControl : OsuEnumDropdown<T>
        {
            protected virtual int MenuMaxHeight => 200;

            public DropdownControl()
            {
                Margin = new MarginPadding { Top = 5 };
                RelativeSizeAxes = Axes.X;
            }

            protected override DropdownMenu CreateMenu() => base.CreateMenu().With(m => m.MaxHeight = MenuMaxHeight);
        }
    }
}

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

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

namespace osu.Game.Overlays.Settings
{
    public class SettingsEnumDropdown<T> : SettingsDropdown<T>
        where T : struct, Enum
    {
        protected override OsuDropdown<T> CreateDropdown() => new DropdownControl();

        protected new class DropdownControl : OsuEnumDropdown<T>
        {
            public DropdownControl()
            {
                Margin = new MarginPadding { Top = 5 };
                RelativeSizeAxes = Axes.X;
            }

            protected override DropdownMenu CreateMenu() => base.CreateMenu().With(m => m.MaxHeight = 200);
        }
    }
}

Revert "Refactor the menu's max height to be a property"

This reverts commit 9cb9ef5c


using System;
using System.Reflection;

namespace EE.Internal {
    internal class FirebaseAnalyticsImpl : IFirebaseAnalyticsImpl {
        private readonly MethodInfo _methodSetCurrentScreen;

        public FirebaseAnalyticsImpl() {
            var type = Type.GetType("Firebase.Analytics.FirebaseAnalytics, Firebase.Crashlytics");
            if (type == null) {
                throw new ArgumentException("Cannot find FirebaseAnalytics");
            }
            _methodSetCurrentScreen = type.GetMethod("SetCurrentScreen", new[] {typeof(string), typeof(string)});
        }

        public void SetCurrentScreen(string screenName, string screenClass) {
            _methodSetCurrentScreen.Invoke(null, new object[] {screenName, screenClass});
        }
    }
}

using System;
using System.Reflection;

namespace EE.Internal {
    internal class FirebaseAnalyticsImpl : IFirebaseAnalyticsImpl {
        private readonly MethodInfo _methodSetCurrentScreen;

        public FirebaseAnalyticsImpl() {
            var type = Type.GetType("Firebase.Analytics.FirebaseAnalytics, Firebase.Analytics");
            if (type == null) {
                throw new ArgumentException("Cannot find FirebaseAnalytics");
            }
            _methodSetCurrentScreen = type.GetMethod("SetCurrentScreen", new[] {typeof(string), typeof(string)});
        }

        public void SetCurrentScreen(string screenName, string screenClass) {
            _methodSetCurrentScreen.Invoke(null, new object[] {screenName, screenClass});
        }
    }
}

Fix cannot load firebase analytics type.


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Builder;

namespace RedCard.API
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var host = new WebHostBuilder()
                .UseKestrel()
                .UseContentRoot(Directory.GetCurrentDirectory())
                .UseStartup<Startup>()
                .Build();

            host.Run();
        }
    }
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Builder;
using RedCard.API.Contexts;
using Microsoft.EntityFrameworkCore;

namespace RedCard.API
{
    public class Program
    {
        public static void Main(string[] args)
        {
            using (var context = new ApplicationDbContext())
            {
              context.Database.Migrate();
            }

            var host = new WebHostBuilder()
                .UseKestrel()
                .UseContentRoot(Directory.GetCurrentDirectory())
                .UseStartup<Startup>()
                .Build();

            host.Run();
        }
    }
}

Add sqlite migrate on startup

Add sqlite migrate on startup