using osu_StreamCompanion.Code.Core.DataTypes;
using osu_StreamCompanion.Code.Interfaces;

namespace osu_StreamCompanion.Code.Modules.MapDataGetters.FileMap
{
    public class FileMapDataGetter : IModule, IMapDataGetter
    {
        public bool Started { get; set; }
        private readonly FileMapManager _fileMapManager = new FileMapManager();
        public void Start(ILogger logger)
        {
            Started = true;
        }

        public void SetNewMap(MapSearchResult map)
        {
            foreach (var s in map.FormatedStrings)
            {
                var name = s.Name;

                if ((s.SaveEvent & map.Action) != 0)
                    _fileMapManager.Write("SC-" + name, s.GetFormatedPattern());
                else
                    _fileMapManager.Write("SC-" + name, "    ");//spaces so object rect displays on obs preview window.

            }
        }
    }
}

using osu_StreamCompanion.Code.Core.DataTypes;
using osu_StreamCompanion.Code.Interfaces;

namespace osu_StreamCompanion.Code.Modules.MapDataGetters.FileMap
{
    public class FileMapDataGetter : IModule, IMapDataGetter
    {
        public bool Started { get; set; }
        private readonly FileMapManager _fileMapManager = new FileMapManager();
        public void Start(ILogger logger)
        {
            Started = true;
        }

        public void SetNewMap(MapSearchResult map)
        {
            foreach (var s in map.FormatedStrings)
            {
                if(s.IsMemoryFormat) continue;//memory pattern saving is handled elsewhere, not in this codebase.
                var name = s.Name;

                if ((s.SaveEvent & map.Action) != 0)
                    _fileMapManager.Write("SC-" + name, s.GetFormatedPattern());
                else
                    _fileMapManager.Write("SC-" + name, "    ");//spaces so object rect displays on obs preview window.

            }
        }
    }
}

Fix memory patterns saving when not playing.


using Microsoft.Extensions.DependencyInjection;
using Swashbuckle.AspNetCore.SwaggerGen;

namespace Swashbuckle.AspNetCore.Filters
{
    public static class SwaggerGenOptionsExtensions
    {
        public static void ExampleFilters(this SwaggerGenOptions swaggerGenOptions)
        {
            swaggerGenOptions.OperationFilter<ExamplesOperationFilter>();
            swaggerGenOptions.OperationFilter<ServiceProviderExamplesOperationFilter>();
        }
    }
}

Add using statement for Swashbuckle 4.0

Add using statement for Swashbuckle 4.0


using Hops.Repositories;
using Microsoft.AspNet.Mvc;
using System.Collections.Generic;
using System.Linq;

namespace Hops.Controllers
{
    [Route("[controller]")]
    public class SearchController : Controller
    {
        private ISqliteRepository sqliteRepository;

        public SearchController(ISqliteRepository sqliteRepository)
        {
            this.sqliteRepository = sqliteRepository;
        }

        [HttpGet]
        public IActionResult Index()
        {
            return View();
        }

        [HttpGet("{searchTerm}/{page:int?}")]
        public IActionResult Results(string searchTerm, int page = 1)
        {
            var results = sqliteRepository.Search(searchTerm, page);

            if (results.List.Count == 0)
            {
                return View("NoResults", sqliteRepository.GetRandomHop());
            }

            if (results.List.Count == 1)
            {
                return Redirect($"/Hop/{results.List.First().Hop.Id}");
            }

            return View(results);
        }

        [HttpGet("inventory/{page:int?}")]
        public IActionResult Inventory(string searchTerm, int page = 1)
        {
            return View(page);
        }

        [HttpGet("aroma/{profile:int}/{page:int?}")]
        public IActionResult Results(int profile, int page = 1)
        {
            var results = sqliteRepository.Search(profile, page);

            return View(results);
        }

        [HttpGet("autocomplete/{searchTerm}")]
        public List<string> AutoComplete(string searchTerm)
        {
            return sqliteRepository.Autocomplete(searchTerm);
        }
    }
}

using Hops.Repositories;
using Microsoft.AspNet.Mvc;
using System.Collections.Generic;
using System.Linq;

namespace Hops.Controllers
{
    [Route("[controller]")]
    public class SearchController : Controller
    {
        private ISqliteRepository sqliteRepository;

        public SearchController(ISqliteRepository sqliteRepository)
        {
            this.sqliteRepository = sqliteRepository;
        }

        [HttpGet]
        public IActionResult Index()
        {
            return View();
        }

        [HttpGet("{searchTerm}/{page:int?}")]
        public IActionResult Results(string searchTerm, int page = 1)
        {
            var results = sqliteRepository.Search(searchTerm, page);

            if (results.List.Count == 0)
            {
                return View("NoResults", sqliteRepository.GetRandomHop());
            }

            if (results.List.Count == 1)
            {
                return Redirect($"/hop/{results.List.First().Hop.Slug()}");
            }

            return View(results);
        }

        [HttpGet("inventory/{page:int?}")]
        public IActionResult Inventory(string searchTerm, int page = 1)
        {
            return View(page);
        }

        [HttpGet("aroma/{profile:int}/{page:int?}")]
        public IActionResult Results(int profile, int page = 1)
        {
            var results = sqliteRepository.Search(profile, page);

            return View(results);
        }

        [HttpGet("autocomplete/{searchTerm}")]
        public List<string> AutoComplete(string searchTerm)
        {
            return sqliteRepository.Autocomplete(searchTerm);
        }
    }
}

Use slug for single search result

Use slug for single search result


using System.Collections.Generic;

namespace Parser
{
    // Assigns each locale an ID from 0 to n - 1
    internal static class LocaleIdAllocator
    {
        public static void Run(ParserContext parser, IList<CompilationScope> scopes)
        {
            foreach (CompilationScope scope in scopes)
            {
                if (!parser.LocaleIds.ContainsKey(scope.Locale))
                {
                    parser.LocaleIds.Add(scope.Locale, parser.LocaleIds.Count);
                }
            }
        }
    }
}

using System.Collections.Generic;

namespace Parser
{
    // Assigns each locale an ID from 0 to n - 1
    internal static class LocaleIdAllocator
    {
        // TODO: merge this with the current ID allocator in ParserContext.
        public static void Run(ParserContext parser, IList<CompilationScope> scopes)
        {
            /*
            foreach (CompilationScope scope in scopes)
            {
                if (!parser.LocaleIds.ContainsKey(scope.Locale))
                {
                    parser.LocaleIds.Add(scope.Locale, parser.LocaleIds.Count);
                }
            }//*/
        }
    }
}

Fix compilation error introduced with last minute cleanup added when looking at the diff.


using System;
using System.Runtime.CompilerServices;
using System.Threading;

namespace GUtils.Testing
{
    /// <summary>
    /// A class that tracks the amount of times its <see cref="WrappedDelegate" /> was invoked.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class DelegateInvocationCounter<T>
        where T : Delegate
    {
        private Int32 _invocationCount = 0;

        /// <summary>
        /// The number of times <see cref="WrappedDelegate" /> was invoked.
        /// </summary>
        public Int32 InvocationCount => this._invocationCount;

        /// <summary>
        /// The wrapper delegate that increments the invocation count when invoked.
        /// </summary>
        public T WrappedDelegate { get; internal set; } = null!;

        /// <summary>
        /// Atomically increments the number of invocations of this delegate.
        /// </summary>
        [MethodImpl ( MethodImplOptions.AggressiveInlining )]
        internal void Increment ( ) =>
            Interlocked.Increment ( ref this._invocationCount );

        /// <summary>
        /// Resets the number of invocations of this counter.
        /// </summary>
        public void Reset ( ) =>
            this._invocationCount = 0;
    }
}

using System;
using System.Runtime.CompilerServices;
using System.Threading;

namespace GUtils.Testing
{
    /// <summary>
    /// A class that tracks the amount of times its <see cref="WrappedDelegate" /> was invoked.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class DelegateInvocationCounter<T>
        where T : Delegate
    {
        private Int32 _invocationCount;

        /// <summary>
        /// The number of times <see cref="WrappedDelegate" /> was invoked.
        /// </summary>
        public Int32 InvocationCount => this._invocationCount;

        /// <summary>
        /// The wrapper delegate that increments the invocation count when invoked.
        /// </summary>
        public T WrappedDelegate { get; internal set; } = null!;

        /// <summary>
        /// Atomically increments the number of invocations of this delegate.
        /// </summary>
        [MethodImpl ( MethodImplOptions.AggressiveInlining )]
        internal void Increment ( ) =>
            Interlocked.Increment ( ref this._invocationCount );

        /// <summary>
        /// Resets the number of invocations of this counter.
        /// </summary>
        public void Reset ( ) =>
            this._invocationCount = 0;
    }
}

Remove explicit default value initialization.


using Foundation;
using System;
using UIKit;

namespace MyDriving.iOS
{
    public partial class GettingStartedContentViewController : UIViewController
    {
		public UIImage Image { get; set; }
		public int PageIndex { get; set; }

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

		public static GettingStartedContentViewController ControllerForPageIndex(int pageIndex)
		{
			var imagePath = string.Format($"screen_{pageIndex+1}.png");
			var image = UIImage.FromBundle(imagePath);
			var page = (GettingStartedContentViewController)UIStoryboard.FromName("Main", null).InstantiateViewController("gettingStartedContentViewController");
			page.Image = image;
			page.PageIndex = pageIndex;

			return page;
		}

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

			imageView.Image = Image;
		}
	}
}

using Foundation;
using System;
using UIKit;

namespace MyDriving.iOS
{
    public partial class GettingStartedContentViewController : UIViewController
    {
		public UIImage Image { get; set; }
		public int PageIndex { get; set; }

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

		public static GettingStartedContentViewController ControllerForPageIndex(int pageIndex)
		{
			var imagePath = string.Format($"screen_{pageIndex+1}.png");
			var image = UIImage.FromBundle(imagePath);
			var page = (GettingStartedContentViewController)UIStoryboard.FromName("Main", null).InstantiateViewController("gettingStartedContentViewController");
			page.Image = image;
			page.PageIndex = pageIndex;

			return page;
		}

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

			View.BackgroundColor = UIColor.FromPatternImage(UIImage.FromBundle("background_started.png"));
			imageView.Image = Image;
		}
	}
}

[iOS] Use login/getting started background image.


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

using Wukong.Models;

namespace Wukong.Services
{
    public sealed class Storage
    {
        static readonly Lazy<Storage> instance =
            new Lazy<Storage>(() => new Storage());

        IDictionary<string, User> userMap = new Dictionary<string, User>();
        IDictionary<string, Channel> channelMap = new Dictionary<string, Channel>();

        public static Storage Instance
        {
            get
            {
                return instance.Value;
            }
        }

        Storage() { }

        public User GetUser(string userId)
        {
            if (!userMap.ContainsKey(userId))
            {
                userMap.Add(userId, new User(userId));
            }
            return userMap[userId];
        }

        public Channel GetChannel(string channelId)
        {
            if (channelId == null || !channelMap.ContainsKey(channelId))
            {
                return null;
            }
            return channelMap[channelId];
        }

        public void RemoveChannel(string channelId)
        {
            channelMap.Remove(channelId);
        }

        public List<Channel> GetAllChannelsWithUserId(string userId)
        {
            return channelMap.Values.Where(x => x.HasUser(userId)).ToList();
        }

        public Channel CreateChannel(string channelId, ISocketManager socketManager, IProvider provider)
        {
            channelMap[channelId] = new Channel(channelId, socketManager, provider);
            return channelMap[channelId];
        }
    }

}

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

using Wukong.Models;

namespace Wukong.Services
{
    public sealed class Storage
    {
        static readonly Lazy<Storage> instance =
            new Lazy<Storage>(() => new Storage());

        volatile IDictionary<string, User> userMap = new Dictionary<string, User>();
        volatile IDictionary<string, Channel> channelMap = new Dictionary<string, Channel>();

        public static Storage Instance
        {
            get
            {
                return instance.Value;
            }
        }

        Storage() { }

        public User GetUser(string userId)
        {
            if (!userMap.ContainsKey(userId))
            {
                userMap.Add(userId, new User(userId));
            }
            return userMap[userId];
        }

        public Channel GetChannel(string channelId)
        {
            if (channelId == null || !channelMap.ContainsKey(channelId))
            {
                return null;
            }
            return channelMap[channelId];
        }

        public void RemoveChannel(string channelId)
        {
            channelMap.Remove(channelId);
        }

        public List<Channel> GetAllChannelsWithUserId(string userId)
        {
            return channelMap.Values.Where(x => x.HasUser(userId)).ToList();
        }

        public Channel CreateChannel(string channelId, ISocketManager socketManager, IProvider provider)
        {
            channelMap[channelId] = new Channel(channelId, socketManager, provider);
            return channelMap[channelId];
        }
    }

}

Add volatile keyword accroding to the doc


// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE

using System;
using Android.Content;
using Android.Runtime;
using Android.Util;
using osuTK.Graphics;

namespace osu.Framework.Android
{
    public class AndroidGameView : osuTK.Android.AndroidGameView
    {
        private AndroidGameHost host;
        private Game game;

        public AndroidGameView(Context context, Game game) : base(context)
        {
            this.game = game;
            init();
        }

        public AndroidGameView(Context context, IAttributeSet attrs) : base(context, attrs)
        {
            init();
        }

        public AndroidGameView(IntPtr handle, JniHandleOwnership transfer) : base(handle, transfer)
        {
            init();
        }

        private void init()
        {
            AutoSetContextOnRenderFrame = true;
            ContextRenderingApi = GLVersion.ES3;
        }

        protected override void CreateFrameBuffer()
        {
            try
            {
                base.CreateFrameBuffer();
                Log.Verbose("AndroidGameView", "Successfully created the framebuffer");
            }
            catch (Exception e)
            {
                Log.Verbose("AndroidGameView", "{0}", e);
                throw new Exception("Can't load egl, aborting", e);
            }
        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            RenderGame();
        }

        [STAThread]
        public void RenderGame()
        {
            host = new AndroidGameHost(this);
            host.Run(game);
        }
    }
}

// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE

using System;
using Android.Content;
using Android.Runtime;
using Android.Util;
using osuTK.Graphics;

namespace osu.Framework.Android
{
    public class AndroidGameView : osuTK.Android.AndroidGameView
    {
        private AndroidGameHost host;
        private readonly Game game;

        public AndroidGameView(Context context, Game game) : base(context)
        {
            this.game = game;
            init();
        }

        public AndroidGameView(Context context, IAttributeSet attrs) : base(context, attrs)
        {
            init();
        }

        public AndroidGameView(IntPtr handle, JniHandleOwnership transfer) : base(handle, transfer)
        {
            init();
        }

        private void init()
        {
            AutoSetContextOnRenderFrame = true;
            ContextRenderingApi = GLVersion.ES3;
        }

        protected override void CreateFrameBuffer()
        {
            try
            {
                base.CreateFrameBuffer();
                Log.Verbose("AndroidGameView", "Successfully created the framebuffer");
            }
            catch (Exception e)
            {
                Log.Verbose("AndroidGameView", "{0}", e);
                throw new Exception("Can't load egl, aborting", e);
            }
        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            RenderGame();
        }

        [STAThread]
        public void RenderGame()
        {
            host = new AndroidGameHost(this);
            host.Run(game);
        }
    }
}

Make the private field readonly.

Make the private field readonly.


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

using osu.Framework.IO.Network;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Game.Online.API.Requests;

namespace osu.Game.Extensions
{
    public static class WebRequestExtensions
    {
        /// <summary>
        /// Add a pagination cursor to the web request in the format required by osu-web.
        /// </summary>
        public static void AddCursor(this WebRequest webRequest, Cursor cursor)
        {
            cursor?.Properties.ForEach(x =>
            {
                webRequest.AddParameter("cursor[" + x.Key + "]", x.Value.ToString());
            });
        }
    }
}

// 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.Globalization;
using Newtonsoft.Json.Linq;
using osu.Framework.IO.Network;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Game.Online.API.Requests;

namespace osu.Game.Extensions
{
    public static class WebRequestExtensions
    {
        /// <summary>
        /// Add a pagination cursor to the web request in the format required by osu-web.
        /// </summary>
        public static void AddCursor(this WebRequest webRequest, Cursor cursor)
        {
            cursor?.Properties.ForEach(x =>
            {
                webRequest.AddParameter("cursor[" + x.Key + "]", (x.Value as JValue)?.ToString(CultureInfo.InvariantCulture) ?? x.Value.ToString());
            });
        }
    }
}

Fix cursors sent to osu-web being potentially string formatted in incorrect culture

Fixed as per solution at https://github.com/JamesNK/Newtonsoft.Json/issues/874.

Note that due to the use of `JsonExtensionDataAttribute` it's not
feasible to change the actual specification to `JValue` in the
`Dictionary`.

In discussion with the osu-web team, it may be worthwhile to change the cursor
to a string format where parsing is not required at our end. We could already
do this in fact, but there are tests that rely on it being a `JToken` so the
switch to `JValue` seems like the easier path right now.


// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.IO;
using System.Security.Cryptography;

namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
{
    public class FileThumbPrint : IEquatable<FileThumbPrint>
    {
        private FileThumbPrint(DateTime lastWriteTimeUtc, string hash)
        {
            LastWriteTimeUtc = lastWriteTimeUtc;
            Hash = hash;
        }

        public DateTime LastWriteTimeUtc { get; }

        public string Hash { get; }

        public static FileThumbPrint Create(string path)
        {
            byte[] hashBytes;
            using (var sha1 = SHA1.Create())
            using (var fileStream = File.OpenRead(path))
            {
                hashBytes = sha1.ComputeHash(fileStream);
            }

            var hash = Convert.ToBase64String(hashBytes);
            var lastWriteTimeUtc = File.GetLastWriteTimeUtc(path);
            return new FileThumbPrint(lastWriteTimeUtc, hash);
        }

        public bool Equals(FileThumbPrint other)
        {
            return LastWriteTimeUtc == other.LastWriteTimeUtc &&
                string.Equals(Hash, other.Hash, StringComparison.Ordinal);
        }

        public override int GetHashCode() => LastWriteTimeUtc.GetHashCode();
    }
}

// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.IO;
using System.Security.Cryptography;

namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests
{
    public class FileThumbPrint : IEquatable<FileThumbPrint>
    {
        private FileThumbPrint(string path, DateTime lastWriteTimeUtc, string hash)
        {
            Path = path;
            LastWriteTimeUtc = lastWriteTimeUtc;
            Hash = hash;
        }

        public string Path { get; }

        public DateTime LastWriteTimeUtc { get; }

        public string Hash { get; }

        public static FileThumbPrint Create(string path)
        {
            byte[] hashBytes;
            using (var sha1 = SHA1.Create())
            using (var fileStream = File.OpenRead(path))
            {
                hashBytes = sha1.ComputeHash(fileStream);
            }

            var hash = Convert.ToBase64String(hashBytes);
            var lastWriteTimeUtc = File.GetLastWriteTimeUtc(path);
            return new FileThumbPrint(path, lastWriteTimeUtc, hash);
        }

        public bool Equals(FileThumbPrint other)
        {
            return
                string.Equals(Path, other.Path, StringComparison.Ordinal) &&
                LastWriteTimeUtc == other.LastWriteTimeUtc &&
                string.Equals(Hash, other.Hash, StringComparison.Ordinal);
        }

        public override int GetHashCode() => LastWriteTimeUtc.GetHashCode();
    }
}

Add more diagnostics to FileThumbPrint

Add more diagnostics to FileThumbPrint


using System;
using System.Net.Http;
using System.Net.Http.Headers;
using Microsoft.Extensions.Options;

namespace AllReady.Hangfire.Jobs
{
    public class SendRequestStatusToGetASmokeAlarm : ISendRequestStatusToGetASmokeAlarm
    {
        private readonly IOptions<GetASmokeAlarmApiSettings> getASmokeAlarmApiSettings;
        private static readonly HttpClient HttpClient = new HttpClient();

        public SendRequestStatusToGetASmokeAlarm(IOptions<GetASmokeAlarmApiSettings> getASmokeAlarmApiSettings)
        {
            this.getASmokeAlarmApiSettings = getASmokeAlarmApiSettings;
        }

        public void Send(string serial, string status, bool acceptance)
        {
            var baseAddress = getASmokeAlarmApiSettings.Value.BaseAddress;
            var token = getASmokeAlarmApiSettings.Value.Token;

            var updateRequestMessage = new { acceptance, status };

            HttpClient.BaseAddress = new Uri(baseAddress);
            HttpClient.DefaultRequestHeaders.Accept.Clear();
            HttpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            HttpClient.DefaultRequestHeaders.Add("Authorization", token);

            var response = HttpClient.PostAsJsonAsync($"admin/requests/status/{serial}", updateRequestMessage).Result;

            //throw HttpRequestException if response is not a success code.
            response.EnsureSuccessStatusCode();
        }
    }

    public interface ISendRequestStatusToGetASmokeAlarm
    {
        void Send(string serial, string status, bool acceptance);
    }
}

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using Microsoft.Extensions.Options;

namespace AllReady.Hangfire.Jobs
{
    public class SendRequestStatusToGetASmokeAlarm : ISendRequestStatusToGetASmokeAlarm
    {
        private static HttpClient httpClient;

        public SendRequestStatusToGetASmokeAlarm(IOptions<GetASmokeAlarmApiSettings> getASmokeAlarmApiSettings)
        {
            CreateStaticHttpClient(getASmokeAlarmApiSettings);
        }

        public void Send(string serial, string status, bool acceptance)
        {
            var updateRequestMessage = new { acceptance, status };
            var response = httpClient.PostAsJsonAsync($"admin/requests/status/{serial}", updateRequestMessage).Result;

            //throw HttpRequestException if response is not a success code.
            response.EnsureSuccessStatusCode();
        }

        private void CreateStaticHttpClient(IOptions<GetASmokeAlarmApiSettings> getASmokeAlarmApiSettings)
        {
            if (httpClient == null)
            {
                httpClient = new HttpClient { BaseAddress = new Uri(getASmokeAlarmApiSettings.Value.BaseAddress)};
                httpClient.DefaultRequestHeaders.Accept.Clear();
                httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                //TODO mgmccarthy: the one drawback here is if GASA were to give us a new authorization token, we'd have to reload the web app to get it to update b/c this is now static
                httpClient.DefaultRequestHeaders.Add("Authorization", getASmokeAlarmApiSettings.Value.Token);
            }
        }
    }

    public interface ISendRequestStatusToGetASmokeAlarm
    {
        void Send(string serial, string status, bool acceptance);
    }
}

Fix broken implementation of static HttpClient


using System.IO;
using JetBrains.Annotations;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace Wox.Plugin.WebSearch
{
    public class WebSearch
    {
        public const string DefaultIcon = "web_search.png";
        public string Title { get; set; }
        public string ActionKeyword { get; set; }
        [NotNull]
        private string _icon = DefaultIcon;

        [NotNull]
        public string Icon
        {
            get { return _icon; }
            set
            {
                _icon = value;
                IconPath = Path.Combine(WebSearchPlugin.PluginDirectory, WebSearchPlugin.ImageDirectory, value);
            }
        }
        /// <summary>
        /// All icon should be put under Images directory
        /// </summary>
        [NotNull]
        [JsonIgnore]
        internal string IconPath { get; private set; }

        public string Url { get; set; }
        public bool Enabled { get; set; }
    }
}

using System.IO;
using JetBrains.Annotations;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;

namespace Wox.Plugin.WebSearch
{
    public class WebSearch
    {
        public const string DefaultIcon = "web_search.png";
        public string Title { get; set; }
        public string ActionKeyword { get; set; }
        [NotNull]
        private string _icon = DefaultIcon;

        [NotNull]
        public string Icon
        {
            get { return _icon; }
            set
            {
                _icon = value;
                IconPath = Path.Combine(WebSearchPlugin.PluginDirectory, WebSearchPlugin.ImageDirectory, value);
            }
        }

        /// <summary>
        /// All icon should be put under Images directory
        /// </summary>
        [NotNull]
        [JsonIgnore]
        internal string IconPath { get; private set; } = Path.Combine
        (
            WebSearchPlugin.PluginDirectory, WebSearchPlugin.ImageDirectory, DefaultIcon
        );

        public string Url { get; set; }
        public bool Enabled { get; set; }
    }
}

Fix default icon path when add new web search


using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OfficeDevPnP.Core.Utilities;
using System.Collections.Generic;

namespace OfficeDevPnP.Core.Tests.AppModelExtensions
{
    [TestClass]
    public class UrlUtilityTests
    {
        [TestMethod]
        public void ContainsInvalidCharsReturnsFalseForValidString()
        {
            string validString = "abd-123";
            Assert.IsFalse(validString.ContainsInvalidUrlChars());
        }

        [TestMethod]
        public void ContainsInvalidUrlCharsReturnsTrueForInvalidString()
        {
            var targetVals = new List<char> { '#', '%', '&', '*', '{', '}', '\\', ':', '<', '>', '?', '/', '+', '|', '"' };

            targetVals.ForEach(v => Assert.IsTrue((string.Format("abc{0}abc", v).ContainsInvalidUrlChars())));
        }

        [TestMethod]
        public void StripInvalidUrlCharsReturnsStrippedString()
        {
            var invalidString = "a#%&*{}\\:<>?/+|b";

            Assert.AreEqual("ab", invalidString.StripInvalidUrlChars());
        }

        [TestMethod]
        public void ReplaceInvalidUrlCharsReturnsStrippedString()
        {
            var invalidString = "a#%&*{}\\:<>?/+|b";

            Assert.AreEqual("a------------------------------------------b", invalidString.ReplaceInvalidUrlChars("---"));
        }
    }
}

using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using OfficeDevPnP.Core.Utilities;
using System.Collections.Generic;

namespace OfficeDevPnP.Core.Tests.AppModelExtensions
{
    [TestClass]
    public class UrlUtilityTests
    {
        [TestMethod]
        public void ContainsInvalidCharsReturnsFalseForValidString()
        {
            string validString = "abd-123";
            Assert.IsFalse(validString.ContainsInvalidUrlChars());
        }

        [TestMethod]
        public void ContainsInvalidUrlCharsReturnsTrueForInvalidString()
        {
#if !CLIENTSDKV15
            var targetVals = new List<char> { '#', '%', '*', '\\', ':', '<', '>', '?', '/', '+', '|', '"' };
#else
            var targetVals = new List<char> { '#', '~', '%', '&', '*', '{', '}', '\\', ':', '<', '>', '?', '/', '+', '|', '"' };
#endif

            targetVals.ForEach(v => Assert.IsTrue((string.Format("abc{0}abc", v).ContainsInvalidUrlChars())));
        }

        [TestMethod]
        public void StripInvalidUrlCharsReturnsStrippedString()
        {
#if !CLIENTSDKV15
            var invalidString = "a#%*\\:<>?/+|b";
#else
            var invalidString = "a#~%&*{}\\:<>?/+|b";
#endif

            Assert.AreEqual("ab", invalidString.StripInvalidUrlChars());
        }

        [TestMethod]
        public void ReplaceInvalidUrlCharsReturnsStrippedString()
        {
#if !CLIENTSDKV15
            var invalidString = "a#%*\\:<>?/+|b";
#else
            var invalidString = "a#~%&*{}\\:<>?/+|b";
#endif

            Assert.AreEqual("a------------------------------------------b", invalidString.ReplaceInvalidUrlChars("---"));
        }
    }
}

Align url invalid char unit tests with changes done to the validation logic


using System.Collections.Generic;

namespace Okanshi.Dashboard
{
	public interface IConfiguration
	{
		void Add(OkanshiServer server);
		IEnumerable<OkanshiServer> GetAll();
	}
}

using System.Collections.Generic;

namespace Okanshi.Dashboard
{
	public interface IConfiguration
	{
		void Add(OkanshiServer server);
		IEnumerable<OkanshiServer> GetAll();
		void Remove(string name);
	}
}

Add support for removing okanshi instances


using NUnit.Framework;

namespace Mond.Tests
{
    [TestFixture]
    public class MondStateTests
    {
        [Test]
        public void MultiplePrograms()
        {
            const string source1 = @"
                hello = fun (x) {
                    return 'hi ' + x;
                };

                a = hello('nerd');
            ";

            const string source2 = @"
                b = hello('brian');
            ";

            var state = Script.Load(source1, source2);

            var result1 = state["a"];
            var result2 = state["b"];

            Assert.True(result1 == "hi nerd");
            Assert.True(result2 == "hi brian");
        }

        [Test]
        public void NativeFunction()
        {
            var state = new MondState();

            state["function"] = new MondFunction((_, args) => args[0]);

            var program = MondProgram.Compile(@"
                return function('arg');
            ");

            var result = state.Load(program);

            Assert.True(result == "arg");
        }

        [Test]
        public void NativeInstanceFunction()
        {
            var state = new MondState();

            state["value"] = 123;
            state["function"] = new MondInstanceFunction((_, instance, arguments) => instance[arguments[0]]);

            var program = MondProgram.Compile(@"
                return function('value');
            ");

            var result = state.Load(program);

            Assert.True(result == 123);
        }
    }
}

using NUnit.Framework;

namespace Mond.Tests
{
    [TestFixture]
    public class MondStateTests
    {
        [Test]
        public void MultiplePrograms()
        {
            const string source1 = @"
                global.hello = fun (x) {
                    return 'hi ' + x;
                };

                global.a = global.hello('nerd');
            ";

            const string source2 = @"
                global.b = global.hello('brian');
            ";

            var state = Script.Load(source1, source2);

            var result1 = state["a"];
            var result2 = state["b"];

            Assert.True(result1 == "hi nerd");
            Assert.True(result2 == "hi brian");
        }

        [Test]
        public void NativeFunction()
        {
            var state = new MondState();

            state["function"] = new MondFunction((_, args) => args[0]);

            var program = MondProgram.Compile(@"
                return global.function('arg');
            ");

            var result = state.Load(program);

            Assert.True(result == "arg");
        }

        [Test]
        public void NativeInstanceFunction()
        {
            var state = new MondState();

            state["value"] = 123;
            state["function"] = new MondInstanceFunction((_, instance, arguments) => instance[arguments[0]]);

            var program = MondProgram.Compile(@"
                return global.function('value');
            ");

            var result = state.Load(program);

            Assert.True(result == 123);
        }
    }
}

Update tests to use explicit globals

Update tests to use explicit globals


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

namespace Navigation.Mvc
{
	public class RouteConfig
	{
		public static void AddStateRoutes()
		{
			if (StateInfoConfig.Dialogs == null)
				return;
			ValueProviderFactories.Factories.Insert(0, new NavigationDataValueProviderFactory());
			string controller, action;
			Route route;
			using (RouteTable.Routes.GetWriteLock())
			{
				foreach (Dialog dialog in StateInfoConfig.Dialogs)
				{
					foreach (State state in dialog.States)
					{
						controller = state.Attributes["controller"] != null ? state.Attributes["controller"].Trim() : string.Empty;
						action = state.Attributes["action"] != null ? state.Attributes["action"].Trim() : string.Empty;
						if (controller.Length != 0 && action.Length != 0 && state.Route.Length != 0)
						{
							state.StateHandler = new MvcStateHandler();
							route = RouteTable.Routes.MapRoute("Mvc" + state.Id, state.Route);
							route.Defaults = StateInfoConfig.GetRouteDefaults(state, state.Route);
							route.Defaults["controller"] = controller;
							route.Defaults["action"] = action;
							route.DataTokens = new RouteValueDictionary() { { NavigationSettings.Config.StateIdKey, state.Id } };
							route.RouteHandler = new MvcStateRouteHandler(state);
						}
					}
				}
			}
		}
	}
}

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

namespace Navigation.Mvc
{
	public class RouteConfig
	{
		public static void AddStateRoutes()
		{
			if (StateInfoConfig.Dialogs == null)
				return;
			ValueProviderFactories.Factories.Insert(0, new NavigationDataValueProviderFactory());
			string controller, action;
			Route route;
			using (RouteTable.Routes.GetWriteLock())
			{
				foreach (Dialog dialog in StateInfoConfig.Dialogs)
				{
					foreach (State state in dialog.States)
					{
						controller = state.Attributes["controller"] != null ? state.Attributes["controller"].Trim() : string.Empty;
						action = state.Attributes["action"] != null ? state.Attributes["action"].Trim() : string.Empty;
						if (controller.Length != 0 && action.Length != 0)
						{
							state.StateHandler = new MvcStateHandler();
							route = RouteTable.Routes.MapRoute("Mvc" + state.Id, state.Route);
							route.Defaults = StateInfoConfig.GetRouteDefaults(state, state.Route);
							route.Defaults["controller"] = controller;
							route.Defaults["action"] = action;
							route.DataTokens = new RouteValueDictionary() { { NavigationSettings.Config.StateIdKey, state.Id } };
							route.RouteHandler = new MvcStateRouteHandler(state);
						}
					}
				}
			}
		}
	}
}

Allow blank/root route to be configured

Allow blank/root route to be configured


using System.Linq;
using Assets.Scripts.Helpers;
using UnityEngine;

public class SelfLevelingController : MonoBehaviour
{
    public float MaxRotateAngle = 0.25f;

    void Start()
    {

    }

    void Update()
    {
        var body = GetComponent<Rigidbody2D>();
        var force = Environment.GetAverageGravitationalForce(body);
        gameObject.transform.up = force * -1;

        //var gravitySources = FindObjectsOfType<Gravity>();

        //var averageForce = Vector2.zero;
        //foreach (var source in gravitySources)
        //{
        //    averageForce += source.GetForce(body);
        //}

        //gameObject.transform.up = averageForce.normalized * -1;

        //var closestPlanet = GameObject
        //                .FindGameObjectsWithTag("Planet")
        //    .Select(x => new
        //    {
        //        Vector = gameObject.transform.position - x.transform.position,
        //        Planet = x
        //    })
        //    .OrderBy(x => x.Vector.magnitude - x.Planet.GetComponent<CircleCollider2D>().radius)
        //    .FirstOrDefault();

        //var targetVector = Vector3.RotateTowards(gameObject.transform.up, closestPlanet.Vector, MaxRotateAngle, Mathf.Infinity);

        //gameObject.transform.up = new Vector3(targetVector.x, targetVector.y).normalized;
    }
}

using Assets.Scripts.Helpers;
using UnityEngine;

public class SelfLevelingController : MonoBehaviour
{
    private Rigidbody2D body;

    void Start()
    {
        body = GetComponent<Rigidbody2D>();
    }

    void Update()
    {
        var force = Environment.GetAverageGravitationalForce(body);
        transform.rotation = Quaternion.LookRotation(Vector3.forward, force * -1);
    }
}

Fix camera flip bug at x=0

Fix camera flip bug at x=0


namespace TraktApiSharp.Services
{
    using Authentication;

    /// <summary>Provides helper methods for serializing and deserializing Trakt objects.</summary>
    public static class TraktSerializationService
    {
        public static string Serialize(TraktAuthorization authorization)
        {
            return string.Empty;
        }

        public static TraktAuthorization Deserialize(string authorization)
        {
            return null;
        }
    }
}

namespace TraktApiSharp.Services
{
    using Authentication;
    using System;

    /// <summary>Provides helper methods for serializing and deserializing Trakt objects.</summary>
    public static class TraktSerializationService
    {
        public static string Serialize(TraktAuthorization authorization)
        {
            if (authorization == null)
                throw new ArgumentNullException(nameof(authorization), "authorization must not be null");

            return string.Empty;
        }

        public static TraktAuthorization Deserialize(string authorization)
        {
            return null;
        }
    }
}

Add implementation for argument exceptions for serializing.


using System.Web.Mvc;
using System.Web.Mvc.Html;
using CourtesyFlush;

namespace System.Web.WebPages
{
    public static class HtmlHelperExtension
    {
        public static MvcHtmlString FlushHead(this HtmlHelper html)
        {
            return FlushHead(html, null);
        }

        public static MvcHtmlString FlushHead(this HtmlHelper html, string headername)
        {
            if (String.IsNullOrWhiteSpace(headername))
                headername = "_Head";

            if (!html.ViewData.ContainsKey("HeadFlushed"))
                return html.Partial(headername);

            return new MvcHtmlString(string.Empty);
        }

#if NET45
        public static MvcHtmlString FlushedAntiForgeryToken(this HtmlHelper html)
        {
            var token = html.ViewContext.HttpContext.Items[ControllerBaseExtension.FlushedAntiForgeryTokenKey] as string;

            if (string.IsNullOrEmpty(token))
            {
                // Fall back to the standard AntiForgeryToken if no FlushedAntiForgeryToken exists.
                return html.AntiForgeryToken();
            }

            var tag = new TagBuilder("input");
            tag.Attributes["type"] = "hidden";
            tag.Attributes["name"] = "__RequestVerificationToken";
            tag.Attributes["value"] = token;

            return new MvcHtmlString(tag.ToString());
        }
#endif
    }
}

using System.Web.Mvc;
using System.Web.Mvc.Html;
using CourtesyFlush;

namespace System.Web.WebPages
{
    public static class HtmlHelperExtension
    {
        public static MvcHtmlString FlushHead(this HtmlHelper html)
        {
            return FlushHead(html, null);
        }

        public static MvcHtmlString FlushHead(this HtmlHelper html, string headername)
        {
            if (String.IsNullOrWhiteSpace(headername))
                headername = "_Head";

            if (!html.ViewData.ContainsKey("HeadFlushed"))
                return html.Partial(headername);

            return new MvcHtmlString(string.Empty);
        }

#if NET45
        public static MvcHtmlString FlushedAntiForgeryToken(this HtmlHelper html)
        {
            var token = html.ViewContext.HttpContext.Items[ControllerBaseExtension.FlushedAntiForgeryTokenKey] as string;

            if (string.IsNullOrEmpty(token))
            {
                // Fall back to the standard AntiForgeryToken if no FlushedAntiForgeryToken exists.
                return html.AntiForgeryToken();
            }

            var tag = new TagBuilder("input");
            tag.Attributes["type"] = "hidden";
            tag.Attributes["name"] = "__RequestVerificationToken";
            tag.Attributes["value"] = token;

            return new MvcHtmlString(tag.ToString(TagRenderMode.SelfClosing));
        }
#endif
    }
}

Update to make hidden input for token self-closing


using System.Collections.Generic;
using Hangfire.MemoryStorage.Database;
using Hangfire.Server;
using Hangfire.Storage;

namespace Hangfire.MemoryStorage
{
    public class MemoryStorage : JobStorage
    {
        private readonly MemoryStorageOptions _options;
        private readonly Data _data;

        public MemoryStorage() : this(new MemoryStorageOptions(), new Data())
        {
        }

        public MemoryStorage(MemoryStorageOptions options) : this(options, new Data())
        {
        }

        public MemoryStorage(MemoryStorageOptions options, Data data)
        {
            _options = options;
            _data = data;
        }

        public override IStorageConnection GetConnection()
        {
            return new MemoryStorageConnection(_data, _options.FetchNextJobTimeout);
        }

        public override IMonitoringApi GetMonitoringApi()
        {
            return new MemoryStorageMonitoringApi(_data);
        }

#pragma warning disable 618
        public override IEnumerable<IServerComponent> GetComponents()
#pragma warning restore 618
        {
            yield return new ExpirationManager(_data, _options.JobExpirationCheckInterval);
            yield return new CountersAggregator(_data, _options.CountersAggregateInterval);
        }
    }
}

using System.Collections.Generic;
using Hangfire.MemoryStorage.Database;
using Hangfire.Server;
using Hangfire.Storage;

namespace Hangfire.MemoryStorage
{
    public class MemoryStorage : JobStorage
    {
        private readonly MemoryStorageOptions _options;

        public Data Data { get; }

        public MemoryStorage() : this(new MemoryStorageOptions(), new Data())
        {
        }

        public MemoryStorage(MemoryStorageOptions options) : this(options, new Data())
        {
        }

        public MemoryStorage(MemoryStorageOptions options, Data data)
        {
            _options = options;
            Data = data;
        }

        public override IStorageConnection GetConnection()
        {
            return new MemoryStorageConnection(Data, _options.FetchNextJobTimeout);
        }

        public override IMonitoringApi GetMonitoringApi()
        {
            return new MemoryStorageMonitoringApi(Data);
        }

#pragma warning disable 618
        public override IEnumerable<IServerComponent> GetComponents()
#pragma warning restore 618
        {
            yield return new ExpirationManager(Data, _options.JobExpirationCheckInterval);
            yield return new CountersAggregator(Data, _options.CountersAggregateInterval);
        }
    }
}

Allow access to the Data object

Allow access to the Data object


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

using System.Linq;
using Microsoft.DotNet.Cli.CommandLine;

namespace Microsoft.DotNet.Cli
{
    internal static class InternalReportinstallsuccessCommandParser
    {
        public static Command InternalReportinstallsuccess() =>
            Create.Command(
                "internal-reportinstallsuccess", "internal only",
                Accept.ExactlyOneArgument());
    }
}

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

using System.Linq;
using Microsoft.DotNet.Cli.CommandLine;

namespace Microsoft.DotNet.Cli
{
    internal static class InternalReportinstallsuccessCommandParser
    {
        public static Command InternalReportinstallsuccess() =>
            Create.Command(
                "internal-reportinstallsuccess",
                "",
                Accept.ExactlyOneArgument());
    }
}

Remove `internal-reportinstallsuccess` from `dotnet complete`.

This commit removes `internal-reportinstallsuccess` from `dotnet complete` by
changing the command's help text to an empty string.  This causes the parser to
treat the command as hidden and does not match the command name for
suggestions.

Fixes #9111.


using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Orleans.Providers.MongoDB.Configuration;
using Orleans.Runtime;
using Orleans.Serialization;

namespace Orleans.Providers.MongoDB.StorageProviders.Serializers
{
    public class JsonGrainStateSerializer : IGrainStateSerializer
    {
        private readonly JsonSerializer serializer;

        public JsonGrainStateSerializer(ITypeResolver typeResolver, IGrainFactory grainFactory, MongoDBGrainStorageOptions options)
        {
            var jsonSettings = OrleansJsonSerializer.GetDefaultSerializerSettings(typeResolver, grainFactory);
            options?.ConfigureJsonSerializerSettings?.Invoke(jsonSettings);
            this.serializer = JsonSerializer.Create(jsonSettings);

            //// https://github.com/OrleansContrib/Orleans.Providers.MongoDB/issues/44
            //// Always include the default value, so that the deserialization process can overwrite default
            //// values that are not equal to the system defaults.
            this.serializer.NullValueHandling = NullValueHandling.Include;

            this.serializer.DefaultValueHandling = DefaultValueHandling.Populate;
        }

        public void Deserialize(IGrainState grainState, JObject entityData)
        {
            var jsonReader = new JTokenReader(entityData);

            serializer.Populate(jsonReader, grainState.State);
        }

        public JObject Serialize(IGrainState grainState)
        {
            return JObject.FromObject(grainState.State, serializer);
        }
    }
}

using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Orleans.Providers.MongoDB.Configuration;
using Orleans.Runtime;
using Orleans.Serialization;

namespace Orleans.Providers.MongoDB.StorageProviders.Serializers
{
    public class JsonGrainStateSerializer : IGrainStateSerializer
    {
        private readonly JsonSerializer serializer;

        public JsonGrainStateSerializer(ITypeResolver typeResolver, IGrainFactory grainFactory, MongoDBGrainStorageOptions options)
        {
            var jsonSettings = OrleansJsonSerializer.GetDefaultSerializerSettings(typeResolver, grainFactory);

            //// https://github.com/OrleansContrib/Orleans.Providers.MongoDB/issues/44
            //// Always include the default value, so that the deserialization process can overwrite default
            //// values that are not equal to the system defaults.
            this.serializer.NullValueHandling = NullValueHandling.Include;
            this.serializer.DefaultValueHandling = DefaultValueHandling.Populate;

            options?.ConfigureJsonSerializerSettings?.Invoke(jsonSettings);
            this.serializer = JsonSerializer.Create(jsonSettings);
        }

        public void Deserialize(IGrainState grainState, JObject entityData)
        {
            var jsonReader = new JTokenReader(entityData);

            serializer.Populate(jsonReader, grainState.State);
        }

        public JObject Serialize(IGrainState grainState)
        {
            return JObject.FromObject(grainState.State, serializer);
        }
    }
}

Replace order of default settings

Replace order of default settings


using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using Ploeh.AutoFixture;
using Xunit;

namespace Ploeh.AutoFixtureUnitTest.DataAnnotations
{
    public class StringLengthArgumentSupportTests
    {
        [Fact]
        public void FixtureCorrectlyCreatesShortText()
        {
            // Fixture setup
            var fixture = new Fixture();
            // Exercise system
            var actual = fixture.Create<ClassWithLengthConstrainedConstructorArgument>();
            // Verify outcome
            Assert.True(
                actual.ShortText.Length <= ClassWithLengthConstrainedConstructorArgument.ShortTextMaximumLength,
                "AutoFixture should respect [StringLength] attribute on constructor arguments.");
            // Teardown
        }

        private class ClassWithLengthConstrainedConstructorArgument
        {
            public const int ShortTextMaximumLength = 3;
            public readonly string ShortText;

            public ClassWithLengthConstrainedConstructorArgument(
                [StringLength(ShortTextMaximumLength)]string shortText)
            {
                this.ShortText = shortText;
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using Ploeh.AutoFixture;
using Xunit;

namespace Ploeh.AutoFixtureUnitTest.DataAnnotations
{
    public class StringLengthArgumentSupportTests
    {
        [Fact]
        public void FixtureCorrectlyCreatesShortText()
        {
            // Fixture setup
            var fixture = new Fixture();
            // Exercise system
            var actual = fixture.Create<ClassWithLengthConstrainedConstructorArgument>();
            // Verify outcome
            Assert.True(
                actual.ShortText.Length <= ClassWithLengthConstrainedConstructorArgument.ShortTextMaximumLength,
                "AutoFixture should respect [StringLength] attribute on constructor arguments.");
            // Teardown
        }

        [Fact]
        public void FixtureCorrectlyCreatesLongText()
        {
            // Fixture setup
            var fixture = new Fixture();
            // Exercise system
            var actual = fixture.Create<ClassWithLengthConstrainedConstructorArgument>();
            // Verify outcome
            Assert.Equal(
                ClassWithLengthConstrainedConstructorArgument.LongTextLength,
                actual.LongText.Length);
            // Teardown
        }

        private class ClassWithLengthConstrainedConstructorArgument
        {
            public const int ShortTextMaximumLength = 3;
            public const int LongTextLength = 50;
            public readonly string ShortText;
            public readonly string LongText;

            public ClassWithLengthConstrainedConstructorArgument(
                [StringLength(ShortTextMaximumLength)]string shortText,
                [StringLength(LongTextLength, MinimumLength = LongTextLength)]string longText)
            {
                this.ShortText = shortText;
                this.LongText = longText;
            }
        }
    }
}

Add scenario test to check the minimum string length constraint is ignored


namespace Siftables
{
    public partial class MainWindowView
    {
        public MainWindowView()
        {
            InitializeComponent();
            DoSomething();
        }
    }
}

namespace Siftables
{
    public partial class MainWindowView
    {
        public MainWindowView()
        {
            InitializeComponent();
            DoAllOfTheThings();
        }
    }
}

Break build again for TeamCity email notify test.

Signed-off-by: Alexander J Mullans <60c6d277a8bd81de7fdde19201bf9c58a3df08f4@alexmullans.com>


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

using System;
using System.Linq;
using Nuke.Common.Utilities;

namespace Nuke.Common.CI.GitHubActions.Configuration
{
    public class GitHubActionsScheduledTrigger : GitHubActionsDetailedTrigger
    {
        public string Cron { get; set; }

        public override void Write(CustomFileWriter writer)
        {
            using (writer.Indent())
            {
                writer.WriteLine("schedule:");
                using (writer.Indent())
                {
                    writer.WriteLine($"  - cron: '{Cron}'");
                }
            }
        }
    }
}

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

using System;
using System.Linq;
using Nuke.Common.Utilities;

namespace Nuke.Common.CI.GitHubActions.Configuration
{
    public class GitHubActionsScheduledTrigger : GitHubActionsDetailedTrigger
    {
        public string Cron { get; set; }

        public override void Write(CustomFileWriter writer)
        {
            writer.WriteLine("schedule:");
            using (writer.Indent())
            {
                writer.WriteLine($"- cron: '{Cron}'");
            }
        }
    }
}

Fix indentation for scheduled triggers

Fix indentation for scheduled triggers


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

namespace KerbalPackageManager
{
    internal class dotVersion
    {
        public dotVersion(string toFilename)
        {
            var jObj = JObject.Parse(File.ReadAllText(toFilename));
            Name = (string)jObj["NAME"];
            Url = (Uri)jObj["URL"];
            var ver = jObj["VERSION"];
            Version = new Version((int)ver["MAJOR"], (int)ver["MINOR"], (int)ver["PATCH"], (int)ver["BUILD"]);
        }

        public string Name { get; set; }

        public Uri Url { get; set; }

        public Version Version { get; set; }
    }
}

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

namespace KerbalPackageManager
{
    internal class dotVersion
    {
        public dotVersion(string toFilename)
        {
            var jObj = JObject.Parse(File.ReadAllText(toFilename));
            Name = (string)jObj["NAME"];
            Url = (Uri)jObj["URL"];
            if (jObj["VERSION"] != null)
            {
                string ver = (string)jObj["VERSION"]["MAJOR"];
                if (jObj["VERSION"]["MINOR"] != null) ver += "." + jObj["VERSION"]["MINOR"];
                if (jObj["VERSION"]["PATCH"] != null) ver += "." + jObj["VERSION"]["PATCH"];
                if (jObj["VERSION"]["BUILD"] != null) ver += "." + jObj["VERSION"]["BUILD"];
                Version = new Version(ver);
            }
            else Version = null;
        }

        public string Name { get; set; }

        public Uri Url { get; set; }

        public Version Version { get; set; }
    }
}

Check dVers versions for null (version numbers such as 1, 1.2 and 1.3)


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

namespace IntUITive.Selenium.Tests
{
    [TestFixture]
    public class IntuitivelyTests
    {
        [Test]
        public void Find_WithNoTerm_Fails()
        {
            var intuitively = new Intuitively();

            Assert.That(() => intuitively.Find(null), Throws.Exception.TypeOf<ArgumentNullException>());
        }

        [Test]
        public void Find_WithEmptyTerm_Fails()
        {
            var intuitively = new Intuitively();

            Assert.That(() => intuitively.Find(""), Throws.Exception.TypeOf<ArgumentException>());
        }

        [Test]
        public void Find_WithUnidentifiableTerm_ReturnsNothing()
        {
            var intuitively = new Intuitively();

            var element = intuitively.Find("unidentifiable term");

            Assert.That(element, Is.Null);
        }
    }
}

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

namespace IntUITive.Selenium.Tests
{
    [TestFixture]
    public class EdgeCaseTests
    {
        [Test]
        public void Find_WithNoTerm_Fails()
        {
            var intuitively = new Intuitively();

            Assert.That(() => intuitively.Find(null), Throws.Exception.TypeOf<ArgumentNullException>());
        }

        [Test]
        public void Find_WithEmptyTerm_Fails()
        {
            var intuitively = new Intuitively();

            Assert.That(() => intuitively.Find(""), Throws.Exception.TypeOf<ArgumentException>());
        }

        [Test]
        public void Find_WithUnidentifiableTerm_ReturnsNothing()
        {
            var intuitively = new Intuitively();

            var element = intuitively.Find("unidentifiable term");

            Assert.That(element, Is.Null);
        }
    }
}

Refactor - rename test class

Refactor - rename test class


using UnityEngine;
using UniRx;
using UniRx.Triggers;
using System.Collections;
using System.Linq;
using System;
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class MyEventClass
{
    public event Action<int> Hoge;
    public void Push(int x)
    {
        Hoge(x);
    }
}

public class MoGe
{
    public void Huga()
    {
    }
}

// for Scenes/NextSandBox
public class Sandbox2 : MonoBehaviour
{
    public Button button;

    void Awake()
    {
        MainThreadDispatcher.Initialize();
    }

    void Aaa(Action action)
    {
    }

    int clickCount = 0;
    AsyncOperation ao = null;

    int hogehoge;

    void Start()
    {

        button.OnClickAsObservable().Subscribe(_ =>
        {
            if (clickCount++ == 0)
            {
                ao = SceneManager.LoadSceneAsync("TestSandbox");
                // Debug.Log(ao.allowSceneActivation);
                ao.allowSceneActivation = false;
                ao.AsAsyncOperationObservable(new Progress<float>(x =>
                {
                    Debug.Log(x);
                })).Subscribe();
            }
            else
            {
                ao.allowSceneActivation = true;
            }
        });
    }
}

using UnityEngine;
using UniRx;
using UniRx.Triggers;
using System.Collections;
using System.Linq;
using System;
using System.Collections.Generic;
using UnityEngine.UI;
// using UnityEngine.SceneManagement;

public class MyEventClass
{
    public event Action<int> Hoge;
    public void Push(int x)
    {
        Hoge(x);
    }
}

public class MoGe
{
    public void Huga()
    {
    }
}

// for Scenes/NextSandBox
public class Sandbox2 : MonoBehaviour
{
    public Button button;

    void Awake()
    {
        MainThreadDispatcher.Initialize();
    }

    void Aaa(Action action)
    {
    }

    int clickCount = 0;
    AsyncOperation ao = null;

    int hogehoge;

    void Start()
    {

        button.OnClickAsObservable().Subscribe(_ =>
        {
            //if (clickCount++ == 0)
            //{
            //    ao = SceneManager.LoadSceneAsync("TestSandbox");
            //    // Debug.Log(ao.allowSceneActivation);
            //    ao.allowSceneActivation = false;
            //    ao.AsAsyncOperationObservable(new Progress<float>(x =>
            //    {
            //        Debug.Log(x);
            //    })).Subscribe();
            //}
            //else
            //{
            //    ao.allowSceneActivation = true;
            //}
        });
    }
}

Fix Sandbox occurs compile error under 5.3


using NUnit.Framework;

namespace Rant.Tests.Expressions
{
    [TestFixture]
    public class Loops
    {
        private readonly RantEngine rant = new RantEngine();

        [Test]
        public void StringBuildingWhileLoop()
        {
            var output = rant.Do(@"
[@
    var parts = (""this"", ""is"", ""a"", ""test"");
    var i = 0;
    var buffer = """";
    while(i < parts.length)
    {
        if (i > 0) buffer ~= "" "";
        buffer ~= parts[i];
        i++;
    }
    return buffer;
]");
            Assert.AreEqual("this is a test", output.Main);
        }
    }
}

using NUnit.Framework;

namespace Rant.Tests.Expressions
{
    [TestFixture]
    public class Loops
    {
        private readonly RantEngine rant = new RantEngine();

        [Test]
        public void StringBuildingWhileLoop()
        {
            var output = rant.Do(@"
[@
    (function()
    {
        var parts = (""this"", ""is"", ""a"", ""test"");
        var i = 0;
        var buffer = """";
        while(i < parts.length)
        {
            if (i > 0) buffer ~= "" "";
            buffer ~= parts[i];
            i++;
        }
        return buffer;
    })();
]");
            Assert.AreEqual("this is a test", output.Main);
        }
    }
}

Put loop test's variables in a local scope


using Discord;
using Discord.Commands;
using Discord.WebSocket;

public class ModuleA : ModuleBase
{
    private readonly DatabaseService _database;

    // Dependencies can be injected via the constructor
    public ModuleA(DatabaseService database)
    {
        _database = database;
    }

    public async Task ReadFromDb()
    {
        var x = _database.getX();
        await ReplyAsync(x);
    }
}

public class ModuleB
{

    // Public settable properties will be injected
    public AnnounceService { get; set; }

    // Public properties without setters will not
    public CommandService Commands { get; }

    // Public properties annotated with [DontInject] will not
    [DontInject]
    public NotificationService { get; set; }

    public ModuleB(CommandService commands, IDependencyMap map)
    {
        Commands = commands;
        _notification = map.Get<NotificationService>();
    }

}

using Discord;
using Discord.Commands;
using Discord.WebSocket;

public class ModuleA : ModuleBase
{
    private readonly DatabaseService _database;

    // Dependencies can be injected via the constructor
    public ModuleA(DatabaseService database)
    {
        _database = database;
    }

    public async Task ReadFromDb()
    {
        var x = _database.getX();
        await ReplyAsync(x);
    }
}

public class ModuleB
{

    // Public settable properties will be injected
    public AnnounceService { get; set; }

    // Public properties without setters will not
    public CommandService Commands { get; }

    // Public properties annotated with [DontInject] will not
    [DontInject]
    public NotificationService { get; set; }

    public ModuleB(CommandService commands)
    {
        Commands = commands;
    }

}

Remove "Get" statement from example docs


using Chromium;
using Chromium.Event;
using Neutronium.Core;
using Neutronium.WPF;

namespace Neutronium.WebBrowserEngine.ChromiumFx
{
    public abstract class ChromiumFxWebBrowserApp : HTMLApp
    {
        protected virtual bool DisableWebSecurity => true;

        protected override IWPFWebWindowFactory GetWindowFactory(IWebSessionLogger logger) =>
            new ChromiumFXWPFWebWindowFactory(logger, UpdateChromiumSettings, PrivateUpdateLineCommandArg);

        protected virtual void UpdateChromiumSettings(CfxSettings settings)
        {
        }

        private void PrivateUpdateLineCommandArg(CfxOnBeforeCommandLineProcessingEventArgs beforeLineCommand)
        {
            var commandLine = beforeLineCommand.CommandLine;
            commandLine.AppendSwitch("disable-gpu");
            // Needed to avoid crash when using devtools application tab with custom schema
            commandLine.AppendSwitch("disable-kill-after-bad-ipc");

            if (DisableWebSecurity)
                commandLine.AppendSwitch("disable-web-security");
            UpdateLineCommandArg(beforeLineCommand);
        }

        protected virtual void UpdateLineCommandArg(CfxOnBeforeCommandLineProcessingEventArgs beforeLineCommand)
        {
        }
    }
}

using Chromium;
using Chromium.Event;
using Neutronium.Core;
using Neutronium.WPF;

namespace Neutronium.WebBrowserEngine.ChromiumFx
{
    public abstract class ChromiumFxWebBrowserApp : HTMLApp
    {
        protected virtual bool DisableWebSecurity => false;

        protected override IWPFWebWindowFactory GetWindowFactory(IWebSessionLogger logger) =>
            new ChromiumFXWPFWebWindowFactory(logger, UpdateChromiumSettings, PrivateUpdateLineCommandArg);

        protected virtual void UpdateChromiumSettings(CfxSettings settings)
        {
        }

        private void PrivateUpdateLineCommandArg(CfxOnBeforeCommandLineProcessingEventArgs beforeLineCommand)
        {
            var commandLine = beforeLineCommand.CommandLine;
            commandLine.AppendSwitch("disable-gpu");
            if (DisableWebSecurity)
                commandLine.AppendSwitch("disable-web-security");
            UpdateLineCommandArg(beforeLineCommand);
        }

        protected virtual void UpdateLineCommandArg(CfxOnBeforeCommandLineProcessingEventArgs beforeLineCommand)
        {
        }
    }
}

Improve cfx default settings (removing hack switch)


using System;
using System.Threading.Tasks;
using JabbR.ContentProviders.Core;

namespace JabbR.ContentProviders
{
    public class AudioContentProvider : IContentProvider
    {
        public bool IsValidContent(Uri uri)
        {
            return uri.AbsolutePath.EndsWith(".mp3", StringComparison.OrdinalIgnoreCase) ||
                   uri.AbsolutePath.EndsWith(".wav", StringComparison.OrdinalIgnoreCase) ||
                   uri.AbsolutePath.EndsWith(".ogg", StringComparison.OrdinalIgnoreCase);
        }

        public Task<ContentProviderResult> GetContent(ContentProviderHttpRequest request)
        {
            return TaskAsyncHelper.FromResult(new ContentProviderResult()
            {
                Content = String.Format(@"<audio controls=""controls"" src=""{0}"">Your browser does not support the audio tag.</audio>", request.RequestUri),
                Title = request.RequestUri.AbsoluteUri.ToString()
            });
        }
    }
}

using System;
using System.Threading.Tasks;
using JabbR.ContentProviders.Core;
using Microsoft.Security.Application;

namespace JabbR.ContentProviders
{
    public class AudioContentProvider : IContentProvider
    {
        public bool IsValidContent(Uri uri)
        {
            return uri.AbsolutePath.EndsWith(".mp3", StringComparison.OrdinalIgnoreCase) ||
                   uri.AbsolutePath.EndsWith(".wav", StringComparison.OrdinalIgnoreCase) ||
                   uri.AbsolutePath.EndsWith(".ogg", StringComparison.OrdinalIgnoreCase);
        }

        public Task<ContentProviderResult> GetContent(ContentProviderHttpRequest request)
        {
            string url = request.RequestUri.ToString();
            return TaskAsyncHelper.FromResult(new ContentProviderResult()
            {
                Content = String.Format(@"<audio controls=""controls"" src=""{0}"">Your browser does not support the audio tag.</audio>", Encoder.HtmlAttributeEncode(url)),
                Title = request.RequestUri.AbsoluteUri
            });
        }
    }
}

Fix for audio URIs to prevent onerror javascript being introduced via percent encoding.

Signed-off-by: cmaish <1d6e1cf70ec6f9ab28d3ea4b27a49a77654d370e@christophermaish.com>


using Auth0.Core;
using Newtonsoft.Json;

namespace Auth0.ManagementApi.Models
{

    /// <summary>
    ///
    /// </summary>
    public class DeviceCredentialCreateRequest : DeviceCredentialBase
    {

        /// <summary>
        /// Gets or sets the ID of the client for which the credential will be created.
        /// </summary>
        [JsonProperty("client_id")]
        public string ClientId { get; set; }

        /// <summary>
        /// Gets or sets the ID of the user using the device for which the credential will be created.
        /// </summary>
        [JsonProperty("user_id")]
        public string UserId { get; set; }

        /// <summary>
        /// Gets or sets the value of the credentia
        /// </summary>
        [JsonProperty("value")]
        public string Value { get; set; }

    }

}

using System;
using Auth0.Core;
using Newtonsoft.Json;

namespace Auth0.ManagementApi.Models
{

    /// <summary>
    ///
    /// </summary>
    public class DeviceCredentialCreateRequest : DeviceCredentialBase
    {

        /// <summary>
        /// Gets or sets the ID of the client for which the credential will be created.
        /// </summary>
        [JsonProperty("client_id")]
        public string ClientId { get; set; }

        /// <summary>
        /// Gets or sets the ID of the user using the device for which the credential will be created.
        /// </summary>
        [Obsolete("This property has been removed from the Auth0 API and sending it has no effect")]
        [JsonIgnore]
        [JsonProperty("user_id")]
        public string UserId { get; set; }

        /// <summary>
        /// Gets or sets the value of the credentia
        /// </summary>
        [JsonProperty("value")]
        public string Value { get; set; }

    }

}

Remove User ID from device credential creation payload


using UnityEngine;
using System.Collections;

public class GameManager : MonoBehaviour
{
    public static GameManager Instance;
    public Mode CurrentMode = Mode.TopDown;

    CameraController cameraController;

    void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        } else if (Instance != this)
        {
            Destroy(Instance.gameObject);
            Instance = this;
        }

        cameraController = GetComponent<CameraController>();

        if (CurrentMode == Mode.TopDown)
        {
            cameraController.SwitchToTopDown();
        }
        else
        {
            cameraController.SwitchToSideScroller();
        }
    }

    void Update()
    {
        if (Input.GetButtonDown("Twist"))
        {
            if (CurrentMode == Mode.TopDown)
            {
                cameraController.RotateToSideScroller();
                GetComponent<TransitionManager>().Twist(Mode.SideScroller);

            } else if(CurrentMode == Mode.SideScroller) {
                GetComponent<TransitionManager>().Twist(Mode.TopDown);
                cameraController.RotateToTopDown();
            }
        }

    }
}

public enum Mode
{
    SideScroller,
    TopDown,
    TransitioningToSideScroller,
    TransitioningToTopDown
}

using UnityEngine;
using System.Collections;

public class GameManager : MonoBehaviour
{
    public static GameManager Instance;
    public Mode CurrentMode = Mode.TopDown;
    public bool AllowTwisting = true;

    CameraController cameraController;

    void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        } else if (Instance != this)
        {
            Destroy(Instance.gameObject);
            Instance = this;
        }

        cameraController = GetComponent<CameraController>();

        if (CurrentMode == Mode.TopDown)
        {
            cameraController.SwitchToTopDown();
        }
        else
        {
            cameraController.SwitchToSideScroller();
        }
    }

    void Update()
    {
        if (Input.GetButtonDown("Twist") && AllowTwisting)
        {
            if (CurrentMode == Mode.TopDown)
            {
                cameraController.RotateToSideScroller();
                GetComponent<TransitionManager>().Twist(Mode.SideScroller);

            } else if(CurrentMode == Mode.SideScroller) {
                GetComponent<TransitionManager>().Twist(Mode.TopDown);
                cameraController.RotateToTopDown();
            }
        }

    }
}

public enum Mode
{
    SideScroller,
    TopDown,
    TransitioningToSideScroller,
    TransitioningToTopDown
}

Add option to control whether player can use twisting


using System.Linq;
using Umbraco.Core.Persistence.Dtos;

namespace Umbraco.Core.Migrations.Upgrade.V_8_16_0
{
    public class AddPropertyTypeGroupColumns : MigrationBase
    {
        public AddPropertyTypeGroupColumns(IMigrationContext context)
            : base(context)
        { }

        public override void Migrate()
        {
            AddColumn<PropertyTypeGroupDto>("type");
            AddColumn<PropertyTypeGroupDto>("alias", out var sqls);
            var dtos = Database.Fetch<PropertyTypeGroupDto>();
            foreach (var dto in dtos)
            {
                // Generate alias from current name
                dto.Alias = dto.Text.ToSafeAlias(true);

                Database.Update(dto, x => new { x.Alias });
            }
            foreach (var sql in sqls) Database.Execute(sql);
        }
    }
}

using System.Linq;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence.Dtos;

namespace Umbraco.Core.Migrations.Upgrade.V_8_16_0
{
    public class AddPropertyTypeGroupColumns : MigrationBase
    {
        public AddPropertyTypeGroupColumns(IMigrationContext context)
            : base(context)
        { }

        public override void Migrate()
        {
            AddColumn<PropertyTypeGroupDto>("type");

            AddColumn<PropertyTypeGroupDto>("alias", out var sqls);

            var dtos = Database.Fetch<PropertyTypeGroupDto>();
            foreach (var dtosPerAlias in dtos.GroupBy(x => x.Text.ToSafeAlias(true)))
            {
                var dtosPerAliasAndText = dtosPerAlias.GroupBy(x => x.Text);
                var numberSuffix = 1;
                foreach (var dtosPerText in dtosPerAliasAndText)
                {
                    foreach (var dto in dtosPerText)
                    {
                        dto.Alias = dtosPerAlias.Key;

                        if (numberSuffix > 1)
                        {
                            // More than 1 name found for the alias, so add a suffix
                            dto.Alias += numberSuffix;
                        }

                        Database.Update(dto, x => new { x.Alias });
                    }

                    numberSuffix++;
                }

                if (numberSuffix > 2)
                {
                    Logger.Error<AddPropertyTypeGroupColumns>("Detected the same alias {Alias} for different property group names {Names}, the migration added suffixes, but this might break backwards compatibility.", dtosPerAlias.Key, dtosPerAliasAndText.Select(x => x.Key));
                }
            }

            foreach (var sql in sqls)
                Database.Execute(sql);
        }
    }
}

Fix migration to handle identical aliases for different group names and write error to log


using System;
using System.Threading.Tasks;

namespace MySql.Data
{
	internal static class ValueTaskExtensions
	{
		public static ValueTask<TResult> ContinueWith<T, TResult>(this ValueTask<T> valueTask, Func<T, ValueTask<TResult>> continuation)
		{
			return valueTask.IsCompleted ? continuation(valueTask.Result) :
				new ValueTask<TResult>(valueTask.AsTask().ContinueWith(task => continuation(task.GetAwaiter().GetResult()).AsTask()).Unwrap());
		}

		public static ValueTask<T> FromException<T>(Exception exception) => new ValueTask<T>(Utility.TaskFromException<T>(exception));
	}
}

using System;
using System.Threading.Tasks;

namespace MySql.Data
{
	internal static class ValueTaskExtensions
	{
		public static async ValueTask<TResult> ContinueWith<T, TResult>(this ValueTask<T> valueTask, Func<T, ValueTask<TResult>> continuation) => await continuation(await valueTask);

		public static ValueTask<T> FromException<T>(Exception exception) => new ValueTask<T>(Utility.TaskFromException<T>(exception));
	}
}

Use await instead of hand-written continuation.

The compiler-generated state machine reduces allocations and performs better in benchmarks.


@using JoinRpg.Web.App_Code
@using JoinRpg.Web.Models.Plot
@model PlotElementViewModel

 @if (!Model.Visible)
 {
     return;
 }

@{
    var hideClass = Model.Status == PlotStatus.InWork ? "world-object-hidden" : "";
}

@if (Model.HasEditAccess)
{

    @Html.DisplayFor(model => model.Status)
    @Html.ActionLink("Изменить", "Edit", "Plot", new { Model.PlotFolderId, Model.ProjectId }, null)
    @if (Model.CharacterId != null)
        {
    @Html.MoveControl(model => Model, "MoveElementForCharacter", "Plot", Model.CharacterId)
    }

}

@if (Model.HasMasterAccess || Model.PublishMode)
{

    Для
    if (Model.TargetsForDisplay.Any())
    {
        foreach (var target in Model.TargetsForDisplay)
        {
            @Html.DisplayFor(model => target)
        }
    }
    else
    {
        Не установлено
    }
}

@if (!string.IsNullOrWhiteSpace(Model.TodoField) && Model.HasMasterAccess)
{

Доделать: @Model.TodoField

}

    @Html.DisplayFor(model => Model.Content)

@using JoinRpg.Web.App_Code
@using JoinRpg.Web.Models.Plot
@model PlotElementViewModel

 @if (!Model.Visible)
 {
     return;
 }

@{
    var hideClass = Model.Status == PlotStatus.InWork ? "world-object-hidden" : "";
}

@if (Model.HasEditAccess)
{

    @Html.DisplayFor(model => model.Status)
    @Html.ActionLink("Изменить", "Edit", "Plot", new { Model.PlotFolderId, Model.ProjectId }, null)
    @if (Model.CharacterId != null)
        {
    @Html.MoveControl(model => Model, "MoveElementForCharacter", "Plot", Model.CharacterId)
    }

}

@if (Model.HasMasterAccess || Model.PublishMode)
{

    Для
    if (Model.TargetsForDisplay.Any())
    {
        foreach (var target in Model.TargetsForDisplay)
        {
            @Html.DisplayFor(model => target)
        }
    }
    else
    {
        Не установлено
    }
}

@if (!string.IsNullOrWhiteSpace(Model.TodoField) && Model.HasMasterAccess)
{

Доделать: @Model.TodoField

}

    @Model.Content

Fix missing plot in claims

Fix missing plot in claims


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

namespace LiteNetLibHighLevel
{
    [RequireComponent(typeof(LiteNetLibAssets))]
    public class LiteNetLibGameManager : LiteNetLibManager
    {
        private LiteNetLibAssets assets;
        public LiteNetLibAssets Assets
        {
            get
            {
                if (assets == null)
                    assets = GetComponent<LiteNetLibAssets>();
                return assets;
            }
        }

        protected override void Awake()
        {
            base.Awake();
            Assets.ClearRegisterPrefabs();
            Assets.RegisterPrefabs();
        }

        public override bool StartServer()
        {
            if (base.StartServer())
                Assets.RegisterSceneObjects();
            return false;
        }

        public override LiteNetLibClient StartClient()
        {
            var client = base.StartClient();
            if (client != null)
                Assets.RegisterSceneObjects();
            return client;
        }

        protected override void RegisterServerMessages()
        {
            base.RegisterServerMessages();
        }

        protected override void RegisterClientMessages()
        {
            base.RegisterClientMessages();
        }

        #region Relates components functions
        public LiteNetLibIdentity NetworkSpawn(GameObject gameObject)
        {
            return Assets.NetworkSpawn(gameObject);
        }

        public bool NetworkDestroy(GameObject gameObject)
        {
            return Assets.NetworkDestroy(gameObject);
        }
        #endregion
    }
}

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

namespace LiteNetLibHighLevel
{
    [RequireComponent(typeof(LiteNetLibAssets))]
    public class LiteNetLibGameManager : LiteNetLibManager
    {
        private LiteNetLibAssets assets;
        public LiteNetLibAssets Assets
        {
            get
            {
                if (assets == null)
                    assets = GetComponent<LiteNetLibAssets>();
                return assets;
            }
        }

        protected override void Awake()
        {
            base.Awake();
            Assets.ClearRegisterPrefabs();
            Assets.RegisterPrefabs();
        }

        public override bool StartServer()
        {
            if (base.StartServer())
            {
                Assets.RegisterSceneObjects();
                return true;
            }
            return false;
        }

        public override LiteNetLibClient StartClient()
        {
            var client = base.StartClient();
            if (client != null)
                Assets.RegisterSceneObjects();
            return client;
        }

        protected override void RegisterServerMessages()
        {
            base.RegisterServerMessages();
        }

        protected override void RegisterClientMessages()
        {
            base.RegisterClientMessages();
        }

        #region Relates components functions
        public LiteNetLibIdentity NetworkSpawn(GameObject gameObject)
        {
            return Assets.NetworkSpawn(gameObject);
        }

        public bool NetworkDestroy(GameObject gameObject)
        {
            return Assets.NetworkDestroy(gameObject);
        }
        #endregion
    }
}

Fix invalid logic when start server

Fix invalid logic when start server


@using JabbR;
    <form class="form-horizontal" action="@Url.Content("~/account/login")" method="post">
        @Html.ValidationSummary()

                    @Html.TextBox("username", "input-block-level", "Username")

                    @Html.Password("password", "input-block-level", "Password")

                <button type="submit" class="btn">Sign in</button>

        @if (Model)
        {

                Register if you don't have an account.

        }
        @Html.AntiForgeryToken()
    </form>

@using JabbR;
    <form class="form-horizontal" action="@Url.Content("~/account/login")" method="post">
        @Html.ValidationSummary()

                    @Html.TextBox("username", "span10", "Username")

                    @Html.Password("password", "span10", "Password")

                <button type="submit" class="btn">Sign in</button>

        @if (Model)
        {

                Register if you don't have an account.

        }
        @Html.AntiForgeryToken()
    </form>

Make username password fields fit on Mac Chrome


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

using osu.Game.Audio;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Osu.Judgements;
using osu.Game.Rulesets.Scoring;

namespace osu.Game.Rulesets.Osu.Objects
{
    public class SpinnerTick : OsuHitObject
    {
        public SpinnerTick()
        {
            Samples.Add(new HitSampleInfo { Name = "spinnerbonus" });
        }

        public override Judgement CreateJudgement() => new OsuSpinnerTickJudgement();

        protected override HitWindows CreateHitWindows() => null;
    }
}

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

using osu.Game.Audio;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Osu.Judgements;
using osu.Game.Rulesets.Scoring;

namespace osu.Game.Rulesets.Osu.Objects
{
    public class SpinnerTick : OsuHitObject
    {
        public SpinnerTick()
        {
            Samples.Add(new HitSampleInfo { Name = "spinnerbonus" });
        }

        public override Judgement CreateJudgement() => new OsuSpinnerTickJudgement();

        protected override HitWindows CreateHitWindows() => HitWindows.Empty;
    }
}

Use empty hit windows for spinner ticks

Use empty hit windows for spinner ticks


using System;
using ATL.AudioReaders;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Text;

namespace ATL.test
{
    [TestClass]
    public class FactoryTest
    {
        [TestMethod]
        public void TestGetPlaylistFormats()
        {
            StringBuilder filter = new StringBuilder("");

            foreach (Format f in ATL.PlaylistReaders.PlaylistReaderFactory.GetInstance().getFormats())
            {
                if (f.Readable)
                {
                    foreach (String extension in f)
                    {
                        filter.Append(extension).Append(";");
                    }
                }
            }
            // Removes the last separator
            filter.Remove(filter.Length - 1, 1);

            Assert.AreEqual(".PLS;.M3U;.M3U8;.FPL;.XSPF;.SMIL;.SMI;.ASX;.WAX;.WVX;.B4S", filter.ToString());
        }
    }
}

using System;
using ATL.AudioReaders;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Text;

namespace ATL.test
{
    [TestClass]
    public class FactoryTest
    {
        [TestMethod]
        public void TestGetPlaylistFormats()
        {
            StringBuilder filter = new StringBuilder("");

            foreach (Format f in ATL.PlaylistReaders.PlaylistReaderFactory.GetInstance().getFormats())
            {
                if (f.Readable)
                {
                    foreach (String extension in f)
                    {
                        filter.Append(extension).Append(";");
                    }
                }
            }
            // Removes the last separator
            filter.Remove(filter.Length - 1, 1);

            Assert.AreEqual(".PLS;.M3U;.M3U8;.FPL;.XSPF;.SMIL;.SMI;.ZPL;.WPL;.ASX;.WAX;.WVX;.B4S", filter.ToString());
        }
    }
}

Fix TestGetPlaylistFormats after adding more extensions to the PlaylistReaderFactory


using System;
using System.IO;

namespace Amica.vNext
{
    public class SqliteObjectCache : SqliteObjectCacheBase
    {
        protected override string GetDatabasePath()
        {
            const string sqliteFilename = "cache.db3";
            var cacheFolder = Path.Combine(ApplicationName, "SimpleCache");

            var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            var cachePath = Path.Combine(documentsPath, "..", "Library", cacheFolder);
            Directory.CreateDirectory(cachePath);
            return Path.Combine(cachePath, sqliteFilename);
        }
    }
}

using System;
using System.IO;
using Amica.vNext;

[assembly: Xamarin.Forms.Dependency(typeof(SqliteObjectCache))]

namespace Amica.vNext
{
    public class SqliteObjectCache : SqliteObjectCacheBase
    {
        protected override string GetDatabasePath()
        {
            const string sqliteFilename = "cache.db3";
            var cacheFolder = Path.Combine(ApplicationName, "SimpleCache");

            var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            var cachePath = Path.Combine(documentsPath, cacheFolder);
            Directory.CreateDirectory(cachePath);
            return Path.Combine(cachePath, sqliteFilename);
        }
    }
}

Fix iOS cache folder path

Fix iOS cache folder path


using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.ObjectBuilder;

namespace UnityAutoMoq
{
    public class UnityAutoMoqExtension : UnityContainerExtension
    {
        private readonly UnityAutoMoqContainer autoMoqContainer;

        public UnityAutoMoqExtension(UnityAutoMoqContainer autoMoqContainer)
        {
            this.autoMoqContainer = autoMoqContainer;
        }

        protected override void Initialize()
        {
            Context.Strategies.Add(new UnityAutoMoqBuilderStrategy(autoMoqContainer), UnityBuildStage.PreCreation);
        }
    }
}

using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.ObjectBuilder;

namespace UnityAutoMoq
{
    /// <summary>
    /// Provide extensions for Unity Auto Moq
    /// </summary>
    public class UnityAutoMoqExtension : UnityContainerExtension
    {
        private readonly UnityAutoMoqContainer autoMoqContainer;

        public UnityAutoMoqExtension(UnityAutoMoqContainer autoMoqContainer)
        {
            this.autoMoqContainer = autoMoqContainer;
        }

        protected override void Initialize()
        {
            Context.Strategies.Add(new UnityAutoMoqBuilderStrategy(autoMoqContainer), UnityBuildStage.PreCreation);
        }
    }
}

Add API comments for Git Testing ;)

Add API comments for Git Testing ;)


#if NETSTANDARD1_6

using System;
using Microsoft.Extensions.Configuration;

namespace RapidCore.Configuration
{
    /// <summary>
    /// Base class for strongly typed configuration classes.
    ///
    /// The idea is to allow you to define a config class specific
    /// for your project, but gain easy access to reading config values
    /// from wherever.
    /// </summary>
    public abstract class ConfigBase
    {
        private readonly IConfigurationRoot configuration;

        public ConfigBase(IConfigurationRoot configuration)
        {
            this.configuration = configuration;
        }

        protected T Get<T>(string key, T defaultValue)
        {
            string value = configuration[key];

            if (string.IsNullOrEmpty(value))
            {
                return defaultValue;
            }

            return (T)Convert.ChangeType(value, typeof(T));
        }
    }
}
#endif

#if NETSTANDARD1_6

using System;
using Microsoft.Extensions.Configuration;

namespace RapidCore.Configuration
{
    /// <summary>
    /// Base class for strongly typed configuration classes.
    ///
    /// The idea is to allow you to define a config class specific
    /// for your project, but gain easy access to reading config values
    /// from wherever.
    /// </summary>
    public abstract class ConfigBase
    {
        private readonly IConfiguration configuration;

        protected ConfigBase(IConfiguration configuration)
        {
            this.configuration = configuration;
        }

        protected T Get<T>(string key, T defaultValue)
        {
            string value = configuration[key];

            if (string.IsNullOrEmpty(value))
            {
                return defaultValue;
            }

            return (T)Convert.ChangeType(value, typeof(T));
        }
    }
}
#endif

Switch to the less restrictive IConfiguration


@{
    ViewBag.Title = "Contact";
}

@ViewBag.Title.

@ViewBag.Message

<address>
    One Microsoft Way

    Redmond, WA 98052-6399

    P:
    425.555.0100
</address>

<address>
    Support:   Support@example.com

    Marketing: Marketing@example.com
</address>

@{
    ViewBag.Title = "Contact";
}

@ViewBag.Title.

@ViewBag.Message

<address>
    One Microsoft Way

    Redmond, WA 98052-6399

    P:
    425.555.0100
</address>

<address>
    Support:   Support@example.com

    Marketing: Marketing@example.com
    Travis: travis.elkins@zirmed.com
</address>

Add Travis to contact list.

Add Travis to contact list.


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

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

[assembly: AssemblyTitle("Flirper1.0")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

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

[assembly: AssemblyVersion("1.0.*")]

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

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

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

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

[assembly: AssemblyTitle("Flirper1.1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

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

[assembly: AssemblyVersion("1.1.*")]

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

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

Change assembly version for release

Change assembly version for release


using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Xml.Serialization;
using Rocket.Unturned.Player;

namespace Safezone.Model
{
    [XmlInclude(typeof(RectangleType))]
    public abstract class SafeZoneType
    {
        private static readonly Dictionary<String, Type> RegistereTypes = new Dictionary<String, Type>();

        public static SafeZoneType CreateSafeZoneType(String name)
        {
            if (!RegistereTypes.ContainsKey(name))
            {
                return null;
            }
            Type t = RegistereTypes[name];
            return (SafeZoneType)Activator.CreateInstance(t);
        }

        public static void RegisterSafeZoneType(String name, Type t)
        {
            if(typeof(SafeZoneType).IsAssignableFrom(t))
            {
                throw new ArgumentException(t.Name + " is not a SafeZoneType!");
            }

            if (RegistereTypes.ContainsKey(name))
            {
                throw new ArgumentException(name + " is already registered!");
            }

            RegistereTypes.Add(name, t);
        }

        public abstract SafeZone Create(RocketPlayer player, String name, string[] args);
        public abstract bool IsInSafeZone(Position p);
        public abstract bool Redefine(RocketPlayer player, string[] args);

        public static ReadOnlyCollection<String> GetTypes()
        {
            return new ReadOnlyCollection<string>(new List<string>(RegistereTypes.Keys));
        }
    }
}

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Xml.Serialization;
using Rocket.Unturned.Player;

namespace Safezone.Model
{
    [XmlInclude(typeof(RectangleType))]
    [XmlInclude(typeof(CircleType))]
    public abstract class SafeZoneType
    {
        private static readonly Dictionary<String, Type> RegistereTypes = new Dictionary<String, Type>();

        public static SafeZoneType CreateSafeZoneType(String name)
        {
            if (!RegistereTypes.ContainsKey(name))
            {
                return null;
            }
            Type t = RegistereTypes[name];
            return (SafeZoneType)Activator.CreateInstance(t);
        }

        public static void RegisterSafeZoneType(String name, Type t)
        {
            if(typeof(SafeZoneType).IsAssignableFrom(t))
            {
                throw new ArgumentException(t.Name + " is not a SafeZoneType!");
            }

            if (RegistereTypes.ContainsKey(name))
            {
                throw new ArgumentException(name + " is already registered!");
            }

            RegistereTypes.Add(name, t);
        }

        public abstract SafeZone Create(RocketPlayer player, String name, string[] args);
        public abstract bool IsInSafeZone(Position p);
        public abstract bool Redefine(RocketPlayer player, string[] args);

        public static ReadOnlyCollection<String> GetTypes()
        {
            return new ReadOnlyCollection<string>(new List<string>(RegistereTypes.Keys));
        }
    }
}

Add missing Include for CircleType

Add missing Include for CircleType