using System;
using UnityEditor;
using UnityEngine;

namespace Alensia.Core.UI
{
    public static class ComponentFactory
    {
        [MenuItem("GameObject/UI/Alensia/Button", false, 10)]
        public static Button CreateButton(MenuCommand command) => CreateComponent(command, Button.CreateInstance);

        [MenuItem("GameObject/UI/Alensia/Dropdown", false, 10)]
        public static Dropdown CreateDropdown(MenuCommand command) => CreateComponent(command, Dropdown.CreateInstance);

        [MenuItem("GameObject/UI/Alensia/Label", false, 10)]
        public static Label CreateLabel(MenuCommand command) => CreateComponent(command, Label.CreateInstance);

        [MenuItem("GameObject/UI/Alensia/Panel", false, 10)]
        public static Panel CreatePanel(MenuCommand command) => CreateComponent(command, Panel.CreateInstance);

        [MenuItem("GameObject/UI/Alensia/Slider", false, 10)]
        public static Slider CreateSlider(MenuCommand command) => CreateComponent(command, Slider.CreateInstance);

        [MenuItem("GameObject/UI/Alensia/Scroll Panel", false, 10)]
        public static ScrollPanel CreateScrollPanel(MenuCommand command) => CreateComponent(command, ScrollPanel.CreateInstance);

        private static T CreateComponent<T>(
            MenuCommand command, Func<T> factory) where T : UIComponent
        {
            var component = factory.Invoke();

            GameObjectUtility.SetParentAndAlign(
                component.gameObject, command.context as GameObject);

            Undo.RegisterCreatedObjectUndo(component, "Create " + component.name);

            Selection.activeObject = component;

            return component;
        }
    }
}

using System;
using UnityEditor;
using UnityEngine;

namespace Alensia.Core.UI
{
    public static class ComponentFactory
    {
        [MenuItem("GameObject/UI/Alensia/Label", false, 10)]
        public static Label CreateLabel(MenuCommand command) => CreateComponent(command, Label.CreateInstance);

        [MenuItem("GameObject/UI/Alensia/Button", false, 10)]
        public static Button CreateButton(MenuCommand command) => CreateComponent(command, Button.CreateInstance);

        [MenuItem("GameObject/UI/Alensia/Dropdown", false, 10)]
        public static Dropdown CreateDropdown(MenuCommand command) => CreateComponent(command, Dropdown.CreateInstance);

        [MenuItem("GameObject/UI/Alensia/Slider", false, 10)]
        public static Slider CreateSlider(MenuCommand command) => CreateComponent(command, Slider.CreateInstance);

        [MenuItem("GameObject/UI/Alensia/Panel", false, 10)]
        public static Panel CreatePanel(MenuCommand command) => CreateComponent(command, Panel.CreateInstance);

        [MenuItem("GameObject/UI/Alensia/Scroll Panel", false, 10)]
        public static ScrollPanel CreateScrollPanel(MenuCommand command) => CreateComponent(command, ScrollPanel.CreateInstance);

        private static T CreateComponent<T>(
            MenuCommand command, Func<T> factory) where T : UIComponent
        {
            var component = factory.Invoke();

            GameObjectUtility.SetParentAndAlign(
                component.gameObject, command.context as GameObject);

            Undo.RegisterCreatedObjectUndo(component, "Create " + component.name);

            Selection.activeObject = component;

            return component;
        }
    }
}

Rearrange UI menu according to component types


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

namespace Eco.Variables
{
    public class PublicIpVariable : IVariableProvider
    {
        public Dictionary<string, Func<string>> GetVariables()
        {
            return new Dictionary<string, Func<string>>()
            {
                { "publicIp", () => new WebClient().DownloadString("http://icanhazip.com").Trim() }
            };
        }
    }
}

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

namespace Eco.Variables
{
    public class PublicIpVariable : IVariableProvider
    {
        string _lastIp;
        DateTime _lastUpdate;

        public Dictionary<string, Func<string>> GetVariables()
        {
            var now = DateTime.Now;
            if (now -  _lastUpdate > TimeSpan.FromMinutes(1))
            {
                _lastIp = new WebClient().DownloadString("http://icanhazip.com").Trim();
                _lastUpdate = now;
            }
            return new Dictionary<string, Func<string>>()
            {
                { "publicIp", () => _lastIp }
            };
        }
    }
}

Refresh IP address not often than 1 time per minute.


using Andromeda2D.Entities;
using Andromeda2D.Entities.Components;
using Andromeda2D.Entities.Components.Internal;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Andromeda.Entities.Components
{

    /// <summary>
    /// A controller for a model
    /// </summary>
    /// <typeparam name="TModel">The model type</typeparam>
    public abstract class Controller<TModel> : Component
        where  TModel : IModel
    {
        Entity _entity;

        /// <summary>
        /// Sets the model of the controller
        /// </summary>
        /// <param name="model">The model to set to this controller</param>
        protected void SetControllerModel(TModel model)
        {
            this._model = model;
        }

        private TModel _model;

        /// <summary>
        /// The model of this controller
        /// </summary>
        public TModel Model
        {
            get => _model;
        }

        public abstract void InitModel();

        public override void OnComponentInit(Entity entity)
        {
            InitModel();
        }
    }
}

using Andromeda2D.Entities;
using Andromeda2D.Entities.Components;
using Andromeda2D.Entities.Components.Internal;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Andromeda.Entities.Components
{

    /// <summary>
    /// A controller for a model
    /// </summary>
    /// <typeparam name="TModel">The model type</typeparam>
    public abstract class Controller<TModel> : Component
        where  TModel : IModel
    {
        Entity _entity;

        /// <summary>
        /// Sets the model of the controller
        /// </summary>
        /// <param name="model">The model to set to this controller</param>
        protected void SetControllerModel(TModel model)
        {
            this._model = model;
        }

        private TModel _model;

        /// <summary>
        /// The model of this controller
        /// </summary>
        public TModel Model
        {
            get => _model;
        }

        protected abstract void InitModel();

        public override void OnComponentInit(Entity entity)
        {
            InitModel();
        }
    }
}

Change InitModel from public to protected

No reason for it to be public.


using System;
using System.ServiceModel;

namespace MultiMiner.Remoting.Server
{
    public class RemotingServer
    {
        private bool serviceStarted = false;
        private ServiceHost myServiceHost = null;

        public void Startup()
        {
            Uri baseAddress = new Uri("net.tcp://localhost:" + Config.RemotingPort + "/RemotingService");

            NetTcpBinding binding = new NetTcpBinding(SecurityMode.None);

            myServiceHost = new ServiceHost(typeof(RemotingService), baseAddress);
            myServiceHost.AddServiceEndpoint(typeof(IRemotingService), binding, baseAddress);

            myServiceHost.Open();

            serviceStarted = true;
        }

        public void Shutdown()
        {
            myServiceHost.Close();
            myServiceHost = null;
            serviceStarted = false;
        }
    }
}

using System;
using System.ServiceModel;

namespace MultiMiner.Remoting.Server
{
    public class RemotingServer
    {
        private bool serviceStarted = false;
        private ServiceHost myServiceHost = null;

        public void Startup()
        {
            Uri baseAddress = new Uri("net.tcp://localhost:" + Config.RemotingPort + "/RemotingService");

            NetTcpBinding binding = new NetTcpBinding(SecurityMode.None);

            myServiceHost = new ServiceHost(typeof(RemotingService), baseAddress);
            myServiceHost.AddServiceEndpoint(typeof(IRemotingService), binding, baseAddress);

            myServiceHost.Open();

            serviceStarted = true;
        }

        public void Shutdown()
        {
            if (!serviceStarted)
                return;

            myServiceHost.Close();
            myServiceHost = null;
            serviceStarted = false;
        }
    }
}

Fix a null ref error

Fix a null ref error


using System;
using Gtk;

namespace VideoAggregator
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			Application.Init ();
			MainWindow win = new MainWindow ();
			win.Show ();
			Application.Run ();

		}
	}
}

using System;
using Gtk;

namespace VideoAggregator
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			Application.Init ();
			MainWindow win = new MainWindow ();
			win.Maximize ();
			win.Show ();
			Application.Run ();

		}
	}
}

Make program maximized on start

Make program maximized on start


using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CuberLib
{
    public class ImageTile
    {
        private Image image;
        private Size size;

        public ImageTile(string inputFile, int xSize, int ySize)
        {
            if (!File.Exists(inputFile)) throw new FileNotFoundException();

            image = Image.FromFile(inputFile);
            size = new Size(xSize, ySize);
        }

        public void GenerateTiles(string outputPath)
        {
            int xMax = image.Width;
            int yMax = image.Height;
            int tileWidth = xMax / size.Width;
            int tileHeight = yMax / size.Height;

            for (int x = 0; x < size.Width; x++)
            {
                for (int y = 0; y < size.Height; y++)
                {
                    string outputFileName = Path.Combine(outputPath, string.Format("{0}_{1}.jpg", x, y));

                    Rectangle tileBounds = new Rectangle(x * tileWidth, y * tileHeight, tileWidth, tileHeight);
                    Bitmap target = new Bitmap(tileWidth, tileHeight);

                    using (Graphics graphics = Graphics.FromImage(target))
                    {
                        graphics.DrawImage(
                            image,
                            new Rectangle(0, 0, tileWidth, tileHeight),
                            tileBounds,
                            GraphicsUnit.Pixel);
                    }

                    target.Save(outputFileName, ImageFormat.Jpeg);
                }
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CuberLib
{
    public class ImageTile
    {
        private Image image;
        private Size size;

        public ImageTile(string inputFile, int xSize, int ySize)
        {
            if (!File.Exists(inputFile)) throw new FileNotFoundException();

            image = Image.FromFile(inputFile);
            size = new Size(xSize, ySize);
        }

        public void GenerateTiles(string outputPath)
        {
            int xMax = image.Width;
            int yMax = image.Height;
            int tileWidth = xMax / size.Width;
            int tileHeight = yMax / size.Height;

			if (!Directory.Exists(outputPath)) { Directory.CreateDirectory(outputPath); }

			for (int x = 0; x < size.Width; x++)
            {
                for (int y = 0; y < size.Height; y++)
                {
                    string outputFileName = Path.Combine(outputPath, string.Format("{0}_{1}.jpg", x, y));

                    Rectangle tileBounds = new Rectangle(x * tileWidth, y * tileHeight, tileWidth, tileHeight);
                    Bitmap target = new Bitmap(tileWidth, tileHeight);

                    using (Graphics graphics = Graphics.FromImage(target))
                    {
                        graphics.DrawImage(
                            image,
                            new Rectangle(0, 0, tileWidth, tileHeight),
                            tileBounds,
                            GraphicsUnit.Pixel);
                    }

                    target.Save(outputFileName, ImageFormat.Jpeg);
                }
            }
        }
    }
}

Create output directory if needed for jpg slicing.


using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace BatteryCommander.Web.Models
{
    public class Vehicle
    {
        [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }

        [Required]
        public int UnitId { get; set; }

        public virtual Unit Unit { get; set; }

        // Notes, What's broken about it?

        [Required]
        public VehicleStatus Status { get; set; } = VehicleStatus.FMC;

        [Required, StringLength(10)]
        public String Bumper { get; set; }

        [Required]
        public VehicleType Type { get; set; } = VehicleType.HMMWV;

        // public String Registration { get; set; }

        // public String Serial { get; set; }

        [Required]
        public int Seats { get; set; } = 2;

        // TroopCapacity?

        // Chalk Order?

        // LIN?

        // Fuel Card? Towbar? Water Buffalo?

        // Fuel Level?

        // Driver, A-Driver, Passengers, Assigned Section?

        public enum VehicleType : byte
        {
            HMMWV = 0,

            MTV = 1
        }

        public enum VehicleStatus : byte
        {
            Unknown = 0,

            FMC = 1,

            NMC = byte.MaxValue
        }
    }
}

using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace BatteryCommander.Web.Models
{
    public class Vehicle
    {
        [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }

        [Required]
        public int UnitId { get; set; }

        public virtual Unit Unit { get; set; }

        // Notes, What's broken about it?

        [Required]
        public VehicleStatus Status { get; set; } = VehicleStatus.FMC;

        [Required, StringLength(10)]
        public String Bumper { get; set; }

        [Required]
        public VehicleType Type { get; set; } = VehicleType.HMMWV;

        // public String Registration { get; set; }

        // public String Serial { get; set; }

        [Required]
        public int Seats { get; set; } = 2;

        // TroopCapacity?

        // Chalk Order?

        // LIN?

        // Fuel Card? Towbar? Water Buffalo?

        // Fuel Level?

        // Driver, A-Driver, Passengers, Assigned Section?

        // Has JBC-P?

        public enum VehicleType : byte
        {
            HMMWV = 0,

            MTV = 1
        }

        public enum VehicleStatus : byte
        {
            Unknown = 0,

            FMC = 1,

            NMC = byte.MaxValue
        }
    }
}

Add note about things to add for vehicles


using System;
using SocialToolBox.Core.Database;
using SocialToolBox.Core.Database.Serialization;
using SocialToolBox.Crm.Contact.Event;

namespace SocialToolBox.Sample.Web
{
    /// <summary>
    /// Data initially available in the system.
    /// </summary>
    public static class InitialData
    {
        public static readonly Id UserVictorNicollet = Id.Parse("aaaaaaaaaaa");
        public static readonly Id ContactBenjaminFranklin = Id.Parse("aaaaaaaaaab");

        /// <summary>
        /// Generates sample data.
        /// </summary>
        public static void AddTo(SocialModules modules)
        {
            var t = modules.Database.OpenReadWriteCursor();
            AddContactsTo(modules, t);
        }

        /// <summary>
        /// Generates sample contacts.
        /// </summary>
        private static void AddContactsTo(SocialModules modules, ICursor t)
        {
            foreach (var ev in new IContactEvent[]
            {
                new ContactCreated(ContactBenjaminFranklin, DateTime.Parse("2013/09/26"),UserVictorNicollet),
                new ContactNameUpdated(ContactBenjaminFranklin, DateTime.Parse("2013/09/26"),UserVictorNicollet,"Benjamin","Franklin"),
            }) modules.Contacts.Stream.AddEvent(ev, t);
        }
    }
}

using System;
using SocialToolBox.Core.Database;
using SocialToolBox.Crm.Contact.Event;

namespace SocialToolBox.Sample.Web
{
    /// <summary>
    /// Data initially available in the system.
    /// </summary>
    public static class InitialData
    {
        public static readonly Id UserVictorNicollet = Id.Parse("aaaaaaaaaaa");
        public static readonly Id ContactBenjaminFranklin = Id.Parse("aaaaaaaaaab");
        public static readonly Id ContactJuliusCaesar = Id.Parse("aaaaaaaaaac");

        /// <summary>
        /// Generates sample data.
        /// </summary>
        public static void AddTo(SocialModules modules)
        {
            var t = modules.Database.OpenReadWriteCursor();
            AddContactsTo(modules, t);
        }

        /// <summary>
        /// Generates sample contacts.
        /// </summary>
        private static void AddContactsTo(SocialModules modules, ICursor t)
        {
            foreach (var ev in new IContactEvent[]
            {
                new ContactCreated(ContactBenjaminFranklin, DateTime.Parse("2013/09/26"),UserVictorNicollet),
                new ContactNameUpdated(ContactBenjaminFranklin, DateTime.Parse("2013/09/26"),UserVictorNicollet,"Benjamin","Franklin"),
                new ContactCreated(ContactJuliusCaesar, DateTime.Parse("2013/09/27"),UserVictorNicollet),
                new ContactNameUpdated(ContactJuliusCaesar, DateTime.Parse("2013/09/27"),UserVictorNicollet,"Julius","Caesar")
            }) modules.Contacts.Stream.AddEvent(ev, t);
        }
    }
}

Add a second contact to initial sample data


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

#nullable enable

using System.Collections.Generic;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Scoring;
using osu.Game.Screens.Play;
using osu.Game.Tests.Beatmaps;

namespace osu.Game.Tests.Gameplay
{
    /// <summary>
    /// Static class providing a <see cref="Create"/> convenience method to retrieve a correctly-initialised <see cref="GameplayState"/> instance in testing scenarios.
    /// </summary>
    public static class TestGameplayState
    {
        /// <summary>
        /// Creates a correctly-initialised <see cref="GameplayState"/> instance for use in testing.
        /// </summary>
        public static GameplayState Create(Ruleset ruleset, IReadOnlyList<Mod>? mods = null, Score? score = null)
        {
            var beatmap = new TestBeatmap(ruleset.RulesetInfo);
            var workingBeatmap = new TestWorkingBeatmap(beatmap);
            var playableBeatmap = workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo, mods);

            return new GameplayState(playableBeatmap, ruleset, mods, score);
        }
    }
}

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

#nullable enable

using System.Collections.Generic;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Scoring;
using osu.Game.Screens.Play;
using osu.Game.Tests.Beatmaps;

namespace osu.Game.Tests.Gameplay
{
    /// <summary>
    /// Static class providing a <see cref="Create"/> convenience method to retrieve a correctly-initialised <see cref="GameplayState"/> instance in testing scenarios.
    /// </summary>
    public static class TestGameplayState
    {
        /// <summary>
        /// Creates a correctly-initialised <see cref="GameplayState"/> instance for use in testing.
        /// </summary>
        public static GameplayState Create(Ruleset ruleset, IReadOnlyList<Mod>? mods = null, Score? score = null)
        {
            var beatmap = new TestBeatmap(ruleset.RulesetInfo);
            var workingBeatmap = new TestWorkingBeatmap(beatmap);
            var playableBeatmap = workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo, mods);

            var scoreProcessor = ruleset.CreateScoreProcessor();
            scoreProcessor.ApplyBeatmap(playableBeatmap);

            return new GameplayState(playableBeatmap, ruleset, mods, score, scoreProcessor);
        }
    }
}

Fix tests by creating a score processor

Fix tests by creating a score processor


using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CodeBreaker.Core;
using CodeBreaker.Core.Storage;
using Microsoft.EntityFrameworkCore;

namespace CodeBreaker.WebApp.Storage
{
    public class ScoreStore : IScoreStore
    {
        private readonly CodeBreakerDbContext _dbContext;
        public ScoreStore(CodeBreakerDbContext dbContext)
        {
            _dbContext = dbContext;
        }

        public async Task<Score[]> GetScores(int page, int size)
        {
            return (await _dbContext.Scores.ToListAsync())
                .OrderBy(s => s.Attempts)
                .ThenBy(s => s.Duration)
                .Skip(page * size).Take(size)
                .ToArray();
        }

        public async Task SaveScore(Score score)
        {
            await _dbContext.Scores.AddAsync(score);
            await _dbContext.SaveChangesAsync();
        }

        public Task<bool> ScoreExists(Guid gameId)
        {
           return _dbContext.Scores.AnyAsync(s => s.GameId == gameId);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using CodeBreaker.Core;
using CodeBreaker.Core.Storage;
using Microsoft.EntityFrameworkCore;

namespace CodeBreaker.WebApp.Storage
{
    public class ScoreStore : IScoreStore
    {
        private readonly CodeBreakerDbContext _dbContext;
        public ScoreStore(CodeBreakerDbContext dbContext)
        {
            _dbContext = dbContext;
        }

        public Task<Score[]> GetScores(int page, int size)
        {
            return _dbContext.Scores
                .OrderBy(s => s.Attempts)
                .ThenBy(s => s.Duration)
                .Skip(page * size).Take(size)
                .ToArrayAsync();
        }

        public async Task SaveScore(Score score)
        {
            await _dbContext.Scores.AddAsync(score);
            await _dbContext.SaveChangesAsync();
        }

        public Task<bool> ScoreExists(Guid gameId)
        {
           return _dbContext.Scores.AnyAsync(s => s.GameId == gameId);
        }
    }
}

Fix for slow high score loading

Fix for slow high score loading


using System;
using System.Collections.Generic;
using Glimpse.Web;
using Microsoft.Framework.DependencyInjection;

namespace Glimpse
{
    public class GlimpseWebServices
    {
        public static IServiceCollection GetDefaultServices()
        {
            var services = new ServiceCollection();

            services.AddTransient<IRequestAuthorizerProvider, DefaultRequestAuthorizerProvider>();
            services.AddTransient<IRequestHandlerProvider, DefaultRequestHandlerProvider>();

            return services;
        }
    }
}

using System;
using System.Collections.Generic;
using Glimpse.Web;
using Microsoft.Framework.DependencyInjection;

namespace Glimpse
{
    public class GlimpseWebServices
    {
        public static IServiceCollection GetDefaultServices()
        {
            var services = new ServiceCollection();

            services.AddTransient<IRequestAuthorizerProvider, DefaultRequestAuthorizerProvider>();
            services.AddTransient<IRequestHandlerProvider, DefaultRequestHandlerProvider>();
            services.AddTransient<IRequestRuntimeProvider, DefaultRequestRuntimeProvider>();

            return services;
        }
    }
}

Add default RequestRuntime to service registration


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("SIM.Telemetry")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SIM.Telemetry")]
[assembly: AssemblyCopyright("Copyright ©  2019")]
[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("b91b2024-3f75-4df7-8dcc-111fb5ccaf5d")]

// 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("SIM.Telemetry")]
[assembly: AssemblyDescription("'SIM.Telemetry' is used to track Sitecore Instance Manager utilisation statistics")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SIM.Telemetry")]
[assembly: AssemblyCopyright("Copyright ©  2019")]
[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("b91b2024-3f75-4df7-8dcc-111fb5ccaf5d")]

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

Add AssemblyDescription to SIM.Telemetry project


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

namespace Nest.Tests.Unit
{
	public static class JsonExtensions
	{
		internal static bool JsonEquals(this string json, string otherjson)
		{
			var nJson = JObject.Parse(json).ToString();
			var nOtherJson = JObject.Parse(otherjson).ToString();
			//Assert.AreEqual(nOtherJson, nJson);
			return nJson == nOtherJson;
		}
	}
}

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

namespace Nest.Tests.Unit
{
	public static class JsonExtensions
	{
		internal static bool JsonEquals(this string json, string otherjson)
		{
			var nJson = JObject.Parse(json);
			var nOtherJson = JObject.Parse(otherjson);
			return JToken.DeepEquals(nJson, nOtherJson);
		}
	}
}

Use deep equality rather than string comparison.

This makes the tests a lot less brittle, since they don't
depend on the vagueries of json ordering


using Newtonsoft.Json;

namespace MessageBird.Objects
{
    public class Error
    {
        [JsonProperty("code")]
        public int Code { get; set; }

        [JsonProperty("description")]
        public string Description { get; set; }

        [JsonProperty("parameter")]
        public string Parameter { get; set; }
    }
}

using System.Runtime.Serialization;
using Newtonsoft.Json;

namespace MessageBird.Objects
{
    public enum ErrorCode
    {
        RequestNotAllowed = 2,
        MissingParameters = 9,
        InvalidParameters = 10,
        NotFound = 20,
        NotEnoughBalance = 25,
        ApiNotFound = 98,
        InternalError = 99
    }

    public class Error
    {
        [JsonProperty("code")]
        public ErrorCode Code { get; set; }

        [JsonProperty("description")]
        public string Description { get; set; }

        [JsonProperty("parameter")]
        public string Parameter { get; set; }
    }
}

Replace integer error code with enum

Replace integer error code with enum


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

using System.ComponentModel;

namespace osu.Game.Configuration
{
    public enum HUDVisibilityMode
    {
        Never,

        [Description("Hide during gameplay")]
        HideDuringGameplay,

        [Description("Hide during breaks")]
        HideDuringBreaks,

        Always
    }
}

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

using System.ComponentModel;

namespace osu.Game.Configuration
{
    public enum HUDVisibilityMode
    {
        Never,

        [Description("Hide during gameplay")]
        HideDuringGameplay,

        Always
    }
}

Remove "hide during breaks" option

Remove "hide during breaks" option

Probably wouldn't be used anyway.


using System;
using System.Collections.Generic;
using System.Linq;
using Fitbit.Models;
using Newtonsoft.Json.Linq;

namespace Fitbit.Api.Portable
{
    internal static class JsonDotNetSerializerExtensions
    {
        /// <summary>
        /// GetFriends has to do some custom manipulation with the returned representation
        /// </summary>
        /// <param name="serializer"></param>
        /// <param name="friendsJson"></param>
        /// <returns></returns>
        internal static List<UserProfile> GetFriends(this JsonDotNetSerializer serializer, string friendsJson)
        {
            if (string.IsNullOrWhiteSpace(friendsJson))
            {
                throw new ArgumentNullException("friendsJson", "friendsJson can not be empty, null or whitespace.");
            }

            // todo: additional error checking of json string required
            serializer.RootProperty = "user";
            var users = JToken.Parse(friendsJson)["friends"];
            return users.Children().Select(serializer.Deserialize<UserProfile>).ToList();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using Fitbit.Models;
using Newtonsoft.Json.Linq;

namespace Fitbit.Api.Portable
{
    internal static class JsonDotNetSerializerExtensions
    {
        /// <summary>
        /// GetFriends has to do some custom manipulation with the returned representation
        /// </summary>
        /// <param name="serializer"></param>
        /// <param name="friendsJson"></param>
        /// <returns></returns>
        internal static List<UserProfile> GetFriends(this JsonDotNetSerializer serializer, string friendsJson)
        {
            if (string.IsNullOrWhiteSpace(friendsJson))
            {
                throw new ArgumentNullException("friendsJson", "friendsJson can not be empty, null or whitespace.");
            }

            // todo: additional error checking of json string required
            serializer.RootProperty = "user";
            var friends = JToken.Parse(friendsJson)["friends"];
            return friends.Children().Select(serializer.Deserialize<UserProfile>).ToList();
        }
    }
}

Rename variable to make it read better

Rename variable to make it read better


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

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.

[assembly: AssemblyTitle("CloudSearch")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CloudSearch")]
[assembly: AssemblyCopyright("Copyright ©  2012")]
[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("8ace1017-c436-4f00-b040-84f7619af92f")]

// 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.2")]
[assembly: AssemblyFileVersion("1.0.0.2")]

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

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.

[assembly: AssemblyTitle("CloudSearch")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CloudSearch")]
[assembly: AssemblyCopyright("Copyright ©  2012")]
[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("8ace1017-c436-4f00-b040-84f7619af92f")]

// 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.1")]
[assembly: AssemblyFileVersion("1.0.0.1")]

Undo version number bump from personal build


using System;
using TagLib;

public class SetPictures
{
    public static void Main(string [] args)
    {
        if(args.Length < 2) {
            Console.Error.WriteLine("USAGE: mono SetPictures.exe AUDIO_PATH IMAGE_PATH_1[...IMAGE_PATH_N]");
            return;
        }

        TagLib.File file = TagLib.File.Create(args[0]);
        Console.WriteLine("Current picture count: " + file.Tag.Pictures.Length);

        Picture [] pictures = new Picture[args.Length - 1];

        for(int i = 1; i < args.Length; i++) {
            Picture picture = Picture.CreateFromPath(args[i]);
            pictures[i - 1] = picture;
        }

        file.Tag.Pictures = pictures;
        file.Save();

        Console.WriteLine("New picture count: " + file.Tag.Pictures.Length);
    }
}

using System;
using TagLib;

public class SetPictures
{
    public static void Main(string [] args)
    {
        if(args.Length < 2) {
            Console.Error.WriteLine("USAGE: mono SetPictures.exe AUDIO_PATH IMAGE_PATH_1[...IMAGE_PATH_N]");
            return;
        }

        TagLib.File file = TagLib.File.Create(args[0]);
        Console.WriteLine("Current picture count: " + file.Tag.Pictures.Length);

        Picture [] pictures = new Picture[args.Length - 1];

        for(int i = 1; i < args.Length; i++) {
            Picture picture = new Picture(args[i]);
            pictures[i - 1] = picture;
        }

        file.Tag.Pictures = pictures;
        file.Save();

        Console.WriteLine("New picture count: " + file.Tag.Pictures.Length);
    }
}

Fix use of obsolete API

Fix use of obsolete API

svn path=/trunk/taglib-sharp/; revision=123925


using AxosoftAPI.NET.Core.Interfaces;
using AxosoftAPI.NET.Models;

namespace AxosoftAPI.NET.Interfaces
{
	public interface IWorkLogs : IGetAllResource<WorkLog>, ICreateResource<WorkLog>, IDeleteResource<WorkLog>
	{
	}
}

using AxosoftAPI.NET.Core.Interfaces;
using AxosoftAPI.NET.Models;

namespace AxosoftAPI.NET.Interfaces
{
	public interface IWorkLogs : IResource<WorkLog>
	{
	}
}

Support full API available for worklogs

Support full API available for worklogs

Adds ability to update a worklog and retrieve a single worklog as provided for in API: http://developer.axosoft.com/api#!/work_logs


// Copyright 2015 Palm Stone Games, Inc. All Rights Reserved.

using System.IO;

namespace UnrealBuildTool.Rules
{
	public class ue4czmq : ModuleRules
	{
        public ue4czmq(TargetInfo Target)
		{
            // Include paths
            //PublicIncludePaths.AddRange(new string[] {});
            //PrivateIncludePaths.AddRange(new string[] {});

            // Dependencies
            PublicDependencyModuleNames.AddRange(new string[] { "Core", "Engine", });

            //PrivateDependencyModuleNames.AddRange(new string[] {});

            // Dynamically loaded modules
            //DynamicallyLoadedModuleNames.AddRange(new string[] {});

            // Definitions
            Definitions.Add("WITH_UE4CZMQ=1");

            LoadLib(Target);
		}

        public void LoadLib(TargetInfo Target)
        {
            string ModulePath = Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name));

            // CZMQ
            string czmqPath = Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/", Target.Platform.ToString(), "czmq"));
            PublicAdditionalLibraries.Add(Path.Combine(czmqPath, "Libraries", "czmq.lib"));
            PrivateIncludePaths.Add(Path.Combine(czmqPath, "Includes"));

            // LIBZMQ
            string libzmqPath = Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/", Target.Platform.ToString(), "libzmq"));
            PrivateIncludePaths.Add(Path.Combine(libzmqPath, "Includes"));
        }
	}
}

// Copyright 2015 Palm Stone Games, Inc. All Rights Reserved.

using System.IO;

namespace UnrealBuildTool.Rules
{
	public class ue4czmq : ModuleRules
	{
        public ue4czmq(TargetInfo Target)
		{
            // Include paths
            //PublicIncludePaths.AddRange(new string[] {});
            //PrivateIncludePaths.AddRange(new string[] {});

            // Dependencies
            PublicDependencyModuleNames.AddRange(new string[] { "Core", "Engine", });

            //PrivateDependencyModuleNames.AddRange(new string[] {});

            // Dynamically loaded modules
            //DynamicallyLoadedModuleNames.AddRange(new string[] {});

            // Definitions
            Definitions.Add("WITH_UE4CZMQ=1");

            LoadLib(Target);
		}

        public void LoadLib(TargetInfo Target)
        {
            string ModulePath = Path.GetDirectoryName(RulesCompiler.GetModuleFilename(this.GetType().Name));

            // CZMQ
            string czmqPath = Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/", Target.Platform.ToString(), "czmq"));
            PrivateAdditionalLibraries.Add(Path.Combine(czmqPath, "Libraries", "czmq.lib"));
            PrivateIncludePaths.Add(Path.Combine(czmqPath, "Includes"));

            // LIBZMQ
            string libzmqPath = Path.GetFullPath(Path.Combine(ModulePath, "../../ThirdParty/", Target.Platform.ToString(), "libzmq"));
            PrivateIncludePaths.Add(Path.Combine(libzmqPath, "Includes"));
        }
	}
}

Use a PrivateAdditionalLibrary for czmq.lib instead of a public one


using System;
using NBi.Xml;
using NUnit.Framework;

namespace NBi.Testing.Unit.Xml
{
    [TestFixture]
    public class XmlManagerTest
    {
        [Test]
        public void Load_ValidFile_Success()
        {
            var filename = DiskOnFile.CreatePhysicalFile("TestSuite.xml", "NBi.Testing.Unit.Xml.Resources.TestSuiteSample.xml");

            var manager = new XmlManager();
            manager.Load(filename);

            Assert.That(manager.TestSuite, Is.Not.Null);
        }

        [Test]
        public void Load_ValidFile_TestContentIsCorrect()
        {
            var filename = DiskOnFile.CreatePhysicalFile("TestSuite.xml", "NBi.Testing.Unit.Xml.Resources.TestSuiteSample.xml");

            var manager = new XmlManager();
            manager.Load(filename);

            Assert.That(manager.TestSuite.Tests[0].Content, Is.Not.Null);
        }

        [Test]
        public void Load_InvalidFile_Successfully()
        {
            var filename = DiskOnFile.CreatePhysicalFile("TestSuiteInvalidSyntax.xml", "NBi.Testing.Unit.Xml.Resources.TestSuiteInvalidSyntax.xml");

            var manager = new XmlManager();
            Assert.Throws<ArgumentException>(delegate { manager.Load(filename); });
        }
    }
}

using System;
using NBi.Xml;
using NUnit.Framework;

namespace NBi.Testing.Unit.Xml
{
    [TestFixture]
    public class XmlManagerTest
    {
        [Test]
        public void Load_ValidFile_Success()
        {
            var filename = DiskOnFile.CreatePhysicalFile("TestSuite.xml", "NBi.Testing.Unit.Xml.Resources.TestSuiteSample.xml");

            var manager = new XmlManager();
            manager.Load(filename);

            Assert.That(manager.TestSuite, Is.Not.Null);
        }

        [Test]
        public void Load_ValidFile_TestContentIsCorrect()
        {
            var filename = DiskOnFile.CreatePhysicalFile("TestContentIsCorrect.xml", "NBi.Testing.Unit.Xml.Resources.TestSuiteSample.xml");

            var manager = new XmlManager();
            manager.Load(filename);

            Assert.That(manager.TestSuite.Tests[0].Content, Is.Not.Null);
        }

        [Test]
        public void Load_InvalidFile_Successfully()
        {
            var filename = DiskOnFile.CreatePhysicalFile("TestSuiteInvalidSyntax.xml", "NBi.Testing.Unit.Xml.Resources.TestSuiteInvalidSyntax.xml");

            var manager = new XmlManager();
            Assert.Throws<ArgumentException>(delegate { manager.Load(filename); });
        }
    }
}

Fix failing test for TestContent in test redaction


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

// 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("Binding")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Binding")]
[assembly: AssemblyCopyright("Copyright ©  2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]

// 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.InteropServices;
using Android;

[assembly: AssemblyTitle("Binding")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Binding")]
[assembly: AssemblyCopyright("Copyright ©  2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: LinkerSafe]

Add link safe attribute support

Add link safe attribute support


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace poshsecframework.PShell
{
    class psfilenameeditor : System.Drawing.Design.UITypeEditor
    {
        public override System.Drawing.Design.UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context)
        {
            return System.Drawing.Design.UITypeEditorEditStyle.Modal;
        }

        [RefreshProperties(System.ComponentModel.RefreshProperties.All)]
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context == null || context.Instance == null)
            {
                return base.EditValue(context, provider, value);
            }
            else
            {
                OpenFileDialog dlg = new OpenFileDialog();
                dlg.Title = "Select " + context.PropertyDescriptor.DisplayName;
                dlg.FileName = (string)value;
                dlg.Filter = "All Files (*.*)|*.*";
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    value = dlg.FileName;
                }
                dlg.Dispose();
                dlg = null;
                return value;
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace poshsecframework.PShell
{
    class psfilenameeditor : System.Drawing.Design.UITypeEditor
    {
        public override System.Drawing.Design.UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context)
        {
            return System.Drawing.Design.UITypeEditorEditStyle.Modal;
        }

        [RefreshProperties(System.ComponentModel.RefreshProperties.All)]
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (context == null || context.Instance == null)
            {
                return base.EditValue(context, provider, value);
            }
            else
            {
                OpenFileDialog dlg = new OpenFileDialog();
                dlg.Title = "Select " + context.PropertyDescriptor.DisplayName;
                dlg.FileName = (string)value;
                dlg.Filter = "All Files (*.*)|*.*";
                dlg.CheckFileExists = false;
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    value = dlg.FileName;
                }
                dlg.Dispose();
                dlg = null;
                return value;
            }
        }
    }
}

Allow File to not Exist in FileBrowse

Allow File to not Exist in FileBrowse


using System;
using Villermen.RuneScapeCacheTools.Cache;
using Villermen.RuneScapeCacheTools.Cache.RuneTek5;
using Xunit;
using Xunit.Abstractions;

namespace RuneScapeCacheToolsTests
{
    public class RuneTek5CacheTests : IDisposable
    {
        private ITestOutputHelper _output;

        private RuneTek5Cache _cache;

        public RuneTek5CacheTests(ITestOutputHelper output)
        {
            _output = output;

            _cache = new RuneTek5Cache("TestData");
        }

        /// <summary>
        /// Test for a file that exists, an archive file that exists and a file that doesn't exist.
        /// </summary>
        [Fact]
        public void TestGetFile()
        {
            var file = _cache.GetFile(12, 3);

            var fileData = file.Data;

            Assert.True(fileData.Length > 0, "File's data is empty.");

            var archiveFile = _cache.GetFile(17, 5);

            var archiveEntry = archiveFile.Entries[255];

            Assert.True(archiveEntry.Length > 0, "Archive entry's data is empty.");

            try
            {
                _cache.GetFile(40, 30);

                Assert.True(false, "Cache returned a file that shouldn't exist.");
            }
            catch (CacheException exception)
            {
                Assert.True(exception.Message.Contains("incomplete"), "Non-existent file cache exception had the wrong message.");
            }
        }

        public void Dispose()
        {
            _cache?.Dispose();
        }
    }
}

using System;
using Villermen.RuneScapeCacheTools.Cache;
using Villermen.RuneScapeCacheTools.Cache.RuneTek5;
using Xunit;
using Xunit.Abstractions;

namespace RuneScapeCacheToolsTests
{
    public class RuneTek5CacheTests : IDisposable
    {
        private readonly ITestOutputHelper _output;

        private readonly RuneTek5Cache _cache;

        public RuneTek5CacheTests(ITestOutputHelper output)
        {
            _output = output;

            _cache = new RuneTek5Cache("TestData");
        }

        /// <summary>
        /// Test for a file that exists, an archive file that exists and a file that doesn't exist.
        /// </summary>
        [Fact]
        public void TestGetFile()
        {
            var file = _cache.GetFile(12, 3);

            var fileData = file.Data;

            Assert.True(fileData.Length > 0, "File's data is empty.");

            var archiveFile = _cache.GetFile(17, 5);

            var archiveEntry = archiveFile.Entries[255];

            Assert.True(archiveEntry.Length > 0, "Archive entry's data is empty.");

            try
            {
                _cache.GetFile(40, 30);

                Assert.True(false, "Cache returned a file that shouldn't exist.");
            }
            catch (CacheException exception)
            {
                Assert.True(exception.Message.Contains("incomplete"), "Non-existent file cache exception had the wrong message.");
            }
        }

        public void Dispose()
        {
            _cache?.Dispose();
        }
    }
}

Add some readonly 's to tests

Add some readonly
's to tests


// Copyright (c) to owners found in https://github.com/AArnott/pinvoke/blob/master/COPYRIGHT.md. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.

using System;
using System.Linq;
using PInvoke;
using Xunit;
using Xunit.Abstractions;
using static PInvoke.WtsApi32;

public class WtsApi32Facts
{
    private readonly ITestOutputHelper output;

    public WtsApi32Facts(ITestOutputHelper output)
    {
        this.output = output;
    }

    [Fact]
    public void CheckWorkingOfWtsSafeMemoryGuard()
    {
        System.Diagnostics.Debugger.Break();

        WtsSafeSessionInfoGuard wtsSafeMemoryGuard = new WtsSafeSessionInfoGuard();
        int sessionCount = 0;
        Assert.True(WTSEnumerateSessions(WTS_CURRENT_SERVER_HANDLE, 0, 1, ref wtsSafeMemoryGuard, ref sessionCount));
        Assert.NotEqual(0, sessionCount);

        var list = wtsSafeMemoryGuard.Take(sessionCount).ToList();
        foreach (var ses in list)
        {
            this.output.WriteLine($"{ses.pWinStationName}, {ses.SessionID}, {ses.State}");
        }
    }
}

// Copyright (c) to owners found in https://github.com/AArnott/pinvoke/blob/master/COPYRIGHT.md. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.

using System;
using System.Linq;
using PInvoke;
using Xunit;
using Xunit.Abstractions;
using static PInvoke.WtsApi32;

public class WtsApi32Facts
{
    private readonly ITestOutputHelper output;

    public WtsApi32Facts(ITestOutputHelper output)
    {
        this.output = output;
    }

    [Fact]
    public void CheckWorkingOfWtsSafeMemoryGuard()
    {
        WtsSafeSessionInfoGuard wtsSafeMemoryGuard = new WtsSafeSessionInfoGuard();
        int sessionCount = 0;
        Assert.True(WTSEnumerateSessions(WTS_CURRENT_SERVER_HANDLE, 0, 1, ref wtsSafeMemoryGuard, ref sessionCount));
        Assert.NotEqual(0, sessionCount);

        var list = wtsSafeMemoryGuard.Take(sessionCount).ToList();
        foreach (var ses in list)
        {
            this.output.WriteLine($"{ses.pWinStationName}, {ses.SessionID}, {ses.State}");
        }
    }
}

Delete break from the test

Delete break from the test


using System;
using Microsoft.SPOT;

namespace IntervalTimer
{
    public delegate void IntervalEventHandler(object sender, EventArgs e);

    public class IntervalTimer
    {
        public TimeSpan ShortDuration { get; set; }
        public TimeSpan LongDuration { get; set; }

        public IntervalTimer(TimeSpan shortDuration, TimeSpan longDuration)
        {
            ShortDuration = shortDuration;
            LongDuration = longDuration;
        }

        public IntervalTimer(int shortSeconds, int longSeconds)
        {
            ShortDuration = new TimeSpan(0, 0, shortSeconds);
            LongDuration = new TimeSpan(0, 0, longSeconds);
        }

    }
}

using System;
using Microsoft.SPOT;

namespace IntervalTimer
{
    public delegate void IntervalEventHandler(object sender, IntervalReachedEventArgs e);

    public class IntervalTimer
    {
        public TimeSpan ShortDuration { get; set; }
        public TimeSpan LongDuration { get; set; }

        public IntervalTimer(TimeSpan shortDuration, TimeSpan longDuration)
        {
            ShortDuration = shortDuration;
            LongDuration = longDuration;
        }

        public IntervalTimer(int shortSeconds, int longSeconds)
        {
            ShortDuration = new TimeSpan(0, 0, shortSeconds);
            LongDuration = new TimeSpan(0, 0, longSeconds);
        }

    }
}

Use IntervalReachedEventArgs instead of EventArgs.


using System;
using System.Web;
using System.Web.Configuration;
using ZMQ;

namespace Nohros.Toolkit.RestQL
{
  public class Global : HttpApplication
  {
    static readonly Context zmq_context_;

    #region .ctor
    static Global() {
      zmq_context_ = new Context(ZMQ.Context.DefaultIOThreads);
    }
    #endregion

    protected void Application_Start(object sender, EventArgs e) {
      string config_file_name =
        WebConfigurationManager.AppSettings[Strings.kConfigFileNameKey];
      string config_file_path = Server.MapPath(config_file_name);
      Settings settings = new Settings.Loader()
        .Load(config_file_path, Strings.kConfigRootNodeName);
      var factory = new HttpQueryApplicationFactory(settings);
      Application[Strings.kApplicationKey] = factory.CreateQueryApplication();
    }

    protected void Session_Start(object sender, EventArgs e) {
    }

    protected void Application_BeginRequest(object sender, EventArgs e) {
    }

    protected void Application_AuthenticateRequest(object sender, EventArgs e) {
    }

    protected void Application_Error(object sender, EventArgs e) {
    }

    protected void Session_End(object sender, EventArgs e) {
    }

    protected void Application_End(object sender, EventArgs e) {
      var app = Application[Strings.kApplicationKey] as HttpQueryApplication;
      if (app != null) {
        app.Stop();
        app.Dispose();
      }
      zmq_context_.Dispose();
    }
  }
}

using System;
using System.Web;
using System.Web.Configuration;
using ZMQ;

namespace Nohros.Toolkit.RestQL
{
  public class Global : HttpApplication
  {
    static readonly Context zmq_context_;

    #region .ctor
    static Global() {
      zmq_context_ = new Context(ZMQ.Context.DefaultIOThreads);
    }
    #endregion

    protected void Application_Start(object sender, EventArgs e) {
      string config_file_name =
        WebConfigurationManager.AppSettings[Strings.kConfigFileNameKey];
      string config_file_path = Server.MapPath(config_file_name);
      Settings settings = new Settings.Loader()
        .Load(config_file_path, Strings.kConfigRootNodeName);
      var factory = new HttpQueryApplicationFactory(settings);
      HttpQueryApplication app = factory.CreateQueryApplication();
      Application[Strings.kApplicationKey] = app;
      app.Start();
    }

    protected void Session_Start(object sender, EventArgs e) {
    }

    protected void Application_BeginRequest(object sender, EventArgs e) {
    }

    protected void Application_AuthenticateRequest(object sender, EventArgs e) {
    }

    protected void Application_Error(object sender, EventArgs e) {
    }

    protected void Session_End(object sender, EventArgs e) {
    }

    protected void Application_End(object sender, EventArgs e) {
      var app = Application[Strings.kApplicationKey] as HttpQueryApplication;
      if (app != null) {
        app.Stop();
        app.Dispose();
      }
      zmq_context_.Dispose();
    }
  }
}

Fix a bug that causes the application to not start. This happen because the Start method was not begin called.


using UnityEngine;

public class Settings {
    public static Player
        p1 = new RandomAI(null, 1, Color.red, Resources.Load<Sprite>("Sprites/x"), "X"),
        p2 = new RandomAI(null, 2, Color.blue, Resources.Load<Sprite>("Sprites/o"), "O");
}

using UnityEngine;

public class Settings {
    public static Player p1 = RandomAI(true), p2 = RandomAI(false);

    public static RandomAI RandomAI(bool firstPlayer)
    {
        int turn = firstPlayer ? 1 : 2;
        Color color = firstPlayer ? Color.red : Color.blue;
        Sprite sprite =
            Resources.Load<Sprite>("Sprites/" + (firstPlayer ? "x" : "o"));
        string name = firstPlayer ? "X" : "O";
        return new RandomAI(null, turn, color, sprite, name);
    }
}

Add RandomAI() method for fast generation of simple random players


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AvsAnLib;
using ExpressionToCodeLib;
using NUnit.Framework;

namespace AvsAn_Test {
    public class StandardCasesWork {
        [TestCase("an", "unanticipated result")]
        [TestCase("a", "unanimous vote")]
        [TestCase("an", "honest decision")]
        [TestCase("a", "honeysuckle shrub")]
        [TestCase("an", "0800 number")]
        [TestCase("an", "∞ of oregano")]
        [TestCase("a", "NASA scientist")]
        [TestCase("an", "NSA analyst")]
        [TestCase("a", "FIAT car")]
        [TestCase("an", "FAA policy")]
        [TestCase("an", "A")]
        public void DoTest(string article, string word) {
            PAssert.That(() => AvsAn.Query(word).Article == article);
        }

        [TestCase("a", "", "")]
        [TestCase("a", "'", "'")]
        [TestCase("an", "N", "N ")]
        [TestCase("a", "NASA", "NAS")]
        public void CheckOddPrefixes(string article, string word, string prefix) {
            PAssert.That(() => AvsAn.Query(word).Article == article && AvsAn.Query(word).Prefix == prefix);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AvsAnLib;
using ExpressionToCodeLib;
using NUnit.Framework;

namespace AvsAn_Test {
    public class StandardCasesWork {
        [TestCase("an", "unanticipated result")]
        [TestCase("a", "unanimous vote")]
        [TestCase("an", "honest decision")]
        [TestCase("a", "honeysuckle shrub")]
        [TestCase("an", "0800 number")]
        [TestCase("an", "∞ of oregano")]
        [TestCase("a", "NASA scientist")]
        [TestCase("an", "NSA analyst")]
        [TestCase("a", "FIAT car")]
        [TestCase("an", "FAA policy")]
        [TestCase("an", "A")]
        [TestCase("a", "uniformed agent")]
        [TestCase("an", "unissued permit")]
        [TestCase("an", "unilluminating argument")]
        public void DoTest(string article, string word) {
            PAssert.That(() => AvsAn.Query(word).Article == article);
        }

        [TestCase("a", "", "")]
        [TestCase("a", "'", "'")]
        [TestCase("an", "N", "N ")]
        [TestCase("a", "NASA", "NAS")]
        public void CheckOddPrefixes(string article, string word, string prefix) {
            PAssert.That(() => AvsAn.Query(word).Article == article && AvsAn.Query(word).Prefix == prefix);
        }
    }
}

Add two (currently failing) tests. Hopefully the new wikiextractor will deal with these corner cases (unissued, unilluminating).


namespace NHasher
{
    internal static class HashExtensions
    {
        public static ulong RotateLeft(this ulong original, int bits)
        {
            return (original << bits) | (original >> (64 - bits));
        }

        public static uint RotateLeft(this uint original, int bits)
        {
            return (original << bits) | (original >> (32 - bits));
        }

        internal static unsafe ulong GetUInt64(this byte[] data, int position)
        {
            // we only read aligned longs, so a simple casting is enough
            fixed (byte* pbyte = &data[position])
            {
                return *((ulong*)pbyte);
            }
        }

        internal static unsafe uint GetUInt32(this byte[] data, int position)
        {
            // we only read aligned longs, so a simple casting is enough
            fixed (byte* pbyte = &data[position])
            {
                return *((uint*)pbyte);
            }
        }
    }
}

using System.Runtime.CompilerServices;

namespace NHasher
{
    internal static class HashExtensions
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static ulong RotateLeft(this ulong original, int bits)
        {
            return (original << bits) | (original >> (64 - bits));
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static uint RotateLeft(this uint original, int bits)
        {
            return (original << bits) | (original >> (32 - bits));
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        internal static unsafe ulong GetUInt64(this byte[] data, int position)
        {
            // we only read aligned longs, so a simple casting is enough
            fixed (byte* pbyte = &data[position])
            {
                return *((ulong*)pbyte);
            }
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        internal static unsafe uint GetUInt32(this byte[] data, int position)
        {
            // we only read aligned longs, so a simple casting is enough
            fixed (byte* pbyte = &data[position])
            {
                return *((uint*)pbyte);
            }
        }
    }
}

Add AggressiveInlining for Rotate and Get functions


using Telerik.TestingFramework.Controls.KendoUI;
using Telerik.WebAii.Controls.Html;
using Telerik.WebAii.Controls.Xaml;
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;

using ArtOfTest.Common.UnitTesting;
using ArtOfTest.WebAii.Core;
using ArtOfTest.WebAii.Controls.HtmlControls;
using ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts;
using ArtOfTest.WebAii.Design;
using ArtOfTest.WebAii.Design.Execution;
using ArtOfTest.WebAii.ObjectModel;
using ArtOfTest.WebAii.Silverlight;
using ArtOfTest.WebAii.Silverlight.UI;

namespace MonkeyTests
{
    public static class Constans
    {
        public static string BrowserWaitUntilReady = @"MonkeyHelper\Steps\BrowserWaitUntilReady.tstest";
        public static string NavigationToBaseUrl = @"MonkeyHelper\Steps\NavigationToBaseUrl.tstest";
        public static string ClickOnElement = @"MonkeyHelper\Steps\ClickOnElement.tstest";
    }
}

using Telerik.TestingFramework.Controls.KendoUI;
using Telerik.WebAii.Controls.Html;
using Telerik.WebAii.Controls.Xaml;
using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;

using ArtOfTest.Common.UnitTesting;
using ArtOfTest.WebAii.Core;
using ArtOfTest.WebAii.Controls.HtmlControls;
using ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts;
using ArtOfTest.WebAii.Design;
using ArtOfTest.WebAii.Design.Execution;
using ArtOfTest.WebAii.ObjectModel;
using ArtOfTest.WebAii.Silverlight;
using ArtOfTest.WebAii.Silverlight.UI;

namespace MonkeyTests
{
    public static class Constans
    {
        public static string BrowserWaitUntilReady = @"MonkeyTests\MonkeyHelper\Steps\MonkeyHelper_BrowserWaitUntilReady.tstest";
        public static string NavigationToBaseUrl = @"MonkeyTests\MonkeyHelper\Steps\MonkeyHelper_NavigationToBaseUrl.tstest";
        public static string ClickOnElement = @"MonkeyTests\MonkeyHelper\Steps\MonkeyHelper_ClickOnElement.tstest";
    }
}

Change constants file. Fixed path to MonkeyHelper.


using UnityEngine;
using System.Collections;

public class LightManager {
	Material LightOnMaterial;
	Material LightOffMaterial;
	public bool IsOn = true;
	// Use this for initialization
	public void UpdateLights() {
		GameObject[] allLights = GameObject.FindGameObjectsWithTag ("Light");

		foreach (GameObject i in allLights) {
			i.SetActive (IsOn);
		}
		SpriteRenderer[] bitmaps = GameObject.FindObjectsOfType<SpriteRenderer>();
		if (IsOn) {
			foreach (SpriteRenderer i in bitmaps) {
				i.material = LightOnMaterial;
			}
		} else {
			foreach (SpriteRenderer i in bitmaps) {
				i.material = LightOffMaterial;
			}
		}
	}

	public void SetLights(bool enabled) {
		IsOn = enabled;
		UpdateLights ();
	}

	private static LightManager instance;
	public static LightManager Instance
	{
		get
		{
			if(instance==null)
			{
				instance = new LightManager();
				instance.LightOnMaterial = Resources.Load("Materials/LightOnMaterial", typeof(Material)) as Material;
				instance.LightOffMaterial = Resources.Load("Materials/LightOffMaterial", typeof(Material)) as Material;
			}
			return instance;
		}
	}
}

using UnityEngine;
using System.Collections;

public class LightManager {
	Material LightOnMaterial;
	Material LightOffMaterial;
	public bool IsOn = true;
	// Use this for initialization
	public void UpdateLights() {
		bool lightOn = IsOn;
		if (!Application.loadedLevelName.StartsWith ("Level"))
			lightOn = false;

		GameObject[] allLights = GameObject.FindGameObjectsWithTag ("Light");

		foreach (GameObject i in allLights) {
			i.SetActive (lightOn);
		}
		SpriteRenderer[] bitmaps = GameObject.FindObjectsOfType<SpriteRenderer>();
		if (lightOn) {
			foreach (SpriteRenderer i in bitmaps) {
				i.material = LightOnMaterial;
			}
		} else {
			foreach (SpriteRenderer i in bitmaps) {
				i.material = LightOffMaterial;
			}
		}
	}

	public void SetLights(bool enabled) {
		IsOn = enabled;
		UpdateLights ();
	}

	private static LightManager instance;
	public static LightManager Instance
	{
		get
		{
			if(instance==null)
			{
				instance = new LightManager();
				instance.LightOnMaterial = Resources.Load("Materials/LightOnMaterial", typeof(Material)) as Material;
				instance.LightOffMaterial = Resources.Load("Materials/LightOffMaterial", typeof(Material)) as Material;
			}
			return instance;
		}
	}
}

Make lights not appear in menu

Make lights not appear in menu


using Avalonia.Controls;
using System.Reactive.Disposables;

namespace WalletWasabi.Gui.Behaviors
{
    public class CommandOnDoubleClickBehavior : CommandBasedBehavior<Control>
    {
        private CompositeDisposable _disposables;

        protected override void OnAttached()
        {
            _disposables = new CompositeDisposable();

            base.OnAttached();

            _disposables.Add(AssociatedObject.AddHandler(Control.PointerPressedEvent, (sender, e) =>
            {
                if(e.ClickCount == 2)
                {
                    e.Handled = ExecuteCommand();
                }
            }));
        }

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

            _disposables.Dispose();
        }
    }
}

using Avalonia.Controls;
using System.Reactive.Disposables;

namespace WalletWasabi.Gui.Behaviors
{
	public class CommandOnDoubleClickBehavior : CommandBasedBehavior<Control>
	{
		private CompositeDisposable Disposables { get; set; }

		protected override void OnAttached()
		{
			Disposables = new CompositeDisposable();

			base.OnAttached();

			Disposables.Add(AssociatedObject.AddHandler(Control.PointerPressedEvent, (sender, e) =>
			{
				if (e.ClickCount == 2)
				{
					e.Handled = ExecuteCommand();
				}
			}));
		}

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

			Disposables?.Dispose();
		}
	}
}

Use property instead of field for CompositeDisposable


using Mond.Binding;

namespace Mond.Libraries.Console
{
    [MondClass("")]
    internal class ConsoleOutputClass
    {
        private ConsoleOutputLibrary _consoleOutput;

        public static MondValue Create(ConsoleOutputLibrary consoleOutput)
        {
            MondValue prototype;
            MondClassBinder.Bind<ConsoleOutputClass>(out prototype);

            var instance = new ConsoleOutputClass();
            instance._consoleOutput = consoleOutput;

            var obj = new MondValue(MondValueType.Object);
            obj.UserData = instance;
            obj.Prototype = prototype;
            obj.Lock();

            return obj;
        }

        [MondFunction("print")]
        public void Print(params MondValue[] arguments)
        {
            foreach (var v in arguments)
            {
                _consoleOutput.Out.Write((string)v);
            }
        }

        [MondFunction("printLn")]
        public void PrintLn(params MondValue[] arguments)
        {
            if (arguments.Length == 0)
                _consoleOutput.Out.WriteLine();

            foreach (var v in arguments)
            {
                _consoleOutput.Out.Write((string)v);
                _consoleOutput.Out.WriteLine();
            }
        }
    }
}

using Mond.Binding;

namespace Mond.Libraries.Console
{
    [MondClass("")]
    internal class ConsoleOutputClass
    {
        private ConsoleOutputLibrary _consoleOutput;

        public static MondValue Create(ConsoleOutputLibrary consoleOutput)
        {
            MondValue prototype;
            MondClassBinder.Bind<ConsoleOutputClass>(out prototype);

            var instance = new ConsoleOutputClass();
            instance._consoleOutput = consoleOutput;

            var obj = new MondValue(MondValueType.Object);
            obj.UserData = instance;
            obj.Prototype = prototype;
            obj.Lock();

            return obj;
        }

        [MondFunction("print")]
        public void Print(params MondValue[] arguments)
        {
            foreach (var v in arguments)
            {
                _consoleOutput.Out.Write((string)v);
            }
        }

        [MondFunction("printLn")]
        public void PrintLn(params MondValue[] arguments)
        {
            foreach (var v in arguments)
            {
                _consoleOutput.Out.Write((string)v);
            }

            _consoleOutput.Out.WriteLine();
        }
    }
}

Change printLn to print all values followed by a newline


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("HALClient")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HALClient")]
[assembly: AssemblyCopyright("Copyright ©  2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: InternalsVisibleTo("HALClient.Tests")]

// 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("HALClient")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("HALClient")]
[assembly: AssemblyCopyright("Copyright ©  2012")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: InternalsVisibleTo("HALClient.Tests")]

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

Set the version to a trepidatious 0.5

Set the version to a trepidatious 0.5


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

using Android.App;
using Android.Content;
using Android.Content.PM;
using Android.Database;
using Android.Graphics;
using Android.OS;
using Android.Runtime;
using Android.Support.Design.Widget;
using Android.Support.V4.Widget;
using Android.Support.V4.View;
using Android.Support.V7.App;
using Android.Support.V7.Widget;
using Android.Utilities;
using Android.Views;
using Android.Widget;

using Java.Lang;

using Fragment = Android.Support.V4.App.Fragment;
using Toolbar = Android.Support.V7.Widget.Toolbar;
using SearchView = Android.Support.V7.Widget.SearchView;

namespace Android.Utilities
{
    public abstract class TabFragment : Fragment
    {
        public abstract string Title { get; }

        protected virtual void OnGotFocus() { }
        protected virtual void OnLostFocus() { }

        public virtual void Refresh() { }
        public override void SetMenuVisibility(bool visible)
        {
            base.SetMenuVisibility(visible);

            if (visible)
                OnGotFocus();
            else
                OnLostFocus();
        }
    }
}

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

using Android.App;
using Android.Content;
using Android.Content.PM;
using Android.Database;
using Android.Graphics;
using Android.OS;
using Android.Runtime;
using Android.Support.Design.Widget;
using Android.Support.V4.Widget;
using Android.Support.V4.View;
using Android.Support.V7.App;
using Android.Support.V7.Widget;
using Android.Utilities;
using Android.Views;
using Android.Widget;

using Java.Lang;

using Fragment = Android.Support.V4.App.Fragment;
using Toolbar = Android.Support.V7.Widget.Toolbar;
using SearchView = Android.Support.V7.Widget.SearchView;

namespace Android.Utilities
{
    public abstract class TabFragment : Fragment
    {
        public abstract string Title { get; }

        protected virtual void OnGotFocus() { }
        protected virtual void OnLostFocus() { }

        public virtual void Refresh() { }
        public override void SetMenuVisibility(bool visible)
        {
            base.SetMenuVisibility(visible);

            /*if (visible)
                OnGotFocus();
            else
                OnLostFocus();*/
        }

        public override bool UserVisibleHint
        {
            get
            {
                return base.UserVisibleHint;
            }
            set
            {
                base.UserVisibleHint = value;

                if (value)
                    OnGotFocus();
                else
                    OnLostFocus();
            }
        }
    }
}

Use UserVisibilityHint to detect ViewPager change instead of MenuVisibility, this fixes an Exception.


namespace SimpSim.NET
{
    public class Registers
    {
        public delegate void ValueWrittenToOutputRegisterHandler(char output);

        public event ValueWrittenToOutputRegisterHandler ValueWrittenToOutputRegister;

        private readonly byte[] _array;

        public Registers()
        {
            _array = new byte[16];
        }

        public byte this[byte register]
        {
            get
            {
                return _array[register];
            }
            set
            {
                _array[register] = value;

                if (register == 0x0f && ValueWrittenToOutputRegister != null)
                    ValueWrittenToOutputRegister((char)value);
            }
        }
    }
}

namespace SimpSim.NET
{
    public class Registers
    {
        public delegate void ValueWrittenToOutputRegisterHandler(char output);

        public event ValueWrittenToOutputRegisterHandler ValueWrittenToOutputRegister;

        private readonly byte[] _array;

        public Registers()
        {
            _array = new byte[16];
        }

        public byte this[byte register]
        {
            get
            {
                return _array[register];
            }
            set
            {
                _array[register] = value;

                if (register == 0x0f)
                    ValueWrittenToOutputRegister?.Invoke((char)value);
            }
        }
    }
}

Use null propagation when invoking ValueWrittenToOutputRegister to prevent possible race condition.


using System;

namespace Utils
{
    public static class Strings
    {
        public static Tuple<string, string> SplitString(this string str, char separator)
        {
            var index = str.IndexOf(separator);
            var str2 = str.Length > index?str.Substring(index + 1):string.Empty;
            var str1 = str.Substring(0, index);
            return new Tuple<string, string>(str1, str2);
        }
    }
}

using System;

namespace Utils
{
    public static class Strings
    {
        public static Tuple<string, string> SplitString(this string str, char separator)
        {
            var index = str.IndexOf(separator);
            var str2 = str.Length > index?str.Substring(index + 1):string.Empty;
            var str1 = str.Substring(0, index);
            return new Tuple<string, string>(str1, str2);
        }

        public static void Trim<T>(this T obj, Expression<Func<T, string>> action) where T : class
        {
            var expression = (MemberExpression)action.Body;
            var member = expression.Member;
            Action<string> setProperty;
            Func<string> getPropertyValue;
            switch (member.MemberType)
            {
                case MemberTypes.Field:
                    setProperty = val =>  ((FieldInfo)member).SetValue(obj,val);
                    getPropertyValue = () => ((FieldInfo)member).GetValue(obj)?.ToString();

                    break;
                case MemberTypes.Property:
                    setProperty = val => ((PropertyInfo)member).SetValue(obj, val);
                    getPropertyValue = () => ((PropertyInfo) member).GetValue(obj)?.ToString();
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }

            var trimmedString = getPropertyValue().Trim();
            setProperty(trimmedString);
        }
    }
}

Add Trim string property extension

Add Trim string property extension

to use obj.Trim(x => x.Prop1);


using NUnit.Framework;

namespace ZimmerBot.Core.Tests.BotTests
{
  [TestFixture]
  public class ContinueTests : TestHelper
  {
    [Test]
    public void CanContinueWithEmptyTarget()
    {
      BuildBot(@"
> Hello
: Hi
! continue

> *
! weight 0.5
: What can I help you with?
");
      AssertDialog("Hello", "Hi\nWhat can I help you with?");
    }

    [Test]
    public void CanContinueWithLabel()
    {
      BuildBot(@"
> Yo
: Yaj!
! continue at HowIsItGoing

<HowIsItGoing>
: How is it going?

>
: What can I help you with?
");
      AssertDialog("Yo!", "Yaj!\nHow is it going?");
    }

    [Test]
    public void CanContinueWithNewInput()
    {
      BuildBot(@"
> Yo
: Yaj!
! continue with Having Fun

> Having Fun
: is it fun

>
: What can I help you with?
");
      AssertDialog("Yo!", "Yaj!\nis it fun");
    }
  }
}

using NUnit.Framework;

namespace ZimmerBot.Core.Tests.BotTests
{
  [TestFixture]
  public class ContinueTests : TestHelper
  {
    [Test]
    public void CanContinueWithEmptyTarget()
    {
      BuildBot(@"
> Hello
: Hi
! continue

> *
! weight 0.5
: What can I help you with?
");
      AssertDialog("Hello", "Hi\nWhat can I help you with?");
    }

    [Test]
    public void CanContinueWithLabel()
    {
      BuildBot(@"
> Yo
: Yaj!
! continue at HowIsItGoing

<HowIsItGoing>
: How is it going?

>
: What can I help you with?
");
      AssertDialog("Yo!", "Yaj!\nHow is it going?");
    }

    [Test]
    public void CanContinueWithNewInput()
    {
      BuildBot(@"
> Yo
: Yaj!
! continue with Having Fun

> Having Fun
: is it fun

>
: What can I help you with?
");
      AssertDialog("Yo!", "Yaj!\nis it fun");
    }

    [Test]
    public void CanContinueWithParameters()
    {
      BuildBot(@"
> Yo +
: Yaj!
! continue with Some <1>

> Some +
: Love '<1>'
");
      AssertDialog("Yo Mouse", "Yaj!\nLove 'Mouse'");
    }
  }
}

Add test showing problem with "continue with".


// 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.Skinning
{
    public class LegacySkinConfiguration : DefaultSkinConfiguration
    {
        public const decimal LATEST_VERSION = 2.7m;

        /// <summary>
        /// Legacy version of this skin. Null if no version was set to allow fallback to a parent skin version.
        /// </summary>
        public decimal? LegacyVersion { get; internal set; }

        public enum LegacySetting
        {
            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.

namespace osu.Game.Skinning
{
    public class LegacySkinConfiguration : DefaultSkinConfiguration
    {
        public const decimal LATEST_VERSION = 2.7m;

        /// <summary>
        /// Legacy version of this skin.
        /// </summary>
        public decimal? LegacyVersion { get; internal set; }

        public enum LegacySetting
        {
            Version,
        }
    }
}

Remove unnecessary mentioning in xmldoc

Remove unnecessary mentioning in xmldoc


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

namespace LaunchNumbering
{
	public class LNSettings : GameParameters.CustomParameterNode
	{
		public override GameParameters.GameMode GameMode => GameParameters.GameMode.ANY;

		public override bool HasPresets => false;

		public override string Section => "Launch Numbering";

		public override int SectionOrder => 1;

		public override string Title => "Vessel Defaults";

		[GameParameters.CustomParameterUI("Numbering Scheme")]
		public NumberScheme Scheme { get; set; }
		[GameParameters.CustomParameterUI("Show Bloc numbers")]
		public bool ShowBloc { get; set; }
		[GameParameters.CustomParameterUI("Bloc Numbering Scheme")]
		public NumberScheme BlocScheme { get; set; }
		public enum NumberScheme
		{
			Arabic,
			Roman
		}
	}
}

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

namespace LaunchNumbering
{
	public class LNSettings : GameParameters.CustomParameterNode
	{
		public override GameParameters.GameMode GameMode => GameParameters.GameMode.ANY;

		public override bool HasPresets => false;

		public override string Section => "Launch Numbering";

		public override int SectionOrder => 1;

		public override string Title => "Vessel Defaults";

		[GameParameters.CustomParameterUI("Numbering Scheme")]
		public NumberScheme Scheme { get; set; }
		[GameParameters.CustomParameterUI("Show Bloc numbers")]
		public bool ShowBloc { get; set; } = true;
		[GameParameters.CustomParameterUI("Bloc Numbering Scheme")]
		public NumberScheme BlocScheme { get; set; } = NumberScheme.Roman;
		public enum NumberScheme
		{
			Arabic,
			Roman
		}
	}
}

Set suitable default settings, in accordance with the prophecy


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

namespace UnitTestProject1
{
    [TestClass]
    public class UnitTest1
    {
        FibonacciGenerator _gen = new FibonacciGenerator();

        [TestMethod]
        public void FibonacciGeneratorBasic()
        {
            Assert.Equals(_gen.Get(0), 0);
            Assert.Equals(_gen.Get(1), 1);
            Assert.Equals(_gen.Get(2), 1);
            Assert.Equals(_gen.Get(3), 2);
            Assert.Equals(_gen.Get(4), 3);
            Assert.Equals(_gen.Get(5), 5);
        }

        [TestMethod]
        public void FibonacciGenerator9()
        {
            Assert.Equals(_gen.Get(9), 34);
        }

        [TestMethod]
        public void FibonacciGeneratorBig()
        {
            Assert.AreNotSame(_gen.Get(12345678), 0);
        }
    }
}

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

namespace UnitTestProject1
{
    [TestClass]
    public class UnitTest1
    {
        FibonacciGenerator _gen = new FibonacciGenerator();

        [TestMethod]
        public void FibonacciGeneratorBasic()
        {
            Assert.AreEqual(_gen.Get(0), 0);
            Assert.AreEqual(_gen.Get(1), 1);
            Assert.AreEqual(_gen.Get(2), 1);
            Assert.AreEqual(_gen.Get(3), 2);
            Assert.AreEqual(_gen.Get(4), 3);
            Assert.AreEqual(_gen.Get(5), 5);
        }

        [TestMethod]
        public void FibonacciGenerator9()
        {
            Assert.AreEqual(_gen.Get(9), 34);
        }

        [TestMethod]
        public void FibonacciGeneratorBig()
        {
            Assert.AreNotSame(_gen.Get(12345678), 0);
        }
    }
}

Replace deprecated Equals API by AreEqual


using System;
using dnlib.DotNet;

namespace Confuser.Core.Project.Patterns {
	/// <summary>
	///     A function that compare the namespace of definition.
	/// </summary>
	public class NamespaceFunction : PatternFunction {
		internal const string FnName = "namespace";

		/// <inheritdoc />
		public override string Name {
			get { return FnName; }
		}

		/// <inheritdoc />
		public override int ArgumentCount {
			get { return 1; }
		}

		/// <inheritdoc />
		public override object Evaluate(IDnlibDef definition) {
			if (!(definition is TypeDef) && !(definition is IMemberDef))
				return false;
			object ns = Arguments[0].Evaluate(definition);

			var type = definition as TypeDef;
			if (type == null)
				type = ((IMemberDef)definition).DeclaringType;

			while (type.IsNested)
				type = type.DeclaringType;

			return type != null && type.Namespace == ns.ToString();
		}
	}
}

using System;
using System.Text.RegularExpressions;
using dnlib.DotNet;

namespace Confuser.Core.Project.Patterns {
	/// <summary>
	///     A function that compare the namespace of definition.
	/// </summary>
	public class NamespaceFunction : PatternFunction {
		internal const string FnName = "namespace";

		/// <inheritdoc />
		public override string Name {
			get { return FnName; }
		}

		/// <inheritdoc />
		public override int ArgumentCount {
			get { return 1; }
		}

		/// <inheritdoc />
		public override object Evaluate(IDnlibDef definition) {
			if (!(definition is TypeDef) && !(definition is IMemberDef))
				return false;
			var ns = Arguments[0].Evaluate(definition).ToString();

			var type = definition as TypeDef;
			if (type == null)
				type = ((IMemberDef)definition).DeclaringType;

			while (type.IsNested)
				type = type.DeclaringType;

			return type != null && Regex.IsMatch(type.Namespace, ns);
		}
	}
}

Use Regex in namespace pattern

Use Regex in namespace pattern


using System;
using System.Linq;

using LinqToDB;

using NUnit.Framework;

namespace Tests.UserTests
{
	[TestFixture]
	public class Issue1556Tests : TestBase
	{
		[Test]
		public void Issue1556Test([DataSources(ProviderName.Sybase, ProviderName.OracleNative)] string context)
		{
			using (var db = GetDataContext(context))
			{
				AreEqual(
					from p in db.Parent
					from c in db.Child
					where p.ParentID == c.ParentID || c.GrandChildren.Any(y => y.ParentID == p.ParentID)
					select new { p, c }
					,
					db.Parent
						.InnerJoin(db.Child,
							(p,c) => p.ParentID == c.ParentID || c.GrandChildren.Any(y => y.ParentID == p.ParentID),
							(p,c) => new { p, c }));
			}
		}
	}
}

using System;
using System.Linq;

using LinqToDB;

using NUnit.Framework;

namespace Tests.UserTests
{
	[TestFixture]
	public class Issue1556Tests : TestBase
	{
		[Test]
		public void Issue1556Test(
			[DataSources(ProviderName.Sybase, ProviderName.OracleNative, ProviderName.Access)] string context)
		{
			using (var db = GetDataContext(context))
			{
				AreEqual(
					from p in db.Parent
					from c in db.Child
					where p.ParentID == c.ParentID || c.GrandChildren.Any(y => y.ParentID == p.ParentID)
					select new { p, c }
					,
					db.Parent
						.InnerJoin(db.Child,
							(p,c) => p.ParentID == c.ParentID || c.GrandChildren.Any(y => y.ParentID == p.ParentID),
							(p,c) => new { p, c }));
			}
		}
	}
}

Access dos not support such join syntax.


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

namespace InfinniPlatform.Core.Metadata
{
    public class MetadataUniqueName : IEquatable<MetadataUniqueName>
    {
        private const char NamespaceSeparator = '.';

        public MetadataUniqueName(string ns, string name)
        {
            Namespace = ns;
            Name = name;
        }
        public MetadataUniqueName(string fullQuelifiedName)
        {
            Namespace = fullQuelifiedName.Remove(fullQuelifiedName.LastIndexOf(NamespaceSeparator));
            Name = fullQuelifiedName.Split(NamespaceSeparator).Last();
        }

        public string Namespace { get; }
        public string Name { get; }

        public bool Equals(MetadataUniqueName other)
        {
            return Namespace.Equals(other.Namespace) && Name.Equals(other.Name);
        }

        public override string ToString()
        {
            return $"{Namespace}.{Name}";
        }

        public override int GetHashCode()
        {
            return Namespace.GetHashCode() ^ Name.GetHashCode();
        }
    }
}

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

namespace InfinniPlatform.Core.Metadata
{
    public class MetadataUniqueName : IEquatable<MetadataUniqueName>
    {
        private const char NamespaceSeparator = '.';

        public MetadataUniqueName(string ns, string name)
        {
            Namespace = ns;
            Name = name;
        }
        public MetadataUniqueName(string fullQuelifiedName)
        {
            Namespace = fullQuelifiedName.Remove(fullQuelifiedName.LastIndexOf(NamespaceSeparator));
            Name = fullQuelifiedName.Split(NamespaceSeparator).Last();
        }

        public string Namespace { get; }
        public string Name { get; }

        public bool Equals(MetadataUniqueName other)
        {
            return Namespace.Equals(other.Namespace, StringComparison.OrdinalIgnoreCase) && Name.Equals(other.Name, StringComparison.OrdinalIgnoreCase);
        }

        public override string ToString()
        {
            return $"{Namespace}.{Name}";
        }

        public override int GetHashCode()
        {
            return Namespace.ToLower().GetHashCode() ^ Name.ToLower().GetHashCode();
        }
    }
}

Fix metadata cache case dependency

Fix metadata cache case dependency


using System.IO;
using System.Text;
using Antlr4.Runtime;
using GraphQL.Language;
using GraphQL.Parsing;

namespace GraphQL.Execution
{
    public class AntlrDocumentBuilder : IDocumentBuilder
    {
        public Document Build(string data)
        {
            var stream = new MemoryStream(Encoding.UTF8.GetBytes(data));
            var reader = new StreamReader(stream);
            var input = new AntlrInputStream(reader);
            var lexer = new GraphQLLexer(input);
            var tokens = new CommonTokenStream(lexer);
            var parser = new GraphQLParser(tokens);
            var documentTree = parser.document();
            var vistor = new GraphQLVisitor();
            return vistor.Visit(documentTree) as Document;
        }
    }
}

using System.IO;
using System.Text;
using Antlr4.Runtime;
using GraphQL.Language;
using GraphQL.Parsing;

namespace GraphQL.Execution
{
    public class AntlrDocumentBuilder : IDocumentBuilder
    {
        public Document Build(string data)
        {
            using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(data)))
            using (var reader = new StreamReader(stream))
            {
                var input = new AntlrInputStream(reader);
                var lexer = new GraphQLLexer(input);
                var tokens = new CommonTokenStream(lexer);
                var parser = new GraphQLParser(tokens);
                var documentTree = parser.document();
                var vistor = new GraphQLVisitor();
                return vistor.Visit(documentTree) as Document;
            }
        }
    }
}

Clean up stream after use.

Clean up stream after use.


using System;
using System.Threading.Tasks;
using NServiceBus;
using NServiceBus.Logging;

class ChaosHandler : IHandleMessages<object>
{
    readonly ILog Log = LogManager.GetLogger<ChaosHandler>();
    readonly double Thresshold = ThreadLocalRandom.NextDouble() * 0.50;

    public Task Handle(object message, IMessageHandlerContext context)
    {
        var result = ThreadLocalRandom.NextDouble();
        if (result < Thresshold) throw new Exception($"Random chaos ({Thresshold * 100:N}% failure)");
        return Task.FromResult(0);
    }
}

using System;
using System.Threading.Tasks;
using NServiceBus;
using NServiceBus.Logging;

class ChaosHandler : IHandleMessages<object>
{
    readonly ILog Log = LogManager.GetLogger<ChaosHandler>();
    readonly double Thresshold = ThreadLocalRandom.NextDouble() * 0.05;

    public Task Handle(object message, IMessageHandlerContext context)
    {
        var result = ThreadLocalRandom.NextDouble();
        if (result < Thresshold) throw new Exception($"Random chaos ({Thresshold * 100:N}% failure)");
        return Task.FromResult(0);
    }
}

Set failure rate to max 5%

Set failure rate to max 5%


using System;
using System.Collections.Generic;
using System.Linq;
using PhotoLife.Data.Contracts;
using PhotoLife.Models;
using PhotoLife.Models.Enums;
using PhotoLife.Services.Contracts;

namespace PhotoLife.Services
{
    public class CategoryService : ICategoryService
    {
        private readonly IRepository<Category> categoryRepository;
        private readonly IUnitOfWork unitOfWork;

        public CategoryService(IRepository<Category> categoryRepository, IUnitOfWork unitOfWork)
        {
            if (categoryRepository == null)
            {
                throw new ArgumentNullException(nameof(categoryRepository));
            }

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

            this.categoryRepository = categoryRepository;
            this.unitOfWork = unitOfWork;
        }

        public Category GetCategoryByName(CategoryEnum categoryEnum)
        {
            return this.categoryRepository.GetAll.FirstOrDefault(c => c.Name.Equals(categoryEnum));
        }

        public IEnumerable<Category> GetAll()
        {
            return this.categoryRepository.GetAll.ToList();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using PhotoLife.Data.Contracts;
using PhotoLife.Models;
using PhotoLife.Models.Enums;
using PhotoLife.Services.Contracts;

namespace PhotoLife.Services
{
    public class CategoryService : ICategoryService
    {
        private readonly IRepository<Category> categoryRepository;
        private readonly IUnitOfWork unitOfWork;

        public CategoryService(IRepository<Category> categoryRepository, IUnitOfWork unitOfWork)
        {
            if (categoryRepository == null)
            {
                throw new ArgumentNullException("categoryRepository");
            }

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

            this.categoryRepository = categoryRepository;
            this.unitOfWork = unitOfWork;
        }

        public Category GetCategoryByName(CategoryEnum categoryEnum)
        {
            return this.categoryRepository.GetAll.FirstOrDefault(c => c.Name.Equals(categoryEnum));
        }

        public IEnumerable<Category> GetAll()
        {
            return this.categoryRepository.GetAll.ToList();
        }
    }
}

Change throw exception due to appharbor build


namespace SyncTrayzor.SyncThing.ApiClient
{
    public class GenericEvent : Event
    {
        public override void Visit(IEventVisitor visitor)
        {
            visitor.Accept(this);
        }

        public override string ToString()
        {
            return $"<GenericEvent ID={this.Id} Type={this.Type} Time={this.Time}>";
        }
    }
}

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

namespace SyncTrayzor.SyncThing.ApiClient
{
    public class GenericEvent : Event
    {
        public override void Visit(IEventVisitor visitor)
        {
            visitor.Accept(this);
        }

        [JsonProperty("data")]
        public JToken Data { get; set; }

        public override string ToString()
        {
            return $"<GenericEvent ID={this.Id} Type={this.Type} Time={this.Time} Data={this.Data.ToString(Formatting.None)}>";
        }
    }
}

Print 'data' fields for generic events

Print 'data' fields for generic events