using ConDep.Dsl.SemanticModel;
using ConDep.Dsl.SemanticModel.WebDeploy;
using Microsoft.Web.Deployment;

namespace ConDep.Dsl.Operations.Application.Execution.RunCmd
{
	public class RunCmdProvider : WebDeployProviderBase
	{
        private const string NAME = "runCommand";

		public RunCmdProvider(string command)
		{
		    DestinationPath = command;
		}

        public override DeploymentProviderOptions GetWebDeploySourceProviderOptions()
        {
            return new DeploymentProviderOptions(NAME) { Path = DestinationPath };
        }

    	public override string Name
		{
			get { return NAME; }
		}

		public override DeploymentProviderOptions GetWebDeployDestinationProviderOptions()
		{
		    var destProviderOptions = new DeploymentProviderOptions("Auto");// { Path = DestinationPath };
            //DeploymentProviderSetting dontUseCmdExe;
            //if (destProviderOptions.ProviderSettings.TryGetValue("dontUseCommandExe", out dontUseCmdExe))
            //{
            //    dontUseCmdExe.Value = true;
            //}
		    return destProviderOptions;
		}

		public override bool IsValid(Notification notification)
		{
			return !string.IsNullOrWhiteSpace(DestinationPath) ||
                string.IsNullOrWhiteSpace(SourcePath);
		}
	}
}

using ConDep.Dsl.SemanticModel;
using ConDep.Dsl.SemanticModel.WebDeploy;
using Microsoft.Web.Deployment;

namespace ConDep.Dsl.Operations.Application.Execution.RunCmd
{
	public class RunCmdProvider : WebDeployProviderBase
	{
        private const string NAME = "runCommand";

		public RunCmdProvider(string command)
		{
		    DestinationPath = command;
		    WaitIntervalInSeconds = 60;
		}

        public override DeploymentProviderOptions GetWebDeploySourceProviderOptions()
        {
            return new DeploymentProviderOptions(NAME) { Path = DestinationPath };
        }

    	public override string Name
		{
			get { return NAME; }
		}

		public override DeploymentProviderOptions GetWebDeployDestinationProviderOptions()
		{
		    var destProviderOptions = new DeploymentProviderOptions("Auto");// { Path = DestinationPath };
            //DeploymentProviderSetting dontUseCmdExe;
            //if (destProviderOptions.ProviderSettings.TryGetValue("dontUseCommandExe", out dontUseCmdExe))
            //{
            //    dontUseCmdExe.Value = true;
            //}
		    return destProviderOptions;
		}

		public override bool IsValid(Notification notification)
		{
			return !string.IsNullOrWhiteSpace(DestinationPath) ||
                string.IsNullOrWhiteSpace(SourcePath);
		}
	}
}

Set default wait interval for Run command to be 60 seconds


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

using MBEV = Microsoft.Build.Evaluation;
using MBEX = Microsoft.Build.Execution;

namespace MSBuildTracer
{
    class ImportTracer
    {
        private MBEV.Project project;

        public ImportTracer(MBEV.Project project)
        {
            this.project = project;
        }

        public void Trace(MBEV.ResolvedImport import, int traceLevel = 0)
        {
            PrintImportInfo(import, traceLevel);

            foreach (var childImport in project.Imports.Where(
                i => string.Equals(i.ImportingElement.ContainingProject.FullPath,
                                   project.ResolveAllProperties(import.ImportingElement.Project),
                                   StringComparison.OrdinalIgnoreCase)))
            {
                Trace(childImport, traceLevel + 1);
            }
        }

        private void PrintImportInfo(MBEV.ResolvedImport import, int indentCount)
        {
            var indent = indentCount > 0 ? new StringBuilder().Insert(0, "    ", indentCount).ToString() : "";

            Console.WriteLine($"{indent}{import.ImportingElement.Location.Line}: {project.ResolveAllProperties(import.ImportingElement.Project)}");
        }
    }
}

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

using MBEV = Microsoft.Build.Evaluation;
using MBEX = Microsoft.Build.Execution;

namespace MSBuildTracer
{
    class ImportTracer
    {
        private MBEV.Project project;

        public ImportTracer(MBEV.Project project)
        {
            this.project = project;
        }

        public void Trace(MBEV.ResolvedImport import, int traceLevel = 0)
        {
            PrintImportInfo(import, traceLevel);

            foreach (var childImport in project.Imports.Where(
                i => string.Equals(i.ImportingElement.ContainingProject.FullPath,
                                   project.ResolveAllProperties(import.ImportingElement.Project),
                                   StringComparison.OrdinalIgnoreCase)))
            {
                Trace(childImport, traceLevel + 1);
            }
        }

        private void PrintImportInfo(MBEV.ResolvedImport import, int indentCount)
        {
            var indent = indentCount > 0 ? new StringBuilder().Insert(0, "    ", indentCount).ToString() : "";

            Console.WriteLine($"{indent}{import.ImportingElement.Location.Line}: {project.ResolveAllProperties(import.ImportedProject.Location.File)}");
        }
    }
}

Fix path output for inputs

Fix path output for inputs


//
// NSUrlConnection.cs:
// Author:
//   Miguel de Icaza
//

using System;
using System.Reflection;
using System.Collections;
using System.Runtime.InteropServices;

using MonoMac.ObjCRuntime;

namespace MonoMac.Foundation {

	public partial class NSUrlConnection {
                static Selector selSendSynchronousRequestReturningResponseError = new Selector ("sendSynchronousRequest:returningResponse:error:");

		unsafe static NSData SendSynchronousRequest (NSUrlRequest request, out NSUrlResponse response, out NSError error)
		{
			IntPtr responseStorage = IntPtr.Zero;
			IntPtr errorStorage = IntPtr.Zero;

			void *resp = &responseStorage;
			void *errp = &errorStorage;
			IntPtr rhandle = (IntPtr) resp;
			IntPtr ehandle = (IntPtr) errp;

			var res = Messaging.IntPtr_objc_msgSend_IntPtr_IntPtr_IntPtr (
				class_ptr,
				selSendSynchronousRequestReturningResponseError.Handle,
				request.Handle,
				rhandle,
				ehandle);

			if (responseStorage != IntPtr.Zero)
				response = (NSUrlResponse) Runtime.GetNSObject (responseStorage);
			else
				response = null;

			if (errorStorage != IntPtr.Zero)
				error = (NSUrlResponse) Runtime.GetNSObject (errorStorage);
			else
				error = null;

			return (NSData) Runtime.GetNSObject (res);
		}
	}
}

//
// NSUrlConnection.cs:
// Author:
//   Miguel de Icaza
//

using System;
using System.Reflection;
using System.Collections;
using System.Runtime.InteropServices;

using MonoMac.ObjCRuntime;

namespace MonoMac.Foundation {

	public partial class NSUrlConnection {
                static Selector selSendSynchronousRequestReturningResponseError = new Selector ("sendSynchronousRequest:returningResponse:error:");

		public unsafe static NSData SendSynchronousRequest (NSUrlRequest request, out NSUrlResponse response, out NSError error)
		{
			IntPtr responseStorage = IntPtr.Zero;
			IntPtr errorStorage = IntPtr.Zero;

			void *resp = &responseStorage;
			void *errp = &errorStorage;
			IntPtr rhandle = (IntPtr) resp;
			IntPtr ehandle = (IntPtr) errp;

			var res = Messaging.IntPtr_objc_msgSend_IntPtr_IntPtr_IntPtr (
				class_ptr,
				selSendSynchronousRequestReturningResponseError.Handle,
				request.Handle,
				rhandle,
				ehandle);

			if (responseStorage != IntPtr.Zero)
				response = (NSUrlResponse) Runtime.GetNSObject (responseStorage);
			else
				response = null;

			if (errorStorage != IntPtr.Zero)
				error = (NSError) Runtime.GetNSObject (errorStorage);
			else
				error = null;

			return (NSData) Runtime.GetNSObject (res);
		}
	}
}

Fix compilation error introduced with my previous fix


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

namespace osu.Game.Beatmaps
{
    /// <summary>
    /// The type of countdown shown before the start of gameplay on a given beatmap.
    /// </summary>
    public enum CountdownType
    {
        None = 0,
        Normal = 1,
        HalfSpeed = 2,
        DoubleSpeed = 3
    }
}

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

using System.ComponentModel;

namespace osu.Game.Beatmaps
{
    /// <summary>
    /// The type of countdown shown before the start of gameplay on a given beatmap.
    /// </summary>
    public enum CountdownType
    {
        None = 0,

        [Description("Normal")]
        Normal = 1,

        [Description("Half speed")]
        HalfSpeed = 2,

        [Description("Double speed")]
        DoubleSpeed = 3
    }
}

Add descriptions to enum members

Add descriptions to enum members


using System;
using O365.Security.ETW;

namespace hiddentreasure_etw_demo
{
    public static class RemoteThreadInjection
    {
        public static UserTrace CreateTrace()
        {
            var filter = new EventFilter(Filter
                .EventIdIs(3));

            filter.OnEvent += (IEventRecord r) => {
                var sourcePID = r.ProcessId;
                var targetPID = r.GetUInt32("ProcessID");

                if (sourcePID != targetPID)
                {
                    var createdTID = r.GetUInt32("ThreadID");
                    var fmt = "Possible thread injection! - SourcePID: {0}, TargetPID: {1}, CreatedTID: {2}";
                    Console.WriteLine(fmt, sourcePID, targetPID, createdTID);
                }
            };

            var provider = new Provider("Microsoft-Windows-Kernel-Process");
            provider.AddFilter(filter);

            var trace = new UserTrace();
            trace.Enable(provider);
            return trace;
        }
    }
}

using System;
using O365.Security.ETW;

namespace hiddentreasure_etw_demo
{
    public static class RemoteThreadInjection
    {
        public static UserTrace CreateTrace()
        {
            var filter = new EventFilter(Filter
                .EventIdIs(3));

            filter.OnEvent += (IEventRecord r) => {
                var sourcePID = r.ProcessId;
                var targetPID = r.GetUInt32("ProcessID");

                if (sourcePID != targetPID)
                {
                    // This is where you'd check that the target process's
                    // parent PID isn't the source PID. I've left it off for
                    // brevity since .NET doesn't provide an easy way to get
                    // parent PID :(.
                    var createdTID = r.GetUInt32("ThreadID");
                    var fmt = "Possible thread injection! - SourcePID: {0}, TargetPID: {1}, CreatedTID: {2}";
                    Console.WriteLine(fmt, sourcePID, targetPID, createdTID);
                }
            };

            var provider = new Provider("Microsoft-Windows-Kernel-Process");
            provider.AddFilter(filter);

            var trace = new UserTrace();
            trace.Enable(provider);
            return trace;
        }
    }
}

Add comment about ParentPid check.

Add comment about ParentPid check.


using BruTile.Predefined;
using BruTile.Web;
using Mapsui.Layers;

namespace Mapsui.Utilities
{
    public static class OpenStreetMap
    {
        private const string DefaultUserAgent = "Default Mapsui user-agent";
        private static readonly BruTile.Attribution OpenStreetMapAttribution = new BruTile.Attribution(
            "© OpenStreetMap contributors", "https://www.openstreetmap.org/copyright");

        public static TileLayer CreateTileLayer()
        {
            return new TileLayer(CreateTileSource()) { Name = "OpenStreetMap" };
        }

        private static HttpTileSource CreateTileSource(string userAgent = DefaultUserAgent)
        {
            return new HttpTileSource(new GlobalSphericalMercator(),
                "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
                new[] { "a", "b", "c" }, name: "OpenStreetMap",
                attribution: OpenStreetMapAttribution, userAgent: userAgent);
        }
    }
}

using BruTile.Predefined;
using BruTile.Web;
using Mapsui.Layers;

namespace Mapsui.Utilities
{
    public static class OpenStreetMap
    {
        private const string DefaultUserAgent = "Default Mapsui user-agent";
        private static readonly BruTile.Attribution OpenStreetMapAttribution = new BruTile.Attribution(
            "© OpenStreetMap contributors", "https://www.openstreetmap.org/copyright");

        public static TileLayer CreateTileLayer(string userAgent = DefaultUserAgent)
        {
            return new TileLayer(CreateTileSource(userAgent)) { Name = "OpenStreetMap" };
        }

        private static HttpTileSource CreateTileSource(string userAgent)
        {
            return new HttpTileSource(new GlobalSphericalMercator(),
                "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
                new[] { "a", "b", "c" }, name: "OpenStreetMap",
                attribution: OpenStreetMapAttribution, userAgent: userAgent);
        }
    }
}

Add parameter to the public method

Add parameter to the public method


using PubNubMessaging.Core;
using System;
using Utf8Json;

namespace BitFlyer.Apis
{
    public class RealtimeApi
    {
        private readonly Pubnub _pubnub;

        public RealtimeApi()
        {
            _pubnub = new Pubnub("nopublishkey", BitFlyerConstants.SubscribeKey);
        }

        public void Subscribe<T>(string channel, Action<T> onReceive, Action<string> onConnect, Action<string, Exception> onError)
        {
            _pubnub.Subscribe(
                channel,
                s => OnReceiveMessage(s, onReceive, onError),
                onConnect,
                error =>
                {
                    onError(error.Message, error.DetailedDotNetException);
                });
        }

        private void OnReceiveMessage<T>(string result, Action<T> onReceive, Action<string, Exception> onError)
        {
            if (string.IsNullOrWhiteSpace(result))
            {
                return;
            }

            var deserializedMessage = _pubnub.JsonPluggableLibrary.DeserializeToListOfObject(result);
            if (deserializedMessage == null || deserializedMessage.Count <= 0)
            {
                return;
            }

            var subscribedObject = deserializedMessage[0];
            if (subscribedObject == null)
            {
                return;
            }

            var resultActualMessage = _pubnub.JsonPluggableLibrary.SerializeToJsonString(subscribedObject);
            T deserialized;
            try
            {
                deserialized = JsonSerializer.Deserialize<T>(resultActualMessage);
            }
            catch (Exception ex)
            {
                onError(ex.Message, ex);
                return;
            }
            onReceive(deserialized);
        }
    }
}

using PubNubMessaging.Core;
using System;
using System.Text;
using Utf8Json;

namespace BitFlyer.Apis
{
    public class RealtimeApi
    {
        private readonly Pubnub _pubnub;

        public RealtimeApi()
        {
            _pubnub = new Pubnub("nopublishkey", BitFlyerConstants.SubscribeKey);
        }

        public void Subscribe<T>(string channel, Action<T> onReceive, Action<string> onConnect, Action<string, Exception> onError)
        {
            _pubnub.Subscribe(
                channel,
                s => OnReceiveMessage(s, onReceive, onError),
                onConnect,
                error =>
                {
                    onError(error.Message, error.DetailedDotNetException);
                });
        }

        private void OnReceiveMessage<T>(string result, Action<T> onReceive, Action<string, Exception> onError)
        {
            if (string.IsNullOrWhiteSpace(result))
            {
                return;
            }

            var reader = new JsonReader(Encoding.UTF8.GetBytes(result));
            reader.ReadIsBeginArrayWithVerify();

            T deserialized;
            try
            {
                deserialized = JsonSerializer.Deserialize<T>(ref reader);
            }
            catch (Exception ex)
            {
                onError(ex.Message, ex);
                return;
            }
            onReceive(deserialized);
        }
    }
}

Improve performance for realtime API

Improve performance for realtime API


namespace Poller.Data
{
    using Microsoft.AspNet.Identity.EntityFramework;
    using Models;
    using Migrations;
    using System.Data.Entity;

    public class PollerDb : IdentityDbContext<ApplicationUser>
    {
        public PollerDb()
            : base("PollerDbConnection", throwIfV1Schema: false)
        {
            Database.SetInitializer(new MigrateDatabaseToLatestVersion<PollerDb, Configuration>());
        }

        public static PollerDb Create()
        {
            return new PollerDb();
        }

        public IDbSet<Poll> Polls { get; set; }

        public IDbSet<PollQuestion> PollQuestions { get; set; }

        public IDbSet<PollAnswer> PollAnswers { get; set; }

        public System.Data.Entity.DbSet<Poller.Models.ApplicationUser> ApplicationUsers { get; set; }
    }
}

namespace Poller.Data
{
    using Microsoft.AspNet.Identity.EntityFramework;
    using Models;
    using Migrations;
    using System.Data.Entity;

    public class PollerDb : IdentityDbContext<ApplicationUser>
    {
        public PollerDb()
            : base("PollerD", throwIfV1Schema: false)
        {
            Database.SetInitializer(new MigrateDatabaseToLatestVersion<PollerDb, Configuration>());
        }

        public static PollerDb Create()
        {
            return new PollerDb();
        }

        public IDbSet<Poll> Polls { get; set; }

        public IDbSet<PollQuestion> PollQuestions { get; set; }

        public IDbSet<PollAnswer> PollAnswers { get; set; }
    }
}

Fix stupid error from scafolding

Fix stupid error from scafolding


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

namespace osu.Game.Scoring
{
    public enum ScoreRank
    {
        [Description(@"F")]
        F,
        [Description(@"D")]
        D,
        [Description(@"C")]
        C,
        [Description(@"B")]
        B,
        [Description(@"A")]
        A,
        [Description(@"S")]
        S,
        [Description(@"SPlus")]
        SH,
        [Description(@"SS")]
        X,
        [Description(@"SSPlus")]
        XH,
    }
}

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

namespace osu.Game.Scoring
{
    public enum ScoreRank
    {
        [Description(@"F")]
        F,
        [Description(@"F")]
        D,
        [Description(@"C")]
        C,
        [Description(@"B")]
        B,
        [Description(@"A")]
        A,
        [Description(@"S")]
        S,
        [Description(@"SPlus")]
        SH,
        [Description(@"SS")]
        X,
        [Description(@"SSPlus")]
        XH,
    }
}

Revert "Fix D rank displaying as F"

Revert "Fix D rank displaying as F"

This reverts commit 17b2a4ca0de3c486ab239da7e278fcbb9a7d8cd9.


//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.18033
//
//     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-02-22 14:39")]
[assembly: AssemblyCopyright("Copyright © 2013 Autofac Contributors")]

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.18033
//
//     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-02-28 02:03")]
[assembly: AssemblyCopyright("Copyright © 2013 Autofac Contributors")]

Build script now creates individual zip file packages to align with the NuGet packages and semantic versioning.


using System;
using System.Data.Entity;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace NoteFolder.Models {
	public class FileDbContext : DbContext {
		public DbSet<File> Files { get; set; }
	}

	public class File {
		public int ID { get; set; }
		public string Name { get; set; }
		public string Description { get; set; }
		public string Text { get; set; }
		public bool IsFolder { get; set; }
		public DateTime TimeCreated {get; set; }
		public DateTime TimeLastEdited { get; set; }

		public virtual File Parent { get; set; }
		public virtual ICollection<File> Children { get; set; }
	}
}

using System;
using System.Data.Entity;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace NoteFolder.Models {
	public class FileTestInit : DropCreateDatabaseAlways<FileDbContext> {
		protected override void Seed(FileDbContext db) {
			var docs = new File { Name = "Documents", Description = "", IsFolder = true };
			var proj = new File { Name = "Projects", Description = "", IsFolder = true };
			var nf = new File { Name = "NoteFolder", Description = "Note organization", IsFolder = true };
			var sln = new File { Name = "NoteFolder.sln", Description = "", IsFolder = false, Text = "<Solution text>" };
			var source = new File { Name = "Source", Description = "", IsFolder = true };
			var cs = new File { Name = "NoteFolder.cs", Description = "", IsFolder = false, Text = "<Source code>" };
			proj.SetParent(docs);
			nf.SetParent(proj);
			sln.SetParent(nf);
			source.SetParent(nf);
			cs.SetParent(source);
			db.Files.AddRange(new File[] {docs, proj, nf, sln, source, cs });
			base.Seed(db);
		}
	}
	public static class FileDebugExtensions {
		public static void SetParent(this File f, File parent) {
			f.Parent = parent;
			parent.Children.Add(f);
		}
	}
	public class FileDbContext : DbContext {
		public DbSet<File> Files { get; set; }
		public FileDbContext() {
			Database.SetInitializer(new FileTestInit());
		}
	}

	public class File {
		public int ID { get; set; }
		public string Name { get; set; }
		public string Description { get; set; }
		public string Text { get; set; }
		public bool IsFolder { get; set; }
		public DateTime TimeCreated {get; set; }
		public DateTime TimeLastEdited { get; set; }

		public virtual File Parent { get; set; }
		public virtual ICollection<File> Children { get; set; }
	}
}

Add test data seeder to DbContext.

Add test data seeder to DbContext.


namespace Prometheus.HttpMetrics
{
    public sealed class HttpRequestDurationOptions : HttpMetricsOptionsBase
    {
        private const string DefaultName = "http_request_duration_seconds";

        private const string DefaultHelp =
            "Provides the duration in seconds of HTTP requests from an ASP.NET application.";

        public Histogram Histogram { get; set; } = Metrics.CreateHistogram(DefaultName, DefaultHelp,
            new HistogramConfiguration
            {
                Buckets = Histogram.ExponentialBuckets(0.0001, 1.5, 36),
                LabelNames = HttpRequestLabelNames.All
            });
    }
}

namespace Prometheus.HttpMetrics
{
    public sealed class HttpRequestDurationOptions : HttpMetricsOptionsBase
    {
        private const string DefaultName = "http_request_duration_seconds";

        private const string DefaultHelp =
            "Provides the duration in seconds of HTTP requests from an ASP.NET application.";

        public Histogram Histogram { get; set; } = Metrics.CreateHistogram(DefaultName, DefaultHelp,
            new HistogramConfiguration
            {
                Buckets = Histogram.ExponentialBuckets(0.001, 2, 16),
                LabelNames = HttpRequestLabelNames.All
            });
    }
}

Reduce default bucket count for HTTP request duration to 16

1ms to 65k ms


// ==========================================================================
//  Squidex Headless CMS
// ==========================================================================
//  Copyright (c) Squidex UG (haftungsbeschraenkt)
//  All rights reserved. Licensed under the MIT license.
// ==========================================================================

using Squidex.ClientLibrary.Management;

namespace TestSuite.Fixtures
{
    public class CreatedAppFixture : ClientFixture
    {
        private static readonly string[] Contributors =
        {
            "sebastian@squidex.io",
            "hello1@squidex.io",
            "hello2@squidex.io",
        };

        private static bool isCreated;

        public CreatedAppFixture()
        {
            if (!isCreated)
            {
                Task.Run(async () =>
                {
                    try
                    {
                        await Apps.PostAppAsync(new CreateAppDto { Name = AppName });
                    }
                    catch (SquidexManagementException ex)
                    {
                        if (ex.StatusCode != 400)
                        {
                            throw;
                        }
                    }

                    var invite = new AssignContributorDto { Invite = true, Role = "Owner" };

                    foreach (var contributor in Contributors)
                    {
                        invite.ContributorId = contributor;

                        await Apps.PostContributorAsync(AppName, invite);
                    }
                }).Wait();

                isCreated = true;
            }
        }
    }
}

// ==========================================================================
//  Squidex Headless CMS
// ==========================================================================
//  Copyright (c) Squidex UG (haftungsbeschraenkt)
//  All rights reserved. Licensed under the MIT license.
// ==========================================================================

using Squidex.ClientLibrary.Management;

namespace TestSuite.Fixtures
{
    public class CreatedAppFixture : ClientFixture
    {
        private static readonly string[] Contributors =
        {
            "hello@squidex.io"
        };

        private static bool isCreated;

        public CreatedAppFixture()
        {
            if (!isCreated)
            {
                Task.Run(async () =>
                {
                    try
                    {
                        await Apps.PostAppAsync(new CreateAppDto { Name = AppName });
                    }
                    catch (SquidexManagementException ex)
                    {
                        if (ex.StatusCode != 400)
                        {
                            throw;
                        }
                    }

                    var invite = new AssignContributorDto { Invite = true, Role = "Owner" };

                    foreach (var contributor in Contributors)
                    {
                        invite.ContributorId = contributor;

                        await Apps.PostContributorAsync(AppName, invite);
                    }
                }).Wait();

                isCreated = true;
            }
        }
    }
}

Reduce contributors to work for cloud tests.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using PX.Data;
using PX.SM.BoxStorageProvider;
using PX.Common;

public partial class Pages_SM_SM202670 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string folderID = Request.QueryString["FolderID"];
        string fileID = Request.QueryString["FileID"];

        if (!String.IsNullOrEmpty(folderID) && !String.IsNullOrEmpty(fileID))
        {
            fraContent.Attributes["src"] = "https://box.com/embed_widget/000000000000/files/0/f/" + folderID + "/1/f_" + fileID;
        }
        else if (!String.IsNullOrEmpty(folderID))
        {
            fraContent.Attributes["src"] = "https://box.com/embed_widget/000000000000/files/0/f/" + folderID;
        }
        else
        {
            Response.Write("Error. Missing FolderID/FileID Parameters.");
            return;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using PX.Data;
using PX.SM.BoxStorageProvider;
using PX.Common;

public partial class Pages_SM_SM202670 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string folderID = Request.QueryString["FolderID"];
        string fileID = Request.QueryString["FileID"];

        if (!String.IsNullOrEmpty(folderID) && !String.IsNullOrEmpty(fileID))
        {
            fraContent.Attributes["src"] = "https://boxenterprise.net/embed_widget/000000000000/files/0/f/" + folderID + "/1/f_" + fileID;
        }
        else if (!String.IsNullOrEmpty(folderID))
        {
            fraContent.Attributes["src"] = "https://boxenterprise.net/embed_widget/000000000000/files/0/f/" + folderID;
        }
        else
        {
            Response.Write("Error. Missing FolderID/FileID Parameters.");
            return;
        }
    }
}

Use boxenterprise.net when viewing file of folder from Acumatica


using System.IO;

namespace Cassette.BundleProcessing
{
    public abstract class ParseReferences<T> : IBundleProcessor<T>
        where T : Bundle
    {
        public void Process(T bundle)
        {
            foreach (var asset in bundle.Assets)
            {
                if (ShouldParseAsset(asset))
                {
                    ParseAssetReferences(asset);
                }
            }
        }

        protected virtual bool ShouldParseAsset(IAsset asset)
        {
            return true;
        }

        void ParseAssetReferences(IAsset asset)
        {
            string code;
            using (var reader = new StreamReader(asset.OpenStream()))
            {
                code = reader.ReadToEnd();
            }

            var commentParser = CreateCommentParser();
            var referenceParser = CreateReferenceParser(commentParser);
            var references = referenceParser.Parse(code, asset);
            foreach (var reference in references)
            {
                asset.AddReference(reference.Path, reference.LineNumber);
            }
        }

        internal virtual ReferenceParser CreateReferenceParser(ICommentParser commentParser)
        {
            return new ReferenceParser(commentParser);
        }

        protected abstract ICommentParser CreateCommentParser();
    }
}

using System.IO;

namespace Cassette.BundleProcessing
{
    public abstract class ParseReferences<T> : IBundleProcessor<T>
        where T : Bundle
    {
        public void Process(T bundle)
        {
            foreach (var asset in bundle.Assets)
            {
                if (ShouldParseAsset(asset))
                {
                    ParseAssetReferences(asset);
                }
            }
        }

        protected virtual bool ShouldParseAsset(IAsset asset)
        {
            return true;
        }

        protected virtual bool ShouldAddReference(string referencePath)
        {
            return true;
        }

        void ParseAssetReferences(IAsset asset)
        {
            string code;
            using (var reader = new StreamReader(asset.OpenStream()))
            {
                code = reader.ReadToEnd();
            }

            var commentParser = CreateCommentParser();
            var referenceParser = CreateReferenceParser(commentParser);
            var references = referenceParser.Parse(code, asset);
            foreach (var reference in references)
            {
                if (ShouldAddReference(reference.Path))
                {
                    asset.AddReference(reference.Path, reference.LineNumber);
                }
            }
        }

        internal virtual ReferenceParser CreateReferenceParser(ICommentParser commentParser)
        {
            return new ReferenceParser(commentParser);
        }

        protected abstract ICommentParser CreateCommentParser();
    }
}

Allow control over references being added


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

namespace Tests.Scriptables
{
    public class Progeny : Scriptable
    {
        [Description("Simple Name Field")]
        public string Name { get; set; }
    }
}

using Consola.Library;
using Consola.Library.util;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tests.Scriptables
{
    public class Progeny : Scriptable
    {
        [Description("Simple Name Field")]
        public string Name { get; set; }
    }
}

Update Tests to reflect attribute move

Update Tests to reflect attribute move


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

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

            host.Run();
        }
    }
}

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

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

            host.Run();
        }
    }
}

Set thread count to 1 in kestrel options.


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

namespace Catel
{
    using System;

    /// <summary>
    /// String extensions.
    /// </summary>
    public static class StringExtensions
    {
        /// <summary>
        /// Gets the a unique name for a control. This is sometimes required in some frameworks.
        /// <para />
        /// The name is made unique by appending a unique guid.
        /// </summary>
        /// <param name="controlName">Name of the control.</param>
        /// <returns>System.String.</returns>
        public static string GetUniqueControlName(this string controlName)
        {
            var name = string.Format("{0}_{1}", controlName, Guid.NewGuid());
            return name;
        }
    }
}

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

namespace Catel
{
    using System;

    /// <summary>
    /// String extensions.
    /// </summary>
    public static class StringExtensions
    {
        /// <summary>
        /// Gets the a unique name for a control. This is sometimes required in some frameworks.
        /// <para />
        /// The name is made unique by appending a unique guid.
        /// </summary>
        /// <param name="controlName">Name of the control.</param>
        /// <returns>System.String.</returns>
        public static string GetUniqueControlName(this string controlName)
        {
            var random = Guid.NewGuid().ToString();
            random = random.Replace("-", string.Empty);

            var name = string.Format("{0}_{1}", controlName, random);
            return name;
        }
    }
}

Fix unique control name for WPF

Fix unique control name for WPF


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

using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osuTK;
using osuTK.Graphics;

namespace osu.Game.Overlays.BeatmapSet
{
    public class ExplicitBeatmapPill : CompositeDrawable
    {
        public ExplicitBeatmapPill()
        {
            AutoSizeAxes = Axes.Both;
        }

        [BackgroundDependencyLoader(true)]
        private void load(OsuColour colours, OverlayColourProvider colourProvider)
        {
            InternalChild = new CircularContainer
            {
                Masking = true,
                AutoSizeAxes = Axes.Both,
                Children = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour = colourProvider?.Background5 ?? colours.Gray2,
                    },
                    new OsuSpriteText
                    {
                        Margin = new MarginPadding { Horizontal = 10f, Vertical = 2f },
                        Text = "EXPLICIT",
                        Font = OsuFont.GetFont(size: 10, weight: FontWeight.Bold),
                        // todo: this is --hsl-orange-2 from the new palette in https://github.com/ppy/osu-web/blob/8ceb46f/resources/assets/less/colors.less#L128-L151,
                        // should probably take the whole palette from there onto OsuColour for a nicer look in code.
                        Colour = Color4.FromHsl(new Vector4(45f / 360, 0.8f, 0.6f, 1f)),
                    }
                }
            };
        }
    }
}

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

using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;

namespace osu.Game.Overlays.BeatmapSet
{
    public class ExplicitBeatmapPill : CompositeDrawable
    {
        public ExplicitBeatmapPill()
        {
            AutoSizeAxes = Axes.Both;
        }

        [BackgroundDependencyLoader(true)]
        private void load(OsuColour colours, OverlayColourProvider colourProvider)
        {
            InternalChild = new CircularContainer
            {
                Masking = true,
                AutoSizeAxes = Axes.Both,
                Children = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour = colourProvider?.Background5 ?? colours.Gray2,
                    },
                    new OsuSpriteText
                    {
                        Margin = new MarginPadding { Horizontal = 10f, Vertical = 2f },
                        Text = "EXPLICIT",
                        Font = OsuFont.GetFont(size: 10, weight: FontWeight.Bold),
                        Colour = OverlayColourProvider.Orange.Colour2,
                    }
                }
            };
        }
    }
}

Use `Colour2` of orange theme for explicit pill


using Orders.com.Web.Api.Filters;
using System.Web.Http;

namespace Orders.com.Web.Api
{
    public static class WebApiConfig
    {
        public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services
            GlobalConfiguration.Configuration.DependencyResolver = new NinjectResolver(NinjectWebCommon.CreateKernel());

            // Web API routes
            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );
        }
    }
}

using Orders.com.Web.Api.Filters;
using System.Web.Http;

namespace Orders.com.Web.Api
{
    public static class WebApiConfig
    {
        public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services
            GlobalConfiguration.Configuration.DependencyResolver = new NinjectResolver(NinjectWebCommon.CreateKernel());

            // Web API routes
            config.MapHttpAttributeRoutes();

            config.Routes.MapHttpRoute(
                name: "children",
                routeTemplate: "api/{controller}/{id}/{action}",
                defaults: new { id = RouteParameter.Optional }
            );

            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
            );
        }
    }
}

Add route to support children

Add route to support children


// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// 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 Microsoft.Azure.Commands.HDInsight.Commands;
using Microsoft.Azure.Management.HDInsight.Models;
using System.Management.Automation;

namespace Microsoft.Azure.Commands.HDInsight
{
    [Cmdlet(
        VerbsCommon.Get,
        Constants.CommandNames.AzureHDInsightProperties),
    OutputType(
        typeof(CapabilitiesResponse))]
    public class GetAzureHDInsightPropertiesCommand : HDInsightCmdletBase
    {
        #region Input Parameter Definitions

        [Parameter(
            Position = 0,
            Mandatory = true,
            HelpMessage = "Gets or sets the datacenter location for the cluster.")]
        public string Location { get; set; }

        #endregion

        public override void ExecuteCmdlet()
        {
            var result = HDInsightManagementClient.GetCapabilities(Location);

            WriteObject(result);
        }
    }
}

// ----------------------------------------------------------------------------------
//
// Copyright Microsoft Corporation
// 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 Microsoft.Azure.Commands.HDInsight.Commands;
using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
using Microsoft.Azure.Management.HDInsight.Models;
using System.Management.Automation;

namespace Microsoft.Azure.Commands.HDInsight
{
    [Cmdlet(
        VerbsCommon.Get,
        Constants.CommandNames.AzureHDInsightProperties),
    OutputType(
        typeof(CapabilitiesResponse))]
    public class GetAzureHDInsightPropertiesCommand : HDInsightCmdletBase
    {
        #region Input Parameter Definitions

        [Parameter(
            Position = 0,
            Mandatory = true,
            HelpMessage = "Gets or sets the datacenter location for the cluster.")]
        [LocationCompleter("Microsoft.HDInsight/locations/capabilities")]
        public string Location { get; set; }

        #endregion

        public override void ExecuteCmdlet()
        {
            var result = HDInsightManagementClient.GetCapabilities(Location);

            WriteObject(result);
        }
    }
}

Add LocationCompleter to HDInsight cmdlets


using System;
using System.Threading;
using System.Net;
using System.Net.Sockets;
using System.Text.RegularExpressions;
using System.Text;
using transf.Log;

namespace transf
{
	class Program
	{
		/// <summary>
		/// Prompts for a nickname until a valid nickname is found.
		/// </summary>
		/// <returns>The valid nickname retrieved from user input</returns>
		public static string GetNickname()
		{
			string prompt = "Type a nickname (4-16 chars, alphanum only): ";
			string nickname = "";
			do
			{
				Console.Write (prompt);
				nickname = Console.ReadLine();
			} while(!Regex.IsMatch (nickname, "[a-zA-Z0-9]{4,16}"));
			return nickname;
		}

		public static void Main (string[] args)
		{
			// This should be the first thing that's done
			Logger.Instance = new Logger (Console.Out);
			Logger.Instance.LogLevel = LogLevel.Verbose; // up the verbosity

			const int PORT = 44444;
			string nickname = GetNickname ();
			Logger.WriteDebug (Logger.GROUP_APP, "Using nickname {0}", nickname);

			DiscoveryWorker discWorker = new DiscoveryWorker ();
			discWorker.Start (PORT, nickname);
			discWorker.Join ();
		}
	}
}

using System;
using System.Threading;
using System.Net;
using System.Net.Sockets;
using System.Text.RegularExpressions;
using System.Text;
using transf.Log;

namespace transf
{
	class Program
	{
		/// <summary>
		/// Prompts for a nickname until a valid nickname is found.
		/// </summary>
		/// <returns>The valid nickname retrieved from user input</returns>
		public static string GetNickname()
		{
			string prompt = "Type a nickname (4-16 chars, alphanum only): ";
			string nickname = "";
			do
			{
				Console.Write (prompt);
				nickname = Console.ReadLine();
			} while(!Regex.IsMatch (nickname, "[a-zA-Z0-9]{4,16}"));
			return nickname;
		}

		public static void Main (string[] args)
		{
			// This should be the first thing that's done
			Logger.Instance = new Logger (Console.Out);
			Logger.Instance.LogLevel = LogLevel.Verbose; // up the verbosity

			const int PORT = 44444;
			string nickname = GetNickname ();
			Logger.WriteDebug (Logger.GROUP_APP, "Using nickname {0}", nickname);

            // Start a discovery worker and message worker
            MessageWorker msgWorker = MessageWorker.Instance;
            msgWorker.Start(PORT);
			DiscoveryWorker discWorker = new DiscoveryWorker ();
			discWorker.Start (PORT, nickname);
			discWorker.Join ();
		}
	}
}

Add messageworker start to main()

Add messageworker start to main()


using Gtk;
using NLog;
using SlimeSimulation.Controller.WindowController.Templates;

namespace SlimeSimulation.View.WindowComponent.SimulationControlComponent
{
    internal class GrowthPhaseControlBox : AbstractSimulationControlBox
    {
        private static readonly Logger Logger = LogManager.GetCurrentClassLogger();

        public GrowthPhaseControlBox(SimulationStepAbstractWindowController simulationStepAbstractWindowController, Window parentWindow)
        {
            AddControls(simulationStepAbstractWindowController, parentWindow);
        }

        private void AddControls(SimulationStepAbstractWindowController simulationStepAbstractWindowController, Window parentWindow)
        {
            Add(new SimulationStepButton(simulationStepAbstractWindowController, parentWindow));
            Add(new SimulationStepUntilFullyGrownComponent(simulationStepAbstractWindowController, parentWindow));
        }
    }
}

using Gtk;
using NLog;
using SlimeSimulation.Controller.WindowController.Templates;

namespace SlimeSimulation.View.WindowComponent.SimulationControlComponent
{
    internal class GrowthPhaseControlBox : AbstractSimulationControlBox
    {
        private static readonly Logger Logger = LogManager.GetCurrentClassLogger();

        public GrowthPhaseControlBox(SimulationStepAbstractWindowController simulationStepAbstractWindowController, Window parentWindow)
        {
            AddControls(simulationStepAbstractWindowController, parentWindow);
        }

        private void AddControls(SimulationStepAbstractWindowController simulationStepAbstractWindowController, Window parentWindow)
        {
            Add(new SimulationStepButton(simulationStepAbstractWindowController, parentWindow));
            Add(new SimulationStepUntilFullyGrownComponent(simulationStepAbstractWindowController, parentWindow));
            Add(new SimulationSaveComponent(simulationStepAbstractWindowController.SimulationController, parentWindow));
        }
    }
}

Allow for saving of simulations before the slime has fully expanded


@model IPagedList<MMLibrarySystem.Models.BookListController.BookListItem>

@{
    ViewBag.Title = "Book List";
}

@using (Ajax.BeginForm(new AjaxOptions()
{
    HttpMethod = "GET",
    InsertionMode = InsertionMode.Replace,
    UpdateTargetId = "bookListContainer"
}))
{
    <fieldset style="border:1px solid black;padding: 1em">
        <legend style="display: inline" >Filter</legend>
        Book name or description: <input type="search" name="searchTerm" />
        Show books in library @Html.CheckBox("showInLibrary")
    </fieldset>
    <input type="submit" value="Search by name or description" />
}

@Html.Partial("_BookList", Model)

@model IPagedList<MMLibrarySystem.Models.BookListController.BookListItem>

@{
    ViewBag.Title = "Book List";
}

@using (Ajax.BeginForm(new AjaxOptions()
{
    HttpMethod = "GET",
    InsertionMode = InsertionMode.Replace,
    UpdateTargetId = "bookListContainer"
}))
{
    <fieldset style="border:1px solid black;padding: 1em">
        <legend style="display: inline">Filter</legend>
        Book name or description: <input type="search" name="searchTerm" />
        Show books in library @Html.CheckBox("showInLibrary")
    </fieldset>
    <input type="submit" value="Search by name or description" />
}

@Html.Partial("_BookList", Model)

Add check box for show in library or not


using System.Diagnostics;

namespace GOALWorker
{
    public static class LightNotifier
    {
        //TODO: Jared Implement call to each light here for their team
        public static void NotifyLightsForTeam(string teamname)
        {
            Trace.TraceInformation("GOALWorker is Sending Light Request for {0}", teamname);
        }
    }
}

using System.Diagnostics;
using System.Net;
using System.Text;
using System.IO;

namespace GOALWorker
{
    public static class LightNotifier
    {
        //TODO: Jared Implement call to each light here for their team
        public static void NotifyLightsForTeam(string teamname)
        {
            Trace.TraceInformation("GOALWorker is Sending Light Request for {0}", teamname);

            WebRequest request = WebRequest.Create("https://api.spark.io/v1/devices/DEVICEID/score");

            request.Method = "POST";

            string postData = "access_token=ACCESSTOKEN&params=0%2C255%2C0";

            byte[] byteArray = Encoding.UTF8.GetBytes(postData);

            request.ContentType = "application/x-www-form-urlencoded";
            // Set the ContentLength property of the WebRequest.
            // Set the ContentLength property of the WebRequest.
            request.ContentLength = byteArray.Length;
            // Get the request stream.
            Stream dataStream = request.GetRequestStream();
            // Write the data to the request stream.
            dataStream.Write(byteArray, 0, byteArray.Length);
            // Close the Stream object.
            dataStream.Close();
            // Get the response.
           request.GetResponse();

        }
    }
}

Send a POST to light up the HockeyGoalLight


@model Tigwi.UI.Models.IAccountModel

@{
    ViewBag.Title = "ShowAccount";
}

@section LeftInfos
{

Oh Hai @Model.Name

        @if(User.Identity.IsAuthenticated)
        {
            @Html.Partial("_FollowPerson", Model)
            @Html.Partial("_AccountFollowedPublicLists", Model)
        }
}

@Html.Partial("_ViewPostList", Model.PersonalList.PostsAfter(DateTime.MinValue, 10))

@model Tigwi.UI.Models.IAccountModel

@{
    ViewBag.Title = "ShowAccount";
}

@section LeftInfos
{

@Model.Name

@Model.Description

        @if(User.Identity.IsAuthenticated)
        {
            @Html.Partial("_FollowPerson", Model)
            @Html.Partial("_AccountFollowedPublicLists", Model)
        }
}

@Html.Partial("_ViewPostList", Model.PersonalList.PostsAfter(DateTime.MinValue, 10))

Remove error in case the searchString is empty


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

namespace PublicHolidays.Test
{
    [TestClass]
    public class PublicHolidaysApiTest
    {
        [TestMethod]
        public void TestGet()
        {
            var holidays = JpPublicHolidays.PublicHolidays.Get().Result;
            Assert.IsTrue(holidays.Length >= 20);

            var day = holidays.FirstOrDefault(x => x.Date == new DateTime(DateTime.Now.Year, 1, 1));
            Assert.IsNotNull(day);
            Assert.AreEqual(day.Name, "元日");
        }
    }
}

using System;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace PublicHolidays.Test
{
    [TestClass]
    public class PublicHolidaysApiTest
    {
        [TestMethod]
        public async Task TestGet()
        {
            var holidays = await JpPublicHolidays.PublicHolidays.Get();
            Assert.IsTrue(holidays.Length >= 20);

            var day = holidays.FirstOrDefault(x => x.Date == new DateTime(DateTime.Now.Year, 1, 1));
            Assert.IsNotNull(day);
            Assert.AreEqual(day.Name, "元日");
        }
    }
}

Change test method to async

Change test method to async


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using PKMDS_CS;

namespace PKMDS_Save_Editor
{
    public partial class frmMain : Form
    {
        public frmMain()
        {
            InitializeComponent();
        }

        private void loadSaveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // Test to make sure the dependencies are working correctly
            //this.Text = PKMDS.GetPKMName(4, 9, "F:\\Dropbox\\PKMDS Databases\\veekun-pokedex.sqlite");
        }
    }
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using PKMDS_CS;

namespace PKMDS_Save_Editor
{
    public partial class frmMain : Form
    {
        public frmMain()
        {
            InitializeComponent();
        }

        private void loadSaveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // Test to make sure the dependencies are working correctly
            PKMDS.OpenDB("F:\\Dropbox\\PKMDS Databases\\veekun-pokedex.sqlite");
            this.Text = PKMDS.GetPKMName(4, 9);
            PKMDS.CloseDB();
        }
    }
}

Rework the way DB access is done

Rework the way DB access is done


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

namespace Promact.Trappist.Repository.Questions
{
    public class QuestionRepository : IQuestionRespository
    {
        private readonly TrappistDbContext _dbContext;
        public QuestionRepository(TrappistDbContext dbContext)
        {
            _dbContext = dbContext;
        }

        /// <summary>
        /// Get all questions
        /// </summary>
        /// <returns>Question list</returns>
        public List<SingleMultipleAnswerQuestion> GetAllQuestions()
        {
            var question = _dbContext.SingleMultipleAnswerQuestion.ToList();
            return question;
        }
        /// <summary>
        /// Add single multiple answer question into model
        /// </summary>
        /// <param name="singleMultipleAnswerQuestion"></param>
        /// <param name="singleMultipleAnswerQuestionOption"></param>
        public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion, SingleMultipleAnswerQuestionOption[] singleMultipleAnswerQuestionOption)
        {
            _dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion);
            foreach(SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOptionElement in singleMultipleAnswerQuestionOption)
            {
                singleMultipleAnswerQuestionOptionElement.SingleMultipleAnswerQuestionID = singleMultipleAnswerQuestion.Id;
                _dbContext.SingleMultipleAnswerQuestionOption.Add(singleMultipleAnswerQuestionOptionElement);
            }
            _dbContext.SaveChanges();
        }
    }
}

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

namespace Promact.Trappist.Repository.Questions
{
    public class QuestionRepository : IQuestionRespository
    {
        private readonly TrappistDbContext _dbContext;
        public QuestionRepository(TrappistDbContext dbContext)
        {
            _dbContext = dbContext;
        }

        /// <summary>
        /// Get all questions
        /// </summary>
        /// <returns>Question list</returns>
        public List<SingleMultipleAnswerQuestion> GetAllQuestions()
        {
            var question = _dbContext.SingleMultipleAnswerQuestion.ToList();
            return question;
        }
        /// <summary>
        /// Add single multiple answer question into model
        /// </summary>
        /// <param name="singleMultipleAnswerQuestion"></param>
        /// <param name="singleMultipleAnswerQuestionOption"></param>
        public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion, SingleMultipleAnswerQuestionOption[] singleMultipleAnswerQuestionOption)
        {
            _dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion);
            foreach(SingleMultipleAnswerQuestionOption singleMultipleAnswerQuestionOptionElement in singleMultipleAnswerQuestionOption)
            {
                singleMultipleAnswerQuestionOptionElement.SingleMultipleAnswerQuestionID = singleMultipleAnswerQuestion.Id;
                _dbContext.SingleMultipleAnswerQuestionOption.Add(singleMultipleAnswerQuestionOptionElement);
            }
            _dbContext.SaveChanges();
        }
        /// <summary>
        /// Adding single multiple answer question into SingleMultipleAnswerQuestion model
        /// </summary>
        /// <param name="singleMultipleAnswerQuestion"></param>
        public void AddSingleMultipleAnswerQuestion(SingleMultipleAnswerQuestion singleMultipleAnswerQuestion)
        {
            _dbContext.SingleMultipleAnswerQuestion.Add(singleMultipleAnswerQuestion);
            _dbContext.SaveChanges();
        }

    }
}

Create server side API for single multiple answer question


public class BuildVersion
{
    public GitVersion GitVersion { get; private set; }
    public string Version { get; private set; }
    public string Milestone { get; private set; }
    public string SemVersion { get; private set; }
    public string GemVersion { get; private set; }
    public string VsixVersion { get; private set; }

    public static BuildVersion Calculate(ICakeContext context, BuildParameters parameters, GitVersion gitVersion)
    {
        var version = gitVersion.MajorMinorPatch;
        var semVersion = gitVersion.LegacySemVer;
        var vsixVersion = gitVersion.MajorMinorPatch;

        if (!string.IsNullOrWhiteSpace(gitVersion.BuildMetaData)) {
            semVersion += "-" + gitVersion.BuildMetaData;
            vsixVersion += "." + DateTime.UtcNow.ToString("yyMMddHH");
        }

        return new BuildVersion
        {
            GitVersion = gitVersion,
            Milestone  = version,
            Version    = version,
            SemVersion = semVersion,
            GemVersion = semVersion.Replace("-", "."),
            VsixVersion = vsixVersion,
        };
    }
}

public class BuildVersion
{
    public GitVersion GitVersion { get; private set; }
    public string Version { get; private set; }
    public string Milestone { get; private set; }
    public string SemVersion { get; private set; }
    public string GemVersion { get; private set; }
    public string VsixVersion { get; private set; }

    public static BuildVersion Calculate(ICakeContext context, BuildParameters parameters, GitVersion gitVersion)
    {
        var version = gitVersion.MajorMinorPatch;
        var semVersion = gitVersion.LegacySemVer;
        var vsixVersion = gitVersion.MajorMinorPatch;

        if (!string.IsNullOrWhiteSpace(gitVersion.BuildMetaData)) {
            semVersion += "." + gitVersion.BuildMetaData;
            vsixVersion += "." + DateTime.UtcNow.ToString("yyMMddHH");
        }

        return new BuildVersion
        {
            GitVersion = gitVersion,
            Milestone  = version,
            Version    = version,
            SemVersion = semVersion,
            GemVersion = semVersion.Replace("-", "."),
            VsixVersion = vsixVersion,
        };
    }
}

Use dot instead of dash to separate build metadata


@model string

    <form action="/" method="POST">

                    Ask me
                    <input id="query" name="query" class="input-xlarge" placeholder="What is the meaing of life?" type="text">

        <button id="submit" type="submit" class="btn btn-inverse btn-large">Ask the psychic dangerzone</button>
    </form>

Welcome to the dangerzone

@Model

@model string

    <form action="/" method="POST">

                    Ask me
                    <input id="query" name="query" class="input-xlarge" placeholder="What is the meaing of life?" type="text">

        <button id="submit" type="submit" class="btn btn-danger btn-large">Ask the psychic dangerzone</button>
    </form>
    @if (!string.IsNullOrEmpty(Model))
    {

Welcome to the dangerzone

@Model

    }

Hide results until results are available


using System;

namespace WpfMath.Utils
{
    internal static class Result
    {
        public static Result<TValue> Ok<TValue>(TValue value) => new Result<TValue>(value, null);
        public static Result<TValue> Error<TValue>(Exception error) => new Result<TValue>(default, error);
    }

    internal readonly struct Result<TValue>
    {
        private readonly TValue value;

        public TValue Value => this.Error == null ? this.value : throw this.Error;
        public Exception Error { get; }

        public bool IsSuccess => this.Error == null;

        public Result(TValue value, Exception error)
        {
            if (!Equals(value, default) && error != null)
            {
                throw new ArgumentException(nameof(error), $"Invalid {nameof(Result)} constructor call");
            }

            this.value = value;
            this.Error = error;
        }

        public Result<TProduct> Map<TProduct>(Func<TValue, TProduct> mapper) => this.IsSuccess
            ? Result.Ok(mapper(this.Value))
            : Result.Error<TProduct>(this.Error);
    }
}

using System;

namespace WpfMath.Utils
{
    internal static class Result
    {
        public static Result<TValue> Ok<TValue>(TValue value) => new Result<TValue>(value, null);
        public static Result<TValue> Error<TValue>(Exception error) => new Result<TValue>(default, error);
    }

    internal readonly struct Result<TValue>
    {
        private readonly TValue value;

        public TValue Value => this.Error == null ? this.value : throw this.Error;
        public Exception Error { get; }

        public bool IsSuccess => this.Error == null;

        public Result(TValue value, Exception error)
        {
            if (!Equals(value, default) && error != null)
            {
                throw new ArgumentException($"Invalid {nameof(Result)} constructor call", nameof(error));
            }

            this.value = value;
            this.Error = error;
        }

        public Result<TProduct> Map<TProduct>(Func<TValue, TProduct> mapper) => this.IsSuccess
            ? Result.Ok(mapper(this.Value))
            : Result.Error<TProduct>(this.Error);
    }
}

Fix parameter order in ArgumentException constructor


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

using osu.Framework.Graphics;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osuTK;

namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
{
    public class SliderSelectionBlueprint : OsuSelectionBlueprint<Slider>
    {
        protected readonly SliderBodyPiece BodyPiece;
        protected readonly SliderCircleSelectionBlueprint HeadBlueprint;
        protected readonly SliderCircleSelectionBlueprint TailBlueprint;

        public SliderSelectionBlueprint(DrawableSlider slider)
            : base(slider)
        {
            var sliderObject = (Slider)slider.HitObject;

            InternalChildren = new Drawable[]
            {
                BodyPiece = new SliderBodyPiece(),
                HeadBlueprint = CreateCircleSelectionBlueprint(slider, SliderPosition.Start),
                TailBlueprint = CreateCircleSelectionBlueprint(slider, SliderPosition.End),
                new PathControlPointVisualiser(sliderObject),
            };
        }

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

            BodyPiece.UpdateFrom(HitObject);
        }

        public override Vector2 SelectionPoint => HeadBlueprint.SelectionPoint;

        protected virtual SliderCircleSelectionBlueprint CreateCircleSelectionBlueprint(DrawableSlider slider, SliderPosition position) => new SliderCircleSelectionBlueprint(slider, position);
    }
}

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

using osu.Framework.Graphics;
using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osuTK;

namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
{
    public class SliderSelectionBlueprint : OsuSelectionBlueprint<Slider>
    {
        protected readonly SliderBodyPiece BodyPiece;
        protected readonly SliderCircleSelectionBlueprint HeadBlueprint;
        protected readonly SliderCircleSelectionBlueprint TailBlueprint;

        public SliderSelectionBlueprint(DrawableSlider slider)
            : base(slider)
        {
            var sliderObject = (Slider)slider.HitObject;

            InternalChildren = new Drawable[]
            {
                BodyPiece = new SliderBodyPiece(),
                HeadBlueprint = CreateCircleSelectionBlueprint(slider, SliderPosition.Start),
                TailBlueprint = CreateCircleSelectionBlueprint(slider, SliderPosition.End),
                new PathControlPointVisualiser(sliderObject),
            };
        }

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

            BodyPiece.UpdateFrom(HitObject);
        }

        public override Vector2 SelectionPoint => HeadBlueprint.SelectionPoint;

        public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => BodyPiece.ReceivePositionalInputAt(screenSpacePos);

        protected virtual SliderCircleSelectionBlueprint CreateCircleSelectionBlueprint(DrawableSlider slider, SliderPosition position) => new SliderCircleSelectionBlueprint(slider, position);
    }
}

Fix not being able to drag non-snaked sliders


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

#nullable disable

using System;
using NUnit.Framework;
using osu.Framework.Graphics.Containers;
using osu.Framework.Tests.Visual;

namespace osu.Framework.Tests.Containers
{
    public class TestSceneEnumeratorVersion : FrameworkTestScene
    {
        private Container parent;

        [SetUp]
        public void SetUp() => Schedule(() =>
        {
            Child = parent = new Container
            {
                Child = new Container()
            };
        });

        [Test]
        public void TestEnumeratingNormally()
        {
            AddStep("iterate through parent doing nothing", () => Assert.DoesNotThrow(() =>
            {
                foreach (var child in parent)
                {
                }
            }));
        }

        [Test]
        public void TestAddChildDuringEnumerationFails()
        {
            AddStep("adding child during enumeration fails", () => Assert.Throws<InvalidOperationException>(() =>
            {
                foreach (var child in parent)
                {
                    parent.Add(new Container());
                }
            }));
        }

        [Test]
        public void TestRemoveChildDuringEnumerationFails()
        {
            AddStep("removing child during enumeration fails", () => Assert.Throws<InvalidOperationException>(() =>
            {
                foreach (var child in parent)
                {
                    parent.Remove(child, true);
                }
            }));
        }

        [Test]
        public void TestClearDuringEnumerationFails()
        {
            AddStep("clearing children during enumeration fails", () => Assert.Throws<InvalidOperationException>(() =>
            {
                foreach (var child in parent)
                {
                    parent.Clear();
                }
            }));
        }
    }
}

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

#nullable disable

using System;
using NUnit.Framework;
using osu.Framework.Graphics.Containers;
using osu.Framework.Tests.Visual;

namespace osu.Framework.Tests.Containers
{
    public class TestSceneEnumeratorVersion : FrameworkTestScene
    {
        private Container parent;

        [SetUp]
        public void SetUp() => Schedule(() =>
        {
            Child = parent = new Container
            {
                Child = new Container()
            };
        });

        [Test]
        public void TestEnumeratingNormally()
        {
            AddStep("iterate through parent doing nothing", () => Assert.DoesNotThrow(() =>
            {
                foreach (var _ in parent)
                {
                }
            }));
        }

        [Test]
        public void TestAddChildDuringEnumerationFails()
        {
            AddStep("adding child during enumeration fails", () => Assert.Throws<InvalidOperationException>(() =>
            {
                foreach (var _ in parent)
                {
                    parent.Add(new Container());
                }
            }));
        }

        [Test]
        public void TestRemoveChildDuringEnumerationFails()
        {
            AddStep("removing child during enumeration fails", () => Assert.Throws<InvalidOperationException>(() =>
            {
                foreach (var child in parent)
                {
                    parent.Remove(child, true);
                }
            }));
        }

        [Test]
        public void TestClearDuringEnumerationFails()
        {
            AddStep("clearing children during enumeration fails", () => Assert.Throws<InvalidOperationException>(() =>
            {
                foreach (var _ in parent)
                {
                    parent.Clear();
                }
            }));
        }
    }
}

Use discards to fix CI complaints

Use discards to fix CI complaints


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

namespace Nuke.Common.Utilities
{
    public static partial class StringExtensions
    {
        private static readonly string[] KnownWords =
        {
            "DotNet",
            "GitHub",
            "GitVersion",
            "MSBuild",
            "NuGet",
            "ReSharper",
            "AppVeyor",
            "TeamCity",
            "GitLab"
        };
    }
}

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

namespace Nuke.Common.Utilities
{
    public static partial class StringExtensions
    {
        private static readonly string[] KnownWords =
        {
            "DotNet",
            "GitHub",
            "GitVersion",
            "MSBuild",
            "NuGet",
            "ReSharper",
            "AppVeyor",
            "TeamCity",
            "GitLab",
            "SignPath"
        };
    }
}

Add SignPath to known words

Add SignPath to known words


/*
** Project ShiftDrive
** (C) Mika Molenkamp, 2016.
*/

using Microsoft.Xna.Framework;

namespace ShiftDrive {

    /// <summary>
    /// A <seealso cref="GameObject"/> representing a single asteroid.
    /// </summary>
    internal sealed class Asteroid : GameObject {

        public Asteroid() {
            type = ObjectType.Asteroid;
            facing = Utils.RNG.Next(0, 360);
            spritename = "map/asteroid";
            color = Color.White;
            bounding = 7f;
        }

        public override void Update(GameState world, float deltaTime) {
            base.Update(world, deltaTime);
        }

        protected override void OnCollision(GameObject other, Vector2 normal, float penetration) {
            base.OnCollision(other, normal, penetration);

            // asteroids shouldn't move so much if ships bump into them, because
            // they should look heavy and sluggish
            if (other.type == ObjectType.AIShip || other.type == ObjectType.PlayerShip)
                this.velocity *= 0.8f;
        }

        public override bool IsTerrain() {
            return true;
        }

    }

}

/*
** Project ShiftDrive
** (C) Mika Molenkamp, 2016.
*/

using System;
using Microsoft.Xna.Framework;

namespace ShiftDrive {

    /// <summary>
    /// A <seealso cref="GameObject"/> representing a single asteroid.
    /// </summary>
    internal sealed class Asteroid : GameObject {

        private float angularVelocity;

        public Asteroid() {
            type = ObjectType.Asteroid;
            facing = Utils.RNG.Next(0, 360);
            spritename = "map/asteroid";
            color = Color.White;
            bounding = 7f;
        }

        public override void Update(GameState world, float deltaTime) {
            base.Update(world, deltaTime);

            facing += angularVelocity * deltaTime;
            angularVelocity *= (float)Math.Pow(0.8f, deltaTime);
        }

        protected override void OnCollision(GameObject other, Vector2 normal, float penetration) {
            base.OnCollision(other, normal, penetration);

            // spin around!
            angularVelocity += (1f + penetration * 4f) * (float)(Utils.RNG.NextDouble() * 2.0 - 1.0);

            // asteroids shouldn't move so much if ships bump into them, because
            // they should look heavy and sluggish
            if (other.type == ObjectType.AIShip || other.type == ObjectType.PlayerShip)
                this.velocity *= 0.8f;
        }

        public override bool IsTerrain() {
            return true;
        }

    }

}

Apply angular velocity to asteroids

Apply angular velocity to asteroids

... when they bump into something, to make the scene feel a little bit
more alive


using System;
using System.IO;
using System.Text;
using Microsoft.Azure.Jobs.Host.Bindings;
using Microsoft.ServiceBus.Messaging;

namespace Microsoft.Azure.Jobs.ServiceBus.Triggers
{
    internal class BrokeredMessageValueProvider : IValueProvider
    {
        private readonly object _value;
        private readonly Type _valueType;
        private readonly string _invokeString;

        public BrokeredMessageValueProvider(BrokeredMessage clone, object value, Type valueType)
        {
            if (value != null && !valueType.IsAssignableFrom(value.GetType()))
            {
                throw new InvalidOperationException("value is not of the correct type.");
            }

            _value = value;
            _valueType = valueType;
            _invokeString = CreateInvokeString(clone);
        }

        public Type Type
        {
            get { return _valueType; }
        }

        public object GetValue()
        {
            return _value;
        }

        public string ToInvokeString()
        {
            return _invokeString;
        }

        private static string CreateInvokeString(BrokeredMessage message)
        {
            using (MemoryStream outputStream = new MemoryStream())
            {
                using (Stream inputStream = message.GetBody<Stream>())
                {
                    if (inputStream == null)
                    {
                        return null;
                    }

                    inputStream.CopyTo(outputStream);

                    try
                    {
                        return StrictEncodings.Utf8.GetString(outputStream.ToArray());
                    }
                    catch (DecoderFallbackException)
                    {
                        return "byte[" + message.Size + "]";
                    }
                }
            }
        }
    }
}

using System;
using System.IO;
using System.Text;
using Microsoft.Azure.Jobs.Host.Bindings;
using Microsoft.ServiceBus.Messaging;

namespace Microsoft.Azure.Jobs.ServiceBus.Triggers
{
    internal class BrokeredMessageValueProvider : IValueProvider
    {
        private readonly object _value;
        private readonly Type _valueType;
        private readonly string _invokeString;

        public BrokeredMessageValueProvider(BrokeredMessage clone, object value, Type valueType)
        {
            if (value != null && !valueType.IsAssignableFrom(value.GetType()))
            {
                throw new InvalidOperationException("value is not of the correct type.");
            }

            _value = value;
            _valueType = valueType;
            _invokeString = CreateInvokeString(clone);
        }

        public Type Type
        {
            get { return _valueType; }
        }

        public object GetValue()
        {
            return _value;
        }

        public string ToInvokeString()
        {
            return _invokeString;
        }

        private static string CreateInvokeString(BrokeredMessage message)
        {
            using (MemoryStream outputStream = new MemoryStream())
            {
                using (Stream inputStream = message.GetBody<Stream>())
                {
                    if (inputStream == null)
                    {
                        return null;
                    }

                    inputStream.CopyTo(outputStream);
                    byte[] bytes = outputStream.ToArray();

                    try
                    {
                        return StrictEncodings.Utf8.GetString(bytes);
                    }
                    catch (DecoderFallbackException)
                    {
                        return "byte[" + bytes.Length + "]";
                    }
                }
            }
        }
    }
}

Use body length for Service Bus binary messages.


namespace TraktApiSharp.Objects.Get.Shows
{
    using Basic;
    using Newtonsoft.Json;

    /// <summary>
    /// A collection of images for a Trakt show.
    /// </summary>
    public class TraktShowImages
    {
        /// <summary>
        /// A fanart image set for various sizes.
        /// </summary>
        [JsonProperty(PropertyName = "fanart")]
        public TraktImageSet FanArt { get; set; }

        /// <summary>
        /// A poster image set for various sizes.
        /// </summary>
        [JsonProperty(PropertyName = "poster")]
        public TraktImageSet Poster { get; set; }

        /// <summary>
        /// A logo image.
        /// </summary>
        [JsonProperty(PropertyName = "logo")]
        public TraktImage Logo { get; set; }

        /// <summary>
        /// A clearart image.
        /// </summary>
        [JsonProperty(PropertyName = "clearart")]
        public TraktImage ClearArt { get; set; }

        /// <summary>
        /// A banner image.
        /// </summary>
        [JsonProperty(PropertyName = "banner")]
        public TraktImage Banner { get; set; }

        /// <summary>
        /// A thumbnail image.
        /// </summary>
        [JsonProperty(PropertyName = "thumb")]
        public TraktImage Thumb { get; set; }
    }
}

namespace TraktApiSharp.Objects.Get.Shows
{
    using Basic;
    using Newtonsoft.Json;

    /// A collection of images and image sets for a Trakt show.
    public class TraktShowImages
    {
        /// Gets or sets the fan art image set.
        [JsonProperty(PropertyName = "fanart")]
        public TraktImageSet FanArt { get; set; }

        /// Gets or sets the poster image set.
        [JsonProperty(PropertyName = "poster")]
        public TraktImageSet Poster { get; set; }

        /// Gets or sets the loge image.
        [JsonProperty(PropertyName = "logo")]
        public TraktImage Logo { get; set; }

        /// Gets or sets the clear art image.
        [JsonProperty(PropertyName = "clearart")]
        public TraktImage ClearArt { get; set; }

        /// Gets or sets the banner image.
        [JsonProperty(PropertyName = "banner")]
        public TraktImage Banner { get; set; }

        /// Gets or sets the thumb image.
        [JsonProperty(PropertyName = "thumb")]
        public TraktImage Thumb { get; set; }
    }
}

Update existing documentation for show images.


using System;

public class Hangman {
  public static void Main(string[] args) {
    Console.WriteLine("Hello, World!");
    Console.WriteLine("You entered the following {0} command line arguments:",
         args.Length );
    for (int i=0; i < args.Length; i++) {
      Console.WriteLine("{0}", args[i]);
    }
  }
}

using System;
using Table;

public class Hangman {
  public static void Main(string[] args) {
    Console.WriteLine("Hello, World!");
    Console.WriteLine("You entered the following {0} command line arguments:",
         args.Length );
    for (int i=0; i < args.Length; i++) {
      Console.WriteLine("{0}", args[i]);
    }
  }
}

Include the Table namespace into Hangman


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

namespace PhotoLife.Services
{
    class VotingService
    {
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using PhotoLife.Data.Contracts;
using PhotoLife.Factories;
using PhotoLife.Models;
using PhotoLife.Services.Contracts;

namespace PhotoLife.Services
{
    public class VotingService
    {
        private readonly IRepository<Vote> voteRepository;
        private readonly IUnitOfWork unitOfWork;
        private readonly IVoteFactory voteFactory;
        private readonly IPostService postService;

        public VotingService(IRepository<Vote> voteRepository, IUnitOfWork unitOfWork, IVoteFactory voteFactory, IPostService postService)
        {
            if (voteRepository == null)
            {
                throw new ArgumentNullException(nameof(voteRepository));
            }

            if (unitOfWork == null)
            {
                throw new ArgumentNullException(nameof(unitOfWork));
            }

            if (postService == null)
            {
                throw new ArgumentNullException(nameof(postService));
            }

            if (voteFactory == null)
            {
                throw new ArgumentNullException(nameof(voteFactory));
            }

            this.voteRepository = voteRepository;
            this.unitOfWork = unitOfWork;
            this.postService = postService;
            this.voteFactory = voteFactory;
        }

        public int Vote(int postId, string userId)
        {
            var userVoteOnLog = this.voteRepository
                .GetAll
                .FirstOrDefault(v => v.PostId.Equals(postId) && v.UserId.Equals(userId));

            var notVoted = (userVoteOnLog == null);

            if (notVoted)
            {
                var log = this.postService.GetPostById(postId);

                if (log != null)
                {
                    var vote = this.voteFactory.CreateVote(postId, userId);

                    this.voteRepository.Add(vote);
                    this.unitOfWork.Commit();

                    return log.Votes.Count;
                }
            }

            return -1;
        }
    }
}

Add vote method to voting service

Add vote method to voting service


using System.Reflection;
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("PogoLocationFeeder")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PogoLocationFeeder")]
[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("76f6eeef-e89f-4e43-aa9d-1567cbc1420b")]

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

[assembly: AssemblyVersion("0.1.3.0")]
[assembly: AssemblyFileVersion("0.1.3.0")]

using System.Reflection;
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("PogoLocationFeeder")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PogoLocationFeeder")]
[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("76f6eeef-e89f-4e43-aa9d-1567cbc1420b")]

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

[assembly: AssemblyVersion("0.1.4.0")]
[assembly: AssemblyFileVersion("0.1.4.0")]

Increment version 0.1.3 -> 0.1.4

Increment version 0.1.3 -> 0.1.4


using System;
using System.Linq;
using Microsoft.Build.Evaluation;
using NuGet.Extensions.MSBuild;
using NuGet.Extensions.Tests.TestData;
using NUnit.Framework;

namespace NuGet.Extensions.Tests.MSBuild
{
    [TestFixture]
    public class ProjectAdapterTests
    {
        [Test]
        public void ProjectWithDependenciesAssemblyNameIsProjectWithDependencies()
        {
            var projectAdapter = CreateProjectAdapter(Paths.ProjectWithDependencies);
            Assert.That(projectAdapter.AssemblyName, Is.EqualTo("ProjectWithDependencies"));
        }

        [Test]
        public void ProjectWithDependenciesDependsOnNewtonsoftJson()
        {
            var projectAdapter = CreateProjectAdapter(Paths.ProjectWithDependencies);

            var binaryReferences = projectAdapter.GetBinaryReferences();

            var binaryReferenceIncludeNames = binaryReferences.Select(r => r.IncludeName).ToList();
            Assert.That(binaryReferenceIncludeNames, Contains.Item("Newtonsoft.Json"));
        }

        private static ProjectAdapter CreateProjectAdapter(string projectWithDependencies)
        {
            var msBuildProject = new Project(projectWithDependencies, null, null);
            var projectAdapter = new ProjectAdapter(msBuildProject, "packages.config");
            return projectAdapter;
        }
    }
}

using System;
using System.Linq;
using Microsoft.Build.Evaluation;
using NuGet.Extensions.MSBuild;
using NuGet.Extensions.Tests.TestData;
using NUnit.Framework;

namespace NuGet.Extensions.Tests.MSBuild
{
    [TestFixture]
    public class ProjectAdapterTests
    {
        private const string _expectedBinaryDependencyAssemblyName = "Newtonsoft.Json";
        private const string _expectedBinaryDependencyVersion = "6.0.0.0";

        [Test]
        public void ProjectWithDependenciesAssemblyNameIsProjectWithDependencies()
        {
            var projectAdapter = CreateProjectAdapter(Paths.ProjectWithDependencies);
            Assert.That(projectAdapter.AssemblyName, Is.EqualTo("ProjectWithDependencies"));
        }

        [Test]
        public void ProjectWithDependenciesDependsOnNewtonsoftJson()
        {
            var projectAdapter = CreateProjectAdapter(Paths.ProjectWithDependencies);

            var binaryReferences = projectAdapter.GetBinaryReferences();

            var binaryReferenceIncludeNames = binaryReferences.Select(r => r.IncludeName).ToList();
            Assert.That(binaryReferenceIncludeNames, Contains.Item(_expectedBinaryDependencyAssemblyName));
        }

        [Test]
        public void ProjectWithDependenciesDependsOnNewtonsoftJson6000()
        {
            var projectAdapter = CreateProjectAdapter(Paths.ProjectWithDependencies);

            var binaryReferences = projectAdapter.GetBinaryReferences();

            var newtonsoft = binaryReferences.Single(r => r.IncludeName == _expectedBinaryDependencyAssemblyName);
            Assert.That(newtonsoft.IncludeVersion, Is.EqualTo(_expectedBinaryDependencyVersion));
        }

        private static ProjectAdapter CreateProjectAdapter(string projectWithDependencies)
        {
            var msBuildProject = new Project(projectWithDependencies, null, null);
            var projectAdapter = new ProjectAdapter(msBuildProject, "packages.config");
            return projectAdapter;
        }
    }
}

Test version of binary dependency

Test version of binary dependency


using System;
using System.Drawing;
using MonoMac.Foundation;
using MonoMac.AppKit;
using MonoMac.ObjCRuntime;

namespace SamplesButtonMadness
{
	public partial class AppDelegate : NSApplicationDelegate
	{
		TestWindowController mainWindowController;

		public AppDelegate ()
		{
		}

		public override void FinishedLaunching (NSObject notification)
		{
			mainWindowController = new TestWindowController ();
			mainWindowController.Window.MakeKeyAndOrderFront (this);
		}
	}
}

using System;
using System.Drawing;
using MonoMac.Foundation;
using MonoMac.AppKit;
using MonoMac.ObjCRuntime;

namespace SamplesButtonMadness
{
	public partial class AppDelegate : NSApplicationDelegate
	{
		TestWindowController mainWindowController;

		public AppDelegate ()
		{
		}

		public override void FinishedLaunching (NSObject notification)
		{
			mainWindowController = new TestWindowController ();
			mainWindowController.Window.MakeKeyAndOrderFront (this);
		}

		public override bool ApplicationShouldTerminateAfterLastWindowClosed (NSApplication sender)
		{
			return true;
		}
	}
}

Fix ButtonMadness application closes when Close button is clicked.


using System;

namespace SurveyMonkey.RequestSettings
{
    public class GetSurveyListSettings : IPagingSettings
    {
        public enum SortByOption
        {
            Title,
            DateModified,
            NumResponses
        }

        public enum SortOrderOption
        {
            ASC,
            DESC
        }

        public int? Page { get; set; }
        public int? PerPage { get; set; }
        public SortByOption? SortBy { get; set; }
        public SortOrderOption? SortOrder { get; set; }
        public DateTime? StartModifiedAt { get; set; }
        public DateTime? EndModifiedAt { get; set; }
        public string Include { get { return "response_count,date_created,date_modified,language,question_count,analyze_url,preview"; } }
    }
}

using System;

namespace SurveyMonkey.RequestSettings
{
    public class GetSurveyListSettings : IPagingSettings
    {
        public enum SortByOption
        {
            Title,
            DateModified,
            NumResponses
        }

        public enum SortOrderOption
        {
            ASC,
            DESC
        }

        public int? Page { get; set; }
        public int? PerPage { get; set; }
        public SortByOption? SortBy { get; set; }
        public SortOrderOption? SortOrder { get; set; }
        public DateTime? StartModifiedAt { get; set; }
        public DateTime? EndModifiedAt { get; set; }
        public string Title { get; set; }
        public string Include { get { return "response_count,date_created,date_modified,language,question_count,analyze_url,preview"; } }
    }
}

Allow Title to be set for searching GetSurveyList


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

using Xamarin.Forms;

namespace BabbyJotz {
    public partial class WebViewPage : ContentPage {
        public WebViewPage(string title, Func<Task<string>> htmlFunc) {
            InitializeComponent();
            Title = title;
            ((HtmlWebViewSource)webview.Source).Html = "Loading...";
            doFunc(htmlFunc);
        }

        private async void doFunc(Func<Task<string>> htmlFunc) {
            ((HtmlWebViewSource)webview.Source).Html = await htmlFunc();
        }
    }
}

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

using Xamarin.Forms;

namespace BabbyJotz {
    public partial class WebViewPage : ContentPage {
        public WebViewPage(string title, Func<Task<string>> htmlFunc) {
            InitializeComponent();
            Title = title;
            ((HtmlWebViewSource)webview.Source).Html = @"
<html>
  <head>
    <style>
      body {
        padding: 0px;
        margin: 8px;
        font-family: Helvetica;
        background-color: #333333;
        color: #ffffff;
      }
    </style>
  </head>
  <body>
    Loading...
  </body>
</html>";
            doFunc(htmlFunc);
        }

        private async void doFunc(Func<Task<string>> htmlFunc) {
            ((HtmlWebViewSource)webview.Source).Html = await htmlFunc();
        }
    }
}

Make the Loading html page look better.

Make the Loading html page look better.


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

namespace XeroApi.Model
{
    public abstract class EndpointModelBase : ModelBase
    {

    }

    public abstract class ModelBase
    {
        [XmlAttribute("status")]
        public ValidationStatus ValidationStatus
        {
            get;
            set;
        }

        public List<ValidationError> ValidationErrors
        {
            get;
            set;
        }

        public List<Warning> Warnings
        {
            get;
            set;
        }
    }

    public enum ValidationStatus
    {
        OK,
        WARNING,
        ERROR
    }

    public struct Warning
    {
        public string Message;
    }

    public struct ValidationError
    {
        public string Message;
    }
}

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

namespace XeroApi.Model
{
    public abstract class EndpointModelBase : ModelBase
    {

    }

    public abstract class ModelBase : IModelBase
    {
        [XmlAttribute("status")]
        public ValidationStatus ValidationStatus
        {
            get;
            set;
        }

        public List<ValidationError> ValidationErrors
        {
            get;
            set;
        }

        public List<Warning> Warnings
        {
            get;
            set;
        }
    }

    public interface IModelBase
    {

    }

    public enum ValidationStatus
    {
        OK,
        WARNING,
        ERROR
    }

    public struct Warning
    {
        public string Message;
    }

    public struct ValidationError
    {
        public string Message;
    }
}

Include interface to make IoC easier

Include interface to make IoC easier