using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using XHRTool.XHRLogic.Common;

namespace XHRTool.UI.WPF.ViewModels
{
    [Serializable]
    public class UrlHistoryModel
    {
        public UrlHistoryModel(string url, string verb)
        {
            Url = url;
            Verb = verb;
        }

        public string Url { get; set; }

        public string Verb { get; set; }
    }

    public class UrlHistoryModelEqualityComparer : IEqualityComparer<UrlHistoryModel>
    {
        public bool Equals(UrlHistoryModel x, UrlHistoryModel y)
        {
            return x.Url.Equals(y.Url) && x.Verb.Equals(y.Verb);
        }

        public int GetHashCode(UrlHistoryModel obj)
        {
            return (obj.Verb.GetHashCode() + obj.Url.GetHashCode()) / 2;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using XHRTool.XHRLogic.Common;

namespace XHRTool.UI.WPF.ViewModels
{
    [Serializable]
    public class UrlHistoryModel
    {
        public UrlHistoryModel(string url, string verb)
        {
            Url = url;
            Verb = verb;
        }

        public string Url { get; set; }

        public string Verb { get; set; }
    }

    public class UrlHistoryModelEqualityComparer : IEqualityComparer<UrlHistoryModel>
    {
        public bool Equals(UrlHistoryModel x, UrlHistoryModel y)
        {
            return x.Url.Equals(y.Url, StringComparison.OrdinalIgnoreCase) && x.Verb.Equals(y.Verb, StringComparison.OrdinalIgnoreCase);
        }

        public int GetHashCode(UrlHistoryModel obj)
        {
            return (obj.Verb.GetHashCode() + obj.Url.GetHashCode()) / 2;
        }
    }
}

Fix string comparison for URL history

Fix string comparison for URL history


namespace Stripe
{
    using Newtonsoft.Json;

    public class BillingDetailsOptions : INestedOptions
    {
        [JsonProperty("address")]
        public AddressOptions Address { get; set; }

        [JsonProperty("country")]
        public string Country { get; set; }

        [JsonProperty("line1")]
        public string Line1 { get; set; }

        [JsonProperty("line2")]
        public string Line2 { get; set; }

        [JsonProperty("postal_code")]
        public string PostalCode { get; set; }

        [JsonProperty("type")]
        public string Type { get; set; }
    }
}

namespace Stripe
{
    using Newtonsoft.Json;

    public class BillingDetailsOptions : INestedOptions
    {
        [JsonProperty("address")]
        public AddressOptions Address { get; set; }

        [JsonProperty("email")]
        public string Email { get; set; }

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

        [JsonProperty("phone")]
        public string Phone { get; set; }
    }
}

Fix BillingDetails on PaymentMethod creation to have the right params


// 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.Shapes;
using osu.Game.Graphics.UserInterface;
using osuTK.Graphics;

namespace osu.Game.Tests.Visual.UserInterface
{
    public class TestSceneLoadingSpinner : OsuGridTestScene
    {
        public TestSceneLoadingSpinner()
            : base(2, 2)
        {
            LoadingSpinner loading;

            Cell(0).AddRange(new Drawable[]
            {
                new Box
                {
                    Colour = Color4.Black,
                    RelativeSizeAxes = Axes.Both
                },
                loading = new LoadingSpinner()
            });

            loading.Show();

            Cell(1).AddRange(new Drawable[]
            {
                new Box
                {
                    Colour = Color4.White,
                    RelativeSizeAxes = Axes.Both
                },
                loading = new LoadingSpinner()
            });

            loading.Show();

            Cell(2).AddRange(new Drawable[]
            {
                new Box
                {
                    Colour = Color4.Gray,
                    RelativeSizeAxes = Axes.Both
                },
                loading = new LoadingSpinner()
            });

            loading.Show();

            Cell(3).AddRange(new Drawable[]
            {
                loading = new LoadingSpinner()
            });

            Scheduler.AddDelayed(() => loading.ToggleVisibility(), 200, true);
        }
    }
}

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

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

namespace osu.Game.Tests.Visual.UserInterface
{
    public class TestSceneLoadingSpinner : OsuGridTestScene
    {
        public TestSceneLoadingSpinner()
            : base(2, 2)
        {
            LoadingSpinner loading;

            Cell(0).AddRange(new Drawable[]
            {
                new Box
                {
                    Colour = Color4.Black,
                    RelativeSizeAxes = Axes.Both
                },
                loading = new LoadingSpinner()
            });

            loading.Show();

            Cell(1).AddRange(new Drawable[]
            {
                new Box
                {
                    Colour = Color4.White,
                    RelativeSizeAxes = Axes.Both
                },
                loading = new LoadingSpinner(true)
            });

            loading.Show();

            Cell(2).AddRange(new Drawable[]
            {
                new Box
                {
                    Colour = Color4.Gray,
                    RelativeSizeAxes = Axes.Both
                },
                loading = new LoadingSpinner()
            });

            loading.Show();

            Cell(3).AddRange(new Drawable[]
            {
                loading = new LoadingSpinner()
            });

            Scheduler.AddDelayed(() => loading.ToggleVisibility(), 200, true);
        }
    }
}

Add test for loading spinner with box

Add test for loading spinner with box


using System.Xml;

namespace umbraco.editorControls.imagecropper
{
    public class DataTypeData : umbraco.cms.businesslogic.datatype.DefaultData
    {
        public DataTypeData(umbraco.cms.businesslogic.datatype.BaseDataType DataType) : base(DataType) { }

        public override XmlNode ToXMl(XmlDocument data)
        {
            if (Value.ToString() != "") {
                XmlDocument xd = new XmlDocument();
                xd.LoadXml(Value.ToString());
                return data.ImportNode(xd.DocumentElement, true);
            } else {
                return base.ToXMl(data);
            }

        }
    }
}

using System.Xml;

namespace umbraco.editorControls.imagecropper
{
    public class DataTypeData : umbraco.cms.businesslogic.datatype.DefaultData
    {
        public DataTypeData(umbraco.cms.businesslogic.datatype.BaseDataType DataType) : base(DataType) { }

        public override XmlNode ToXMl(XmlDocument data)
        {
            if (Value!=null && Value.ToString() != "") {
                XmlDocument xd = new XmlDocument();
                xd.LoadXml(Value.ToString());
                return data.ImportNode(xd.DocumentElement, true);
            } else {
                return base.ToXMl(data);
            }

        }
    }
}

Fix U4-2711 add Null Check to ToXMl method

Fixes Object reference not set to an instance of an object. at
umbraco.editorControls.imagecropper.DataTypeData.ToXMl(XmlDocument data)


using System;
using System.Threading.Tasks;
using Treehopper;
using Treehopper.Libraries.Displays;

namespace LedShiftRegisterDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            App().Wait();
        }

        static async Task App()
        {
            var board = await ConnectionService.Instance.GetFirstDeviceAsync();
            await board.ConnectAsync();
            Console.WriteLine("Connected to " + board);
            var driver = new LedShiftRegister(board.Spi, board.Pins[5], board.Pwm1);
            driver.Brightness = 0.01;
            var bar = new BarGraph(driver.Leds);
            while (!Console.KeyAvailable)
            {
                for (int i = 1; i < 10; i++)
                {
                    bar.Value = i / 10.0;
                    await Task.Delay(50);
                }
                for (int i = 10; i >= 0; i--)
                {
                    bar.Value = i / 10.0;
                    await Task.Delay(50);
                }
                await Task.Delay(100);
            }
            board.Disconnect();
        }
    }
}

using System;
using System.Linq;
using System.Threading.Tasks;
using Treehopper;
using Treehopper.Libraries.Displays;

namespace LedShiftRegisterDemo
{
    class Program
    {
        static void Main(string[] args)
        {
            App().Wait();
        }

        static async Task App()
        {
            var board = await ConnectionService.Instance.GetFirstDeviceAsync();
            await board.ConnectAsync();
            Console.WriteLine("Connected to " + board);
            var driver = new LedShiftRegister(board.Spi, board.Pins[9], board.Pwm1, LedShiftRegister.LedChannelCount.SixteenChannel, 0.1);
            var driver2 = new LedShiftRegister(driver, LedShiftRegister.LedChannelCount.SixteenChannel);
            driver.Brightness = 0.01;
            var leds = driver.Leds.Concat(driver2.Leds);
            var ledSet1 = leds.Take(8).Concat(leds.Skip(16).Take(8)).ToList();
            var ledSet2 = leds.Skip(8).Take(8).Reverse().Concat(leds.Skip(24).Take(8).Reverse()).ToList();

            var bar1 = new BarGraph(ledSet1);
            var bar2 = new BarGraph(ledSet2);
            var collection = new LedDisplayCollection();
            collection.Add(bar1);
            collection.Add(bar2);
            while (!Console.KeyAvailable)
            {
                for (int i = 1; i < 16; i++)
                {
                    bar1.Value = i / 16.0;
                    bar2.Value = i / 16.0;
                    await collection.Flush();
                    await Task.Delay(10);
                }
                await Task.Delay(100);
                for (int i = 16; i >= 0; i--)
                {
                    bar1.Value = i / 16.0;
                    bar2.Value = i / 16.0;
                    await collection.Flush();
                    await Task.Delay(10);
                }
                await Task.Delay(100);
            }
            board.Disconnect();
        }
    }
}

Use two shift registers with two bar graphs and an collection


namespace TraktApiSharp.Tests.Experimental.Requests.Users.OAuth
{
    using FluentAssertions;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using TraktApiSharp.Experimental.Requests.Base.Post.Bodyless;
    using TraktApiSharp.Experimental.Requests.Users.OAuth;

    [TestClass]
    public class TraktUserListLikeRequestTests
    {
        [TestMethod, TestCategory("Requests"), TestCategory("Users")]
        public void TestTraktUserListLikeRequestIsNotAbstract()
        {
            typeof(TraktUserListLikeRequest).IsAbstract.Should().BeFalse();
        }

        [TestMethod, TestCategory("Requests"), TestCategory("Users")]
        public void TestTraktUserListLikeRequestIsSealed()
        {
            typeof(TraktUserListLikeRequest).IsSealed.Should().BeTrue();
        }

        [TestMethod, TestCategory("Requests"), TestCategory("Users")]
        public void TestTraktUserListLikeRequestIsSubclassOfATraktNoContentBodylessPostByIdRequest()
        {
            typeof(TraktUserListLikeRequest).IsSubclassOf(typeof(ATraktNoContentBodylessPostByIdRequest)).Should().BeTrue();
        }
    }
}

namespace TraktApiSharp.Tests.Experimental.Requests.Users.OAuth
{
    using FluentAssertions;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using TraktApiSharp.Experimental.Requests.Base.Post.Bodyless;
    using TraktApiSharp.Experimental.Requests.Users.OAuth;
    using TraktApiSharp.Requests;

    [TestClass]
    public class TraktUserListLikeRequestTests
    {
        [TestMethod, TestCategory("Requests"), TestCategory("Users")]
        public void TestTraktUserListLikeRequestIsNotAbstract()
        {
            typeof(TraktUserListLikeRequest).IsAbstract.Should().BeFalse();
        }

        [TestMethod, TestCategory("Requests"), TestCategory("Users")]
        public void TestTraktUserListLikeRequestIsSealed()
        {
            typeof(TraktUserListLikeRequest).IsSealed.Should().BeTrue();
        }

        [TestMethod, TestCategory("Requests"), TestCategory("Users")]
        public void TestTraktUserListLikeRequestIsSubclassOfATraktNoContentBodylessPostByIdRequest()
        {
            typeof(TraktUserListLikeRequest).IsSubclassOf(typeof(ATraktNoContentBodylessPostByIdRequest)).Should().BeTrue();
        }

        [TestMethod, TestCategory("Requests"), TestCategory("Users")]
        public void TestTraktUserListLikeRequestHasAuthorizationRequired()
        {
            var request = new TraktUserListLikeRequest(null);
            request.AuthorizationRequirement.Should().Be(TraktAuthorizationRequirement.Required);
        }
    }
}

Add test for authorization requirement in TraktUserListLikeRequest


using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Windows.Forms;

namespace Common
{
    public partial class InterfaceSelectorComboBox : ComboBox
    {
        public InterfaceSelectorComboBox()
        {
            InitializeComponent();
            NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();
            foreach (NetworkInterface iface in interfaces)
            {
                UnicastIPAddressInformationCollection addresses = iface.GetIPProperties().UnicastAddresses;
                foreach (UnicastIPAddressInformation address in addresses)
                {
                    if (address.Address.AddressFamily == AddressFamily.InterNetwork)
                        Items.Add(address.Address.ToString());
                }
            }
        }
    }
}

using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Windows.Forms;

namespace Common
{
    public partial class InterfaceSelectorComboBox : ComboBox
    {
        public InterfaceSelectorComboBox()
        {
            InitializeComponent();

            Initalize();

            NetworkChange.NetworkAddressChanged += NetworkChange_NetworkAddressChanged;
            NetworkChange.NetworkAvailabilityChanged += NetworkChange_NetworkAvailabilityChanged;
        }

        private void Initalize()
        {
            if (InvokeRequired)
            {
                BeginInvoke((MethodInvoker)Initalize);
                return;
            }
            Items.Clear();
            NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces();
            foreach (NetworkInterface iface in interfaces)
            {
                UnicastIPAddressInformationCollection addresses = iface.GetIPProperties().UnicastAddresses;
                foreach (UnicastIPAddressInformation address in addresses)
                {
                    if (address.Address.AddressFamily == AddressFamily.InterNetwork)
                        Items.Add(address.Address.ToString());
                }
            }
        }

        private void NetworkChange_NetworkAvailabilityChanged(object sender, NetworkAvailabilityEventArgs e)
        {
            Initalize();
        }

        private void NetworkChange_NetworkAddressChanged(object sender, System.EventArgs e)
        {
            Initalize();
        }
    }
}

Refresh interface list on change

Refresh interface list on change


using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using NUnit.Framework;

namespace MaxMind.MaxMindDb.Test
{
    [TestFixture]
    public class ThreadingTest
    {
        [Test]
        public void TestParallelFor()
        {
            var reader = new MaxMindDbReader("..\\..\\TestData\\GeoLite2-City.mmdb", FileAccessMode.MemoryMapped);
            var count = 0;
            var ipsAndResults = new Dictionary<IPAddress, string>();
            var rand = new Random();
            while(count < 10000)
            {
                var ip = new IPAddress(rand.Next(int.MaxValue));
                var resp = reader.Find(ip);
                if (resp != null)
                {
                    ipsAndResults.Add(ip, resp.ToString());
                    count++;
                }
            }

            var ips = ipsAndResults.Keys.ToArray();
            Parallel.For(0, ips.Length, (i) =>
            {
                var ipAddress = ips[i];
                var result = reader.Find(ipAddress);
                var resultString = result.ToString();
                var expectedString = ipsAndResults[ipAddress];
                if(resultString != expectedString)
                    throw new Exception(string.Format("Non-matching zip. Expected {0}, found {1}", expectedString, resultString));
            });
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using NUnit.Framework;

namespace MaxMind.MaxMindDb.Test
{
    [TestFixture]
    public class ThreadingTest
    {
        [Test]
        public void TestParallelFor()
        {
            var reader = new MaxMindDbReader("..\\..\\TestData\\GeoLite2-City.mmdb", FileAccessMode.MemoryMapped);
            var count = 0;
            var ipsAndResults = new Dictionary<IPAddress, string>();
            var rand = new Random();
            while(count < 10000)
            {
                var ip = new IPAddress(rand.Next(int.MaxValue));
                var resp = reader.Find(ip);
                if (resp != null)
                {
                    ipsAndResults.Add(ip, resp.ToString());
                    count++;
                }
            }

            var ips = ipsAndResults.Keys.ToArray();
            Parallel.For(0, ips.Length, (i) =>
            {
                var ipAddress = ips[i];
                var result = reader.Find(ipAddress);
                var resultString = result.ToString();
                var expectedString = ipsAndResults[ipAddress];
                if(resultString != expectedString)
                    throw new Exception(string.Format("Non-matching result. Expected {0}, found {1}", expectedString, resultString));
            });
        }
    }
}

Correct error message in thread test

Correct error message in thread test


using Xamarin.Forms;
#if __ANDROID__
using NativePoint = Android.Graphics.PointF;
using NativeColor = Android.Graphics.Color;
#elif __IOS__
using NativePoint = CoreGraphics.CGPoint;
#elif NETFX_CORE
using NativePoint = Windows.Foundation.Point;
#endif
#if NETFX_CORE
using NativeColor = Windows.UI.Color;
#endif

namespace Esri.ArcGISRuntime.Toolkit.Xamarin.Forms.Internal
{
    internal static class ExtensionMethods
    {
        internal static NativeColor ToNativeColor(this Color color)
        {
#if NETFX_CORE
            return NativeColor.FromArgb((byte)color.A, (byte)color.R, (byte)color.G, (byte)color.B);
#elif __ANDROID__
            return NativeColor.Argb((int)color.A, (int)color.R, (int)color.G, (int)color.B);
#endif
        }

        internal static Color ToXamarinFormsColor(this NativeColor color)
        {
            return Color.FromRgba(color.R, color.G, color.B, color.A);
        }
    }
}

using Xamarin.Forms;
#if __ANDROID__
using NativePoint = Android.Graphics.PointF;
using NativeColor = Android.Graphics.Color;
#elif __IOS__
using NativePoint = CoreGraphics.CGPoint;
#elif NETFX_CORE
using NativePoint = Windows.Foundation.Point;
#endif
#if NETFX_CORE
using NativeColor = Windows.UI.Color;
#endif

namespace Esri.ArcGISRuntime.Toolkit.Xamarin.Forms.Internal
{
    internal static class ExtensionMethods
    {
        internal static NativeColor ToNativeColor(this Color color)
        {
            var a = (byte)(255 * color.A);
            var r = (byte)(255 * color.R);
            var g = (byte)(255 * color.G);
            var b = (byte)(255 * color.B);
#if NETFX_CORE
            return NativeColor.FromArgb(a, r, g, b);
#elif __ANDROID__
            return NativeColor.Argb(a, r, g, b);
#endif
        }

        internal static Color ToXamarinFormsColor(this NativeColor color)
        {
            return Color.FromRgba(color.R, color.G, color.B, color.A);
        }
    }
}

Fix conversion from Xamarin Forms color to native color


using System;
using System.Collections.Generic;

namespace CertiPay.Common.Notifications
{
    /// <summary>
    /// Represents an email notification sent a user, employee, or administrator
    /// </summary>
    public class EmailNotification : Notification
    {
        public static String QueueName { get { return "EmailNotifications"; } }

        /// <summary>
        /// Who the email notification should be FROM
        /// </summary>
        public String FromAddress { get; set; }

        /// <summary>
        /// A list of email addresses to CC
        /// </summary>
        public ICollection<String> CC { get; set; }

        /// <summary>
        /// A list of email addresses to BCC
        /// </summary>
        public ICollection<String> BCC { get; set; }

        /// <summary>
        /// The subject line of the email
        /// </summary>
        public String Subject { get; set; }

        /// <summary>
        /// Any attachments to the email in the form of URLs to download
        /// </summary>
        public ICollection<Attachment> Attachments { get; set; }

        public EmailNotification()
        {
            this.Recipients = new List<String>();
            this.Attachments = new List<Attachment>();
            this.CC = new List<String>();
            this.BCC = new List<String>();
        }

        /// <summary>
        /// A file may be attached to the email notification by providing a URL to download
        /// the file (will be downloaded by the sending process) and a filename
        /// </summary>
        public class Attachment
        {
            public String Filename { get; set; }

            public String Uri { get; set; }
        }
    }
}

using System;
using System.Collections.Generic;

namespace CertiPay.Common.Notifications
{
    /// <summary>
    /// Represents an email notification sent a user, employee, or administrator
    /// </summary>
    public class EmailNotification : Notification
    {
        public static String QueueName { get { return "EmailNotifications"; } }

        /// <summary>
        /// Who the email notification should be FROM
        /// </summary>
        public String FromAddress { get; set; }

        /// <summary>
        /// A list of email addresses to CC
        /// </summary>
        public ICollection<String> CC { get; set; } = new List<String>();

        /// <summary>
        /// A list of email addresses to BCC
        /// </summary>
        public ICollection<String> BCC { get; set; } = new List<String>();

        /// <summary>
        /// The subject line of the email
        /// </summary>
        public String Subject { get; set; }

        /// <summary>
        /// Any attachments to the email in the form of URLs to download
        /// </summary>
        public ICollection<Attachment> Attachments { get; set; } = new List<Attachment>();

        /// <summary>
        /// A file may be attached to the email notification by providing a URL to download
        /// the file (will be downloaded by the sending process) and a filename
        /// </summary>
        public class Attachment
        {
            public String Filename { get; set; }

            public String Uri { get; set; }
        }
    }
}

:lipstick: Tweak initialization for email notification


using Avalonia.Controls;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;

namespace WalletWasabi.Gui.Converters
{
	public class WindowStateAfterSartJsonConverter : JsonConverter
	{
		/// <inheritdoc />
		public override bool CanConvert(Type objectType)
		{
			return objectType == typeof(WindowState);
		}

		/// <inheritdoc />
		public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
		{
			try
			{
				// If minimized, then go with Maximized, because at start it shouldn't run with minimized.
				var value = reader.Value as string;

				if (string.IsNullOrWhiteSpace(value))
				{
					return WindowState.Maximized;
				}

				if (value is null)
				{
					return WindowState.Maximized;
				}

				string windowStateString = value.Trim();
				if (WindowState.Normal.ToString().Equals(windowStateString, StringComparison.OrdinalIgnoreCase)
					|| "normal".Equals(windowStateString, StringComparison.OrdinalIgnoreCase)
					|| "norm".Equals(windowStateString, StringComparison.OrdinalIgnoreCase))
				{
					return WindowState.Normal;
				}
				else
				{
					return WindowState.Maximized;
				}
			}
			catch
			{
				return WindowState.Maximized;
			}
		}

		/// <inheritdoc />
		public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
		{
			writer.WriteValue(((WindowState)value).ToString());
		}
	}
}

using Avalonia.Controls;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;

namespace WalletWasabi.Gui.Converters
{
	public class WindowStateAfterSartJsonConverter : JsonConverter
	{
		/// <inheritdoc />
		public override bool CanConvert(Type objectType)
		{
			return objectType == typeof(WindowState);
		}

		/// <inheritdoc />
		public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
		{
			try
			{
				// If minimized, then go with Maximized, because at start it shouldn't run with minimized.
				var value = reader.Value as string;

				if (string.IsNullOrWhiteSpace(value))
				{
					return WindowState.Maximized;
				}

				var windowStateString = value.Trim();

				return windowStateString.StartsWith("norm", StringComparison.OrdinalIgnoreCase)
					? WindowState.Normal
					: WindowState.Maximized;
			}
			catch
			{
				return WindowState.Maximized;
			}
		}

		/// <inheritdoc />
		public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
		{
			writer.WriteValue(((WindowState)value).ToString());
		}
	}
}

Remove duplicae null check, simplified state check


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

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

        public ExpireFundsJob(
            IMessageSession messageSession,
            ICurrentDateTime currentDateTime,
            IEmployerAccountRepository accountRepository)
        {
            _messageSession = messageSession;
            _currentDateTime = currentDateTime;
            _accountRepository = accountRepository;
        }

        public async Task Run(
            [TimerTrigger("0 0 0 28 * *")] TimerInfo timer,
            ILogger logger)
        {
            var now = _currentDateTime.Now;
            var accounts = await _accountRepository.GetAllAccounts();
            var commands = accounts.Select(a => new ExpireAccountFundsCommand { AccountId = a.Id });

            var tasks = commands.Select(c =>
            {
                var sendOptions = new SendOptions();

                sendOptions.RequireImmediateDispatch();
                sendOptions.SetMessageId($"{nameof(ExpireAccountFundsCommand)}-{now.Year}-{now.Month}-{c.AccountId}");

                return _messageSession.Send(c, sendOptions);
            });

            await Task.WhenAll(tasks);
        }
    }
}

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

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

        public ExpireFundsJob(
            IMessageSession messageSession,
            ICurrentDateTime currentDateTime,
            IEmployerAccountRepository accountRepository)
        {
            _messageSession = messageSession;
            _currentDateTime = currentDateTime;
            _accountRepository = accountRepository;
        }

        public async Task Run(
            [TimerTrigger("0 0 0 28 * *")] TimerInfo timer,
            ILogger logger)
        {
            logger.LogInformation($"Starting {nameof(ExpireFundsJob)}");

            var now = _currentDateTime.Now;
            var accounts = await _accountRepository.GetAllAccounts();
            var commands = accounts.Select(a => new ExpireAccountFundsCommand { AccountId = a.Id });

            var tasks = commands.Select(c =>
            {
                var sendOptions = new SendOptions();

                sendOptions.RequireImmediateDispatch();
                sendOptions.SetMessageId($"{nameof(ExpireAccountFundsCommand)}-{now.Year}-{now.Month}-{c.AccountId}");

                return _messageSession.Send(c, sendOptions);
            });

            await Task.WhenAll(tasks);

            logger.LogInformation($"{nameof(ExpireFundsJob)} completed.");
        }
    }
}

Add logging to webjob start and end

[CON-2942] Add logging to webjob start and end


using System;
using System.Collections.Generic;
using AgateLib;
using AgateLib.DisplayLib;
using AgateLib.Geometry;
using AgateLib.InputLib;

namespace Tests.DisplayTests
{
	class FullscreenTest : IAgateTest
	{
		public string Name
		{
			get { return "Full Screen"; }
		}

		public string Category
		{
			get { return "Display"; }
		}

		public void Main(string[] args)
		{
			using (AgateSetup setup = new AgateSetup(args))
			{
				setup.InitializeAll();
				if (setup.WasCanceled)
					return;

				DisplayWindow wind = DisplayWindow.CreateFullScreen("Hello World", 640, 480);
				Surface mySurface = new Surface("jellybean.png");

				// Run the program while the window is open.
				while (Display.CurrentWindow.IsClosed == false &&
					Keyboard.Keys[KeyCode.Escape] == false)
				{
					Display.BeginFrame();
					Display.Clear(Color.DarkGreen);
					mySurface.Draw(Mouse.X, Mouse.Y);
					Display.EndFrame();
					Core.KeepAlive();
				}
			}
		}

	}
}

using System;
using System.Collections.Generic;
using AgateLib;
using AgateLib.DisplayLib;
using AgateLib.Geometry;
using AgateLib.InputLib;

namespace Tests.DisplayTests
{
	class FullscreenTest : IAgateTest
	{
		public string Name
		{
			get { return "Full Screen"; }
		}

		public string Category
		{
			get { return "Display"; }
		}

		string text = "Press Esc or Tilde to exit." + Environment.NewLine + "Starting Text";

		public void Main(string[] args)
		{
			using (AgateSetup setup = new AgateSetup(args))
			{
				setup.InitializeAll();
				if (setup.WasCanceled)
					return;

				DisplayWindow wind = DisplayWindow.CreateFullScreen("Hello World", 640, 480);
				Surface mySurface = new Surface("jellybean.png");

				Keyboard.KeyDown += new InputEventHandler(Keyboard_KeyDown);
				FontSurface font = FontSurface.AgateSans14;

				// Run the program while the window is open.
				while (Display.CurrentWindow.IsClosed == false &&
					Keyboard.Keys[KeyCode.Escape] == false &&
					Keyboard.Keys[KeyCode.Tilde] == false)
				{
					Display.BeginFrame();
					Display.Clear(Color.DarkGreen);

					font.DrawText(text);
					mySurface.Draw(Mouse.X, Mouse.Y);

					Display.EndFrame();
					Core.KeepAlive();
				}
			}
		}

		void Keyboard_KeyDown(InputEventArgs e)
		{
			text += e.KeyString;
		}

	}
}

Add text to fullscreen test.

Add text to fullscreen test.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Frenetic.TagHandlers;
using Frenetic.TagHandlers.Objects;
using Voxalia.ServerGame.TagSystem.TagObjects;
using Voxalia.ServerGame.ServerMainSystem;
using Voxalia.ServerGame.EntitySystem;
using Voxalia.Shared;

namespace Voxalia.ServerGame.TagSystem.TagBases
{
    class PlayerTagBase : TemplateTags
    {
        Server TheServer;

        // <--[tag]
        // @Base player[<TextTag>]
        // @Group Entities
        // @ReturnType PlayerTag
        // @Returns the player with the given name.
        // -->
        public PlayerTagBase(Server tserver)
        {
            Name = "player";
            TheServer = tserver;
        }

        public override string Handle(TagData data)
        {
            string pname = data.GetModifier(0).ToLower();
            foreach (PlayerEntity player in TheServer.Players)
            {
                if (player.Name.ToLower() == pname)
                {
                    return new PlayerTag(player).Handle(data.Shrink());
                }
            }
            return new TextTag("{NULL}").Handle(data.Shrink());
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Frenetic.TagHandlers;
using Frenetic.TagHandlers.Objects;
using Voxalia.ServerGame.TagSystem.TagObjects;
using Voxalia.ServerGame.ServerMainSystem;
using Voxalia.ServerGame.EntitySystem;
using Voxalia.Shared;

namespace Voxalia.ServerGame.TagSystem.TagBases
{
    class PlayerTagBase : TemplateTags
    {
        Server TheServer;

        // <--[tag]
        // @Base player[<TextTag>]
        // @Group Entities
        // @ReturnType PlayerTag
        // @Returns the player with the given name.
        // -->
        public PlayerTagBase(Server tserver)
        {
            Name = "player";
            TheServer = tserver;
        }

        public override string Handle(TagData data)
        {
            string pname = data.GetModifier(0).ToLower();
            long pid;
            if (long.TryParse(pname, out pid))
            {
                foreach (PlayerEntity player in TheServer.Players)
                {
                    if (player.EID == pid)
                    {
                        return new PlayerTag(player).Handle(data.Shrink());
                    }
                }
            }
            else
            {
                foreach (PlayerEntity player in TheServer.Players)
                {
                    if (player.Name.ToLower() == pname)
                    {
                        return new PlayerTag(player).Handle(data.Shrink());
                    }
                }
            }
            return new TextTag("{NULL}").Handle(data.Shrink());
        }
    }
}

Extend PlayerTags to accept name or entityID


using System.Collections.Generic;
using Promact.Trappist.DomainModel.Models.Question;
using System.Linq;
using Promact.Trappist.DomainModel.DbContext;

namespace Promact.Trappist.Repository.Questions
{
    public class QuestionRepository : IQuestionRepository
    {
        private readonly TrappistDbContext _dbContext;

        public QuestionRepository(TrappistDbContext dbContext)
        {
            _dbContext = dbContext;
        }

        /// <summary>
        /// Get all questions
        /// </summary>
        /// <returns>Question list</returns>
        public List<SingleMultipleAnswerQuestion> GetAllQuestions()
        {
            var questions = _dbContext.SingleMultipleAnswerQuestion.ToList();
            return questions;
        }
        /// <summary>
        /// Add single multiple answer question into SingleMultipleAnswerQuestion model
        /// </summary>
        /// <param name="singleMultipleAnswerQuestion"></param>
        public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion)
        {
            _dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion);
            _dbContext.SaveChanges();
        }
        /// <summary>
        /// Add option of single multiple answer question into SingleMultipleAnswerQuestionOption model
        /// </summary>
        /// <param name="singleMultipleAnswerQuestion"></param>
        public void AddSingleMultipleAnswerQuestionOption(SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOption)
        {
            _dbContext.SingleMultipleAnswerQuestionOption.Add(singleMultipleAnswerQuestionOption);
            _dbContext.SaveChanges();
        }

    }
}

Create server side API for single multiple answer question


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

// TODO: Generate this file!
// This file contains partial classes for all event data messages, to apply
// the converter attributes to them.

namespace Google.Events.Protobuf.Cloud.PubSub.V1
{
    [CloudEventDataConverter(typeof(ProtobufCloudEventDataConverter<PubsubMessage>))]
    public partial class PubsubMessage { }
}

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

// TODO: Generate this file!
// This file contains partial classes for all event data messages, to apply
// the converter attributes to them.

namespace Google.Events.Protobuf.Cloud.PubSub.V1
{
    [CloudEventDataConverter(typeof(ProtobufCloudEventDataConverter<MessagePublishedData>))]
    public partial class MessagePublishedData { }
}

Fix PubSub converter attribute in protobuf

PubsubMessage is now wrapped by MessagePublishedData


using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Extensions.DependencyInjection;
using PPTail.Entities;
using PPTail.Interfaces;

namespace PPTail
{
    public class Program
    {
        public static void Main(string[] args)
        {
            (var argsAreValid, var argumentErrrors) = args.ValidateArguments();

            if (argsAreValid)
            {
                var (sourceConnection, targetConnection, templateConnection) = args.ParseArguments();

                var settings = (null as ISettings).Create(sourceConnection, targetConnection, templateConnection);
                var templates = (null as IEnumerable<Template>).Create(templateConnection);

                var container = (null as IServiceCollection).Create(settings, templates);
                var serviceProvider = container.BuildServiceProvider();

                // TODO: Move data load here -- outside of the build process
                //var contentRepos = serviceProvider.GetServices<IContentRepository>();
                //var contentRepo = contentRepos.First(); // TODO: Implement properly

                var siteBuilder = serviceProvider.GetService<ISiteBuilder>();
                var sitePages = siteBuilder.Build();

                // TODO: Change this to use the named provider specified in the input args
                var outputRepo = serviceProvider.GetService<Interfaces.IOutputRepository>();
                outputRepo.Save(sitePages);
            }
            else
            {
                // TODO: Display argument errors to user
                throw new NotImplementedException();
            }
        }

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Extensions.DependencyInjection;
using PPTail.Entities;
using PPTail.Interfaces;
using PPTail.Extensions;

namespace PPTail
{
    public class Program
    {
        const string _connectionStringProviderKey = "Provider";

        public static void Main(string[] args)
        {
            (var argsAreValid, var argumentErrrors) = args.ValidateArguments();

            if (argsAreValid)
            {
                var (sourceConnection, targetConnection, templateConnection) = args.ParseArguments();

                var settings = (null as ISettings).Create(sourceConnection, targetConnection, templateConnection);
                var templates = (null as IEnumerable<Template>).Create(templateConnection);

                var container = (null as IServiceCollection).Create(settings, templates);
                var serviceProvider = container.BuildServiceProvider();

                // Generate the website pages
                var siteBuilder = serviceProvider.GetService<ISiteBuilder>();
                var sitePages = siteBuilder.Build();

                // Store the resulting output
                var outputRepoInstanceName = settings.TargetConnection.GetConnectionStringValue(_connectionStringProviderKey);
                var outputRepo = serviceProvider.GetNamedService<IOutputRepository>(outputRepoInstanceName);
                outputRepo.Save(sitePages);
            }
            else
            {
                // TODO: Display argument errors to user
                throw new NotImplementedException();
            }
        }

    }
}

Make the system respect the Target ConnectionString Provider designation.


using System.Collections.Generic;
using System.Linq;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authentication;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Wukong.Models;

namespace Wukong.Controllers
{
    [Route("oauth")]
    public class AuthController : Controller
    {
        [HttpGet("all")]
        public IEnumerable<OAuthMethod> AllSchemes()
        {
            return
                new List<OAuthMethod>{ new OAuthMethod()
                {
                    Scheme = "Microsoft",
                    DisplayName = "Microsoft",
                    Url = $"/oauth/go/{OpenIdConnectDefaults.AuthenticationScheme}"
                }};
        }

        [HttpGet("go/{any}")]
        public async Task SignIn(string any, string redirectUri = "/")
        {
            await HttpContext.ChallengeAsync(
                OpenIdConnectDefaults.AuthenticationScheme,
                new AuthenticationProperties {
                    RedirectUri = redirectUri,
                    IsPersistent = true
                });
        }

        [HttpGet("signout")]
        public SignOutResult SignOut(string redirectUrl = "/")
        {
            return SignOut(new AuthenticationProperties { RedirectUri = redirectUrl },
                CookieAuthenticationDefaults.AuthenticationScheme,
                OpenIdConnectDefaults.AuthenticationScheme);
        }
    }
}

using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Authentication;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication.Cookies;
using Microsoft.AspNetCore.Authentication.OpenIdConnect;
using Wukong.Models;

namespace Wukong.Controllers
{
    [Route("oauth")]
    public class AuthController : Controller
    {
        [HttpGet("all")]
        public IEnumerable<OAuthMethod> AllSchemes()
        {
            return
                new List<OAuthMethod>{ new OAuthMethod()
                {
                    Scheme = "Microsoft",
                    DisplayName = "Microsoft",
                    Url = $"/oauth/go/{OpenIdConnectDefaults.AuthenticationScheme}"
                }};
        }

        [HttpGet("go/{any}")]
        public async Task SignIn(string any, string redirectUri = "/")
        {
            await HttpContext.ChallengeAsync(
                OpenIdConnectDefaults.AuthenticationScheme,
                new AuthenticationProperties {
                    RedirectUri = redirectUri,
                    IsPersistent = true,
                    ExpiresUtc = System.DateTime.UtcNow.AddDays(30)
                });
        }

        [HttpGet("signout")]
        public SignOutResult SignOut(string redirectUrl = "/")
        {
            return SignOut(new AuthenticationProperties { RedirectUri = redirectUrl },
                CookieAuthenticationDefaults.AuthenticationScheme,
                OpenIdConnectDefaults.AuthenticationScheme);
        }
    }
}

Make cookie valid for 30 days.

Make cookie valid for 30 days.


using System.IO;
using System.Reflection;
using NUnit.Framework;

public class GitHubAssemblyTests
{
    [Theory]
    public void GitHub_Assembly_Should_Not_Reference_DesignTime_Assembly(string assemblyFile)
    {
        var asm = Assembly.LoadFrom(assemblyFile);
        foreach (var referencedAssembly in asm.GetReferencedAssemblies())
        {
            Assert.That(referencedAssembly.Name, Does.Not.EndWith(".DesignTime"),
                "DesignTime assemblies should be embedded not referenced");
        }
    }

    [DatapointSource]
    string[] GitHubAssemblies => Directory.GetFiles(AssemblyDirectory, "GitHub.*.dll");

    string AssemblyDirectory => Path.GetDirectoryName(GetType().Assembly.Location);
}

using System;
using System.IO;
using System.Reflection;
using NUnit.Framework;

public class GitHubAssemblyTests
{
    [Theory]
    public void GitHub_Assembly_Should_Not_Reference_DesignTime_Assembly(string assemblyFile)
    {
        var asm = Assembly.LoadFrom(assemblyFile);
        foreach (var referencedAssembly in asm.GetReferencedAssemblies())
        {
            Assert.That(referencedAssembly.Name, Does.Not.EndWith(".DesignTime"),
                "DesignTime assemblies should be embedded not referenced");
        }
    }

    [Theory]
    public void GitHub_Assembly_Should_Not_Reference_System_Net_Http_Above_4_0(string assemblyFile)
    {
        var asm = Assembly.LoadFrom(assemblyFile);
        foreach (var referencedAssembly in asm.GetReferencedAssemblies())
        {
            if (referencedAssembly.Name == "System.Net.Http")
            {
                Assert.That(referencedAssembly.Version, Is.EqualTo(new Version("4.0.0.0")));
            }
        }
    }

    [DatapointSource]
    string[] GitHubAssemblies => Directory.GetFiles(AssemblyDirectory, "GitHub.*.dll");

    string AssemblyDirectory => Path.GetDirectoryName(GetType().Assembly.Location);
}

Check assemblies reference System.Net.Http v4.0

Check all GitHub.* assemblies reference System.Net.Http v4.0.0.0.


using System;
using Quartz.Impl.Calendar;
using Xunit;

namespace Quartz.DynamoDB.Tests
{
    /// <summary>
    /// Tests the DynamoCalendar serialisation for all quartz derived calendar types.
    /// </summary>
    public class CalendarSerialisationTests
    {
        [Fact]
        [Trait("Category", "Unit")]
        public void BaseCalendarDescription()
        {
            BaseCalendar cal = new BaseCalendar() { Description = "Hi mum" };

            var sut = new DynamoCalendar("test", cal);
            var serialised = sut.ToDynamo();
            var deserialised = new DynamoCalendar(serialised);

            Assert.Equal(sut.Description, deserialised.Description);
        }
    }
}

using System;
using Quartz.Impl.Calendar;
using Xunit;

namespace Quartz.DynamoDB.Tests
{
    /// <summary>
    /// Tests the DynamoCalendar serialisation for all quartz derived calendar types.
    /// </summary>
    public class CalendarSerialisationTests
    {
        /// <summary>
        /// Tests that the description property of the base calendar type serialises and deserialises correctly.
        /// </summary>
        /// <returns>The calendar description.</returns>
        [Fact]
        [Trait("Category", "Unit")]
        public void BaseCalendarDescription()
        {
            BaseCalendar cal = new BaseCalendar() { Description = "Hi mum" };

            var sut = new DynamoCalendar("test", cal);
            var serialised = sut.ToDynamo();
            var deserialised = new DynamoCalendar(serialised);

            Assert.Equal(sut.Description, deserialised.Description);
        }

        /// <summary>
        /// Tests that the excluded days property of the annual calendar serialises and deserialises correctly.
        /// </summary>
        [Fact]
        [Trait("Category", "Unit")]
        public void Annual()
        {
            var importantDate = new DateTime(2015, 04, 02);

            AnnualCalendar cal = new AnnualCalendar();
            cal.SetDayExcluded(DateTime.Today, true);
            cal.SetDayExcluded(importantDate, true);

            var sut = new DynamoCalendar("test", cal);
            var serialised = sut.ToDynamo();
            var deserialised = new DynamoCalendar(serialised);

            Assert.True(((AnnualCalendar)deserialised.Calendar).IsDayExcluded(DateTime.Today));
            Assert.True(((AnnualCalendar)deserialised.Calendar).IsDayExcluded(importantDate));
        }
    }
}

Add unit test for annual calendar

Add unit test for annual calendar


using KitKare.Data.Models;
using KitKare.Data.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using AutoMapper.QueryableExtensions;
using KitKare.Server.ViewModels;

namespace KitKare.Server.Controllers
{
    public class ValuesController : ApiController
    {
        private IRepository<User> users;

        public ValuesController(IRepository<User> users)
        {
            this.users = users;
        }

        // GET api/values
        public IEnumerable<string> Get()
        {
            var user = this.users.All().ProjectTo<ProfileViewModel>().FirstOrDefault();

            return new string[] { "value1", "value2" };
        }

        // GET api/values/5
        public string Get(int id)
        {
            return "value";
        }

        // POST api/values
        public void Post([FromBody]string value)
        {
        }

        // PUT api/values/5
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE api/values/5
        public void Delete(int id)
        {
        }
    }
}

using KitKare.Data.Models;
using KitKare.Data.Repositories;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using AutoMapper.QueryableExtensions;
using KitKare.Server.ViewModels;

namespace KitKare.Server.Controllers
{
    public class ValuesController : ApiController
    {
        private IRepository<User> users;

        public ValuesController(IRepository<User> users)
        {
            this.users = users;
        }

        // GET api/values
        public IEnumerable<string> Get()
        {
            try
            {
                var user = this.users.All().ProjectTo<ProfileViewModel>().FirstOrDefault();
                return new string[] { "value1", "value2" };

            }
            catch (Exception e)
            {
                return new string[] { e.Message };
            }
        }

        // GET api/values/5
        public string Get(int id)
        {
            return "value";
        }

        // POST api/values
        public void Post([FromBody]string value)
        {
        }

        // PUT api/values/5
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE api/values/5
        public void Delete(int id)
        {
        }
    }
}

Debug try catch added to values controller


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

namespace ILCompiler.DependencyAnalysisFramework
{
    public interface IDependencyNode
    {
        bool Marked
        {
            get;
        }
    }

    public interface IDependencyNode<DependencyContextType> : IDependencyNode
    {
        bool InterestingForDynamicDependencyAnalysis
        {
            get;
        }

        bool HasDynamicDependencies
        {
            get;
        }

        bool HasConditionalStaticDependencies
        {
            get;
        }

        bool StaticDependenciesAreComputed
        {
            get;
        }

        IEnumerable<DependencyNodeCore<DependencyContextType>.DependencyListEntry> GetStaticDependencies(DependencyContextType context);

        IEnumerable<DependencyNodeCore<DependencyContextType>.CombinedDependencyListEntry> GetConditionalStaticDependencies(DependencyContextType context);

        IEnumerable<DependencyNodeCore<DependencyContextType>.CombinedDependencyListEntry> SearchDynamicDependencies(List<DependencyNodeCore<DependencyContextType>> markedNodes, int firstNode, DependencyContextType context);
    }
}

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

using System.Collections.Generic;

namespace ILCompiler.DependencyAnalysisFramework
{
    public interface IDependencyNode
    {
        bool Marked
        {
            get;
        }
    }

    public interface IDependencyNode<DependencyContextType> : IDependencyNode
    {
        bool InterestingForDynamicDependencyAnalysis
        {
            get;
        }

        bool HasDynamicDependencies
        {
            get;
        }

        bool HasConditionalStaticDependencies
        {
            get;
        }

        bool StaticDependenciesAreComputed
        {
            get;
        }

        IEnumerable<DependencyNodeCore<DependencyContextType>.DependencyListEntry> GetStaticDependencies(DependencyContextType context);

        IEnumerable<DependencyNodeCore<DependencyContextType>.CombinedDependencyListEntry> GetConditionalStaticDependencies(DependencyContextType context);

        IEnumerable<DependencyNodeCore<DependencyContextType>.CombinedDependencyListEntry> SearchDynamicDependencies(List<DependencyNodeCore<DependencyContextType>> markedNodes, int firstNode, DependencyContextType context);
    }
}

Add copyright header to new file

Add copyright header to new file

[tfs-changeset: 1650235]


using System.Collections.Generic;

namespace Casper {
	public class MSBuild : TaskBase {
		public string WorkingDirectory { get; set; }
		public string ProjectFile {	get; set; }
		public string[] Targets { get; set; }
		public IDictionary<string, string> Properties { get; set; }

		public override void Execute() {

			List<string> args = new List<string>();
			if (null != ProjectFile) {
				args.Add(ProjectFile);
			}
			if (null != Targets) {
				args.Add("/t:" + string.Join(";", Targets));
			}
			if (null != Properties) {
				foreach (var entry in Properties) {
					args.Add("/p:" + entry.Key + "=" + entry.Value);
				}
			}

			var exec = new Exec {
				WorkingDirectory = WorkingDirectory,
				Executable = "xbuild",
				Arguments = string.Join(" ", args),
			};
			exec.Execute();
		}
	}
}

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

namespace Casper {
	public class MSBuild : TaskBase {
		public string WorkingDirectory { get; set; }
		public string ProjectFile {	get; set; }
		public IList Targets { get; set; }
		public IDictionary Properties { get; set; }

		public override void Execute() {

			List<string> args = new List<string>();
			if (null != ProjectFile) {
				args.Add(ProjectFile);
			}
			if (null != Targets) {
				args.Add("/t:" + string.Join(";", Targets));
			}
			if (null != Properties) {
				foreach (var propertyName in Properties.Keys) {
					args.Add("/p:" + propertyName + "=" + Properties[propertyName]);
				}
			}

			var exec = new Exec {
				WorkingDirectory = WorkingDirectory,
				Executable = "xbuild",
				Arguments = string.Join(" ", args),
			};
			exec.Execute();
		}
	}
}

Change property types to better match up with Boo syntax


using System;
using System.Collections.Generic;

namespace Cosmos.TestRunner.Core
{
    public static class TestKernelSets
    {
        public static IEnumerable<Type> GetStableKernelTypes()
        {
            yield return typeof(VGACompilerCrash.Kernel);
            ////yield return typeof(Cosmos.Compiler.Tests.Encryption.Kernel);
            //yield return typeof(Cosmos.Compiler.Tests.Bcl.Kernel);
            //yield return typeof(Cosmos.Compiler.Tests.SingleEchoTest.Kernel);
            //yield return typeof(Cosmos.Compiler.Tests.SimpleWriteLine.Kernel.Kernel);
            //yield return typeof(SimpleStructsAndArraysTest.Kernel);
            //yield return typeof(Cosmos.Compiler.Tests.Exceptions.Kernel);
            //yield return typeof(Cosmos.Compiler.Tests.LinqTests.Kernel);
            //yield return typeof(Cosmos.Compiler.Tests.MethodTests.Kernel);
            yield return typeof(Cosmos.Kernel.Tests.Fat.Kernel);
            ////yield return typeof(FrotzKernel.Kernel);
        }
    }
}

using System;
using System.Collections.Generic;

namespace Cosmos.TestRunner.Core
{
    public static class TestKernelSets
    {
        public static IEnumerable<Type> GetStableKernelTypes()
        {
            yield return typeof(VGACompilerCrash.Kernel);
            //yield return typeof(Cosmos.Compiler.Tests.Encryption.Kernel);
            yield return typeof(Cosmos.Compiler.Tests.Bcl.Kernel);
            yield return typeof(Cosmos.Compiler.Tests.SingleEchoTest.Kernel);
            yield return typeof(Cosmos.Compiler.Tests.SimpleWriteLine.Kernel.Kernel);
            yield return typeof(SimpleStructsAndArraysTest.Kernel);
            yield return typeof(Cosmos.Compiler.Tests.Exceptions.Kernel);
            yield return typeof(Cosmos.Compiler.Tests.LinqTests.Kernel);
            yield return typeof(Cosmos.Compiler.Tests.MethodTests.Kernel);
            //yield return typeof(Cosmos.Kernel.Tests.Fat.Kernel);
            //yield return typeof(FrotzKernel.Kernel);
        }
    }
}

Enable all kernels except FAT.

Enable all kernels except FAT.


using System;
using BudgetAnalyser.Engine.BankAccount;
using BudgetAnalyser.Engine.Budget;
using JetBrains.Annotations;

namespace BudgetAnalyser.Engine.Statement.Data
{
    [AutoRegisterWithIoC]
    internal partial class Mapper_TransactionDto_Transaction
    {
        private readonly IAccountTypeRepository accountRepo;
        private readonly IBudgetBucketRepository bucketRepo;
        private readonly ITransactionTypeRepository transactionTypeRepo;

        public Mapper_TransactionDto_Transaction([NotNull] IAccountTypeRepository accountRepo, [NotNull] IBudgetBucketRepository bucketRepo, [NotNull] ITransactionTypeRepository transactionTypeRepo)
        {
            if (accountRepo == null) throw new ArgumentNullException(nameof(accountRepo));
            if (bucketRepo == null) throw new ArgumentNullException(nameof(bucketRepo));
            if (transactionTypeRepo == null) throw new ArgumentNullException(nameof(transactionTypeRepo));
            this.accountRepo = accountRepo;
            this.bucketRepo = bucketRepo;
            this.transactionTypeRepo = transactionTypeRepo;
        }

        partial void ToDtoPostprocessing(ref TransactionDto dto, Transaction model)
        {
            dto.Account = model.Account.Name;
            dto.BudgetBucketCode = model.BudgetBucket.Code;
            dto.TransactionType = model.TransactionType.Name;
        }

        partial void ToModelPostprocessing(TransactionDto dto, ref Transaction model)
        {
            // TODO do these need to be added to the repo here?
            model.Account = this.accountRepo.GetByKey(dto.Account);
            model.BudgetBucket = this.bucketRepo.GetByCode(dto.BudgetBucketCode);
            model.TransactionType = this.transactionTypeRepo.GetOrCreateNew(dto.TransactionType);
        }
    }
}

using System;
using BudgetAnalyser.Engine.BankAccount;
using BudgetAnalyser.Engine.Budget;
using JetBrains.Annotations;

namespace BudgetAnalyser.Engine.Statement.Data
{
    [AutoRegisterWithIoC]
    internal partial class Mapper_TransactionDto_Transaction
    {
        private readonly IAccountTypeRepository accountRepo;
        private readonly IBudgetBucketRepository bucketRepo;
        private readonly ITransactionTypeRepository transactionTypeRepo;

        public Mapper_TransactionDto_Transaction([NotNull] IAccountTypeRepository accountRepo, [NotNull] IBudgetBucketRepository bucketRepo, [NotNull] ITransactionTypeRepository transactionTypeRepo)
        {
            if (accountRepo == null) throw new ArgumentNullException(nameof(accountRepo));
            if (bucketRepo == null) throw new ArgumentNullException(nameof(bucketRepo));
            if (transactionTypeRepo == null) throw new ArgumentNullException(nameof(transactionTypeRepo));
            this.accountRepo = accountRepo;
            this.bucketRepo = bucketRepo;
            this.transactionTypeRepo = transactionTypeRepo;
        }

        partial void ToDtoPostprocessing(ref TransactionDto dto, Transaction model)
        {
            dto.Account = model.Account.Name;
            dto.BudgetBucketCode = model.BudgetBucket?.Code;
            dto.TransactionType = model.TransactionType.Name;
        }

        partial void ToModelPostprocessing(TransactionDto dto, ref Transaction model)
        {
            // TODO do these need to be added to the repo here?
            model.Account = this.accountRepo.GetByKey(dto.Account);
            model.BudgetBucket = this.bucketRepo.GetByCode(dto.BudgetBucketCode);
            model.TransactionType = this.transactionTypeRepo.GetOrCreateNew(dto.TransactionType);
        }
    }
}

Fix bug in Statement DTO mapper that expected bucket code to always have a value - it can be null.


namespace Vlc.DotNet.Core
{
    public interface IAudioManagement
    {
        IAudioOutputsManagement Outputs { get; }
    }
}

namespace Vlc.DotNet.Core
{
    public interface IAudioManagement
    {
        IAudioOutputsManagement Outputs { get; }

        bool IsMute { get; set; }

        void ToggleMute();

        int Volume { get; set; }

        ITracksManagement Tracks { get; }

        int Channel { get; set; }

        long Delay { get; set; }
    }
}

Add Audio properties to IAudiomanagement


using System.Collections.Generic;

namespace JetBrains.ReSharper.Plugins.PresentationAssistant
{
    public static class ActionIdBlacklist
    {
        private static readonly HashSet<string> ActionIds = new HashSet<string>
        {
            // These are the only actions that should be hidden
            "TextControl.Backspace",
            "TextControl.Delete",
            "TextControl.Cut",
            "TextControl.Paste",
            "TextControl.Copy",

            // Used when code completion window is visible
            "TextControl.Up", "TextControl.Down",
            "TextControl.PageUp", "TextControl.PageDown",

            // If camel humps are enabled in the editor
            "TextControl.PreviousWord",
            "TextControl.PreviousWord.Selection",
            "TextControl.NextWord",
            "TextControl.NextWord.Selection",

            // VS commands, not R# commands
            "Edit.Up", "Edit.Down", "Edit.Left", "Edit.Right", "Edit.PageUp", "Edit.PageDown",

            // Make sure we don't try to show the presentation assistant popup just as we're
            // killing the popups
            PresentationAssistantAction.ActionId
        };

        public static bool IsBlacklisted(string actionId)
        {
            return ActionIds.Contains(actionId);
        }
    }
}

using System.Collections.Generic;

namespace JetBrains.ReSharper.Plugins.PresentationAssistant
{
    public static class ActionIdBlacklist
    {
        private static readonly HashSet<string> ActionIds = new HashSet<string>
        {
            // These are the only actions that should be hidden
            "TextControl.Backspace",
            "TextControl.Delete",
            "TextControl.Cut",
            "TextControl.Paste",
            "TextControl.Copy",

            "TextControl.Left", "TextControl.Right",
            "TextControl.Left.Selection", "TextControl.Right.Selection",
            "TextControl.Up", "TextControl.Down",
            "TextControl.Up.Selection", "TextControl.Down.Selection",
            "TextControl.Home", "TextControl.End",
            "TextControl.Home.Selection", "TextControl.End.Selection",
            "TextControl.PageUp", "TextControl.PageDown",
            "TextControl.PageUp.Selection", "TextControl.PageDown.Selection",
             "TextControl.PreviousWord", "TextControl.NextWord",
            "TextControl.PreviousWord.Selection", "TextControl.NextWord.Selection",

            // VS commands, not R# commands
            "Edit.Up", "Edit.Down", "Edit.Left", "Edit.Right", "Edit.PageUp", "Edit.PageDown",

            // Make sure we don't try to show the presentation assistant popup just as we're
            // killing the popups
            PresentationAssistantAction.ActionId
        };

        public static bool IsBlacklisted(string actionId)
        {
            return ActionIds.Contains(actionId);
        }
    }
}

Improve text control black list

Improve text control black list


using System.Runtime.Serialization;

namespace Nest
{
	public enum StringFielddataFormat
	{
		[EnumMember(Value = "paged_bytes")]
		PagedBytes,
		[EnumMember(Value = "doc_values")]
		DocValues,
		[EnumMember(Value = "disabled")]
		Disabled
	}
}

using System.Runtime.Serialization;

namespace Nest
{
	public enum StringFielddataFormat
	{
		[EnumMember(Value = "paged_bytes")]
		PagedBytes,
		[EnumMember(Value = "disabled")]
		Disabled
	}
}

Remove doc_values fielddata format for strings

Looks like this was deprecated in 2.0 - https://www.elastic.co/guide/en/elasticsearch/reference/2.0/fielddata.html#fielddata-format
Will mark as obsolete in 2.x branch with note that removed in 5.0


using System;
using Humanizer;

namespace Repack
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            Console.WriteLine("Usage:   repack [date]");
            Console.WriteLine("Prints how long it is until your birthday.");
            Console.WriteLine("If you don't supply your birthday, it uses mine.");

            DateTime birthDay = GetBirthday(args);
            Console.WriteLine();

            var span = GetSpan(birthDay);

            Console.WriteLine("{0} until your birthday", span.Humanize());
        }

        private static TimeSpan GetSpan(DateTime birthDay)
        {
            if (birthDay < DateTime.Now)
            {
                if (birthDay.Year < DateTime.Now.Year)
                {
                    return GetSpan(new DateTime(DateTime.Now.Year, birthDay.Month, birthDay.Day));
                }
                else
                {
                    return GetSpan(new DateTime(DateTime.Now.Year + 1, birthDay.Month, birthDay.Day));
                }
            }
            var span = birthDay - DateTime.Now;
            return span;
        }

        private static DateTime GetBirthday(string[] args)
        {
            string day = null;
            if (args != null && args.Length > 0)
            {
                day = args[0];
            }

            return GetBirthday(day);
        }

        private static DateTime GetBirthday(string day)
        {
            DateTime parsed;
            if (DateTime.TryParse(day, out parsed))
            {
                return parsed;
            }
            else
            {
                return new DateTime(DateTime.Now.Year, 8, 20);
            }
        }
    }
}

using System;
using Humanizer;

namespace Repack
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            Console.WriteLine("Usage:   repack [date]");
            Console.WriteLine("Prints how long it is until your birthday.");
            Console.WriteLine("If you don't supply your birthday, it uses mine.");

            DateTime birthDay = GetBirthday(args);
            Console.WriteLine();

            var span = GetSpan(birthDay);

            Console.WriteLine("{0} until your birthday", span.Humanize());
        }

        private static TimeSpan GetSpan(DateTime birthDay)
        {
            var span = birthDay - DateTime.Now;

            if (span.Days < 0)
            {
                // If the supplied birthday has already happened, then find the next one that will occur.
                int years = span.Days / -365;
                span = span.Add(TimeSpan.FromDays((years + 1) * 365));
            }

            return span;
        }

        private static DateTime GetBirthday(string[] args)
        {
            string day = null;
            if (args != null && args.Length > 0)
            {
                day = args[0];
            }

            return GetBirthday(day);
        }

        private static DateTime GetBirthday(string day)
        {
            DateTime parsed;
            if (DateTime.TryParse(day, out parsed))
            {
                return parsed;
            }
            else
            {
                return new DateTime(DateTime.Now.Year, 8, 20);
            }
        }
    }
}

Simplify the code that ensures a birthday is in the future.


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

namespace Builder
{
    public class Options
    {
        [Option('a', "buildDir", Required = true, HelpText = "")]
        public string BuildDir { get; set; }

        [Option('b', "buildArtifactsCacheDir", Required = false, HelpText = "")]
        public string BuildArtifactsCacheDir { get; set; }

        [Option('o', "buildpackOrder", Required = false, HelpText = "")]
        public string BuildpackOrder { get; set; }

        [Option('e', "buildpacksDir", Required = false, HelpText = "")]
        public string BuildpacksDir { get; set; }

        [Option('c', "outputBuildArtifactsCache", Required = false, HelpText = "")]
        public string OutputBuildArtifactsCache { get; set; }

        [Option('d', "outputDroplet", Required = true, HelpText = "")]
        public string OutputDroplet { get; set; }

        [Option('m', "outputMetadata", Required = true, HelpText = "")]
        public string OutputMetadata { get; set; }

        [Option('s', "skipCertVerify", Required = false, HelpText = "")]
        public string SkipCertVerify { get; set; }

        [HelpOption]
        public string GetUsage()
        {
            return HelpText.AutoBuild(this,
              (HelpText current) => HelpText.DefaultParsingErrorsHandler(this, current));
        }
    }
}

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

namespace Builder
{
    public class Options
    {
        [Option('a', "buildDir", Required = true, HelpText = "")]
        public string BuildDir { get; set; }

        [Option('b', "buildArtifactsCacheDir", Required = false, HelpText = "")]
        public string BuildArtifactsCacheDir { get; set; }

        [Option('o', "buildpackOrder", Required = false, HelpText = "")]
        public string BuildpackOrder { get; set; }

        [Option('e', "buildpacksDir", Required = false, HelpText = "")]
        public string BuildpacksDir { get; set; }

        [Option('c', "outputBuildArtifactsCache", Required = false, HelpText = "")]
        public string OutputBuildArtifactsCache { get; set; }

        [Option('d', "outputDroplet", Required = true, HelpText = "")]
        public string OutputDroplet { get; set; }

        [Option('m', "outputMetadata", Required = true, HelpText = "")]
        public string OutputMetadata { get; set; }

        [Option('s', "skipCertVerify", Required = false, HelpText = "")]
        public string SkipCertVerify { get; set; }

        [Option('k', "skipDetect", Required = false, HelpText = "")]
        public string skipDetect { get; set; }

        [HelpOption]
        public string GetUsage()
        {
            return HelpText.AutoBuild(this,
              (HelpText current) => HelpText.DefaultParsingErrorsHandler(this, current));
        }
    }
}

Add new command option "skipDetect"

Add new command option "skipDetect"

Our cmd line parser currently blows up if it receives a param it does not
know about, and thus the new "skipDetect" arg has to be added to the list.


using LogicalShift.Reason.Api;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace LogicalShift.Reason.Solvers
{
    /// <summary>
    /// Represents a solver that can solve a single clause
    /// </summary>
    public class SimpleSingleClauseSolver : ISolver
    {
        /// <summary>
        /// The clause that this will solve
        /// </summary>
        private readonly IClause _clause;

        /// <summary>
        /// The solver that will be used for subclauses
        /// </summary>
        private readonly ISolver _subclauseSolver;

        public SimpleSingleClauseSolver(IClause clause, ISolver subclauseSolver)
        {
            if (clause == null) throw new ArgumentNullException("clause");
            if (subclauseSolver == null) throw new ArgumentNullException("subclauseSolver");

            _clause = clause;
            _subclauseSolver = subclauseSolver;
        }

        public Task<IQueryResult> Solve(IEnumerable<ILiteral> goals)
        {
            throw new NotImplementedException();
        }

        public Func<bool> Call(ILiteral predicate, params IReferenceLiteral[] arguments)
        {
            throw new NotImplementedException();
        }
    }
}

using LogicalShift.Reason.Api;
using LogicalShift.Reason.Assignment;
using LogicalShift.Reason.Literals;
using LogicalShift.Reason.Unification;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace LogicalShift.Reason.Solvers
{
    /// <summary>
    /// Represents a solver that can solve a single clause
    /// </summary>
    public class SimpleSingleClauseSolver : ISolver
    {
        /// <summary>
        /// The clause that this will solve
        /// </summary>
        private readonly IClause _clause;

        /// <summary>
        /// The solver that will be used for subclauses
        /// </summary>
        private readonly ISolver _subclauseSolver;

        public SimpleSingleClauseSolver(IClause clause, ISolver subclauseSolver)
        {
            if (clause == null) throw new ArgumentNullException("clause");
            if (subclauseSolver == null) throw new ArgumentNullException("subclauseSolver");

            _clause = clause;
            _subclauseSolver = subclauseSolver;
        }

        /// <summary>
        /// Retrieves an object representing the assignments for a particular literal when used as a predicate
        /// </summary>
        private PredicateAssignmentList GetAssignmentsFromPredicate(ILiteral predicate)
        {
            var result = new PredicateAssignmentList();

            if (predicate.UnificationKey != null)
            {
                foreach (var argument in predicate.Dependencies)
                {
                    result.AddArgument(argument);
                }
            }

            return result;
        }

        public Task<IQueryResult> Solve(IEnumerable<ILiteral> goals)
        {
            throw new NotImplementedException();
        }

        public Func<bool> Call(ILiteral predicate, params IReferenceLiteral[] arguments)
        {
            throw new NotImplementedException();
        }
    }
}

Add a method to get the assignments from a particular literal when it's used as a predicate


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

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using Realms;
using Realms.Schema;

#nullable enable

namespace osu.Game.Database
{
    public class EmptyRealmSet<T> : IRealmCollection<T>
    {
        private static List<T> emptySet => new List<T>();

        public IEnumerator<T> GetEnumerator()
        {
            return emptySet.GetEnumerator();
        }

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

        public int Count => emptySet.Count;

        public T this[int index] => emptySet[index];

        public event NotifyCollectionChangedEventHandler? CollectionChanged
        {
            add => throw new NotImplementedException();
            remove => throw new NotImplementedException();
        }

        public event PropertyChangedEventHandler? PropertyChanged
        {
            add => throw new NotImplementedException();
            remove => throw new NotImplementedException();
        }

        public int IndexOf(object item)
        {
            return emptySet.IndexOf((T)item);
        }

        public bool Contains(object item)
        {
            return emptySet.Contains((T)item);
        }

        public IRealmCollection<T> Freeze()
        {
            throw new NotImplementedException();
        }

        public IDisposable SubscribeForNotifications(NotificationCallbackDelegate<T> callback)
        {
            throw new NotImplementedException();
        }

        public bool IsValid => throw new NotImplementedException();

        public Realm Realm => throw new NotImplementedException();

        public ObjectSchema ObjectSchema => throw new NotImplementedException();

        public bool IsFrozen => throw new NotImplementedException();
    }
}

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

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using Realms;
using Realms.Schema;

#nullable enable

namespace osu.Game.Database
{
    public class EmptyRealmSet<T> : IRealmCollection<T>
    {
        private IList<T> emptySet => Array.Empty<T>();

        public IEnumerator<T> GetEnumerator() => emptySet.GetEnumerator();
        IEnumerator IEnumerable.GetEnumerator() => emptySet.GetEnumerator();
        public int Count => emptySet.Count;
        public T this[int index] => emptySet[index];
        public int IndexOf(object item) => emptySet.IndexOf((T)item);
        public bool Contains(object item) => emptySet.Contains((T)item);

        public event NotifyCollectionChangedEventHandler? CollectionChanged
        {
            add => throw new NotImplementedException();
            remove => throw new NotImplementedException();
        }

        public event PropertyChangedEventHandler? PropertyChanged
        {
            add => throw new NotImplementedException();
            remove => throw new NotImplementedException();
        }

        public IRealmCollection<T> Freeze() => throw new NotImplementedException();
        public IDisposable SubscribeForNotifications(NotificationCallbackDelegate<T> callback) => throw new NotImplementedException();
        public bool IsValid => throw new NotImplementedException();
        public Realm Realm => throw new NotImplementedException();
        public ObjectSchema ObjectSchema => throw new NotImplementedException();
        public bool IsFrozen => throw new NotImplementedException();
    }
}

Use `Array.Empty` instead of constructed list


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

using Xunit;

namespace System.Reflection.Context
{
    public class CustomReflectionContextTests
    {
        [Fact]
        public void InstantiateContext_Throws()
        {
            Assert.Throws<PlatformNotSupportedException>(() => new DerivedContext());
        }

        private class DerivedContext : CustomReflectionContext { }
    }
}

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

using Xunit;

namespace System.Reflection.Context
{
    public class CustomReflectionContextTests
    {
        [Fact]
        [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)]
        public void InstantiateContext_Throws()
        {
            Assert.Throws<PlatformNotSupportedException>(() => new DerivedContext());
        }

        private class DerivedContext : CustomReflectionContext { }
    }
}

Fix System.Reflection.Context test to run on Desktop


using System;
using System.Collections.Generic;
using Arkivverket.Arkade.Util;

namespace Arkivverket.Arkade.Core.Addml.Definitions
{
    public class Separator
    {
        private static readonly Dictionary<string, string> SpecialSeparators = new Dictionary<string, string>
            {
                {"CRLF", "\r\n"}
            };

        public static readonly Separator CRLF = new Separator("CRLF");

        private readonly string _name;
        private readonly string _separator;

        public Separator(string separator)
        {
            Assert.AssertNotNullOrEmpty("separator", separator);

            _name = separator;
            _separator = Convert(separator);
        }

        public string Get()
        {
            return _separator;
        }

        public override string ToString()
        {
            return _name;
        }

        protected bool Equals(Separator other)
        {
            return string.Equals(_name, other._name);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != this.GetType()) return false;
            return Equals((Separator) obj);
        }

        public override int GetHashCode()
        {
            return _name?.GetHashCode() ?? 0;
        }

        private string Convert(string s)
        {
            return SpecialSeparators.ContainsKey(s) ? SpecialSeparators[s] : s;
        }

        internal int GetLength()
        {
            return _separator.Length;
        }
    }
}

using System;
using System.Collections.Generic;
using Arkivverket.Arkade.Util;

namespace Arkivverket.Arkade.Core.Addml.Definitions
{
    public class Separator
    {
        private static readonly Dictionary<string, string> SpecialSeparators = new Dictionary<string, string>
            {
                {"CRLF", "\r\n"},
                {"LF", "\n"}
            };

        public static readonly Separator CRLF = new Separator("CRLF");

        private readonly string _name;
        private readonly string _separator;

        public Separator(string separator)
        {
            Assert.AssertNotNullOrEmpty("separator", separator);

            _name = separator;
            _separator = Convert(separator);
        }

        public string Get()
        {
            return _separator;
        }

        public override string ToString()
        {
            return _name;
        }

        protected bool Equals(Separator other)
        {
            return string.Equals(_name, other._name);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != this.GetType()) return false;
            return Equals((Separator) obj);
        }

        public override int GetHashCode()
        {
            return _name?.GetHashCode() ?? 0;
        }

        private string Convert(string s)
        {
            return SpecialSeparators.ContainsKey(s) ? SpecialSeparators[s] : s;
        }

        internal int GetLength()
        {
            return _separator.Length;
        }
    }
}

Add support for LF record separator

Add support for LF record separator


using Espera.Core;
using Espera.Core.Management;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Threading.Tasks;

namespace Espera.Services
{
    public static class MobileHelper
    {
        public static async Task<byte[]> CompressContentAsync(byte[] content)
        {
            using (var targetStream = new MemoryStream())
            {
                using (var stream = new GZipStream(targetStream, CompressionMode.Compress))
                {
                    await stream.WriteAsync(content, 0, content.Length);
                }

                return targetStream.ToArray();
            }
        }

        public static JObject SerializePlaylist(Playlist playlist)
        {
            return JObject.FromObject(new
            {
                name = playlist.Name,
                current = playlist.CurrentSongIndex.Value.ToString(),
                songs = playlist.Select(x => new
                {
                    artist = x.Song.Artist,
                    title = x.Song.Title,
                    source = x.Song is LocalSong ? "local" : "youtube",
                    guid = x.Guid
                })
            });
        }

        public static JObject SerializeSongs(IEnumerable<LocalSong> songs)
        {
            return JObject.FromObject(new
            {
                songs = songs
                    .Select(s => new
                    {
                        album = s.Album,
                        artist = s.Artist,
                        duration = s.Duration.TotalSeconds,
                        genre = s.Genre,
                        title = s.Title,
                        guid = s.Guid
                    })
            });
        }
    }
}

using Espera.Core;
using Espera.Core.Management;
using Newtonsoft.Json.Linq;
using System.Collections.Generic;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Threading.Tasks;

namespace Espera.Services
{
    public static class MobileHelper
    {
        public static async Task<byte[]> CompressContentAsync(byte[] content)
        {
            using (var targetStream = new MemoryStream())
            {
                using (var stream = new GZipStream(targetStream, CompressionMode.Compress))
                {
                    await stream.WriteAsync(content, 0, content.Length);
                }

                return targetStream.ToArray();
            }
        }

        public static JObject SerializePlaylist(Playlist playlist)
        {
            return JObject.FromObject(new
            {
                name = playlist.Name,
                current = playlist.CurrentSongIndex.Value,
                songs = playlist.Select(x => new
                {
                    artist = x.Song.Artist,
                    title = x.Song.Title,
                    source = x.Song is LocalSong ? "local" : "youtube",
                    guid = x.Guid
                })
            });
        }

        public static JObject SerializeSongs(IEnumerable<LocalSong> songs)
        {
            return JObject.FromObject(new
            {
                songs = songs
                    .Select(s => new
                    {
                        album = s.Album,
                        artist = s.Artist,
                        duration = s.Duration.TotalSeconds,
                        genre = s.Genre,
                        title = s.Title,
                        guid = s.Guid
                    })
            });
        }
    }
}

Send the current song index as nullable

Send the current song index as nullable


using SubMapper.EnumerableMapping;
using System;
using System.Collections.Generic;
using System.Linq;

namespace SubMapper.EnumerableMapping.Adders
{
    public static partial class PartialEnumerableMappingExtensions
    {
        public static PartialEnumerableMapping<TSubA, TSubB, IEnumerable<TSubIItem>, TSubJ, TSubIItem>
            WithArrayConcatAdder<TSubA, TSubB, TSubJ, TSubIItem>(
            this PartialEnumerableMapping<TSubA, TSubB, IEnumerable<TSubIItem>, TSubJ, TSubIItem> source)
            where TSubJ : new()
            where TSubIItem : new()
        {
            source.WithAdder((bc, b) => new[] { b }.Concat(bc ?? new TSubIItem[] { }).ToArray());
            return source;
        }
    }
}

using SubMapper.EnumerableMapping;
using System;
using System.Collections.Generic;
using System.Linq;

namespace SubMapper.EnumerableMapping.Adders
{
    public static partial class PartialEnumerableMappingExtensions
    {
        public static PartialEnumerableMapping<TSubA, TSubB, IEnumerable<TSubIItem>, TSubJ, TSubIItem>
            WithArrayConcatAdder<TSubA, TSubB, TSubJ, TSubIItem>(
            this PartialEnumerableMapping<TSubA, TSubB, IEnumerable<TSubIItem>, TSubJ, TSubIItem> source)
            where TSubJ : new()
            where TSubIItem : new()
        {
            source.WithAdder((bc, b) => (bc ?? new TSubIItem[] { }).Concat(new[] { b }).ToArray());
            return source;
        }
    }
}

Make concat add to the eof array

Make concat add to the eof array


using CSharpMath.Apple;

namespace CSharpMath.Ios
{
  static class IosMathLabels
  {
    public static AppleLatexView LatexView(string latex)
    {
      var typesettingContext = AppleTypesetters.CreateTypesettingContext()
      var view = new AppleLatexView();
      view.SetLatex(latex);
      return view;
    }
  }
}

using CSharpMath.Apple;

namespace CSharpMath.Ios
{
  static class IosMathLabels
  {
    public static AppleLatexView LatexView(string latex)
    {
      var typesettingContext = AppleTypesetters.CreateLatinMath();
      var view = new AppleLatexView(typesettingContext);
      view.SetLatex(latex);
      return view;
    }
  }
}

Use the new factory for Typesetting context


using GalaSoft.MvvmLight;

namespace twitch_tv_viewer.ViewModels.Components
{
    internal class MessageDisplayViewModel : ViewModelBase
    {
        private string _message;

        public string Message
        {
            get { return _message; }
            set
            {
                _message = value;
                RaisePropertyChanged();
            }
        }
    }
}

using GalaSoft.MvvmLight;

namespace twitch_tv_viewer.ViewModels.Components
{
    internal class MessageDisplayViewModel : ViewModelBase
    {
        private string _message;

        public string Message
        {
            get { return _message; }
            set
            {
                _message = value;
                RaisePropertyChanged();
                MessengerInstance.Send(new NotificationMessage());
            }
        }
    }
}

Clear notification on change in textbox text


using System;
using UnityEngine;

namespace FullSerializer {
    /// <summary>
    /// Enables some top-level customization of Full Serializer.
    /// </summary>
    public static class fsConfig {
        /// <summary>
        /// The attributes that will force a field or property to be serialized.
        /// </summary>
        public static Type[] SerializeAttributes = new[] { typeof(SerializeField), typeof(fsPropertyAttribute) };

        /// <summary>
        /// The attributes that will force a field or property to *not* be serialized.
        /// </summary>
        public static Type[] IgnoreSerializeAttributes = new[] { typeof(NonSerializedAttribute), typeof(fsIgnoreAttribute) };

        /// <summary>
        /// The default member serialization.
        /// </summary>
        public static fsMemberSerialization DefaultMemberSerialization {
            get {
                return _defaultMemberSerialization;
            }
            set {
                _defaultMemberSerialization = value;
                fsMetaType.ClearCache();
            }
        }

        private static fsMemberSerialization _defaultMemberSerialization = fsMemberSerialization.OptOut;
    }
}

using System;
using UnityEngine;

namespace FullSerializer {
    /// <summary>
    /// Enables some top-level customization of Full Serializer.
    /// </summary>
    public static class fsConfig {
        /// <summary>
        /// The attributes that will force a field or property to be serialized.
        /// </summary>
        public static Type[] SerializeAttributes = new[] { typeof(SerializeField), typeof(fsPropertyAttribute) };

        /// <summary>
        /// The attributes that will force a field or property to *not* be serialized.
        /// </summary>
        public static Type[] IgnoreSerializeAttributes = new[] { typeof(NonSerializedAttribute), typeof(fsIgnoreAttribute) };

        /// <summary>
        /// The default member serialization.
        /// </summary>
        public static fsMemberSerialization DefaultMemberSerialization {
            get {
                return _defaultMemberSerialization;
            }
            set {
                _defaultMemberSerialization = value;
                fsMetaType.ClearCache();
            }
        }

        private static fsMemberSerialization _defaultMemberSerialization = fsMemberSerialization.Default;
    }
}

Correct default serialization strategy to `Default`


namespace TraktApiSharp.Objects.Post.Scrobbles
{
    using Newtonsoft.Json;
    using System;

    public abstract class TraktScrobblePost : IValidatable
    {
        [JsonProperty(PropertyName = "progress")]
        public float Progress { get; set; }

        [JsonProperty(PropertyName = "app_version")]
        public string AppVersion { get; set; }

        [JsonProperty(PropertyName = "app_date")]
        public string AppDate { get; set; }

        public void Validate()
        {
            if (Progress.CompareTo(0.0f) < 0)
                throw new ArgumentException("progress value not valid");

            if (Progress.CompareTo(100.0f) > 0)
                throw new ArgumentException("progress value not valid");
        }
    }
}

namespace TraktApiSharp.Objects.Post.Scrobbles
{
    using Newtonsoft.Json;
    using System;

    public abstract class TraktScrobblePost : IValidatable
    {
        [JsonProperty(PropertyName = "progress")]
        public float Progress { get; set; }

        [JsonProperty(PropertyName = "app_version")]
        public string AppVersion { get; set; }

        [JsonProperty(PropertyName = "app_date")]
        public string AppDate { get; set; }

        public void Validate()
        {
            if (Progress.CompareTo(0.0f) < 0 || Progress.CompareTo(100.0f) > 0)
                throw new ArgumentException("progress value not valid - value must be between 0 and 100");
        }
    }
}

Improve argument exception message of scrobble post.


using System.Net.Http;
using SFA.DAS.CommitmentPayments.WebJob.Configuration;
using SFA.DAS.Http;
using SFA.DAS.Http.TokenGenerators;
using SFA.DAS.NLog.Logger.Web.MessageHandlers;
using SFA.DAS.Provider.Events.Api.Client;
using SFA.DAS.Provider.Events.Api.Client.Configuration;
using StructureMap;

namespace SFA.DAS.CommitmentPayments.WebJob.DependencyResolution
{
    internal class PaymentsRegistry : Registry
    {
        public PaymentsRegistry()
        {
            For<PaymentEventsApi>().Use(c => c.GetInstance<CommitmentPaymentsConfiguration>().PaymentEventsApi);
            For<IPaymentsEventsApiConfiguration>().Use(c => c.GetInstance<PaymentEventsApi>());
            For<IPaymentsEventsApiClient>().Use<PaymentsEventsApiClient>().Ctor<HttpClient>().Is(c => CreateClient(c));
        }

        private HttpClient CreateClient(IContext context)
        {
            var config = context.GetInstance<CommitmentPaymentsConfiguration>().PaymentEventsApi;

            HttpClient httpClient = new HttpClientBuilder()
                    .WithBearerAuthorisationHeader(new AzureActiveDirectoryBearerTokenGenerator(config))
                    .WithHandler(new RequestIdMessageRequestHandler())
                    .WithHandler(new SessionIdMessageRequestHandler())
                    .WithDefaultHeaders()
                    .Build();

            return httpClient;
        }
    }
}

using System.Net.Http;
using SFA.DAS.CommitmentPayments.WebJob.Configuration;
using SFA.DAS.Http;
using SFA.DAS.Http.TokenGenerators;
using SFA.DAS.NLog.Logger.Web.MessageHandlers;
using SFA.DAS.Provider.Events.Api.Client;
using SFA.DAS.Provider.Events.Api.Client.Configuration;
using StructureMap;

namespace SFA.DAS.CommitmentPayments.WebJob.DependencyResolution
{
    internal class PaymentsRegistry : Registry
    {
        public PaymentsRegistry()
        {
            For<PaymentEventsApi>().Use(c => c.GetInstance<CommitmentPaymentsConfiguration>().PaymentEventsApi);
            For<IPaymentsEventsApiConfiguration>().Use(c => c.GetInstance<PaymentEventsApi>());
            For<IPaymentsEventsApiClient>().Use<PaymentsEventsApiClient>().Ctor<HttpClient>().Is(c => CreateClient(c));
        }

        private HttpClient CreateClient(IContext context)
        {
            var config = context.GetInstance<CommitmentPaymentsConfiguration>().PaymentEventsApi;

            HttpClient httpClient = new HttpClientBuilder()
                    .WithBearerAuthorisationHeader(new AzureActiveDirectoryBearerTokenGenerator(config))
                    .WithHandler(new RequestIdMessageRequestHandler())
                    .WithHandler(new SessionIdMessageRequestHandler())
                    .WithDefaultHeaders()
                    .Build();

            httpClient.DefaultRequestHeaders.Add("api-version", "2");

            return httpClient;
        }
    }
}

Add default request header to Payments API httpClient to look for version 2. Since removing the SecureHttpClient from PaymentEventsApiClient this header was lost. This only matters for data locks as that is the only controller action split by api version at present