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

[System.Serializable]
public struct CategoryItem
{
    public string name;
    public SoundItem[] soundItems;
    public GameObject audioObjectPrefab;
}

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

[System.Serializable]
public struct CategoryItem
{
    public string name;
    public SoundItem[] soundItems;
    public GameObject audioObjectPrefab = null;
    public bool usingDefaultPrefab = true;
}

Use default AudioObject prefab if none is assigned.


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

namespace BTCPayServer.Models.InvoicingModels
{
    public class CreateInvoiceModel
    {
        public CreateInvoiceModel()
        {
            Currency = "USD";
        }
        [Required]
        public decimal? Amount
        {
            get; set;
        }

        [Required]
        public string Currency
        {
            get; set;
        }

        [Required]
        public string StoreId
        {
            get; set;
        }

        public string OrderId
        {
            get; set;
        }

        [DisplayName("Item Description")]
        public string ItemDesc
        {
            get; set;
        }

        [DisplayName("POS Data")]
        public string PosData
        {
            get; set;
        }

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

        [EmailAddress]
        [DisplayName("Notification Email")]
        public string NotificationEmail
        {
            get; set;
        }

        [Uri]
        [DisplayName("Notification Url")]
        public string NotificationUrl
        {
            get; set;
        }

        public SelectList Stores
        {
            get;
            set;
        }

        [DisplayName("Supported Transaction Currencies")]
        public List<string> SupportedTransactionCurrencies
        {
            get;
            set;
        }

        [DisplayName("Available Payment Methods")]
        public SelectList AvailablePaymentMethods
        {
            get;
            set;
        }
    }
}

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

namespace BTCPayServer.Models.InvoicingModels
{
    public class CreateInvoiceModel
    {
        public CreateInvoiceModel()
        {
            Currency = "USD";
        }

        [Required]
        public decimal? Amount
        {
            get; set;
        }

        [Required]
        public string Currency
        {
            get; set;
        }

        [Required]
        [DisplayName("Store Id")]
        public string StoreId
        {
            get; set;
        }

        [DisplayName("Order Id")]
        public string OrderId
        {
            get; set;
        }

        [DisplayName("Item Description")]
        public string ItemDesc
        {
            get; set;
        }

        [DisplayName("POS Data")]
        public string PosData
        {
            get; set;
        }

        [EmailAddress]
        [DisplayName("Buyer Email")]
        public string BuyerEmail
        {
            get; set;
        }

        [EmailAddress]
        [DisplayName("Notification Email")]
        public string NotificationEmail
        {
            get; set;
        }

        [Uri]
        [DisplayName("Notification Url")]
        public string NotificationUrl
        {
            get; set;
        }

        public SelectList Stores
        {
            get; set;
        }

        [DisplayName("Supported Transaction Currencies")]
        public List<string> SupportedTransactionCurrencies
        {
            get; set;
        }

        [DisplayName("Available Payment Methods")]
        public SelectList AvailablePaymentMethods
        {
            get; set;
        }
    }
}

Update display text on the view model.

Update display text on the view model.


using Quibill.Web.Contexts;
using System;
using System.Collections.Generic;
using Quibill.Domain.Models;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Microsoft.AspNet.Identity;
using Quibill.Domain;

namespace Quibill.Web.Controllers
{
    [Authorize]
    public class TransactionsController : ApiController
    {
        private TransactionsDbContext transactionsContext;

        public TransactionsController()
        {
            transactionsContext = new TransactionsDbContext();
        }

        // GET api/values
        public IEnumerable<ITransaction> Get()
        {
            string userName = User.Identity.GetUserId();

            List<SingleTransaction> allSingleTransactions = transactionsContext.SingleTransactions.ToList();
            List<RecurringTransaction> allRecurringTransactions = transactionsContext.RecurringTransactions.ToList();

            List<ITransaction> allTransactions = new List<ITransaction>();

            allTransactions.AddRange(allRecurringTransactions);
            allTransactions.AddRange(allSingleTransactions);

            return allTransactions;
        }

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

        // POST api/values
        public void Post([FromBody]SingleTransaction singleTransaction)
        {
           singleTransaction.BoundUserId = User.Identity.GetUserId();
           transactionsContext.SingleTransactions.Add(singleTransaction);
           transactionsContext.SaveChanges();
        }

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

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

using Quibill.Web.Contexts;
using System;
using System.Collections.Generic;
using Quibill.Domain.Models;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Microsoft.AspNet.Identity;
using Quibill.Domain;

namespace Quibill.Web.Controllers
{
    [Authorize]
    public class TransactionsController : ApiController
    {
        private TransactionsDbContext transactionsContext;

        public TransactionsController()
        {
            transactionsContext = new TransactionsDbContext();
        }

        // GET api/values
        public IEnumerable<ITransaction> Get()
        {
            string userName = User.Identity.GetUserId();

            List<SingleTransaction> allSingleTransactions = transactionsContext.SingleTransactions.ToList();
            List<RecurringTransaction> allRecurringTransactions = transactionsContext.RecurringTransactions.ToList();

            List<ITransaction> allTransactions = new List<ITransaction>();

            allTransactions.AddRange(allRecurringTransactions);
            allTransactions.AddRange(allSingleTransactions);

            return allTransactions;
        }

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

        // POST api/values
        public void Post([FromBody]SingleTransaction singleTransaction)
        {
           singleTransaction.BoundUserId = User.Identity.GetUserId();
           singleTransaction.AddDate = DateTime.Now;
           transactionsContext.SingleTransactions.Add(singleTransaction);
           transactionsContext.SaveChanges();
        }

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

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

Set AddDate on server for new transactions


// Copyright 2014 The Noda Time Authors. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.

using NUnit.Framework;
using System.Collections.Generic;
using System.Linq;
using System.Security;

namespace NodaTime.Test.Annotations
{
    [TestFixture]
    public class SecurityTest
    {
        [Test]
        public void SecurityAttributesOnInterfaceImplementations()
        {
            var violations = new List<string>();
            foreach (var type in typeof(Instant).Assembly.GetTypes().Where(type => !type.IsInterface))
            {
                foreach (var iface in type.GetInterfaces())
                {
                    var map = type.GetInterfaceMap(iface);
                    var methodCount = map.InterfaceMethods.Length;
                    for (int i = 0; i < methodCount; i++)
                    {
                        if (map.TargetMethods[i].ReflectedType == type &&
                            map.InterfaceMethods[i].IsDefined(typeof(SecurityCriticalAttribute), false) &&
                            !map.TargetMethods[i].IsDefined(typeof(SecurityCriticalAttribute), false))
                        {
                            violations.Add(type.FullName + "/" + map.TargetMethods[i].Name);
                        }
                    }
                }
            }
            Assert.IsEmpty(violations);
        }
    }
}

// Copyright 2014 The Noda Time Authors. All rights reserved.
// Use of this source code is governed by the Apache License 2.0,
// as found in the LICENSE.txt file.

using NUnit.Framework;
using System.Collections.Generic;
using System.Linq;
using System.Security;

namespace NodaTime.Test.Annotations
{
    [TestFixture]
    public class SecurityTest
    {
        [Test]
        public void SecurityAttributesOnInterfaceImplementations()
        {
            var violations = new List<string>();
            foreach (var type in typeof(Instant).Assembly.GetTypes().Where(type => !type.IsInterface))
            {
                foreach (var iface in type.GetInterfaces())
                {
                    var map = type.GetInterfaceMap(iface);
                    var methodCount = map.InterfaceMethods.Length;
                    for (int i = 0; i < methodCount; i++)
                    {
                        if (map.TargetMethods[i].DeclaringType == type &&
                            map.InterfaceMethods[i].IsDefined(typeof(SecurityCriticalAttribute), false) &&
                            !map.TargetMethods[i].IsDefined(typeof(SecurityCriticalAttribute), false))
                        {
                            violations.Add(type.FullName + "/" + map.TargetMethods[i].Name);
                        }
                    }
                }
            }
            Assert.IsEmpty(violations);
        }
    }
}

Use DeclaringType instead of ReflectedType to find interface implementations within the NodaTime assembly. (Not sure why the mapping code behaves differently in .NET to in Mono anyway, but...)


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

using SmugMug.Shared.Descriptors;
using System.Collections.Generic;
using System.Text;

namespace SmugMugCodeGen
{
    public partial class CodeGen
    {
        public static StringBuilder BuildMethods(List<Method> list)
        {
            return new StringBuilder();
        }
    }
}

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

using SmugMug.Shared.Descriptors;
using System.Collections.Generic;
using System.Text;

namespace SmugMugCodeGen
{
    public partial class CodeGen
    {
        public static StringBuilder BuildMethods(List<Method> list)
        {
            StringBuilder sb = new StringBuilder();
            sb.AppendLine("/*");
            foreach (var item in list)
            {
                sb.AppendLine(string.Format("[{0}] -- {1}", item.ReturnType, item.Uri));
            }
            sb.AppendLine("*/");
            return sb;
        }
    }
}

Add code to start generating the methods.


using System;
using System.ComponentModel.DataAnnotations;

namespace Cash_Flow_Projection.Models
{
    public class RepeatingEntry
    {
        [DataType(DataType.Date)]
        public DateTime FirstDate { get; set; } = DateTime.Today;

        public String Description { get; set; }

        public Decimal Amount { get; set; }

        public int RepeatInterval { get; set; } = 1;

        public RepeatUnit Unit { get; set; } = RepeatUnit.Days;

        public int RepeatIterations { get; set; } = 10;

        public Account Account { get; set; } = Account.Cash;

        public enum RepeatUnit
        {
            Days,

            Weeks,

            Months
        }
    }
}

using System;
using System.ComponentModel.DataAnnotations;

namespace Cash_Flow_Projection.Models
{
    public class RepeatingEntry
    {
        [DataType(DataType.Date)]
        public DateTime FirstDate { get; set; } = DateTime.Today;

        public String Description { get; set; }

        public Decimal Amount { get; set; }

        public int RepeatInterval { get; set; } = 1;

        public RepeatUnit Unit { get; set; } = RepeatUnit.Months;

        public int RepeatIterations { get; set; } = 12;

        public Account Account { get; set; } = Account.Cash;

        public enum RepeatUnit
        {
            Days,

            Weeks,

            Months
        }
    }
}

Change default to be once per month for a year


using Halforbit.DataStores.FileStores.Serialization.Json.Implementation;
using Newtonsoft.Json.Linq;
using System.Dynamic;
using System.Text;
using System.Threading.Tasks;
using YamlDotNet.Serialization;
using ISerializer = Halforbit.DataStores.FileStores.Interface.ISerializer;

namespace Halforbit.DataStores.FileStores.Serialization.Yaml.Implementation
{
    public class YamlSerializer : ISerializer
    {
        readonly JsonSerializer _jsonSerializer = new JsonSerializer();

        readonly Serializer _serializer = new Serializer();

        readonly Deserializer _deserializer = new Deserializer();

        public Task<TValue> Deserialize<TValue>(byte[] data)
        {
            return Task.FromResult(JToken.FromObject(_deserializer.Deserialize<ExpandoObject>(
                Encoding.UTF8.GetString(data, 0, data.Length))).ToObject<TValue>());
        }

        public Task<byte[]> Serialize<TValue>(TValue value)
        {
            return Task.FromResult(Encoding.UTF8.GetBytes(_serializer.Serialize(
                JToken.FromObject(value).ToObject<ExpandoObject>())));
        }
    }
}

using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
using System.Dynamic;
using System.Text;
using System.Threading.Tasks;
using YamlDotNet.Serialization;
using ISerializer = Halforbit.DataStores.FileStores.Interface.ISerializer;

namespace Halforbit.DataStores.FileStores.Serialization.Yaml.Implementation
{
    public class YamlSerializer : ISerializer
    {
        readonly JsonSerializer _jsonSerializer;

        readonly Serializer _serializer = new Serializer();

        readonly Deserializer _deserializer = new Deserializer();

        public YamlSerializer()
        {
             _jsonSerializer = new JsonSerializer
             {
                 ContractResolver = new CamelCasePropertyNamesContractResolver()
             };

            _jsonSerializer.Converters.Add(new StringEnumConverter { CamelCaseText = true });
        }

        public Task<TValue> Deserialize<TValue>(byte[] data)
        {
            return Task.FromResult(JToken
                .FromObject(
                    _deserializer.Deserialize<ExpandoObject>(
                        Encoding.UTF8.GetString(data, 0, data.Length)),
                    _jsonSerializer)
                .ToObject<TValue>());
        }

        public Task<byte[]> Serialize<TValue>(TValue value)
        {
            return Task.FromResult(Encoding.UTF8.GetBytes(_serializer.Serialize(
                JToken.FromObject(value, _jsonSerializer).ToObject<ExpandoObject>())));
        }
    }
}

Use camelCase and string enums with YAML serialization


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

namespace Bumpy
{
    internal sealed class Template
    {
        private static readonly Dictionary<string, Template> Templates = new Dictionary<string, Template>()
        {
            { ".csproj", new Template(@"<(?<marker>[Vv]ersion)>(?<version>\d+\.\d+\.\d+.*)<\/[Vv]ersion>", new UTF8Encoding(false)) },
            { ".nuspec", new Template(@"<(?<marker>[Vv]ersion)>(?<version>\d+\.\d+\.\d+.*)<\/[Vv]ersion>", new UTF8Encoding(false)) },
            { "AssemblyInfo.cs", new Template(@"(?<marker>Assembly(File)?Version).*(?<version>\d+\.\d+\.\d+\.\d+)", new UTF8Encoding(true)) }
        };

        private Template(string regularExpression, Encoding encoding)
        {
            Regex = regularExpression;
            Encoding = encoding;
        }

        public string Regex { get; }

        public Encoding Encoding { get; }

        public static bool TryFindTemplate(string text, out Template template)
        {
            var matches = Templates.Where(t => text.EndsWith(t.Key, StringComparison.OrdinalIgnoreCase)).ToList();
            template = null;

            if (matches.Any())
            {
                template = matches[0].Value;
                return true;
            }

            return false;
        }
    }
}

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

namespace Bumpy
{
    internal sealed class Template
    {
        private static readonly Dictionary<string, Template> Templates = new Dictionary<string, Template>()
        {
            { ".csproj", new Template(@"<(?<marker>[Vv]ersion)>(?<version>\d+\.\d+\.\d+.*)<\/[Vv]ersion>", new UTF8Encoding(false)) },
            { ".nuspec", new Template(@"<(?<marker>[Vv]ersion)>(?<version>\d+\.\d+\.\d+.*)<\/[Vv]ersion>", new UTF8Encoding(false)) },
            { "AssemblyInfo.cs", new Template(@"(?<marker>Assembly(File)?Version).*(?<version>\d+\.\d+\.\d+\.\d+)", new UTF8Encoding(true)) },
            { ".cs", new Template("(?<tag>(FILEVERSION|PRODUCTVERSION|FileVersion|ProductVersion))[\", ]*(?<version>\\d+[\\.,]\\d+[\\.,]\\d+[\\.,]\\d+)", Encoding.GetEncoding(1200)) }
        };

        private Template(string regularExpression, Encoding encoding)
        {
            Regex = regularExpression;
            Encoding = encoding;
        }

        public string Regex { get; }

        public Encoding Encoding { get; }

        public static bool TryFindTemplate(string text, out Template template)
        {
            var matches = Templates.Where(t => text.EndsWith(t.Key, StringComparison.OrdinalIgnoreCase)).ToList();
            template = null;

            if (matches.Any())
            {
                template = matches[0].Value;
                return true;
            }

            return false;
        }
    }
}

Add template for Visual Studio C++ resource files


using Xunit;
using System.IO;
using Xunit.Sdk;

namespace Mammoth.Tests {
	public class DocumentConverterTests {
		[Fact]
		public void DocxContainingOneParagraphIsConvertedToSingleParagraphElement() {
			assertSuccessfulConversion(
				ConvertToHtml("single-paragraph.docx"),
				"
Walking on imported air
");
		}

		[Fact]
		public void CanReadFilesWithUtf8Bom() {
			assertSuccessfulConversion(
				ConvertToHtml("utf8-bom.docx"),
				"
This XML has a byte order mark.
");
		}

		[Fact]
		public void EmptyParagraphsAreIgnoredByDefault() {
			assertSuccessfulConversion(
				ConvertToHtml("empty.docx"),
				"");
		}

		private void assertSuccessfulConversion(IResult<string> result, string expectedValue) {
			if (result.Warnings.Count > 0) {
				throw new XunitException("Unexpected warnings: " + string.Join(", ", result.Warnings));
			}
			Assert.Equal(expectedValue, result.Value);
		}

		private IResult<string> ConvertToHtml(string name) {
			return new DocumentConverter().ConvertToHtml(TestFilePath(name));
		}

		private string TestFilePath(string name) {
			return Path.Combine("../../TestData", name);
		}
	}
}

using Xunit;
using System.IO;
using Xunit.Sdk;
using System;

namespace Mammoth.Tests {
	public class DocumentConverterTests {
		[Fact]
		public void DocxContainingOneParagraphIsConvertedToSingleParagraphElement() {
			assertSuccessfulConversion(
				ConvertToHtml("single-paragraph.docx"),
				"
Walking on imported air
");
		}

		[Fact]
		public void CanReadFilesWithUtf8Bom() {
			assertSuccessfulConversion(
				ConvertToHtml("utf8-bom.docx"),
				"
This XML has a byte order mark.
");
		}

		[Fact]
		public void EmptyParagraphsAreIgnoredByDefault() {
			assertSuccessfulConversion(
				ConvertToHtml("empty.docx"),
				"");
		}

		[Fact]
		public void EmptyParagraphsArePreservedIfIgnoreEmptyParagraphsIsFalse() {
			assertSuccessfulConversion(
				ConvertToHtml("empty.docx", converter => converter.PreserveEmptyParagraphs()),
				"

");
		}

		private void assertSuccessfulConversion(IResult<string> result, string expectedValue) {
			if (result.Warnings.Count > 0) {
				throw new XunitException("Unexpected warnings: " + string.Join(", ", result.Warnings));
			}
			Assert.Equal(expectedValue, result.Value);
		}

		private IResult<string> ConvertToHtml(string name) {
			return ConvertToHtml(name, converter => converter);
		}

		private IResult<string> ConvertToHtml(string name, Func<DocumentConverter, DocumentConverter> configure) {
			return configure(new DocumentConverter()).ConvertToHtml(TestFilePath(name));
		}

		private string TestFilePath(string name) {
			return Path.Combine("../../TestData", name);
		}
	}
}

Add test for preserving empty paragraphs


// Copyright 2006 Alp Toker <alp@atoker.com>
// This software is made available under the MIT License
// See COPYING for details

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

//[assembly: AssemblyVersion("0.0.0.*")]
[assembly: AssemblyTitle ("NDesk.DBus")]
[assembly: AssemblyDescription ("D-Bus IPC protocol library and CLR binding")]
[assembly: AssemblyCopyright ("Copyright (C) Alp Toker")]
[assembly: AssemblyCompany ("NDesk")]

[assembly: InternalsVisibleTo ("dbus-monitor")]
[assembly: InternalsVisibleTo ("dbus-daemon")]

Add a couple of friend assemblies

Add a couple of friend assemblies


using System;
using System.Collections.Generic;

namespace Mios.Localization.Localizers {
	public class DictionaryLocalizer {
		private readonly IDictionary<string, string> source;
		public DictionaryLocalizer(IDictionary<string,string> source) {
			this.source = source;
		}
		public LocalizedString Localize(string original, params object[] args) {
			if(original==null) return new LocalizedString();
			string localized;
			source.TryGetValue(original, out localized);
			if(localized!=null) {
				localized = String.Format(localized, args);
			}
			return new LocalizedString(String.Format(original, args), localized);
		}
	}
}

using System;
using System.Collections.Generic;

namespace Mios.Localization.Localizers {
	public class DictionaryLocalizer {
		private readonly IDictionary<string, string> source;
	  private readonly Localizer defaultLocalizer;

	  public DictionaryLocalizer(IDictionary<string, string> source) : this(source, NullLocalizer.Instance) {
    }
	  public DictionaryLocalizer(IDictionary<string,string> source, Localizer defaultLocalizer) {
	    this.source = source;
	    this.defaultLocalizer = defaultLocalizer;
	  }

	  public LocalizedString Localize(string original, params object[] args) {
			if(original==null) return new LocalizedString();
			string localized;
      if(!source.TryGetValue(original, out localized)) {
        return defaultLocalizer(original, args);
      }
			if(localized!=null) {
				localized = String.Format(localized, args);
			}
			return new LocalizedString(String.Format(original, args), localized);
		}
	}
}

Allow specifying a default localizer.

Allow specifying a default localizer.


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

namespace DesktopWidgets.Classes
{
    [ExpandableObject]
    [DisplayName("Directory Watcher Settings")]
    public class DirectoryWatcherSettings
    {
        [DisplayName("Watch Folder Paths")]
        public List<string> WatchFolders { get; set; } = new List<string>();

        [DisplayName("File Extension Whitelist")]
        public List<string> FileExtensionWhitelist { get; set; } = new List<string>();

        [DisplayName("File Extension Blacklist")]
        public List<string> FileExtensionBlacklist { get; set; } = new List<string>();

        [DisplayName("Recursive")]
        public bool Recursive { get; set; } = false;

        [DisplayName("Check Interval (ms)")]
        public int CheckInterval { get; set; } = 500;

        [DisplayName("Max File Size (bytes)")]
        public double MaxSize { get; set; } = 1048576;

        [DisplayName("Detect New Files")]
        public bool DetectNewFiles { get; set; } = true;

        [DisplayName("Detect Modified Files")]
        public bool DetectModifiedFiles { get; set; } = true;

        [DisplayName("Timeout Duration")]
        public TimeSpan TimeoutDuration { get; set; } = TimeSpan.FromMinutes(0);

        [Browsable(false)]
        [DisplayName("Last Check")]
        public DateTime LastCheck { get; set; } = DateTime.Now;
    }
}

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

namespace DesktopWidgets.Classes
{
    [ExpandableObject]
    [DisplayName("Directory Watcher Settings")]
    public class DirectoryWatcherSettings
    {
        [DisplayName("Watch Folder Paths")]
        public List<string> WatchFolders { get; set; } = new List<string>();

        [DisplayName("File Extension Whitelist")]
        public List<string> FileExtensionWhitelist { get; set; } = new List<string>();

        [DisplayName("File Extension Blacklist")]
        public List<string> FileExtensionBlacklist { get; set; } = new List<string>();

        [DisplayName("Recursive")]
        public bool Recursive { get; set; } = false;

        [DisplayName("Check Interval (ms)")]
        public int CheckInterval { get; set; } = 500;

        [DisplayName("Max File Size (bytes)")]
        public double MaxSize { get; set; } = 0;

        [DisplayName("Detect New Files")]
        public bool DetectNewFiles { get; set; } = true;

        [DisplayName("Detect Modified Files")]
        public bool DetectModifiedFiles { get; set; } = true;

        [DisplayName("Timeout Duration")]
        public TimeSpan TimeoutDuration { get; set; } = TimeSpan.FromMinutes(0);

        [Browsable(false)]
        [DisplayName("Last Check")]
        public DateTime LastCheck { get; set; } = DateTime.Now;
    }
}

Change directory watcher settings "Max Size" default


using System;
using System.Diagnostics;

using Mindscape.Raygun4Net;
using MarkerMetro.Unity.WinIntegration.Logging;
using MarkerMetro.Unity.WinIntegration;

namespace UnityProject.Logging
{

    /// <summary>
    /// Implementation of IExceptionLogger for Raygun Exception Logger.
    /// </summary>
    public sealed class RaygunExceptionLogger : IExceptionLogger
    {
        Lazy<RaygunClient> _raygun;

        public bool IsEnabled { get; set; }

        public RaygunExceptionLogger(string apiKey)
        {
            _raygun = new Lazy<RaygunClient>(() => BuildRaygunClient(apiKey));
        }

        RaygunClient BuildRaygunClient(string apiKey)
        {
            try
            {
                string version = null, user = null;

                version = Helper.Instance.GetAppVersion();
                try
                {
                    user = Helper.Instance.GetUserDeviceId();
                }
                catch (Exception ex)
                {
                    Debug.WriteLine("Failed to get UserDeviceId: {0}", ex);
                }

                return new RaygunClient(apiKey)
                {
                    ApplicationVersion = version,
                    User = user,
                };
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Failed to BuildRaygunClient", ex);

                throw;
            }
        }

        public void Send(Exception ex)
        {
            if (_raygun != null)
            {
                _raygun.Value.Send(ex);
            }
        }

        public void Send(string message, string stackTrace)
        {
            if (_raygun != null)
            {
                _raygun.Value.Send(new WrappedException(message, stackTrace));
            }
        }
    }
}

using System;
using System.Diagnostics;

using Mindscape.Raygun4Net;
using MarkerMetro.Unity.WinIntegration.Logging;
using MarkerMetro.Unity.WinIntegration;

namespace UnityProject.Logging
{

    /// <summary>
    /// Implementation of IExceptionLogger for Raygun Exception Logger.
    /// </summary>
    public sealed class RaygunExceptionLogger : IExceptionLogger
    {
        Lazy<RaygunClient> _raygun;

        public bool IsEnabled { get; set; }

        public RaygunExceptionLogger(string apiKey)
        {
            _raygun = new Lazy<RaygunClient>(() => BuildRaygunClient(apiKey));
        }

        RaygunClient BuildRaygunClient(string apiKey)
        {
            string version = null, user = null;

            version = Helper.Instance.GetAppVersion();
            try
            {
                user = Helper.Instance.GetUserDeviceId();
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Failed to get UserDeviceId: {0}", ex);
            }

            return new RaygunClient(apiKey)
            {
                ApplicationVersion = version,
                User = user,
            };
        }

        public void Send(Exception ex)
        {
            if (_raygun != null)
            {
                _raygun.Value.Send(ex);
            }
        }

        public void Send(string message, string stackTrace)
        {
            if (_raygun != null)
            {
                _raygun.Value.Send(new WrappedException(message, stackTrace));
            }
        }
    }
}

Remove the outter try/catch in BuildRaygunClient


namespace StarsReloaded.Client.ViewModel.Fragments
{
    using System.Windows;

    using GalaSoft.MvvmLight.Command;

    using StarsReloaded.Client.ViewModel.Attributes;

    public class CollapsiblePanelViewModel : BaseViewModel
    {
        private bool isExpanded;

        private string header;

        public CollapsiblePanelViewModel()
        {
            this.ToggleExpansionCommand = new RelayCommand(this.ToggleExpansion);

            this.IsExpanded = true; ////TODO: save/read from user's settings

            if (this.IsInDesignMode)
            {
                this.Header = "Some Panel";
            }
        }

        public string Header
        {
            get
            {
                return this.header;
            }

            set
            {
                this.Set(() => this.Header, ref this.header, value);
            }
        }

        public bool IsExpanded
        {
            get
            {
                return this.isExpanded;
            }

            set
            {
                this.Set(() => this.IsExpanded, ref this.isExpanded, value);
            }
        }

        [DependsUpon(nameof(IsExpanded))]
        public string ExpandButtonSource
            => this.IsExpanded
            ? "../../Resources/Buttons/panel_collapse.png"
            : "../../Resources/Buttons/panel_expand.png";

        [DependsUpon(nameof(IsExpanded))]
        public Visibility ContentVisibility => this.IsExpanded ? Visibility.Visible : Visibility.Collapsed;

        public RelayCommand ToggleExpansionCommand { get; private set; }

        private void ToggleExpansion()
        {
            this.IsExpanded = !this.IsExpanded;
        }
    }
}

namespace StarsReloaded.Client.ViewModel.Fragments
{
    using System.Windows;

    using GalaSoft.MvvmLight.Command;

    using StarsReloaded.Client.ViewModel.Attributes;

    public class CollapsiblePanelViewModel : BaseViewModel
    {
        private bool isExpanded;

        private string header;

        public CollapsiblePanelViewModel()
        {
            this.ToggleExpansionCommand = new RelayCommand(this.ToggleExpansion);

            this.IsExpanded = true; ////TODO: save/read from user's settings

            if (this.IsInDesignMode)
            {
                this.Header = "Some Panel";
            }
        }

        public string Header
        {
            get
            {
                return this.header;
            }

            set
            {
                this.Set(() => this.Header, ref this.header, value);
            }
        }

        public bool IsExpanded
        {
            get
            {
                return this.isExpanded;
            }

            set
            {
                this.Set(() => this.IsExpanded, ref this.isExpanded, value);
            }
        }

        ////TODO: Do it with styling
        [DependsUpon(nameof(IsExpanded))]
        public string ExpandButtonSource
            => this.IsExpanded
            ? "../../Resources/Buttons/panel_collapse.png"
            : "../../Resources/Buttons/panel_expand.png";

        [DependsUpon(nameof(IsExpanded))]
        public Visibility ContentVisibility => this.IsExpanded ? Visibility.Visible : Visibility.Collapsed;

        public RelayCommand ToggleExpansionCommand { get; private set; }

        private void ToggleExpansion()
        {
            this.IsExpanded = !this.IsExpanded;
        }
    }
}

Add TODO regarding use of styling in VM

Add TODO regarding use of styling in VM


using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Dragon.Mail.Interfaces;

namespace Dragon.Mail.Impl
{
    public class DefaultReceiverMapper : IReceiverMapper
    {
        public void Map(dynamic receiver, Models.Mail mail)
        {
            var displayName = (string)null;
            if (receiver.GetType().GetProperty("fullname") != null)
            {
                displayName = receiver.fullname;
            }
            var email = receiver.email;

            mail.Receiver = new System.Net.Mail.MailAddress(email, displayName);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Dragon.Mail.Interfaces;

namespace Dragon.Mail.Impl
{
    public class DefaultReceiverMapper : IReceiverMapper
    {
        public void Map(dynamic receiver, Models.Mail mail)
        {
            var displayName = (string)null;
            if (receiver.GetType().GetProperty("fullname") != null)
            {
                displayName = receiver.fullname;
            }
            if (receiver.GetType().GetProperty("email") == null)
            {
                throw new Exception("The receiver object must have an email property denoting who to send the e-mail to.");
            }
            var email = receiver.email;

            mail.Receiver = new System.Net.Mail.MailAddress(email, displayName);
        }
    }
}

Check receiver has at least email property


using System;

namespace Glimpse.Web
{
    public static class HttpRequestExtension
    {
        public static string Uri(this IHttpRequest request)
        {
            return $"{request.Scheme}://{request.Host}{request.PathBase}{request.Path}{request.QueryString}";
        }
    }
}

using System;

namespace Glimpse.Web
{
    public static class HttpRequestExtension
    {
        public static string Uri(this IHttpRequest request)
        {
            return $"{request.Scheme}://{request.Host}{request.PathBase}{request.Path}{request.QueryString}";
        }
        public static string UriAbsolute(this IHttpRequest request)
        {
            return $"{request.Path}{request.QueryString}";
        }
    }
}

Add extra extension method for getting URI


namespace AngleSharp.DOM.Html
{
    using AngleSharp.Attributes;
    using System;

    /// <summary>
    /// Represents the HTML marquee element.
    /// </summary>
    [DomHistorical]
    sealed class HTMLMarqueeElement : HTMLElement
    {
        #region ctor

        internal HTMLMarqueeElement()
            : base(Tags.Marquee, NodeFlags.Special | NodeFlags.Scoped)
        {
        }

        #endregion

        #region Properties

        /// <summary>
        /// Gets the minimum delay in ms.
        /// </summary>
        public Int32 MinimumDelay
        {
            get;
            private set;
        }

        /// <summary>
        /// Gets or sets the amount of scrolling in pixels.
        /// </summary>
        public Int32 ScrollAmount
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the delay of scrolling in ms.
        /// </summary>
        public Int32 ScrollDelay
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the loop number.
        /// </summary>
        public Int32 Loop
        {
            get;
            set;
        }

        #endregion

        #region Methods

        /// <summary>
        /// Starts the marquee loop.
        /// </summary>
        public void Start()
        {
            //TODO
        }

        /// <summary>
        /// Stops the marquee loop.
        /// </summary>
        public void Stop()
        {
            //TODO
        }

        #endregion
    }
}

namespace AngleSharp.DOM.Html
{
    using AngleSharp.Attributes;
    using System;

    /// <summary>
    /// Represents the HTML marquee element.
    /// </summary>
    [DomHistorical]
    sealed class HTMLMarqueeElement : HTMLElement
    {
        #region ctor

        internal HTMLMarqueeElement()
            : base(Tags.Marquee, NodeFlags.Special | NodeFlags.Scoped)
        {
        }

        #endregion

        #region Properties

        /// <summary>
        /// Gets the minimum delay in ms.
        /// </summary>
        public Int32 MinimumDelay
        {
            get;
            private set;
        }

        /// <summary>
        /// Gets or sets the amount of scrolling in pixels.
        /// </summary>
        public Int32 ScrollAmount
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the delay of scrolling in ms.
        /// </summary>
        public Int32 ScrollDelay
        {
            get;
            set;
        }

        /// <summary>
        /// Gets or sets the loop number.
        /// </summary>
        public Int32 Loop
        {
            get;
            set;
        }

        #endregion

        #region Methods

        /// <summary>
        /// Starts the marquee loop.
        /// </summary>
        public void Start()
        {
            FireSimpleEvent(EventNames.Play);
        }

        /// <summary>
        /// Stops the marquee loop.
        /// </summary>
        public void Stop()
        {
            FireSimpleEvent(EventNames.Pause);
        }

        #endregion
    }
}

Handle Marquee start / stop via event

Handle Marquee start / stop via event


using System;
using System.Windows.Forms;

namespace FreenetTray
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            FNLog.Initialize();

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

using System;
using System.Windows.Forms;

namespace FreenetTray
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {

            // migrate settings from older config files for previous assembly versions
            FreenetTray.Properties.Settings.Default.Upgrade();

            FNLog.Initialize();

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

Migrate preferences from older assembly versions at launch

Without this, any preferences set by a user will be reset to the default
values every time the assembly version changes, for example upgrading
the tray app would cause it to forget user preferences


using System;

namespace UpVer
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                var settings = new Settings(args);
                var updater = new VersionUpdater(settings);

                var changes = updater.Process();

                if (settings.Read)
                {
                    Console.WriteLine("Current version: " + changes.Version(x => x.From));
                }
                else
                {
                    Console.WriteLine("Bumped version from " + changes.Version(x => x.From) + " to " + changes.Version(x => x.To));
                }
            }
            catch (Exception e)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(e.Message);
            }
            Console.ReadKey();
        }
    }
}

using System;

namespace UpVer
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                var settings = new Settings(args);
                var updater = new VersionUpdater(settings);

                var changes = updater.Process();

                if (settings.Read)
                {
                    Console.WriteLine("Current version: " + changes.Version(x => x.From));
                }
                else
                {
                    Console.WriteLine("Bumped version from " + changes.Version(x => x.From) + " to " + changes.Version(x => x.To));
                }
            }
            catch (Exception e)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(e.Message);
            }
        }
    }
}

Remove pause at end (left in accidentally)


<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>@ViewBag.Title</title>
    <link rel="stylesheet" type="text/css" href="~/css/styles.css" />
</head>
<body>
    <div>
        @RenderBody()
    </div>
</body>
</html>

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>@ViewBag.Title</title>
    <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
    <link rel="stylesheet" href="~/css/styles.css" />
</head>
<body>
    <div>
        @RenderBody()
    </div>
    <script src="~/lib/jquery/dist/jquery.js"></script>
    <script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
</body>
</html>

Add bootstrap and jquery using bower package management.


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

#nullable disable

using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Osu.Judgements;
using osu.Game.Rulesets.Scoring;

namespace osu.Game.Rulesets.Osu.Objects
{
    public class SliderTick : OsuHitObject
    {
        public int SpanIndex { get; set; }
        public double SpanStartTime { get; set; }

        protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty)
        {
            base.ApplyDefaultsToSelf(controlPointInfo, difficulty);

            double offset;

            if (SpanIndex > 0)
                // Adding 200 to include the offset stable used.
                // This is so on repeats ticks don't appear too late to be visually processed by the player.
                offset = 200;
            else
                offset = TimeFadeIn * 0.66f;

            TimePreempt = (StartTime - SpanStartTime) / 2 + offset;
        }

        protected override HitWindows CreateHitWindows() => HitWindows.Empty;

        public override Judgement CreateJudgement() => new SliderTickJudgement();
    }
}

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

#nullable disable

using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Osu.Judgements;
using osu.Game.Rulesets.Scoring;

namespace osu.Game.Rulesets.Osu.Objects
{
    public class SliderTick : OsuHitObject
    {
        public int SpanIndex { get; set; }
        public double SpanStartTime { get; set; }

        protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, IBeatmapDifficultyInfo difficulty)
        {
            base.ApplyDefaultsToSelf(controlPointInfo, difficulty);

            double offset;

            if (SpanIndex > 0)
                // Adding 200 to include the offset stable used.
                // This is so on repeats ticks don't appear too late to be visually processed by the player.
                offset = 200;
            else
                offset = TimePreempt * 0.66f;

            TimePreempt = (StartTime - SpanStartTime) / 2 + offset;
        }

        protected override HitWindows CreateHitWindows() => HitWindows.Empty;

        public override Judgement CreateJudgement() => new SliderTickJudgement();
    }
}

Fix osu! slider ticks appearing too late


using System;
using System.Linq;
using System.Threading.Tasks;
using Kudu.Contracts.Tracing;
using Kudu.Core.Infrastructure;

namespace Kudu.Core.Deployment
{
    public abstract class MsBuildSiteBuilder : ISiteBuilder
    {
        private const string NuGetCachePathKey = "NuGetCachePath";

        private readonly Executable _msbuildExe;
        private readonly IBuildPropertyProvider _propertyProvider;
        private readonly string _tempPath;

        public MsBuildSiteBuilder(IBuildPropertyProvider propertyProvider, string workingDirectory, string tempPath, string nugetCachePath)
        {
            _propertyProvider = propertyProvider;
            _msbuildExe = new Executable(PathUtility.ResolveMSBuildPath(), workingDirectory);

            // Disable this for now
            // _msbuildExe.EnvironmentVariables[NuGetCachePathKey] = nugetCachePath;

            _tempPath = tempPath;
        }

        protected string GetPropertyString()
        {
            return String.Join(";", _propertyProvider.GetProperties().Select(p => p.Key + "=" + p.Value));
        }

        public string ExecuteMSBuild(ITracer tracer, string arguments, params object[] args)
        {
            return _msbuildExe.Execute(tracer, arguments, args).Item1;
        }

        public abstract Task Build(DeploymentContext context);
    }
}

using System;
using System.Linq;
using System.Threading.Tasks;
using Kudu.Contracts.Tracing;
using Kudu.Core.Infrastructure;

namespace Kudu.Core.Deployment
{
    public abstract class MsBuildSiteBuilder : ISiteBuilder
    {
        private const string NuGetCachePathKey = "NuGetCachePath";
        private const string NuGetPackageRestoreKey = "EnableNuGetPackageRestore";

        private readonly Executable _msbuildExe;
        private readonly IBuildPropertyProvider _propertyProvider;
        private readonly string _tempPath;

        public MsBuildSiteBuilder(IBuildPropertyProvider propertyProvider, string workingDirectory, string tempPath, string nugetCachePath)
        {
            _propertyProvider = propertyProvider;
            _msbuildExe = new Executable(PathUtility.ResolveMSBuildPath(), workingDirectory);

            // Disable this for now
            // _msbuildExe.EnvironmentVariables[NuGetCachePathKey] = nugetCachePath;

            // NuGet.exe 1.8 will require an environment variable to make package restore work
            _msbuildExe.EnvironmentVariables[NuGetPackageRestoreKey] = "true";

            _tempPath = tempPath;
        }

        protected string GetPropertyString()
        {
            return String.Join(";", _propertyProvider.GetProperties().Select(p => p.Key + "=" + p.Value));
        }

        public string ExecuteMSBuild(ITracer tracer, string arguments, params object[] args)
        {
            return _msbuildExe.Execute(tracer, arguments, args).Item1;
        }

        public abstract Task Build(DeploymentContext context);
    }
}

Set flag to enable package restore for future versions of nuget.


using System;
using System.Collections.Generic;

namespace symbooglix
{
    public interface ISolver
    {
        void SetConstraints(ConstraintManager cm);

        // This can be used as a hint to the solver to destroy Constraints created internally in the solver
        void DropConstraints();

        // Given the constraints is the query expression satisfiable
        // \return True iff sat
        // if sat the assignment will be set to an assignment object
        //
        // If another query is made the previously received assignment object may be
        // invalid.
        bool IsQuerySat(Microsoft.Boogie.Expr Query, out IAssignment assignment);

        // Given the constraints is the negation of the query expression satisfiable
        // \return True iff sat
        // if sat the assignment will be set to an assignment object
        //
        // If another query is made the previously received assignment object may be
        // invalid.
        bool IsNotQuerySat(Microsoft.Boogie.Expr Query, out IAssignment assignment);
    }

    public interface IAssignment
    {
        Microsoft.Boogie.LiteralExpr GetAssignment(SymbolicVariable SV);
    }
}

using System;
using System.Collections.Generic;

namespace symbooglix
{
    public interface ISolver
    {
        void SetConstraints(ConstraintManager cm);
        void SetFunctions(IEnumerable<Microsoft.Boogie.Function> functions);

        // Given the constraints is the query expression satisfiable
        // \return True iff sat
        // if sat the assignment will be set to an assignment object
        //
        // If another query is made the previously received assignment object may be
        // invalid.
        bool IsQuerySat(Microsoft.Boogie.Expr Query, out IAssignment assignment);

        // Given the constraints is the negation of the query expression satisfiable
        // \return True iff sat
        // if sat the assignment will be set to an assignment object
        //
        // If another query is made the previously received assignment object may be
        // invalid.
        bool IsNotQuerySat(Microsoft.Boogie.Expr Query, out IAssignment assignment);
    }

    public interface IAssignment
    {
        Microsoft.Boogie.LiteralExpr GetAssignment(SymbolicVariable SV);
    }
}

Add method to solver interface to tell it about functions it might
see in queries.

Also remove the dropConstaints() method for now. It probably isn't
a good idea to have it as it leaks information about the internal
implementation.


using MultipleStartNodes.Models;
using MultipleStartNodes.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using umbraco.cms.businesslogic.packager.standardPackageActions;
using umbraco.interfaces;
using Umbraco.Core.Logging;

namespace MultipleStartNodes.PackageActions
{
    class CreateDatabase : IPackageAction
    {
        public string Alias()
        {
            return "MultipleStartNodes_CreateDatabase";
        }

        public bool Execute(string packageName, XmlNode xmlData)
        {
            try
            {
                Resources.DatabaseSchemaHelper.CreateTable<UserStartNodes>(false);

                return true;
            }
            catch (Exception ex)
            {
                var message = string.Concat("Error at install ", this.Alias(), " package action: ", ex);
                LogHelper.Error(typeof(CreateDatabase), message, ex);
            }

            return false;

        }

        public XmlNode SampleXml()
        {
            var xml = string.Concat("<Action runat=\"install\" undo=\"true\" alias=\"", this.Alias(), "\" />");
            return helper.parseStringToXmlNode(xml);
        }

        public bool Undo(string packageName, XmlNode xmlData)
        {
            try
            {
                Resources.DatabaseSchemaHelper.DropTable<UserStartNodes>();

                return true;
            }
            catch (Exception ex)
            {
                var message = string.Concat("Error at undo ", this.Alias(), " package action: ", ex);
                LogHelper.Error(typeof(CreateDatabase), message, ex);
            }

            return false;
        }
    }
}

using MultipleStartNodes.Models;
using MultipleStartNodes.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using umbraco.cms.businesslogic.packager.standardPackageActions;
using umbraco.interfaces;
using Umbraco.Core.Logging;

namespace MultipleStartNodes.PackageActions
{
    class CreateDatabase : IPackageAction
    {
        public string Alias()
        {
            return "MultipleStartNodes_CreateDatabase";
        }

        public bool Execute(string packageName, XmlNode xmlData)
        {
            try
            {
                if (!Resources.DatabaseSchemaHelper.TableExist("userStartNodes"))
                {
                    Resources.DatabaseSchemaHelper.CreateTable<UserStartNodes>(false);
                }

                return true;
            }
            catch (Exception ex)
            {
                var message = string.Concat("Error at install ", this.Alias(), " package action: ", ex);
                LogHelper.Error(typeof(CreateDatabase), message, ex);
            }

            return false;
        }

        public XmlNode SampleXml()
        {
            var xml = string.Concat("<Action runat=\"install\" undo=\"true\" alias=\"", this.Alias(), "\" />");
            return helper.parseStringToXmlNode(xml);
        }

        public bool Undo(string packageName, XmlNode xmlData)
        {
            try
            {
                Resources.DatabaseSchemaHelper.DropTable<UserStartNodes>();

                return true;
            }
            catch (Exception ex)
            {
                var message = string.Concat("Error at undo ", this.Alias(), " package action: ", ex);
                LogHelper.Error(typeof(CreateDatabase), message, ex);
            }

            return false;
        }
    }
}

Check if table exist before creating it in the install


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

using System;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;

namespace SampleApp
{
    public class Startup
    {
        public void Configure(IApplicationBuilder app)
        {
            app.Run(async context =>
            {
                Console.WriteLine("{0} {1}{2}{3}",
                    context.Request.Method,
                    context.Request.PathBase,
                    context.Request.Path,
                    context.Request.QueryString);

                context.Response.ContentLength = 11;
                context.Response.ContentType = "text/plain";
                await context.Response.WriteAsync("Hello world");
            });
        }
    }
}

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

using System;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Http;

namespace SampleApp
{
    public class Startup
    {
        public void Configure(IApplicationBuilder app)
        {
            app.Run(context =>
            {
                Console.WriteLine("{0} {1}{2}{3}",
                    context.Request.Method,
                    context.Request.PathBase,
                    context.Request.Path,
                    context.Request.QueryString);

                context.Response.ContentLength = 11;
                context.Response.ContentType = "text/plain";
                return context.Response.WriteAsync("Hello world");
            });
        }
    }
}

Fix sample perf (Option 1)

Fix sample perf (Option 1)

No need to await just return Task


using System;
using System.Linq;
using MvcContrib.TestHelper;
using Snittlistan.Infrastructure.Indexes;
using Snittlistan.Models;
using Xunit;

namespace Snittlistan.Test
{
	public class PlayerStat_Test : DbTest
	{
		[Fact]
		public void VerifyIndex()
		{
			// Arrange
			IndexCreator.CreateIndexes(Store);

			// Act
			var match = DbSeed.CreateMatch();
			Session.Store(match);
			Session.SaveChanges();
			WaitForNonStaleResults<Match>();
			Matches_PlayerStats.Results stats = Session.Query<Matches_PlayerStats.Results, Matches_PlayerStats>()
				.Single(s => s.Player == "Mikael Axelsson");

			// Assert
			stats.Count.ShouldBe(4);
			stats.TotalPins.ShouldBe(845);
			stats.Max.ShouldBe(223);
			stats.Min.ShouldBe(202);
		}
	}
}

using System;
using System.Linq;
using MvcContrib.TestHelper;
using Snittlistan.Infrastructure.Indexes;
using Snittlistan.Models;
using Xunit;

namespace Snittlistan.Test
{
	public class PlayerStat_Test : DbTest
	{
		[Fact]
		public void VerifyIndex()
		{
			// Arrange
			IndexCreator.CreateIndexes(Store);

			// Act
			var match = DbSeed.CreateMatch();
			Session.Store(match);
			Session.SaveChanges();
			Matches_PlayerStats.Results stats = Session.Query<Matches_PlayerStats.Results, Matches_PlayerStats>()
				.Customize(c => c.WaitForNonStaleResults())
				.Single(s => s.Player == "Mikael Axelsson");

			// Assert
			stats.Count.ShouldBe(4);
			stats.TotalPins.ShouldBe(845);
			stats.Max.ShouldBe(223);
			stats.Min.ShouldBe(202);
		}
	}
}

Correct way to wait for indexing

Correct way to wait for indexing


using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel.Syndication;
using System.Web;
using Firehose.Web.Infrastructure;

namespace Firehose.Web.Authors
{
    public class MikeKanakos : IAmACommunityMember
    {
        public string FirstName => "Mike";
        public string LastName => "Kanakos";
        public string ShortBioOrTagLine => "Windows IT pro located in the RTP area of North Carolina. Active Directory, Azure AD, Group Policy, and automation.";
        public string StateOrRegion => "Apex, NC";
        public string EmailAddress => "mike@networkadm.in";
        public string TwitterHandle => "MikeKanakos";
        public string GravatarHash => "2bca167386e229ec2c5606f6c1677493";
        public string GitHubHandle => "compwiz32";
        public GeoPosition Position => new GeoPosition(35.7327, 78.8503);

        public Uri WebSite => new Uri("https://www.networkadm.in/");
        public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://www.networkadm.in/rss/"); } }
    }
}

Add missing namespace and using statements.


using Newtonsoft.Json;

namespace Nest
{
	[JsonObject]
	public class CatIndicesRecord : ICatRecord
	{
		[JsonProperty("docs.count")]
		public string DocsCount { get; set; }

		[JsonProperty("docs.deleted")]
		public string DocsDeleted { get; set; }

		[JsonProperty("health")]
		public string Health { get; set; }

		[JsonProperty("index")]
		public string Index { get; set; }

		[JsonProperty("pri")]
		public string Primary { get; set; }

		[JsonProperty("pri.store.size")]
		public string PrimaryStoreSize { get; set; }

		[JsonProperty("rep")]
		public string Replica { get; set; }

		[JsonProperty("store.size")]
		public string StoreSize { get; set; }
	}
}

using Newtonsoft.Json;

namespace Nest
{
	[JsonObject]
	public class CatIndicesRecord : ICatRecord
	{
		[JsonProperty("docs.count")]
		public string DocsCount { get; set; }

		[JsonProperty("docs.deleted")]
		public string DocsDeleted { get; set; }

		[JsonProperty("health")]
		public string Health { get; set; }

		[JsonProperty("index")]
		public string Index { get; set; }

		[JsonProperty("pri")]
		public string Primary { get; set; }

		[JsonProperty("pri.store.size")]
		public string PrimaryStoreSize { get; set; }

		[JsonProperty("rep")]
		public string Replica { get; set; }

		[JsonProperty("store.size")]
		public string StoreSize { get; set; }

		[JsonProperty("status")]
		public string Status { get; set; }
	}
}

Add status to cat indices response

Add status to cat indices response

Closes #1340


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

using System;
using System.Diagnostics;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Testing;

namespace Microsoft.Extensions.Logging.Testing
{
    /// <summary>
    /// Capture the memory dump upon test failure.
    /// </summary>
    /// <remarks>
    /// This currently only works in Windows environments
    /// </remarks>
    [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
    public class CollectDumpAttribute : Attribute, ITestMethodLifecycle
    {
        public Task OnTestStartAsync(TestContext context, CancellationToken cancellationToken)
        {
            return Task.CompletedTask;
        }

        public Task OnTestEndAsync(TestContext context, Exception exception, CancellationToken cancellationToken)
        {
            if (exception != null)
            {
                var path = Path.Combine(context.FileOutput.TestClassOutputDirectory, context.FileOutput.GetUniqueFileName(context.FileOutput.TestName, ".dmp"));
                var process = Process.GetCurrentProcess();
                DumpCollector.Collect(process, path);
            }

            return Task.CompletedTask;
        }
    }
}

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

using System;
using System.Diagnostics;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Testing;

namespace Microsoft.Extensions.Logging.Testing
{
    /// <summary>
    /// Capture the memory dump upon test failure.
    /// </summary>
    /// <remarks>
    /// This currently only works in Windows environments
    /// </remarks>
    [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
    public class CollectDumpAttribute : Attribute, ITestMethodLifecycle
    {
        public Task OnTestStartAsync(TestContext context, CancellationToken cancellationToken)
        {
            return Task.CompletedTask;
        }

        public Task OnTestEndAsync(TestContext context, Exception exception, CancellationToken cancellationToken)
        {
            if (exception != null)
            {
                var path = Path.Combine(context.FileOutput.TestClassOutputDirectory, context.FileOutput.GetUniqueFileName(context.FileOutput.TestName, ".dmp"));
                var process = Process.GetCurrentProcess();
                DumpCollector.Collect(process, path);
            }

            return Task.CompletedTask;
        }
    }
}

Normalize all file headers to the expected Apache 2.0 license


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

namespace osu.Game.Rulesets.Osu.Skinning
{
    public enum OsuSkinColour
    {
        SliderTrackOverride,
        SliderBorder,
        SliderBall
    }
}

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

namespace osu.Game.Rulesets.Osu.Skinning
{
    public enum OsuSkinColour
    {
        SliderTrackOverride,
        SliderBorder,
        SliderBall,
        SpinnerBackground,
    }
}

Add lookup for spinner background colour


namespace RestfulRouting
{
	public abstract class Mapper
	{
	}
}

using System;
using System.Web.Routing;

namespace RestfulRouting
{
	public abstract class Mapper
	{
		protected Route GenerateRoute(string path, string controller, string action, string[] httpMethods)
		{
			throw new NotImplementedException();
		}
	}
}

Add new method stub for generating routes


using SyntaxTree.VisualStudio.Unity.Bridge;
using UnityEditor;

[InitializeOnLoad]
public class NCrunchAdapterForUnity
{
    public const string NUnitUnityReference = @"<Reference Include=""nunit.framework"">
      <HintPath>Library\UnityAssemblies\nunit.framework.dll</HintPath>
    </Reference>";

    public const string NUnitOfficialReference = @"<Reference Include=""nunit.framework"">
      <HintPath>Assets\Plugins\Editor\NCrunchAdapterForUnity\NUnit.3.5.0\lib\net35\nunit.framework.dll</HintPath>
    </Reference>";

    static NCrunchAdapterForUnity()
    {
        ProjectFilesGenerator.ProjectFileGeneration += (string name, string content) =>
        {
            return content.Replace(NUnitUnityReference, NUnitOfficialReference);
        };
    }
}

using System.Text.RegularExpressions;
using SyntaxTree.VisualStudio.Unity.Bridge;
using UnityEditor;

[InitializeOnLoad]
public class NCrunchAdapterForUnity
{
    public const string NUnitUnityReference = @"<Reference Include=""nunit.framework"">
      <HintPath>.*nunit.framework.dll</HintPath>
    </Reference>";

    public const string NUnitOfficialReference = @"<Reference Include=""nunit.framework"">
      <HintPath>Assets\Plugins\Editor\NCrunchAdapterForUnity\NUnit.3.5.0\lib\net35\nunit.framework.dll</HintPath>
    </Reference>";

    static NCrunchAdapterForUnity()
    {
        ProjectFilesGenerator.ProjectFileGeneration += (string name, string content) =>
        {
            var regex = new Regex(NUnitUnityReference);
            return regex.Replace(content, NUnitOfficialReference);
        };
    }
}

Replace reference by using regex

Replace reference by using regex

To avoid path inconsistence between different Unity versions.


using System;
using TrueCraft.API.Logic;
using TrueCraft.Core.Logic.Items;
using TrueCraft.API;

namespace TrueCraft.Core.Logic.Blocks
{
    public class TallGrassBlock : BlockProvider
    {
        public static readonly byte BlockID = 0x1F;

        public override byte ID { get { return 0x1F; } }

        public override double BlastResistance { get { return 0; } }

        public override double Hardness { get { return 0; } }

        public override byte Luminance { get { return 0; } }

        public override bool Opaque { get { return false; } }

        public override string DisplayName { get { return "Tall Grass"; } }

        public override Tuple<int, int> GetTextureMap(byte metadata)
        {
            return new Tuple<int, int>(7, 2);
        }

        protected override ItemStack[] GetDrop(BlockDescriptor descriptor)
        {
            return new[] { new ItemStack(SeedsItem.ItemID, (sbyte)MathHelper.Random.Next(2), descriptor.Metadata) };
        }
    }
}

using System;
using TrueCraft.API.Logic;
using TrueCraft.Core.Logic.Items;
using TrueCraft.API;

namespace TrueCraft.Core.Logic.Blocks
{
    public class TallGrassBlock : BlockProvider
    {
        public static readonly byte BlockID = 0x1F;

        public override byte ID { get { return 0x1F; } }

        public override double BlastResistance { get { return 0; } }

        public override double Hardness { get { return 0; } }

        public override byte Luminance { get { return 0; } }

        public override bool Opaque { get { return false; } }

        public override string DisplayName { get { return "Tall Grass"; } }

        public override Tuple<int, int> GetTextureMap(byte metadata)
        {
            return new Tuple<int, int>(7, 2);
        }

        protected override ItemStack[] GetDrop(BlockDescriptor descriptor)
        {
            return new[] { new ItemStack(SeedsItem.ItemID, (sbyte)MathHelper.Random.Next(2)) };
        }
    }
}

Remove tall grass metadata when dropping seed


using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;

namespace Anlab.Core.Domain
{
    public class TestItem
    {
        [Key]
        public int Id { get; set; }

        [Required]
        [StringLength(7)]
        public string FeeSchedule { get; set; }

        [Required]
        [StringLength(512)]
        public string Analysis { get; set; }

        [Required]
        [StringLength(128)]
        public string Code { get; set; }

        public decimal InternalCost { get; set; }

        public decimal ExternalCost { get; set; }

        public decimal SetupCost { get; set; }

        [Required]
        [StringLength(64)]
        public string Category { get; set; }

        [Required]
        [StringLength(8)]
        public string Group { get; set; }

        [Range(0, int.MaxValue)]
        public int Multiplier { get; set; }

        public bool Multiplies { get; set; }

        public bool ChargeSet { get; set; }

        public bool Public { get; set; }

        public string GroupType { get; set; }

        public string Notes { get; set; }
    }

    public static class TestCategories
    {
        public static string Soil = "Soil";
        public static string Plant = "Plant";
        public static string Water = "Water";
    }
}

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;

namespace Anlab.Core.Domain
{
    public class TestItem
    {
        [Key]
        public int Id { get; set; }

        [Required]
        [StringLength(7)]
        public string FeeSchedule { get; set; }

        [Required]
        [StringLength(512)]
        public string Analysis { get; set; }

        [Required]
        [StringLength(128)]
        public string Code { get; set; }

        public decimal InternalCost { get; set; }

        public decimal ExternalCost { get; set; }

        public decimal SetupCost { get; set; }

        [Required]
        [StringLength(64)]
        public string Category { get; set; }

        [Required]
        [StringLength(8)]
        public string Group { get; set; }

        [Range(0, int.MaxValue)]
        public int Multiplier { get; set; }

        public bool Multiplies { get; set; }

        public bool ChargeSet { get; set; }

        public bool Public { get; set; }

        public string GroupType { get; set; }

        public string Notes { get; set; }
    }

    public static class TestCategories
    {
        public static string Soil = "Soil";
        public static string Plant = "Plant";
        public static string Water = "Water";
        public static string Other = "Other";
    }
}

Add other to the enum

Add other to the enum


using System.Collections.Generic;
using System.Linq;
using Parsley;
using Rook.Compiling.Types;

namespace Rook.Compiling.Syntax
{
    public class Class : TypedSyntaxTree, Binding
    {
        public Position Position { get; private set; }
        public Name Name { get; private set; }
        public IEnumerable<Function> Methods { get; private set; }
        public DataType Type { get; private set; }

        public Class(Position position, Name name, IEnumerable<Function> methods)
            : this(position, name, methods, ConstructorFunctionType(name)) { }

        private Class(Position position, Name name, IEnumerable<Function> methods, DataType type)
        {
            Position = position;
            Name = name;
            Methods = methods;
            Type = type;
        }

        public TResult Visit<TResult>(Visitor<TResult> visitor)
        {
            return visitor.Visit(this);
        }

        public TypeChecked<Class> WithTypes(Environment environment)
        {
            var localEnvironment = new Environment(environment);

            foreach (var method in Methods)
                if (!environment.TryIncludeUniqueBinding(method))
                    return TypeChecked<Class>.DuplicateIdentifierError(method);

            var typeCheckedMethods = Methods.WithTypes(localEnvironment);

            var errors = typeCheckedMethods.Errors();
            if (errors.Any())
                return TypeChecked<Class>.Failure(errors);

            return TypeChecked<Class>.Success(new Class(Position, Name, typeCheckedMethods.Functions()));
        }

        private static NamedType ConstructorFunctionType(Name name)
        {
            return NamedType.Constructor(new NamedType(name.Identifier));
        }

        string Binding.Identifier
        {
            get { return Name.Identifier; }
        }
    }
}

using System.Collections.Generic;
using System.Linq;
using Parsley;
using Rook.Compiling.Types;

namespace Rook.Compiling.Syntax
{
    public class Class : TypedSyntaxTree, Binding
    {
        public Position Position { get; private set; }
        public Name Name { get; private set; }
        public IEnumerable<Function> Methods { get; private set; }
        public DataType Type { get; private set; }

        public Class(Position position, Name name, IEnumerable<Function> methods)
            : this(position, name, methods, ConstructorFunctionType(name)) { }

        private Class(Position position, Name name, IEnumerable<Function> methods, DataType type)
        {
            Position = position;
            Name = name;
            Methods = methods;
            Type = type;
        }

        public TResult Visit<TResult>(Visitor<TResult> visitor)
        {
            return visitor.Visit(this);
        }

        public TypeChecked<Class> WithTypes(Environment environment)
        {
            var localEnvironment = new Environment(environment);

            foreach (var method in Methods)
                if (!localEnvironment.TryIncludeUniqueBinding(method))
                    return TypeChecked<Class>.DuplicateIdentifierError(method);

            var typeCheckedMethods = Methods.WithTypes(localEnvironment);

            var errors = typeCheckedMethods.Errors();
            if (errors.Any())
                return TypeChecked<Class>.Failure(errors);

            return TypeChecked<Class>.Success(new Class(Position, Name, typeCheckedMethods.Functions()));
        }

        private static NamedType ConstructorFunctionType(Name name)
        {
            return NamedType.Constructor(new NamedType(name.Identifier));
        }

        string Binding.Identifier
        {
            get { return Name.Identifier; }
        }
    }
}

Fix bug in which class members polluted the surrounding namespace.


using System.Reflection;
using System.Security;

[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyCopyright("Copyright 2008-2009 James Gregory and contributors (Paul Batum, Andrew Stewart, Chad Myers et al). All rights reserved.")]
[assembly: AssemblyProduct("Fluent NHibernate")]
[assembly: AssemblyCompany("http://fluentnhibernate.org")]
[assembly: AssemblyConfiguration("debug")]
[assembly: AssemblyInformationalVersion("0.1.0.0")]
[assembly: AllowPartiallyTrustedCallers]

using System.Reflection;
using System.Security;

[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyCopyright("Copyright 2008-2009 James Gregory and contributors (Paul Batum, Andrew Stewart, Chad Myers, Hudson Akridge et al). All rights reserved.")]
[assembly: AssemblyProduct("Fluent NHibernate")]
[assembly: AssemblyCompany("http://fluentnhibernate.org")]
[assembly: AssemblyConfiguration("debug")]
[assembly: AssemblyInformationalVersion("0.1.0.0")]
[assembly: AllowPartiallyTrustedCallers]

Test for Jame's Github mirror

Test for Jame's Github mirror

git-svn-id: a161142445158cf41e00e2afdd70bb78aded5464@496 48f0ce17-cc52-0410-af8c-857c09b6549b


namespace FsxWebApi.Services
{
    using System.Web.Http.Cors;
    using Infrastructure;
    using Model;
    using System.Web.Http;

    [EnableCors(origins: "http://localhost:26759", headers: "*", methods: "*")]
    public class PlaneController : ApiController
    {
        private readonly FsxManager _fsxManager = new FsxManager();

        // GET: api/Plane
        public IHttpActionResult Get()
        {
            //return ActionRes;
            PlaneData planeData = _fsxManager.GetCurrentPlaneData();

            if (planeData == null)
            {
                return NotFound();
            }
            return Ok(planeData);
        }

        // POST: api/Plane
        public void Post(Location newLocation)
        {
            // Pass the values to the FSX
        }
    }
}

namespace FsxWebApi.Services
{
    using System.Web.Http.Cors;
    using Infrastructure;
    using Model;
    using System.Web.Http;

    [EnableCors(origins: "*", headers: "*", methods: "*")]
    public class PlaneController : ApiController
    {
        private readonly FsxManager _fsxManager = new FsxManager();

        // GET: api/Plane
        public IHttpActionResult Get()
        {
            //return ActionRes;
            PlaneData planeData = _fsxManager.GetCurrentPlaneData();

            if (planeData == null)
            {
                return NotFound();
            }
            return Ok(planeData);
        }

        // POST: api/Plane
        public void Post(Location newLocation)
        {
            // Pass the values to the FSX
        }
    }
}

Access allwed for all addresses (by CORS)


@model OpenOrderFramework.Models.Order
@{
    ViewBag.Title = "P4MCheckout";
}
<link rel="import" href="/Scripts/widgets/p4m-checkout/p4m-checkout.html">
<link rel="import" href="/Scripts/widgets/p4m-login/p4m-login.html">

Parcel For Me

<p4m-login></p4m-login>
<p4m-checkout></p4m-checkout>

@model OpenOrderFramework.Models.Order
@{
    ViewBag.Title = "P4MCheckout";
}
<link rel="import" href="/Scripts/widgets/p4m-checkout/p4m-checkout.html">
<link rel="import" href="/Scripts/widgets/p4m-login/p4m-login.html">

Parcel For Me

<p4m-checkout></p4m-checkout>

Remove redundant login widget in page

Remove redundant login widget in page


using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace NutEngine
{
    public class Sprite : Node, IDrawable
    {
        public Texture2D Atlas { get; }

        public Rectangle? Frame { get; set; }
        public Color Color { get; set; }
        public Vector2 Origin { get; set; }
        public SpriteEffects Effects { get; set; }
        public float LayerDepth { get; set; }

        public Sprite(Texture2D atlas, Rectangle? frame) : base()
        {
            Atlas = atlas;
            Frame = frame;

            Color = Color.White;

            if (Frame != null) {
                var center = Frame.Value.Center;
                Origin = new Vector2(center.X, center.Y);
            }
            else {
                Origin = new Vector2(Atlas.Width / 2.0f, Atlas.Height / 2.0f);
            }

            Effects = SpriteEffects.None;
            LayerDepth = 0;
        }

        public void Draw(SpriteBatch spriteBatch, Transform2D currentTransform)
        {
            Vector2 position, scale;
            float rotation;

            currentTransform.Decompose(out scale, out rotation, out position);

            spriteBatch.Draw(
                  Atlas
                , position
                , Frame
                , Color
                , rotation
                , Origin
                , scale
                , Effects
                , LayerDepth);
        }
    }
}

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace NutEngine
{
    public class Sprite : Node, IDrawable
    {
        public Texture2D Atlas { get; }

        public Rectangle? Frame { get; set; }
        public Color Color { get; set; }
        public Vector2 Origin { get; set; }
        public SpriteEffects Effects { get; set; }
        public float LayerDepth { get; set; }

        public Sprite(Texture2D atlas, Rectangle? frame = null) : base()
        {
            Atlas = atlas;
            Frame = frame;

            Color = Color.White;

            if (Frame != null) {
                var center = Frame.Value.Center;
                Origin = new Vector2(center.X, center.Y);
            }
            else {
                Origin = new Vector2(Atlas.Width / 2.0f, Atlas.Height / 2.0f);
            }

            Effects = SpriteEffects.None;
            LayerDepth = 0;
        }

        public void Draw(SpriteBatch spriteBatch, Transform2D currentTransform)
        {
            Vector2 position, scale;
            float rotation;

            currentTransform.Decompose(out scale, out rotation, out position);

            spriteBatch.Draw(
                  Atlas
                , position
                , Frame
                , Color
                , rotation
                , Origin
                , scale
                , Effects
                , LayerDepth);
        }
    }
}

Add default value for frame in constructor


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

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

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

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

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

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

Increment assembly version to 1.1.2

Increment assembly version to 1.1.2


using System.Runtime.Serialization;

namespace CefSharp
{
	[DataContract]
	[KnownType(typeof(object[]))]
	public class JavascriptResponse
	{
		[DataMember]
		public string Message { get; set; }

		[DataMember]
		public bool Success { get; set; }

		[DataMember]
		public object Result { get; set; }
	}
}

using System.Collections.Generic;
using System.Runtime.Serialization;

namespace CefSharp
{
	[DataContract]
	[KnownType(typeof(object[]))]
	[KnownType(typeof(Dictionary<string,object>))]
	public class JavascriptResponse
	{
		[DataMember]
		public string Message { get; set; }

		[DataMember]
		public bool Success { get; set; }

		[DataMember]
		public object Result { get; set; }
	}
}

Add [KnownType(typeof(Dictionary<string,object>))] to allow for Object mapping to be passed over WCF channel


using Swigged.LLVM;
using Mono.Cecil;
using Mono.Cecil.Cil;
using CSharpLLVM.Compilation;
using CSharpLLVM.Stack;

namespace CSharpLLVM.Generator.Instructions.FlowControl
{
    [InstructionHandler(Code.Ret)]
    class EmitRet : ICodeEmitter
    {
        /// <summary>
        /// Emits a ret instruction.
        /// </summary>
        /// <param name="instruction">The instruction.</param>
        /// <param name="context">The context.</param>
        /// <param name="builder">The builder.</param>
        public void Emit(Instruction instruction, MethodContext context, BuilderRef builder)
        {
            if (context.Method.ReturnType.MetadataType == MetadataType.Void)
            {
                LLVM.BuildRetVoid(builder);
            }
            else
            {
                StackElement element = context.CurrentStack.Pop();
                LLVM.BuildRet(builder, element.Value);
            }
        }
    }
}

using Swigged.LLVM;
using Mono.Cecil;
using Mono.Cecil.Cil;
using CSharpLLVM.Compilation;
using CSharpLLVM.Stack;
using CSharpLLVM.Helpers;

namespace CSharpLLVM.Generator.Instructions.FlowControl
{
    [InstructionHandler(Code.Ret)]
    class EmitRet : ICodeEmitter
    {
        /// <summary>
        /// Emits a ret instruction.
        /// </summary>
        /// <param name="instruction">The instruction.</param>
        /// <param name="context">The context.</param>
        /// <param name="builder">The builder.</param>
        public void Emit(Instruction instruction, MethodContext context, BuilderRef builder)
        {
            TypeReference returnType = context.Method.ReturnType;
            if (returnType.MetadataType == MetadataType.Void)
            {
                LLVM.BuildRetVoid(builder);
            }
            else
            {
                StackElement element = context.CurrentStack.Pop();
                TypeRef returnTypeRef = TypeHelper.GetTypeRefFromType(returnType);

                if (element.Type != returnTypeRef)
                {
                    CastHelper.HelpIntAndPtrCast(builder, ref element.Value, element.Type, returnTypeRef);
                }

                LLVM.BuildRet(builder, element.Value);
            }
        }
    }
}

Add cast on return value if needed

Add cast on return value if needed


using MagicalCryptoWallet.KeyManagement;
using MagicalCryptoWallet.Services;
using NBitcoin;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using Xunit;

namespace MagicalCryptoWallet.Tests
{
    public class WalletTests : IClassFixture<SharedFixture>
	{
		private SharedFixture SharedFixture { get; }

		public WalletTests(SharedFixture fixture)
		{
			SharedFixture = fixture;
		}

		[Fact]
		public async Task BasicWalletTestAsync()
		{
			var manager = KeyManager.CreateNew(out Mnemonic mnemonic, "password");
			var dataFolder = Path.Combine(SharedFixture.DataDir, nameof(BasicWalletTestAsync));
			using (var wallet = new WalletService(dataFolder, Network.Main, manager))
			{
				wallet.Start();
				await Task.Delay(1000);
			}
		}
	}
}

using MagicalCryptoWallet.KeyManagement;
using MagicalCryptoWallet.Logging;
using MagicalCryptoWallet.Services;
using NBitcoin;
using NBitcoin.Protocol;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Xunit;

namespace MagicalCryptoWallet.Tests
{
    public class WalletTests : IClassFixture<SharedFixture>
	{
		private SharedFixture SharedFixture { get; }

		public WalletTests(SharedFixture fixture)
		{
			SharedFixture = fixture;
		}

		[Fact]
		public async Task CanConnectToNodesTestAsync()
		{
			var manager = KeyManager.CreateNew(out Mnemonic mnemonic, "password");
			var dataFolder = Path.Combine(SharedFixture.DataDir, nameof(CanConnectToNodesTestAsync));
			using (var wallet = new WalletService(dataFolder, Network.Main, manager))
			{

				wallet.Nodes.ConnectedNodes.Added += ConnectedNodes_Added;
				wallet.Nodes.ConnectedNodes.Removed += ConnectedNodes_Removed;
				wallet.Start();
				// Using the interlocked, not because it makes sense in this context, but to
				// set an example that these values are often concurrency sensitive
				while (Interlocked.Read(ref _nodeCount) < 3)
				{
					await Task.Delay(100);
				}
			}
		}

		private long _nodeCount = 0;
		private void ConnectedNodes_Added(object sender, NodeEventArgs e)
		{
			var nodes = sender as NodesCollection;
			Interlocked.Increment(ref _nodeCount);
			Logger.LogInfo<WalletTests>($"Node count:{Interlocked.Read(ref _nodeCount)}");
		}
		private void ConnectedNodes_Removed(object sender, NodeEventArgs e)
		{
			var nodes = sender as NodesCollection;
			Interlocked.Decrement(ref _nodeCount);
			// Trace is fine here, building the connections is more exciting than removing them.
			Logger.LogTrace<WalletTests>($"Node count:{Interlocked.Read(ref _nodeCount)}");
		}
	}
}

Add connection to the Bitcoin network test


// 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.Sprites;
using osu.Game.Online.API.Requests.Responses;

namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
{
    public class FavouriteButton : BeatmapCardIconButton
    {
        private readonly APIBeatmapSet beatmapSet;

        public FavouriteButton(APIBeatmapSet beatmapSet)
        {
            this.beatmapSet = beatmapSet;

            Icon.Icon = FontAwesome.Regular.Heart;
        }

        // TODO: implement behaviour
    }
}

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

using osu.Framework.Allocation;
using osu.Framework.Graphics.Sprites;
using osu.Game.Online.API.Requests.Responses;
using osu.Framework.Logging;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Resources.Localisation.Web;

namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
{
    public class FavouriteButton : BeatmapCardIconButton
    {
        private readonly APIBeatmapSet beatmapSet;

        private PostBeatmapFavouriteRequest favouriteRequest;

        public FavouriteButton(APIBeatmapSet beatmapSet)
        {
            this.beatmapSet = beatmapSet;

            updateState();
        }

        [BackgroundDependencyLoader]
        private void load(IAPIProvider api)
        {
            Action = () =>
            {
                var actionType = beatmapSet.HasFavourited ? BeatmapFavouriteAction.UnFavourite : BeatmapFavouriteAction.Favourite;

                favouriteRequest?.Cancel();
                favouriteRequest = new PostBeatmapFavouriteRequest(beatmapSet.OnlineID, actionType);

                Enabled.Value = false;
                favouriteRequest.Success += () =>
                {
                    beatmapSet.HasFavourited = actionType == BeatmapFavouriteAction.Favourite;
                    Enabled.Value = true;
                    updateState();
                };
                favouriteRequest.Failure += e =>
                {
                    Logger.Error(e, $"Failed to {actionType.ToString().ToLower()} beatmap: {e.Message}");
                    Enabled.Value = true;
                };

                api.Queue(favouriteRequest);
            };
        }

        private void updateState()
        {
            if (beatmapSet.HasFavourited)
            {
                Icon.Icon = FontAwesome.Solid.Heart;
                TooltipText = BeatmapsetsStrings.ShowDetailsUnfavourite;
            }
            else
            {
                Icon.Icon = FontAwesome.Regular.Heart;
                TooltipText = BeatmapsetsStrings.ShowDetailsFavourite;
            }
        }
    }
}

Implement basic behaviour of favourite button


using System.Reflection;

[assembly: AssemblyTitle("Autofac.Extras.Tests.EnterpriseLibraryConfigurator")]
[assembly: AssemblyDescription("Tests for the Autofac container configurator for Enterprise Library.")]

Build script now writes the package name and version into the AssemblyDescription attibute. This allows the package information to be seen in Visual Studio avoiding confusion with the assembly version that remains at the major.


using System;
using System.ComponentModel;
using System.Diagnostics;

namespace WOptiPng
{
    public static class OptiPngWrapper
    {
        public static bool OptiPngExists()
        {
            var process = new Process
            {
                StartInfo = new ProcessStartInfo("optipng")
                {
                    UseShellExecute = false,
                    CreateNoWindow = true
                }
            };
            try
            {
                process.Start();
            }
            catch (Win32Exception)
            {
                return false;
            }
            return true;
        }

        public static int Optimize(string inputPath, string outputPath, Settings settings,
            Action<string> standardErrorCallback)
        {
            using (var p = new Process
            {
                StartInfo = new ProcessStartInfo("optipng")
                {
                    UseShellExecute = false,
                    CreateNoWindow = true,
                    Arguments = FormatArguments(outputPath, inputPath, settings.OptLevel),
                    RedirectStandardError = true,
                }
            })
            {
                p.Start();
                p.PriorityClass = settings.ProcessPriority;
                p.ErrorDataReceived += (sender, e) =>
                {
                    if (standardErrorCallback != null)
                    {
                        standardErrorCallback(e.Data);
                    }
                };
                p.BeginErrorReadLine();
                p.WaitForExit();
                return p.ExitCode;
            }
        }

        private static string FormatArguments(string outputPath, string inputPath, int optLevel)
        {
            return string.Format("-clobber -preserve -out \"{0}\" -o {1} \"{2}\"", outputPath, optLevel, inputPath);
        }
    }
}

using System;
using System.ComponentModel;
using System.Diagnostics;

namespace WOptiPng
{
    public static class OptiPngWrapper
    {
        public static bool OptiPngExists()
        {
            var process = new Process
            {
                StartInfo = new ProcessStartInfo("optipng")
                {
                    UseShellExecute = false,
                    CreateNoWindow = true
                }
            };
            try
            {
                process.Start();
            }
            catch (Win32Exception)
            {
                return false;
            }
            return true;
        }

        public static int Optimize(string inputPath, string outputPath, Settings settings,
            Action<string> standardErrorCallback)
        {
            using (var p = new Process
            {
                StartInfo = new ProcessStartInfo("optipng")
                {
                    UseShellExecute = false,
                    CreateNoWindow = true,
                    Arguments = FormatArguments(outputPath, inputPath, settings.OptLevel),
                    RedirectStandardError = true,
                }
            })
            {
                p.Start();
                p.PriorityClass = settings.ProcessPriority;
                p.ErrorDataReceived += (sender, e) =>
                {
                    if (standardErrorCallback != null)
                    {
                        standardErrorCallback(e.Data);
                    }
                };
                p.BeginErrorReadLine();
                p.WaitForExit();
                return p.ExitCode;
            }
        }

        private static string FormatArguments(string outputPath, string inputPath, int optLevel)
        {
            return string.Format("-clobber -preserve -fix -out \"{0}\" -o {1} \"{2}\"", outputPath, optLevel, inputPath);
        }
    }
}

Allow OptiPNG to fix some apparently broken PNGs


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

namespace Microsoft.Azure.Devices.Client
{
    /// <summary>
    /// Transport types supported by DeviceClient
    /// </summary>
    public enum TransportType
    {
        /// <summary>
        /// Advanced Message Queuing Protocol transport.
        /// Try Amqp over TCP first and fallback to Amqp over WebSocket if that fails
        /// </summary>
        Amqp = 0,

        /// <summary>
        /// HyperText Transfer Protocol version 1 transport.
        /// </summary>
        Http1 = 1,

        /// <summary>
        /// Advanced Message Queuing Protocol transport over WebSocket only.
        /// </summary>
        Amqp_WebSocket_Only = 2,

        /// <summary>
        /// Advanced Message Queuing Protocol transport over native TCP only
        /// </summary>
        Amqp_Tcp_Only = 3,

        /// <summary>
        /// Message Queuing Telemetry Transport.
        /// </summary>
        Mqtt = 4
    }
}

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

namespace Microsoft.Azure.Devices.Client
{
    /// <summary>
    /// Transport types supported by DeviceClient - AMQP/TCP, HTTP 1.1, MQTT/TCP, AMQP/WS, MQTT/WS
    /// </summary>
    public enum TransportType
    {
        /// <summary>
        /// Advanced Message Queuing Protocol transport.
        /// Try Amqp over TCP first and fallback to Amqp over WebSocket if that fails
        /// </summary>
        Amqp = 0,

        /// <summary>
        /// HyperText Transfer Protocol version 1 transport.
        /// </summary>
        Http1 = 1,

        /// <summary>
        /// Advanced Message Queuing Protocol transport over WebSocket only.
        /// </summary>
        Amqp_WebSocket_Only = 2,

        /// <summary>
        /// Advanced Message Queuing Protocol transport over native TCP only
        /// </summary>
        Amqp_Tcp_Only = 3,

        /// <summary>
        /// Message Queuing Telemetry Transport.
        /// Try Mqtt over TCP first and fallback to Mqtt over WebSocket if that fails
        /// </summary>
        Mqtt = 4,

        /// <summary>
        /// Message Queuing Telemetry Transport over Websocket only.
        /// </summary>
        Mqtt_WebSocket_Only = 5,

        /// <summary>
        /// Message Queuing Telemetry Transport over native TCP only
        /// </summary>
        Mqtt_Tcp_Only = 6,
    }
}

Update tranportype with new additions for Mqtt/Ws and Mqtt/Tcp