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

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

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

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

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

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

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


using System;
using System.Web;

namespace VersionOne.SDK.APIClient {
    internal class ValueStringizer {
        private readonly string valueWrapper;

        public ValueStringizer(string valueWrapper = "'") {
            this.valueWrapper = valueWrapper;
        }

        public string Stringize(object value) {
            var valueString = value != null ? Format(value).Replace("'", "''") : null;
            valueString = HttpUtility.UrlEncode(valueString);
            return string.Format("{0}{1}{0}", valueWrapper, valueString);
        }

        private static string Format(object value) {
            if(value is DateTime) {
                var date = (DateTime) value;
                return date.ToString("yyyy-MM-ddTHH:mm:ss.fff");
            }

            return value.ToString();
        }
    }
}

using System;
using System.Web;

namespace VersionOne.SDK.APIClient {
    internal class ValueStringizer {
        private readonly string valueWrapper;

        public ValueStringizer(string valueWrapper = "'") {
            this.valueWrapper = valueWrapper;
        }

        public string Stringize(object value) {
            string valueString = value == null ? null : HttpUtility.UrlEncode(value.ToString());
            return string.Format("{0}{1}{0}", valueWrapper, valueString);
        }

        private static string Format(object value) {
            if(value is DateTime) {
                var date = (DateTime) value;
                return date.ToString("yyyy-MM-ddTHH:mm:ss.fff");
            }

            return value.ToString();
        }
    }
}

Fix for stringize when values contain single quotes.

There was no need for using 2 single quotes since we are doing url
encode to the value.


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

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

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

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

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

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

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


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

public class Team : MonoBehaviour {

	//public List<Drone> team = new List<Drone>();
	public ArrayList team = new ArrayList();
	public GameObject DronePrefab;

	public void addDrone(Drone drone){
		team.Add(drone);
	}

	public void getDronesGameObjects(){
		Debug.Log ("DronesGameObject"+team.Count);
		int i = 1;
		foreach (Drone drone in team) {
			string imageName = "Drone" + i.ToString ();
			string spriteName = drone.eveId.ToString ();
			GameObject droneClone = (GameObject)Instantiate (DronePrefab, transform.position, transform.rotation);
			droneClone.BroadcastMessage ("set", drone.raw);
			Sprite droneImg = (Sprite)Resources.Load("sprites/drones/"+spriteName, typeof(Sprite));
			GameObject image = GameObject.Find (imageName);
			image.GetComponent<Image> ().overrideSprite= droneImg;
			i = i + 1;
		}
	}
}

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

public class Team : MonoBehaviour {

	//public List<Drone> team = new List<Drone>();
	public ArrayList team = new ArrayList();
	public GameObject DronePrefab;

	public void addDrone(Drone drone){
		team.Add(drone);
	}

	public void getDronesGameObjects(){
		Debug.Log ("DronesGameObject"+team.Count);
		int i = 1;
		foreach (Drone drone in team) {
			string imageName = "Drone" + i.ToString ();
			string spriteName = drone.eveId.ToString ();
			GameObject droneClone = (GameObject)Instantiate (DronePrefab, transform.position, transform.rotation);
			droneClone.transform.position = new Vector3(droneClone.transform.position.x + 10 *i, droneClone.transform.position.y, droneClone.transform.position.z);
			droneClone.BroadcastMessage ("set", drone.raw);
			Sprite droneImg = (Sprite)Resources.Load("sprites/drones/"+spriteName, typeof(Sprite));
			GameObject image = GameObject.Find (imageName);
			image.GetComponent<Image> ().overrideSprite= droneImg;
			i = i + 1;
		}
	}
}

Add drone to the right og 10x

Add drone to the right og 10x


using UnityEngine;
using System.Collections;

namespace ecorealms.map {
	public class MapPresenter : MonoBehaviour {

		private int sizeX;
		private int sizeY;

		private GameObject rootObject;
		private Transform root;
		public Mesh mesh;
		public Material material;

		public void Setup(int sizeX, int sizeY) {
			this.sizeX = sizeX;
			this.sizeY = sizeY;

			rootObject = new GameObject("MapRoot");
			root = rootObject.transform;
			rootObject.AddComponent<MeshFilter>().mesh = mesh;
			rootObject.AddComponent<MeshRenderer>().material = material;
		}
	}
}

using UnityEngine;
using System.Collections;

namespace ecorealms.map {
	public class MapPresenter : MonoBehaviour {

		private int sizeX;
		private int sizeY;

		private GameObject rootObject;
		private Transform root;
		public Mesh mesh;
		public Material material;

		private Tile[] tiles;

		public void Setup(int sizeX, int sizeY) {
			this.sizeX = sizeX;
			this.sizeY = sizeY;

			tiles = new Tile[sizeX * sizeY];

			rootObject = new GameObject("MapRoot");
			rootObject.AddComponent<MeshFilter>().mesh = mesh;
			rootObject.AddComponent<MeshRenderer>().material = material;

			root = rootObject.transform;

			StartCoroutine(DelayedFunction());
		}

		private IEnumerator DelayedFunction () {
			//TDOD do something
			yield return new WaitForSeconds(0.5f);
		}

		private void CreateQuad(){
			//Vector3.one;
		}
	}

	public class Tile {

	}
}

Add some new map code

Add some new map code


using MyCouch.Extensions;
using Newtonsoft.Json.Serialization;

namespace MyCouch.Serialization
{
    public class SerializationContractResolver : DefaultContractResolver
    {
        public SerializationContractResolver() : base(true) { }

        protected override string ResolvePropertyName(string propertyName)
        {
            return base.ResolvePropertyName(propertyName.ToCamelCase());
        }
    }
}

using MyCouch.Extensions;
using Newtonsoft.Json.Serialization;

namespace MyCouch.Serialization
{
    public class SerializationContractResolver : DefaultContractResolver
    {
        protected override string ResolvePropertyName(string propertyName)
        {
            return base.ResolvePropertyName(propertyName.ToCamelCase());
        }
    }
}

Remove obsolete chain to base ctor

Remove obsolete chain to base ctor

The bootstraper is having this as single instance anyway,
so as long as the bootstraper is reused, it is ok.


using System.Collections.Generic;

namespace Glimpse.Agent.AspNet.Mvc.Messages
{
    public interface IActionViewFoundMessage
    {
        string ActionId { get; set; }

        string ViewName { get; set; }

        bool DidFind { get; set; }

        ViewResult ViewData { get; set; }
    }
}

using System.Collections.Generic;

namespace Glimpse.Agent.AspNet.Mvc.Messages
{
    public interface IActionViewMessage
    {
        string ActionId { get; set; }

        string ViewName { get; set; }

        bool DidFind { get; set; }

        ViewResult ViewData { get; set; }
    }
}

Update IActionViewMessage message to remove verb


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

#nullable disable

using System;
using System.IO;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Input.Events;
using osu.Framework.Extensions.EnumExtensions;

namespace osu.Framework.Graphics.UserInterface
{
    public abstract class DirectorySelectorDirectory : DirectorySelectorItem
    {
        protected readonly DirectoryInfo Directory;
        protected override string FallbackName => Directory.Name;

        [Resolved]
        private Bindable<DirectoryInfo> currentDirectory { get; set; }

        protected DirectorySelectorDirectory(DirectoryInfo directory, string displayName = null)
            : base(displayName)
        {
            Directory = directory;

            try
            {
                if (directory?.Attributes.HasFlagFast(FileAttributes.System) == true) { }
                else if (directory?.Attributes.HasFlagFast(FileAttributes.Hidden) == true)
                    ApplyHiddenState();
            }
            catch (UnauthorizedAccessException)
            {
                // checking attributes on access-controlled directories will throw an error so we handle it here to prevent a crash
            }
        }

        protected override bool OnClick(ClickEvent e)
        {
            currentDirectory.Value = Directory;
            return true;
        }
    }
}

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

#nullable disable

using System;
using System.IO;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Input.Events;
using osu.Framework.Extensions.EnumExtensions;

namespace osu.Framework.Graphics.UserInterface
{
    public abstract class DirectorySelectorDirectory : DirectorySelectorItem
    {
        protected readonly DirectoryInfo Directory;
        protected override string FallbackName => Directory.Name;

        [Resolved]
        private Bindable<DirectoryInfo> currentDirectory { get; set; }

        protected DirectorySelectorDirectory(DirectoryInfo directory, string displayName = null)
            : base(displayName)
        {
            Directory = directory;

            try
            {
                bool isHidden = directory?.Attributes.HasFlagFast(FileAttributes.Hidden) == true;

                // System drives show up as `System | Hidden | Directory` but shouldn't be shown in a hidden state.
                bool isSystem = directory?.Attributes.HasFlagFast(FileAttributes.System) == true;

                if (isHidden && !isSystem)
                    ApplyHiddenState();
            }
            catch (UnauthorizedAccessException)
            {
                // checking attributes on access-controlled directories will throw an error so we handle it here to prevent a crash
            }
        }

        protected override bool OnClick(ClickEvent e)
        {
            currentDirectory.Value = Directory;
            return true;
        }
    }
}

Improve readability of previous implementation.

Co-authored-by: Dean Herbert <1db828bcd41de75377dce59825af73ae7fca5651@ppy.sh>


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

namespace TextPet.Commands {
	/// <summary>
	/// A command line interface command that sets the current active game.
	/// </summary>
	internal class GameCommand : CliCommand {
		public override string Name => "game";
		public override string RunString => "Initializing game...";

		private const string nameArg = "name";

		public GameCommand(CommandLineInterface cli, TextPetCore core)
			: base(cli, core, new string[] {
				nameArg,
			}) { }

		protected override void RunImplementation() {
			string gameCode = GetRequiredValue(nameArg);
			if (!this.Core.SetActiveGame(gameCode)) {
				Console.ForegroundColor = ConsoleColor.Red;
				Console.WriteLine("ERROR: Unrecognized game name \"" + gameCode + "\".");
			}
		}
	}
}

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

namespace TextPet.Commands {
	/// <summary>
	/// A command line interface command that sets the current active game.
	/// </summary>
	internal class GameCommand : CliCommand {
		public override string Name => "game";
		public override string RunString => "Initializing game...";

		private const string nameArg = "name";

		public GameCommand(CommandLineInterface cli, TextPetCore core)
			: base(cli, core, new string[] {
				nameArg,
			}) { }

		protected override void RunImplementation() {
			string gameCode = GetRequiredValue(nameArg);
			if (!this.Core.SetActiveGame(gameCode)) {
				Console.ForegroundColor = ConsoleColor.Red;
				Console.WriteLine("ERROR: Unrecognized game name \"" + gameCode + "\".");
				Console.ResetColor();
			}
		}
	}
}

Fix console color staying red after unrecognized game error.


using System;
using System.IO;
using System.Xml;
using System.Xml.Linq;

namespace IvionSoft
{
    public abstract class XmlConfig
    {
        public XElement Config { get; private set; }

        public XmlConfig(string file)
        {
            try
            {
                Config = XElement.Load(file);
                Console.WriteLine("-> Loaded config from " + file);
            }
            catch (FileNotFoundException)
            {
                Config = DefaultConfig();
                Config.Save(file);
                Console.WriteLine("-> Created default config at " + file);
            }
            catch (XmlException ex)
            {
                Console.WriteLine("!! XML Exception: " + ex.Message);
                Console.WriteLine("-> Loading default config.");
                Config = DefaultConfig();
            }

            try
            {
                LoadConfig();
            }
            catch (Exception ex)
            {
                if (ex is FormatException || ex is NullReferenceException)
                {
                    Console.WriteLine(" ! Error(s) in loading values from {0}. ({1})", file, ex.Message);
                    Console.WriteLine("-> Loading default config.");
                    Config = DefaultConfig();
                    LoadConfig();
                }
                else
                    throw;
            }
        }

        public abstract void LoadConfig();
        public abstract XElement DefaultConfig();
    }
}

using System;
using System.IO;
using System.Xml;
using System.Xml.Linq;

namespace IvionSoft
{
    public abstract class XmlConfig
    {
        public XElement Config { get; private set; }

        public XmlConfig(string file)
        {
            try
            {
                Config = XElement.Load(file);
                Console.WriteLine("-> Loaded config from " + file);
            }
            catch (FileNotFoundException)
            {
                Config = DefaultConfig();
                Config.Save(file);
                Console.WriteLine("-> Created default config at " + file);
            }
            catch (DirectoryNotFoundException)
            {
                Console.WriteLine(" ! Directory not found: " + file);
                Console.WriteLine("-> Loading default config.");
                Config = DefaultConfig();
            }
            catch (XmlException ex)
            {
                Console.WriteLine("!! XML Exception: " + ex.Message);
                Console.WriteLine("-> Loading default config.");
                Config = DefaultConfig();
            }

            try
            {
                LoadConfig();
            }
            catch (Exception ex)
            {
                if (ex is FormatException || ex is NullReferenceException)
                {
                    Console.WriteLine(" ! Error(s) in loading values from {0}. ({1})", file, ex.Message);
                    Console.WriteLine("-> Loading default config.");
                    Config = DefaultConfig();
                    LoadConfig();
                }
                else
                    throw;
            }
        }

        public abstract void LoadConfig();
        public abstract XElement DefaultConfig();
    }
}

Add an extra catch to handle incorrect paths


using System;

namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution
{
    public enum ExecutionPriority
    {
        Normal,
        Next,
    }

    public record ExecutionOptions
    {
        public static ExecutionOptions Default = new()
        {
            Priority = ExecutionPriority.Normal,
            MustRunInForeground = false,
            InterruptCurrentForeground = false,
        };

        public ExecutionPriority Priority { get; init; }

        public bool MustRunInForeground { get; init; }

        public bool InterruptCurrentForeground { get; init; }
    }

    public record PowerShellExecutionOptions : ExecutionOptions
    {
        public static new PowerShellExecutionOptions Default = new()
        {
            Priority = ExecutionPriority.Normal,
            MustRunInForeground = false,
            InterruptCurrentForeground = false,
            WriteOutputToHost = false,
            WriteInputToHost = false,
            ThrowOnError = true,
            AddToHistory = false,
        };

        public bool WriteOutputToHost { get; init; }

        public bool WriteInputToHost { get; init; }

        public bool ThrowOnError { get; init; }

        public bool AddToHistory { get; init; }
    }
}

using System;

namespace Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution
{
    public enum ExecutionPriority
    {
        Normal,
        Next,
    }

    // Some of the fields of this class are not orthogonal,
    // so it's possible to construct self-contradictory execution options.
    // We should see if it's possible to rework this class to make the options less misconfigurable.
    // Generally the executor will do the right thing though; some options just priority over others.
    public record ExecutionOptions
    {
        public static ExecutionOptions Default = new()
        {
            Priority = ExecutionPriority.Normal,
            MustRunInForeground = false,
            InterruptCurrentForeground = false,
        };

        public ExecutionPriority Priority { get; init; }

        public bool MustRunInForeground { get; init; }

        public bool InterruptCurrentForeground { get; init; }
    }

    public record PowerShellExecutionOptions : ExecutionOptions
    {
        public static new PowerShellExecutionOptions Default = new()
        {
            Priority = ExecutionPriority.Normal,
            MustRunInForeground = false,
            InterruptCurrentForeground = false,
            WriteOutputToHost = false,
            WriteInputToHost = false,
            ThrowOnError = true,
            AddToHistory = false,
        };

        public bool WriteOutputToHost { get; init; }

        public bool WriteInputToHost { get; init; }

        public bool ThrowOnError { get; init; }

        public bool AddToHistory { get; init; }
    }
}

Add comment to execution options class

Add comment to execution options class


@model IEnumerable<BatteryCommander.Web.Models.Evaluation>

Past Due and Upcoming Evaluations

            Ratee
            Rater
            Senior Rater
            Due Date
            Status
            Last Update

        @foreach (var eval in Model)
        {
            var style = eval.LastUpdated < DateTime.Now.AddDays(-30) ? "background-color:red" : "";

                @eval.Ratee
                @eval.Rater
                @eval.SeniorRater
                @eval.ThruDate.ToString("yyyy-MM-dd")
                @eval.Status
                @eval.LastUpdatedHumanized

        }

Evaluation Tracker

@model IEnumerable<BatteryCommander.Web.Models.Evaluation>

Past Due and Upcoming Evaluations

            Ratee
            Rater
            Senior Rater
            Due Date
            Status
            Last Update

        @foreach (var eval in Model)
        {
            var last_update_style = eval.LastUpdated < DateTime.Now.AddDays(-30) ? "background-color:red" : "";
            var thru_date_style = eval.ThruDate < DateTime.Now.AddDays(-60) ? "background-color:red" : "";

                @eval.Ratee
                @eval.Rater
                @eval.SeniorRater
                @eval.ThruDate.ToString("yyyy-MM-dd")
                @eval.Status
                @eval.LastUpdatedHumanized

        }

Evaluation Tracker

Tweak eval due email for thru and last update dates


using MVVM.HTML.Core.V8JavascriptObject;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using MVVM.HTML.Core.Infra;
using MVVM.HTML.Core.Exceptions;

namespace MVVM.HTML.Core.Binding
{
    public static class IJavascriptObjectFactory_CreateEnum_extesion
    {

        public static IJavascriptObject CreateEnum(this IJavascriptObjectFactory @this, Enum ienum)
        {
            IJavascriptObject res = @this.CreateObject(string.Format("new Enum('{0}',{1},'{2}','{3}')",
                ienum.GetType().Name, Convert.ToInt32(ienum), ienum.ToString(), ienum.GetDescription()));

           if ((res==null) || (!res.IsObject))
               throw ExceptionHelper.NoKoExtension();

            return res;
        }

    }
}

using MVVM.HTML.Core.V8JavascriptObject;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using MVVM.HTML.Core.Infra;
using MVVM.HTML.Core.Exceptions;

namespace MVVM.HTML.Core.Binding
{
    public static class IJavascriptObjectFactory_CreateEnum_extesion
    {

        public static IJavascriptObject CreateEnum(this IJavascriptObjectFactory @this, Enum ienum)
        {
            try
            {
                IJavascriptObject res = @this.CreateObject(string.Format("new Enum('{0}',{1},'{2}','{3}')",
                    ienum.GetType().Name, Convert.ToInt32(ienum), ienum.ToString(), ienum.GetDescription()));

                if ((res == null) || (!res.IsObject))
                    throw ExceptionHelper.NoKoExtension();

                return res;
            }
            catch
            {
                throw ExceptionHelper.NoKoExtension();
            }
        }

    }
}

Correct broken test - wrong exception

Correct broken test - wrong exception


using Chalmers.ILL.Members;
using Chalmers.ILL.Models.Page;
using Chalmers.ILL.OrderItems;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Mvc;
using Umbraco.Web.Models;
using Umbraco.Web.Mvc;

namespace Chalmers.ILL.Controllers.SurfaceControllers.Page
{
    public class ChalmersILLDiskPageController : RenderMvcController
    {
        IMemberInfoManager _memberInfoManager;
        IOrderItemSearcher _searcher;

        public ChalmersILLDiskPageController(IMemberInfoManager memberInfoManager, IOrderItemSearcher searcher)
        {
            _memberInfoManager = memberInfoManager;
            _searcher = searcher;
        }

        public override ActionResult Index(RenderModel model)
        {
            var customModel = new ChalmersILLDiskPageModel();

            _memberInfoManager.PopulateModelWithMemberData(Request, Response, customModel);

            if (!String.IsNullOrEmpty(Request.QueryString["query"]))
            {
                customModel.OrderItems = _searcher.Search("\"" + Request.Params["query"] + "\"");
            }

            return CurrentTemplate(customModel);
        }
    }
}

using Chalmers.ILL.Members;
using Chalmers.ILL.Models.Page;
using Chalmers.ILL.OrderItems;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Mvc;
using Umbraco.Web.Models;
using Umbraco.Web.Mvc;

namespace Chalmers.ILL.Controllers.SurfaceControllers.Page
{
    public class ChalmersILLDiskPageController : RenderMvcController
    {
        IMemberInfoManager _memberInfoManager;
        IOrderItemSearcher _searcher;

        public ChalmersILLDiskPageController(IMemberInfoManager memberInfoManager, IOrderItemSearcher searcher)
        {
            _memberInfoManager = memberInfoManager;
            _searcher = searcher;
        }

        public override ActionResult Index(RenderModel model)
        {
            var customModel = new ChalmersILLDiskPageModel();

            _memberInfoManager.PopulateModelWithMemberData(Request, Response, customModel);

            if (!String.IsNullOrEmpty(Request.QueryString["query"]))
            {
                customModel.OrderItems = _searcher.Search("\"" + Request.Params["query"].Trim() + "\"");
            }

            return CurrentTemplate(customModel);
        }
    }
}

Trim search strings in deskapp.

Trim search strings in deskapp.


using Chalmers.ILL.Members;
using Chalmers.ILL.Models.Page;
using Chalmers.ILL.OrderItems;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Mvc;
using Umbraco.Web.Models;
using Umbraco.Web.Mvc;

namespace Chalmers.ILL.Controllers.SurfaceControllers.Page
{
    public class ChalmersILLDiskPageController : RenderMvcController
    {
        IMemberInfoManager _memberInfoManager;
        IOrderItemSearcher _searcher;

        public ChalmersILLDiskPageController(IMemberInfoManager memberInfoManager, IOrderItemSearcher searcher)
        {
            _memberInfoManager = memberInfoManager;
            _searcher = searcher;
        }

        public override ActionResult Index(RenderModel model)
        {
            var customModel = new ChalmersILLDiskPageModel();

            _memberInfoManager.PopulateModelWithMemberData(Request, Response, customModel);

            if (!String.IsNullOrEmpty(Request.QueryString["query"]))
            {
                customModel.OrderItems = _searcher.Search("((type:Bok AND status:(Infodisk OR Utlånad OR Transport OR Krävd)) OR (type:Artikel AND status:Transport)) AND " +
                    "\"" + Request.Params["query"].Trim() + "\"");
            }

            return CurrentTemplate(customModel);
        }
    }
}

using Chalmers.ILL.Members;
using Chalmers.ILL.Models.Page;
using Chalmers.ILL.OrderItems;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Mvc;
using Umbraco.Web.Models;
using Umbraco.Web.Mvc;

namespace Chalmers.ILL.Controllers.SurfaceControllers.Page
{
    public class ChalmersILLDiskPageController : RenderMvcController
    {
        IMemberInfoManager _memberInfoManager;
        IOrderItemSearcher _searcher;

        public ChalmersILLDiskPageController(IMemberInfoManager memberInfoManager, IOrderItemSearcher searcher)
        {
            _memberInfoManager = memberInfoManager;
            _searcher = searcher;
        }

        public override ActionResult Index(RenderModel model)
        {
            var customModel = new ChalmersILLDiskPageModel();

            _memberInfoManager.PopulateModelWithMemberData(Request, Response, customModel);

            if (!String.IsNullOrEmpty(Request.QueryString["query"]))
            {
                customModel.OrderItems = _searcher.Search("((type:Bok AND status:(Infodisk OR Utlånad OR Transport OR Krävd OR Förlorad OR Förlorad\?)) OR (type:Artikel AND status:Transport)) AND " +
                    "\"" + Request.Params["query"].Trim() + "\"");
            }

            return CurrentTemplate(customModel);
        }
    }
}

Include Förlorad and Förlorad? in disk page.


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

namespace System.Globalization
{
    public partial class TextInfo
    {
        //////////////////////////////////////////////////////////////////////////
        ////
        ////  TextInfo Constructors
        ////
        ////  Implements CultureInfo.TextInfo.
        ////
        //////////////////////////////////////////////////////////////////////////
        internal unsafe TextInfo(CultureData cultureData)
        {
            // TODO: Implement this fully.
        }

        private unsafe string ChangeCase(string s, bool toUpper)
        {
            Contract.Assert(s != null);
            // TODO: Implement this fully.

            StringBuilder sb = new StringBuilder(s.Length);

            for (int i = 0; i < s.Length; i++)
            {
                sb.Append(ChangeCaseAscii(s[i], toUpper));
            }

            return sb.ToString();
        }

        private unsafe char ChangeCase(char c, bool toUpper)
        {
            // TODO: Implement this fully.
            return ChangeCaseAscii(c, toUpper);
        }

        // PAL Methods end here.

        internal static char ChangeCaseAscii(char c, bool toUpper = true)
        {
            if (toUpper && c >= 'a' && c <= 'z')
            {
                return (char)('A' + (c - 'a'));
            }
            else if (!toUpper && c >= 'A' && c <= 'Z')
            {
                return (char)('a' + (c - 'A'));
            }

            return c;
        }
    }
}

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

namespace System.Globalization
{
    public partial class TextInfo
    {
        //////////////////////////////////////////////////////////////////////////
        ////
        ////  TextInfo Constructors
        ////
        ////  Implements CultureInfo.TextInfo.
        ////
        //////////////////////////////////////////////////////////////////////////
        internal unsafe TextInfo(CultureData cultureData)
        {
            // TODO: Implement this fully.
            this.m_cultureData = cultureData;
            this.m_cultureName = this.m_cultureData.CultureName;
            this.m_textInfoName = this.m_cultureData.STEXTINFO;
        }

        private unsafe string ChangeCase(string s, bool toUpper)
        {
            Contract.Assert(s != null);
            // TODO: Implement this fully.

            StringBuilder sb = new StringBuilder(s.Length);

            for (int i = 0; i < s.Length; i++)
            {
                sb.Append(ChangeCaseAscii(s[i], toUpper));
            }

            return sb.ToString();
        }

        private unsafe char ChangeCase(char c, bool toUpper)
        {
            // TODO: Implement this fully.
            return ChangeCaseAscii(c, toUpper);
        }

        // PAL Methods end here.

        internal static char ChangeCaseAscii(char c, bool toUpper = true)
        {
            if (toUpper && c >= 'a' && c <= 'z')
            {
                return (char)('A' + (c - 'a'));
            }
            else if (!toUpper && c >= 'A' && c <= 'Z')
            {
                return (char)('a' + (c - 'A'));
            }

            return c;
        }
    }
}

Initialize TextInfo's m_textInfoName in stubbed out globalization

Some System.Runtime.Extensions tests are failing due to IsAsciiCasingSameAsInvariant trying to use a null m_textInfoName.


using System.Collections.Generic;
using System.Linq;
using System.Xml;
using System.Xml.Linq;
using VanillaTransformer.Core.Utility;

namespace VanillaTransformer.Core.ValuesProviders
{
    public class XmlInlineConfigurationValuesProvider:IValuesProvider
    {
        private readonly XElement inlineValues;

        public XmlInlineConfigurationValuesProvider(XElement inlineValues)
        {
            this.inlineValues = inlineValues;
        }

        public IDictionary<string, string> GetValues()
        {
            var result = inlineValues.Elements()
                .Where(x => x.NodeType == XmlNodeType.Element)
                .ToDictionary(el =>
                {
                    var keyAttributeValue = el.Attribute("key")?.Value;
                    var valueName = el.Name.LocalName;
                    if ((valueName == "add" || valueName == "value") && string.IsNullOrWhiteSpace(keyAttributeValue) == false)
                    {
                        return keyAttributeValue;
                    }
                    return valueName;
                }, el => el.GetInnerXmlAsText());
            return result;
        }
    }
}

using System.Collections.Generic;
using System.Linq;
using System.Xml;
using System.Xml.Linq;
using VanillaTransformer.Core.Utility;

namespace VanillaTransformer.Core.ValuesProviders
{
    public class XmlInlineConfigurationValuesProvider:IValuesProvider
    {
        private readonly XElement inlineValues;

        public XmlInlineConfigurationValuesProvider(XElement inlineValues)
        {
            this.inlineValues = inlineValues;
        }

        public IDictionary<string, string> GetValues()
        {
            if (inlineValues == null)
            {
                return new Dictionary<string, string>();
            }

            var result = inlineValues.Elements()
                .Where(x => x.NodeType == XmlNodeType.Element)
                .ToDictionary(el =>
                {
                    var keyAttributeValue = el.Attribute("key")?.Value;
                    var valueName = el.Name.LocalName;
                    if ((valueName == "add" || valueName == "value") && string.IsNullOrWhiteSpace(keyAttributeValue) == false)
                    {
                        return keyAttributeValue;
                    }
                    return valueName;
                }, el => el.GetInnerXmlAsText());
            return result;
        }
    }
}

Fix handling empty values collection

Fix handling empty values collection


namespace NuGet.Lucene.Web.Extension.Controllers
{
    #region Usings

    using AspNet.WebApi.HtmlMicrodataFormatter;

    using NuGet.Lucene.Web.DataServices;
    using NuGet.Lucene.Web.Hubs;

    #endregion

    /// <summary>
    ///     Provides documentation and semantic information about various
    ///     resources and actions configured for use in this application.
    /// </summary>
    public class NuGetMultiRepositoryDocumentationController : DocumentationController
    {
        #region Public Properties

        [Ninject.Inject]
        public NuGetMultiRepositoryWebApiRouteMapper NuGetWebApiRouteMapper { get; set; }

        #endregion

        #region Public Methods and Operators

        /// <summary>
        ///     Probably the document you are reading now.
        /// </summary>
        public override SimpleApiDocumentation GetApiDocumentation()
        {
            var docs = base.GetApiDocumentation();

            docs.Add(
                "Packages",
                new SimpleApiDescription(this.Request, "OData", this.NuGetWebApiRouteMapper.ODataRoutePath)
                {
                    Documentation
                        =
                        this
                        .DocumentationProvider
                        .GetDocumentation
                        (
                            typeof
                        (
                        PackageDataService
                        ))
                });

            docs.Add(
                "Indexing",
                new SimpleApiDescription(this.Request, "Hub", this.NuGetWebApiRouteMapper.SignalrRoutePath)
                {
                    Documentation
                        =
                        this
                        .DocumentationProvider
                        .GetDocumentation
                        (
                            typeof
                        (
                        StatusHub
                        ))
                });

            return docs;
        }

        #endregion
    }
}

namespace NuGet.Lucene.Web.Extension.Controllers
{
    #region Usings

    using AspNet.WebApi.HtmlMicrodataFormatter;

    using NuGet.Lucene.Web.DataServices;
    using NuGet.Lucene.Web.Hubs;

    #endregion

    /// <summary>
    ///     Provides documentation and semantic information about various
    ///     resources and actions configured for use in this application.
    /// </summary>
    public class NuGetMultiRepositoryDocumentationController : DocumentationController
    {
        #region Public Properties

        [Ninject.Inject]
        public NuGetMultiRepositoryWebApiRouteMapper NuGetWebApiRouteMapper { get; set; }

        #endregion

        #region Public Methods and Operators

        /// <summary>
        ///     Probably the document you are reading now.
        /// </summary>
        public override SimpleApiDocumentation GetApiDocumentation()
        {
            var docs = base.GetApiDocumentation();

            docs.Add(
                "Packages",
                new SimpleApiDescription(this.Request, "OData", this.NuGetWebApiRouteMapper.ODataRoutePath)
                {
                    Documentation
                        =
                        this
                        .DocumentationProvider
                        .GetDocumentation
                        (
                            typeof
                        (
                        PackageDataService
                        ))
                });

            return docs;
        }

        #endregion
    }
}

Remove currently not used signal r documentation


// 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.Linq;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Screens;

namespace osu.Game.Graphics.UserInterface
{
    /// <summary>
    /// A <see cref="BreadcrumbControl{IScreen}"/> which follows the active screen (and allows navigation) in a <see cref="Screen"/> stack.
    /// </summary>
    public class ScreenBreadcrumbControl : BreadcrumbControl<IScreen>
    {
        public ScreenBreadcrumbControl(ScreenStack stack)
        {
            stack.ScreenPushed += onPushed;
            stack.ScreenExited += onExited;

            if (stack.CurrentScreen != null)
                onPushed(null, stack.CurrentScreen);

            Current.ValueChanged += current => current.NewValue.MakeCurrent();
        }

        private void onPushed(IScreen lastScreen, IScreen newScreen)
        {
            AddItem(newScreen);
            Current.Value = newScreen;
        }

        private void onExited(IScreen lastScreen, IScreen newScreen)
        {
            if (newScreen != null)
                Current.Value = newScreen;

            Items.ToList().SkipWhile(s => s != Current.Value).Skip(1).ForEach(RemoveItem);
        }
    }
}

// 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.Linq;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Screens;

namespace osu.Game.Graphics.UserInterface
{
    /// <summary>
    /// A <see cref="BreadcrumbControl{IScreen}"/> which follows the active screen (and allows navigation) in a <see cref="Screen"/> stack.
    /// </summary>
    public class ScreenBreadcrumbControl : BreadcrumbControl<IScreen>
    {
        public ScreenBreadcrumbControl(ScreenStack stack)
        {
            stack.ScreenPushed += onPushed;
            stack.ScreenExited += onExited;

            if (stack.CurrentScreen != null)
                onPushed(null, stack.CurrentScreen);
        }

        protected override void SelectTab(TabItem<IScreen> tab)
        {
            // override base method to prevent current item from being changed on click.
            // depend on screen push/exit to change current item instead.
            tab.Value.MakeCurrent();
        }

        private void onPushed(IScreen lastScreen, IScreen newScreen)
        {
            AddItem(newScreen);
            Current.Value = newScreen;
        }

        private void onExited(IScreen lastScreen, IScreen newScreen)
        {
            if (newScreen != null)
                Current.Value = newScreen;

            Items.ToList().SkipWhile(s => s != Current.Value).Skip(1).ForEach(RemoveItem);
        }
    }
}

Fix screen breadcrumb control updating on click


using System;

namespace MySql.Data.MySqlClient
{
	public enum MySqlDbType
	{
		Decimal,
		Byte,
		Int16,
		Int24 = 9,
		Int32 = 3,
		Int64 = 8,
		Float = 4,
		Double,
		Timestamp = 7,
		Date = 10,
		Time,
		DateTime,
		[Obsolete("The Datetime enum value is obsolete.  Please use DateTime.")]
		Datetime = 12,
		Year,
		Newdate,
		VarString,
		Bit,
		JSON = 245,
		NewDecimal,
		Enum,
		Set,
		TinyBlob,
		MediumBlob,
		LongBlob,
		Blob,
		VarChar,
		String,
		Geometry,
		UByte = 501,
		UInt16,
		UInt24 = 509,
		UInt32 = 503,
		UInt64 = 508,
		Binary = 600,
		VarBinary,
		TinyText = 749,
		MediumText,
		LongText,
		Text,
		Guid = 800
	}
}

using System;

namespace MySql.Data.MySqlClient
{
	public enum MySqlDbType
	{
		Decimal,
		Byte,
		Int16,
		Int32,
		Float,
		Double,
		Timestamp = 7,
		Int64,
		Int24,
		Date,
		Time,
		DateTime,
		[Obsolete("The Datetime enum value is obsolete.  Please use DateTime.")]
		Datetime = 12,
		Year,
		Newdate,
		VarString,
		Bit,
		JSON = 245,
		NewDecimal,
		Enum,
		Set,
		TinyBlob,
		MediumBlob,
		LongBlob,
		Blob,
		VarChar,
		String,
		Geometry,
		UByte = 501,
		UInt16,
		UInt32,
		UInt64 = 508,
		UInt24,
		Binary = 600,
		VarBinary,
		TinyText = 749,
		MediumText,
		LongText,
		Text,
		Guid = 800
	}
}

Rearrange values in numeric order.

Rearrange values in numeric order.


using System;
using System.Linq;
using System.Reflection;
using Abp.Dependency;
using Castle.Core;

namespace Abp.EntityHistory
{
    internal static class EntityHistoryInterceptorRegistrar
    {
        public static void Initialize(IIocManager iocManager)
        {
            iocManager.IocContainer.Kernel.ComponentRegistered += (key, handler) =>
            {
                if (!iocManager.IsRegistered<IEntityHistoryConfiguration>())
                {
                    return;
                }

                var entityHistoryConfiguration = iocManager.Resolve<IEntityHistoryConfiguration>();

                if (ShouldIntercept(entityHistoryConfiguration, handler.ComponentModel.Implementation))
                {
                    handler.ComponentModel.Interceptors.Add(new InterceptorReference(typeof(EntityHistoryInterceptor)));
                }
            };
        }

        private static bool ShouldIntercept(IEntityHistoryConfiguration entityHistoryConfiguration, Type type)
        {
            if (entityHistoryConfiguration.Selectors.Any(selector => selector.Predicate(type)))
            {
                return true;
            }

            if (type.GetTypeInfo().IsDefined(typeof(UseCaseAttribute), true))
            {
                return true;
            }

            if (type.GetMethods().Any(m => m.IsDefined(typeof(UseCaseAttribute), true)))
            {
                return true;
            }

            return false;
        }
    }
}

using System;
using System.Linq;
using System.Reflection;
using Abp.Dependency;
using Castle.Core;

namespace Abp.EntityHistory
{
    internal static class EntityHistoryInterceptorRegistrar
    {
        public static void Initialize(IIocManager iocManager)
        {
            iocManager.IocContainer.Kernel.ComponentRegistered += (key, handler) =>
            {
                if (!iocManager.IsRegistered<IEntityHistoryConfiguration>())
                {
                    return;
                }

                var entityHistoryConfiguration = iocManager.Resolve<IEntityHistoryConfiguration>();

                if (ShouldIntercept(entityHistoryConfiguration, handler.ComponentModel.Implementation))
                {
                    handler.ComponentModel.Interceptors.Add(new InterceptorReference(typeof(EntityHistoryInterceptor)));
                }
            };
        }

        private static bool ShouldIntercept(IEntityHistoryConfiguration entityHistoryConfiguration, Type type)
        {
            if (type.GetTypeInfo().IsDefined(typeof(UseCaseAttribute), true))
            {
                return true;
            }

            if (type.GetMethods().Any(m => m.IsDefined(typeof(UseCaseAttribute), true)))
            {
                return true;
            }

            return false;
        }
    }
}

Remove unintended use of Selectors for interception


using System;
using System.Linq;
using System.Net;
using System.Web.Http;
using VotingApplication.Data.Context;
using VotingApplication.Data.Model;
using VotingApplication.Web.Api.Models.DBViewModels;

namespace VotingApplication.Web.Api.Controllers
{
    public class ManagePollTypeController : WebApiController
    {
        public ManagePollTypeController() : base() { }

        public ManagePollTypeController(IContextFactory contextFactory) : base(contextFactory) { }

        [HttpPut]
        public void Put(Guid manageId, ManagePollTypeRequest updateRequest)
        {
            using (var context = _contextFactory.CreateContext())
            {
                Poll poll = context.Polls.Where(p => p.ManageId == manageId).SingleOrDefault();

                if (poll == null)
                {
                    ThrowError(HttpStatusCode.NotFound, string.Format("Poll for manage id {0} not found", manageId));
                }

                if (!ModelState.IsValid)
                {
                    ThrowError(HttpStatusCode.BadRequest, ModelState);
                }

                poll.PollType = (PollType)Enum.Parse(typeof(PollType), updateRequest.PollType, true);
                poll.MaxPerVote = updateRequest.MaxPerVote;
                poll.MaxPoints = updateRequest.MaxPoints;

                poll.LastUpdated = DateTime.Now;

                context.SaveChanges();
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Net;
using System.Web.Http;
using VotingApplication.Data.Context;
using VotingApplication.Data.Model;
using VotingApplication.Web.Api.Models.DBViewModels;

namespace VotingApplication.Web.Api.Controllers
{
    public class ManagePollTypeController : WebApiController
    {
        public ManagePollTypeController() : base() { }

        public ManagePollTypeController(IContextFactory contextFactory) : base(contextFactory) { }

        [HttpPut]
        public void Put(Guid manageId, ManagePollTypeRequest updateRequest)
        {
            using (var context = _contextFactory.CreateContext())
            {
                Poll poll = context.Polls.Where(p => p.ManageId == manageId).SingleOrDefault();

                if (poll == null)
                {
                    ThrowError(HttpStatusCode.NotFound, string.Format("Poll for manage id {0} not found", manageId));
                }

                if (!ModelState.IsValid)
                {
                    ThrowError(HttpStatusCode.BadRequest, ModelState);
                }

                if (updateRequest.PollType.ToLower() != poll.PollType.ToString().ToLower())
                {
                    List<Vote> removedVotes = context.Votes.Include(v => v.Poll)
                                                            .Where(v => v.Poll.UUID == poll.UUID)
                                                            .ToList();
                    foreach (Vote oldVote in removedVotes)
                    {
                        context.Votes.Remove(oldVote);
                    }

                    poll.PollType = (PollType)Enum.Parse(typeof(PollType), updateRequest.PollType, true);
                    poll.MaxPerVote = updateRequest.MaxPerVote;
                }

                poll.MaxPoints = updateRequest.MaxPoints;

                poll.LastUpdated = DateTime.Now;

                context.SaveChanges();
            }
        }
    }
}

Remove votes when changing poll type

Remove votes when changing poll type


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

namespace Conventional
{
    public class TypeScanner : ITypeScanner
    {
        private readonly ITypeSource _typeSource;
        private readonly IList<IConvention> _conventions = new List<IConvention>();

        public TypeScanner(ITypeSource typeSource)
        {
            _typeSource = typeSource;
        }

        public void AddConvention(IConvention convention)
        {
            _conventions.Add(convention);
        }

        internal void Run(Func<Type, Action<Type>> installers)
        {
            var types = _typeSource.GetTypes().ToList();

            foreach (var convention in _conventions)
                foreach (var type in types)
                    if (convention.Matches(type))
                        installers(convention.GetType())(type);
        }

        internal IEnumerable<Registration> GetRegistrations()
        {
            var types = new Lazy<IEnumerable<Type>>(() => _typeSource.GetTypes().ToList(),
                                                     LazyThreadSafetyMode.ExecutionAndPublication);

            return from c in _conventions.AsParallel().AsOrdered()
                   let ct = c.GetType()
                   from t in types.Value
                   where c.Matches(t)
                   select new Registration(ct, t);
        }
    }
}

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

namespace Conventional
{
    public class TypeScanner : ITypeScanner
    {
        private readonly ITypeSource _typeSource;
        private readonly IList<IConvention> _conventions = new List<IConvention>();

        public TypeScanner(ITypeSource typeSource)
        {
            _typeSource = typeSource;
        }

        public void AddConvention(IConvention convention)
        {
            _conventions.Add(convention);
        }

        internal IEnumerable<Registration> GetRegistrations()
        {
            var types = _typeSource.GetTypes().ToList();

            return from c in _conventions.AsParallel().AsOrdered()
                   let ct = c.GetType()
                   from t in types
                   where c.Matches(t)
                   select new Registration(ct, t);
        }
    }
}

Clean up type scanner and remove lazy initialization of assembly types


using Neptuo.Observables.Commands;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WebCamImageCollector.RemoteControl.Services;
using WebCamImageCollector.RemoteControl.Views;

namespace WebCamImageCollector.RemoteControl.ViewModels.Commands
{
    public class DeleteLocalCommand : NavigateCommand
    {
        public DeleteLocalCommand()
            :  base(typeof(Overview))
        { }

        public override bool CanExecute()
        {
            return true;
        }

        public override void Execute()
        {
            ClientRepository repository = new ClientRepository();
            repository.DeleteLocal();
        }
    }
}

using Neptuo.Observables.Commands;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WebCamImageCollector.RemoteControl.Services;
using WebCamImageCollector.RemoteControl.Views;

namespace WebCamImageCollector.RemoteControl.ViewModels.Commands
{
    public class DeleteLocalCommand : NavigateCommand
    {
        public DeleteLocalCommand()
            :  base(typeof(Overview))
        { }

        public override bool CanExecute()
        {
            return true;
        }

        public override void Execute()
        {
            ClientRepository repository = new ClientRepository();
            repository.DeleteLocal();

            base.Execute();
        }
    }
}

Fix navigation to Overview after deleting LocalClient.


namespace Sandbox
{
    public class Program
    {
        public static void Main()
        {
        }
    }
}

using System.Threading.Tasks;

namespace Sandbox
{
    public class Program
    {
        public static void Main() => new Program().MainAsync().GetAwaiter().GetResult();

        private async Task MainAsync()
        {

        }
    }
}

Use MainAsync instead of Main

Use MainAsync instead of Main


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

namespace NuPack.Dialog.PackageManagerUI {

    public class StringCollectionsToStringConverter : IValueConverter {

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

            return value;
        }

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

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

namespace NuPack.Dialog.PackageManagerUI {

    public class StringCollectionsToStringConverter : IValueConverter {

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

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

            return value;
        }

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

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


using System.Collections.Generic;
using System.Runtime.CompilerServices;

namespace SharpLayout
{
    public class Section
    {
        public PageSettings PageSettings { get; }
        public List<Table> Tables { get; } = new List<Table>();

        public Section(PageSettings pageSettings)
        {
            PageSettings = pageSettings;
        }

        public Table AddTable([CallerLineNumber] int line = 0)
        {
            var table = new Table(line);
            Tables.Add(table);
            return table;
        }
    }
}

using System.Collections.Generic;
using System.Runtime.CompilerServices;

namespace SharpLayout
{
    public class Section
    {
        public PageSettings PageSettings { get; }
        public List<Table> Tables { get; } = new List<Table>();

        public Section(PageSettings pageSettings)
        {
            PageSettings = pageSettings;
        }

        public Table AddTable([CallerLineNumber] int line = 0)
        {
            var table = new Table(line);
            Tables.Add(table);
            return table;
        }

        public Section Add(Paragraph paragraph, [CallerLineNumber] int line = 0, [CallerFilePath] string filePath = "")
        {
            var table = AddTable();
            var c1 = table.AddColumn(PageSettings.PageWidthWithoutMargins);
            var r1 = table.AddRow();
            r1[c1, line, filePath].Add(paragraph);
            return this;
        }
    }
}

Add method to add paragraph to section

Add method to add paragraph to section


using System.Collections.Generic;
using System.IO;
using System.Linq;
using ICSharpCode.SharpZipLib.Tar;

namespace AppHarbor
{
	public static class CompressionExtensions
	{
		public static void ToTar(this DirectoryInfo sourceDirectory, Stream output)
		{
			var archive = TarArchive.CreateOutputTarArchive(output);

			archive.RootPath = sourceDirectory.FullName.Replace(Path.DirectorySeparatorChar, '/').TrimEnd('/');

			var entries = GetFiles(sourceDirectory, new string[] { ".git", ".hg" })
				.Select(x => TarEntry.CreateEntryFromFile(x.FullName));

			foreach (var entry in entries)
			{
				archive.WriteEntry(entry, true);
			}

			archive.Close();
		}

		private static FileInfo[] GetFiles(DirectoryInfo directory, string[] excludedDirectories)
		{
			var files = directory.GetFiles("*", SearchOption.TopDirectoryOnly);
			foreach (var nestedDirectory in directory.GetDirectories())
			{
				if (excludedDirectories.Contains(nestedDirectory.Name))
				{
					continue;
				}
				files.Concat(GetFiles(nestedDirectory, excludedDirectories));
			}

			return files;
		}
	}
}

using System.Collections.Generic;
using System.IO;
using System.Linq;
using ICSharpCode.SharpZipLib.Tar;

namespace AppHarbor
{
	public static class CompressionExtensions
	{
		public static void ToTar(this DirectoryInfo sourceDirectory, Stream output)
		{
			var archive = TarArchive.CreateOutputTarArchive(output);

			archive.RootPath = sourceDirectory.FullName.Replace(Path.DirectorySeparatorChar, '/').TrimEnd('/');

			var entries = GetFiles(sourceDirectory, new string[] { ".git", ".hg" })
				.Select(x => TarEntry.CreateEntryFromFile(x.FullName));

			foreach (var entry in entries)
			{
				archive.WriteEntry(entry, true);
			}

			archive.Close();
		}

		private static FileInfo[] GetFiles(DirectoryInfo directory, string[] excludedDirectories)
		{
			var files = directory.GetFiles("*", SearchOption.TopDirectoryOnly);
			foreach (var nestedDirectory in directory.GetDirectories())
			{
				if (excludedDirectories.Contains(nestedDirectory.Name))
				{
					continue;
				}
				files = files.Concat(GetFiles(nestedDirectory, excludedDirectories));
			}

			return files;
		}
	}
}

Make sure to assign concatted value to variable


using Windows.UI.Xaml;
using System.Threading.Tasks;
using TraktApiSharp.Example.UWP.Services.SettingsServices;
using Windows.ApplicationModel.Activation;
using Template10.Controls;
using Template10.Common;
using System;
using System.Linq;
using Windows.UI.Xaml.Data;

namespace TraktApiSharp.Example.UWP
{
    /// Documentation on APIs used in this page:
    /// https://github.com/Windows-XAML/Template10/wiki

    [Bindable]
    sealed partial class App : Template10.Common.BootStrapper
    {
        public App()
        {
            InitializeComponent();
            SplashFactory = (e) => new Views.Splash(e);

            #region App settings

            var _settings = SettingsService.Instance;
            RequestedTheme = _settings.AppTheme;
            CacheMaxDuration = _settings.CacheMaxDuration;
            ShowShellBackButton = _settings.UseShellBackButton;

            #endregion
        }

        public override async Task OnInitializeAsync(IActivatedEventArgs args)
        {
            if (Window.Current.Content as ModalDialog == null)
            {
                // create a new frame
                var nav = NavigationServiceFactory(BackButton.Attach, ExistingContent.Include);

                // create modal root
                Window.Current.Content = new ModalDialog
                {
                    DisableBackButtonWhenModal = true,
                    Content = new Views.Shell(nav),
                    ModalContent = new Views.Busy(),
                };
            }
            await Task.CompletedTask;
        }

        public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
        {
            // long-running startup tasks go here
            await Task.Delay(5000);

            NavigationService.Navigate(typeof(Views.MainPage));
            await Task.CompletedTask;
        }
    }
}

using System.Threading.Tasks;
using Template10.Controls;
using TraktApiSharp.Example.UWP.Services.SettingsServices;
using Windows.ApplicationModel.Activation;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Data;

namespace TraktApiSharp.Example.UWP
{
    /// Documentation on APIs used in this page:
    /// https://github.com/Windows-XAML/Template10/wiki

    [Bindable]
    sealed partial class App : Template10.Common.BootStrapper
    {
        public App()
        {
            InitializeComponent();
            SplashFactory = (e) => new Views.Splash(e);

            var settings = SettingsService.Instance;
            RequestedTheme = settings.AppTheme;
            CacheMaxDuration = settings.CacheMaxDuration;
            ShowShellBackButton = settings.UseShellBackButton;
        }

        public override async Task OnInitializeAsync(IActivatedEventArgs args)
        {
            if (Window.Current.Content as ModalDialog == null)
            {
                // create a new frame
                var nav = NavigationServiceFactory(BackButton.Attach, ExistingContent.Include);

                // create modal root
                Window.Current.Content = new ModalDialog
                {
                    DisableBackButtonWhenModal = true,
                    Content = new Views.Shell(nav),
                    ModalContent = new Views.Busy(),
                };
            }

            await Task.CompletedTask;
        }

        public override async Task OnStartAsync(StartKind startKind, IActivatedEventArgs args)
        {
            NavigationService.Navigate(typeof(Views.MainPage));
            await Task.CompletedTask;
        }
    }
}

Remove startup delay from project template.


using CommandLine;
using CommandLine.Text;

namespace Builder
{
    public enum OptionBool
    {
        False,
        True
    }

    public class Options
    {
        [Option("buildDir", Required = true)]
        public string BuildDir { get; set; }

        [Option("buildArtifactsCacheDir", Required = false)]
        public string BuildArtifactsCacheDir { get; set; }

        [Option("buildpackOrder", Required = false)]
        public string BuildpackOrder { get; set; }

        [Option("buildpacksDir", Required = false)]
        public string BuildpacksDir { get; set; }

        [Option("outputBuildArtifactsCache", Required = false)]
        public string OutputBuildArtifactsCache { get; set; }

        [Option("outputDroplet", Required = true)]
        public string OutputDroplet { get; set; }

        [Option("outputMetadata", Required = true)]
        public string OutputMetadata { get; set; }

        [Option("skipDetect", Required = false, DefaultValue = OptionBool.False)]
        public OptionBool SkipDetect { get; set; }

        [HelpOption]
        public string GetUsage()
        {
            return HelpText.AutoBuild(this,
              (HelpText current) => HelpText.DefaultParsingErrorsHandler(this, current));
        }
    }
}

using CommandLine;
using CommandLine.Text;

namespace Builder
{
    public enum OptionBool
    {
        False,
        True
    }

    public class Options
    {
        [Option("buildDir", Required = true)]
        public string BuildDir { get; set; }

        [Option("buildArtifactsCacheDir", Required = false)]
        public string BuildArtifactsCacheDir { get; set; }

        [Option("buildpackOrder", Required = false)]
        public string BuildpackOrder { get; set; }

        [Option("buildpacksDir", Required = false)]
        public string BuildpacksDir { get; set; }

        [Option("outputBuildArtifactsCache", Required = false)]
        public string OutputBuildArtifactsCache { get; set; }

        [Option("outputDroplet", Required = true)]
        public string OutputDroplet { get; set; }

        [Option("outputMetadata", Required = true)]
        public string OutputMetadata { get; set; }

        [Option("skipDetect", Required = false, DefaultValue = OptionBool.False)]
        public OptionBool SkipDetect { get; set; }

        [Option("skipCertVerify", Required = false)]
        public OptionBool SkipCertVerify { get; set; }

        [HelpOption]
        public string GetUsage()
        {
            return HelpText.AutoBuild(this,
              (HelpText current) => HelpText.DefaultParsingErrorsHandler(this, current));
        }
    }
}

Add skipCertVerify back to options

Add skipCertVerify back to options


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

public class ProfileKeys {
    public static string login_count = "login_count";
}

public class Profile : DataObject {

    public virtual int login_count {
        get {
            return Get<int>(ProfileKeys.login_count);
        }

        set {
            Set(ProfileKeys.login_count, value);
        }
    }

    public virtual string username {
        get {
            return Get<string>(BaseDataObjectKeys.username);
        }

        set {
            Set(BaseDataObjectKeys.username, value);
        }
    }

    public virtual string uuid {
        get {

            //string val = Get<string>(BaseDataObjectKeys.uuid);
            //if(string.IsNullOrEmpty(val)) {
            //    val = UniqueUtil.Instance.CreateUUID4();
            //    Set(BaseDataObjectKeys.uuid, val);
            //}

            return Get<string>(BaseDataObjectKeys.uuid,
                               UniqueUtil.Instance.CreateUUID4());
        }

        set {
            Set(BaseDataObjectKeys.uuid, value);
        }
    }

    public Profile() {
        Reset();
    }

    public void ChangeUser(string name) {
        Reset();

        username = name;
    }

    public void ChangeUserNoReset(string name) {
        username = name;
    }

    public override void Reset() {
        base.Reset();

        username = "Player";
        uuid = "";
    }
}

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

public class ProfileKeys {
    public static string login_count = "login_count";
}

public class Profile : DataObject {

    public virtual int login_count {
        get {
            return Get<int>(ProfileKeys.login_count);
        }

        set {
            Set(ProfileKeys.login_count, value);
        }
    }

    public virtual string username {
        get {
            return Get<string>(BaseDataObjectKeys.username);
        }

        set {
            Set(BaseDataObjectKeys.username, value);
        }
    }

    public virtual string uuid {
        get {

            //string val = Get<string>(BaseDataObjectKeys.uuid);
            //if(string.IsNullOrEmpty(val)) {
            //    val = UniqueUtil.Instance.CreateUUID4();
            //    Set(BaseDataObjectKeys.uuid, val);
            //}

            return Get<string>(BaseDataObjectKeys.uuid,
                               UniqueUtil.Instance.CreateUUID4());
        }

        set {
            Set(BaseDataObjectKeys.uuid, value);
        }
    }

    public Profile() {
        Reset();
    }

    public void ChangeUser(string name) {

        if(name == username) {
            return;
        }

        Reset();

        username = name;
    }

    public void ChangeUserNoReset(string name) {
        username = name;
    }

    public override void Reset() {
        base.Reset();

        username = "Player";
        uuid = "";
    }
}

Update change user, don't update if same val.


using System;
using System.Collections.Generic;
using Avalonia.Native.Interop;
using Avalonia.Platform;

namespace Avalonia.Native
{
    class ScreenImpl : IScreenImpl, IDisposable
    {
        private IAvnScreens _native;

        public ScreenImpl(IAvnScreens native)
        {
            _native = native;
        }

        public int ScreenCount => _native.GetScreenCount();

        public IReadOnlyList<Screen> AllScreens
        {
            get
            {
                if (_native != null)
                {
                    var count = ScreenCount;
                    var result = new Screen[count];

                    for (int i = 0; i < count; i++)
                    {
                        var screen = _native.GetScreen(i);

                        result[i] = new Screen(
                            screen.PixelDensity,
                            screen.Bounds.ToAvaloniaPixelRect(),
                            screen.WorkingArea.ToAvaloniaPixelRect(),
                            screen.Primary);
                    }

                    return result;
                }

                return new List<Screen>();
            }
        }

        public void Dispose ()
        {
            _native?.Dispose();
            _native = null;
        }
    }
}

using System;
using System.Collections.Generic;
using Avalonia.Native.Interop;
using Avalonia.Platform;

namespace Avalonia.Native
{
    class ScreenImpl : IScreenImpl, IDisposable
    {
        private IAvnScreens _native;

        public ScreenImpl(IAvnScreens native)
        {
            _native = native;
        }

        public int ScreenCount => _native.GetScreenCount();

        public IReadOnlyList<Screen> AllScreens
        {
            get
            {
                if (_native != null)
                {
                    var count = ScreenCount;
                    var result = new Screen[count];

                    for (int i = 0; i < count; i++)
                    {
                        var screen = _native.GetScreen(i);

                        result[i] = new Screen(
                            screen.PixelDensity,
                            screen.Bounds.ToAvaloniaPixelRect(),
                            screen.WorkingArea.ToAvaloniaPixelRect(),
                            screen.Primary);
                    }

                    return result;
                }

                return Array.Empty<Screen>();
            }
        }

        public void Dispose ()
        {
            _native?.Dispose();
            _native = null;
        }
    }
}

Use Array.Empty instead of list.

Use Array.Empty instead of list.

Co-authored-by: jp2masa <9fbaf4cd1a94d3d15b2d6800c6bfb955d5b2dc3c@users.noreply.github.com>


using System.IO;
using CppSharp.Generators;

namespace CppSharp.Utils
{
    public abstract class LibraryTest : ILibrary
    {
        readonly string name;
        readonly LanguageGeneratorKind kind;

        public LibraryTest(string name, LanguageGeneratorKind kind)
        {
            this.name = name;
            this.kind = kind;
        }

        public virtual void Setup(DriverOptions options)
        {
            options.LibraryName = name + ".Native";
            options.GeneratorKind = kind;
            options.OutputDir = "../gen/" + name;
            options.GenerateLibraryNamespace = false;

            var path = "../../../tests/" + name;
            options.IncludeDirs.Add(path);

            var files = Directory.EnumerateFiles(path, "*.h");
            foreach(var file in files)
                options.Headers.Add(Path.GetFileName(file));
        }

        public virtual void Preprocess(Library lib)
        {
        }

        public virtual void Postprocess(Library lib)
        {
        }

        public virtual void SetupPasses(Driver driver, PassBuilder passes)
        {
        }

        public virtual void GenerateStart(TextTemplate template)
        {
        }

        public virtual void GenerateAfterNamespaces(TextTemplate template)
        {
        }
    }
}

using System.IO;
using CppSharp.Generators;

namespace CppSharp.Utils
{
    public abstract class LibraryTest : ILibrary
    {
        readonly string name;
        readonly LanguageGeneratorKind kind;

        public LibraryTest(string name, LanguageGeneratorKind kind)
        {
            this.name = name;
            this.kind = kind;
        }

        public virtual void Setup(Driver driver)
        {
            var options = driver.Options;
            options.LibraryName = name + ".Native";
            options.GeneratorKind = kind;
            options.OutputDir = "../gen/" + name;
            options.GenerateLibraryNamespace = false;

            var path = "../../../tests/" + name;
            options.IncludeDirs.Add(path);

            var files = Directory.EnumerateFiles(path, "*.h");
            foreach(var file in files)
                options.Headers.Add(Path.GetFileName(file));
        }

        public virtual void Preprocess(Driver driver, Library lib)
        {
        }

        public virtual void Postprocess(Library lib)
        {
        }

        public virtual void SetupPasses(Driver driver, PassBuilder passes)
        {
        }

        public virtual void GenerateStart(TextTemplate template)
        {
        }

        public virtual void GenerateAfterNamespaces(TextTemplate template)
        {
        }
    }
}

Update test utility class for new ILibrary interface.


@using SpaceBlog.Models;
    @model IEnumerable

    @{
        ViewBag.Title = "Index";
    }

Index

             Title
             Author

        @foreach(var article in Model)
        {

                 @article.title
                 @article.Author

        }

@using SpaceBlog.Models;
    @model IEnumerable

    @{
        ViewBag.Title = "Index";
    }

Index

             Title
             Author

        @foreach(var article in Model)
        {

                 @article.Title
                 Намазано от: @article.Author.FullName

        }

Add action to "Read more" button

Add action to "Read more" button


using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using ExplicitlyImpl.AspNetCore.Mvc.FluentActions;

namespace SimpleApi
{
    public class Startup
    {
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().AddFluentActions();

            services.AddTransient<IUserService, UserService>();
            services.AddTransient<INoteService, NoteService>();
        }

        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            app.UseFluentActions(actions =>
            {
                actions.RouteGet("/").To(() => "Hello World!");

                actions.Add(UserActions.All);
                actions.Add(NoteActions.All);
            });
            app.UseMvc();
        }
    }
}

using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.DependencyInjection;
using ExplicitlyImpl.AspNetCore.Mvc.FluentActions;
using Microsoft.AspNetCore.Mvc;

namespace SimpleApi
{
    public class Startup
    {
        public void ConfigureServices(IServiceCollection services)
        {
            services
                .AddMvc()
                .AddFluentActions()
                .SetCompatibilityVersion(CompatibilityVersion.Version_2_2);

            services.AddTransient<IUserService, UserService>();
            services.AddTransient<INoteService, NoteService>();
        }

        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            app.UseFluentActions(actions =>
            {
                actions.RouteGet("/").To(() => "Hello World!");

                actions.Add(UserActions.All);
                actions.Add(NoteActions.All);
            });
            app.UseMvc();
        }
    }
}

Set compatibility version to 2.2 in simple API test project


@model PagedMemberListViewModel
@using GiveCRM.Web.Models.Members
@using PagedList.Mvc
@{
    Layout = null;
}

@if (Model != null && Model.Count > 0)
{

    @{ Html.RenderPartial("_TableOfMembers", Model); }

           @* what's a "ShowPager"? - caused an error if (Model.ShowPager) { *@
           @Html.PagedListPager(Model, Model.PagingFunction, PagedListRenderOptions.OnlyShowFivePagesAtATime)

}
else
{

Your search returned no results.

}

@model PagedMemberListViewModel
@using GiveCRM.Web.Models.Members
@using PagedList.Mvc
@{
    Layout = null;
}

@if (Model != null && Model.Count > 0)
{

    @{ Html.RenderPartial("_TableOfMembers", Model); }

           @Html.PagedListPager(Model, Model.PagingFunction, PagedListRenderOptions.OnlyShowFivePagesAtATime)

}
else
{

Your search returned no results.

}

Remove refs to "ShowPager" that isn't relevant any more


using System;
using Chromium;
using Chromium.WebBrowser;
using Neutronium.Core;
using Neutronium.WebBrowserEngine.ChromiumFx.EngineBinding;
using Neutronium.WebBrowserEngine.ChromiumFx.Session;
using Neutronium.WPF;
using Chromium.Event;

namespace Neutronium.WebBrowserEngine.ChromiumFx
{
    public class ChromiumFXWPFWebWindowFactory : IWPFWebWindowFactory
    {
        private readonly ChromiumFxSession _Session;

        public CfxSettings Settings { get; private set; }
        public string EngineName => "Chromium " + CfxRuntime.GetChromeVersion();
        public string EngineVersion => CfxRuntime.GetChromeVersion();
        public string Name => "ChromiumFX";
        public CfxBrowserSettings BrtowserSettings => ChromiumWebBrowser.DefaultBrowserSettings;
        public IWebSessionLogger WebSessionLogger { get; set; }

        public ChromiumFXWPFWebWindowFactory(Action<CfxSettings> settingsUpdater=null, Action<CfxOnBeforeCommandLineProcessingEventArgs> commadLineHandler=null)
        {
            _Session = ChromiumFxSession.GetSession((settings) =>
            {
                settingsUpdater?.Invoke(settings);
                Settings = settings;
            }, commadLineHandler);
        }

        public IWPFWebWindow Create()
        {
            return new ChromiumFxWpfWindow(WebSessionLogger);
        }

        public void Dispose()
        {
            _Session.Dispose();
        }
    }
}

using System;
using Chromium;
using Chromium.WebBrowser;
using Neutronium.Core;
using Neutronium.WebBrowserEngine.ChromiumFx.EngineBinding;
using Neutronium.WebBrowserEngine.ChromiumFx.Session;
using Neutronium.WPF;
using Chromium.Event;

namespace Neutronium.WebBrowserEngine.ChromiumFx
{
    public class ChromiumFXWPFWebWindowFactory : IWPFWebWindowFactory
    {
        private readonly ChromiumFxSession _Session;

        public CfxSettings Settings { get; private set; }
        public string EngineName => "Chromium";
        public string EngineVersion => CfxRuntime.GetChromeVersion();
        public string Name => "ChromiumFX";
        public CfxBrowserSettings BrtowserSettings => ChromiumWebBrowser.DefaultBrowserSettings;
        public IWebSessionLogger WebSessionLogger { get; set; }

        public ChromiumFXWPFWebWindowFactory(Action<CfxSettings> settingsUpdater=null, Action<CfxOnBeforeCommandLineProcessingEventArgs> commadLineHandler=null)
        {
            _Session = ChromiumFxSession.GetSession((settings) =>
            {
                settingsUpdater?.Invoke(settings);
                Settings = settings;
            }, commadLineHandler);
        }

        public IWPFWebWindow Create()
        {
            return new ChromiumFxWpfWindow(WebSessionLogger);
        }

        public void Dispose()
        {
            _Session.Dispose();
        }
    }
}

Improve granularity of component description


using Microsoft.Extensions.Configuration;
using Persistence.MongoDB;
using SimpleInjector;
using SO115App.API.Models.Servizi.Infrastruttura.GestioneSoccorso;
using SO115App.Persistence.MongoDB;

namespace SO115App.CompositionRoot
{
    internal static class PersistenceServicesConfigurator_MongoDB
    {
        internal static void Configure(Container container, IConfiguration configuration)
        {
            var connectionString = configuration.GetSection("ConnectionString").Value;
            var databaseName = configuration.GetSection("DatabaseName").Value;

            container.Register<DbContext>(() =>
                new DbContext(connectionString, databaseName), Lifestyle.Singleton);

            container.Register<ISaveRichiestaAssistenza, SaveRichiesta>();
            container.Register<IUpDateRichiestaAssistenza, UpDateRichiesta>();
        }
    }
}

using Microsoft.Extensions.Configuration;
using Persistence.MongoDB;
using SimpleInjector;
using SO115App.API.Models.Servizi.Infrastruttura.GestioneSoccorso;
using SO115App.Models.Servizi.Infrastruttura.GestioneSoccorso;
using SO115App.Persistence.MongoDB;

namespace SO115App.CompositionRoot
{
    internal static class PersistenceServicesConfigurator_MongoDB
    {
        internal static void Configure(Container container, IConfiguration configuration)
        {
            var connectionString = configuration.GetSection("ConnectionString").Value;
            var databaseName = configuration.GetSection("DatabaseName").Value;

            container.Register<DbContext>(() =>
                new DbContext(connectionString, databaseName), Lifestyle.Singleton);

            #region Gestione richiesta di assistenza

            container.Register<ISaveRichiestaAssistenza, SaveRichiesta>();
            container.Register<IUpDateRichiestaAssistenza, UpDateRichiesta>();

            container.Register<IGetRichiestaById, GetRichiesta>();
            container.Register<IGetListaSintesi, GetRichiesta>();

            #endregion Gestione richiesta di assistenza
        }
    }
}

Add - Aggiunta la registrazione nella composition root della ricerca della richiesta di assistenza


using System;
using System.IO;

namespace Conduit
{
    class Program
    {
        public static string APP_NAME = "Mimic Conduit";
        public static string VERSION = "2.0.0";

        public static string HUB_WS = "ws://127.0.0.1:51001/conduit";
        public static string HUB = "http://127.0.0.1:51001";

        private static App _instance;

        [STAThread]
        public static void Main()
        {
            // Start the application.
            _instance = new App();
            _instance.InitializeComponent();
            _instance.Run();
        }
    }
}

using System;
using System.IO;

namespace Conduit
{
    class Program
    {
        public static string APP_NAME = "Mimic Conduit";
        public static string VERSION = "2.0.0";

        public static string HUB_WS = "ws://rift.mimic.lol/conduit";
        public static string HUB = "https://rift.mimic.lol";

        private static App _instance;

        [STAThread]
        public static void Main()
        {
            // Start the application.
            _instance = new App();
            _instance.InitializeComponent();
            _instance.Run();
        }
    }
}

Switch Conduit to use rift.lol

:electric_plug: Switch Conduit to use rift.lol


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

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

        internal TraktPeriod? Period { get; set; }

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

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

            return uriParams;
        }

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

        protected override TraktAuthorizationRequirement AuthorizationRequirement => TraktAuthorizationRequirement.NotRequired;

        protected override bool SupportsPagination => true;

        protected override bool IsListResult => true;
    }
}

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

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

        internal TraktPeriod? Period { get; set; }

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

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

            return uriParams;
        }

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

        protected override TraktAuthorizationRequirement AuthorizationRequirement => TraktAuthorizationRequirement.NotRequired;

        internal TraktMovieFilter Filter { get; set; }

        protected override bool SupportsPagination => true;

        protected override bool IsListResult => true;
    }
}

Add filter property to most watched movies request.


using Topshelf;
using Topshelf.HostConfigurators;

namespace Cogito.Components.Server
{

    public static class Program
    {

        /// <summary>
        /// Main application entry point.
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public static int Main(string[] args)
        {
            return (int)BuildHost(args).Run();
        }

        /// <summary>
        /// Builds a new <see cref="Host"/>.
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public static Host BuildHost(string[] args)
        {
            return HostFactory.New(x => ConfigureHostFactory(args, x));
        }

        /// <summary>
        /// Applies the configuration to the given <see cref="HostConfigurator"/>.
        /// </summary>
        /// <param name="args"></param>
        /// <param name="x"></param>
        public static void ConfigureHostFactory(string[] args, HostConfigurator x)
        {
            x.Service<ServiceHost>(() => new ServiceHost());
            x.SetServiceName("Cogito.Components.Server");
            x.StartAutomatically();
            x.EnableServiceRecovery(c => c.RestartService(5));
            x.RunAsNetworkService();
        }

    }

}

using Topshelf;
using Topshelf.HostConfigurators;

namespace Cogito.Components.Server
{

    public static class Program
    {

        /// <summary>
        /// Main application entry point.
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public static int Main(string[] args)
        {
            return (int)BuildHost(args).Run();
        }

        /// <summary>
        /// Builds a new <see cref="Host"/>.
        /// </summary>
        /// <param name="args"></param>
        /// <returns></returns>
        public static Host BuildHost(string[] args)
        {
            return HostFactory.New(x => ConfigureHostFactory(args, x));
        }

        /// <summary>
        /// Applies the configuration to the given <see cref="HostConfigurator"/>.
        /// </summary>
        /// <param name="args"></param>
        /// <param name="x"></param>
        public static void ConfigureHostFactory(string[] args, HostConfigurator x)
        {
            x.Service<ServiceHost>(() => new ServiceHost());
            x.SetServiceName("Cogito.Components.Server");
            x.StartAutomatically();
            x.EnableServiceRecovery(c => c.RestartService(5).SetResetPeriod(0));
            x.EnableShutdown();
            x.RunAsNetworkService();
        }

    }

}

Enable shutdown and set reset period.

Enable shutdown and set reset period.


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

namespace UKParliData.BPTweets
{
    public class TweetLog : ITweetLog
    {
        private string filename;

        public TweetLog(string filename)
        {
            this.filename = filename;
        }

        public ISet<string> GetTweetedIDs()
        {
            return new HashSet<string>(File.ReadAllLines(filename));
        }

        public void LogTweetedID(string id)
        {
            File.AppendAllLines(filename, new string[] { id });
        }
    }
}

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

namespace UKParliData.BPTweets
{
    public class TweetLog : ITweetLog
    {
        private string filename;

        public TweetLog(string filename)
        {
            this.filename = filename;
            if (!File.Exists(this.filename))
            {
                using (var f = File.Create(this.filename)) { }
            }
        }

        public ISet<string> GetTweetedIDs()
        {
            return new HashSet<string>(File.ReadAllLines(filename));
        }

        public void LogTweetedID(string id)
        {
            File.AppendAllLines(filename, new string[] { id });
        }
    }
}

Create the log file if it doesn't already exist


using System;
using System.Linq;
using CommandLine;
using Ninject;
using P2E.ExtensionMethods;
using P2E.Interfaces.AppLogic;
using P2E.Interfaces.CommandLine;

namespace P2EApp
{
    internal static class Program
    {
        static void Main(string[] args)
        {
            try
            {
                var kernel = new StandardKernel();
                Bootstrapper.ConfigureContainer(kernel);

                var options = kernel.Get<IConsoleOptions>();
                if (Parser.Default.ParseArguments(args, options) == false)
                {
                    Console.WriteLine(options.GetUsage());
                    return;
                }

                kernel.Get<IMainLogic>().RunAsync().Wait();
            }
            catch (AggregateException ae)
            {
                var messages = ae.Flatten().InnerExceptions
                    .ToList()
                    .Select(e => e.GetInnermostException())
                    .Select(e => (object)e.Message)
                    .ToArray();

                Console.WriteLine("Oops, you did something I didn't think of:\n{0}", messages);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Oops, you did something I didn't think of:\n{0}", ex.Message);
            }
            finally
            {
                // todo - remove the whole finally block
                Console.ReadLine();
            }
        }
    }
}

using System;
using System.Linq;
using CommandLine;
using Ninject;
using P2E.ExtensionMethods;
using P2E.Interfaces.AppLogic;
using P2E.Interfaces.CommandLine;

namespace P2EApp
{
    internal static class Program
    {
        static void Main(string[] args)
        {
            try
            {
                // FYI: Disposable objects bound in InSingletonScope are disposed when the kernel is disposed.
                using (var kernel = new StandardKernel())
                {
                    Bootstrapper.ConfigureContainer(kernel);

                    var options = kernel.Get<IConsoleOptions>();
                    if (Parser.Default.ParseArguments(args, options) == false)
                    {
                        Console.WriteLine(options.GetUsage());
                        return;
                    }

                    kernel.Get<IMainLogic>().RunAsync().Wait();
                }
            }
            catch (AggregateException ae)
            {
                var messages = ae.Flatten().InnerExceptions
                    .ToList()
                    .Select(e => e.GetInnermostException())
                    .Select(e => (object)e.Message)
                    .ToArray();

                Console.WriteLine("Oops, you did something I didn't think of:\n{0}", messages);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Oops, you did something I didn't think of:\n{0}", ex.Message);
            }
            finally
            {
                // todo - remove the whole finally block
                Console.ReadLine();
            }
        }
    }
}

Use using() for Ninject kernel.

Use using() for Ninject kernel.


using EPiServer.Framework.Localization;
using EPiServer.ServiceLocation;
using EPiServer.Web;

namespace AlloyDemoKit.Business.Channels
{
    /// <summary>
    /// Base class for all resolution definitions
    /// </summary>
    public abstract class DisplayResolutionBase : IDisplayResolution
    {
        private Injected<LocalizationService> LocalizationService { get; set; }

        protected DisplayResolutionBase(string name, int width, int height)
        {
            Id = GetType().FullName;
            Name = Translate(name);
            Width = width;
            Height = height;
        }

        /// <summary>
        /// Gets the unique ID for this resolution
        /// </summary>
        public string Id { get; protected set; }

        /// <summary>
        /// Gets the name of resolution
        /// </summary>
        public string Name { get; protected set; }

        /// <summary>
        /// Gets the resolution width in pixels
        /// </summary>
        public int Width { get; protected set; }

        /// <summary>
        /// Gets the resolution height in pixels
        /// </summary>
        public int Height { get; protected set; }

        private string Translate(string resurceKey)
        {
            string value;

            if(!LocalizationService.Service.TryGetString(resurceKey, out value))
            {
                value = resurceKey;
            }

            return value;
        }
    }
}

using System;
using EPiServer.Framework.Localization;
using EPiServer.ServiceLocation;
using EPiServer.Web;

namespace AlloyDemoKit.Business.Channels
{
    /// <summary>
    /// Base class for all resolution definitions
    /// </summary>
    public abstract class DisplayResolutionBase : IDisplayResolution
    {
        private Injected<LocalizationService> LocalizationService { get; set; }
        private static object syncLock = new Object();

        protected DisplayResolutionBase(string name, int width, int height)
        {
            Id = GetType().FullName;
            Name = Translate(name);
            Width = width;
            Height = height;
        }

        /// <summary>
        /// Gets the unique ID for this resolution
        /// </summary>
        public string Id { get; protected set; }

        /// <summary>
        /// Gets the name of resolution
        /// </summary>
        public string Name { get; protected set; }

        /// <summary>
        /// Gets the resolution width in pixels
        /// </summary>
        public int Width { get; protected set; }

        /// <summary>
        /// Gets the resolution height in pixels
        /// </summary>
        public int Height { get; protected set; }

        private string Translate(string resurceKey)
        {
            string value;

            lock (syncLock)
            {
                if (!LocalizationService.Service.TryGetString(resurceKey, out value))
                {
                    value = resurceKey;
                }
            }

            return value;
        }
    }
}

Fix threading issue on initialisation

Fix threading issue on initialisation

When using DbLocalizationProvider the display channels would occasionaly
cause exceptions on start by trying to add duplicate keys (assume this
is due to trying to initialise display channels in parallel during start
up which in turn trying to initialise the localisation service in
paralell multiple times). Added a synclock to ensure only one thread at
a time can use the localisation service when initialising display
channels which should resolve the issue.