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

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

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

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("763b7fef-ff24-407d-8dce-5313e6129941")]

// 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.8.0.0")]

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

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

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

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("763b7fef-ff24-407d-8dce-5313e6129941")]

// 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.9.0.0")]

Increase version to 1.9 to reflect the new AdhocQuery capability change.


namespace McIP
{
    using System;
    using System.Diagnostics;
    using System.IO;

    public static class Program
    {
        public static void Main()
        {
            var si = new ProcessStartInfo("ipconfig", "/all")
            {
                RedirectStandardOutput = true,
                UseShellExecute = false
            };

            var p = Process.Start(si);

            StreamReader reader = p.StandardOutput;

            string heading = string.Empty;

            string line;
            while ((line = reader.ReadLine()) != null)
            {
                if (!string.IsNullOrEmpty(line) && !line.StartsWith(" ", StringComparison.Ordinal))
                {
                    heading = line;
                }

                if (line.Contains("IP Address"))
                {
                    Console.WriteLine(heading);
                    Console.WriteLine(line);
                    Console.WriteLine();
                }
            }
        }
    }
}

namespace McIP
{
    using System;
    using System.Diagnostics;
    using System.IO;

    public static class Program
    {
        public static void Main()
        {
            var si = new ProcessStartInfo("ipconfig", "/all")
            {
                RedirectStandardOutput = true,
                UseShellExecute = false
            };

            var p = Process.Start(si);

            StreamReader reader = p.StandardOutput;

            string heading = string.Empty;
            bool headingPrinted = false;

            string line;
            while ((line = reader.ReadLine()) != null)
            {
                if (!string.IsNullOrEmpty(line) && !line.StartsWith(" ", StringComparison.Ordinal))
                {
                    heading = line;
                    headingPrinted = false;
                }

                if (line.ContainsAny("IP Address", "IPv4 Address", "IPv6 Address"))
                {
                    if (!headingPrinted)
                    {
                        Console.WriteLine();
                        Console.WriteLine(heading);
                        headingPrinted = true;
                    }

                    Console.WriteLine(line);
                }
            }
        }

        private static bool ContainsAny(this string target, params string[] values)
        {
            if (values == null)
            {
                throw new ArgumentNullException("values");
            }

            foreach (var value in values)
            {
                if (target.Contains(value))
                {
                    return true;
                }
            }

            return false;
        }
    }
}

Handle IPv4 Address and IPv6 Address

Handle IPv4 Address and IPv6 Address


using Microsoft.AspNetCore.Mvc;
using Promact.Trappist.DomainModel.ApplicationClasses;
using Promact.Trappist.Repository.Questions;
using System;

namespace Promact.Trappist.Core.Controllers
{
    [Route("api")]
    public class QuestionController : Controller
    {
        private readonly IQuestionRepository _questionsRepository;

        public QuestionsController(IQuestionRepository questionsRepository)
        {
            _questionsRepository = questionsRepository;
        }

          /// <summary>
        /// Add single multiple answer question into model
        /// </summary>
        /// <param name="singleMultipleQuestion"></param>
        /// <returns></returns>
        [Route("singlemultiplequestion")]
        [HttpPost]
        public IActionResult AddSingleMultipleAnswerQuestion([FromBody]SingleMultipleQuestion singleMultipleQuestion)
        {
            _questionsRepository.AddSingleMultipleAnswerQuestion(singleMultipleQuestion.singleMultipleAnswerQuestion,singleMultipleQuestion.singleMultipleAnswerQuestionOption);
            return Ok(singleMultipleQuestion);
        }
    }
}

Create server side API for single multiple answer question


// Copyright 2019 Maintainers of NUKE.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE

using System;
using System.Linq;
using Nuke.Common.Utilities;

namespace Nuke.Common.CI.TeamCity.Configuration
{
    public class TeamCityScheduledTrigger : TeamCityTrigger
    {
        public string BranchFilter { get; set; }
        public string TriggerRules { get; set; }
        public bool TriggerBuildAlways { get; set; } //TODO: check
        public bool WithPendingChangesOnly { get; set; }
        public bool EnableQueueOptimization { get; set; }

        public override void Write(CustomFileWriter writer)
        {
            using (writer.WriteBlock("schedule"))
            {
                using (writer.WriteBlock("schedulingPolicy = daily"))
                {
                    writer.WriteLine("hour = 3");
                    writer.WriteLine("timezone = \"Europe/Berlin\"");
                }

                writer.WriteLine($"branchFilter = {BranchFilter.DoubleQuote()}");
                writer.WriteLine($"triggerRules = {TriggerRules.DoubleQuote()}");
                writer.WriteLine("triggerBuild = always()");
                writer.WriteLine("withPendingChangesOnly = false");
                writer.WriteLine($"enableQueueOptimization = {EnableQueueOptimization.ToString().ToLowerInvariant()}");
                writer.WriteLine("param(\"cronExpression_min\", \"3\")");
            }
        }
    }
}

// Copyright 2019 Maintainers of NUKE.
// Distributed under the MIT License.
// https://github.com/nuke-build/nuke/blob/master/LICENSE

using System;
using System.Linq;
using Nuke.Common.Utilities;

namespace Nuke.Common.CI.TeamCity.Configuration
{
    public class TeamCityScheduledTrigger : TeamCityTrigger
    {
        public string BranchFilter { get; set; }
        public string TriggerRules { get; set; }
        public bool TriggerBuildAlways { get; set; } //TODO: check
        public bool WithPendingChangesOnly { get; set; }
        public bool EnableQueueOptimization { get; set; }

        public override void Write(CustomFileWriter writer)
        {
            using (writer.WriteBlock("schedule"))
            {
                using (writer.WriteBlock("schedulingPolicy = daily"))
                {
                    writer.WriteLine("hour = 3");
                }

                writer.WriteLine($"branchFilter = {BranchFilter.DoubleQuote()}");
                writer.WriteLine($"triggerRules = {TriggerRules.DoubleQuote()}");
                writer.WriteLine("triggerBuild = always()");
                writer.WriteLine("withPendingChangesOnly = false");
                writer.WriteLine($"enableQueueOptimization = {EnableQueueOptimization.ToString().ToLowerInvariant()}");
                writer.WriteLine("param(\"cronExpression_min\", \"3\")");
            }
        }
    }
}

Remove timezone specification for scheduled triggers to use server timezone


namespace TAUtil.Gaf.Structures
{
    using System.IO;

    public struct GafFrameData
    {
        public ushort Width;
        public ushort Height;
        public ushort XPos;
        public ushort YPos;
        public char Unknown1;
        public bool Compressed;
        public ushort FramePointers;
        public uint Unknown2;
        public uint PtrFrameData;
        public uint Unknown3;

        public static void Read(Stream f, ref GafFrameData e)
        {
            BinaryReader b = new BinaryReader(f);
            e.Width = b.ReadUInt16();
            e.Height = b.ReadUInt16();
            e.XPos = b.ReadUInt16();
            e.YPos = b.ReadUInt16();
            e.Unknown1 = b.ReadChar();
            e.Compressed = b.ReadBoolean();
            e.FramePointers = b.ReadUInt16();
            e.Unknown2 = b.ReadUInt32();
            e.PtrFrameData = b.ReadUInt32();
            e.Unknown3 = b.ReadUInt32();
        }
    }
}

namespace TAUtil.Gaf.Structures
{
    using System.IO;

    public struct GafFrameData
    {
        public ushort Width;
        public ushort Height;
        public ushort XPos;
        public ushort YPos;
        public byte Unknown1;
        public bool Compressed;
        public ushort FramePointers;
        public uint Unknown2;
        public uint PtrFrameData;
        public uint Unknown3;

        public static void Read(Stream f, ref GafFrameData e)
        {
            BinaryReader b = new BinaryReader(f);
            e.Width = b.ReadUInt16();
            e.Height = b.ReadUInt16();
            e.XPos = b.ReadUInt16();
            e.YPos = b.ReadUInt16();
            e.Unknown1 = b.ReadByte();
            e.Compressed = b.ReadBoolean();
            e.FramePointers = b.ReadUInt16();
            e.Unknown2 = b.ReadUInt32();
            e.PtrFrameData = b.ReadUInt32();
            e.Unknown3 = b.ReadUInt32();
        }
    }
}

Change char to byte in gaf frame header

Change char to byte in gaf frame header


using System.Collections.Generic;

namespace Palaso.Extensions
{
	public static class StringExtensions
	{
		public static List<string> SplitTrimmed(this string s, char seperator)
		{
			var x = s.Split(seperator);

			var r = new List<string>();

			foreach (var part in x)
			{
				r.Add(part.Trim());
			}
			return r;
		}

	}
}

using System.Collections.Generic;

namespace Palaso.Extensions
{
	public static class StringExtensions
	{
		public static List<string> SplitTrimmed(this string s, char seperator)
		{
			if(s.Trim() == string.Empty)
				return new List<string>();

			var x = s.Split(seperator);

			var r = new List<string>();

			foreach (var part in x)
			{
				r.Add(part.Trim());
			}
			return r;
		}

	}
}

Make SplitTrimmed give empty list when given white-space-only string


namespace Snittlistan.Test
{
    using System.IO;
    using System.Text;
    using Models;
    using Raven.Imports.Newtonsoft.Json;
    using Xunit;

    public class SerializationTest : DbTest
    {
        [Fact]
        public void CanSerialize8x4Match()
        {
            // Arrange
            var serializer = Store.Conventions.CreateSerializer();
            var builder = new StringBuilder();

            // Act
            serializer.Serialize(new StringWriter(builder), DbSeed.Create8x4Match());
            string text = builder.ToString();
            var match = serializer.Deserialize<Match8x4>(new JsonTextReader(new StringReader(text)));

            // Assert
            TestData.VerifyTeam(match.AwayTeam);
        }

        [Fact]
        public void CanSerialize4x4Match()
        {
            // Arrange
            var serializer = Store.Conventions.CreateSerializer();
            var builder = new StringBuilder();

            // Act
            serializer.Serialize(new StringWriter(builder), DbSeed.Create4x4Match());
            string text = builder.ToString();
            var match = serializer.Deserialize<Match4x4>(new JsonTextReader(new StringReader(text)));

            // Assert
            TestData.VerifyTeam(match.HomeTeam);
        }
    }
}

namespace Snittlistan.Test
{
    using System.IO;
    using System.Text;
    using Models;
    using Raven.Imports.Newtonsoft.Json;
    using Xunit;

    public class SerializationTest : DbTest
    {
        [Fact]
        public void CanSerialize8x4Match()
        {
            // Arrange
            var serializer = Store.Conventions.CreateSerializer();
            var builder = new StringBuilder();

            // Act
            serializer.Serialize(new StringWriter(builder), DbSeed.Create8x4Match());
            string text = builder.ToString();
            var match = serializer.Deserialize<Match8x4>(new JsonTextReader(new StringReader(text)));

            // Assert
            TestData.VerifyTeam(match.AwayTeam);
        }

        [Fact]
        public void CanSerialize4x4Match()
        {
            // Arrange
            var serializer = Store.Conventions.CreateSerializer();
            var builder = new StringBuilder();

            // Act
            serializer.Serialize(new StringWriter(builder), DbSeed.Create4x4Match());
            string text = builder.ToString();
            var match = serializer.Deserialize<Match4x4>(new JsonTextReader(new StringReader(text)));

            // Assert
            TestData.VerifyTeam(match.HomeTeam);
        }

        [Fact]
        public void CanSerializeUser()
        {
            // Arrange
            var user = new User("firstName", "lastName", "e@d.com", "some-pass");

            // Act
            using (var session = Store.OpenSession())
            {
                session.Store(user);
                session.SaveChanges();
            }

            // Assert
            using (var session = Store.OpenSession())
            {
                var loadedUser = session.Load<User>(user.Id);
                Assert.True(loadedUser.ValidatePassword("some-pass"), "Password validation failed");
            }
        }
    }
}

Make sure password validation works after saving


using System;
using System.Collections.Generic;
using System.Windows.Data;

namespace NuPack.Dialog.PackageManagerUI {

    public class StringCollectionsToStringConverter : IValueConverter {

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
            if (targetType == typeof(string)) {
                IEnumerable<string> parts = (IEnumerable<string>)value;
                return String.Join(", ", parts);
            }

            return value;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
            throw new NotImplementedException();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Windows.Data;

namespace NuPack.Dialog.PackageManagerUI {

    public class StringCollectionsToStringConverter : IValueConverter {

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
            if (targetType == typeof(string)) {

                string stringValue = value as string;
                if (stringValue != null) {
                    return stringValue;
                }
                else {
                    IEnumerable<string> parts = (IEnumerable<string>)value;
                    return String.Join(", ", parts);
                }
            }

            return value;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
            throw new NotImplementedException();
        }
    }
}

Fix bug in the StringCollection converter when DataServicePackage.Authors is a simple string.


//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.34003
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

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

[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.0.0.0")]
[assembly: AssemblyConfiguration("Release built on 2013-10-23 22:48")]
[assembly: AssemblyCopyright("Copyright © 2013 Autofac Contributors")]
[assembly: AssemblyDescription("Autofac.Wcf 3.0.0")]

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.18051
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

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

[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.0.0.0")]
[assembly: AssemblyConfiguration("Release built on 2013-12-03 10:23")]
[assembly: AssemblyCopyright("Copyright © 2013 Autofac Contributors")]
[assembly: AssemblyDescription("Autofac.Wcf 3.0.0")]

Split WCF functionality out of Autofac.Extras.Multitenant into a separate assembly/package, Autofac.Extras.Multitenant.Wcf. Both packages are versioned 3.1.0.


using UnityEngine;

namespace Entitas.Unity.VisualDebugging {

    public static class GameObjectDestroyExtension {

        public static void DestroyGameObject(this GameObject gameObject) {

            #if (UNITY_EDITOR)

            if (Application.isPlaying) {
                Object.Destroy(gameObject);
            } else {
                Object.DestroyImmediate(gameObject);
            }

            #else

        Destroy(gameObject);

            #endif
        }
    }
}

using UnityEngine;

namespace Entitas.Unity.VisualDebugging {

    public static class GameObjectDestroyExtension {

        public static void DestroyGameObject(this GameObject gameObject) {

            #if (UNITY_EDITOR)

            if (Application.isPlaying) {
                Object.Destroy(gameObject);
            } else {
                Object.DestroyImmediate(gameObject);
            }

            #else

            Object.Destroy(gameObject);

            #endif
        }
    }
}

Fix Destroy compile time error

Fix Destroy compile time error

Project refused to build post upgrade to 0.30.0.

Error:
error CS0103: The name `Destroy' does not exist in the current context


using CarFuel.DataAccess;
using CarFuel.Models;
using CarFuel.Services;
using Microsoft.AspNet.Identity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace CarFuel.Controllers
{
    public class CarsController : Controller
    {
        private ICarDb db;
        private CarService carService;
        public CarsController()
        {
            db = new CarDb();
            carService = new CarService(db);
        }
        [Authorize]
        public ActionResult Index()
        {
            var userId = new Guid(User.Identity.GetUserId());
            IEnumerable<Car> cars = carService.GetCarsByMember(userId);
            return View(cars);
        }
        [Authorize]
        public ActionResult Create()
        {
            return View();
        }

        [HttpPost]
        [Authorize]
        public ActionResult Create(Car item)
        {
            var userId = new Guid(User.Identity.GetUserId());
            try
            {
                carService.AddCar(item, userId);
            }
            catch (OverQuotaException ex)
            {
                TempData["error"] = ex.Message;
            }

            return RedirectToAction("Index");
        }

        public ActionResult Details(Guid id)
        {
            var userId = new Guid(User.Identity.GetUserId());
            var c = carService.GetCarsByMember(userId).SingleOrDefault(x => x.Id == id);

            return View(c);
        }
    }
}

using CarFuel.DataAccess;
using CarFuel.Models;
using CarFuel.Services;
using Microsoft.AspNet.Identity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Mvc;

namespace CarFuel.Controllers
{
    public class CarsController : Controller
    {
        private ICarDb db;
        private CarService carService;
        public CarsController()
        {
            db = new CarDb();
            carService = new CarService(db);
        }
        [Authorize]
        public ActionResult Index()
        {
            var userId = new Guid(User.Identity.GetUserId());
            IEnumerable<Car> cars = carService.GetCarsByMember(userId);
            return View(cars);
        }
        [Authorize]
        public ActionResult Create()
        {
            return View();
        }

        [HttpPost]
        [Authorize]
        public ActionResult Create(Car item)
        {
            var userId = new Guid(User.Identity.GetUserId());
            try
            {
                carService.AddCar(item, userId);
            }
            catch (OverQuotaException ex)
            {
                TempData["error"] = ex.Message;
            }

            return RedirectToAction("Index");
        }

        public ActionResult Details(Guid? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }

            var userId = new Guid(User.Identity.GetUserId());
            var c = carService.GetCarsByMember(userId).SingleOrDefault(x => x.Id == id);

            return View(c);
        }
    }
}

Handle null id for Cars/Details action

Handle null id for Cars/Details action

If users don't supply id value in the URL,
instead of displaying YSOD, we are now return BadRequest.


using Orchard.Data.Migration;

namespace Orchard.Users.DataMigrations {
    public class UsersDataMigration : DataMigrationImpl {

        public int Create() {
            //CREATE TABLE Orchard_Users_UserRecord (Id INTEGER not null, UserName TEXT, Email TEXT, NormalizedUserName TEXT, Password TEXT, PasswordFormat TEXT, PasswordSalt TEXT, primary key (Id));
            SchemaBuilder.CreateTable("UserRecord", table => table
                .ContentPartRecord()
                .Column<string>("UserName")
                .Column<string>("Email")
                .Column<string>("NormalizedUserName")
                .Column<string>("Password")
                .Column<string>("PasswordFormat")
                .Column<string>("PasswordSalt")
                );

            return 0010;
        }
    }
}

using Orchard.Data.Migration;

namespace Orchard.Users.DataMigrations {
    public class UsersDataMigration : DataMigrationImpl {

        public int Create() {
            //CREATE TABLE Orchard_Users_UserRecord (Id INTEGER not null, UserName TEXT, Email TEXT, NormalizedUserName TEXT, Password TEXT, PasswordFormat TEXT, PasswordSalt TEXT, primary key (Id));
            SchemaBuilder.CreateTable("UserRecord", table => table
                .ContentPartRecord()
                .Column<string>("UserName")
                .Column<string>("Email")
                .Column<string>("NormalizedUserName")
                .Column<string>("Password")
                .Column<string>("PasswordFormat")
                .Column<string>("HashAlgorithm")
                .Column<string>("PasswordSalt")
                );

            return 0010;
        }
    }
}

Fix data migration code for UserRecord

Fix data migration code for UserRecord

Issue came from last merge from Default...

--HG--
branch : dev


using System;
namespace CITS.Models
{
    public class MathProblemModel : ProblemModel
    {
        public MathProblemModel(string Problem, string Solution):base(Problem,Solution){}

        public override Boolean IsSolutionCorrect(String candidateSolution)
        {
            return Solution.Equals(candidateSolution.Trim());
        }
    }
}

using System;
using System.Collections.Generic;
namespace CITS.Models
{
    public class MathProblemModel : ProblemModel
    {
        public MathProblemModel(string problem, string solution, List<String> listOfHints):base(problem,solution, listOfHints){}

        public override Boolean IsSolutionCorrect(String candidateSolution)
        {
            return Solution.Equals(candidateSolution.Trim());
        }
    }
}

Support list of hints per problem

Support list of hints per problem


using System;
using System.IO;
using System.Linq;
using NuGet.Frameworks;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.ProjectModel;
using Microsoft.DotNet.ProjectModel.Graph;
using Microsoft.Extensions.DependencyModel.Resolution;

namespace ConsoleApplication
{
    public class Program
    {
        public static void Main(string[] args)
        {
            // The TypeCatalogGen project takes this as input
            var outputPath = "../TypeCatalogGen/powershell.inc";

            // Get a context for our top level project
            var context = ProjectContext.Create("../Microsoft.PowerShell.CoreConsoleHost", NuGetFramework.Parse("netcoreapp1.0"));

            System.IO.File.WriteAllLines(outputPath,
                                         // Get the target for the current runtime
                                         from t in context.LockFile.Targets where t.RuntimeIdentifier == Constants.RuntimeIdentifier
                                         // Get the packages (not projects)
                                         from x in t.Libraries where x.Type == "package"
                                         // Get the real reference assemblies
                                         from y in x.CompileTimeAssemblies where y.Path.EndsWith(".dll")
                                         // Construct the path to the assemblies
                                         select $"{context.PackagesDirectory}/{x.Name}/{x.Version}/{y.Path};");

            Console.WriteLine($"List of reference assemblies written to {outputPath}");
        }
    }
}

using System;
using System.IO;
using System.Linq;
using NuGet.Frameworks;
using Microsoft.DotNet.Cli.Utils;
using Microsoft.DotNet.ProjectModel;
using Microsoft.DotNet.ProjectModel.Graph;
using Microsoft.Extensions.DependencyModel.Resolution;

namespace TypeCatalogParser
{
    public class Program
    {
        public static void Main(string[] args)
        {
            // The TypeCatalogGen project takes this as input
            var outputPath = "../TypeCatalogGen/powershell.inc";

            // Get a context for our top level project
            var context = ProjectContext.Create("../powershell", NuGetFramework.Parse("netcoreapp1.0"));

            System.IO.File.WriteAllLines(outputPath,
                                         // Get the target for the current runtime
                                         from t in context.LockFile.Targets where t.RuntimeIdentifier == Constants.RuntimeIdentifier
                                         // Get the packages (not projects)
                                         from x in t.Libraries where x.Type == "package"
                                         // Get the real reference assemblies
                                         from y in x.CompileTimeAssemblies where y.Path.EndsWith(".dll")
                                         // Construct the path to the assemblies
                                         select $"{context.PackagesDirectory}/{x.Name}/{x.Version}/{y.Path};");

            Console.WriteLine($"List of reference assemblies written to {outputPath}");
        }
    }
}

Update TypeCatalogParser for CoreConsoleHost removal


using UnityEngine;
using UnityEngine.EventSystems;

class DisableMouse : MonoBehaviour
{
	// private stuff we don't want the editor to see
	private GameObject m_lastSelectedGameObject;

	// this is called by unity before start
	void Awake()
	{
		m_lastSelectedGameObject = new GameObject();
	}

	// this is called by unity every frame
	void Update()
	{
		// check if we have an active ui
		if ( EventSystem.current != null )
		{
			// check if we have a currently selected game object
			if ( EventSystem.current.currentSelectedGameObject == null )
			{
				// nope - the mouse may have stolen it - give it back to the last selected game object
				EventSystem.current.SetSelectedGameObject( m_lastSelectedGameObject );
			}
			else if ( EventSystem.current.currentSelectedGameObject != m_lastSelectedGameObject )
			{
				// we changed our selection - remember it
				m_lastSelectedGameObject = EventSystem.current.currentSelectedGameObject;
			}
		}
	}
}

using UnityEngine;
using UnityEngine.EventSystems;

class DisableMouse : MonoBehaviour
{
	// private stuff we don't want the editor to see
	private GameObject m_lastSelectedGameObject;

	// this is called by unity before start
	void Awake()
	{
		m_lastSelectedGameObject = new GameObject();
	}

	// this is called by unity every frame
	void Update()
	{
		// check if we have an active ui
		if ( false && ( EventSystem.current != null ) )
		{
			// check if we have a currently selected game object
			if ( EventSystem.current.currentSelectedGameObject == null )
			{
				// nope - the mouse may have stolen it - give it back to the last selected game object
				EventSystem.current.SetSelectedGameObject( m_lastSelectedGameObject );
			}
			else if ( EventSystem.current.currentSelectedGameObject != m_lastSelectedGameObject )
			{
				// we changed our selection - remember it
				m_lastSelectedGameObject = EventSystem.current.currentSelectedGameObject;
			}
		}
	}
}

Disable the disable mouse script for now


using com.techphernalia.MyPersonalAccounts.Model.Inventory;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace com.techphernalia.MyPersonalAccounts.Model.Controller
{
    public interface IInventoryController
    {
        #region Stock Unit

        List<StockUnit> GetAllStockUnits();

        StockUnit GetStockUnitFromId(int unitId);

        int AddStockUnit(StockUnit stockUnit);

        bool UpdateStockUnit(StockUnit stockUnit);

        bool DeleteStockUnit(int unitId);

        #endregion

        #region Stock Group

        List<StockGroup> GetAllStockGroups();

        List<StockGroup> GetStockGroupsForGroup(int stockGroupId);

        StockGroup GetStockGroupFromId(int stockGroupId);

        int AddStockGroup(StockItem stockItem);

        bool UpdateStockGroup(StockItem stockItem);

        bool DeleteStockGroup(int stockGroupId);

        #endregion

        #region Stock Item

        List<StockItem> GetAllStockItems();

        List<StockItem> GetStockItemsForGroup(int stockGroupId);

        StockItem GetStockItemFromId(int stockItemId);

        int AddStockItem(StockGroup stockGroup);

        bool UpdateStockItem(StockGroup stockGroup);

        bool DeleteStockItemI(int stockItemId);

        #endregion
    }
}

using com.techphernalia.MyPersonalAccounts.Model.Inventory;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace com.techphernalia.MyPersonalAccounts.Model.Controller
{
    public interface IInventoryController
    {
        #region Stock Unit

        List<StockUnit> GetAllStockUnits();

        StockUnit GetStockUnitFromId(int unitId);

        int AddStockUnit(StockUnit stockUnit);

        void UpdateStockUnit(StockUnit stockUnit);

        void DeleteStockUnit(int unitId);

        #endregion

        #region Stock Group

        List<StockGroup> GetAllStockGroups();

        List<StockGroup> GetStockGroupsForGroup(int stockGroupId);

        StockGroup GetStockGroupFromId(int stockGroupId);

        int AddStockGroup(StockItem stockItem);

        bool UpdateStockGroup(StockItem stockItem);

        bool DeleteStockGroup(int stockGroupId);

        #endregion

        #region Stock Item

        List<StockItem> GetAllStockItems();

        List<StockItem> GetStockItemsForGroup(int stockGroupId);

        StockItem GetStockItemFromId(int stockItemId);

        int AddStockItem(StockGroup stockGroup);

        bool UpdateStockItem(StockGroup stockGroup);

        bool DeleteStockItemI(int stockItemId);

        #endregion
    }
}

Update interface for return type

Update interface for return type


namespace TraktApiSharp.Objects.Get.Shows.Episodes
{
    using Basic;

    public class TraktEpisodeIds : TraktIds
    {

    }
}

namespace TraktApiSharp.Objects.Get.Shows.Episodes
{
    using Basic;

    /// <summary>A collection of ids for various web services, including the Trakt id, for a Trakt episode.</summary>
    public class TraktEpisodeIds : TraktIds
    {

    }
}

Add documentation for episode ids.

Add documentation for episode ids.


namespace GeekLearning.Domain.AspnetCore
{
    using Microsoft.AspNetCore.Mvc.Filters;
    using Microsoft.Extensions.Logging;
    using Microsoft.Extensions.Options;

    public class DomainExceptionFilter : IActionFilter
    {
        private ILoggerFactory loggerFactory;
        private IOptions<DomainOptions> options;

        public DomainExceptionFilter(ILoggerFactory loggerFactory, IOptions<DomainOptions> domainOptions)
        {
            this.loggerFactory = loggerFactory;
            this.options = domainOptions;
        }

        public void OnActionExecuted(ActionExecutedContext context)
        {
            if (context.Exception != null)
            {
                var domainException = context.Exception as DomainException;
                var logger = this.loggerFactory.CreateLogger<DomainExceptionFilter>();
                if (domainException == null)
                {
                    logger.LogError(new EventId(1, "Unknown error"), context.Exception.Message, context.Exception);
                    domainException = new Explanations.Unknown().AsException(context.Exception);
                }

                context.Result = new MaybeResult<object>(domainException.Explanation);
                context.ExceptionHandled = true;
            }
        }

        public void OnActionExecuting(ActionExecutingContext context)
        {
        }
    }
}

namespace GeekLearning.Domain.AspnetCore
{
    using Microsoft.AspNetCore.Mvc.Filters;
    using Microsoft.Extensions.Logging;
    using Microsoft.Extensions.Options;

    public class DomainExceptionFilter : IActionFilter
    {
        private ILoggerFactory loggerFactory;
        private IOptions<DomainOptions> options;

        public DomainExceptionFilter(ILoggerFactory loggerFactory, IOptions<DomainOptions> domainOptions)
        {
            this.loggerFactory = loggerFactory;
            this.options = domainOptions;
        }

        public void OnActionExecuted(ActionExecutedContext context)
        {
            if (context.Exception != null)
            {
                var domainException = context.Exception as DomainException;
                var logger = this.loggerFactory.CreateLogger<DomainExceptionFilter>();
                if (domainException == null)
                {
                    logger.LogError(new EventId(1, "Unknown error"), context.Exception, context.Exception.Message);
                    domainException = new Explanations.Unknown().AsException(context.Exception);
                }

                context.Result = new MaybeResult<object>(domainException.Explanation);
                context.ExceptionHandled = true;
            }
        }

        public void OnActionExecuting(ActionExecutingContext context)
        {
        }
    }
}

Fix DomainException LogError parameter order


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

using System;
using System.Collections.Generic;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mods;
using osu.Game.Users;
using osu.Game.Rulesets.Replays;

namespace osu.Game.Rulesets.Scoring
{
    public class Score
    {
        public ScoreRank Rank { get; set; }

        public double TotalScore { get; set; }

        public double Accuracy { get; set; }

        public double Health { get; set; } = 1;

        public double? PP { get; set; }

        public int MaxCombo { get; set; }

        public int Combo { get; set; }

        public RulesetInfo Ruleset { get; set; }

        public Mod[] Mods { get; set; } = { };

        public User User;

        public Replay Replay;

        public BeatmapInfo Beatmap;

        public long OnlineScoreID;

        public DateTimeOffset Date;

        public Dictionary<HitResult, object> Statistics = new Dictionary<HitResult, object>();
    }
}

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

using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Mods;
using osu.Game.Users;
using osu.Game.Rulesets.Replays;

namespace osu.Game.Rulesets.Scoring
{
    public class Score
    {
        public ScoreRank Rank { get; set; }

        public double TotalScore { get; set; }

        public double Accuracy { get; set; }

        public double Health { get; set; } = 1;

        public double? PP { get; set; }

        public int MaxCombo { get; set; }

        public int Combo { get; set; }

        public RulesetInfo Ruleset { get; set; }

        public Mod[] Mods { get; set; } = { };

        public User User;

        [JsonIgnore]
        public Replay Replay;

        public BeatmapInfo Beatmap;

        public long OnlineScoreID;

        public DateTimeOffset Date;

        public Dictionary<HitResult, object> Statistics = new Dictionary<HitResult, object>();
    }
}

Fix score retrieval no longer working

Fix score retrieval no longer working


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

namespace xwalk
{
    class TwoinoneTest
    {
        static void Main(string[] args)
        {
            Emulator emulator = new Emulator();
            TabletMonitor monitor = new TabletMonitor(emulator);
            monitor.TabletModeDelegate = onTabletModeChanged;
            monitor.start();
            Console.WriteLine("Main: " + monitor.IsTablet);

            bool isTabletEmulated = monitor.IsTablet;

            // Fudge mainloop
            int tick = 0;
            while (true) {
                Thread.Sleep(500);
                Console.Write(".");
                tick++;
                if (tick % 10 == 0)
                {
                    Console.WriteLine("");
                    isTabletEmulated = !isTabletEmulated;
                    emulator.IsTablet = isTabletEmulated;
                }
            }
        }

        private static void onTabletModeChanged(bool isTablet)
        {
            Console.WriteLine("onTabletModeChanged: " + isTablet);
        }
    }
}

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

namespace xwalk
{
    class TwoinoneTest
    {
        static void Main(string[] args)
        {
            if (args.Length > 0 && args[0] == "emulator")
            {
                runEmulator();
            }
            else
            {
                run();
            }
        }

        static void run()
        {
            Emulator emulator = new Emulator();
            TabletMonitor monitor = new TabletMonitor(emulator);
            monitor.TabletModeDelegate = onTabletModeChanged;
            monitor.start();
            Console.WriteLine("Main: " + monitor.IsTablet);

            // Fudge mainloop
            int tick = 0;
            while (true)
            {
                Thread.Sleep(500);
                Console.Write(".");
                tick++;
                if (tick % 10 == 0)
                {
                    Console.WriteLine("");
                    Console.WriteLine("Tablet mode " + monitor.IsTablet);
                }
            }
        }

        static void runEmulator()
        {
            Emulator emulator = new Emulator();
            TabletMonitor monitor = new TabletMonitor(emulator);
            monitor.TabletModeDelegate = onTabletModeChanged;
            monitor.start();
            Console.WriteLine("Main: " + monitor.IsTablet);

            bool isTabletEmulated = monitor.IsTablet;

            // Fudge mainloop
            int tick = 0;
            while (true)
            {
                Thread.Sleep(500);
                Console.Write(".");
                tick++;
                if (tick % 10 == 0)
                {
                    Console.WriteLine("");
                    isTabletEmulated = !isTabletEmulated;
                    emulator.IsTablet = isTabletEmulated;
                }
            }
        }

        private static void onTabletModeChanged(bool isTablet)
        {
            Console.WriteLine("onTabletModeChanged: " + isTablet);
        }
    }
}

Enable testing in emulated or actual device mode


using Lbookshelf.Models;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Interactivity;

namespace Lbookshelf.Utils
{
    public class ChangeThumbnailBehavior : Behavior<FrameworkElement>
    {
        protected override void OnAttached()
        {
            base.OnAttached();

            AssociatedObject.MouseLeftButtonUp += ShowChooseThumbnailDialog;
        }

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

            AssociatedObject.MouseLeftButtonUp -= ShowChooseThumbnailDialog;
        }

        private void ShowChooseThumbnailDialog(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            DialogService.ShowOpenFileDialog(
                fileName =>
                {
                    // Note that when editing a book, we are actually
                    // editing a clone of the original book.
                    // The changes can be safely discarded if the user
                    // cancel the edit. So feel free to change the
                    // value of Thumbnail. The BookManager is responsible
                    // for copying the new thumbnail.
                    var book = (Book)AssociatedObject.DataContext;
                    book.Thumbnail = fileName;

                }, "Image files|*.jpg", ".jpg");
        }
    }
}

using Lbookshelf.Models;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Interactivity;

namespace Lbookshelf.Utils
{
    public class ChangeThumbnailBehavior : Behavior<FrameworkElement>
    {
        protected override void OnAttached()
        {
            base.OnAttached();

            AssociatedObject.MouseLeftButtonUp += ShowChooseThumbnailDialog;
        }

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

            AssociatedObject.MouseLeftButtonUp -= ShowChooseThumbnailDialog;
        }

        private void ShowChooseThumbnailDialog(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            DialogService.ShowOpenFileDialog(
                fileName =>
                {
                    // Note that when editing a book, we are actually
                    // editing a clone of the original book.
                    // The changes can be safely discarded if the user
                    // cancel the edit. So feel free to change the
                    // value of Thumbnail. The BookManager is responsible
                    // for copying the new thumbnail.
                    var book = (Book)AssociatedObject.DataContext;
                    book.Thumbnail = fileName;

                }, "Image files|*.jpg;*.png", ".jpg");
        }
    }
}

Enable the user to choose PNG file as thumbnail.


// Copyright (c) 2010-2012 SharpDX - Alexandre Mutel
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

using System;

namespace MiniCube
{
    /// <summary>
    /// Simple MiniCube application using SharpDX.Toolkit.
    /// </summary>
    class Program
    {
        /// <summary>
        /// Defines the entry point of the application.
        /// </summary>
#if NETFX_CORE
        [MTAThread]
#else
        [STAThread]
#endif
        static void Main()
        {
            using (var program = new SphereGame())
                program.Run();
        }
    }
}

// Copyright (c) 2010-2012 SharpDX - Alexandre Mutel
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

using System;

namespace MiniCube
{
    /// <summary>
    /// Simple MiniCube application using SharpDX.Toolkit.
    /// </summary>
    class Program
    {
        /// <summary>
        /// Defines the entry point of the application.
        /// </summary>
#if NETFX_CORE
        [MTAThread]
#else
        [STAThread]
#endif
        static void Main()
        {
            using (var program = new MiniCubeGame())
                program.Run();
        }
    }
}

Fix compilation error in sample

[Build] Fix compilation error in sample


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

namespace NBi.Core.Analysis.Metadata
{
    public class Property : IField
    {
        public string UniqueName { get; private set; }
        public string Caption { get; set; }

        public Property(string uniqueName, string caption)
        {
            UniqueName = uniqueName;
            Caption = caption;
        }

        public Property Clone()
        {
            return new Property(UniqueName, Caption);
        }
    }
}

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

namespace NBi.Core.Analysis.Metadata
{
    public class Property : IField
    {
        public string UniqueName { get; private set; }
        public string Caption { get; set; }

        public Property(string uniqueName, string caption)
        {
            UniqueName = uniqueName;
            Caption = caption;
        }

        public Property Clone()
        {
            return new Property(UniqueName, Caption);
        }

        public override string ToString()
        {
            return Caption.ToString();
        }

    }
}

Add method ToString to override default display and replace by Caption


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

namespace nxtlibtester
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                string filename = "version.ric"; //filename on disk (locally)
                string filenameonbrick = "version.ric"; //filename on remote NXT

                //Prepare Connection
                Console.WriteLine("File Upload Test\r\n");
                Console.WriteLine("Connecting to brick...");
                Brick brick = new Brick(Brick.LinkType.USB, null); //Brick = top layer of code, contains the sensors and motors
                if (!brick.Connect()) { throw new Exception(brick.LastError); }
                Protocol protocol = brick.ProtocolLink; //Protocol = underlying layer of code, contains NXT communications

                //Test Connection
                if (!brick.IsConnected) { throw new Exception("Not connected to NXT!"); }

                //Upload File
                Console.WriteLine("Uploading file...");
                if (!brick.UploadFile(filename, filenameonbrick)) { throw new Exception(brick.LastError); }

                Console.WriteLine("Success!");
                Console.WriteLine("Press any key to continue...");
                Console.ReadKey(true);
                return;
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: {0}", ex.Message);
                Console.WriteLine("Press any key to continue...");
                Console.ReadKey(true);
                return;
            }
        }
    }
}

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

namespace nxtlibtester
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                string filename = "../../version.ric"; //filename on disk (locally)
                string filenameonbrick = "version.ric"; //filename on remote NXT

                //Prepare Connection
                Console.WriteLine("File Upload Test\r\n");
                Console.WriteLine("Connecting to brick...");
                Brick brick = new Brick(Brick.LinkType.USB, null); //Brick = top layer of code, contains the sensors and motors
                if (!brick.Connect()) { throw new Exception(brick.LastError); }
                Protocol protocol = brick.ProtocolLink; //Protocol = underlying layer of code, contains NXT communications

                //Test Connection
                if (!brick.IsConnected) { throw new Exception("Not connected to NXT!"); }

                //Upload File
                Console.WriteLine("Uploading file...");
                if (!brick.UploadFile(filename, filenameonbrick)) { throw new Exception(brick.LastError); }

                Console.WriteLine("Success!");
                Console.WriteLine("Press any key to continue...");
                Console.ReadKey(true);
                return;
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: {0}", ex.Message);
                Console.WriteLine("Press any key to continue...");
                Console.ReadKey(true);
                return;
            }
        }
    }
}

Add test files to tree

Add test files to tree


namespace Microsoft.ApplicationInsights.Extensibility.Implementation.Platform
{
    using Microsoft.ApplicationInsights.DataContracts;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Assert = Xunit.Assert;

    [TestClass]
    public class PlatformReferencesTests
    {
        [TestMethod]
        public void NoSystemWebReferences()
        {
            // Validate Platform assembly.
            foreach (var assembly in typeof(DebugOutput).Assembly.GetReferencedAssemblies())
            {
                Assert.True(!assembly.FullName.Contains("System.Web"));
            }

            // Validate Core assembly
            foreach (var assembly in typeof(EventTelemetry).Assembly.GetReferencedAssemblies())
            {
                Assert.True(!assembly.FullName.Contains("System.Web"));
            }
        }
    }
}

namespace Microsoft.ApplicationInsights.Extensibility.Implementation.Platform
{
    using Microsoft.ApplicationInsights.DataContracts;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Assert = Xunit.Assert;

    [TestClass]
    public class PlatformReferencesTests
    {
        [TestMethod]
        public void NoSystemWebReferences()
        {
            // Validate Platform assembly
            foreach (var assembly in typeof(DebugOutput).Assembly.GetReferencedAssemblies())
            {
                Assert.True(!assembly.FullName.Contains("System.Web"));
            }

            // Validate Core assembly
            foreach (var assembly in typeof(EventTelemetry).Assembly.GetReferencedAssemblies())
            {
                Assert.True(!assembly.FullName.Contains("System.Web"));
            }
        }
    }
}

Revert "Dummy commit to test PR. No real changes"

This reverts commit 3fcee5225bbf877fb13cdbf87987bfada486cd76.


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

using System.Runtime.Remoting.Messaging;
using System.Security;

namespace System.Diagnostics
{
    public partial class Activity
    {
        /// <summary>
        /// Returns the current operation (Activity) for the current thread.  This flows
        /// across async calls.
        /// </summary>
        public static Activity Current
        {
#if ALLOW_PARTIALLY_TRUSTED_CALLERS
            [System.Security.SecuritySafeCriticalAttribute]
#endif
            get
            {
                return (Activity)CallContext.LogicalGetData(FieldKey);
            }

#if ALLOW_PARTIALLY_TRUSTED_CALLERS
            [System.Security.SecuritySafeCriticalAttribute]
#endif
            private set
            {
                CallContext.LogicalSetData(FieldKey, value);
            }
        }

#region private

        private partial class KeyValueListNode
        {
        }

        private static readonly string FieldKey = $"{typeof(Activity).FullName}";
#endregion
    }
}

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

using System.Runtime.Remoting.Messaging;
using System.Security;

namespace System.Diagnostics
{
    // this code is specific to .NET 4.5 and uses CallContext to store Activity.Current which requires Activity to be Serializable.
    [Serializable] // DO NOT remove
    public partial class Activity
    {
        /// <summary>
        /// Returns the current operation (Activity) for the current thread.  This flows
        /// across async calls.
        /// </summary>
        public static Activity Current
        {
#if ALLOW_PARTIALLY_TRUSTED_CALLERS
            [System.Security.SecuritySafeCriticalAttribute]
#endif
            get
            {
                return (Activity)CallContext.LogicalGetData(FieldKey);
            }

#if ALLOW_PARTIALLY_TRUSTED_CALLERS
            [System.Security.SecuritySafeCriticalAttribute]
#endif
            private set
            {
                CallContext.LogicalSetData(FieldKey, value);
            }
        }

        #region private

        [Serializable] // DO NOT remove
        private partial class KeyValueListNode
        {
        }

        private static readonly string FieldKey = $"{typeof(Activity).FullName}";
#endregion
    }
}

Mark Activity and it's properties as Serializable


using System.Linq;
using Xunit;

namespace Microsoft.Language.Xml.Tests
{
    public class TestApi
    {
        [Fact]
        public void TestAttributeValue()
        {
            var root = Parser.ParseText("<e a=\"\"/>");
            var attributeValue = root.Attributes.First().Value;
            Assert.Equal("", attributeValue);
        }

        [Fact]
        public void TestContent()
        {
            var root = Parser.ParseText("<e>Content</e>");
            var value = root.Value;
            Assert.Equal("Content", value);
        }
    }
}

using System.Linq;
using Xunit;

namespace Microsoft.Language.Xml.Tests
{
    public class TestApi
    {
        [Fact]
        public void TestAttributeValue()
        {
            var root = Parser.ParseText("<e a=\"\"/>");
            var attributeValue = root.Attributes.First().Value;
            Assert.Equal("", attributeValue);
        }

        [Fact]
        public void TestContent()
        {
            var root = Parser.ParseText("<e>Content</e>");
            var value = root.Value;
            Assert.Equal("Content", value);
        }

        [Fact]
        public void TestRootLevel()
        {
            var root = Parser.ParseText("<Root></Root>");
            Assert.Equal("Root", root.Name);
        }

        [Fact(Skip = "https://github.com/KirillOsenkov/XmlParser/issues/8")]
        public void TestRootLevelTrivia()
        {
            var root = Parser.ParseText("<!-- C --><Root></Root>");
            Assert.Equal("Root", root.Name);
        }

        [Fact]
        public void TestRootLevelTriviaWithDeclaration()
        {
            var root = Parser.ParseText("<?xml version=\"1.0\" encoding=\"utf-8\"?><!-- C --><Root></Root>");
            Assert.Equal("Root", root.Name);
        }
    }
}

Add some tests for a bug.

Add some tests for a bug.


using System.Reflection;

[assembly: AssemblyCompany("Andrew Davey")]
[assembly: AssemblyProduct("Cassette")]
[assembly: AssemblyCopyright("Copyright © 2011 Andrew Davey")]

// NOTE: When changing this version, also update Cassette.MSBuild\Cassette.targets to match.
[assembly: AssemblyInformationalVersion("2.0.0")]

[assembly: AssemblyVersion("2.0.0.*")]
[assembly: AssemblyFileVersion("2.0.0.0")]

using System.Reflection;

[assembly: AssemblyCompany("Andrew Davey")]
[assembly: AssemblyProduct("Cassette")]
[assembly: AssemblyCopyright("Copyright © 2011 Andrew Davey")]

[assembly: AssemblyInformationalVersion("2.0.0-beta1")]

[assembly: AssemblyVersion("2.0.0.*")]
[assembly: AssemblyFileVersion("2.0.0.0")]

Set nuget package version to 2.0.0-beta1


namespace DotnetThoughts.AspNet
{
    using Microsoft.AspNet.Builder;
    using Microsoft.AspNet.Http;
    using System.IO;
    using System.Threading.Tasks;
    using System.Text;
    using System.Text.RegularExpressions;

    public class HtmlMinificationMiddleware
    {
        private RequestDelegate _next;
        public HtmlMinificationMiddleware(RequestDelegate next)
        {
            _next = next;
        }
        public async Task Invoke(HttpContext context)
        {
            var stream = context.Response.Body;
            using (var buffer = new MemoryStream())
            {
                context.Response.Body = buffer;
                await _next(context);
                var isHtml = context.Response.ContentType?.ToLower().Contains("text/html");

                buffer.Seek(0, SeekOrigin.Begin);
                using (var reader = new StreamReader(buffer))
                {
                    string responseBody = await reader.ReadToEndAsync();
                    if (context.Response.StatusCode == 200 && isHtml.GetValueOrDefault())
                    {
                        responseBody = Regex.Replace(responseBody, @">\s+<", "><", RegexOptions.Compiled);
                    }
                    using (var memoryStream = new MemoryStream())
                    {
                        var bytes = Encoding.UTF8.GetBytes(responseBody);
                        memoryStream.Write(bytes, 0, bytes.Length);
                        memoryStream.Seek(0, SeekOrigin.Begin);
                        await memoryStream.CopyToAsync(stream, bytes.Length);
                    }
                }

            }
        }
    }
}

namespace DotnetThoughts.AspNet
{
    using Microsoft.AspNet.Builder;
    using Microsoft.AspNet.Http;
    using System.IO;
    using System.Threading.Tasks;
    using System.Text;
    using System.Text.RegularExpressions;

    public class HtmlMinificationMiddleware
    {
        private RequestDelegate _next;
        public HtmlMinificationMiddleware(RequestDelegate next)
        {
            _next = next;
        }
        public async Task Invoke(HttpContext context)
        {
            var stream = context.Response.Body;
            using (var buffer = new MemoryStream())
            {
                context.Response.Body = buffer;
                await _next(context);
                var isHtml = context.Response.ContentType?.ToLower().Contains("text/html");

                buffer.Seek(0, SeekOrigin.Begin);
                using (var reader = new StreamReader(buffer))
                {
                    string responseBody = await reader.ReadToEndAsync();
                    if (context.Response.StatusCode == 200 && isHtml.GetValueOrDefault())
                    {
                        responseBody = Regex.Replace(responseBody, @">\s+<", "><", RegexOptions.Compiled);
                        responseBody = Regex.Replace(responseBody, @"<!--(?!\s*(?:\[if [^\]]+]|<!|>))(?:(?!-->)(.|\n))*-->", "", RegexOptions.Compiled);
                    }
                    using (var memoryStream = new MemoryStream())
                    {
                        var bytes = Encoding.UTF8.GetBytes(responseBody);
                        memoryStream.Write(bytes, 0, bytes.Length);
                        memoryStream.Seek(0, SeekOrigin.Begin);
                        await memoryStream.CopyToAsync(stream, bytes.Length);
                    }
                }

            }
        }
    }
}

Support added for HTML comment removal

Support added for HTML comment removal


using LogicalShift.Reason.Api;
using LogicalShift.Reason.Clauses;
using System;
using System.Linq;

namespace LogicalShift.Reason
{
    /// <summary>
    /// Methods for creating an altering clauses
    /// </summary>
    public static class Clause
    {
        /// <summary>
        /// Creates a new negative Horn clause
        /// </summary>
        public static IClause If(params ILiteral[] literals)
        {
            if (literals == null) throw new ArgumentNullException("literals");
            if (literals.Any(literal => literal == null)) throw new ArgumentException("Null literals are not allowed", "literals");

            return new NegativeClause(literals);
        }

        /// <summary>
        /// Adds a positive literal to a negative Horn clause
        /// </summary>
        public static IClause Then(this IClause negativeHornClause, ILiteral then)
        {
            if (negativeHornClause == null) throw new ArgumentNullException("negativeHornClause");
            if (negativeHornClause.Implies != null) throw new ArgumentException("Clause already has an implication", "negativeHornClause");
            if (then == null) throw new ArgumentNullException("then");

            return new PositiveClause(negativeHornClause, then);
        }

        /// <summary>
        /// Returns a clause indicating that a literal is unconditionally true
        /// </summary>
        public static IClause Always(ILiteral always)
        {
            return If(Literal.True()).Then(always);
        }
    }
}

using LogicalShift.Reason.Api;
using LogicalShift.Reason.Clauses;
using System;
using System.Linq;

namespace LogicalShift.Reason
{
    /// <summary>
    /// Methods for creating an altering clauses
    /// </summary>
    public static class Clause
    {
        /// <summary>
        /// Creates a new negative Horn clause
        /// </summary>
        public static IClause If(params ILiteral[] literals)
        {
            if (literals == null) throw new ArgumentNullException("literals");
            if (literals.Any(literal => literal == null)) throw new ArgumentException("Null literals are not allowed", "literals");

            return new NegativeClause(literals);
        }

        /// <summary>
        /// Adds a positive literal to a negative Horn clause
        /// </summary>
        public static IClause Then(this IClause negativeHornClause, ILiteral then)
        {
            if (negativeHornClause == null) throw new ArgumentNullException("negativeHornClause");
            if (negativeHornClause.Implies != null) throw new ArgumentException("Clause already has an implication", "negativeHornClause");
            if (then == null) throw new ArgumentNullException("then");

            return new PositiveClause(negativeHornClause, then);
        }

        /// <summary>
        /// Returns a clause indicating that a literal is unconditionally true
        /// </summary>
        public static IClause Always(ILiteral always)
        {
            return If().Then(always);
        }
    }
}

Change Always(x) so that it doesn't depend on the 'true' literal


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

namespace osu.Framework.Statistics
{
    public class GlobalStatistic<T> : IGlobalStatistic
    {
        public string Group { get; }

        public string Name { get; }

        public IBindable<string> DisplayValue => displayValue;

        private readonly Bindable<string> displayValue = new Bindable<string>();

        public Bindable<T> Bindable { get; } = new Bindable<T>();

        public T Value
        {
            get => Bindable.Value;
            set => Bindable.Value = value;
        }

        public GlobalStatistic(string group, string name)
        {
            Group = group;
            Name = name;

            Bindable.ValueChanged += val => displayValue.Value = val.NewValue.ToString();
        }

        public virtual void Clear() => Bindable.SetDefault();
    }
}

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

namespace osu.Framework.Statistics
{
    public class GlobalStatistic<T> : IGlobalStatistic
    {
        public string Group { get; }

        public string Name { get; }

        public IBindable<string> DisplayValue => displayValue;

        private readonly Bindable<string> displayValue = new Bindable<string>();

        public Bindable<T> Bindable { get; } = new Bindable<T>();

        public T Value
        {
            get => Bindable.Value;
            set => Bindable.Value = value;
        }

        public GlobalStatistic(string group, string name)
        {
            Group = group;
            Name = name;

            Bindable.BindValueChanged(val => displayValue.Value = val.NewValue.ToString(), true);
        }

        public virtual void Clear() => Bindable.SetDefault();
    }
}

Fix initial value not propagating

Fix initial value not propagating


using System;
using System.Collections.Generic;
using System.Text;
using OpenQA.Selenium;
using Selenium.Internal.SeleniumEmulation;

namespace Selenium.Internal.SeleniumEmulation
{
    /// <summary>
    /// Defines the command for the open keyword.
    /// </summary>
    internal class Open : SeleneseCommand
    {
        private Uri baseUrl;

        /// <summary>
        /// Initializes a new instance of the <see cref="Open"/> class.
        /// </summary>
        /// <param name="baseUrl">The base URL to open with the command.</param>
        public Open(Uri baseUrl)
        {
            this.baseUrl = baseUrl;
        }

        /// <summary>
        /// Handles the command.
        /// </summary>
        /// <param name="driver">The driver used to execute the command.</param>
        /// <param name="locator">The first parameter to the command.</param>
        /// <param name="value">The second parameter to the command.</param>
        /// <returns>The result of the command.</returns>
        protected override object HandleSeleneseCommand(IWebDriver driver, string locator, string value)
        {
            string urlToOpen = this.ConstructUrl(locator);
            driver.Url = urlToOpen;
            return null;
        }

        private string ConstructUrl(string path)
        {
            string urlToOpen = path.Contains("://") ?
                               path :
                               this.baseUrl.ToString() + (!path.StartsWith("/", StringComparison.Ordinal) ? "/" : string.Empty) + path;

            return urlToOpen;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Text;
using OpenQA.Selenium;
using Selenium.Internal.SeleniumEmulation;

namespace Selenium.Internal.SeleniumEmulation
{
    /// <summary>
    /// Defines the command for the open keyword.
    /// </summary>
    internal class Open : SeleneseCommand
    {
        private Uri baseUrl;

        /// <summary>
        /// Initializes a new instance of the <see cref="Open"/> class.
        /// </summary>
        /// <param name="baseUrl">The base URL to open with the command.</param>
        public Open(Uri baseUrl)
        {
            this.baseUrl = baseUrl;
        }

        /// <summary>
        /// Handles the command.
        /// </summary>
        /// <param name="driver">The driver used to execute the command.</param>
        /// <param name="locator">The first parameter to the command.</param>
        /// <param name="value">The second parameter to the command.</param>
        /// <returns>The result of the command.</returns>
        protected override object HandleSeleneseCommand(IWebDriver driver, string locator, string value)
        {
            string urlToOpen = this.ConstructUrl(locator);
            driver.Url = urlToOpen;
            return null;
        }

        private string ConstructUrl(string path)
        {
            string urlToOpen = path.Contains("://") ?
                               path :
                               this.baseUrl.ToString().TrimEnd('/') + (!path.StartsWith("/", StringComparison.Ordinal) ? "/" : string.Empty) + path;

            return urlToOpen;
        }
    }
}

Remove trailing slashes from baseUrl in .NET to prevent double slashes in URL

This change is in the .NET WebDriverBackedSelenium API. Fixes issue #4506.

Signed-off-by Jim Evans <james.h.evans.jr@gmail.com>


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

using System.Web;
using System.Web.Mvc;
using Microsoft.Owin.Security;

namespace GoogleCloudSamples.Controllers
{
    // [START login]
    public class SessionController : Controller
    {
        // GET: Session/Login
        public ActionResult Login()
        {
            HttpContext.GetOwinContext().Authentication.Challenge(
                new AuthenticationProperties { RedirectUri = "/" },
                "Google"
            );
            return new HttpUnauthorizedResult();
        }
        // ...
        // [END login]

        // [START logout]
        // GET: Session/Logout
        public ActionResult Logout()
        {
            Request.GetOwinContext().Authentication.SignOut();
            return Redirect("/");
        }
        // [END logout]
    }
}

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

using System.Web;
using System.Web.Mvc;
using Microsoft.Owin.Security;

namespace GoogleCloudSamples.Controllers
{
    // [START login]
    public class SessionController : Controller
    {
        public ActionResult Login()
        {
            // Redirect to the Google OAuth 2.0 user consent screen
            HttpContext.GetOwinContext().Authentication.Challenge(
                new AuthenticationProperties { RedirectUri = "/" },
                "Google"
            );
            return new HttpUnauthorizedResult();
        }

        // ...
        // [END login]

        // [START logout]
        public ActionResult Logout()
        {
            Request.GetOwinContext().Authentication.SignOut();
            return Redirect("/");
        }
        // [END logout]
    }
}

Add comment to Auth Login action describing redirect


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

namespace SpotifyAPI.Web
{
    public static class Util
    {
        public static string GetStringAttribute<T>(this T en, String separator) where T : struct, IConvertible
        {
            Enum e = (Enum)(object)en;
            IEnumerable<StringAttribute> attributes =
            Enum.GetValues(typeof(T))
            .Cast<T>()
            .Where(v => e.HasFlag((Enum)(object)v))
            .Select(v => typeof(T).GetField(v.ToString(CultureInfo.InvariantCulture)))
            .Select(f => f.GetCustomAttributes(typeof(StringAttribute), false)[0])
            .Cast<StringAttribute>();

            List<String> list = new List<String>();
            attributes.ToList().ForEach(element => list.Add(element.Text));
            return string.Join(" ", list);
        }
    }

    public sealed class StringAttribute : Attribute
    {
        public String Text { get; set; }

        public StringAttribute(String text)
        {
            Text = text;
        }
    }
}

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

namespace SpotifyAPI.Web
{
    public static class Util
    {
        public static string GetStringAttribute<T>(this T en, String separator) where T : struct, IConvertible
        {
            Enum e = (Enum)(object)en;
            IEnumerable<StringAttribute> attributes =
            Enum.GetValues(typeof(T))
            .Cast<T>()
            .Where(v => e.HasFlag((Enum)(object)v))
            .Select(v => typeof(T).GetField(v.ToString(CultureInfo.InvariantCulture)))
            .Select(f => f.GetCustomAttributes(typeof(StringAttribute), false)[0])
            .Cast<StringAttribute>();

            List<String> list = new List<String>();
            attributes.ToList().ForEach(element => list.Add(element.Text));
            return string.Join(separator, list);
        }
    }

    public sealed class StringAttribute : Attribute
    {
        public String Text { get; set; }

        public StringAttribute(String text)
        {
            Text = text;
        }
    }
}

Use separator when joining string attributes


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

namespace HermaFx.Settings
{
	[AttributeUsage(AttributeTargets.Interface | AttributeTargets.Property, AllowMultiple = false)]
	public sealed class SettingsAttribute : Attribute
	{
		public const string DEFAULT_PREFIX_SEPARATOR = ":";

		/// <summary>
		/// Gets or sets the key prefix.
		/// </summary>
		/// <value>
		/// The key prefix.
		/// </value>
		public string KeyPrefix { get; }
		/// <summary>
		/// Gets or sets the prefix separator.
		/// </summary>
		/// <value>
		/// The prefix separator.
		/// </value>
		public string PrefixSeparator { get; set; }

		public SettingsAttribute()
		{
			PrefixSeparator = DEFAULT_PREFIX_SEPARATOR;
		}

		public SettingsAttribute(string keyPrefix)
			: this()
		{
			KeyPrefix = keyPrefix;
		}
	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Castle.Components.DictionaryAdapter;

namespace HermaFx.Settings
{
	[AttributeUsage(AttributeTargets.Interface | AttributeTargets.Property, AllowMultiple = false)]
	public sealed class SettingsAttribute : Attribute, IPropertyDescriptorInitializer
	{
		public const string DEFAULT_PREFIX_SEPARATOR = ":";

		/// <summary>
		/// Gets or sets the key prefix.
		/// </summary>
		/// <value>
		/// The key prefix.
		/// </value>
		public string KeyPrefix { get; }
		/// <summary>
		/// Gets or sets the prefix separator.
		/// </summary>
		/// <value>
		/// The prefix separator.
		/// </value>
		public string PrefixSeparator { get; set; }

		public SettingsAttribute()
		{
			PrefixSeparator = DEFAULT_PREFIX_SEPARATOR;
		}

		public SettingsAttribute(string keyPrefix)
			: this()
		{
			KeyPrefix = keyPrefix;
		}

		#region IPropertyDescriptorInitializer

		public int ExecutionOrder => DictionaryBehaviorAttribute.LastExecutionOrder;

		public void Initialize(PropertyDescriptor propertyDescriptor, object[] behaviors)
		{
			propertyDescriptor.Fetch = true;
		}

		public IDictionaryBehavior Copy()
		{
			return this;
		}

		#endregion

	}
}

Implement IPropertyDescriptorInitializer to validate properties on initializing


using System;

static class Program {
    static int RemoveDupes(this int[] a) {
        int write = 1;
        int read = 0;
        bool same = false;
        int count = 0;

        for (int i = 1; i < a.Length; i++) {
            read = i;
            if (same && a[read] == a[write]) {
                count++;
                continue;
            }

            same = a[read] == a[write];
            a[write++] = a[read];
        }

        return a.Length - count;
    }

    static void Main() {
        int[] a = new int[] {1, 1, 1, 2, 2, 3, 3, 3};
        int c = RemoveDupes(a);
        for (int i = 0; i < c; i++) {
            Console.Write("{0} ", a[i]);
        }

        Console.WriteLine();
    }
}

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

static class Program {
    static int RemoveDupes(this int[] a) {
        int write = 1;
        int read = 0;
        bool same = false;
        int count = 0;

        for (int i = 1; i < a.Length; i++) {
            read = i;
            if (same && a[read] == a[write]) {
                count++;
                continue;
            }

            same = a[read] == a[write];
            a[write++] = a[read];
        }

        return a.Length - count;
    }

    static int[] RemoveDupes2(this int[] v) {
        return v.Aggregate(new List<int>(),
                           (a, b) => {
                                if (a.Count(x => x == b) < 2) {
                                    a.Add(b);
                                }

                                return a;
                           }).ToArray();
    }

    static void Main() {
        int[] a = new int[] {1, 1, 1, 2, 2, 3, 3, 3};
        int c = RemoveDupes(a);
        for (int i = 0; i < c; i++) {
            Console.Write("{0} ", a[i]);
        }

        Console.WriteLine();

        foreach (int x in RemoveDupes2(a)) {
            Console.Write("{0} ", x);
        }

        Console.WriteLine();
    }
}

Remove duplicates from sorted array II - Linq


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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using osu.Framework.Configuration;
using osu.Game.Modes.Objects.Drawables;

namespace osu.Game.Modes
{
    public class ScoreProcessor
    {
        public virtual Score GetScore() => new Score();

        public BindableDouble TotalScore = new BindableDouble { MinValue = 0 };

        public BindableDouble Accuracy = new BindableDouble { MinValue = 0, MaxValue = 1 };

        public BindableInt Combo = new BindableInt();

        public List<JudgementInfo> Judgements = new List<JudgementInfo>();

        public virtual void AddJudgement(JudgementInfo judgement)
        {
            Judgements.Add(judgement);
            UpdateCalculations();

            judgement.ComboAtHit = (ulong)Combo.Value;
        }

        /// <summary>
        /// Update any values that potentially need post-processing on a judgement change.
        /// </summary>
        protected virtual void UpdateCalculations()
        {

        }
    }
}

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using osu.Framework.Configuration;
using osu.Game.Modes.Objects.Drawables;

namespace osu.Game.Modes
{
    public class ScoreProcessor
    {
        public virtual Score GetScore() => new Score();

        public BindableDouble TotalScore = new BindableDouble { MinValue = 0 };

        public BindableDouble Accuracy = new BindableDouble { MinValue = 0, MaxValue = 1 };

        public BindableInt Combo = new BindableInt();

        public BindableInt MaximumCombo = new BindableInt();

        public List<JudgementInfo> Judgements = new List<JudgementInfo>();

        public virtual void AddJudgement(JudgementInfo judgement)
        {
            Judgements.Add(judgement);
            UpdateCalculations();

            judgement.ComboAtHit = (ulong)Combo.Value;

            if (Combo.Value > MaximumCombo.Value)
                MaximumCombo.Value = Combo.Value;
        }

        /// <summary>
        /// Update any values that potentially need post-processing on a judgement change.
        /// </summary>
        protected virtual void UpdateCalculations()
        {

        }
    }
}

Store max combo in ScoreProcessor.

Store max combo in ScoreProcessor.


using System.IO;
using BenchmarkDotNet.Attributes;
using FreeImageAPI;
using ImageMagick;
using DS = DevILSharp;

namespace Pfim.Benchmarks
{
    public class TargaBenchmark
    {
        [Params("true-32-rle-large.tga", "true-24-large.tga", "true-24.tga", "true-32-rle.tga")]
        public string Payload { get; set; }

        private byte[] data;

        [GlobalSetup]
        public void SetupData()
        {
            data = File.ReadAllBytes(Payload);
            DS.Bootstrap.Init();
        }

        [Benchmark]
        public IImage Pfim() => Targa.Create(new MemoryStream(data));

        [Benchmark]
        public FreeImageBitmap FreeImage() => FreeImageAPI.FreeImageBitmap.FromStream(new MemoryStream(data));

        [Benchmark]
        public int ImageMagick()
        {
            var settings = new MagickReadSettings {Format = MagickFormat.Tga};
            using (var image = new MagickImage(new MemoryStream(data), settings))
            {
                return image.Width;
            }
        }

        [Benchmark]
        public int DevILSharp()
        {
            using (var image = DS.Image.Load(data, DS.ImageType.Tga))
            {
                return image.Width;
            }
        }

        [Benchmark]
        public int TargaImage()
        {
            using (var image = new Paloma.TargaImage(new MemoryStream(data)))
            {
                return image.Stride;
            }
        }
    }
}

using System.IO;
using BenchmarkDotNet.Attributes;
using FreeImageAPI;
using ImageMagick;
using DS = DevILSharp;

namespace Pfim.Benchmarks
{
    public class TargaBenchmark
    {
        [Params("true-32-rle-large.tga", "true-24-large.tga", "true-24.tga", "true-32-rle.tga", "rgb24_top_left")]
        public string Payload { get; set; }

        private byte[] data;

        [GlobalSetup]
        public void SetupData()
        {
            data = File.ReadAllBytes(Payload);
            DS.Bootstrap.Init();
        }

        [Benchmark]
        public IImage Pfim() => Targa.Create(new MemoryStream(data));

        [Benchmark]
        public FreeImageBitmap FreeImage() => FreeImageAPI.FreeImageBitmap.FromStream(new MemoryStream(data));

        [Benchmark]
        public int ImageMagick()
        {
            var settings = new MagickReadSettings {Format = MagickFormat.Tga};
            using (var image = new MagickImage(new MemoryStream(data), settings))
            {
                return image.Width;
            }
        }

        [Benchmark]
        public int DevILSharp()
        {
            using (var image = DS.Image.Load(data, DS.ImageType.Tga))
            {
                return image.Width;
            }
        }

        [Benchmark]
        public int TargaImage()
        {
            using (var image = new Paloma.TargaImage(new MemoryStream(data)))
            {
                return image.Stride;
            }
        }
    }
}

Include top left encoded targa in benchmark


using MetroOverhaul.Detours;
using MetroOverhaul.OptionsFramework.Attibutes;

namespace MetroOverhaul
{
    [Options("MetroOverhaul")]
    public class Options
    {
        private const string UNSUBPREP = "Unsubscribe Prep";
        private const string STYLES = "Additional styles";
        private const string GENERAL = "General settings";
        public Options()
        {
            improvedPassengerTrainAi = true;
            improvedMetroTrainAi = true;
            metroUi = true;
            ghostMode = false;
        }
        [Checkbox("Metro track customization UI (requires reloading from main menu)", GENERAL)]
        public bool metroUi { set; get; }

        [Checkbox("No depot mode (Trains will spawn at stations. Please bulldoze existing depots after enabling)", GENERAL)]
        public bool depotsNotRequiredMode { set; get; }

        [Checkbox("Improved PassengerTrainAI (Allows trains to return to depots)", GENERAL, typeof(PassengerTrainAIDetour), nameof(PassengerTrainAIDetour.ChangeDeployState))]
        public bool improvedPassengerTrainAi { set; get; }

        [Checkbox("Improved MetroTrainAI (Allows trains to properly spawn at surface)", GENERAL, typeof(MetroTrainAIDetour), nameof(MetroTrainAIDetour.ChangeDeployState))]
        public bool improvedMetroTrainAi { set; get; }

        [Checkbox("GHOST MODE (Load your MOM city with this ON and save before unsubscribing)", UNSUBPREP)]
        public bool ghostMode { set; get; }
    }
}

using MetroOverhaul.Detours;
using MetroOverhaul.OptionsFramework.Attibutes;

namespace MetroOverhaul
{
    [Options("MetroOverhaul")]
    public class Options
    {
        private const string UNSUBPREP = "Unsubscribe Prep";
        private const string GENERAL = "General settings";
        public Options()
        {
            improvedPassengerTrainAi = true;
            improvedMetroTrainAi = true;
            metroUi = true;
            ghostMode = false;
            depotsNotRequiredMode = false;
        }
        [Checkbox("Metro track customization UI (requires reloading from main menu)", GENERAL)]
        public bool metroUi { set; get; }

        [Checkbox("No depot mode (Trains will spawn at stations. Please bulldoze existing depots after enabling)", GENERAL)]
        public bool depotsNotRequiredMode { set; get; }

        [Checkbox("Improved PassengerTrainAI (Allows trains to return to depots)", GENERAL, typeof(PassengerTrainAIDetour), nameof(PassengerTrainAIDetour.ChangeDeployState))]
        public bool improvedPassengerTrainAi { set; get; }

        [Checkbox("Improved MetroTrainAI (Allows trains to properly spawn at surface)", GENERAL, typeof(MetroTrainAIDetour), nameof(MetroTrainAIDetour.ChangeDeployState))]
        public bool improvedMetroTrainAi { set; get; }

        [Checkbox("GHOST MODE (Load your MOM city with this ON and save before unsubscribing)", UNSUBPREP)]
        public bool ghostMode { set; get; }
    }
}

Set default value for no depot mode.

Set default value for no depot mode.


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

namespace PS.Mothership.Core.Common.Dto.Merchant
{
    public class AddProspectDto
    {
        public string CompanyName { get; set; }

        public string LocatorId
        {
            get
            {
                var id = Convert.ToString(((CompanyName.GetHashCode() ^ DateTime.UtcNow.Ticks.GetHashCode())
                    & 0xffffff) | 0x1000000, 16).Substring(1);
                return id;
            }
        }

        public long MainPhoneCountryKey { get; set; }

        public string MainPhoneNumber { get; set; }

        public Guid ContactGuid { get; set; }

        public Guid AddressGuid { get; set; }

        public Guid MainPhoneGuid { get; set; }
    }
}

using System;

namespace PS.Mothership.Core.Common.Dto.Merchant
{
    public class AddProspectDto
    {
        public string CompanyName { get; set; }

        public string LocatorId { get; set; }

        public long MainPhoneCountryKey { get; set; }

        public string MainPhoneNumber { get; set; }

        public Guid ContactGuid { get; set; }

        public Guid AddressGuid { get; set; }

        public Guid MainPhoneGuid { get; set; }
    }
}

Remove LocatorId generation code from DTO since the locator id will be generated by a SQL CLR function


using System;
using System.Collections.Generic;
using System.IO;
using NDesk.Options;

namespace make
{
    public class CommandLine
    {
        public string Program { get; set; }
        public string OutputFile { get; set; }
        public string InputFile { get; set; }
        public string[] Arguments { get; set; }

        private CommandLine()
        {
        }

        public static CommandLine Parse(string[] args)
        {
            var commandLine = new CommandLine();

            var options = new OptionSet
            {
                { "p|program=", v => commandLine.Program = v },
                { "o|out=", v => commandLine.OutputFile = v },
            };

            try
            {
                var remaining = options.Parse(args);
                commandLine.ParseRemainingArguments(remaining);
            }
            catch (OptionException e)
            {
                Console.Error.WriteLine(e.Message);
            }

            return commandLine;
        }

        private void ParseRemainingArguments(List<string> remaining)
        {
            var input = "";
            var options = new List<string>();

            foreach (var arg in remaining)
            {
                if (arg.StartsWith("/") || arg.StartsWith("-"))
                    options.Add(arg);
                else if (File.Exists(arg))
                    input = arg;
                else
                    options.Add(arg);
            }

            InputFile = input;
            Arguments = options.ToArray();
        }
    }
}

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using NDesk.Options;

namespace make
{
    public class CommandLine
    {
        public string Program { get; set; }
        public string OutputFile { get; set; }
        public string InputFile { get; set; }
        public string[] Arguments { get; set; }

        private CommandLine()
        {
        }

        public static CommandLine Parse(string[] args)
        {
            var commandLine = new CommandLine();

            var options = new OptionSet
            {
                { "p|program=", v => commandLine.Program = v },
                { "o|out=", v => commandLine.OutputFile = v },
            };

            try
            {
                var remaining = options.Parse(args);
                commandLine.ParseRemainingArguments(remaining);
            }
            catch (OptionException e)
            {
                Console.Error.WriteLine(e.Message);
            }

            return commandLine;
        }

        private void ParseRemainingArguments(List<string> remaining)
        {
            var input = "";
            var options = new List<string>();
            var arguments = remaining.AsEnumerable();

            if (Program == null)
            {
                Program = remaining.FirstOrDefault(a => !a.StartsWith("/") && !a.StartsWith("/"));
                if (Program == null)
                {
                    Console.Error.WriteLine("Wrong argument count. Please, use the -t switch to specify a valid program name.");
                    Environment.Exit(1);
                }
                arguments = remaining.Skip(1);
            }

            foreach (var arg in arguments)
            {
                if (arg.StartsWith("/") || arg.StartsWith("-"))
                    options.Add(arg);
                else if (File.Exists(arg))
                    input = arg;
                else
                    options.Add(arg);
            }

            InputFile = input;
            Arguments = options.ToArray();
        }
    }
}

Fix - The -t command-line switch is optional. Use first argument if omitted.


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

using OpenTK.Graphics;
using osu.Framework.Screens;
using osu.Game.Beatmaps;
using osu.Game.Screens.Backgrounds;

namespace osu.Game.Screens.Edit
{
    internal class Editor : ScreenWhiteBox
    {
        //private WorkingBeatmap beatmap;
        public Editor(WorkingBeatmap workingBeatmap)
        {
            //beatmap = workingBeatmap;
        }

        protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4");

        protected override void OnEntering(Screen last)
        {
            base.OnEntering(last);
            Background.Schedule(() => Background.FadeColour(Color4.DarkGray, 500));
        }

        protected override bool OnExiting(Screen next)
        {
            Background.Schedule(() => Background.FadeColour(Color4.White, 500));
            return base.OnExiting(next);
        }
    }
}

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

using OpenTK.Graphics;
using osu.Framework.Screens;
using osu.Game.Beatmaps;
using osu.Game.Screens.Backgrounds;

namespace osu.Game.Screens.Edit
{
    internal class Editor : ScreenWhiteBox
    {
        private WorkingBeatmap beatmap;
        public Editor(WorkingBeatmap workingBeatmap)
        {
            beatmap = workingBeatmap;
        }

        protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4");

        protected override void OnEntering(Screen last)
        {
            base.OnEntering(last);
            Background.Schedule(() => Background.FadeColour(Color4.DarkGray, 500));
            beatmap.Track?.Stop();
        }

        protected override bool OnExiting(Screen next)
        {
            Background.Schedule(() => Background.FadeColour(Color4.White, 500));
            beatmap.Track?.Start();
            return base.OnExiting(next);
        }
    }
}

Stop playing the track in editor to avoid unused member warning