// 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.Input.Bindings;
using osu.Framework.Platform.SDL2;
using SDL2;

namespace osu.Framework.Platform.MacOS
{
    public class MacOSReadableKeyCombinationProvider : SDL2ReadableKeyCombinationProvider
    {
        protected override string GetReadableKey(InputKey key)
        {
            switch (key)
            {
                case InputKey.Super:
                    return "Cmd";

                case InputKey.Alt:
                    return "Option";

                default:
                    return base.GetReadableKey(key);
            }
        }

        protected override bool TryGetNameFromKeycode(SDL.SDL_Keycode keycode, out string name)
        {
            switch (keycode)
            {
                case SDL.SDL_Keycode.SDLK_LGUI:
                    name = "LCmd";
                    return true;

                case SDL.SDL_Keycode.SDLK_RGUI:
                    name = "RCmd";
                    return true;

                case SDL.SDL_Keycode.SDLK_LALT:
                    name = "LOption";
                    return true;

                case SDL.SDL_Keycode.SDLK_RALT:
                    name = "ROption";
                    return true;

                default:
                    return base.TryGetNameFromKeycode(keycode, out name);
            }
        }
    }
}

// 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.Input.Bindings;
using osu.Framework.Platform.SDL2;
using SDL2;

namespace osu.Framework.Platform.MacOS
{
    public class MacOSReadableKeyCombinationProvider : SDL2ReadableKeyCombinationProvider
    {
        protected override string GetReadableKey(InputKey key)
        {
            switch (key)
            {
                case InputKey.Super:
                    return "Cmd";

                case InputKey.Alt:
                    return "Opt";

                default:
                    return base.GetReadableKey(key);
            }
        }

        protected override bool TryGetNameFromKeycode(SDL.SDL_Keycode keycode, out string name)
        {
            switch (keycode)
            {
                case SDL.SDL_Keycode.SDLK_LGUI:
                    name = "LCmd";
                    return true;

                case SDL.SDL_Keycode.SDLK_RGUI:
                    name = "RCmd";
                    return true;

                case SDL.SDL_Keycode.SDLK_LALT:
                    name = "LOpt";
                    return true;

                case SDL.SDL_Keycode.SDLK_RALT:
                    name = "ROpt";
                    return true;

                default:
                    return base.TryGetNameFromKeycode(keycode, out name);
            }
        }
    }
}

Rename `Option` to `Opt` in key combination output

Is as well understood as "cmd" and much shorter.


@{
    ViewBag.Title = "About";
}

@ViewBag.Title.

@ViewBag.Message

Use this area to provide additional information. Here is more groovy info.

Expand p tag on about screen.

Expand p tag on about screen.


namespace TraktApiSharp.Requests.WithoutOAuth.Shows.Common
{
    using Base.Get;
    using Enums;
    using Objects.Basic;
    using Objects.Get.Shows.Common;
    using System.Collections.Generic;

    internal class TraktShowsMostWatchedRequest : TraktGetRequest<TraktPaginationListResult<TraktMostWatchedShow>, TraktMostWatchedShow>
    {
        internal TraktShowsMostWatchedRequest(TraktClient client) : base(client) { Period = TraktPeriod.Weekly; }

        internal TraktPeriod? Period { get; set; }

        protected override IDictionary<string, object> GetUriPathParameters()
        {
            var uriParams = base.GetUriPathParameters();

            if (Period.HasValue && Period.Value != TraktPeriod.Unspecified)
                uriParams.Add("period", Period.Value.AsString());

            return uriParams;
        }

        protected override string UriTemplate => "shows/watched{/period}{?extended,page,limit}";

        protected override TraktAuthorizationRequirement AuthorizationRequirement => TraktAuthorizationRequirement.NotRequired;

        protected override bool SupportsPagination => true;

        protected override bool IsListResult => true;
    }
}

namespace TraktApiSharp.Requests.WithoutOAuth.Shows.Common
{
    using Base;
    using Base.Get;
    using Enums;
    using Objects.Basic;
    using Objects.Get.Shows.Common;
    using System.Collections.Generic;

    internal class TraktShowsMostWatchedRequest : TraktGetRequest<TraktPaginationListResult<TraktMostWatchedShow>, TraktMostWatchedShow>
    {
        internal TraktShowsMostWatchedRequest(TraktClient client) : base(client) { Period = TraktPeriod.Weekly; }

        internal TraktPeriod? Period { get; set; }

        protected override IDictionary<string, object> GetUriPathParameters()
        {
            var uriParams = base.GetUriPathParameters();

            if (Period.HasValue && Period.Value != TraktPeriod.Unspecified)
                uriParams.Add("period", Period.Value.AsString());

            return uriParams;
        }

        protected override string UriTemplate => "shows/watched{/period}{?extended,page,limit,query,years,genres,languages,countries,runtimes,ratings,certifications,networks,status}";

        protected override TraktAuthorizationRequirement AuthorizationRequirement => TraktAuthorizationRequirement.NotRequired;

        internal TraktShowFilter Filter { get; set; }

        protected override bool SupportsPagination => true;

        protected override bool IsListResult => true;
    }
}

Add filter property to most watched shows request.


using System;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Queue;
using Microsoft.Extensions.Configuration;
using System.Diagnostics;

namespace QueueGettingStarted
{
    public class Program
    {
        public static void Main(string[] args)
        {
            // configuration
            var builder = new ConfigurationBuilder()
                .AddJsonFile("./appsettings.json")
                .AddUserSecrets()
                .AddEnvironmentVariables();
            Configuration = builder.Build();
            // options
            ConfigurationBinder.Bind(Configuration.GetSection("Azure:Storage"), Options);
            Console.WriteLine("Queue encryption sample");
            Console.WriteLine($"Configuration for ConnectionString: {Options.ConnectionString}");
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(Options.ConnectionString);
            CloudQueueClient client = storageAccount.CreateCloudQueueClient();
            Debug.Assert(client != null, "Client created");
            Console.WriteLine("Client created");
            Console.WriteLine($"queue: {Options.DemoQueue}");
            Console.ReadKey();
        }

        static IConfiguration Configuration { get; set; }
        static AzureStorageOptions Options { get; set; } = new AzureStorageOptions();
    }

    class AzureStorageOptions
    {
        public string ConnectionString { get; set; }
        public string DemoQueue { get; set; }
    }
}

using System;
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Queue;
using Microsoft.Extensions.Configuration;
using System.Diagnostics;
using System.Threading.Tasks;

namespace QueueGettingStarted
{
    public class Program
    {
        public static void Main(string[] args)
        {
            AsyncTask(args)
                .ContinueWith((task) =>
                {
                    Console.WriteLine("Press any key to exit...");
                    Console.ReadKey();
                }).Wait();
        }

        public async static Task AsyncTask(string[] args)
        {
            // configuration
            var builder = new ConfigurationBuilder()
                .AddJsonFile("./appsettings.json")
                .AddUserSecrets()
                .AddEnvironmentVariables();
            Configuration = builder.Build();
            // options
            ConfigurationBinder.Bind(Configuration.GetSection("Azure:Storage"), Options);
            Console.WriteLine("Queue encryption sample");
            Console.WriteLine($"Configuration for ConnectionString: {Options.ConnectionString}");
            CloudStorageAccount storageAccount = CloudStorageAccount.Parse(Options.ConnectionString);
            CloudQueueClient client = storageAccount.CreateCloudQueueClient();
            Debug.Assert(client != null, "Client created");
            string hash = Guid.NewGuid().ToString("N");
            CloudQueue queue = client.GetQueueReference($"{Options.DemoQueue}{hash}");
            try
            {
                await queue.CreateAsync();
            }
            finally
            {
                bool deleted = await queue.DeleteIfExistsAsync();
                Console.WriteLine($"Queue deleted: {deleted}");
            }
        }

        static IConfiguration Configuration { get; set; }
        static AzureStorageOptions Options { get; set; } = new AzureStorageOptions();
    }

    class AzureStorageOptions
    {
        public string ConnectionString { get; set; }
        public string DemoQueue { get; set; }
    }
}

Add async/await based pattern execution

Add async/await based pattern execution


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

namespace Microsoft.DotNet.ProjectJsonMigration
{
    internal class ConstantPackageVersions
    {
        public const string AspNetToolsVersion = "1.0.0-msbuild1-final";
        public const string TestSdkPackageVersion = "15.0.0-preview-20161024-02";
        public const string XUnitPackageVersion = "2.2.0-beta3-build3402";
        public const string XUnitRunnerPackageVersion = "2.2.0-beta4-build1188";
        public const string MstestTestAdapterVersion = "1.1.3-preview";
        public const string MstestTestFrameworkVersion = "1.0.4-preview";
        public const string BundleMinifierToolVersion = "2.2.301";
    }
}

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

namespace Microsoft.DotNet.ProjectJsonMigration
{
    internal class ConstantPackageVersions
    {
        public const string AspNetToolsVersion = "1.0.0-msbuild1-final";
        public const string TestSdkPackageVersion = "15.0.0-preview-20161024-02";
        public const string XUnitPackageVersion = "2.2.0-beta4-build3444";
        public const string XUnitRunnerPackageVersion = "2.2.0-beta4-build1194";
        public const string MstestTestAdapterVersion = "1.1.3-preview";
        public const string MstestTestFrameworkVersion = "1.0.4-preview";
        public const string BundleMinifierToolVersion = "2.2.301";
    }
}

Update the version for migration project


using Foundation;
using System;
using System.CodeDom.Compiler;
using UIKit;

namespace SampleApp
{
	partial class ExampleTableViewController : UITableViewController
	{

		public ExampleTableViewController (IntPtr handle) : base (handle)
		{
		}

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			TableView.Source = new ExampleTableViewControllerSource(NavigationController);
		}
	}
}

using Foundation;
using System;
using System.CodeDom.Compiler;
using UIKit;

namespace SampleApp
{
	partial class ExampleTableViewController : UITableViewController
	{

		public ExampleTableViewController (IntPtr handle) : base (handle)
		{
		}

		public override void ViewDidLoad ()
		{
			base.ViewDidLoad ();
			Title = "Application Insights Xamarin";
			TableView.Source = new ExampleTableViewControllerSource(NavigationController);
		}
	}
}

Set title of root controller (sample app)


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

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CloudFlare Utilities")]
[assembly: AssemblyDescription("A .NET PCL to bypass Cloudflare's Anti-DDoS measure (JavaScript challenge) using a DelegatingHandler.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("El Cattivo")]
[assembly: AssemblyProduct("CloudFlare Utilities")]
[assembly: AssemblyCopyright("Copyright © El Cattivo 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]

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

[assembly:CLSCompliant(true)]
[assembly:ComVisible(false)]

[assembly: InternalsVisibleTo("CloudFlareUtilities.Tests")]

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

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CloudFlare Utilities")]
[assembly: AssemblyDescription("A .NET PCL to bypass Cloudflare's Anti-DDoS measure (JavaScript challenge) using a DelegatingHandler.")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("El Cattivo")]
[assembly: AssemblyProduct("CloudFlare Utilities")]
[assembly: AssemblyCopyright("Copyright © El Cattivo 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]

[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: AssemblyInformationalVersion("0.1.0.0-alpha")]

[assembly:CLSCompliant(true)]
[assembly:ComVisible(false)]

[assembly: InternalsVisibleTo("CloudFlareUtilities.Tests")]

Add informational version to assembly manifest


using NUnit.Framework;

namespace Kekiri.IoC.Autofac
{
    public class AutofacFluentScenario : IoCFluentScenario
    {
        public AutofacFluentScenario() : base(new AutofacContainer())
        {
        }
    }

    public class AutofacFluentScenario<TContext> : IoCFluentScenario<TContext> where TContext : new()
    {
        public AutofacFluentScenario()
            : base(new AutofacContainer())
        {
        }
    }
}

Remove unused namespace which caused a build failure


using Nancy;
using Nancy.ModelBinding;
using Schedules.API.Models;
using Simpler;
using Schedules.API.Tasks.Reminders;

namespace Schedules.API.Modules
{
  public class RemindersModule : NancyModule
  {
    public RemindersModule ()
    {
      Post["/reminders/sms"] = _ => {
        var createSMSReminder = CreateAReminder("sms");
        return Response.AsJson(createSMSReminder.Out.Reminder, HttpStatusCode.Created);
      };

      Post["/reminders/email"] = _ => {
        var createSMSReminder = CreateAReminder("email");
        return Response.AsJson(createSMSReminder.Out.Reminder, HttpStatusCode.Created);
      };
    }

    private CreateReminder CreateAReminder(string reminderTypeName)
    {
      var createReminder = Task.New<CreateReminder>();
      createReminder.In.ReminderTypeName = reminderTypeName;
      createReminder.In.Reminder = this.Bind<Reminder>();
      createReminder.Execute();
      return createReminder;
    }
  }
}

using Nancy;
using Nancy.ModelBinding;
using Schedules.API.Models;
using Simpler;
using Schedules.API.Tasks.Reminders;

namespace Schedules.API.Modules
{
  public class RemindersModule : NancyModule
  {
    public RemindersModule ()
    {
      Post["/reminders/sms"] = _ => {
        var createSMSReminder = CreateAReminder("sms");
        return Response.AsJson(createSMSReminder.Out.Reminder, HttpStatusCode.Created);
      };

      Post["/reminders/email"] = _ => {
        var createEmailReminder = CreateAReminder("email");
        return Response.AsJson(createEmailReminder.Out.Reminder, HttpStatusCode.Created);
      };
    }

    private CreateReminder CreateAReminder(string reminderTypeName)
    {
      var createReminder = Task.New<CreateReminder>();
      createReminder.In.ReminderTypeName = reminderTypeName;
      createReminder.In.Reminder = this.Bind<Reminder>();
      createReminder.Execute();
      return createReminder;
    }
  }
}

Rename variable to make more sense

Rename variable to make more sense


// Copyright (c) 2014 Sebastien Rombauts (sebastien.rombauts@gmail.com)
//
// Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
// or copy at http://opensource.org/licenses/MIT)

using UnrealBuildTool;

public class GitSourceControl : ModuleRules
{
	public GitSourceControl(TargetInfo Target)
	{
		PrivateDependencyModuleNames.AddRange(
			new string[] {
			"Core",
			"Slate",
			"EditorStyle",
			"SourceControl",
			}
		);
	}
}

// Copyright (c) 2014 Sebastien Rombauts (sebastien.rombauts@gmail.com)
//
// Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
// or copy at http://opensource.org/licenses/MIT)

using UnrealBuildTool;

public class GitSourceControl : ModuleRules
{
	public GitSourceControl(TargetInfo Target)
	{
		PrivateDependencyModuleNames.AddRange(
			new string[] {
				"Core",
				"Slate",
				"SlateCore",
				"EditorStyle",
				"SourceControl",
			}
		);
	}
}

Fix build for UE4.2 - Add SlateCore as new module dependency


@page
@model SupportManager.Web.Pages.User.ApiKeys.ListModel
@{
    Layout = "/Features/Shared/_Layout.cshtml";
    ViewData["Title"] = "API Keys";
}

API Keys

@if (!Model.Data.ApiKeys.Any())
{

            No API keys created yet.

            Create API key

}
else
{

        Create API key

                Key

                Callback URL

        @{ int i = 0;}
        @foreach (var item in Model.Data.ApiKeys)
        {

                    @Model.Data.ApiKeys[i].Value

                    @Model.Data.ApiKeys[i].CallbackUrl

                    Test
                    Delete

            i++;
        }

}

@page
@model SupportManager.Web.Pages.User.ApiKeys.ListModel
@{
    Layout = "/Features/Shared/_Layout.cshtml";
    ViewData["Title"] = "API Keys";
}

API Keys

@if (!Model.Data.ApiKeys.Any())
{

            No API keys created yet.

            Create API key

}
else
{

        Create API key

                Key

                Callback URL

        @{ int i = 0;}
        @foreach (var item in Model.Data.ApiKeys)
        {

                    @Model.Data.ApiKeys[i].Value

                    @Model.Data.ApiKeys[i].CallbackUrl

                    @if (@Model.Data.ApiKeys[i].CallbackUrl != null)
                    {
                        Test
                    }
                    Delete

            i++;
        }

}

Enable callback test only when url is set


namespace Fixie.Assertions
{
    using System;
    using System.Collections.Generic;

    public class AssertException : Exception
    {
        public static string FilterStackTraceAssemblyPrefix = "Fixie.Assertions.";

        public AssertException(string message)
            : base(message)
        {
        }

        public override string StackTrace => FilterStackTrace(base.StackTrace);

        static string FilterStackTrace(string stackTrace)
        {
            if (stackTrace == null)
                return null;

            var results = new List<string>();

            foreach (var line in SplitLines(stackTrace))
            {
                var trimmedLine = line.TrimStart();
                if (!trimmedLine.StartsWith( "at " + FilterStackTraceAssemblyPrefix) )
                    results.Add(line);
            }

            return string.Join(Environment.NewLine, results.ToArray());
        }

        // Our own custom string.Split because Silverlight/CoreCLR doesn't support the version we were using
        static IEnumerable<string> SplitLines(string input)
        {
            while (true)
            {
                int idx = input.IndexOf(Environment.NewLine);

                if (idx < 0)
                {
                    yield return input;
                    break;
                }

                yield return input.Substring(0, idx);
                input = input.Substring(idx + Environment.NewLine.Length);
            }
        }
    }
}

namespace Fixie.Assertions
{
    using System;
    using System.Collections.Generic;

    public class AssertException : Exception
    {
        public static string FilterStackTraceAssemblyPrefix = "Fixie.Assertions.";

        public AssertException(string message)
            : base(message)
        {
        }

        public override string StackTrace => FilterStackTrace(base.StackTrace);

        static string FilterStackTrace(string stackTrace)
        {
            if (stackTrace == null)
                return null;

            var results = new List<string>();

            foreach (var line in Lines(stackTrace))
            {
                var trimmedLine = line.TrimStart();
                if (!trimmedLine.StartsWith("at " + FilterStackTraceAssemblyPrefix))
                    results.Add(line);
            }

            return string.Join(Environment.NewLine, results.ToArray());
        }

        static string[] Lines(string input)
        {
            return input.Split(new[] {Environment.NewLine}, StringSplitOptions.None);
        }
    }
}

Use String.Split(...) instead of recreating it.


@model SiteOptions

        © @Model.Metadata.Author.Name @DateTimeOffset.UtcNow.Year |

            Site Status & Uptime

        | Built from

            @string.Join(string.Empty, GitMetadata.Commit.Take(7))

        on

            @GitMetadata.Branch

        | Sponsored by

            <lazyimg src="~/assets/img/browserstack.svg" viewBox="0 0 428.5 92.3" height="20" alt="Sponsored by BrowserStack" title="Sponsored by BrowserStack" />

Load footer image in JavaScript disabled

Load the BrowserStack logo in the footer if JavaScript is enabled.


using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace HackyNewsWeb
{
    public class Global : HttpApplication
    {
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);
        }
    }
}

using System.Net;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace HackyNewsWeb
{
    public class Global : HttpApplication
    {
        protected void Application_Start()
        {
            // to account for SSL error
            ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12;

            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);
        }
    }
}

Update for SSL error with site

Update for SSL error with site


using System;

namespace LeanGoldfish
{
    public class IsCharacter : ParsingUnit
    {
        private char character;

        public IsCharacter(char character)
        {
            this.character = character;
        }

        internal override ParsingResult TryParse(string text, int position)
        {
            if (text[position] != character)
            {
                return new ParsingResult()
                {
                    Succeeded = false,
                    StartPosition = position,
                    EndPosition = position
                };
            }

            return new ParsingResult()
            {
                Succeeded = true,
                StartPosition = position,
                EndPosition = position
            };
        }
    }
}

using System;

namespace LeanGoldfish
{
    public class IsCharacter : ParsingUnit
    {
        private char character;

        public IsCharacter(char character)
        {
            this.character = character;
        }

        internal override ParsingResult TryParse(string text, int position)
        {
            if (position >= text.Length ||
                text[position] != character)
            {
                return new ParsingResult()
                {
                    Succeeded = false,
                    StartPosition = position,
                    EndPosition = position
                };
            }

            return new ParsingResult()
            {
                Succeeded = true,
                StartPosition = position,
                EndPosition = position
            };
        }
    }
}

Add checking for end of text

Add checking for end of text


using System;

namespace Hangman {
  public class Row {
    public Cell[] Cells;

    public Row(Cell[] cells) {
      Cells = cells;
    }

    public string Draw(int width) {
      // return new String(' ', width - Text.Length) + Text;
      return "I have many cells!";
    }
  }
}

using System;

namespace Hangman {
  public class Row {
    public Cell[] Cells;

    public Row(Cell[] cells) {
      Cells = cells;
    }

    public string Draw(int width) {
      // return new String(' ', width - Text.Length) + Text;
      return String.Join("\n", Lines());
    }

    public string[] Lines() {
      return new string[] {
        "Line 1",
        "Line 2"
      };
    }
  }
}

Join up hardcoded lines in a Row

Join up hardcoded lines in a Row


using SharpLLVM;

namespace SharpLang.CompilerServices
{
    class DefaultABI : IABI
    {
        private readonly ContextRef context;
        private readonly TargetDataRef targetData;
        private readonly int intPtrSize;

        public DefaultABI(ContextRef context, TargetDataRef targetData)
        {
            this.context = context;
            this.targetData = targetData;

            var intPtrLLVM = LLVM.PointerType(LLVM.Int8TypeInContext(context), 0);
            intPtrSize = (int)LLVM.ABISizeOfType(targetData, intPtrLLVM);
        }

        public ABIParameterInfo GetParameterInfo(Type type)
        {
            if (type.StackType == StackValueType.Value)
            {
                // Types smaller than register size will be coerced to integer register type
                var structSize = LLVM.ABISizeOfType(targetData, type.DefaultTypeLLVM);
                if (structSize <= (ulong)intPtrSize)
                {
                    return new ABIParameterInfo(ABIParameterInfoKind.Coerced, LLVM.IntTypeInContext(context, (uint)structSize * 8));
                }

                // Otherwise, fallback to passing by pointer + byval
                return new ABIParameterInfo(ABIParameterInfoKind.Indirect);
            }

            // Other types are passed by value
            return new ABIParameterInfo(ABIParameterInfoKind.Direct);
        }
    }
}

using SharpLLVM;

namespace SharpLang.CompilerServices
{
    class DefaultABI : IABI
    {
        private readonly ContextRef context;
        private readonly TargetDataRef targetData;
        private readonly int intPtrSize;

        public DefaultABI(ContextRef context, TargetDataRef targetData)
        {
            this.context = context;
            this.targetData = targetData;

            var intPtrLLVM = LLVM.PointerType(LLVM.Int8TypeInContext(context), 0);
            intPtrSize = (int)LLVM.ABISizeOfType(targetData, intPtrLLVM);
        }

        public ABIParameterInfo GetParameterInfo(Type type)
        {
            if (type.StackType == StackValueType.Value)
            {
                // Types smaller than register size will be coerced to integer register type
                var structSize = LLVM.ABISizeOfType(targetData, type.DefaultTypeLLVM);
                if (structSize <= (ulong)intPtrSize)
                {
                    return new ABIParameterInfo(ABIParameterInfoKind.Coerced, LLVM.IntTypeInContext(context, (uint)structSize * 8));
                }

                // Otherwise, fallback to passing by pointer + byval (x86) or direct (x64)
                if (intPtrSize == 8)
                    return new ABIParameterInfo(ABIParameterInfoKind.Direct);
                return new ABIParameterInfo(ABIParameterInfoKind.Indirect);
            }

            // Other types are passed by value (pointers, int32, int64, float, etc...)
            return new ABIParameterInfo(ABIParameterInfoKind.Direct);
        }
    }
}

[Compiler] Improve ABI to work better on x64 (values seems better off passed by value instead of byval*).


using Data.Mappings;
using Domain.Entities;
using System.Data.Entity;

namespace Data
{
  public class DriversEdContext : DbContext
  {
    public DriversEdContext()
    {
      // Database.SetInitializer<DriversEdContext>(null);
    }

    public DbSet<Driver> Drivers { get; set; }

    public DbSet<Course> Courses { get; set; }

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
      base.OnModelCreating(modelBuilder);
      modelBuilder.Configurations.AddFromAssembly(typeof(DriversEdContext).Assembly);
    }
  }
}

using Data.Mappings;
using Domain.Entities;
using System.Data.Entity;

namespace Data
{
  public class DriversEdContext : DbContext
  {
    public DriversEdContext()
    {
      Database.SetInitializer<DriversEdContext>(null);
    }

    public DbSet<Driver> Drivers { get; set; }

    public DbSet<Course> Courses { get; set; }

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
      base.OnModelCreating(modelBuilder);
      modelBuilder.Configurations.AddFromAssembly(typeof(DriversEdContext).Assembly);
    }
  }
}

Put the null db initializer back in there.


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

// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.

[assembly: AssemblyTitle("Mammoth")]
[assembly: AssemblyDescription("Convert Word documents from docx to simple HTML")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("Copyright © Michael Williamson 2015 - 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.

[assembly: AssemblyVersion("0.0.2.0")]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.

//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

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

// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.

[assembly: AssemblyTitle("Mammoth")]
[assembly: AssemblyDescription("Convert Word documents from docx to simple HTML")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Michael Williamson")]
[assembly: AssemblyProduct("Mammoth")]
[assembly: AssemblyCopyright("Copyright © Michael Williamson 2015 - 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.

[assembly: AssemblyVersion("0.0.2.0")]

// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.

//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

Update assembly details for NuGet

Update assembly details for NuGet


using System.Reflection;

[assembly: AssemblyTitle("Raven.Bundles.Contrib.IndexedAttachments")]
[assembly: AssemblyDescription("Plugin for RavenDB that extracts text from attachments so they can be indexed.")]
[assembly: AssemblyVersion("2.0.1.0")]
[assembly: AssemblyFileVersion("2.0.1.0")]

using System.Reflection;

[assembly: AssemblyTitle("Raven.Bundles.Contrib.IndexedAttachments")]
[assembly: AssemblyDescription("Plugin for RavenDB that extracts text from attachments so they can be indexed.")]
[assembly: AssemblyVersion("2.0.2.0")]
[assembly: AssemblyFileVersion("2.0.2.0")]

Set IndexedAttachments to version 2.0.2.0


using StreamCompanionTypes.DataTypes;
using StreamCompanionTypes.Enums;
using StreamCompanionTypes.Interfaces;
using StreamCompanionTypes.Interfaces.Sources;

namespace PlaysReplacements
{
    public class PlaysReplacements : IPlugin, ITokensSource
    {
        private int Plays, Retrys;
        private Tokens.TokenSetter _tokenSetter;

        public string Description { get; } = "";
        public string Name { get; } = nameof(PlaysReplacements);
        public string Author { get; } = "Piotrekol";
        public string Url { get; } = "";
        public string UpdateUrl { get; } = "";

        public PlaysReplacements()
        {
            _tokenSetter = Tokens.CreateTokenSetter(Name);
            UpdateTokens();
        }

        public void CreateTokens(MapSearchResult map)
        {
            //ignore replays/spect
            if (map.Action != OsuStatus.Playing)
                return;

            switch (map.SearchArgs.EventType)
            {
                case OsuEventType.SceneChange:
                case OsuEventType.MapChange:
                    Plays++;
                    break;
                case OsuEventType.PlayChange:
                    Retrys++;
                    break;
            }

            UpdateTokens();
        }

        private void UpdateTokens()
        {
            _tokenSetter("plays", Plays);
            _tokenSetter("retrys", Retrys);
        }
    }
}

using StreamCompanionTypes.DataTypes;
using StreamCompanionTypes.Enums;
using StreamCompanionTypes.Interfaces;
using StreamCompanionTypes.Interfaces.Sources;

namespace PlaysReplacements
{
    public class PlaysReplacements : IPlugin, ITokensSource
    {
        private int Plays, Retries;
        private Tokens.TokenSetter _tokenSetter;

        public string Description { get; } = "";
        public string Name { get; } = nameof(PlaysReplacements);
        public string Author { get; } = "Piotrekol";
        public string Url { get; } = "";
        public string UpdateUrl { get; } = "";

        public PlaysReplacements()
        {
            _tokenSetter = Tokens.CreateTokenSetter(Name);
            UpdateTokens();
        }

        public void CreateTokens(MapSearchResult map)
        {
            //ignore replays/spect
            if (map.Action != OsuStatus.Playing)
                return;

            switch (map.SearchArgs.EventType)
            {
                case OsuEventType.SceneChange:
                case OsuEventType.MapChange:
                    Plays++;
                    break;
                case OsuEventType.PlayChange:
                    Retries++;
                    break;
            }

            UpdateTokens();
        }

        private void UpdateTokens()
        {
            _tokenSetter("plays", Plays);
            _tokenSetter("retries", Retries);
        }
    }
}

Rename retrys token to retries

Misc: Rename retrys token to retries


using System;
using System.Diagnostics;

namespace NuGetConsole.Implementation.PowerConsole {
    /// <summary>
    /// Represents a host with extra info.
    /// </summary>
    class HostInfo : ObjectWithFactory<PowerConsoleWindow> {
        Lazy<IHostProvider, IHostMetadata> HostProvider { get; set; }

        public HostInfo(PowerConsoleWindow factory, Lazy<IHostProvider, IHostMetadata> hostProvider)
            : base(factory) {
            UtilityMethods.ThrowIfArgumentNull(hostProvider);
            this.HostProvider = hostProvider;
        }

        /// <summary>
        /// Get the HostName attribute value of this host.
        /// </summary>
        public string HostName {
            get { return HostProvider.Metadata.HostName; }
        }

        IWpfConsole _wpfConsole;

        /// <summary>
        /// Get/create the console for this host. If not already created, this
        /// actually creates the (console, host) pair.
        ///
        /// Note: Creating the console is handled by this package and mostly will
        /// succeed. However, creating the host could be from other packages and
        /// fail. In that case, this console is already created and can be used
        /// subsequently in limited ways, such as displaying an error message.
        /// </summary>
        public IWpfConsole WpfConsole {
            get {
                if (_wpfConsole == null) {
                    _wpfConsole = Factory.WpfConsoleService.CreateConsole(
                        Factory.ServiceProvider, PowerConsoleWindow.ContentType, HostName);
                    _wpfConsole.Host = HostProvider.Value.CreateHost(_wpfConsole, @async: false);
                }
                return _wpfConsole;
            }
        }
    }
}

using System;
using System.Diagnostics;

namespace NuGetConsole.Implementation.PowerConsole {
    /// <summary>
    /// Represents a host with extra info.
    /// </summary>
    class HostInfo : ObjectWithFactory<PowerConsoleWindow> {
        Lazy<IHostProvider, IHostMetadata> HostProvider { get; set; }

        public HostInfo(PowerConsoleWindow factory, Lazy<IHostProvider, IHostMetadata> hostProvider)
            : base(factory) {
            UtilityMethods.ThrowIfArgumentNull(hostProvider);
            this.HostProvider = hostProvider;
        }

        /// <summary>
        /// Get the HostName attribute value of this host.
        /// </summary>
        public string HostName {
            get { return HostProvider.Metadata.HostName; }
        }

        IWpfConsole _wpfConsole;

        /// <summary>
        /// Get/create the console for this host. If not already created, this
        /// actually creates the (console, host) pair.
        ///
        /// Note: Creating the console is handled by this package and mostly will
        /// succeed. However, creating the host could be from other packages and
        /// fail. In that case, this console is already created and can be used
        /// subsequently in limited ways, such as displaying an error message.
        /// </summary>
        public IWpfConsole WpfConsole {
            get {
                if (_wpfConsole == null) {
                    _wpfConsole = Factory.WpfConsoleService.CreateConsole(
                        Factory.ServiceProvider, PowerConsoleWindow.ContentType, HostName);
                    _wpfConsole.Host = HostProvider.Value.CreateHost(_wpfConsole, @async: true);
                }
                return _wpfConsole;
            }
        }
    }
}

Revert accidental change of the async flag.

--HG--
branch : 1.1


using System;

namespace it.unifi.dsi.stlab.networkreasoner.gas.system.terranova
{
	public class VersioningInfo
	{
		public String VersionNumber {
			get {
				return "v1.0.1";
			}
		}

		public String EngineIdentifier {
			get {
				return "Network Reasoner, stlab.dsi.unifi.it";
			}
		}
	}
}

using System;

namespace it.unifi.dsi.stlab.networkreasoner.gas.system.terranova
{
	public class VersioningInfo
	{
		/// <summary>
		/// Gets the version number.
		///
		/// Here are the stack of versions with a brief description:
		///
		/// v1.1.0: introduce pressure regulator gadget for edges.
		///
		/// v1.0.1: enhancement to tackle turbolent behavior due to
		/// 		Reynolds number.
		///
		/// v1.0.0: basic version with checker about negative pressures
		/// 		associated to nodes with load gadget.
		///
		/// </summary>
		/// <value>The version number.</value>
		public String VersionNumber {
			get {
				return "v1.1.0";
			}
		}

		public String EngineIdentifier {
			get {
				return "Network Reasoner, stlab.dsi.unifi.it";
			}
		}
	}
}

Advance version number scheme to include pressure regulator gadget.


using System;
using System.Collections.Generic;
using System.Linq;
using UrlShortenerApi.Data;
using UrlShortenerApi.Models;

namespace UrlShortenerApi.Repositories
{
    public class UrlRepository : IUrlRepository
    {
        ApplicationDbContext _context;
        public UrlRepository(ApplicationDbContext context)
        {
            _context = context;
        }

        public void Add(Url item)
        {
            item.ShortFormat = UrlShortenerLib.Shortener.GenerateShortFormat(6);
            item.CreationDate = DateTime.Now;
            _context.Urls.Add(item);
            _context.SaveChanges();
        }

        public IEnumerable<Url> GetAll()
        {
            return _context.Urls.ToList();
        }

        public Url Find(int id)
        {
            return _context.Urls.Single(m => m.ID == id);
        }

        public Url Find(string shortFormat)
        {
            return _context.Urls.Single(m => m.ShortFormat == shortFormat);
        }

        public void Remove(int id)
        {
            var student = _context.Urls.Single(m => m.ID == id);
            if (student != null)
            {
                _context.Urls.Remove(student);
            }
        }

        public void Update(Url item)
        {
            _context.Update(item);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using UrlShortenerApi.Data;
using UrlShortenerApi.Models;

namespace UrlShortenerApi.Repositories
{
    public class UrlRepository : IUrlRepository
    {
        ApplicationDbContext _context;
        public UrlRepository(ApplicationDbContext context)
        {
            _context = context;
        }

        public void Add(Url item)
        {
            item.ShortFormat = UrlShortenerLib.Shortener.GenerateShortFormat(6);
            item.CreationDate = DateTime.Now;
            _context.Urls.Add(item);
            _context.SaveChanges();
        }

        public IEnumerable<Url> GetAll()
        {
            return _context.Urls.ToList();
        }

        public Url Find(int id)
        {
            return _context.Urls.SingleOrDefault(m => m.ID == id);
        }

        public Url Find(string shortFormat)
        {
            return _context.Urls.SingleOrDefault(m => m.ShortFormat == shortFormat);
        }

        public void Remove(int id)
        {
            var student = _context.Urls.Single(m => m.ID == id);
            if (student != null)
            {
                _context.Urls.Remove(student);
            }
        }

        public void Update(Url item)
        {
            _context.Update(item);
        }
    }
}

Replace Single with SingleOrDefault for Url Reposiory

Otherwise, an error is thrown and we can't return an empty response.


namespace TraktApiSharp.Modules
{
    using Objects.Basic;
    using Objects.Get.Recommendations;
    using Requests;
    using Requests.WithOAuth.Recommendations;
    using System.Threading.Tasks;

    public class TraktRecommendationsModule : TraktBaseModule
    {
        public TraktRecommendationsModule(TraktClient client) : base(client) { }

        public async Task<TraktListResult<TraktMovieRecommendation>> GetUserMovieRecommendationsAsync(int? limit = null,
                                                                                TraktExtendedOption extended = null)
        {
            return await QueryAsync(new TraktUserMovieRecommendationsRequest(Client)
            {
                PaginationOptions = new TraktPaginationOptions(null, limit),
                ExtendedOption = extended != null ? extended : new TraktExtendedOption()
            });
        }

        public async Task HideMovieRecommendationAsync(string movieId)
        {
            await QueryAsync(new TraktUserRecommendationHideMovieRequest(Client) { Id = movieId });
        }

        public async Task<TraktListResult<TraktShowRecommendation>> GetUserShowRecommendationsAsync(int? limit = null,
                                                                                TraktExtendedOption extended = null)
        {
            return await QueryAsync(new TraktUserShowRecommendationsRequest(Client)
            {
                PaginationOptions = new TraktPaginationOptions(null, limit),
                ExtendedOption = extended != null ? extended : new TraktExtendedOption()
            });
        }

        public async Task HideShowRecommendationAsync(string showId)
        {
            await QueryAsync(new TraktUserRecommendationHideShowRequest(Client) { Id = showId });
        }
    }
}

namespace TraktApiSharp.Modules
{
    using Objects.Basic;
    using Objects.Get.Recommendations;
    using Requests;
    using Requests.WithOAuth.Recommendations;
    using System;
    using System.Threading.Tasks;

    public class TraktRecommendationsModule : TraktBaseModule
    {
        public TraktRecommendationsModule(TraktClient client) : base(client) { }

        public async Task<TraktListResult<TraktMovieRecommendation>> GetUserMovieRecommendationsAsync(int? limit = null,
                                                                                TraktExtendedOption extended = null)
        {
            return await QueryAsync(new TraktUserMovieRecommendationsRequest(Client)
            {
                PaginationOptions = new TraktPaginationOptions(null, limit),
                ExtendedOption = extended != null ? extended : new TraktExtendedOption()
            });
        }

        public async Task HideMovieRecommendationAsync(string movieId)
        {
            Validate(movieId);

            await QueryAsync(new TraktUserRecommendationHideMovieRequest(Client) { Id = movieId });
        }

        public async Task<TraktListResult<TraktShowRecommendation>> GetUserShowRecommendationsAsync(int? limit = null,
                                                                                TraktExtendedOption extended = null)
        {
            return await QueryAsync(new TraktUserShowRecommendationsRequest(Client)
            {
                PaginationOptions = new TraktPaginationOptions(null, limit),
                ExtendedOption = extended != null ? extended : new TraktExtendedOption()
            });
        }

        public async Task HideShowRecommendationAsync(string showId)
        {
            Validate(showId);

            await QueryAsync(new TraktUserRecommendationHideShowRequest(Client) { Id = showId });
        }

        private void Validate(string id)
        {
            if (string.IsNullOrEmpty(id))
                throw new ArgumentException("id not valid", "id");
        }
    }
}

Add validation implementation in recommendations module.


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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Cake.VisualStudio.Helpers;

namespace Cake.VisualStudio.TaskRunner
{
    class TaskParser
    {
        private static string _loadPattern = "#load \"";
        public static SortedList<string, string> LoadTasks(string configPath)
        {
            var list = new SortedList<string, string>();

            try
            {
                var script = new ScriptContent(configPath);
                script.Parse(_loadPattern, s => s.Replace("#load", string.Empty).Trim().Trim('"', ';'));
                var document = script.ToString();
                var r = new Regex("Task\\([\\w\\\"](.+)\\b\\\"*\\)");
                var matches = r.Matches(document);
                var taskNames = matches.Cast<Match>().Select(m => m.Groups[1].Value);
                foreach (var name in taskNames)
                {
                    list.Add(name, $"-Target=\"{name}\"");
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
            }

            return list;
        }
    }
}

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

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using Cake.VisualStudio.Helpers;

namespace Cake.VisualStudio.TaskRunner
{
    class TaskParser
    {
        private static string _loadPattern = "#load \"";
        public static SortedList<string, string> LoadTasks(string configPath)
        {
            var list = new SortedList<string, string>();

            try
            {
                var script = new ScriptContent(configPath);
                script.Parse(_loadPattern, s => s.Replace("#load", string.Empty).Trim().Trim('"', ';'));
                var document = script.ToString();
                var r = new Regex("Task\\s*\\(\\s*\\\"(.+)\\b\\\"\\s*\\)");
                var matches = r.Matches(document);
                var taskNames = matches.Cast<Match>().Select(m => m.Groups[1].Value);
                foreach (var name in taskNames)
                {
                    list.Add(name, $"-Target=\"{name}\"");
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex);
            }

            return list;
        }
    }
}

Rework regex to allow whitespace

task-runner: Rework regex to allow whitespace

Some projects may enforce special coding style guidelines on their
projects. To be more flexible in this area the new regex will now allow
whitespace before and in between the brackets. Following some examples of
allowed task name definitions.

    Task("F_0$0")
    Task( "F_0$0" )
    Task ( "F_0$0" )
    Task ( "F_0$0" )
    Task(
      "F_0$0"
    )
    Task (
      "F_0$0"
    )
    Task (
    	"F_0$0"
    )

This fixes #52


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

[assembly: AssemblyTitle("EVE-O Preview")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EVE-O Preview")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("04f08f8d-9e98-423b-acdb-4effb31c0d35")]
[assembly: AssemblyVersion("3.0.0.1")]
[assembly: AssemblyFileVersion("3.0.0.1")]

[assembly: CLSCompliant(true)]

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

[assembly: AssemblyTitle("EVE-O Preview")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EVE-O Preview")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("04f08f8d-9e98-423b-acdb-4effb31c0d35")]
[assembly: AssemblyVersion("3.1.0.0")]
[assembly: AssemblyFileVersion("3.1.0.0")]

[assembly: CLSCompliant(true)]

Update app version to 3.1.0

Update app version to 3.1.0


// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier:  Apache-2.0

using Amazon.AWSSupport;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

namespace SupportActions;

/// <summary>
/// Hello AWS Support example.
/// </summary>
public static class HelloSupport
{
    static async Task Main(string[] args)
    {
        // snippet-start:[Support.dotnetv3.HelloSupport]

        // Use the AWS .NET Core Setup package to set up dependency injection for the AWS Support service.
        // Use your AWS profile name, or leave it blank to use the default profile.
        // You must have a Business, Enterprise On-Ramp, or Enterprise Support subscription, or an exception will be thrown.
        using var host = Host.CreateDefaultBuilder(args)
            .ConfigureServices((_, services) =>
                services.AddAWSService<IAmazonAWSSupport>()
            ).Build();

        // For this example, get the client from the host after setup.
        var supportClient = host.Services.GetRequiredService<IAmazonAWSSupport>();

        var response = await supportClient.DescribeServicesAsync();
        Console.WriteLine($"\tHello AWS Support! There are {response.Services.Count} services available.");

        // snippet-end:[Support.dotnetv3.HelloSupport]

    }
}

// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier:  Apache-2.0

namespace SupportActions;

// snippet-start:[Support.dotnetv3.HelloSupport]

using Amazon.AWSSupport;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

public static class HelloSupport
{
    static async Task Main(string[] args)
    {
        // Use the AWS .NET Core Setup package to set up dependency injection for the AWS Support service.
        // Use your AWS profile name, or leave it blank to use the default profile.
        // You must have a Business, Enterprise On-Ramp, or Enterprise Support subscription, or an exception will be thrown.
        using var host = Host.CreateDefaultBuilder(args)
            .ConfigureServices((_, services) =>
                services.AddAWSService<IAmazonAWSSupport>()
            ).Build();

        // Now the client is available for injection.
        var supportClient = host.Services.GetRequiredService<IAmazonAWSSupport>();

        // We can use await and any of the async methods to get a response.
        var response = await supportClient.DescribeServicesAsync();
        Console.WriteLine($"\tHello AWS Support! There are {response.Services.Count} services available.");
    }
}
// snippet-end:[Support.dotnetv3.HelloSupport]

Update to hello support snippet

Update to hello support snippet


using System;
using System.Threading.Tasks;

using WebSharpJs.NodeJS;

//namespace <%- wsClassName %>
//{
    public class Startup
    {

        static WebSharpJs.NodeJS.Console console;

        /// <summary>
        /// Default entry into managed code.
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<object> Invoke(object input)
        {
            if (console == null)
                console = await WebSharpJs.NodeJS.Console.Instance();

            try
            {
                console.Log($"Hello:  {input}");
            }
            catch (Exception exc) { console.Log($"extension exception:  {exc.Message}"); }

            return null;

        }
    }
//}

using System;
using System.Threading.Tasks;

using WebSharpJs.NodeJS;

//namespace <%- wsClassName %>
//{
    public class Startup
    {

        static WebSharpJs.NodeJS.Console console;

        /// <summary>
        /// Default entry into managed code.
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task<object> Invoke(object input)
        {
            if (console == null)
                console = await WebSharpJs.NodeJS.Console.Instance();

            try
            {
                await console.Log($"Hello:  {input}");
            }
            catch (Exception exc) { await console.Log($"extension exception:  {exc.Message}"); }

            return null;

        }
    }
//}

Add await to console.Log calls.

Add await to console.Log calls.


using System;
using System.Linq;
using System.Net;
using BmpListener.Bgp;

namespace BmpListener.Bmp
{
    public class PeerUpNotification : BmpMessage
    {
        public PeerUpNotification(BmpHeader bmpHeader, ArraySegment<byte> data)
            : base(bmpHeader, ref data)
        {
            ParseBody(data);
        }

        public IPAddress LocalAddress { get; set; }
        public ushort LocalPort { get; set; }
        public ushort RemotePort { get; set; }
        public BgpMessage SentOpenMessage { get; set; }
        public BgpMessage ReceivedOpenMessage { get; set; }

        public void ParseBody(ArraySegment<byte> data)
        {
            //if ((message.PeerHeader.Flags & (1 << 7)) != 0)
            //{
            LocalAddress = new IPAddress(data.Take(16).ToArray());
            //}

            LocalPort = data.ToUInt16(16);
            RemotePort = data.ToUInt16(18);

            var offset = data.Offset + 20;
            var count = data.Count - 20;
            data = new ArraySegment<byte>(data.Array, offset, count);

            SentOpenMessage = BgpMessage.GetBgpMessage(data);

            offset = data.Offset + SentOpenMessage.Length;
            count = data.Count - SentOpenMessage.Length;
            data = new ArraySegment<byte>(data.Array, offset, count);

            ReceivedOpenMessage = BgpMessage.GetBgpMessage(data);
        }
    }
}

using System;
using System.Linq;
using System.Net;
using BmpListener.Bgp;

namespace BmpListener.Bmp
{
    public class PeerUpNotification : BmpMessage
    {
        public PeerUpNotification(BmpHeader bmpHeader, ArraySegment<byte> data)
            : base(bmpHeader, ref data)
        {
            ParseBody(data);
        }

        public IPAddress LocalAddress { get; set; }
        public ushort LocalPort { get; set; }
        public ushort RemotePort { get; set; }
        public BgpMessage SentOpenMessage { get; set; }
        public BgpMessage ReceivedOpenMessage { get; set; }

        public void ParseBody(ArraySegment<byte> data)
        {
            //if ((message.PeerHeader.Flags & (1 << 7)) != 0)
            //{
            LocalAddress = new IPAddress(data.Take(16).ToArray());
            //}

            LocalPort = data.ToUInt16(16);
            RemotePort = data.ToUInt16(18);

            var offset = data.Offset + 20;
            var count = data.Count - 20;
            data = new ArraySegment<byte>(data.Array, offset, count);

            SentOpenMessage = BgpMessage.GetBgpMessage(data);

            offset = data.Offset + SentOpenMessage.Header.Length;
            count = data.Count - SentOpenMessage.Header.Length;
            data = new ArraySegment<byte>(data.Array, offset, count);

            ReceivedOpenMessage = BgpMessage.GetBgpMessage(data);
        }
    }
}

Add BGP header to all BGP message types

Add BGP header to all BGP message types


using System;
using System.Net.Http;
using System.Net.NetworkInformation;
using System.Net.Sockets;

namespace Healthcheck
{
    internal class Program
    {
        private static void Main(string[] args)
        {
                    var client = new HttpClient();
                    var port = Environment.GetEnvironmentVariable("PORT");
                    if (port == null)
                        throw new Exception("PORT is not defined");

                    foreach (NetworkInterface netInterface in NetworkInterface.GetAllNetworkInterfaces())
                    {
                        IPInterfaceProperties ipProps = netInterface.GetIPProperties();
                        foreach (UnicastIPAddressInformation addr in ipProps.UnicastAddresses)
                        {
                            if (addr.Address.AddressFamily != AddressFamily.InterNetwork) continue;
                            if (addr.Address.ToString().StartsWith("127.")) continue;
                            try
                            {
                                var task =
                                    client.GetAsync(String.Format("http://{0}:{1}", addr.Address.ToString(), port));
                                if (task.Wait(1000))
                                {
                                    if (task.Result.IsSuccessStatusCode)
                                    {
                                        Console.WriteLine("healthcheck passed");
                                        Environment.Exit(0);
                                    }
                                }
                            }
                            catch (Exception e)
                            {
                                Console.WriteLine(e.ToString());
                            }

                        }
                    }

                Console.WriteLine("healthcheck failed");

                Environment.Exit(1);
            }
        }
    }
}

Remove extra braces at the end of the file

Signed-off-by: John_Shahid <7c84c4d4148af24079897a92115d562877358578@pivotal.io>


using System;
using System.Web.Mvc;

namespace AspNetBrowserLocale.Core
{
    public static class HtmlHelpers
    {
        public static MvcHtmlString InitializeLocaleDateTime(this HtmlHelper htmlHelper)
        {
            return MvcHtmlString.Create(
@"");
        }

        public static MvcHtmlString LocaleDateTime(this HtmlHelper htmlHelper, DateTime? dateTime)
        {
            long? msSinceUnixEpoch = null;
            if (dateTime.HasValue)
            {
                msSinceUnixEpoch = (long)((TimeSpan)(dateTime.Value.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc))).TotalMilliseconds;
            }

            return MvcHtmlString.Create(string.Format(
                @"{1}",
                msSinceUnixEpoch,
                dateTime.HasValue ? dateTime.Value.ToUniversalTime().ToString() + " UTC" : null));
        }
    }
}

using System;
using System.Web.Mvc;

namespace AspNetBrowserLocale.Core
{
    public static class HtmlHelpers
    {
        private const string NullValueDisplay = "—";

        public static MvcHtmlString InitializeLocaleDateTime(this HtmlHelper htmlHelper)
        {
            return MvcHtmlString.Create(string.Format(
@"",
NullValueDisplay));
        }

        public static MvcHtmlString LocaleDateTime(this HtmlHelper htmlHelper, DateTime? dateTime)
        {
            long? msSinceUnixEpoch = null;
            if (dateTime.HasValue)
            {
                msSinceUnixEpoch = (long)((TimeSpan)(dateTime.Value.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc))).TotalMilliseconds;
            }

            return MvcHtmlString.Create(string.Format(
                @"{1}",
                msSinceUnixEpoch,
                dateTime.HasValue ? dateTime.Value.ToUniversalTime().ToString() + " UTC" : NullValueDisplay));
        }
    }
}

Use same null default value when JS is disabled


namespace Bakery.Text
{
	using System;

	public static class StringRemoveExtensions
	{
		public static String Remove(this String @string, String @remove)
		{
			return @string.Replace(@remove, String.Empty);
		}
	}
}

namespace Bakery.Text
{
	using System;

	public static class StringRemoveExtensions
	{
		public static String Remove(this String @string, String remove)
		{
			if (remove == null)
				throw new ArgumentNullException(nameof(remove));

			return @string.Replace(remove, String.Empty);
		}
	}
}

Remove unnecessary "@" prefix from method argument variable name.


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

namespace DemoTrader
{
    public class StdTraders : Trader {
        public StdTraders()
            : base() {

        }
        public override string Name {
            get { return "DemoTrader"; }
        }
        public override string Version {
            get { return "0.0.1"; }
        }
        public override bool Active {
            get {
                return true;
            }
        }
        public override void Initiale() {
            log("Tradeengine started.... Balance: btc=" + Portfolio.btc + "; eur=" + Portfolio.eur);
            base.Initiale();
        }
        public override void Update() {
            if (!Data.checkIfDataFalid(2)) return;

            double shortvl = Data.ma(2);
            double longvl = Data.ma(1);
            double mymacd = (longvl - shortvl) / longvl;
            plot("ma short", shortvl);
            plot("ma long", longvl);
            plot("ema short", Data.ema(2));
            plot("price", Data.Candle().value.Last);
            plot("macd", mymacd, true);
            if (TickCount % 2 == 0) {
                buyBtc(10);
            } else {
                sellBtc(10);
            }
            base.Update();
        }
        public override void Stop() {
            base.Stop();
        }
    }
}

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

namespace DemoTrader
{
    public class StdTraders : Trader {
        public StdTraders()
            : base() {

        }
        public override string Name {
            get { return "DemoTrader"; }
        }
        public override string Version {
            get { return "0.0.1"; }
        }
        public override bool Active {
            get {
                return true;
            }
        }
        public override void Initiale() {
            log("Tradeengine started.... Balance: btc=" + Portfolio.btc + "; eur=" + Portfolio.eur);
            base.Initiale();
        }
        public override void Update() {
            if (!Data.checkIfDataFalid(2)) return;

            double shortvl = Data.ma(2);
            double longvl = Data.ma(1);
            double mymacd = (longvl - shortvl) / longvl;
            plot("ma short", shortvl);
            plot("ma long", longvl);
            plot("ema short", Data.ema(2));
            plot("price", Data.Candle().value.Last);
            plot("macd", mymacd, true);
            int tradeint = 100;
            if (TickCount % tradeint == 0) {
                if (TickCount % (tradeint * 2) == 0) {
                    buyBtc(10);
                } else {
                    sellBtc(10);
                }
            }
            base.Update();
        }
        public override void Stop() {
            base.Stop();
        }
    }
}

Change Demo Trading intervall -> performance


using System;
using Skylight.Miscellaneous;

namespace Skylight
{
    public class InputCodeForRoom
    {
        private readonly Out _out;

        public InputCodeForRoom(Out @out)
        {
            _out = @out;
        }

        /// <summary>
        ///     Inputs the edit key.
        /// </summary>
        /// <param name="editKey">The edit key.</param>
        public void InputCode(string editKey)
        {
            try
            {
                _out.C.Send("access", editKey);
            }
            catch (Exception)
            {
                Tools.SkylightMessage("Error: attempted to use Out.InputCode before connecting");
            }
        }
    }
}

using System;
using Skylight.Miscellaneous;

namespace Skylight
{
    public class InputCodeForRoom
    {
        private readonly Out _out;

        public InputCodeForRoom(Out @out)
        {
            _out = @out;
        }

        /// <summary>
        ///     Inputs the edit key.
        /// </summary>
        /// <param name="editKey">The edit key.</param>
        public void InputCode(string editKey)
        {
            if (String.IsNullOrWhiteSpace(editKey)) {throw new ArgumentException("editKey cannot be empty or null.");}

            try
            {
                _out.C.Send("access", editKey);
            }
            catch (Exception)
            {
                Tools.SkylightMessage("Error: attempted to use Out.InputCode before connecting");
            }
        }
    }
}

Disable authentication with empty access key

The access key should be checked whether or not it is null or empty.
Since the room's access key cannot be just whitespace or empty, it's
better to tell the user the specific issue.


using System;
using System.IO;

namespace SikuliSharp
{
	public static class Sikuli
	{
		public static ISikuliSession CreateSession()
		{
			return new SikuliSession(CreateRuntime());
		}

		public static SikuliRuntime CreateRuntime()
		{
			return new SikuliRuntime(
				new AsyncDuplexStreamsHandlerFactory(),
				new SikuliScriptProcessFactory()
				);
		}

		public static string RunProject(string projectPath)
		{
			if (projectPath == null) throw new ArgumentNullException("projectPath");

			if(!Directory.Exists(projectPath))
				throw new DirectoryNotFoundException(string.Format("Project not found in path '{0}'", projectPath));

			var processFactory = new SikuliScriptProcessFactory();
			using (var process = processFactory.Start(string.Format("-r {0}", projectPath)))
			{
				var output = process.StandardOutput.ReadToEnd();
				process.WaitForExit();
				return output;
			}
		}
	}
}

using System;
using System.IO;

namespace SikuliSharp
{
	public static class Sikuli
	{
		public static ISikuliSession CreateSession()
		{
			return new SikuliSession(CreateRuntime());
		}

		public static SikuliRuntime CreateRuntime()
		{
			return new SikuliRuntime(
				new AsyncDuplexStreamsHandlerFactory(),
				new SikuliScriptProcessFactory()
				);
		}

		public static string RunProject(string projectPath)
		{
			if (projectPath == null) throw new ArgumentNullException("projectPath");

			if(!Directory.Exists(projectPath))
				throw new DirectoryNotFoundException(string.Format("Project not found in path '{0}'", projectPath));

			var processFactory = new SikuliScriptProcessFactory();
			using (var process = processFactory.Start(string.Format("-r {0}", projectPath)))
			{
				var output = process.StandardOutput.ReadToEnd();
				process.WaitForExit();
				return output;
			}
		}

        public static string RunProject(string projectPath, string args)
        {
            if (projectPath == null) throw new ArgumentNullException("projectPath");

            if (!Directory.Exists(projectPath))
                throw new DirectoryNotFoundException(string.Format("Project not found in path '{0}'", projectPath));

            var processFactory = new SikuliScriptProcessFactory();
            using (var process = processFactory.Start(string.Format("-r {0} {1}", projectPath, args)))
            {
                var output = process.StandardOutput.ReadToEnd();
                process.WaitForExit();
                return output;
            }
        }
    }
}

Add another RunProject function with args to script.


using NUnit.Framework;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;

namespace Elliptic.Tests
{
    [Explicit]
    [TestFixture]
    public class Curve25519TimingTests
    {
        [Test]
        public void Curve25519_GetPublicKey()
        {
            var millis = new List<long>();
            for (var i = 0; i < 255; i++)
            {
                var privateKey = Curve25519.ClampPrivateKey(TestHelpers.GetUniformBytes((byte)i, 32));
                Curve25519.GetPublicKey(privateKey);

                var stopwatch = Stopwatch.StartNew();

                for (var j = 0; j < 100; j++)
                {
                    Curve25519.GetPublicKey(privateKey);
                }

                millis.Add(stopwatch.ElapsedMilliseconds);
            }

            var text = new StringBuilder();
            foreach (var ms in millis)
                text.Append(ms + ",");
            Assert.Inconclusive(text.ToString());
        }

        [Test]
        public void Curve25519_GetSharedSecret()
        {
            var millis = new List<long>();
            for (var i = 0; i < 255; i++)
            {
                var privateKey = Curve25519.ClampPrivateKey(TestHelpers.GetUniformBytes((byte)i, 32));
                var publicKey = Curve25519.GetPublicKey(privateKey);
                Curve25519.GetSharedSecret(privateKey, publicKey);

                var stopwatch = Stopwatch.StartNew();

                for (var j = 0; j < 100; j++)
                {
                    Curve25519.GetSharedSecret(privateKey, publicKey);
                }

                millis.Add(stopwatch.ElapsedMilliseconds);
            }

            var text = new StringBuilder();
            foreach (var ms in millis)
                text.Append(ms + ",");
            Assert.Inconclusive(text.ToString());
        }
    }
}

using NUnit.Framework;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;

namespace Elliptic.Tests
{
    [Explicit]
    [TestFixture]
    public class Curve25519TimingTests
    {
        [Test]
        public void Curve25519_GetPublicKey()
        {
            var millis = new List<long>();
            for (int i = 0; i < 255; i++)
            {
                byte[] privateKey = Curve25519.ClampPrivateKey(TestHelpers.GetUniformBytes((byte)i, 32));
                Curve25519.GetPublicKey(privateKey);

                Stopwatch stopwatch = Stopwatch.StartNew();

                for (int j = 0; j < 100; j++)
                {
                    Curve25519.GetPublicKey(privateKey);
                }

                millis.Add(stopwatch.ElapsedMilliseconds);
            }

            var text = new StringBuilder();
            foreach (var ms in millis)
                text.Append(ms + ",");
            Assert.Inconclusive(text.ToString());
        }
    }
}

Revert "measure time of GetSharedSecret"

This reverts commit bce0a10acb752b5a40b0422f008d3b459ea5fbc0.


/*
 * John Hall <john.hall@xjtag.com>
 * Copyright (c) Midas Yellow Ltd. All rights reserved.
 */

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

namespace CvsGitConverter
{
	class Program
	{
		static void Main(string[] args)
		{
			if (args.Length != 1)
				throw new ArgumentException("Need a cvs.log file");

			var parser = new CvsLogParser(args[0]);
			var commits = parser.Parse();

			var changeSets = new Dictionary<string, ChangeSet>();

			foreach (var commit in commits)
			{
				ChangeSet changeSet;
				if (changeSets.TryGetValue(commit.CommitId, out changeSet))
				{
					changeSet.Add(commit);
				}
				else
				{
					changeSet = new ChangeSet(commit.CommitId) { commit };
					changeSets.Add(changeSet.CommitId, changeSet);
				}
			}

			foreach (var changeSet in changeSets.Values.OrderBy(c => c.Time))
			{
				Console.Out.WriteLine("Commit: {0} {1}", changeSet.CommitId, changeSet.Time);
				foreach (var commit in changeSet)
					Console.Out.WriteLine("  {0} r{1}", commit.File, commit.Revision);
			}
		}
	}
}

/*
 * John Hall <john.hall@xjtag.com>
 * Copyright (c) Midas Yellow Ltd. All rights reserved.
 */

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

namespace CvsGitConverter
{
	class Program
	{
		static void Main(string[] args)
		{
			if (args.Length != 1)
				throw new ArgumentException("Need a cvs.log file");

			var parser = new CvsLogParser(args[0]);
			var revisions = parser.Parse();

			var commits = new Dictionary<string, Commit>();

			foreach (var revision in revisions)
			{
				Commit changeSet;
				if (commits.TryGetValue(revision.CommitId, out changeSet))
				{
					changeSet.Add(revision);
				}
				else
				{
					changeSet = new Commit(revision.CommitId) { revision };
					commits.Add(changeSet.CommitId, changeSet);
				}
			}

			foreach (var commit in commits.Values.OrderBy(c => c.Time))
			{
				Console.Out.WriteLine("Commit: {0} {1}", commit.CommitId, commit.Time);
				foreach (var revision in commit)
					Console.Out.WriteLine("  {0} r{1}", revision.File, revision.Revision);
			}
		}
	}
}

Update variable names to reflect class name changes


using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Net;

using RestSharp;
using Dapper;
using DapperExtensions;

using WPMGMT.BESScraper.Model;

namespace WPMGMT.BESScraper
{
    class Program
    {
        static void Main(string[] args)
        {
            BesApi besApi = new BesApi(new Uri("https://pc120006933:52311/api/"), "iemadmin", "bigfix");
            //WPMGMT.BESScraper.Model.Action action = besApi.GetAction(1854);
            //Actions actions = besApi.GetActions();
            //ActionDetail detail = besApi.GetActionDetail(1854);

            WPMGMT.BESScraper.Model.Action action = new Model.Action();
            action.ID = 1855;
            action.Name = "TEST POC TROLL";

            using (SqlConnection cn = new SqlConnection(@"Data Source=10.50.20.128\YPTOSQL002LP;Initial Catalog=YPTO_WPMGMT;Integrated Security=SSPI;"))
            {
                cn.Open();
                var id = cn.Insert(action);
                cn.Close();
            }

            Console.Read();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Net;

using RestSharp;
using Dapper;
using DapperExtensions;

using WPMGMT.BESScraper.Model;

namespace WPMGMT.BESScraper
{
    class Program
    {
        static void Main(string[] args)
        {
            BesApi besApi = new BesApi(new Uri("https://pc120006933:52311/api/"), "iemadmin", "bigfix");
            //WPMGMT.BESScraper.Model.Action action = besApi.GetAction(1854);
            //Actions actions = besApi.GetActions();
            //ActionDetail detail = besApi.GetActionDetail(1854);

            WPMGMT.BESScraper.Model.Action action = new Model.Action();
            action.ID = 1855;
            action.Name = "TEST POC TROLL";

            using (SqlConnection cn = new SqlConnection(@"Data Source=10.50.20.128\YPTOSQL002LP;Initial Catalog=YPTO_WPMGMT;Integrated Security=SSPI;"))
            {
                cn.Open();
                // TEST
                var id = cn.Insert(action);
                cn.Close();
            }

            Console.Read();
        }
    }
}

Fix for missing author info

Fix for missing author info


using System;
using System.Linq;
using System.ServiceProcess;

namespace PolymeliaDeployAgent
{
    using PolymeliaDeploy;
    using PolymeliaDeploy.Controller;

    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            var service = new Service();

            DeployServices.ReportClient = new ReportRemoteClient();
            DeployServices.ActivityClient = new ActivityRemoteClient();

            if (args.Any(arg => arg == "/c"))
            {
                Console.WriteLine("Start polling deploy controller for tasks...");

                using(var poller = new DeployPoller())
                {
                    poller.StartPoll();
                    Console.ReadLine();
                }

                return;
            }

            ServiceBase.Run(service);
        }
    }
}

using System;
using System.Linq;
using System.ServiceProcess;

namespace PolymeliaDeployAgent
{
    using PolymeliaDeploy;
    using PolymeliaDeploy.Controller;

    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            var service = new Service();

            DeployServices.ReportClient = new ReportRemoteClient();
            DeployServices.ActivityClient = new ActivityRemoteClient();

            if (Environment.UserInteractive)
            {
                Console.WriteLine("Start polling deploy controller for tasks...");

                using(var poller = new DeployPoller())
                {
                    poller.StartPoll();
                    Console.ReadLine();
                }

                return;
            }

            ServiceBase.Run(service);
        }
    }
}

Check Environment.UserInteractive instead of argument


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

namespace SassSharp.Ast
{
    public class FluentAstBuilder
    {
        private IList<Node> nodes;
        public FluentAstBuilder()
        {
            nodes = new List<Node>();
        }

        public FluentAstBuilder Node(string selector, Action<FluentNodeBuilder> nodeBuilder)
        {
            var builder = new FluentNodeBuilder();
            nodeBuilder(builder);

            nodes.Add(Ast.Node.Create(selector, DeclarationSet.FromList(builder.Declarations), builder.Children));

            return this;
        }

        public SassSyntaxTree Build()
        {
            return new SassSyntaxTree(nodes);
        }

        public class FluentNodeBuilder
        {
            private IList<Declaration> declarations;
            private IList<Node> children;

            public FluentNodeBuilder()
            {
                declarations = new List<Declaration>();
                children = new List<Node>();
            }

            public IList<Declaration> Declarations
            {
                get { return declarations; }
            }

            public IEnumerable<Node> Children
            {
                get { return children; }
            }

            public void Declaration(string property, string value)
            {
                declarations.Add(new Declaration(property, value));
            }

            public void Child(string selector, Action<FluentNodeBuilder> nodeBuilder)
            {
                var builder = new FluentNodeBuilder();
                nodeBuilder(builder);

                children.Add(Ast.Node.Create(selector, DeclarationSet.FromList(builder.Declarations), builder.Children));
            }
        }
    }
}

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

namespace SassSharp.Ast
{
    public class FluentAstBuilder
    {
        private IList<Node> nodes;
        public FluentAstBuilder()
        {
            nodes = new List<Node>();
        }

        public FluentAstBuilder Node(string selector, Action<FluentNodeBuilder> nodeBuilder)
        {
            nodes.Add(FluentNodeBuilder.CreateNode(selector, nodeBuilder));

            return this;
        }

        public SassSyntaxTree Build()
        {
            return new SassSyntaxTree(nodes);
        }

        public class FluentNodeBuilder
        {
            private IList<Declaration> declarations;
            private IList<Node> children;

            public FluentNodeBuilder(IList<Declaration> declarations, IList<Node> children)
            {
                this.declarations = declarations;
                this.children = children;
            }

            public void Declaration(string property, string value)
            {
                declarations.Add(new Declaration(property, value));
            }

            public void Child(string selector, Action<FluentNodeBuilder> nodeBuilder)
            {
                children.Add(FluentNodeBuilder.CreateNode(selector, nodeBuilder));
            }

            public static Node CreateNode(string selector, Action<FluentNodeBuilder> nodeBuilder)
            {
                var declarations = new List<Declaration>();
                var children = new List<Node>();
                var builder = new FluentNodeBuilder(declarations, children);

                nodeBuilder(builder);

                return Ast.Node.Create(selector, DeclarationSet.FromList(declarations), children);
            }
        }
    }
}

Clean up fluent node builder to not leak implementation details


#if DESKTOP
using System;
using System.Collections.ObjectModel;

namespace Eto.Forms
{
	public interface IMenuItem : IMenu
	{
	}

	public enum MenuItemType
	{
		Check,
		Image,
		Radio,
		Separator,
	}

	public abstract class MenuItem : BaseAction
	{
		protected MenuItem (Generator g, Type type, bool initialize = true)
			: base(g, type, initialize)
		{
		}
	}

	public class MenuItemCollection : Collection<MenuItem>
	{
		readonly ISubMenu subMenu;

		public ISubMenuWidget Parent {
			get;
			private set;
		}

		public MenuItemCollection (ISubMenuWidget parent, ISubMenu parentMenu)
		{
			this.Parent = parent;
			this.subMenu = parentMenu;
		}

		protected override void InsertItem (int index, MenuItem item)
		{
			base.InsertItem (index, item);
			subMenu.AddMenu (index, item);
		}

		protected override void RemoveItem (int index)
		{
			var item = this [index];
			base.RemoveItem (index);
			subMenu.RemoveMenu (item);
		}

		protected override void ClearItems ()
		{
			base.ClearItems ();
			subMenu.Clear ();
		}
	}
}
#endif

#if DESKTOP
using System;
using System.Collections.ObjectModel;

namespace Eto.Forms
{
	public interface IMenuItem : IMenu
	{
	}

	public abstract class MenuItem : BaseAction
	{
		protected MenuItem (Generator g, Type type, bool initialize = true)
			: base(g, type, initialize)
		{
		}
	}

	public class MenuItemCollection : Collection<MenuItem>
	{
		readonly ISubMenu subMenu;

		public ISubMenuWidget Parent {
			get;
			private set;
		}

		public MenuItemCollection (ISubMenuWidget parent, ISubMenu parentMenu)
		{
			this.Parent = parent;
			this.subMenu = parentMenu;
		}

		protected override void InsertItem (int index, MenuItem item)
		{
			base.InsertItem (index, item);
			subMenu.AddMenu (index, item);
		}

		protected override void RemoveItem (int index)
		{
			var item = this [index];
			base.RemoveItem (index);
			subMenu.RemoveMenu (item);
		}

		protected override void ClearItems ()
		{
			base.ClearItems ();
			subMenu.Clear ();
		}
	}
}
#endif

Remove work-in progress enum, not presently required.


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

using System.Threading;
using System.Threading.Tasks;
using OmniSharp.Extensions.DebugAdapter.Protocol.Models;
using OmniSharp.Extensions.DebugAdapter.Protocol.Requests;

namespace Microsoft.PowerShell.EditorServices.Handlers
{
    internal class ThreadsHandler : IThreadsHandler
    {
        public Task<ThreadsResponse> Handle(ThreadsArguments request, CancellationToken cancellationToken)
        {
            return Task.FromResult(new ThreadsResponse
            {
                // TODO: What do I do with these?
                Threads = new Container<OmniSharp.Extensions.DebugAdapter.Protocol.Models.Thread>(
                    new OmniSharp.Extensions.DebugAdapter.Protocol.Models.Thread
                    {
                        Id = 1,
                        Name = "Main Thread"
                    })
            });
        }
    }
}

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

using System.Threading;
using System.Threading.Tasks;
using OmniSharp.Extensions.DebugAdapter.Protocol.Models;
using OmniSharp.Extensions.DebugAdapter.Protocol.Requests;

namespace Microsoft.PowerShell.EditorServices.Handlers
{
    internal class ThreadsHandler : IThreadsHandler
    {
        public Task<ThreadsResponse> Handle(ThreadsArguments request, CancellationToken cancellationToken)
        {
            return Task.FromResult(new ThreadsResponse
            {
                // TODO: This is an empty container of threads...do we need to make a thread?
                Threads = new Container<System.Threading.Thread>()
            });
        }
    }
}

Fix use of `ThreadsResponse` (type changed for threads container)


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Core.CrossDomainImagesWeb
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_PreInit(object sender, EventArgs e)
        {
            Uri redirectUrl;
            switch (SharePointContextProvider.CheckRedirectionStatus(Context, out redirectUrl))
            {
                case RedirectionStatus.Ok:
                    return;
                case RedirectionStatus.ShouldRedirect:
                    Response.Redirect(redirectUrl.AbsoluteUri, endResponse: true);
                    break;
                case RedirectionStatus.CanNotRedirect:
                    Response.Write("An error occurred while processing your request.");
                    Response.End();
                    break;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                var spContext = SharePointContextProvider.Current.GetSharePointContext(Context);
                using (var clientContext = spContext.CreateUserClientContextForSPAppWeb())
                {
                    //set access token in hidden field for client calls
                    hdnAccessToken.Value = spContext.UserAccessTokenForSPAppWeb;

                    //set images
                    Image1.ImageUrl = spContext.SPAppWebUrl + "AppImages/O365.png";
                    Services.ImgService svc = new Services.ImgService();
                    Image2.ImageUrl = svc.GetImage(spContext.UserAccessTokenForSPAppWeb, spContext.SPAppWebUrl.ToString(), "AppImages", "O365.png");
                }
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Core.CrossDomainImagesWeb
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_PreInit(object sender, EventArgs e)
        {
            Uri redirectUrl;
            switch (SharePointContextProvider.CheckRedirectionStatus(Context, out redirectUrl))
            {
                case RedirectionStatus.Ok:
                    return;
                case RedirectionStatus.ShouldRedirect:
                    Response.Redirect(redirectUrl.AbsoluteUri, endResponse: true);
                    break;
                case RedirectionStatus.CanNotRedirect:
                    Response.Write("An error occurred while processing your request.");
                    Response.End();
                    break;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            var spContext = SharePointContextProvider.Current.GetSharePointContext(Context);
            using (var clientContext = spContext.CreateUserClientContextForSPAppWeb())
            {
                //set access token in hidden field for client calls
                hdnAccessToken.Value = spContext.UserAccessTokenForSPAppWeb;

                //set images
                Image1.ImageUrl = spContext.SPAppWebUrl + "AppImages/O365.png";
                Services.ImgService svc = new Services.ImgService();
                Image2.ImageUrl = svc.GetImage(spContext.UserAccessTokenForSPAppWeb, spContext.SPAppWebUrl.ToString(), "AppImages", "O365.png");
            }
        }
    }
}

Revert "Revert "Revert "added try catch, test commit"""

This reverts commit 9ba17068fe9978121210a2652deadf655e58e28d.


using System;

namespace Villermen.RuneScapeCacheTools.Extensions
{
    public static class PathExtensions
    {
        public static char[] InvalidCharacters = { '/', ':', '"', '*', '?', '>', '<', '|' };

        /// <summary>
        ///     Parses the given directory and unifies its format, to be applied to unpredictable user input.
        ///     Converts backslashes to forward slashes, and appends a directory separator.
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static string FixDirectory(string path)
        {
            // Expand environment variables
            var result = Environment.ExpandEnvironmentVariables(path);

            // Replace backslashes with forward slashes
            result = result.Replace('\\', '/');

            // Add trailing slash if not present
            if (!result.EndsWith("/"))
            {
                result += "/";
            }

            return result;
        }
    }
}

using System;

namespace Villermen.RuneScapeCacheTools.Extensions
{
    public static class PathExtensions
    {
        public static char[] InvalidCharacters = { '/', ':', '"', '*', '?', '>', '<', '|', '\0' };

        /// <summary>
        ///     Parses the given directory and unifies its format, to be applied to unpredictable user input.
        ///     Converts backslashes to forward slashes, and appends a directory separator.
        /// </summary>
        /// <param name="path"></param>
        /// <returns></returns>
        public static string FixDirectory(string path)
        {
            // Expand environment variables
            var result = Environment.ExpandEnvironmentVariables(path);

            // Replace backslashes with forward slashes
            result = result.Replace('\\', '/');

            // Add trailing slash if not present
            if (!result.EndsWith("/"))
            {
                result += "/";
            }

            return result;
        }
    }
}

Add NUL to invalid characters

Add NUL to invalid characters

Just to be safe.


using System;
using Ninject;
using Ninject.Extensions.Logging;
using Ninject.Extensions.Logging.NLog4;
using OpenAOE.Engine;

namespace OpenAOE
{
    class Program
    {
        static void Main(string[] args)
        {
            var context = new StandardKernel(
                new NinjectSettings()
                {
                    LoadExtensions = false
                }, new EngineModule(), new Games.AGE2.Module(), new NLogModule());

            var log = context.Get<ILoggerFactory>().GetCurrentClassLogger();
            log.Info("Starting");

            /*context.Bind<IDataService>().ToConstant(VersionedDataService.FromRoot(new Root()));
            var instance = context.Get<ISimulationInstance>();
            context.Unbind(typeof(IDataService));*/

            log.Info("Done");
            Console.ReadKey(true);
            log.Info("Exiting");
        }
    }
}

using System;
using System.Collections.Generic;
using Ninject;
using Ninject.Extensions.Logging;
using Ninject.Extensions.Logging.NLog4;
using OpenAOE.Engine;
using OpenAOE.Engine.Entity;

namespace OpenAOE
{
    class Program
    {
        static void Main(string[] args)
        {
            var context = new StandardKernel(
                new NinjectSettings()
                {
                    LoadExtensions = false
                }, new Engine.EngineModule(), new Games.AGE2.Module(), new NLogModule());

            var log = context.Get<ILoggerFactory>().GetCurrentClassLogger();
            log.Info("Starting");

            var engineFactory = context.Get<IEngineFactory>();

            log.Info("Creating Engine");
            var engine = engineFactory.Create(new List<EntityData>(), new List<EntityTemplate>());

            for (var i = 0; i < 10; ++i)
            {
                var tick = engine.Tick(new EngineTickInput());
                tick.Start();
                tick.Wait();
                engine.Synchronize();
            }

            /*context.Bind<IDataService>().ToConstant(VersionedDataService.FromRoot(new Root()));
            var instance = context.Get<ISimulationInstance>();
            context.Unbind(typeof(IDataService));*/

            log.Info("Done");
            Console.ReadKey(true);
            log.Info("Exiting");
        }
    }
}

Update default project to start an engine and tick a few times.


using System;
using System.Collections.Generic;
using OpenQA.Selenium;
using OpenQA.Selenium.Remote;

namespace Tellurium.MvcPages.WebPages
{
    public class WebTableRow : WebElementCollection<PageFragment>
    {
        private readonly IWebElement webElement;
        private Dictionary<string, int> columnsMap;

        public WebTableRow(RemoteWebDriver driver, IWebElement webElement, Dictionary<string, int> columnsMap) : base(driver, webElement)
        {
            this.webElement = webElement;
            this.columnsMap = columnsMap;
        }

        protected override IWebElement GetItemsContainer()
        {
            return webElement;
        }

        protected override PageFragment MapToItem(IWebElement webElementItem)
        {
            return new PageFragment(Driver, webElementItem);
        }

        public IPageFragment this[string columnName]
        {
            get
            {
                if (string.IsNullOrWhiteSpace(columnName))
                {
                    throw new ArgumentException("Column name cannot be empty", nameof(columnName));
                }
                var index = columnsMap[columnName];
                return this[index];
            }
        }
    }
}

using System;
using System.Collections.Generic;
using OpenQA.Selenium;
using OpenQA.Selenium.Remote;

namespace Tellurium.MvcPages.WebPages
{
    public class WebTableRow : WebElementCollection<PageFragment>
    {
        private readonly IWebElement webElement;
        private Dictionary<string, int> columnsMap;

        public WebTableRow(RemoteWebDriver driver, IWebElement webElement, Dictionary<string, int> columnsMap) : base(driver, webElement)
        {
            this.webElement = webElement;
            this.columnsMap = columnsMap;
        }

        protected override IWebElement GetItemsContainer()
        {
            return webElement;
        }

        protected override PageFragment MapToItem(IWebElement webElementItem)
        {
            return new PageFragment(Driver, webElementItem);
        }

        public IPageFragment this[string columnName]
        {
            get
            {
                if (string.IsNullOrWhiteSpace(columnName))
                {
                    throw new ArgumentException("Column name cannot be empty", nameof(columnName));
                }
                if (columnsMap.ContainsKey(columnName) == false)
                {
                    throw new ArgumentException($"There is no column with header {columnName}", nameof(columnName));
                }
                var index = columnsMap[columnName];
                return this[index];
            }
        }
    }
}

Check if column exist in table

Check if column exist in table