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

namespace osu.Game.Utils
{
    /// <summary>
    /// Provides access to the system's power status.
    /// Currently implemented on iOS and Android only.
    /// </summary>
    public abstract class PowerStatus
    {
        /// <summary>
        /// The maximum battery level considered as low, from 0 to 1.
        /// </summary>
        public virtual double BatteryCutoff { get; } = 0;

        /// <summary>
        /// The charge level of the battery, from 0 to 1.
        /// </summary>
        public virtual double ChargeLevel { get; } = 0;

        public virtual bool IsCharging { get; } = false;

        /// <summary>
        /// Whether the battery is currently low in charge.
        /// Returns true if not charging and current charge level is lower than or equal to <see cref="BatteryCutoff"/>.
        /// </summary>
        public bool IsLowBattery => !IsCharging && ChargeLevel <= BatteryCutoff;
    }
}

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

namespace osu.Game.Utils
{
    /// <summary>
    /// Provides access to the system's power status.
    /// Currently implemented on iOS and Android only.
    /// </summary>
    public abstract class PowerStatus
    {
        /// <summary>
        /// The maximum battery level considered as low, from 0 to 1.
        /// </summary>
        public abstract double BatteryCutoff { get; }

        /// <summary>
        /// The charge level of the battery, from 0 to 1.
        /// </summary>
        public abstract double ChargeLevel { get; }

        public abstract bool IsCharging { get; }

        /// <summary>
        /// Whether the battery is currently low in charge.
        /// Returns true if not charging and current charge level is lower than or equal to <see cref="BatteryCutoff"/>.
        /// </summary>
        public bool IsLowBattery => !IsCharging && ChargeLevel <= BatteryCutoff;
    }
}

Make power status properties abstract

Make power status properties abstract


using RestSharp;
using jRace.PrivateClass.Main;
Namespace Inject {

  public class Inject {

  file = new jRace.PrivateClass.Main();
    brows = new jRace.PrivateClass.Brows();

    private main() {
    var browser = brows.runproc(get());
      brows.getID(browser);
    brows.Select(ID);
      return(load);
    }
  load void(){
  file.Load(token.Method());
  file.Send(token, login);
  return(saftynet);
}
  }
}

using RestSharp;
using jRace.PrivateClass.Main;
Namespace Inject {

  public class Inject {

  file = new jRace.PrivateClass.Main();
    brows = new jRace.PrivateClass.Brows();

    private main() {
    var browser = brows.runproc(get());
    var bID = brows.getID(browser());
    brows.Select(bID, int);
      if(ID = null || ID == 0){
        await saftynet(brower);
      }
      else{
        return(load);
      }
    }
  load void(){
  file.Load(token.Method());
  file.Send(token, login);
  return(saftynet);
}
  }
}

Add New Exception *() saftynet

Add New Exception *() saftynet


using System;
using System.Net.Http;
using System.Threading.Tasks;
using PortableWordPressApi;

namespace ApiConsole
{
	class Program
	{
		static void Main(string[] args)
		{
			Task.WhenAll(AsyncMain());

			Console.WriteLine("Press any key to close.");
			Console.Read();
		}

		private static async Task AsyncMain()
		{
			Console.WriteLine("Enter site URL:");
			var url = Console.ReadLine();

			Console.WriteLine("Searching for API at {0}", url);

			var httpClient = new HttpClient();
			var discovery = new WordPressApiDiscovery(new Uri(url, UriKind.Absolute), httpClient);
			var api = await discovery.DiscoverApiForSite();

			Console.WriteLine("Site's API endpoint: {0}", api.ApiRootUri);
		}
	}
}

using System;
using System.Net.Http;
using System.Threading.Tasks;
using PortableWordPressApi;

namespace ApiConsole
{
	class Program
	{
		static void Main(string[] args)
		{
			Task.WaitAll(AsyncMain());

			Console.WriteLine("Press any key to close.");
			Console.Read();
		}

		private static async Task AsyncMain()
		{
			Console.WriteLine("Enter site URL:");
			var url = Console.ReadLine();

			Console.WriteLine("Searching for API at {0}", url);

			var httpClient = new HttpClient();
			var discovery = new WordPressApiDiscovery(new Uri(url, UriKind.Absolute), httpClient);
			var api = await discovery.DiscoverApiForSite();

			Console.WriteLine("Site's API endpoint: {0}", api.ApiRootUri);
		}
	}
}

Fix async behavior of console program.

Fix async behavior of console program.


using System;
using System.ServiceModel;

namespace Nvents.Services.Network
{
	[ServiceBehavior(
		InstanceContextMode = InstanceContextMode.Single,
		ConcurrencyMode = ConcurrencyMode.Multiple)]
	public class EventService : IEventService
	{
		public event EventHandler<EventPublishedEventArgs> EventPublished;

		public void Publish(IEvent @event)
		{
			if (EventPublished != null)
				EventPublished(this, new EventPublishedEventArgs(@event));
		}
	}
}

using System;
using System.ServiceModel;
using System.Threading;

namespace Nvents.Services.Network
{
	[ServiceBehavior(
		InstanceContextMode = InstanceContextMode.Single,
		ConcurrencyMode = ConcurrencyMode.Multiple)]
	public class EventService : IEventService
	{
		public event EventHandler<EventPublishedEventArgs> EventPublished;

		public void Publish(IEvent @event)
		{
			if (EventPublished == null)
				return;
			ThreadPool.QueueUserWorkItem(s =>
				EventPublished(null, new EventPublishedEventArgs(@event)));
		}
	}
}

Raise incoming event on the ThreadPool

Raise incoming event on the ThreadPool


using Android.App;
using Android.Widget;
using Android.OS;

namespace MatXiTest.Droid
{
	[Activity(Label = "MatXiTest", MainLauncher = true, Icon = "@mipmap/icon")]
	public class MainActivity : Activity
	{
		int count = 1;

		protected override void OnCreate(Bundle savedInstanceState)
		{
			base.OnCreate(savedInstanceState);

			// Set our view from the "main" layout resource
			SetContentView(Resource.Layout.Main);

			// Get our button from the layout resource,
			// and attach an event to it
			Button button = FindViewById<Button>(Resource.Id.myButton);

			button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); };
		}
	}
}

using Android.App;
using Android.Widget;
using Android.OS;
using System.Security.Cryptography;

namespace MatXiTest.Droid
{
	[Activity(Label = "MatXiTest", MainLauncher = true, Icon = "@mipmap/icon")]
	public class MainActivity : Activity
	{
		int count = 1;

		protected override void OnCreate(Bundle savedInstanceState)
		{
			base.OnCreate(savedInstanceState);

			// Set our view from the "main" layout resource
			SetContentView(Resource.Layout.Main);

			// Get our button from the layout resource,
			// and attach an event to it
			Button button = FindViewById<Button>(Resource.Id.myButton);

			button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); };
            ECCurve curve = ECCurve.CreateFromValue("");
		}
	}
}

Add NET Standard 1.6 API dependency

Add NET Standard 1.6 API dependency


using System.Collections.Generic;
using Android.Content;

namespace Plugin.FirebasePushNotification
{
    [BroadcastReceiver]
    public class PushNotificationDeletedReceiver : BroadcastReceiver
    {
        public override void OnReceive(Context context, Intent intent)
        {
            IDictionary<string, object> parameters = new Dictionary<string, object>();
            var extras = intent.Extras;

            if (extras != null && !extras.IsEmpty)
            {
                foreach (var key in extras.KeySet())
                {
                    parameters.Add(key, $"{extras.Get(key)}");
                    System.Diagnostics.Debug.WriteLine(key, $"{extras.Get(key)}");
                }
            }

            FirebasePushNotificationManager.RegisterDelete(parameters);
        }
    }
}

using System.Collections.Generic;
using Android.Content;

namespace Plugin.FirebasePushNotification
{
    [BroadcastReceiver(Enabled = true, Exported = false)]
    public class PushNotificationDeletedReceiver : BroadcastReceiver
    {
        public override void OnReceive(Context context, Intent intent)
        {
            IDictionary<string, object> parameters = new Dictionary<string, object>();
            var extras = intent.Extras;

            if (extras != null && !extras.IsEmpty)
            {
                foreach (var key in extras.KeySet())
                {
                    parameters.Add(key, $"{extras.Get(key)}");
                    System.Diagnostics.Debug.WriteLine(key, $"{extras.Get(key)}");
                }
            }

            FirebasePushNotificationManager.RegisterDelete(parameters);
        }
    }
}

Add Enabled = true, Exported = false

Add Enabled = true, Exported = false


using System;

namespace FezEngine.Structure {
    public class Level {

        public static bool IsNoFlat = false;

        public bool orig_get_Flat() {
            return false;
        }

        public bool get_Flat() {
            return orig_get_Flat() || !IsNoFlat;
        }

    }
}

using System;

namespace FezEngine.Structure {
    public class Level {

        public static bool IsNoFlat = false;

        public bool orig_get_Flat() {
            return false;
        }

        public bool get_Flat() {
            return orig_get_Flat() && !IsNoFlat;
        }

    }
}

Fix logic fail with IsNoFlip

Fix logic fail with IsNoFlip


@{
    ViewBag.Title = "Er is iets fout gegaan";
}

500 Interne Server Fout

                Oeps, sorry, er is iets fout gegaan.

                Er is iets kapot. Als u zo vriendelijk wilt zijn

                    een probleem (issue) aan te maken op onze GitHub

                zullen we er naar kijken.

@{
    ViewBag.Title = "Er is iets fout gegaan";
}

500 Interne Server Fout

                Oeps, sorry, er is iets fout gegaan.

                Er is iets kapot. Als u zo vriendelijk wilt zijn

                    een probleem (issue) aan te maken op onze GitHub

                of een mail te sturen naar

                    oogstplanner@gmail.com

                zullen we er naar kijken.

Include email possibility on server error page


using System;
using System.IO;
using System.Windows;
using System.Windows.Forms;
using EnvDTE;
using MessageBox = System.Windows.Forms.MessageBox;

namespace Twainsoft.SolutionRenamer.VSPackage.GUI
{
    public partial class RenameProjectDialog
    {
        private Project CurrentProject { get; set; }

        public RenameProjectDialog(Project project)
        {
            InitializeComponent();

            CurrentProject = project;

            ProjectName.Text = project.Name;
            ProjectName.Focus();
            ProjectName.SelectAll();
        }

        public string GetProjectName()
        {
            return ProjectName.Text.Trim();
        }

        private void Rename_Click(object sender, RoutedEventArgs e)
        {
            var directory = new FileInfo(CurrentProject.FullName).Directory;

            if (directory == null)
            {
                throw new InvalidOperationException();
            }

            var parentDirectory = directory.Parent;

            if (parentDirectory == null)
            {
                throw new InvalidOperationException();
            }

            // Projects with the same name cannot be in the same folder due to the same folder names.
            // Within the same solution it is no problem!
            if (Directory.Exists(Path.Combine(parentDirectory.FullName, GetProjectName())))
            {
                MessageBox.Show(
                    string.Format(
                        "The project '{0}' already exists in the solution respectively the file system. Please choose another project name.",
                        GetProjectName()),
                    "Project already exists", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                DialogResult = true;

                Close();
            }
        }
    }
}

using System;
using System.IO;
using System.Windows;
using System.Windows.Forms;
using EnvDTE;
using MessageBox = System.Windows.Forms.MessageBox;

namespace Twainsoft.SolutionRenamer.VSPackage.GUI
{
    public partial class RenameProjectDialog
    {
        private Project CurrentProject { get; set; }

        public RenameProjectDialog(Project project)
        {
            InitializeComponent();

            CurrentProject = project;

            ProjectName.Text = project.Name;
            ProjectName.Focus();
            ProjectName.SelectAll();
        }

        public string GetProjectName()
        {
            return ProjectName.Text.Trim();
        }

        private void Rename_Click(object sender, RoutedEventArgs e)
        {
            var directory = new FileInfo(CurrentProject.FullName).Directory;

            if (directory == null)
            {
                throw new InvalidOperationException();
            }

            var parentDirectory = directory.Parent;

            if (parentDirectory == null)
            {
                throw new InvalidOperationException();
            }

            // Projects with the same name cannot be in the same folder due to the same folder names.
            // Within the same solution it is no problem!
            if (Directory.Exists(Path.Combine(parentDirectory.FullName, GetProjectName())))
            {
                MessageBox.Show(
                    string.Format(
                        "The project '{0}' already exists in the solution respectively the file system. Please choose another project name.",
                        GetProjectName()),
                    "Project already exists", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else if (CurrentProject.Name != GetProjectName())
            {
                DialogResult = true;

                Close();
            }
            else
            {
                Close();
            }
        }
    }
}

Check if the project names (new and old one) are the same.


using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CreviceApp.Core.Config
{
    public class UserInterfaceConfig
    {
        public Func<Point, Point> TooltipPositionBinding;
        public int TooltipTimeout = 2000;

        public int BaloonTimeout = 10000;

        public UserInterfaceConfig()
        {
            this.TooltipPositionBinding = (point) =>
            {
                var rect = Screen.FromPoint(point).WorkingArea;
                return new Point(rect.X + rect.Width, rect.Y + rect.Height);
            };
        }
    }
}

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CreviceApp.Core.Config
{
    public class UserInterfaceConfig
    {
        public Func<Point, Point> TooltipPositionBinding;
        public int TooltipTimeout = 2000;

        public int BaloonTimeout = 10000;

        public UserInterfaceConfig()
        {
            this.TooltipPositionBinding = (point) =>
            {
                var rect = Screen.FromPoint(point).WorkingArea;
                return new Point(rect.X + rect.Width - 10, rect.Y + rect.Height - 10);
            };
        }
    }
}

Fix an issue Tooltip does not show on the bottom right edge of the primary display


//
// Copyright 2019 Google LLC
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.
//

using Google.Apis.Auth.OAuth2;
using System;
using System.IO;

namespace Google.Solutions.Compute.Test.Env
{
    public static class Defaults
    {
        private const string CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform";

        public static readonly string ProjectId = Environment.GetEnvironmentVariable("GOOGLE_CLOUD_PROJECT");
        public static readonly string Zone = "us-central1-a";

        public static GoogleCredential GetCredential()
        {
            var keyFile = Environment.GetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS");
            if (keyFile != null && File.Exists(keyFile))
            {
                return GoogleCredential.FromFile(keyFile).CreateScoped(CloudPlatformScope);
            }
            else
            {
                return GoogleCredential.GetApplicationDefault();
            }
        }
    }
}

//
// Copyright 2019 Google LLC
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License.  You may obtain a copy of the License at
//
//   http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied.  See the License for the
// specific language governing permissions and limitations
// under the License.
//

using Google.Apis.Auth.OAuth2;
using System;
using System.IO;

namespace Google.Solutions.Compute.Test.Env
{
    public static class Defaults
    {
        private const string CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform";

        public static readonly string ProjectId = Environment.GetEnvironmentVariable("GOOGLE_CLOUD_PROJECT");
        public static readonly string Zone = "us-central1-a";

        public static GoogleCredential GetCredential()
        {
            var credential = GoogleCredential.GetApplicationDefault();
            return credential.IsCreateScopedRequired
                ? credential.CreateScoped(CloudPlatformScope)
                : credential;
        }
    }
}

Use GoogleCredential.CreateScoped to create test credentials

Change-Id: I274d01dd4024589ca9686ac834a66536d3bf2704


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

namespace Stripe
{
    public class StripeEphemeralKeyService : StripeService
    {
        public StripeEphemeralKeyService(string apiKey = null) : base(apiKey) { }

        //Sync
        public virtual StripeEphemeralKey Create(StripeEphemeralKeyCreateOptions createOptions, StripeRequestOptions requestOptions = null)
        {
            return Mapper<StripeEphemeralKey>.MapFromJson(
                Requestor.PostString(this.ApplyAllParameters(createOptions, Urls.EphemeralKeys, false),
                SetupRequestOptions(requestOptions))
            );
        }

        public virtual StripeDeleted Delete(string EphemeralKeyId, StripeRequestOptions requestOptions = null)
        {
            return Mapper<StripeDeleted>.MapFromJson(
                Requestor.Delete(this.ApplyAllParameters(null, $"{Urls.EphemeralKeys}/{EphemeralKeyId}", false),
                SetupRequestOptions(requestOptions))
            );
        }

        //Async
        public virtual async Task<StripeEphemeralKey> CreateAsync(StripeEphemeralKeyCreateOptions createOptions, StripeRequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            return Mapper<StripeEphemeralKey>.MapFromJson(
                await Requestor.PostStringAsync(this.ApplyAllParameters(createOptions, Urls.EphemeralKeys, false),
                SetupRequestOptions(requestOptions),
                cancellationToken)
            );
        }

        public virtual async Task<StripeDeleted> DeleteAsync(string EphemeralKeyId, StripeRequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            return Mapper<StripeDeleted>.MapFromJson(
                await Requestor.DeleteAsync(this.ApplyAllParameters(null, $"{Urls.EphemeralKeys}/{EphemeralKeyId}", false),
                SetupRequestOptions(requestOptions),
                cancellationToken)
            );
        }
    }
}

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

namespace Stripe
{
    public class StripeEphemeralKeyService : StripeBasicService<StripeEphemeralKey>
    {
        public StripeEphemeralKeyService(string apiKey = null) : base(apiKey) { }

        // Sync
        public virtual StripeEphemeralKey Create(StripeEphemeralKeyCreateOptions createOptions, StripeRequestOptions requestOptions = null)
        {
            return Post(Urls.EphemeralKeys, requestOptions, createOptions);
        }

        public virtual StripeDeleted Delete(string keyId, StripeRequestOptions requestOptions = null)
        {
            return DeleteEntity($"{Urls.EphemeralKeys}/{keyId}", requestOptions);
        }

        // Async
        public virtual Task<StripeEphemeralKey> CreateAsync(StripeEphemeralKeyCreateOptions createOptions, StripeRequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            return PostAsync(Urls.EphemeralKeys, requestOptions, cancellationToken, createOptions);
        }

        public virtual Task<StripeDeleted> DeleteAsync(string keyId, StripeRequestOptions requestOptions = null, CancellationToken cancellationToken = default(CancellationToken))
        {
            return DeleteEntityAsync($"{Urls.EphemeralKeys}/{keyId}", requestOptions, cancellationToken);
        }
    }
}

Move to the new StripeBasicService instead of StripeService


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

public class LevelManager : MonoBehaviour {

    public EnemySpaceShip enemy;

    public void SetupLevel() {
        LayoutObject();
    }

    private void LayoutObject() {
        Instantiate(enemy, new Vector3(9f, 0f, 0f), Quaternion.identity);
    }
}

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

public class LevelManager : MonoBehaviour {

    public EnemySpaceShip enemy;
    public PlayerSpaceShip player;

    public void SetupLevel() {
        LayoutObject();
    }

    private void LayoutObject() {
        Instantiate(enemy, new Vector3(9f, 0f, 0f), Quaternion.identity);
        Instantiate(player, new Vector3(-9f, 0f, 0f), Quaternion.identity);
    }
}

Add PlayerSpaceship to a level

Add PlayerSpaceship to a level


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

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

[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.0.0.0")]
[assembly: AssemblyConfiguration("Release built on 2013-02-22 14:39")]
[assembly: AssemblyCopyright("Copyright © 2013 Autofac Contributors")]

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

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

[assembly: AssemblyVersion("3.0.0.0")]
[assembly: AssemblyFileVersion("3.0.0.0")]
[assembly: AssemblyConfiguration("Release built on 2013-02-28 02:03")]
[assembly: AssemblyCopyright("Copyright © 2013 Autofac Contributors")]

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


using System.Web.Http;

namespace Nora
{
    public static class WebApiConfig
    {
        public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services

            // Web API routes
            config.MapHttpAttributeRoutes();

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

using System.Web.Http;

namespace Nora
{
    public static class WebApiConfig
    {
        public static void Register(HttpConfiguration config)
        {
            // Web API configuration and services

            // Web API routes
            config.MapHttpAttributeRoutes();
            config.Routes.MapHttpRoute("DefaultApi", "api/{controller}/{id}", new {id = RouteParameter.Optional});

           // Remove XML formatter
           var json = config.Formatters.JsonFormatter;
           json.SerializerSettings.PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.Objects;
           config.Formatters.Remove(config.Formatters.XmlFormatter);
        }
    }
}

Set JSON as the default (and only) formatter


namespace TraktApiSharp.Experimental.Responses
{
    using Exceptions;
    using System.Collections.Generic;

    public class TraktListResponse<TContentType> : ATraktResponse<List<TContentType>>, ITraktResponseHeaders
    {
        public string SortBy { get; set; }

        public string SortHow { get; set; }

        public int? UserCount { get; set; }

        internal TraktListResponse() : base() { }

        internal TraktListResponse(List<TContentType> value) : base(value) { }

        internal TraktListResponse(TraktException exception) : base(exception) { }

        public static explicit operator List<TContentType>(TraktListResponse<TContentType> response) => response.Value;

        public static implicit operator TraktListResponse<TContentType>(List<TContentType> value) => new TraktListResponse<TContentType>(value);
    }
}

namespace TraktApiSharp.Experimental.Responses
{
    using Exceptions;
    using System.Collections;
    using System.Collections.Generic;

    public class TraktListResponse<TContentType> : ATraktResponse<List<TContentType>>, ITraktResponseHeaders, IEnumerable<TContentType>
    {
        public string SortBy { get; set; }

        public string SortHow { get; set; }

        public int? UserCount { get; set; }

        internal TraktListResponse() : base() { }

        internal TraktListResponse(List<TContentType> value) : base(value) { }

        internal TraktListResponse(TraktException exception) : base(exception) { }

        public static explicit operator List<TContentType>(TraktListResponse<TContentType> response) => response.Value;

        public static implicit operator TraktListResponse<TContentType>(List<TContentType> value) => new TraktListResponse<TContentType>(value);

        public IEnumerator<TContentType> GetEnumerator() => Value.GetEnumerator();

        IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
    }
}

Add implementation of enumerable interface for list responses.


// © Alexander Kozlenko. Licensed under the MIT License.

using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Extensions;
using Serilog;
using Serilog.Events;

namespace Anemonis.MicrosoftOffice.AddinHost.Middleware
{
    /// Represents request tracking middleware.
    public sealed class RequestTracingMiddleware : IMiddleware
    {
        private readonly ILogger _logger;

        /// Initializes a new instance of the <see cref="RequestTracingMiddleware" /> class.
        /// <param name="logger">The logger instance.</param>
        /// <exception cref="ArgumentNullException"><paramref name="logger" /> is <see langword="null" />.</exception>
        public RequestTracingMiddleware(ILogger logger)
        {
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            _logger = logger;
        }

        async Task IMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
        {
            try
            {
                await next.Invoke(context);
            }
            finally
            {
                var level = context.Response.StatusCode < StatusCodes.Status400BadRequest ? LogEventLevel.Information : LogEventLevel.Error;

                _logger.Write(level, "{0} {1} {2}", context.Response.StatusCode, context.Request.Method, context.Request.GetEncodedPathAndQuery());
            }
        }
    }
}

// © Alexander Kozlenko. Licensed under the MIT License.

using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Extensions;
using Serilog;
using Serilog.Events;

namespace Anemonis.MicrosoftOffice.AddinHost.Middleware
{
    /// Represents request tracking middleware.
    public sealed class RequestTracingMiddleware : IMiddleware
    {
        private readonly ILogger _logger;

        /// Initializes a new instance of the <see cref="RequestTracingMiddleware" /> class.
        /// <param name="logger">The logger instance.</param>
        /// <exception cref="ArgumentNullException"><paramref name="logger" /> is <see langword="null" />.</exception>
        public RequestTracingMiddleware(ILogger logger)
        {
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            _logger = logger;
        }

        async Task IMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
        {
            try
            {
                await next.Invoke(context);
            }
            finally
            {
                var level = context.Response.StatusCode < StatusCodes.Status400BadRequest ? LogEventLevel.Information : LogEventLevel.Error;

                _logger.Write(level, "{0} {1}", context.Response.StatusCode, context.Request.GetEncodedPathAndQuery());
            }
        }
    }
}

Remove request HTTP method from logging

Remove request HTTP method from logging


using System.Collections.Generic;
using System.Reflection;
using Shouldly;
using Xunit;

namespace libpolyglot.Tests
{
    public class Assembly_tests
    {
        public static IEnumerable<object[]> TestAssemblies()
        {
            yield return new object[] { "EmptyVB.dll", Language.Vb };
            yield return new object[] { "EmptyCS.dll", Language.CSharp };
            yield return new object[] { "AnonymousAsyncVB.dll", Language.Vb };
            yield return new object[] { "AnonymousAsyncCS.dll", Language.CSharp };
            yield return new object[] { "DynamicCS.dll", Language.CSharp };
            yield return new object[] { "EmptyFSharp.dll", Language.FSharp };
        }

        [Theory]
        [MemberData(nameof(TestAssemblies))]
        public void When_analyzing(string file, Language expected)
        {
            var assembly = Assembly.LoadFrom($"TestAssemblies\\{file}");
            var analyzer = new AssemblyAnalyzer(assembly);

            analyzer.DetectedLanguage.ShouldBe(expected);
        }
    }
}

using System.Collections.Generic;
using System.IO;
using System.Reflection;
using Shouldly;
using Xunit;

namespace libpolyglot.Tests
{
    public class Assembly_tests
    {
        public static IEnumerable<object[]> TestAssemblies()
        {
            yield return new object[] { "EmptyVB.dll", Language.Vb };
            yield return new object[] { "EmptyCS.dll", Language.CSharp };
            yield return new object[] { "AnonymousAsyncVB.dll", Language.Vb };
            yield return new object[] { "AnonymousAsyncCS.dll", Language.CSharp };
            yield return new object[] { "DynamicCS.dll", Language.CSharp };
            yield return new object[] { "EmptyFSharp.dll", Language.FSharp };
        }

        [Theory]
        [MemberData(nameof(TestAssemblies))]
        public void When_analyzing(string file, Language expected)
        {
            var assembly = Assembly.LoadFrom($"TestAssemblies{Path.DirectorySeparatorChar}{file}");
            var analyzer = new AssemblyAnalyzer(assembly);

            analyzer.DetectedLanguage.ShouldBe(expected);
        }
    }
}

Fix test assembly load path

Fix test assembly load path


namespace Prometheus.HttpExporter.AspNetCore.HttpRequestCount
{
    public class HttpRequestCountOptions : HttpExporterOptionsBase
    {
        public Counter Counter { get; set; } =
            Metrics.CreateCounter(DefaultName, DefaultHelp, HttpRequestLabelNames.All);

        private const string DefaultName = "aspnet_http_requests_total";
        private const string DefaultHelp = "Provides the count of HTTP requests from an ASP.NET application.";
    }
}

namespace Prometheus.HttpExporter.AspNetCore.HttpRequestCount
{
    public class HttpRequestCountOptions : HttpExporterOptionsBase
    {
        public Counter Counter { get; set; } =
            Metrics.CreateCounter(DefaultName, DefaultHelp, HttpRequestLabelNames.All);

        private const string DefaultName = "http_requests_total";
        private const string DefaultHelp = "Provides the count of HTTP requests from an ASP.NET application.";
    }
}

Change http request total name to match Prometheus guidelines


using System;

namespace Gma.QrCodeNet.Encoding.Positioning.Stencils
{
	internal abstract class PatternStencilBase : BitMatrix
	{
		protected const bool O = false;
		protected const bool X = true;

		internal PatternStencilBase(int version)
		{
			Version = version;
		}

		public int Version { get; private set; }

		public abstract bool[,] Stencil { get; }

		public override bool this[int i, int j]
		{
			get => Stencil[i, j];
			set => throw new NotSupportedException();
		}

		public override int Width => Stencil.GetLength(0);

		public override int Height => Stencil.GetLength(1);

		public override bool[,] InternalArray => throw new NotImplementedException();

		public abstract void ApplyTo(TriStateMatrix matrix);
	}
}

using System;

namespace Gma.QrCodeNet.Encoding.Positioning.Stencils
{
	internal abstract class PatternStencilBase : BitMatrix
	{
		protected const bool O = false;
		protected const bool X = true;

		internal PatternStencilBase(int version)
		{
			Version = version;
		}

		public int Version { get; private set; }

		public abstract bool[,] Stencil { get; }

		public override int Width => Stencil.GetLength(0);

		public override int Height => Stencil.GetLength(1);

		public override bool[,] InternalArray => throw new NotImplementedException();

		public override bool this[int i, int j]
		{
			get => Stencil[i, j];
			set => throw new NotSupportedException();
		}

		public abstract void ApplyTo(TriStateMatrix matrix);
	}
}

Order elements in some classes

Order elements in some classes


namespace HelixToolkit.Wpf.SharpDX
{
    using System;
    using System.Collections.Generic;
    using HelixToolkit.SharpDX.Shared.Utilities;

    [Serializable]
    public class PointGeometry3D : Geometry3D
    {
        public IEnumerable<Geometry3D.Point> Points
        {
            get
            {
                for (int i = 0; i < Indices.Count; i += 2)
                {
                    yield return new Point { P0 = Positions[Indices[i]] };
                }
            }
        }

        protected override IOctree CreateOctree(OctreeBuildParameter parameter)
        {
            return new PointGeometryOctree(Positions, parameter);
        }
    }
}

namespace HelixToolkit.Wpf.SharpDX
{
    using System;
    using System.Collections.Generic;
    using HelixToolkit.SharpDX.Shared.Utilities;

    [Serializable]
    public class PointGeometry3D : Geometry3D
    {
        public IEnumerable<Geometry3D.Point> Points
        {
            get
            {
                for (int i = 0; i < Positions.Count; ++i)
                {
                    yield return new Point { P0 = Positions[i] };
                }
            }
        }

        protected override IOctree CreateOctree(OctreeBuildParameter parameter)
        {
            return new PointGeometryOctree(Positions, parameter);
        }
    }
}

Fix point skipped during get points issue


using NadekoBot.Services.Database.Models;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;

namespace NadekoBot.Services.Database.Repositories.Impl
{
    public class QuoteRepository : Repository<Quote>, IQuoteRepository
    {
        public QuoteRepository(DbContext context) : base(context)
        {
        }

        public IEnumerable<Quote> GetAllQuotesByKeyword(ulong guildId, string keyword) =>
            _set.Where(q => q.GuildId == guildId && q.Keyword == keyword);

        public IEnumerable<Quote> GetGroup(ulong guildId, int skip, int take) =>
            _set.Where(q=>q.GuildId == guildId).OrderBy(q => q.Keyword).Skip(skip).Take(take).ToList();

        public Task<Quote> GetRandomQuoteByKeywordAsync(ulong guildId, string keyword)
        {
            var rng = new NadekoRandom();
            return _set.Where(q => q.GuildId == guildId && q.Keyword == keyword).OrderBy(q => rng.Next()).FirstOrDefaultAsync();
        }
        public Task<Quote> SearchQuoteKeywordTextAsync(ulong guildId, string keyword, string text)
        {

          	var rngk = new NadekoRandom();
            return _set.Where(q => q.Text.Contains(text) && q.GuildId == guildId && q.Keyword == keyword).OrderBy(q => rngk.Next()).FirstOrDefaultAsync();
		}
    }
}

Add quote search by keyword and text

Add quote search by keyword and text

Add quote search by keyword and text


using System;
using System.ServiceModel;

using Service;

namespace Client
{
    class Program
    {
        static void Main(string[] args)
        {
            var address = new EndpointAddress(new Uri("http://localhost:9000/MyService"));
            var binding = new BasicHttpBinding();
            var factory = new ChannelFactory<IWcfService>(binding, address);

            IWcfService host = factory.CreateChannel();

            Console.WriteLine("Please enter some words or press [Esc] to exit the application.");

            while (true)
            {
                var key = Console.ReadKey();
                if (key.Key.Equals(ConsoleKey.Escape))
                {
                    return;
                }

                string input = key.KeyChar.ToString() + Console.ReadLine(); // read input

                string output = host.Echo(input); // send to host, receive output
                Console.WriteLine(output); // write output
            }
        }
    }
}

using System;
using System.ServiceModel;

using Service;

namespace Client
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("Enter server address: ");
            var hostAddress = Console.ReadLine();

            var address = new EndpointAddress(new Uri(string.Format("http://{0}:9000/MyService", hostAddress)));
            var binding = new BasicHttpBinding();
            var factory = new ChannelFactory<IWcfService>(binding, address);

            IWcfService host = factory.CreateChannel();

            Console.WriteLine("Please enter some words or press [Esc] to exit the application.");

            while (true)
            {
                var key = Console.ReadKey();
                if (key.Key.Equals(ConsoleKey.Escape))
                {
                    return;
                }

                string input = key.KeyChar.ToString() + Console.ReadLine(); // read input

                string output = host.Echo(input); // send to host, receive output
                Console.WriteLine(output); // write output
            }
        }
    }
}

Allow to define host address in client

Allow to define host address in client


using System;

namespace XeroApi.Model
{
    public class BankTransaction : EndpointModelBase
    {
        [ItemId]
        public Guid? BankTransactionID { get; set; }

        public Account BankAccount { get; set; }

        public string Type { get; set; }

        public string Reference { get; set; }

        public string Url { get; set; }

        public string ExternalLinkProviderName { get; set; }

        public bool IsReconciled { get; set; }

        public decimal? CurrencyRate { get; set; }

        public Contact Contact { get; set; }

        public DateTime? Date { get; set; }

        public DateTime? DueDate { get; set; }

        public virtual Guid? BrandingThemeID { get; set; }

        public virtual string Status { get; set; }

        public LineAmountType LineAmountTypes { get; set; }

        public virtual LineItems LineItems { get; set; }

        public virtual decimal? SubTotal { get; set; }

        public virtual decimal? TotalTax { get; set; }

        public virtual decimal? Total { get; set; }

        [ItemUpdatedDate]
        public DateTime? UpdatedDateUTC { get; set; }

        public virtual string CurrencyCode { get; set; }

        public DateTime? FullyPaidOnDate { get; set; }
    }

    public class BankTransactions : ModelList<BankTransaction>
    {
    }
}

using System;

namespace XeroApi.Model
{
    public class BankTransaction : EndpointModelBase
    {
        [ItemId]
        public Guid? BankTransactionID { get; set; }

        public Account BankAccount { get; set; }

        public string Type { get; set; }

        public string Reference { get; set; }

        public string Url { get; set; }

        public string ExternalLinkProviderName { get; set; }

        public bool IsReconciled { get; set; }

        public decimal? CurrencyRate { get; set; }

        public Contact Contact { get; set; }

        public DateTime? Date { get; set; }

        public DateTime? DueDate { get; set; }

        public virtual Guid? BrandingThemeID { get; set; }

        public virtual string Status { get; set; }

        public LineAmountType LineAmountTypes { get; set; }

        public virtual LineItems LineItems { get; set; }

        public virtual decimal? SubTotal { get; set; }

        public virtual decimal? TotalTax { get; set; }

        public virtual decimal? Total { get; set; }

        [ItemUpdatedDate]
        public DateTime? UpdatedDateUTC { get; set; }

        public virtual string CurrencyCode { get; set; }

        public DateTime? FullyPaidOnDate { get; set; }

        public Guid? PrepaymentID { get; set; }
    }

    public class BankTransactions : ModelList<BankTransaction>
    {
    }
}

Add PrepaymentID to bank transaction

Add PrepaymentID to bank transaction


using NUnit.Framework;
using TddCourse.CalculatorExample;

namespace TddCourse.Tests.Unit.Part08_ParameterizedTests
{
    public class Parameterized_Range
    {
        [Test]
        public void Divide_DividendIsZero_ReturnsQuotientEqualToZero(
            [Range(@from: 1, to: 5, step: 1)] double divisor)
        {
            var calc = new Calculator();
            float quotient = calc.Divide(0, divisor);

            Assert.AreEqual(0, quotient);
        }
    }
}

using NUnit.Framework;
using TddCourse.CalculatorExample;

namespace TddCourse.Tests.Unit.Part08_ParameterizedTests
{
    public class Parameterized_Range
    {
        [Test]
        public void Divide_DividendIsZero_ReturnsQuotientEqualToZero(
            [Range(@from: 1, to: 5, step: 1)] int divisor)
        {
            var calc = new Calculator();
            float quotient = calc.Divide(0, divisor);

            Assert.AreEqual(0, quotient);
        }
    }
}

Fix type in Range attribute: change from double to int

An exception was thrown while loading the test.
System.InvalidOperationException: A value of type System.Int32 (1) cannot be passed to a parameter of type System.Double.


using System;
using JetBrains.ReSharper.Plugins.Yaml.Psi.Tree;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.ExtensionsAPI.Tree;
using JetBrains.ReSharper.Psi.Parsing;
using JetBrains.ReSharper.Psi.Tree;
using JetBrains.Text;
using JetBrains.Util;

namespace JetBrains.ReSharper.Plugins.Yaml.Psi.Parsing
{
  public abstract class YamlTokenBase : BindedToBufferLeafElement, IYamlTreeNode, ITokenNode
  {
    protected YamlTokenBase(NodeType nodeType, IBuffer buffer, TreeOffset startOffset, TreeOffset endOffset)
      : base(nodeType, buffer, startOffset, endOffset)
    {
    }

    public override PsiLanguageType Language => LanguageFromParent;

    public virtual void Accept(TreeNodeVisitor visitor)
    {
      visitor.VisitNode(this);
    }

    public virtual void Accept<TContext>(TreeNodeVisitor<TContext> visitor, TContext context)
    {
      visitor.VisitNode(this, context);
    }

    public virtual TResult Accept<TContext, TResult>(TreeNodeVisitor<TContext, TResult> visitor, TContext context)
    {
      return visitor.VisitNode(this, context);
    }

    public TokenNodeType GetTokenType() => (TokenNodeType) NodeType;

    public override string ToString()
    {
      var text = GetTextAsBuffer().GetText(new TextRange(0, Math.Min(100, Length)));
      return $"{base.ToString()}(type:{NodeType}, text:{text})";
    }
  }
}

using System;
using JetBrains.ReSharper.Plugins.Yaml.Psi.Tree;
using JetBrains.ReSharper.Psi;
using JetBrains.ReSharper.Psi.ExtensionsAPI.Tree;
using JetBrains.ReSharper.Psi.Parsing;
using JetBrains.ReSharper.Psi.Tree;
using JetBrains.Text;
using JetBrains.Util;

namespace JetBrains.ReSharper.Plugins.Yaml.Psi.Parsing
{
  public abstract class YamlTokenBase : BoundToBufferLeafElement, IYamlTreeNode, ITokenNode
  {
    protected YamlTokenBase(NodeType nodeType, IBuffer buffer, TreeOffset startOffset, TreeOffset endOffset)
      : base(nodeType, buffer, startOffset, endOffset)
    {
    }

    public override PsiLanguageType Language => LanguageFromParent;

    public virtual void Accept(TreeNodeVisitor visitor)
    {
      visitor.VisitNode(this);
    }

    public virtual void Accept<TContext>(TreeNodeVisitor<TContext> visitor, TContext context)
    {
      visitor.VisitNode(this, context);
    }

    public virtual TResult Accept<TContext, TResult>(TreeNodeVisitor<TContext, TResult> visitor, TContext context)
    {
      return visitor.VisitNode(this, context);
    }

    public TokenNodeType GetTokenType() => (TokenNodeType) NodeType;

    public override string ToString()
    {
      var text = GetTextAsBuffer().GetText(new TextRange(0, Math.Min(100, Length)));
      return $"{base.ToString()}(type:{NodeType}, text:{text})";
    }
  }
}

Fix compilation after sdk api changes

Fix compilation after sdk api changes


using System;
using Foundatio.Serializer;
using Microsoft.Extensions.Logging;

namespace Foundatio {
    public class SharedOptions {
        public ISerializer Serializer { get; set; }
        public ILoggerFactory LoggerFactory { get; set; }
    }

    public class SharedOptionsBuilder<TOption, TBuilder> : OptionsBuilder<TOption>
        where TOption : SharedOptions, new()
        where TBuilder : SharedOptionsBuilder<TOption, TBuilder> {
        public TBuilder Serializer(ISerializer serializer) {
            Target.Serializer = serializer ?? throw new ArgumentNullException(nameof(serializer)); ;
            return (TBuilder)this;
        }

        public TBuilder LoggerFactory(ILoggerFactory loggerFactory) {
            Target.LoggerFactory = loggerFactory ?? throw new ArgumentNullException(nameof(loggerFactory)); ;
            return (TBuilder)this;
        }
    }
}

using System;
using Foundatio.Serializer;
using Microsoft.Extensions.Logging;

namespace Foundatio {
    public class SharedOptions {
        public ISerializer Serializer { get; set; }
        public ILoggerFactory LoggerFactory { get; set; }
    }

    public class SharedOptionsBuilder<TOption, TBuilder> : OptionsBuilder<TOption>
        where TOption : SharedOptions, new()
        where TBuilder : SharedOptionsBuilder<TOption, TBuilder> {
        public TBuilder Serializer(ISerializer serializer) {
            Target.Serializer = serializer;
            return (TBuilder)this;
        }

        public TBuilder LoggerFactory(ILoggerFactory loggerFactory) {
            Target.LoggerFactory = loggerFactory;
            return (TBuilder)this;
        }
    }
}

Allow logger and serializer to be set to null


using UnityEngine;
using UnityEngine.UI;
using System.Collections;

namespace WhoaAlgebraic
{
    public class ScoreManager : MonoBehaviour
    {
        public static int score;        // The player's score.

        Text text;                      // Reference to the Text component.

        void Awake()
        {
            // Set up the reference.
            text = GetComponent<Text>();

            // Reset the score.
            score = 0;
        }

        void Update()
        {
            // Set the displayed text to be the word "Score" followed by the score value.
            text.text = "Score: " + score;
        }
    }
}

using UnityEngine;
using UnityEngine.UI;

namespace WhoaAlgebraic
{
    public class ScoreManager : MonoBehaviour
    {
        public static int score;        // The player's score.

        public Text text;                      // Reference to the Text component.

        void Awake()
        {
            // Reset the score.
            score = 0;
        }

        void Update()
        {
            // Set the displayed text to be the word "Score" followed by the score value.
            text.text = "Score: " + score;
        }
    }
}

Update score manager to use UI's text

Update score manager to use UI's text


using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.ServiceModel;
using System.ServiceModel.Web;

namespace Samples.Glitter
{
    [ServiceContract]
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple)]
    public class StaticFilesEndpoint
    {
        [OperationContract]
        [WebInvoke(Method = "GET", UriTemplate = "/feed")]
        public Stream GetFile()
        {
            var assembly = Assembly.GetExecutingAssembly();
            var resourceName = "Samples.Glitter.feed.html";

            WebOperationContext.Current.OutgoingResponse.ContentType = "text/html";

            return assembly.GetManifestResourceStream(resourceName);
        }
    }
}

using System.Collections.Generic;
using System.IO;
using System.Reflection;
using System.ServiceModel;
using System.ServiceModel.Web;

namespace Samples.Glitter
{
    [ServiceContract]
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Multiple)]
    public class StaticFilesEndpoint
    {
        [OperationContract]
        [WebInvoke(Method = "GET", UriTemplate = "/")]
        public Stream GetFile()
        {
            var assembly = Assembly.GetExecutingAssembly();
            var resourceName = "Samples.Glitter.feed.html";

            WebOperationContext.Current.OutgoingResponse.ContentType = "text/html";

            return assembly.GetManifestResourceStream(resourceName);
        }
    }
}

Update the sample to listen on root addresses instead of a specific path.


using System;
using ClrSpy.Native;
using NUnit.Framework;

namespace ClrSpy.UnitTests.Native
{
    [TestFixture]
    public class PointerUtilsTests
    {
        [TestCase(0x07fffffffL, Int32.MaxValue)]
        [TestCase(0x080000000L, Int32.MinValue)]
        [TestCase(0x000000001L, 1)]
        [TestCase(0x000000000L, 0)]
        [TestCase(0x0ffffffffL, -1)]
        public void CastLongToIntPtr(long longValue, int int32Ptr)
        {
            Assert.That(PointerUtils.CastLongToIntPtr(longValue), Is.EqualTo(new IntPtr(int32Ptr)));
        }
    }
}

using System;
using System.Collections.Generic;
using ClrSpy.Native;
using NUnit.Framework;

namespace ClrSpy.UnitTests.Native
{
    [TestFixture]
    public class PointerUtilsTests
    {
        public static IEnumerable<LongToIntPtrCase> LongToIntPtrCases
        {
            get
            {
                yield return new LongToIntPtrCase { LongValue = 0x07fffffffL, IntPtrValue = new IntPtr(Int32.MaxValue) };
                yield return new LongToIntPtrCase { LongValue = 0x000000001L, IntPtrValue = new IntPtr(1) };
                yield return new LongToIntPtrCase { LongValue = 0x000000000L, IntPtrValue = new IntPtr(0) };

                if (IntPtr.Size == 8)
                {
                    yield return new LongToIntPtrCase { LongValue = 0x080000000L, IntPtrValue = new IntPtr(0x080000000L) };
                    yield return new LongToIntPtrCase { LongValue = 0x0ffffffffL, IntPtrValue = new IntPtr(0x0ffffffffL) };
                }
                if (IntPtr.Size == 4)
                {
                    yield return new LongToIntPtrCase { LongValue = 0x080000000L, IntPtrValue = new IntPtr(Int32.MinValue) };
                    yield return new LongToIntPtrCase { LongValue = 0x0ffffffffL, IntPtrValue = new IntPtr(-1) };
                }
            }
        }

        [TestCaseSource(nameof(LongToIntPtrCases))]
        public void CastLongToIntPtr(LongToIntPtrCase testCase)
        {
            Assert.That(PointerUtils.CastLongToIntPtr(testCase.LongValue), Is.EqualTo(testCase.IntPtrValue));
        }

        public struct LongToIntPtrCase
        {
            public long LongValue { get; set; }
            public IntPtr IntPtrValue { get; set; }
            public override string ToString() => $"{LongValue:X16} -> {IntPtrValue.ToInt64():X16}";
        }
    }
}

Fix test which is incorrect under x64, highlighted by previous commit


using System;
using System.IO;
using System.Text;
using JetBrains.Util;
using JetBrains.Util.Logging;

namespace JetBrains.ReSharper.Plugins.Unity.Yaml.Psi
{
    public static class UnityFileSystemPathExtension
    {
        private static readonly ILogger ourLogger = Logger.GetLogger("UnityFileSystemPathExtension");
        public static bool SniffYamlHeader(this FileSystemPath sourceFile)
        {
            try
            {
                var isYaml = sourceFile.ReadStream(s =>
                {
                    using (var sr = new StreamReader(s, Encoding.UTF8, true, 30))
                    {
                        var headerChars = new char[20];
                        sr.Read(headerChars, 0, headerChars.Length);
                        for (int i = 0; i < 20; i++)
                        {
                            if (headerChars[i] == '%')
                            {
                                if (headerChars[i + 1] == 'Y' && headerChars[i + 2] == 'A' &&
                                    headerChars[i + 3] == 'M' && headerChars[i + 4] == 'L')
                                {
                                    return true;
                                }

                                return false;
                            }
                        }

                        return false;
                    }
                });
                return isYaml;
            }
            catch (Exception e)
            {
                ourLogger.Error(e, "An error occurred while detecting asset's encoding");
                return false;
            }
        }
    }
}

using JetBrains.Util;

namespace JetBrains.ReSharper.Plugins.Unity.Yaml.Psi
{
    public static class UnityFileSystemPathExtension
    {
        public static bool SniffYamlHeader(this FileSystemPath sourceFile)
        {
            var isYaml = sourceFile.ReadBinaryStream(reader =>
            {
                var headerChars = new char[5];
                reader.Read(headerChars, 0, headerChars.Length);
                if (headerChars[0] == '%' && headerChars[1] == 'Y' && headerChars[2] == 'A' &&
                    headerChars[3] == 'M' && headerChars[4] == 'L')
                    return true;
                return false;
            });
            return isYaml;
        }
    }
}

Revert bom checking (unity fails too)

Revert bom checking (unity fails too)


using Newtonsoft.Json;
using System.Collections.Generic;

namespace RepoZ.Api.Common.Git
{
	public class RepositoryActionConfiguration
	{
        [JsonProperty("repository-actions")]
        public List<RepositoryAction> RepositoryActions { get; set; } = new List<RepositoryAction>();

        [JsonProperty("file-associations")]
        public List<FileAssociation> FileAssociations { get; set; } = new List<FileAssociation>();

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

            [JsonProperty("command")]
            public string Command { get; set; }

            [JsonProperty("executables")]
            public List<string> Executables { get; set; } = new List<string>();

            [JsonProperty("arguments")]
            public string Arguments { get; set; }

            [JsonProperty("keys")]
            public string Keys { get; set; }

            [JsonProperty("active")]
            public bool Active { get; set; }
        }

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

            [JsonProperty("extension")]
            public string Extension { get; set; }

            [JsonProperty("executables")]
            public List<string> Executables { get; set; } = new List<string>();

            [JsonProperty("arguments")]
            public string Arguments { get; set; }

            [JsonProperty("active")]
            public bool Active { get; set; }
        }
    }
}

using Newtonsoft.Json;
using System.Collections.Generic;

namespace RepoZ.Api.Common.Git
{
	public class RepositoryActionConfiguration
	{
        [JsonProperty("repository-actions")]
        public List<RepositoryAction> RepositoryActions { get; set; } = new List<RepositoryAction>();

        [JsonProperty("file-associations")]
        public List<FileAssociation> FileAssociations { get; set; } = new List<FileAssociation>();

        [System.Diagnostics.DebuggerDisplay("{Name}")]
        public class RepositoryAction
        {
            [JsonProperty("name")]
            public string Name { get; set; }

            [JsonProperty("command")]
            public string Command { get; set; }

            [JsonProperty("executables")]
            public List<string> Executables { get; set; } = new List<string>();

            [JsonProperty("arguments")]
            public string Arguments { get; set; }

            [JsonProperty("keys")]
            public string Keys { get; set; }

            [JsonProperty("active")]
            public bool Active { get; set; }
        }

        [System.Diagnostics.DebuggerDisplay("{Name}")]
        public class FileAssociation
        {
            [JsonProperty("name")]
            public string Name { get; set; }

            [JsonProperty("extension")]
            public string Extension { get; set; }

            [JsonProperty("executables")]
            public List<string> Executables { get; set; } = new List<string>();

            [JsonProperty("arguments")]
            public string Arguments { get; set; }

            [JsonProperty("active")]
            public bool Active { get; set; }
        }
    }
}

Add debugger display attributes for repository actions


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace NServiceMVC.Examples.Todomvc
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode,
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterGlobalFilters(GlobalFilterCollection filters)
        {
            filters.Add(new HandleErrorAttribute());
        }

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );

            routes.IgnoreRoute("");
        }

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace NServiceMVC.Examples.Todomvc
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode,
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterGlobalFilters(GlobalFilterCollection filters)
        {
            filters.Add(new HandleErrorAttribute());
        }

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("");

            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
            );
        }

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
        }
    }
}

Rearrange order of ignoreroutes call

Rearrange order of ignoreroutes call


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("Certify.Shared")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Certify.Shared")]
[assembly: AssemblyCopyright("Copyright ©  2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

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

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ed48b479-b619-4c16-afa3-83dd3cd89338")]

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

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

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

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

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ed48b479-b619-4c16-afa3-83dd3cd89338")]

// 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("3.0.0.*")]
[assembly: AssemblyFileVersion("3.0.0.0")]

Use shared project for version

Use shared project for version


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

using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transforms;

namespace osu.Game.Graphics.Sprites
{
    public class OsuSpriteText : SpriteText
    {
        public OsuSpriteText()
        {
            Shadow = true;
            Font = OsuFont.Default;
        }
    }

    public static class OsuSpriteTextTransformExtensions
    {
        /// <summary>
        /// Sets <see cref="SpriteText.Text">Text</see> to a new value after a duration.
        /// </summary>
        /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns>
        public static TransformSequence<T> TransformTextTo<T>(this T spriteText, string newText, double duration = 0, Easing easing = Easing.None)
            where T : OsuSpriteText
            => spriteText.TransformTo(nameof(OsuSpriteText.Text), newText, duration, easing);

        /// <summary>
        /// Sets <see cref="SpriteText.Text">Text</see> to a new value after a duration.
        /// </summary>
        /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns>
        public static TransformSequence<T> TransformTextTo<T>(this TransformSequence<T> t, string newText, double duration = 0, Easing easing = Easing.None)
            where T : OsuSpriteText
            => t.Append(o => o.TransformTextTo(newText, duration, easing));
    }
}

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

using osu.Framework.Graphics.Sprites;

namespace osu.Game.Graphics.Sprites
{
    public class OsuSpriteText : SpriteText
    {
        public OsuSpriteText()
        {
            Shadow = true;
            Font = OsuFont.Default;
        }
    }
}

Remove unused text transform helpers

Remove unused text transform helpers


#region

using System.Diagnostics;
using System.IO;
using DesktopWidgets.Classes;

#endregion

namespace DesktopWidgets.Helpers
{
    internal static class ProcessHelper
    {
        public static void Launch(string path, string args = "", string startIn = "",
            ProcessWindowStyle style = ProcessWindowStyle.Normal)
        {
            Launch(new ProcessFile {Path = path, Arguments = args, StartInFolder = startIn, WindowStyle = style});
        }

        public static void Launch(ProcessFile file)
        {
            Process.Start(new ProcessStartInfo
            {
                FileName = file.Path,
                Arguments = file.Arguments,
                WorkingDirectory = file.StartInFolder,
                WindowStyle = file.WindowStyle
            });
        }

        public static void OpenFolder(string path)
        {
            if (File.Exists(path) || Directory.Exists(path))
                Launch("explorer.exe", "/select," + path);
        }
    }
}

#region

using System.Diagnostics;
using System.IO;
using DesktopWidgets.Classes;

#endregion

namespace DesktopWidgets.Helpers
{
    internal static class ProcessHelper
    {
        public static void Launch(string path, string args = "", string startIn = "",
            ProcessWindowStyle style = ProcessWindowStyle.Normal)
        {
            Launch(new ProcessFile {Path = path, Arguments = args, StartInFolder = startIn, WindowStyle = style});
        }

        public static void Launch(ProcessFile file)
        {
            if (string.IsNullOrWhiteSpace(file.Path) || !File.Exists(file.Path))
                return;
            Process.Start(new ProcessStartInfo
            {
                FileName = file.Path,
                Arguments = file.Arguments,
                WorkingDirectory = file.StartInFolder,
                WindowStyle = file.WindowStyle
            });
        }

        public static void OpenFolder(string path)
        {
            if (File.Exists(path) || Directory.Exists(path))
                Launch("explorer.exe", "/select," + path);
        }
    }
}

Fix error when launching missing files

Fix error when launching missing files


#region

using System.Net;
using Tabster.Core.Data.Processing;
using Tabster.Core.Types;

#endregion

namespace Tabster.Core.Searching
{
    /// <summary>
    ///   Tab service which enables searching.
    /// </summary>
    public interface ISearchService
    {
        /// <summary>
        ///   Service name.
        /// </summary>
        string Name { get; }

        /// <summary>
        ///   Associated parser.
        /// </summary>
        ITablatureWebpageImporter Parser { get; }

        /// <summary>
        ///   Service flags.
        /// </summary>
        SearchServiceFlags Flags { get; }

        /// <summary>
        /// Proxy settings.
        /// </summary>
        WebProxy Proxy { get; }

        /// <summary>
        /// Determines whether the service supports ratings.
        /// </summary>
        bool SupportsRatings { get; }

        /// <summary>
        ///   Queries service and returns results based on search parameters.
        /// </summary>
        /// <param name="query"> Search query. </param>
        SearchResult[] Search(SearchQuery query);

        ///<summary>
        ///  Determines whether a specific TabType is supported by the service.
        ///</summary>
        ///<param name="type"> The type to check. </param>
        ///<returns> True if the type is supported by the service; otherwise, False. </returns>
        bool SupportsTabType(TabType type);
    }
}

#region

using System.Net;
using Tabster.Core.Data.Processing;
using Tabster.Core.Types;

#endregion

namespace Tabster.Core.Searching
{
    /// <summary>
    ///   Tab service which enables searching.
    /// </summary>
    public interface ISearchService
    {
        /// <summary>
        ///   Service name.
        /// </summary>
        string Name { get; }

        /// <summary>
        ///   Associated parser.
        /// </summary>
        ITablatureWebpageImporter Parser { get; }

        /// <summary>
        ///   Service flags.
        /// </summary>
        SearchServiceFlags Flags { get; }

        /// <summary>
        /// Proxy settings.
        /// </summary>
        WebProxy Proxy { get; set; }

        /// <summary>
        /// Determines whether the service supports ratings.
        /// </summary>
        bool SupportsRatings { get; }

        /// <summary>
        ///   Queries service and returns results based on search parameters.
        /// </summary>
        /// <param name="query"> Search query. </param>
        SearchResult[] Search(SearchQuery query);

        ///<summary>
        ///  Determines whether a specific TabType is supported by the service.
        ///</summary>
        ///<param name="type"> The type to check. </param>
        ///<returns> True if the type is supported by the service; otherwise, False. </returns>
        bool SupportsTabType(TabType type);
    }
}

Add setter to Proxy property.

Add setter to Proxy property.


using System.Net.Sockets;
using System.Threading.Tasks;
using RapidCore.Network;
using Xunit;

namespace RapidCore.UnitTests.Network
{
    public class HostnameToIpResolverTest
    {
        [Fact]
        public async Task HostnameToIpResolver_can_resolveAsync()
        {
            var resolver = new HostnameToIpResolver();
            var ip = await resolver.ResolveToIpv4Async("localhost");

            Assert.Equal("127.0.0.1", ip);
        }

        [Fact]
        public async Task HostnameToIpResolve_can_fail()
        {
            var resolver = new HostnameToIpResolver();
            await Assert.ThrowsAsync<SocketException>(async () => await resolver.ResolveToIpv4Async("this-host-is-invalid"));
        }
    }
}

using System.Net.Sockets;
using System.Threading.Tasks;
using RapidCore.Network;
using Xunit;

namespace RapidCore.UnitTests.Network
{
    public class HostnameToIpResolverTest
    {
        [Fact]
        public async Task HostnameToIpResolver_can_resolveAsync()
        {
            var resolver = new HostnameToIpResolver();
            var ip = await resolver.ResolveToIpv4Async("localhost");

            Assert.Equal("127.0.0.1", ip);
        }

        [Fact]
        public async Task HostnameToIpResolve_can_fail()
        {
            var resolver = new HostnameToIpResolver();
            var exception =
                await Record.ExceptionAsync(async () => await resolver.ResolveToIpv4Async("this-host-is-invalid"));
            Assert.NotNull(exception);

            Assert.IsAssignableFrom<SocketException>(exception);
        }
    }
}

Fix test assertion for hostname to ip resolver

Rather than testing that the caught exception is _of_ type SocketException
we test that it is assignable to this type - the exception thrown on niX
variants inherit from the SocketException but are not that actual type.

Stupid...


using System.Web;
using System.Web.Optimization;

namespace Borderlands2GoldendKeys
{
    public class BundleConfig
    {
        // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
        public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                        "~/Scripts/jquery-{version}.js"));

            bundles.Add(new ScriptBundle("~/bundles/jqueryunobt").Include(
                        "~/Scripts/jquery.unobtrusive-ajax.js"));

            bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                        "~/Scripts/jquery.validate*"));

            // Use the development version of Modernizr to develop with and learn from. Then, when you're
            // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
            bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                        "~/Scripts/modernizr-*"));

            bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                      "~/Scripts/bootstrap.js",
                      "~/Scripts/respond.js"));

            bundles.Add(new ScriptBundle("~/bundles/site").Include(
                      "~/Scripts/site.js"));

            bundles.Add(new ScriptBundle("~/bundles/ga").Include(
                      "~/Scripts/ga.js"));

            bundles.Add(new StyleBundle("~/Content/css").Include(
                      //"~/Content/bootstrap.css",
                      "~/Content/bootswatch.slate.min.css",
                      "~/Content/site.css"));
        }
    }
}

using System.Web;
using System.Web.Optimization;

namespace Borderlands2GoldendKeys
{
    public class BundleConfig
    {
        // For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
        public static void RegisterBundles(BundleCollection bundles)
        {
            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                        "~/Scripts/jquery-{version}.js"));

            bundles.Add(new ScriptBundle("~/bundles/jqueryunobt").Include(
                        "~/Scripts/jquery.unobtrusive-ajax.js"));

            bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                        "~/Scripts/jquery.validate*"));

            // Use the development version of Modernizr to develop with and learn from. Then, when you're
            // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
            bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                        "~/Scripts/modernizr-*"));

            bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
                      "~/Scripts/bootstrap.js",
                      "~/Scripts/respond.js"));

            bundles.Add(new ScriptBundle("~/bundles/site").Include(
                      "~/Scripts/site.js"));

            bundles.Add(new ScriptBundle("~/bundles/ga").Include(
                      "~/Scripts/ga.js"));

            bundles.Add(new StyleBundle("~/Content/css").Include(
                      "~/Content/bootswatch.slate.min.css",
                      "~/Content/site.css"));
#if !DEBUG
            BundleTable.EnableOptimizations = true;
#endif
        }
    }
}

Add bundle optimization on release

Add bundle optimization on release


using System;

namespace JoinRpg.DataModel
{
  // ReSharper disable once ClassWithVirtualMembersNeverInherited.Global (required by LINQ)
  public class ProjectAcl
  {
    public int ProjectAclId { get; set; }
    public int ProjectId { get; set; }

    public virtual Project Project { get; set; }

    public int UserId { get; set; }

    public virtual  User User { get; set; }

    public Guid Token { get; set; } = new Guid();

    public bool CanChangeFields { get; set; }

    public bool CanChangeProjectProperties { get; set; }

    public bool IsOwner { get; set; }

    public bool CanGrantRights { get; set; }

    public bool CanManageClaims { get; set; }

    public bool CanEditRoles { get; set; }
    public bool CanManageMoney { get; set; }

    public bool CanSendMassMails { get; set; }

    public bool CanManagePlots { get; set; }

    public static ProjectAcl CreateRootAcl(int userId)
    {
      return new ProjectAcl
      {
        CanChangeFields = true,
        CanChangeProjectProperties = true,
        UserId = userId,
        IsOwner = true,
        CanGrantRights =  true,
        CanManageClaims = true,
        CanEditRoles =  true,
        CanManageMoney = true,
        CanSendMassMails = true
      };
    }
  }
}

using System;

namespace JoinRpg.DataModel
{
  // ReSharper disable once ClassWithVirtualMembersNeverInherited.Global (required by LINQ)
  public class ProjectAcl
  {
    public int ProjectAclId { get; set; }
    public int ProjectId { get; set; }

    public virtual Project Project { get; set; }

    public int UserId { get; set; }

    public virtual  User User { get; set; }

    public Guid Token { get; set; } = new Guid();

    public bool CanChangeFields { get; set; }

    public bool CanChangeProjectProperties { get; set; }

    public bool IsOwner { get; set; }

    public bool CanGrantRights { get; set; }

    public bool CanManageClaims { get; set; }

    public bool CanEditRoles { get; set; }
    public bool CanManageMoney { get; set; }

    public bool CanSendMassMails { get; set; }

    public bool CanManagePlots { get; set; }

    public static ProjectAcl CreateRootAcl(int userId)
    {
      return new ProjectAcl
      {
        CanChangeFields = true,
        CanChangeProjectProperties = true,
        UserId = userId,
        IsOwner = true,
        CanGrantRights =  true,
        CanManageClaims = true,
        CanEditRoles =  true,
        CanManageMoney = true,
        CanSendMassMails = true,
        CanManagePlots = true,
      };
    }
  }
}

Add CanManagePlots on project creation

Add CanManagePlots on project creation


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

#if !WINDOWS_UWP
using Microsoft.MixedReality.Toolkit.Input;
using Microsoft.MixedReality.Toolkit.Physics;
using NUnit.Framework;
using System.Collections;
using UnityEngine;
using UnityEngine.TestTools;

namespace Microsoft.MixedReality.Toolkit.Tests.Input
{
    class DefaultRaycastProviderTest
    {
        private DefaultRaycastProvider defaultRaycastProvider;

        /// <summary>
        /// Validates that when nothing is hit, the default raycast provider doesn't throw an
        /// exception and that the MixedRealityRaycastHit is null.
        /// </summary>
        [UnityTest]
        public IEnumerator TestNoHit()
        {
            // step and layerMasks are set arbitrarily (to something which will not generate a hit).
            RayStep step = new RayStep(Vector3.zero, Vector3.up);
            LayerMask[] layerMasks = new LayerMask[] { UnityEngine.Physics.DefaultRaycastLayers };
            MixedRealityRaycastHit hitInfo;
            Assert.IsFalse(defaultRaycastProvider.Raycast(step, layerMasks, out hitInfo));
            Assert.IsFalse(hitInfo.raycastValid);
            yield return null;
        }

        [SetUp]
        public void SetUp()
        {
            TestUtilities.InitializeMixedRealityToolkitAndCreateScenes(true);
            TestUtilities.InitializePlayspace();
            defaultRaycastProvider = new DefaultRaycastProvider(null, null, null);
        }

        [TearDown]
        public void TearDown()
        {
            TestUtilities.ShutdownMixedRealityToolkit();
        }
    }
}
#endif

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

#if !WINDOWS_UWP
using Microsoft.MixedReality.Toolkit.Input;
using Microsoft.MixedReality.Toolkit.Physics;
using NUnit.Framework;
using System.Collections;
using UnityEngine;
using UnityEngine.TestTools;

namespace Microsoft.MixedReality.Toolkit.Tests.Input
{
    class DefaultRaycastProviderTest
    {
        private DefaultRaycastProvider defaultRaycastProvider;

        /// <summary>
        /// Validates that when nothing is hit, the default raycast provider doesn't throw an
        /// exception and that the MixedRealityRaycastHit is null.
        /// </summary>
        [UnityTest]
        public IEnumerator TestNoHit()
        {
            // step and layerMasks are set arbitrarily (to something which will not generate a hit).
            RayStep step = new RayStep(Vector3.zero, Vector3.up);
            LayerMask[] layerMasks = new LayerMask[] { UnityEngine.Physics.DefaultRaycastLayers };
            MixedRealityRaycastHit hitInfo;
            Assert.IsFalse(defaultRaycastProvider.Raycast(step, layerMasks, out hitInfo));
            Assert.IsFalse(hitInfo.raycastValid);
            yield return null;
        }

        [SetUp]
        public void SetUp()
        {
            PlayModeTestUtilities.Setup();
            defaultRaycastProvider = new DefaultRaycastProvider(null, null, null);
        }

        [TearDown]
        public void TearDown()
        {
            PlayModeTestUtilities.TearDown();
        }
    }
}
#endif

Change raycast provider tests to use PlaymodeTestUtilities instead of TestUtilities


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

namespace Benchmarking
{
    /// <summary>
    /// Saga repository only for benchmarking.
    /// Does not really store anything
    /// </summary>
    internal class FastSagaRepository : ISagaRepository
    {
        private readonly ISagaFactory sagaFactory;

        public FastSagaRepository(ISagaFactory sagaFactory)
        {
            this.sagaFactory = sagaFactory;
        }

        public TSaga Find<TSaga>(Guid correlationId) where TSaga : class
        {
            if (correlationId == Program.FirstGuid)
            {
                return null;
            }

            var saga = sagaFactory.Resolve<TSaga>();
            Reflection.Set(saga, "CorrelationId", correlationId);

            return saga;
        }

        public void Save<TSaga>(TSaga saga) where TSaga : class
        {
            // nothing
        }

        public void Complete<TSaga>(TSaga saga) where TSaga : class
        {
            // nothing
        }

        public void Complete(Guid correlationId)
        {
            // nothing
        }
    }
}

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

namespace Benchmarking
{
    /// <summary>
    /// Saga repository only for benchmarking.
    /// Does not really store anything
    /// </summary>
    internal class FastSagaRepository : ISagaRepository
    {
        private readonly ISagaFactory sagaFactory;

        public FastSagaRepository(ISagaFactory sagaFactory)
        {
            this.sagaFactory = sagaFactory;
        }

        public TSaga Find<TSaga>(Guid correlationId) where TSaga : class, IAccessibleSaga
        {
            if (correlationId == Program.FirstGuid)
            {
                return null;
            }

            var saga = sagaFactory.ResolveSaga<TSaga>();
            Reflection.Set(saga, "CorrelationId", correlationId);

            return saga;
        }

        public void Save<TSaga>(TSaga saga) where TSaga : class, IAccessibleSaga
        {
            // nothing
        }

        public void Complete<TSaga>(TSaga saga) where TSaga : class, IAccessibleSaga
        {
            // nothing
        }

        public void Complete(Guid correlationId)
        {
            // nothing
        }
    }
}

Fix build error after merge

Fix build error after merge


using System;
using System.ComponentModel;
using System.Windows;
using DesktopWidgets.Classes;

namespace DesktopWidgets.Actions
{
    public abstract class ActionBase
    {
        [DisplayName("Delay")]
        public TimeSpan Delay { get; set; } = TimeSpan.FromSeconds(0);

        public void Execute()
        {
            DelayedAction.RunAction((int) Delay.TotalMilliseconds, () =>
            {
                try
                {
                    ExecuteAction();
                }
                catch (Exception ex)
                {
                    Popup.ShowAsync($"{GetType().Name} failed to execute.\n\n{ex.Message}", image: MessageBoxImage.Error);
                }
            });
        }

        public virtual void ExecuteAction()
        {
        }
    }
}

using System;
using System.ComponentModel;
using System.Windows;
using DesktopWidgets.Classes;

namespace DesktopWidgets.Actions
{
    public abstract class ActionBase
    {
        [DisplayName("Delay")]
        public TimeSpan Delay { get; set; } = TimeSpan.FromSeconds(0);

        [DisplayName("Show Errors")]
        public bool ShowErrors { get; set; } = false;

        public void Execute()
        {
            DelayedAction.RunAction((int) Delay.TotalMilliseconds, () =>
            {
                try
                {
                    ExecuteAction();
                }
                catch (Exception ex)
                {
                    if (ShowErrors)
                        Popup.ShowAsync($"{GetType().Name} failed to execute.\n\n{ex.Message}",
                            image: MessageBoxImage.Error);
                }
            });
        }

        public virtual void ExecuteAction()
        {
        }
    }
}

Add action "Show Error" option

Add action "Show Error" option


using ApprovalTests.Reporters;
using Gibberish.AST._1_Bare;
using Gibberish.Parsing;
using Gibberish.Tests.ZzTestHelpers;
using NUnit.Framework;

namespace Gibberish.Tests.RecognizeBlockSyntax
{
	[TestFixture]
	public class InterpretWholeFile
	{
		[Test, UseReporter(typeof(QuietReporter))]
		public void should_accept_multiple_language_constructs()
		{
			var subject = new RecognizeBlocks();
			var input = @"
using language fasm

define.thunk some.name:
	pass

define.thunk other.name:
	pass
";
			var result = subject.GetMatch(input, subject.WholeFile);
			//ApprovalTests.Approvals.VerifyJson(result.PrettyPrint());
			result.Should()
				.BeRecognizedAs(
					BasicAst.Statement("using language fasm"),
					BasicAst.Block("define.thunk some.name")
						.WithBody(b => b.AddStatement("pass")),
					BasicAst.Block("define.thunk other.name")
						.WithBody(b => b.AddStatement("pass")));
		}
	}
}

using ApprovalTests.Reporters;
using Gibberish.AST._1_Bare;
using Gibberish.Parsing;
using Gibberish.Tests.ZzTestHelpers;
using NUnit.Framework;

namespace Gibberish.Tests.RecognizeBlockSyntax
{
	[TestFixture]
	public class InterpretWholeFile
	{
		[Test]
		public void should_accept_multiple_language_constructs()
		{
			var subject = new RecognizeBlocks();
			var input = @"
using language fasm

define.thunk some.name:
	pass

define.thunk other.name:
	pass
";
			var result = subject.GetMatch(input, subject.WholeFile);
			result.Should()
				.BeRecognizedAs(
					BasicAst.Statement("using language fasm"),
					BasicAst.Block("define.thunk some.name")
						.WithBody(b => b.AddStatement("pass")),
					BasicAst.Block("define.thunk other.name")
						.WithBody(b => b.AddStatement("pass")));
		}
	}
}

Clean up some use of Approval tests.

Clean up some use of Approval tests.


namespace MultiMiner.MobileMiner.Api
{
    public class RemoteCommand
    {
        public int Id { get; set; }
        public string CommandText { get; set; }
    }
}

using System;

namespace MultiMiner.MobileMiner.Api
{
    public class RemoteCommand
    {
        public int Id { get; set; }
        public string CommandText { get; set; }
        public DateTime CommandDate { get; set; }
    }
}

Add CommandDate so it is deserialized from the JSON response


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

namespace PCLTesting.Infrastructure
{
	public class TestDiscoverer
	{

		public IEnumerable<Test> DiscoverTests(Assembly assembly)
		{
			List<Test> ret = new List<Test>();

			foreach (Type type in assembly.GetExportedTypes())
			{
				ret.AddRange(DiscoverTests(type));
			}

			return ret;
		}

		public IEnumerable<Test> DiscoverTests(Type type)
		{
			List<Test> ret = new List<Test>();
			foreach (MethodInfo method in type.GetMethods())
			{
				if (method.GetCustomAttributes(false).Any(
                    attr => attr.GetType().Name == "TestMethodAttribute"))
				{
					var test = new Test(method);
					ret.Add(test);
				}

			}
			return ret;
		}

	}
}

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

namespace PCLTesting.Infrastructure
{
	public class TestDiscoverer
	{

		public IEnumerable<Test> DiscoverTests(Assembly assembly)
		{
			List<Test> ret = new List<Test>();

			foreach (Type type in assembly.GetExportedTypes().Where(t => !t.IsAbstract))
			{
				ret.AddRange(DiscoverTests(type));
			}

			return ret;
		}

		public IEnumerable<Test> DiscoverTests(Type type)
		{
			List<Test> ret = new List<Test>();
			foreach (MethodInfo method in type.GetMethods())
			{
				if (method.GetCustomAttributes(false).Any(
                    attr => attr.GetType().Name == "TestMethodAttribute"))
				{
					var test = new Test(method);
					ret.Add(test);
				}

			}
			return ret;
		}

	}
}

Test discovery skips over abstract base classes.

Fixes #1


using RocketGPS.GPSMath;
using RocketGPS.Model;
using RocketGPSMath.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RocketGPSMath.GPSMath
{
    public class RegionTriangulator
    {
        public List<GPSCoordinateBearing> reports;

        public RegionTriangulator()
        {

        }

        public RegionTriangulator(List<GPSCoordinateBearing> reports)
        {
            this.reports = reports;
        }

        //Should return number of coordinates where N > 1, Count = N(N-1)/2
        //Returns bunch of GPS points to represent the region triangulated.
        public List<GPSCoordinate> Triangulate()
        {
            if (reports == null || reports.Count < 2)
                return null;

            List<GPSCoordinate> resultingRegion = new List<GPSCoordinate>();

            for (int i = 0; i < reports.Count; ++i)
            {
                var currReport = reports[i];

                for(int j = i + 1; j < reports.Count; ++j)
                {
                    var otherReport = reports[j];
                    var res = GPSMathProcessor.Get().CalculateIntersection(currReport, otherReport);
                    resultingRegion.Add(res);
                }
            }

            return resultingRegion;
        }

    }
}

using RocketGPS.GPSMath;
using RocketGPS.Model;
using RocketGPSMath.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RocketGPSMath.GPSMath
{
    public class RegionTriangulator
    {
        public List<GPSCoordinateBearing> reports;

        public RegionTriangulator()
        {

        }

        public RegionTriangulator(List<GPSCoordinateBearing> reports)
        {
            this.reports = reports;
        }

        //Should return number of coordinates where N > 1, Count = N(N-1)/2
        //Returns bunch of GPS points to represent the region triangulated.
        public List<GPSCoordinate> Triangulate()
        {
            if (reports == null || reports.Count < 2)
                return null;

            List<GPSCoordinate> resultingRegion = new List<GPSCoordinate>();

            for (int i = 0; i < reports.Count; ++i)
            {
                var currReport = reports[i];

                for(int j = i + 1; j < reports.Count; ++j)
                {
                    var otherReport = reports[j];
                    var res = GPSMathProcessor.Get().CalculateIntersection(currReport, otherReport);

                    //Only add if the intersection point distance to both reporters are below 20KM distance
                    if(res.DistanceTo(currReport) < 20 && res.DistanceTo(otherReport) < 20)
                        resultingRegion.Add(res);
                }
            }

            return resultingRegion;
        }

    }
}

Update triangulator to accept point if at certain distance from reporters


using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using LearnositySDK.Request;
using LearnositySDK.Utils;
// static LearnositySDK.Credentials;

namespace LearnosityDemo.Pages
{
    public class ItemsAPIDemoModel : PageModel
    {
        public void OnGet()
        {
            // prepare all the params
            string service = "items";

            JsonObject security = new JsonObject();
            security.set("consumer_key", LearnositySDK.Credentials.ConsumerKey);
            security.set("domain", LearnositySDK.Credentials.Domain);
            security.set("user_id", Uuid.generate());
            string secret = LearnositySDK.Credentials.ConsumerSecret;

            JsonObject config = new JsonObject();
            JsonObject request = new JsonObject();
            request.set("user_id", Uuid.generate());
            request.set("activity_template_id", "quickstart_examples_activity_template_001");
            request.set("session_id", Uuid.generate());
            request.set("activity_id", "quickstart_examples_activity_001");
            request.set("rendering_type", "assess");
            request.set("type", "submit_practice");
            request.set("name", "Items API Quickstart");
            request.set("config", config);

            // Instantiate Init class
            Init init = new Init(service, security, secret, request);

            // Call the generate() method to retrieve a JavaScript object
            ViewData["InitJSON"] = init.generate();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using LearnositySDK.Request;
using LearnositySDK.Utils;
// static LearnositySDK.Credentials;

namespace LearnosityDemo.Pages
{
    public class ItemsAPIDemoModel : PageModel
    {
        public void OnGet()
        {
            // prepare all the params
            string service = "items";

            JsonObject security = new JsonObject();
            security.set("consumer_key", LearnositySDK.Credentials.ConsumerKey);
            security.set("domain", LearnositySDK.Credentials.Domain);
            security.set("user_id", Uuid.generate());
            string secret = LearnositySDK.Credentials.ConsumerSecret;

            //JsonObject config = new JsonObject();
            JsonObject request = new JsonObject();
            request.set("user_id", Uuid.generate());
            request.set("activity_template_id", "quickstart_examples_activity_template_001");
            request.set("session_id", Uuid.generate());
            request.set("activity_id", "quickstart_examples_activity_001");
            request.set("rendering_type", "assess");
            request.set("type", "submit_practice");
            request.set("name", "Items API Quickstart");
            //request.set("config", config);

            // Instantiate Init class
            Init init = new Init(service, security, secret, request);

            // Call the generate() method to retrieve a JavaScript object
            ViewData["InitJSON"] = init.generate();
        }
    }
}

[DOC] Remove unused code from quick-start guide example project.