commit
stringlengths
40
40
subject
stringlengths
4
1.73k
repos
stringlengths
5
127k
old_file
stringlengths
2
751
new_file
stringlengths
2
751
new_contents
stringlengths
1
8.98k
old_contents
stringlengths
0
6.59k
license
stringclasses
13 values
lang
stringclasses
23 values
998a9fdc9baa8ba9fc2ea2b90cefe310bfbad09b
Fix spelling
dotnet-architecture/eShopOnContainers,skynode/eShopOnContainers,andrelmp/eShopOnContainers,dotnet-architecture/eShopOnContainers,productinfo/eShopOnContainers,albertodall/eShopOnContainers,dotnet-architecture/eShopOnContainers,albertodall/eShopOnContainers,andrelmp/eShopOnContainers,dotnet-architecture/eShopOnContainers,productinfo/eShopOnContainers,albertodall/eShopOnContainers,andrelmp/eShopOnContainers,skynode/eShopOnContainers,productinfo/eShopOnContainers,albertodall/eShopOnContainers,skynode/eShopOnContainers,skynode/eShopOnContainers,skynode/eShopOnContainers,andrelmp/eShopOnContainers,albertodall/eShopOnContainers,dotnet-architecture/eShopOnContainers,productinfo/eShopOnContainers,andrelmp/eShopOnContainers,productinfo/eShopOnContainers,productinfo/eShopOnContainers,andrelmp/eShopOnContainers
src/Services/Catalog/Catalog.API/Infrastructure/Filters/HttpGlobalExceptionFilter.cs
src/Services/Catalog/Catalog.API/Infrastructure/Filters/HttpGlobalExceptionFilter.cs
using Catalog.API.Infrastructure.ActionResults; using Catalog.API.Infrastructure.Exceptions; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.Extensions.Logging; using System.Net; namespace Catalog.API.Infrastructure.Filters { public class HttpGlobalExceptionFilter : IExceptionFilter { private readonly IHostingEnvironment env; private readonly ILogger<HttpGlobalExceptionFilter> logger; public HttpGlobalExceptionFilter(IHostingEnvironment env, ILogger<HttpGlobalExceptionFilter> logger) { this.env = env; this.logger = logger; } public void OnException(ExceptionContext context) { logger.LogError(new EventId(context.Exception.HResult), context.Exception, context.Exception.Message); if (context.Exception.GetType() == typeof(CatalogDomainException)) { var json = new JsonErrorResponse { Messages = new[] { context.Exception.Message } }; context.Result = new BadRequestObjectResult(json); context.HttpContext.Response.StatusCode = (int)HttpStatusCode.BadRequest; } else { var json = new JsonErrorResponse { Messages = new[] { "An error ocurred." } }; if (env.IsDevelopment()) { json.DeveloperMeesage = context.Exception; } context.Result = new InternalServerErrorObjectResult(json); context.HttpContext.Response.StatusCode = (int)HttpStatusCode.InternalServerError; } context.ExceptionHandled = true; } private class JsonErrorResponse { public string[] Messages { get; set; } public object DeveloperMeesage { get; set; } } } }
using Catalog.API.Infrastructure.ActionResults; using Catalog.API.Infrastructure.Exceptions; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Filters; using Microsoft.Extensions.Logging; using System.Net; namespace Catalog.API.Infrastructure.Filters { public class HttpGlobalExceptionFilter : IExceptionFilter { private readonly IHostingEnvironment env; private readonly ILogger<HttpGlobalExceptionFilter> logger; public HttpGlobalExceptionFilter(IHostingEnvironment env, ILogger<HttpGlobalExceptionFilter> logger) { this.env = env; this.logger = logger; } public void OnException(ExceptionContext context) { logger.LogError(new EventId(context.Exception.HResult), context.Exception, context.Exception.Message); if (context.Exception.GetType() == typeof(CatalogDomainException)) { var json = new JsonErrorResponse { Messages = new[] { context.Exception.Message } }; context.Result = new BadRequestObjectResult(json); context.HttpContext.Response.StatusCode = (int)HttpStatusCode.BadRequest; } else { var json = new JsonErrorResponse { Messages = new[] { "An error ocurr.Try it again." } }; if (env.IsDevelopment()) { json.DeveloperMeesage = context.Exception; } context.Result = new InternalServerErrorObjectResult(json); context.HttpContext.Response.StatusCode = (int)HttpStatusCode.InternalServerError; } context.ExceptionHandled = true; } private class JsonErrorResponse { public string[] Messages { get; set; } public object DeveloperMeesage { get; set; } } } }
mit
C#
c27a20bc2a0ed3562a7782e47be9386727c0791c
Use API to override the location of the dictionary file in the dictionary cache from our Web applicatoin
TheChimni/Anagrams,TheChimni/Anagrams
Anagrams/Global.asax.cs
Anagrams/Global.asax.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.Routing; using Anagrams.Models; namespace Anagrams { // Note: For instructions on enabling IIS6 or IIS7 classic mode, // visit http://go.microsoft.com/?LinkId=9394801 public class MvcApplication : System.Web.HttpApplication { public static void RegisterGlobalFilters(GlobalFilterCollection filters) { filters.Add(new HandleErrorAttribute()); } public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults ); } protected void Application_Start() { AreaRegistration.RegisterAllAreas(); DictionaryCache.Reader = new DictionaryReader(); RegisterGlobalFilters(GlobalFilters.Filters); RegisterRoutes(RouteTable.Routes); DictionaryCache.SetPath(HttpContext.Current.Server.MapPath(@"Content/wordlist.txt")); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.Routing; using Anagrams.Models; namespace Anagrams { // Note: For instructions on enabling IIS6 or IIS7 classic mode, // visit http://go.microsoft.com/?LinkId=9394801 public class MvcApplication : System.Web.HttpApplication { public static void RegisterGlobalFilters(GlobalFilterCollection filters) { filters.Add(new HandleErrorAttribute()); } public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults ); } protected void Application_Start() { AreaRegistration.RegisterAllAreas(); DictionaryCache.Reader = new DictionaryReader(); RegisterGlobalFilters(GlobalFilters.Filters); RegisterRoutes(RouteTable.Routes); } } }
mit
C#
371b36181c98b3839bc2081b1f554bf70615c121
Fix broken link.
hhalim/Shift.Demo.Mvc,hhalim/Shift.Demo.Mvc
MyApp.Client/Views/Home/Index.cshtml
MyApp.Client/Views/Home/Index.cshtml
@{ ViewBag.Title = "Home Page"; } <div class="row" style="padding-top: 20px"> <div class="col-sm-12"> <ul> <li> <a href="@Url.Action("Index","Dashboard")">Dashboard</a> </li> <li> <a href="@Url.Action("Index", "Progress")">Status & Progress</a> </li> <li> <a href="@Url.Action("Index","Job")">Add Jobs</a> </li> </ul> </div> </div>
@{ ViewBag.Title = "Home Page"; } <div class="row" style="padding-top: 20px"> <div class="col-sm-12"> <ul> <li> <a href="@Url.Action("Index","Dashboard")">Dashboard</a> </li> <li> <a href="@Url.Action("Index", "Progress")">Status & Progress</a> </li> <li> <a href="@Url.Action("Index","Jobs")">Add Jobs</a> </li> </ul> </div> </div>
mit
C#
076e9231af98ace3d5ff2d86a221de16f32f9156
disable windows auth by default and add note about IIS requiring config
IdentityServer/IdentityServer4.Quickstart.UI,IdentityServer/IdentityServer4.Quickstart.UI,IdentityServer/IdentityServer4.Quickstart.UI,IdentityServer/IdentityServer4.Quickstart.UI
Quickstart/Account/AccountOptions.cs
Quickstart/Account/AccountOptions.cs
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved. // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. using System; namespace IdentityServer4.Quickstart.UI { public class AccountOptions { public static bool AllowLocalLogin = true; public static bool AllowRememberLogin = true; public static TimeSpan RememberMeLoginDuration = TimeSpan.FromDays(30); public static bool ShowLogoutPrompt = true; public static bool AutomaticRedirectAfterSignOut = false; // to enable windows authentication, the host (IIS or IIS Express) also must have // windows auth enabled. public static bool WindowsAuthenticationEnabled = false; // specify the Windows authentication schemes you want to use for authentication public static readonly string[] WindowsAuthenticationSchemes = new string[] { "Negotiate", "NTLM" }; public static readonly string WindowsAuthenticationProviderName = "Windows"; public static readonly string WindowsAuthenticationDisplayName = "Windows"; public static string InvalidCredentialsErrorMessage = "Invalid username or password"; } }
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved. // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. using System; namespace IdentityServer4.Quickstart.UI { public class AccountOptions { public static bool AllowLocalLogin = true; public static bool AllowRememberLogin = true; public static TimeSpan RememberMeLoginDuration = TimeSpan.FromDays(30); public static bool ShowLogoutPrompt = true; public static bool AutomaticRedirectAfterSignOut = false; public static bool WindowsAuthenticationEnabled = true; // specify the Windows authentication schemes you want to use for authentication public static readonly string[] WindowsAuthenticationSchemes = new string[] { "Negotiate", "NTLM" }; public static readonly string WindowsAuthenticationProviderName = "Windows"; public static readonly string WindowsAuthenticationDisplayName = "Windows"; public static string InvalidCredentialsErrorMessage = "Invalid username or password"; } }
apache-2.0
C#
50d005ca0961871be161efa7b7e8b4a3724adfad
Improve Cake Bakery resolver
OmniSharp/omnisharp-roslyn,OmniSharp/omnisharp-roslyn,DustinCampbell/omnisharp-roslyn,DustinCampbell/omnisharp-roslyn
src/OmniSharp.Cake/Services/ScriptGenerationToolResolver.cs
src/OmniSharp.Cake/Services/ScriptGenerationToolResolver.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using OmniSharp.Cake.Configuration; using OmniSharp.Utilities; namespace OmniSharp.Cake.Services { internal static class ScriptGenerationToolResolver { public static string GetExecutablePath(string rootPath, ICakeConfiguration configuration) { // First check if installed in workspace var executablepath = ResolveFromToolFolder(rootPath, configuration); if (!string.IsNullOrEmpty(executablepath)) { return executablepath; } // If not check from path return ResolveFromPath(); } private static string ResolveFromToolFolder(string rootPath, ICakeConfiguration configuration) { var toolPath = GetToolPath(rootPath, configuration); if (!Directory.Exists(toolPath)) { return string.Empty; } var bakeryPath = GetLatestBakeryPath(toolPath); if (bakeryPath == null) { return string.Empty; } return Path.Combine(toolPath, bakeryPath, "tools", "Cake.Bakery.exe"); } private static string GetToolPath(string rootPath, ICakeConfiguration configuration) { var toolPath = configuration.GetValue(Constants.Paths.Tools); return Path.Combine(rootPath, !string.IsNullOrWhiteSpace(toolPath) ? toolPath : "tools"); } private static string GetLatestBakeryPath(string toolPath) { var directories = GetBakeryPaths(toolPath); // TODO: Sort by semantic version? return directories.OrderByDescending(x => x).FirstOrDefault(); } private static IEnumerable<string> GetBakeryPaths(string toolPath) { foreach (var directory in Directory.EnumerateDirectories(toolPath)) { var topDirectory = directory.Split(Path.DirectorySeparatorChar).Last(); if (topDirectory.StartsWith("cake.bakery", StringComparison.OrdinalIgnoreCase)) { yield return topDirectory; } } } private static string ResolveFromPath() { foreach (var searchPath in PlatformHelper.GetSearchPaths()) { var path = Path.Combine(searchPath, "Cake.Bakery.exe"); if (File.Exists(path)) { return path; } } return string.Empty; } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices; using OmniSharp.Cake.Configuration; namespace OmniSharp.Cake.Services { internal static class ScriptGenerationToolResolver { public static string GetExecutablePath(string rootPath, ICakeConfiguration configuration) { var toolPath = GetToolPath(rootPath, configuration); if (!Directory.Exists(toolPath)) { return string.Empty; } var bakeryPath = GetLatestBakeryPath(toolPath); if (bakeryPath == null) { return string.Empty; } return Path.Combine(toolPath, bakeryPath, "tools", "Cake.Bakery.exe"); } private static string GetToolPath(string rootPath, ICakeConfiguration configuration) { var toolPath = configuration.GetValue(Constants.Paths.Tools); return Path.Combine(rootPath, !string.IsNullOrWhiteSpace(toolPath) ? toolPath : "tools"); } private static string GetLatestBakeryPath(string toolPath) { var directories = GetBakeryPaths(toolPath); // TODO: Sort by semantic version? return directories.OrderByDescending(x => x).FirstOrDefault(); } private static IEnumerable<string> GetBakeryPaths(string toolPath) { foreach (var directory in Directory.EnumerateDirectories(toolPath)) { var topDirectory = directory.Split(Path.DirectorySeparatorChar).Last(); if (topDirectory.StartsWith("cake.bakery", StringComparison.OrdinalIgnoreCase)) { yield return topDirectory; } } } } }
mit
C#
d230ba56259aa60bfb0e7473d50c5ad0a704b8dd
Fix get so tests now work.
peteri/ClassicBasic
ClassicBasic.Interpreter/Commands/Get.cs
ClassicBasic.Interpreter/Commands/Get.cs
// <copyright file="Get.cs" company="Peter Ibbotson"> // (C) Copyright 2017 Peter Ibbotson // </copyright> namespace ClassicBasic.Interpreter.Commands { /// <summary> /// Implements the GET command. /// </summary> public class Get : Token, ICommand { private readonly IRunEnvironment _runEnvironment; private readonly IExpressionEvaluator _expressionEvaluator; private readonly ITeletypeWithPosition _teletypeWithPosition; /// <summary> /// Initializes a new instance of the <see cref="Get"/> class. /// </summary> /// <param name="runEnvironment">Run time environment.</param> /// <param name="expressionEvaluator">Expression evaluator.</param> /// <param name="teletypeWithPosition">Teletype.</param> public Get( IRunEnvironment runEnvironment, IExpressionEvaluator expressionEvaluator, ITeletypeWithPosition teletypeWithPosition) : base("GET", TokenType.ClassStatement) { _runEnvironment = runEnvironment; _expressionEvaluator = expressionEvaluator; _teletypeWithPosition = teletypeWithPosition; } /// <summary> /// Executes the GET command. /// </summary> public void Execute() { if (!_runEnvironment.CurrentLine.LineNumber.HasValue) { throw new Exceptions.IllegalDirectException(); } var variableReference = _expressionEvaluator.GetLeftValue(); var newChar = _teletypeWithPosition.ReadChar(); Accumulator newValue; if (variableReference.GetValue().Type == typeof(string)) { newValue = new Accumulator(newChar.ToString()); } else { if ("+-E.\0".Contains(newChar.ToString())) { newChar = '0'; } if (newChar < '0' || newChar > '9') { throw new Exceptions.SyntaxErrorException(); } newValue = new Accumulator((double)(newChar - '0')); } variableReference.SetValue(newValue); } } }
// <copyright file="Get.cs" company="Peter Ibbotson"> // (C) Copyright 2017 Peter Ibbotson // </copyright> namespace ClassicBasic.Interpreter.Commands { /// <summary> /// Implements the GET command. /// </summary> public class Get : Token, ICommand { private readonly IRunEnvironment _runEnvironment; private readonly IExpressionEvaluator _expressionEvaluator; private readonly ITeletypeWithPosition _teletypeWithPosition; /// <summary> /// Initializes a new instance of the <see cref="Get"/> class. /// </summary> /// <param name="runEnvironment">Run time environment.</param> /// <param name="expressionEvaluator">Expression evaluator.</param> /// <param name="teletypeWithPosition">Teletype.</param> public Get( IRunEnvironment runEnvironment, IExpressionEvaluator expressionEvaluator, ITeletypeWithPosition teletypeWithPosition) : base("GET", TokenType.ClassStatement) { _runEnvironment = runEnvironment; _expressionEvaluator = expressionEvaluator; _teletypeWithPosition = teletypeWithPosition; } /// <summary> /// Executes the GET command. /// </summary> public void Execute() { if (!_runEnvironment.CurrentLine.LineNumber.HasValue) { throw new Exceptions.IllegalDirectException(); } var variableReference = _expressionEvaluator.GetLeftValue(); var newChar = _teletypeWithPosition.ReadChar(); Accumulator newValue = new Accumulator(newChar.ToString()); variableReference.SetValue(newValue); } } }
mit
C#
c5b07b0c4caab19afb3759de0ea8af9c9aa8ca0b
Prepare for removal
whampson/bft-spec,whampson/cascara
Src/WHampson.Cascara/TemplateFile.cs
Src/WHampson.Cascara/TemplateFile.cs
//#region License ///* Copyright (c) 2017 Wes Hampson // * // * Permission is hereby granted, free of charge, to any person obtaining a copy // * of this software and associated documentation files (the "Software"), to deal // * in the Software without restriction, including without limitation the rights // * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // * copies of the Software, and to permit persons to whom the Software is // * furnished to do so, subject to the following conditions: // * // * The above copyright notice and this permission notice shall be included in all // * copies or substantial portions of the Software. // * // * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // * SOFTWARE. // */ //#endregion //using System.Xml; //using System.Xml.Linq; //namespace WHampson.Cascara //{ // public sealed class templatefile // { // private static xdocument openxmlfile(string path) // { // try // { // return xdocument.load(path, loadoptions.setlineinfo); // } // catch (xmlexception e) // { // throw new templateexception(e.message, e); // } // } // private xdocument doc; // public templatefile(string path) // { // doc = openxmlfile(path); // } // public t process<t>(string filepath) where t : new() // { // templateprocessor processor = new templateprocessor(doc); // return processor.process<t>(filepath); // } // public string this[string key] // { // // get template metadata (root element attribute values) // get // { // xattribute attr = doc.root.attribute(key); // return (attr != null) ? attr.value : null; // } // } // } //}
#region License /* Copyright (c) 2017 Wes Hampson * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #endregion using System.Xml; using System.Xml.Linq; namespace WHampson.Cascara { public sealed class TemplateFile { private static XDocument OpenXmlFile(string path) { try { return XDocument.Load(path, LoadOptions.SetLineInfo); } catch (XmlException e) { throw new TemplateException(e.Message, e); } } private XDocument doc; public TemplateFile(string path) { doc = OpenXmlFile(path); } public T Process<T>(string filePath) where T : new() { TemplateProcessor processor = new TemplateProcessor(doc); return processor.Process<T>(filePath); } public string this[string key] { // Get template metadata (Root element attribute values) get { XAttribute attr = doc.Root.Attribute(key); return (attr != null) ? attr.Value : null; } } } }
mit
C#
d412c73f9b2bd60df04a8141fe59e331e5a0eb13
Add owners to AzureFirewall tests
ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,AzureAutomationTeam/azure-powershell,AzureAutomationTeam/azure-powershell,ClogenyTechnologies/azure-powershell,ClogenyTechnologies/azure-powershell
src/ResourceManager/Network/Commands.Network.Test/ScenarioTests/AzureFirewallTests.cs
src/ResourceManager/Network/Commands.Network.Test/ScenarioTests/AzureFirewallTests.cs
// ---------------------------------------------------------------------------------- // // Copyright Microsoft Corporation // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ---------------------------------------------------------------------------------- using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; using Xunit.Abstractions; namespace Commands.Network.Test.ScenarioTests { public class AzureFirewallTests : Microsoft.WindowsAzure.Commands.Test.Utilities.Common.RMTestBase { public XunitTracingInterceptor _logger; public AzureFirewallTests(ITestOutputHelper output) { _logger = new XunitTracingInterceptor(output); XunitTracingInterceptor.AddToContext(new XunitTracingInterceptor(output)); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] [Trait(Category.Owner, "azurefirewall")] public void TestAzureFirewallCRUD() { NetworkResourcesController.NewInstance.RunPsTest(_logger, "Test-AzureFirewallCRUD"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] [Trait(Category.Owner, "azurefirewall")] public void TestAzureFirewallAllocateAndDeallocate() { NetworkResourcesController.NewInstance.RunPsTest(_logger, "Test-AzureFirewallAllocateAndDeallocate"); } } }
// ---------------------------------------------------------------------------------- // // Copyright Microsoft Corporation // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // ---------------------------------------------------------------------------------- using Microsoft.Azure.ServiceManagemenet.Common.Models; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; using Xunit.Abstractions; namespace Commands.Network.Test.ScenarioTests { public class AzureFirewallTests : Microsoft.WindowsAzure.Commands.Test.Utilities.Common.RMTestBase { public XunitTracingInterceptor _logger; public AzureFirewallTests(ITestOutputHelper output) { _logger = new XunitTracingInterceptor(output); XunitTracingInterceptor.AddToContext(new XunitTracingInterceptor(output)); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestAzureFirewallCRUD() { NetworkResourcesController.NewInstance.RunPsTest(_logger, "Test-AzureFirewallCRUD"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestAzureFirewallAllocateAndDeallocate() { NetworkResourcesController.NewInstance.RunPsTest(_logger, "Test-AzureFirewallAllocateAndDeallocate"); } } }
apache-2.0
C#
2319871d86b95237a921b822beca25b91c969913
Add language list to Kh2.Constants
Xeeynamo/KingdomHearts
OpenKh.Kh2/Constants.cs
OpenKh.Kh2/Constants.cs
namespace OpenKh.Kh2 { public enum World { WorldZz, EndOfSea, TwilightTown, DestinyIsland, HollowBastion, BeastCastle, TheUnderworld, Agrabah, LandOfDragons, HundredAcreWood, PrideLands, Atlantica, DisneyCastle, TimelessRiver, HalloweenTown, WorldMap, PortRoyal, SpaceParanoids, WorldThatNeverWas } public static class Constants { public const int FontEuropeanSystemWidth = 18; public const int FontEuropeanSystemHeight = 24; public const int FontEuropeanEventWidth = 24; public const int FontEuropeanEventHeight = 32; public const int FontIconWidth = 24; public const int FontIconHeight = 24; public const int PaletteCount = 9; public const int WorldCount = (int)World.WorldThatNeverWas + 1; public static readonly string[] WorldIds = new string[WorldCount] { "zz", "es", "tt", "di", "hb", "bb", "he", "al", "mu", "po", "lk", "lm", "dc", "wi", "nm", "wm", "ca", "tr", "eh" }; public static readonly string[] Languages = new string[] { "jp", "us", "it", "sp", "fr", "gr", }; public static readonly string[] WorldNames = new string[WorldCount] { "World ZZ", "End of Sea", "Twilight Town", "Destiny Islands", "Hollow Bastion", "Beast's Castle", "Olympus Coliseum", "Agrabah", "The Land of Dragons", "100 Acre Wood", "Pride Lands", "Atlantica", "Disney Castle", "Timeless River", "Halloween Town", "World Map", "Port Royal", "Space Paranoids", "World That Never Was" }; } }
namespace OpenKh.Kh2 { public enum World { WorldZz, EndOfSea, TwilightTown, DestinyIsland, HollowBastion, BeastCastle, TheUnderworld, Agrabah, LandOfDragons, HundredAcreWood, PrideLands, Atlantica, DisneyCastle, TimelessRiver, HalloweenTown, WorldMap, PortRoyal, SpaceParanoids, WorldThatNeverWas } public static class Constants { public const int FontEuropeanSystemWidth = 18; public const int FontEuropeanSystemHeight = 24; public const int FontEuropeanEventWidth = 24; public const int FontEuropeanEventHeight = 32; public const int FontIconWidth = 24; public const int FontIconHeight = 24; public const int PaletteCount = 9; public const int WorldCount = (int)World.WorldThatNeverWas + 1; public static readonly string[] WorldIds = new string[WorldCount] { "zz", "es", "tt", "di", "hb", "bb", "he", "al", "mu", "po", "lk", "lm", "dc", "wi", "nm", "wm", "ca", "tr", "eh" }; public static readonly string[] WorldNames = new string[WorldCount] { "World ZZ", "End of Sea", "Twilight Town", "Destiny Islands", "Hollow Bastion", "Beast's Castle", "Olympus Coliseum", "Agrabah", "The Land of Dragons", "100 Acre Wood", "Pride Lands", "Atlantica", "Disney Castle", "Timeless River", "Halloween Town", "World Map", "Port Royal", "Space Paranoids", "World That Never Was" }; } }
mit
C#
02a1e683654ec8a93afc799a23231c3570734f1b
Fix null ref in new DefaultManualInjectionStrategy
HelloKitty/SceneJect,HelloKitty/SceneJect
src/SceneJect.Common/Services/DefaultManualInjectionStrategy.cs
src/SceneJect.Common/Services/DefaultManualInjectionStrategy.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Autofac; using JetBrains.Annotations; using SceneJect.Common; using UnityEngine; namespace SceneJect { public sealed class DefaultManualInjectionStrategy : IManualInjectionStrategy { /// <summary> /// Service for resolving dependencies. /// </summary> private IComponentContext ResolverService { get; } /// <inheritdoc /> public DefaultManualInjectionStrategy([NotNull] IComponentContext resolverService) { ResolverService = resolverService ?? throw new ArgumentNullException(nameof(resolverService)); } /// <inheritdoc /> public void InjectDependencies(IReadOnlyCollection<MonoBehaviour> behaviours) { if(behaviours == null) throw new ArgumentNullException(nameof(behaviours)); if(behaviours.Count == 0) return; //TODO: Expose this as a depedency new DefaultInjectionStrategy().InjectDependencies<MonoBehaviour>(behaviours, ResolverService); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Autofac; using JetBrains.Annotations; using SceneJect.Common; using UnityEngine; namespace SceneJect { public sealed class DefaultManualInjectionStrategy : IManualInjectionStrategy { /// <summary> /// Service for resolving dependencies. /// </summary> private IComponentContext ResolverService { get; } private IInjectionStrategy InjectionStrategy { get; } /// <inheritdoc /> public DefaultManualInjectionStrategy([NotNull] IComponentContext resolverService) { ResolverService = resolverService ?? throw new ArgumentNullException(nameof(resolverService)); } /// <inheritdoc /> public void InjectDependencies(IReadOnlyCollection<MonoBehaviour> behaviours) { if(behaviours == null) throw new ArgumentNullException(nameof(behaviours)); if(behaviours.Count == 0) return; InjectionStrategy.InjectDependencies<MonoBehaviour>(behaviours, ResolverService); } } }
mit
C#
e448f39856458596f54c448e092ec56fb4fce3d4
Update Program.cs
mansoor-omrani/AssemblyInfo
AssemblyInfo/Program.cs
AssemblyInfo/Program.cs
using System; using System.Reflection; namespace AssemblyInfo { public class Program { public static void Main(string[] args) { if (args != null && args.Length > 0) { Assembly asm = null; var name = args[0]; try { if (name.Substring(name.Length - 4, 4) != ".dll") name += ".dll"; asm = Assembly.LoadFrom(name); } catch { try { var path = AppDomain.CurrentDomain.BaseDirectory + @"\" + name; asm = Assembly.LoadFrom(path); } catch (Exception e) { System.Console.WriteLine(e.Message); return; } } var x = asm.GetName(); System.Console.WriteLine("CodeBase: {0}", x.CodeBase); System.Console.WriteLine("ContentType: {0}", x.ContentType); System.Console.WriteLine("CultureInfo: {0}", x.CultureInfo); System.Console.WriteLine("CultureName: {0}", x.CultureName); System.Console.WriteLine("FullName: {0}", x.FullName); System.Console.WriteLine("Name: {0}", x.Name); System.Console.WriteLine("Version: {0}", x.Version); System.Console.WriteLine("VersionCompatibility: {0}", x.VersionCompatibility); } else { System.Console.WriteLine("Usage: asminfo.exe assembly"); } } } }
using System; using System.Reflection; namespace AssemblyInfo { class Program { static void Main(string[] args) { if (args != null && args.Length > 0) { Assembly asm = null; var name = args[0]; try { if (name.Substring(name.Length - 4, 4) != ".dll") name += ".dll"; asm = Assembly.LoadFrom(name); } catch { try { var path = AppDomain.CurrentDomain.BaseDirectory + @"\" + name; asm = Assembly.LoadFrom(path); } catch (Exception e) { System.Console.WriteLine(e.Message); return; } } var x = asm.GetName(); System.Console.WriteLine("CodeBase: {0}", x.CodeBase); System.Console.WriteLine("ContentType: {0}", x.ContentType); System.Console.WriteLine("CultureInfo: {0}", x.CultureInfo); System.Console.WriteLine("CultureName: {0}", x.CultureName); System.Console.WriteLine("FullName: {0}", x.FullName); System.Console.WriteLine("Name: {0}", x.Name); System.Console.WriteLine("Version: {0}", x.Version); System.Console.WriteLine("VersionCompatibility: {0}", x.VersionCompatibility); } else { System.Console.WriteLine("Usage: asminfo.exe assembly"); } } } }
mit
C#
b5d5de3ed59860973faa0dc7a389837b243f0b96
Work around empty calendar stores, fixes #10165
labdogg1003/monotouch-samples,davidrynn/monotouch-samples,YOTOV-LIMITED/monotouch-samples,markradacz/monotouch-samples,kingyond/monotouch-samples,peteryule/monotouch-samples,davidrynn/monotouch-samples,YOTOV-LIMITED/monotouch-samples,labdogg1003/monotouch-samples,peteryule/monotouch-samples,xamarin/monotouch-samples,sakthivelnagarajan/monotouch-samples,robinlaide/monotouch-samples,robinlaide/monotouch-samples,kingyond/monotouch-samples,andypaul/monotouch-samples,haithemaraissia/monotouch-samples,markradacz/monotouch-samples,sakthivelnagarajan/monotouch-samples,haithemaraissia/monotouch-samples,nelzomal/monotouch-samples,peteryule/monotouch-samples,nelzomal/monotouch-samples,a9upam/monotouch-samples,albertoms/monotouch-samples,iFreedive/monotouch-samples,sakthivelnagarajan/monotouch-samples,W3SS/monotouch-samples,nelzomal/monotouch-samples,sakthivelnagarajan/monotouch-samples,andypaul/monotouch-samples,kingyond/monotouch-samples,W3SS/monotouch-samples,YOTOV-LIMITED/monotouch-samples,W3SS/monotouch-samples,xamarin/monotouch-samples,robinlaide/monotouch-samples,davidrynn/monotouch-samples,hongnguyenpro/monotouch-samples,a9upam/monotouch-samples,a9upam/monotouch-samples,davidrynn/monotouch-samples,iFreedive/monotouch-samples,hongnguyenpro/monotouch-samples,nervevau2/monotouch-samples,andypaul/monotouch-samples,haithemaraissia/monotouch-samples,haithemaraissia/monotouch-samples,xamarin/monotouch-samples,a9upam/monotouch-samples,nervevau2/monotouch-samples,albertoms/monotouch-samples,peteryule/monotouch-samples,YOTOV-LIMITED/monotouch-samples,iFreedive/monotouch-samples,labdogg1003/monotouch-samples,nelzomal/monotouch-samples,robinlaide/monotouch-samples,andypaul/monotouch-samples,nervevau2/monotouch-samples,labdogg1003/monotouch-samples,markradacz/monotouch-samples,nervevau2/monotouch-samples,hongnguyenpro/monotouch-samples,hongnguyenpro/monotouch-samples,albertoms/monotouch-samples
Calendars/Calendars/Screens/EventList/EventListController.cs
Calendars/Calendars/Screens/EventList/EventListController.cs
using System; using System.Linq; using System.Collections.Generic; using MonoTouch.UIKit; using MonoTouch.Dialog; using MonoTouch.Foundation; using MonoTouch.EventKit; namespace Calendars.Screens.EventList { public class EventListController : DialogViewController { // our roote element for MonoTouch.Dialog protected RootElement itemListRoot = new RootElement ( "Calendar/Reminder Items" ); protected EKCalendarItem[] events; protected EKEntityType eventType; public EventListController ( EKCalendarItem[] events, EKEntityType eventType ) : base ( UITableViewStyle.Plain, null, true) { this.events = events; this.eventType = eventType; Section section; if (events == null) { section = new Section () { new StringElement ("No calendar events") }; } else { section = new Section () { from items in this.events select ( Element ) new StringElement ( items.Title ) }; } itemListRoot.Add (section); // set our element root this.InvokeOnMainThread ( () => { this.Root = itemListRoot; } ); } } }
using System; using System.Linq; using System.Collections.Generic; using MonoTouch.UIKit; using MonoTouch.Dialog; using MonoTouch.Foundation; using MonoTouch.EventKit; namespace Calendars.Screens.EventList { public class EventListController : DialogViewController { // our roote element for MonoTouch.Dialog protected RootElement itemListRoot = new RootElement ( "Calendar/Reminder Items" ); protected EKCalendarItem[] events; protected EKEntityType eventType; public EventListController ( EKCalendarItem[] events, EKEntityType eventType ) : base ( UITableViewStyle.Plain, null, true) { this.events = events; this.eventType = eventType; // add elements to the dialog root for each item itemListRoot.Add ( new Section ( ) { from items in this.events select ( Element ) new StringElement ( items.Title ) } ); // set our element root this.InvokeOnMainThread ( () => { this.Root = itemListRoot; } ); } } }
mit
C#
9c2c7a644986bd49da50e82cbb9ec56d22705f89
revise Initialize
mschray/CalendarHelper
shared/LogHelper.csx
shared/LogHelper.csx
public static class LogHelper { private static TraceWriter logger; public static void Initialize(TraceWriter log) { if (logger == null) logger = log; } public static void Info(TraceWriter log, string logtext) { logger.Info(logtext); } public static void Error(TraceWriter log, string logtext) { logger.Error(logtext); } }
public static class LogHelper { private static TraceWriter logger; public static void Initialize(TraceWriter log) { if (logger == null) logger = log; } public static void Info(TraceWriter log, string logtext) { logger.Info(logtext); } public static void Error(TraceWriter log, string logtext) { logger.Error(logtext); } }
mit
C#
664c6bd73ae0fb9cab2c925986856ac318b905bb
Add Count/Position props to byte[] code reader
0xd4d/iced,0xd4d/iced,0xd4d/iced,0xd4d/iced,0xd4d/iced
Iced/Intel/ByteArrayCodeReader.cs
Iced/Intel/ByteArrayCodeReader.cs
/* Copyright (C) 2018 [email protected] This file is part of Iced. Iced is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Iced is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Iced. If not, see <https://www.gnu.org/licenses/>. */ #if (!NO_DECODER32 || !NO_DECODER64) && !NO_DECODER using System; namespace Iced.Intel { /// <summary> /// A <see cref="CodeReader"/> that reads data from a byte array /// </summary> public sealed class ByteArrayCodeReader : CodeReader { readonly byte[] data; int currentPosition; readonly int startPosition; readonly int endPosition; /// <summary> /// Current position /// </summary> public int Position { get => currentPosition - startPosition; set { if ((uint)value > (uint)Count) throw new ArgumentOutOfRangeException(nameof(value)); currentPosition = startPosition + value; } } /// <summary> /// Number of bytes that can be read /// </summary> public int Count => endPosition - startPosition; /// <summary> /// Checks if it's possible to read another byte /// </summary> public bool CanReadByte => currentPosition < endPosition; /// <summary> /// Constructor /// </summary> /// <param name="hexData">Hex bytes encoded in a string</param> public ByteArrayCodeReader(string hexData) : this(HexUtils.ToByteArray(hexData)) { } /// <summary> /// Constructor /// </summary> /// <param name="data">Data</param> public ByteArrayCodeReader(byte[] data) { this.data = data ?? throw new ArgumentNullException(nameof(data)); currentPosition = 0; startPosition = 0; endPosition = data.Length; } /// <summary> /// Constructor /// </summary> /// <param name="data">Data</param> /// <param name="index">Start index</param> /// <param name="count">Number of bytes</param> public ByteArrayCodeReader(byte[] data, int index, int count) { this.data = data ?? throw new ArgumentNullException(nameof(data)); if (index < 0) throw new ArgumentOutOfRangeException(nameof(index)); if (count < 0) throw new ArgumentOutOfRangeException(nameof(count)); if ((ulong)(uint)index + (uint)count > (uint)data.Length) throw new ArgumentOutOfRangeException(nameof(count)); currentPosition = index; startPosition = index; endPosition = index + count; } /// <summary> /// Reads the next byte or returns less than 0 if there are no more bytes /// </summary> /// <returns></returns> public override int ReadByte() { if (currentPosition >= endPosition) return -1; return data[currentPosition++]; } } } #endif
/* Copyright (C) 2018 [email protected] This file is part of Iced. Iced is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Iced is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with Iced. If not, see <https://www.gnu.org/licenses/>. */ #if (!NO_DECODER32 || !NO_DECODER64) && !NO_DECODER using System; namespace Iced.Intel { /// <summary> /// A <see cref="CodeReader"/> that reads data from a byte array /// </summary> public sealed class ByteArrayCodeReader : CodeReader { readonly byte[] data; int currentPosition; readonly int endPosition; /// <summary> /// Checks if it's possible to read another byte /// </summary> public bool CanReadByte => currentPosition < endPosition; /// <summary> /// Constructor /// </summary> /// <param name="hexData">Hex bytes encoded in a string</param> public ByteArrayCodeReader(string hexData) : this(HexUtils.ToByteArray(hexData)) { } /// <summary> /// Constructor /// </summary> /// <param name="data">Data</param> public ByteArrayCodeReader(byte[] data) { this.data = data ?? throw new ArgumentNullException(nameof(data)); currentPosition = 0; endPosition = data.Length; } /// <summary> /// Constructor /// </summary> /// <param name="data">Data</param> /// <param name="index">Start index</param> /// <param name="count">Number of bytes</param> public ByteArrayCodeReader(byte[] data, int index, int count) { this.data = data ?? throw new ArgumentNullException(nameof(data)); if (index < 0) throw new ArgumentOutOfRangeException(nameof(index)); if (count < 0) throw new ArgumentOutOfRangeException(nameof(count)); if ((ulong)(uint)index + (uint)count > (uint)data.Length) throw new ArgumentOutOfRangeException(nameof(count)); currentPosition = index; endPosition = index + count; } /// <summary> /// Reads the next byte or returns less than 0 if there are no more bytes /// </summary> /// <returns></returns> public override int ReadByte() { if (currentPosition >= endPosition) return -1; return data[currentPosition++]; } } } #endif
mit
C#
1f60752230d592aa7a23063f744801ca8eb0c22f
Debug Assertions
azure-contrib/netmfazurestorage
netmfazurestorage/Tests/QueueTests.cs
netmfazurestorage/Tests/QueueTests.cs
using System; using Microsoft.SPOT; using NetMf.CommonExtensions; using netmfazurestorage.Account; using netmfazurestorage.Queue; namespace netmfazurestorage.Tests { public class QueueTests { private QueueClient _queueClient; public QueueTests(string accountName, string accountKey) { _queueClient = new QueueClient(new CloudStorageAccount(accountName, accountKey)); } public void Run() { var testRun = Guid.NewGuid().ToString().Replace("-", "");//your tablename goes here! CreateQueue(testRun); CreateQueueMessage(testRun, "Skynet is READY"); var peeked = PeekQueueMessage(testRun); Debug.Print(peeked.MessageId); var message = RetrieveQueueMessage(testRun); Debug.Print(message.MessageId); Debug.Assert(peeked.MessageId == message.MessageId); DeleteQueueMessage(testRun, message.MessageId, message.PopReceipt); DeleteQueue(testRun); } private QueueMessageWrapper PeekQueueMessage(string queueName) { return _queueClient.PeekQueueMessage(queueName); } private void DeleteQueue(string queueName) { _queueClient.DeleteQueue(queueName); } private void DeleteQueueMessage(string queueName, string messageId, string popReceipt) { _queueClient.DeleteMessage(queueName, messageId, popReceipt); } private QueueMessageWrapper RetrieveQueueMessage(string queueName) { var message = _queueClient.RetrieveQueueMessage(queueName); Debug.Print(message.Message); return message; } private void CreateQueue(string queueName) { _queueClient.CreateQueue(queueName); } private void CreateQueueMessage(string queueName, string messageBody) { _queueClient.CreateQueueMessage(queueName, messageBody); } } }
using System; using Microsoft.SPOT; using NetMf.CommonExtensions; using netmfazurestorage.Account; using netmfazurestorage.Queue; namespace netmfazurestorage.Tests { public class QueueTests { private QueueClient _queueClient; public QueueTests(string accountName, string accountKey) { _queueClient = new QueueClient(new CloudStorageAccount(accountName, accountKey)); } public void Run() { var testRun = Guid.NewGuid().ToString().Replace("-", "");//your tablename goes here! CreateQueue(testRun); CreateQueueMessage(testRun, "Skynet is READY"); var peeked = PeekQueueMessage(testRun); var message = RetrieveQueueMessage(testRun); DeleteQueueMessage(testRun, message.MessageId, message.PopReceipt); DeleteQueue(testRun); } private QueueMessageWrapper PeekQueueMessage(string queueName) { return _queueClient.PeekQueueMessage(queueName); } private void DeleteQueue(string queueName) { _queueClient.DeleteQueue(queueName); } private void DeleteQueueMessage(string queueName, string messageId, string popReceipt) { _queueClient.DeleteMessage(queueName, messageId, popReceipt); } private QueueMessageWrapper RetrieveQueueMessage(string queueName) { var message = _queueClient.RetrieveQueueMessage(queueName); Debug.Print(message.Message); return message; } private void CreateQueue(string queueName) { _queueClient.CreateQueue(queueName); } private void CreateQueueMessage(string queueName, string messageBody) { _queueClient.CreateQueueMessage(queueName, messageBody); } } }
apache-2.0
C#
f25ea9fe0ef80f547136df434e1ff8d1dde76432
Set neutral language to English
freenet/wintray,freenet/wintray
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Resources; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("FreenetTray")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("FreenetTray")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("220ea49e-e109-4bb4-86c6-ef477f1584e7")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: NeutralResourcesLanguageAttribute("en")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("FreenetTray")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("FreenetTray")] [assembly: AssemblyCopyright("Copyright © 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("220ea49e-e109-4bb4-86c6-ef477f1584e7")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
615fe0e6b6f4c087fe89a168601d3d5fb004f178
Add function to get start of season
MoyTW/MTW_AncestorSpirits
Source/MTW_AncestorSpirits/AncestorUtils.cs
Source/MTW_AncestorSpirits/AncestorUtils.cs
using Verse; using RimWorld; using UnityEngine; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MTW_AncestorSpirits { public static class AncestorUtils { public static int DaysToTicks(float days) { return Mathf.RoundToInt(days * GenDate.TicksPerDay); } public static int HoursToTicks(float hours) { return Mathf.RoundToInt(hours * GenDate.TicksPerHour); } public static long EstStartOfSeasonAt(long ticks) { var currentDayTicks = (int)(GenDate.CurrentDayPercent * GenDate.TicksPerDay); var dayOfSeason = GenDate.DayOfSeasonZeroBasedAt(ticks); var currentSeasonDayTicks = DaysToTicks(dayOfSeason); return ticks - currentDayTicks - currentSeasonDayTicks; } } }
using RimWorld; using UnityEngine; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MTW_AncestorSpirits { public static class AncestorUtils { public static int DaysToTicks(float days) { return Mathf.RoundToInt(days * GenDate.TicksPerDay); } public static int HoursToTicks(float hours) { return Mathf.RoundToInt(hours * GenDate.TicksPerHour); } } }
mit
C#
c990ce4154913172aba04df8b2f810b502f3e7b1
Change event count type
bwatts/Totem,bwatts/Totem
Source/Totem.Runtime/Timeline/ResumeInfo.cs
Source/Totem.Runtime/Timeline/ResumeInfo.cs
using System; using System.Collections; using System.Collections.Generic; using System.Linq; namespace Totem.Runtime.Timeline { /// <summary> /// A series of points with which to resume the timeline /// </summary> public class ResumeInfo : Notion, IEnumerable<ResumeInfo.Batch> { readonly IEnumerable<Batch> _batches; public ResumeInfo() { Flows = new Many<Flow>(); _batches = Enumerable.Empty<Batch>(); } public ResumeInfo(Many<Flow> flows, int eventCount, IEnumerable<Batch> batches) { Flows = flows; EventCount = eventCount; _batches = batches; } public readonly Many<Flow> Flows; public readonly int EventCount; public IEnumerator<Batch> GetEnumerator() => _batches.GetEnumerator(); IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); /// <summary> /// The set of flows with which to resume the timeline /// </summary> public class Flow { public Flow(FlowKey key, TimelinePosition checkpoint) { Key = key; Checkpoint = checkpoint; } public readonly FlowKey Key; public readonly TimelinePosition Checkpoint; } /// <summary> /// A batch of points with which to resume the timeline /// </summary> public class Batch { public Batch(Many<Point> points) { Points = points; HasPoints = points.Any(); if(HasPoints) { FirstPosition = Points.First().Message.Point.Position; LastPosition = Points.Last().Message.Point.Position; } } public readonly Many<Point> Points; public readonly bool HasPoints; public readonly TimelinePosition FirstPosition; public readonly TimelinePosition LastPosition; } /// <summary> /// A point with which to resume the timeline /// </summary> public class Point { public Point(TimelineMessage message, bool onSchedule) { Message = message; OnSchedule = onSchedule; } public readonly TimelineMessage Message; public readonly bool OnSchedule; public override string ToString() => Message.Point.ToString(); } } }
using System; using System.Collections; using System.Collections.Generic; using System.Linq; namespace Totem.Runtime.Timeline { /// <summary> /// A series of points with which to resume the timeline /// </summary> public class ResumeInfo : Notion, IEnumerable<ResumeInfo.Batch> { readonly IEnumerable<Batch> _batches; public ResumeInfo() { Flows = new Many<Flow>(); _batches = Enumerable.Empty<Batch>(); } public ResumeInfo(Many<Flow> flows, long eventCount, IEnumerable<Batch> batches) { Flows = flows; EventCount = eventCount; _batches = batches; } public readonly Many<Flow> Flows; public readonly long EventCount; public IEnumerator<Batch> GetEnumerator() => _batches.GetEnumerator(); IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); /// <summary> /// The set of flows with which to resume the timeline /// </summary> public class Flow { public Flow(FlowKey key, TimelinePosition checkpoint) { Key = key; Checkpoint = checkpoint; } public readonly FlowKey Key; public readonly TimelinePosition Checkpoint; } /// <summary> /// A batch of points with which to resume the timeline /// </summary> public class Batch { public Batch(Many<Point> points) { Points = points; HasPoints = points.Any(); if(HasPoints) { FirstPosition = Points.First().Message.Point.Position; LastPosition = Points.Last().Message.Point.Position; } } public readonly Many<Point> Points; public readonly bool HasPoints; public readonly TimelinePosition FirstPosition; public readonly TimelinePosition LastPosition; } /// <summary> /// A point with which to resume the timeline /// </summary> public class Point { public Point(TimelineMessage message, bool onSchedule) { Message = message; OnSchedule = onSchedule; } public readonly TimelineMessage Message; public readonly bool OnSchedule; public override string ToString() => Message.Point.ToString(); } } }
mit
C#
a5c7ef9debba0817c99f7c297c01118ab7a02e6e
Fix menu button backend invoke
akrisiun/xwt,sevoku/xwt,cra0zy/xwt,hamekoz/xwt,TheBrainTech/xwt,antmicro/xwt,mminns/xwt,lytico/xwt,directhex/xwt,hwthomas/xwt,mono/xwt,steffenWi/xwt,mminns/xwt,residuum/xwt,iainx/xwt
Xwt.WPF/Xwt.WPFBackend/MenuButtonBackend.cs
Xwt.WPF/Xwt.WPFBackend/MenuButtonBackend.cs
// // MenuButtonBackend.cs // // Author: // Eric Maupin <[email protected]> // // Copyright (c) 2012 Xamarin, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using Xwt.Backends; using Xwt.Engine; namespace Xwt.WPFBackend { public class MenuButtonBackend : ButtonBackend, IMenuButtonBackend { public MenuButtonBackend() : base (new DropDownButton()) { DropDownButton.MenuOpening += OnMenuOpening; } protected DropDownButton DropDownButton { get { return (DropDownButton) Button; } } protected IMenuButtonEventSink MenuButtonEventSink { get { return (IMenuButtonEventSink) EventSink; } } private void OnMenuOpening (object sender, DropDownButton.MenuOpeningEventArgs e) { Toolkit.Invoke (() => e.ContextMenu = ((MenuBackend) MenuButtonEventSink.OnCreateMenu ()).CreateContextMenu ()); } } }
// // MenuButtonBackend.cs // // Author: // Eric Maupin <[email protected]> // // Copyright (c) 2012 Xamarin, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using Xwt.Backends; namespace Xwt.WPFBackend { public class MenuButtonBackend : ButtonBackend, IMenuButtonBackend { public MenuButtonBackend() : base (new DropDownButton()) { DropDownButton.MenuOpening += OnMenuOpening; } protected DropDownButton DropDownButton { get { return (DropDownButton) Button; } } protected IMenuButtonEventSink MenuButtonEventSink { get { return (IMenuButtonEventSink) EventSink; } } private void OnMenuOpening (object sender, DropDownButton.MenuOpeningEventArgs e) { e.ContextMenu = ((MenuBackend) MenuButtonEventSink.OnCreateMenu ()).CreateContextMenu (); } } }
mit
C#
d4326edca7061d1b78ea046bd778e3da027a1061
Change dominant animation
Endure-Game/Endure
Assets/Scripts/PlayerController.cs
Assets/Scripts/PlayerController.cs
using UnityEngine; using System.Collections; public class PlayerController : MonoBehaviour { public float speed = 4; public static PlayerController instance; private int counter = 0; private Rigidbody2D rb2d; private Animator animator; // Use this for initialization void Start () { this.rb2d = this.GetComponent<Rigidbody2D> (); this.animator = this.GetComponent<Animator> (); } // Update is called once per frame void Update () { float horizontal = Input.GetAxisRaw ("Horizontal"); float vertical = Input.GetAxisRaw ("Vertical"); // this.transform.Translate (horizontal, vertical, 0); this.rb2d.velocity = this.speed * new Vector2 (horizontal, vertical); if (horizontal > 0) { this.animator.SetInteger ("Direction", 3); } else if (horizontal < 0) { this.animator.SetInteger ("Direction", 1); } else if (vertical > 0) { this.animator.SetInteger ("Direction", 2); } else if (vertical < 0) { this.animator.SetInteger ("Direction", 0); } print (this.animator.GetInteger ("Direction")); } //called before start void Awake () { if (PlayerController.instance == null) { PlayerController.instance = this; } } public void IncrementCounter () { this.counter ++; print (this.counter); } }
using UnityEngine; using System.Collections; public class PlayerController : MonoBehaviour { public float speed = 4; public static PlayerController instance; private int counter = 0; private Rigidbody2D rb2d; private Animator animator; // Use this for initialization void Start () { this.rb2d = this.GetComponent<Rigidbody2D> (); this.animator = this.GetComponent<Animator> (); } // Update is called once per frame void Update () { float horizontal = Input.GetAxisRaw ("Horizontal"); float vertical = Input.GetAxisRaw ("Vertical"); // this.transform.Translate (horizontal, vertical, 0); this.rb2d.velocity = this.speed * new Vector2 (horizontal, vertical); if (vertical > 0) { this.animator.SetInteger ("Direction", 2); } else if (vertical < 0) { this.animator.SetInteger ("Direction", 0); } else if (horizontal > 0) { this.animator.SetInteger ("Direction", 3); } else if (horizontal < 0) { this.animator.SetInteger ("Direction", 1); } print (this.animator.GetInteger ("Direction")); } //called before start void Awake () { if (PlayerController.instance == null) { PlayerController.instance = this; } } public void IncrementCounter () { this.counter ++; print (this.counter); } }
mit
C#
ef0190d218db34f39e0104a6516590ede5188ea9
add GC.Collect() call
Deliay/osuSync,Deliay/Sync
Sync/Program.cs
Sync/Program.cs
using Sync.Command; using Sync.MessageFilter; using Sync.Plugins; using Sync.Source; using Sync.Tools; using System; using System.Diagnostics; using static Sync.Tools.IO; namespace Sync { static class Program { public static SyncHost host; static void Sync() { using (host = new SyncHost()) { host.Load(); CurrentIO.WriteConfig(); CurrentIO.WriteWelcome(); string cmd = CurrentIO.ReadCommand(); while (true) { if (cmd == "restart") return; host.Commands.invokeCmdString(cmd); cmd = CurrentIO.ReadCommand(); } } } static void Main(string[] args) { /* 程序工作流程: * 1.程序枚举所有插件,保存所有IPlugin到List中 * 2.程序整理出所有的List<ISourceBase> * 3.初始化Sync类,Sync类检测配置文件,用正确的类初始化SyncInstance * 4.程序IO Manager开始工作,等待用户输入 */ while(true) { Sync(); GC.Collect(); } } } }
using Sync.Command; using Sync.MessageFilter; using Sync.Plugins; using Sync.Source; using Sync.Tools; using System; using System.Diagnostics; using static Sync.Tools.IO; namespace Sync { static class Program { public static SyncHost host; static void Main(string[] args) { /* 程序工作流程: * 1.程序枚举所有插件,保存所有IPlugin到List中 * 2.程序整理出所有的List<ISourceBase> * 3.初始化Sync类,Sync类检测配置文件,用正确的类初始化SyncInstance * 4.程序CLI Manager开始工作,等待用户输入 */ host = new SyncHost(); host.Load(); CurrentIO.WriteConfig(); CurrentIO.WriteWelcome(); while (true) { host.Commands.invokeCmdString(CurrentIO.ReadCommand()); } } } }
mit
C#
71589ce81b63ba260e33fb7ee919e40c42509ddd
Support debugging executing addin if config flag IsDebug enabled
NickRusinov/CodeContracts.Fody
CodeContracts.Fody/ModuleWeaver.cs
CodeContracts.Fody/ModuleWeaver.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.Contracts; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Linq; using CodeContracts.Fody.Configurations; using Mono.Cecil; using TinyIoC; using static System.StringComparer; namespace CodeContracts.Fody { /// <summary> /// Fody weaver addin for representation code contracts as custom attributes /// </summary> public class ModuleWeaver { /// <summary> /// An instance of Mono.Cecil.ModuleDefinition for processing /// </summary> public ModuleDefinition ModuleDefinition { get; set; } /// <summary> /// Contain the full element XML from FodyWeavers.xml /// </summary> public XElement Config { get; set; } /// <summary> /// Log an MessageImportance.Normal message to MSBuild /// </summary> public Action<string> LogDebug { get; set; } /// <summary> /// Log an MessageImportance.High message to MSBuild /// </summary> public Action<string> LogInfo { get; set; } /// <summary> /// Log an warning message to MSBuild /// </summary> public Action<string> LogWarning { get; set; } /// <summary> /// Log an error message to MSBuild /// </summary> public Action<string> LogError { get; set; } /// <summary> /// Will be called when an assembly will be processing /// </summary> public void Execute() { Contract.Requires(ModuleDefinition != null); Contract.Requires(Config != null); Contract.Requires(LogDebug != null); Contract.Requires(LogInfo != null); Contract.Requires(LogWarning != null); Contract.Requires(LogError != null); #if DEBUG if (OrdinalIgnoreCase.Equals(Config.Attribute("IsDebug")?.Value, bool.TrueString) && !Debugger.IsAttached) Debugger.Launch(); #endif new TinyIoCConfiguration().Configure(this); new LoggerConfiguration().Configure(this); TinyIoCContainer.Current.Resolve<ContractExecutor>().Execute(ModuleDefinition); } } }
using System; using System.Collections.Generic; using System.Diagnostics.Contracts; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Xml.Linq; using CodeContracts.Fody.Configurations; using Mono.Cecil; using TinyIoC; namespace CodeContracts.Fody { /// <summary> /// Fody weaver addin for representation code contracts as custom attributes /// </summary> public class ModuleWeaver { /// <summary> /// An instance of Mono.Cecil.ModuleDefinition for processing /// </summary> public ModuleDefinition ModuleDefinition { get; set; } /// <summary> /// Contain the full element XML from FodyWeavers.xml /// </summary> public XElement Config { get; set; } /// <summary> /// Log an MessageImportance.Normal message to MSBuild /// </summary> public Action<string> LogDebug { get; set; } /// <summary> /// Log an MessageImportance.High message to MSBuild /// </summary> public Action<string> LogInfo { get; set; } /// <summary> /// Log an warning message to MSBuild /// </summary> public Action<string> LogWarning { get; set; } /// <summary> /// Log an error message to MSBuild /// </summary> public Action<string> LogError { get; set; } /// <summary> /// Will be called when an assembly will be processing /// </summary> public void Execute() { Contract.Requires(ModuleDefinition != null); Contract.Requires(Config != null); Contract.Requires(LogDebug != null); Contract.Requires(LogInfo != null); Contract.Requires(LogWarning != null); Contract.Requires(LogError != null); new TinyIoCConfiguration().Configure(this); new LoggerConfiguration().Configure(this); TinyIoCContainer.Current.Resolve<ContractExecutor>().Execute(ModuleDefinition); } } }
mit
C#
cedd703faad81a8462b3e4353a1545de8fe01a49
Fix TryReadProblemJson: ensure problem json could be read and an object was created
bluehands/WebApiHypermediaExtensions,bluehands/WebApiHypermediaExtensions
Source/Hypermedia.Client/Reader/ProblemJson/ProblemJsonReader.cs
Source/Hypermedia.Client/Reader/ProblemJson/ProblemJsonReader.cs
namespace Hypermedia.Client.Reader.ProblemJson { using System; using System.Net.Http; using global::Hypermedia.Client.Exceptions; using global::Hypermedia.Client.Resolver; using Newtonsoft.Json; public static class ProblemJsonReader { public static bool TryReadProblemJson(HttpResponseMessage result, out ProblemDescription problemDescription) { problemDescription = null; if (result.Content == null) { return false; } try { var content = result.Content.ReadAsStringAsync().Result; problemDescription = JsonConvert.DeserializeObject<ProblemDescription>(content); // TODO inject deserializer } catch (Exception) { return false; } return problemDescription != null; } } }
namespace Hypermedia.Client.Reader.ProblemJson { using System; using System.Net.Http; using global::Hypermedia.Client.Exceptions; using global::Hypermedia.Client.Resolver; using Newtonsoft.Json; public static class ProblemJsonReader { public static bool TryReadProblemJson(HttpResponseMessage result, out ProblemDescription problemDescription) { problemDescription = null; if (result.Content == null) { return false; } try { var content = result.Content.ReadAsStringAsync().Result; problemDescription = JsonConvert.DeserializeObject<ProblemDescription>(content); // TODO inject deserializer } catch (Exception) { return false; } return true; } } }
mit
C#
b0ac65e9fa4d3b0461b9a104afad121f615cad12
Remove unused projectiles array and cleaner bullet transform instantiation
ratenbuuren/ProjectBeard,ratenbuuren/ProjectBeard,ratenbuuren/ProjectBeard
Assets/Scripts/TankController.cs
Assets/Scripts/TankController.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; public class TankController : MonoBehaviour { public GameObject projectilePrefab; private Rigidbody2D rigidbody2D; public float power = 3; public float turnpower = 2; public float friction = 3; void Start() { rigidbody2D = GetComponent<Rigidbody2D> (); } void FixedUpdate() { float moveHorizontal = Input.GetAxis ("Horizontal"); float moveVertical = Input.GetAxis ("Vertical"); if (moveVertical != 0.0f) { if (moveVertical > 0) { rigidbody2D.AddForce(transform.up * power * moveVertical); } else { // Backwards is slower than forwards. rigidbody2D.AddForce(transform.up * (power/2) * moveVertical); } rigidbody2D.drag = friction; } else { // No gas means high drag. rigidbody2D.drag = friction * 4; } transform.Rotate(Vector3.forward * turnpower * -moveHorizontal); } void Update() { if (Input.GetButtonDown ("Fire1") || Input.GetKeyDown (KeyCode.Space)) { GameObject bullet = (GameObject)Instantiate (projectilePrefab, transform.Find("Barrel").Find("BulletOrigin").position, Quaternion.identity); Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition); mousePos = new Vector3(mousePos.x, mousePos.y, 0); //Rotate the sprite to the mouse point Vector3 diff = mousePos - bullet.transform.position; diff.Normalize(); float rot_z = Mathf.Atan2(diff.y, diff.x) * Mathf.Rad2Deg; bullet.transform.rotation = Quaternion.Euler(0f, 0f, rot_z - 90); } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; public class TankController : MonoBehaviour { public GameObject projectilePrefab; private Rigidbody2D rigidbody2D; private List<GameObject> projectiles = new List<GameObject> (); public float power = 3; public float turnpower = 2; public float friction = 3; void Start() { rigidbody2D = GetComponent<Rigidbody2D> (); } void FixedUpdate() { float moveHorizontal = Input.GetAxis ("Horizontal"); float moveVertical = Input.GetAxis ("Vertical"); if (moveVertical != 0.0f) { if (moveVertical > 0) { rigidbody2D.AddForce(transform.up * power * moveVertical); } else { // Backwards is slower than forwards. rigidbody2D.AddForce(transform.up * (power/2) * moveVertical); } rigidbody2D.drag = friction; } else { // No gas means high drag. rigidbody2D.drag = friction * 4; } transform.Rotate(Vector3.forward * turnpower * -moveHorizontal); } void Update() { if (Input.GetButtonDown ("Fire1") || Input.GetKeyDown (KeyCode.Space)) { GameObject bullet = (GameObject)Instantiate (projectilePrefab, transform.GetChild(0).gameObject.transform.GetChild(0).gameObject.transform.position, Quaternion.identity); Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition); mousePos = new Vector3(mousePos.x, mousePos.y, 0); //Rotate the sprite to the mouse point Vector3 diff = mousePos - bullet.transform.position; diff.Normalize(); float rot_z = Mathf.Atan2(diff.y, diff.x) * Mathf.Rad2Deg; bullet.transform.rotation = Quaternion.Euler(0f, 0f, rot_z - 90); projectiles.Add (bullet); } } }
mit
C#
e04cac556c568d7b94d9102a0dc9b5c274f3503c
fix rendering script
NataliaDSmirnova/CGAdvanced2017
Assets/Scripts/RenderObject.cs
Assets/Scripts/RenderObject.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class RenderObject : MonoBehaviour { // input object public GameObject renderObject; public Camera mainCamera; // private variables private RenderTexture renderTexture; private RawImage image; void Start () { // get raw image from scene (see RTSprite) image = GetComponent<RawImage>(); // create temprorary texture of screen size renderTexture = RenderTexture.GetTemporary(Screen.width, Screen.height); } void OnRenderObject () { // set our temprorary texture as target for rendering Graphics.SetRenderTarget(renderTexture); // get mesh and meshRenderer from input object Mesh objectMesh = renderObject.GetComponent<MeshFilter>().sharedMesh; var renderer = renderObject.GetComponent<MeshRenderer>(); // activate first shader pass for our renderer renderer.material.SetPass(0); // draw mesh of input object to render texture Graphics.DrawMeshNow(objectMesh, renderObject.transform.localToWorldMatrix * mainCamera.worldToCameraMatrix * mainCamera.projectionMatrix); // set texture of raw image equals to our render texture image.texture = renderTexture; // render again to backbuffer Graphics.SetRenderTarget(null); } }
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class RenderObject : MonoBehaviour { // input object public GameObject renderObject; public Camera mainCamera; // private variables private RenderTexture renderTexture; private RawImage image; void Start () { // get raw image from scene (see RTSprite) image = GetComponent<RawImage>(); } void Update () { // create temprorary texture of screen size renderTexture = RenderTexture.GetTemporary(Screen.width, Screen.height); // set our temprorary texture as target for rendering Graphics.SetRenderTarget(renderTexture); // get mesh and meshRenderer from input object Mesh objectMesh = renderObject.GetComponent<MeshFilter>().sharedMesh; var renderer = renderObject.GetComponent<MeshRenderer>(); // activate first shader pass for our renderer renderer.material.SetPass(0); // render from camera to texture // mainCamera.targetTexture = renderTexture; // mainCamera.Render(); // draw mesh of input object to render texture Graphics.DrawMeshNow(objectMesh, renderer.localToWorldMatrix * mainCamera.worldToCameraMatrix * mainCamera.projectionMatrix); // set texture of raw image equals to our render texture image.texture = renderTexture; //mainCamera.targetTexture = null; // render again to backbuffer Graphics.SetRenderTarget(null); // release texture RenderTexture.ReleaseTemporary(renderTexture); } }
mit
C#
d7d786f60c4490ddc72ca4ad0ad67cb3fa51a98c
Add error message on exception
pleonex/deblocus,pleonex/deblocus
Deblocus/Program.cs
Deblocus/Program.cs
// // Program.cs // // Author: // Benito Palacios Sánchez (aka pleonex) <[email protected]> // // Copyright (c) 2015 Benito Palacios Sánchez (c) 2015 // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. using System; using Xwt; using Deblocus.Views; namespace Deblocus { public static class Program { [STAThread] public static void Main() { Application.Initialize(ToolkitType.Gtk); Application.UnhandledException += ApplicationException; var mainWindow = new MainWindow(); mainWindow.Show(); Application.Run(); mainWindow.Dispose(); Application.Dispose(); } private static void ApplicationException (object sender, ExceptionEventArgs e) { MessageDialog.ShowError("Unknown error. Please contact with the developer.\n" + e.ErrorException); } } }
// // Program.cs // // Author: // Benito Palacios Sánchez (aka pleonex) <[email protected]> // // Copyright (c) 2015 Benito Palacios Sánchez (c) 2015 // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. using System; using Xwt; using Deblocus.Views; namespace Deblocus { public static class Program { [STAThread] public static void Main() { Application.Initialize(ToolkitType.Gtk); var mainWindow = new MainWindow(); mainWindow.Show(); Application.Run(); mainWindow.Dispose(); Application.Dispose(); } } }
agpl-3.0
C#
63634de49847d958797636a59529df225ffc0abb
Use NuGetFramework API
NuGetPackageExplorer/NuGetPackageExplorer,NuGetPackageExplorer/NuGetPackageExplorer
Core/Packages/PackageFileBase.cs
Core/Packages/PackageFileBase.cs
using System; using System.Collections.Generic; using System.IO; using System.Runtime.Versioning; using NuGet.Frameworks; using NuGet.Packaging; namespace NuGetPe { public abstract class PackageFileBase : IPackageFile { protected PackageFileBase(string path) { Path = path; try { var nuf = FrameworkNameUtility.ParseNuGetFrameworkFromFilePath(path, out var effectivePath); EffectivePath = effectivePath; NuGetFramework = nuf; if(nuf != null) { TargetFramework = new FrameworkName(NuGetFramework.DotNetFrameworkName); } } catch (ArgumentException) // could be an invalid framework/version { } } public string Path { get; private set; } public virtual string? OriginalPath { get { return null; } } public abstract Stream GetStream(); public string EffectivePath { get; private set; } public FrameworkName? TargetFramework { get; } public NuGetFramework? NuGetFramework { get; } public IEnumerable<NuGetFramework> SupportedFrameworks { get { if (NuGetFramework != null) { yield return NuGetFramework; } yield break; } } public virtual DateTimeOffset LastWriteTime { get; } = DateTimeOffset.MinValue; } }
using System; using System.Collections.Generic; using System.IO; using System.Runtime.Versioning; using NuGet.Frameworks; using NuGet.Packaging; namespace NuGetPe { public abstract class PackageFileBase : IPackageFile { protected PackageFileBase(string path) { Path = path; FrameworkNameUtility.ParseFrameworkNameFromFilePath(path, out var effectivePath); EffectivePath = effectivePath; try { NuGetFramework = NuGetFramework.Parse(effectivePath); TargetFramework = new FrameworkName(NuGetFramework.DotNetFrameworkName); } catch (ArgumentException) // could be an invalid framework/version { } } public string Path { get; private set; } public virtual string? OriginalPath { get { return null; } } public abstract Stream GetStream(); public string EffectivePath { get; private set; } public FrameworkName? TargetFramework { get; } public NuGetFramework? NuGetFramework { get; } public IEnumerable<NuGetFramework> SupportedFrameworks { get { if (NuGetFramework != null) { yield return NuGetFramework; } yield break; } } public virtual DateTimeOffset LastWriteTime { get; } = DateTimeOffset.MinValue; } }
mit
C#
0b35695dbd935dcb924527283edcd0ca8e3db7f9
Order response from most swears to least
mmbot/mmbot.scripts
scripts/Fun/Swearjar.csx
scripts/Fun/Swearjar.csx
/** * <description> * Monitors for swearing * </description> * * <configuration> * * </configuration> * * <commands> * mmbot swearjar - shows the swear stats of users * </commands> * * <author> * dkarzon * </author> */ var robot = Require<Robot>(); robot.Respond("swearjar", msg => { var swearBrain = robot.Brain.Get<List<SwearUser>>("swearbot").Result ?? new List<SwearUser>(); foreach (var s in swearBrain..OrderByDescending(s => (s.Swears ?? new List<SwearStat>()).Count)) { if (s.Swears == null) continue; msg.Send(string.Format("{0} has sworn {1} times!", s.User, s.Swears.Count)); } }); robot.Hear(@".*\b(fuck|shit|cock|crap|bitch|cunt|asshole|dick)(s)?(ed)?(ing)?(\b|\s|$)", (msg) => { //Someone said a swear! var theSwear = msg.Match[1]; var userName = msg.Message.User.Name; //load the swears from the Brain var swearBrain = robot.Brain.Get<List<SwearUser>>("swearbot").Result ?? new List<SwearUser>(); var swearUser = swearBrain.FirstOrDefault(s => s.User == userName); if (swearUser == null) { swearUser = new SwearUser { User = userName }; swearBrain.Add(swearUser); } if (swearUser.Swears == null) { swearUser.Swears = new List<SwearStat>(); } swearUser.Swears.Add(new SwearStat{Swear = theSwear, Date = DateTime.Now}); robot.Brain.Set("swearbot", swearBrain); msg.Send("SWEAR JAR!"); }); public class SwearStat { public string Swear { get; set; } public DateTime Date { get; set; } } public class SwearUser { public string User { get; set; } public List<SwearStat> Swears { get; set; } }
/** * <description> * Monitors for swearing * </description> * * <configuration> * * </configuration> * * <commands> * mmbot swearjar - shows the swear stats of users * </commands> * * <author> * dkarzon * </author> */ var robot = Require<Robot>(); robot.Respond("swearjar", msg => { var swearBrain = robot.Brain.Get<List<SwearUser>>("swearbot").Result ?? new List<SwearUser>(); foreach (var s in swearBrain) { if (s.Swears == null) continue; msg.Send(string.Format("{0} has sworn {1} times!", s.User, s.Swears.Count)); } }); robot.Hear(@".*\b(fuck|shit|cock|crap|bitch|cunt|asshole|dick)(s)?(ed)?(ing)?(\b|\s|$)", (msg) => { //Someone said a swear! var theSwear = msg.Match[1]; var userName = msg.Message.User.Name; //load the swears from the Brain var swearBrain = robot.Brain.Get<List<SwearUser>>("swearbot").Result ?? new List<SwearUser>(); var swearUser = swearBrain.FirstOrDefault(s => s.User == userName); if (swearUser == null) { swearUser = new SwearUser { User = userName }; swearBrain.Add(swearUser); } if (swearUser.Swears == null) { swearUser.Swears = new List<SwearStat>(); } swearUser.Swears.Add(new SwearStat{Swear = theSwear, Date = DateTime.Now}); robot.Brain.Set("swearbot", swearBrain); msg.Send("SWEAR JAR!"); }); public class SwearStat { public string Swear { get; set; } public DateTime Date { get; set; } } public class SwearUser { public string User { get; set; } public List<SwearStat> Swears { get; set; } }
apache-2.0
C#
59d7e68fd9a8950b5ad99ceb2c2126af3bf75f4c
Bump version to 2.0.1
Codesleuth/esendex-dotnet-sdk
source/Properties/AssemblyInfo.cs
source/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Esendex .NET SDK")] [assembly: AssemblyDescription("Esendex API .NET SDK")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Esendex")] [assembly: AssemblyProduct("Esendex .NET SDK")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("d126b446-acab-4d9b-8429-a8d8fd6943d3")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.0.1")] [assembly: AssemblyFileVersion("2.0.1")] [assembly: InternalsVisibleTo("com.esendex.sdk.test")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Esendex .NET SDK")] [assembly: AssemblyDescription("Esendex API .NET SDK")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Esendex")] [assembly: AssemblyProduct("Esendex .NET SDK")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("d126b446-acab-4d9b-8429-a8d8fd6943d3")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("2.0.0")] [assembly: AssemblyFileVersion("2.0.0")] [assembly: InternalsVisibleTo("com.esendex.sdk.test")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
bsd-3-clause
C#
54270536e827f2924c5558ba08ff120c2ba45e32
remove unused code
kreeben/resin,kreeben/resin
src/Sir.Store/Hit.cs
src/Sir.Store/Hit.cs
using System.Collections.Generic; using System.Linq; namespace Sir.Store { public class Hit { public SortedList<int, byte> Embedding { get; set; } public float Score { get; set; } public IList<long> PostingsOffsets { get; set; } public long NodeId { get; set; } public IEnumerable<long> Ids { get; set; } public override string ToString() { return string.Join(string.Empty, Embedding.Keys.Select(x => char.ConvertFromUtf32(x)).ToArray()); } } }
using System.Collections.Generic; using System.Linq; namespace Sir.Store { public class Hit { public SortedList<int, byte> Embedding { get; set; } public float Score { get; set; } public IList<long> PostingsOffsets { get; set; } public long NodeId { get; set; } public IEnumerable<long> Ids { get; set; } public override string ToString() { return string.Join(string.Empty, Embedding.Keys.Select(x => char.ConvertFromUtf32(x)).ToArray()); } public Hit Copy() { return new Hit { Embedding = Embedding, Score = Score, NodeId = NodeId, Ids = Ids }; } } }
mit
C#
79805c98f897711b74390281e74d26fc47bf9971
Remove white lines
Seddryck/NBi,Seddryck/NBi
NBi.Xml/Constraints/ExistsXml.cs
NBi.Xml/Constraints/ExistsXml.cs
using System.Xml.Serialization; namespace NBi.Xml.Constraints { public class ExistsXml : AbstractConstraintXml { [XmlAttribute("ignore-case")] public bool IgnoreCase { get; set; } } }
using System.Xml.Serialization; namespace NBi.Xml.Constraints { public class ExistsXml : AbstractConstraintXml { [XmlAttribute("ignore-case")] public bool IgnoreCase { get; set; } } }
apache-2.0
C#
199300be1d7b565ea174562ff778fa7d46837ae7
Increase client version to 1.4.2.3
jvalladolid/recurly-client-net
Library/Properties/AssemblyInfo.cs
Library/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Recurly Client Library")] [assembly: AssemblyDescription("Recurly makes subscription billing easy for .NET developers.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Recurly, Inc.")] [assembly: AssemblyProduct("Recurly")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("25932cc0-45c7-4db4-b8d5-dd172555522c")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.4.2.3")] [assembly: AssemblyFileVersion("1.4.2.3")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Recurly Client Library")] [assembly: AssemblyDescription("Recurly makes subscription billing easy for .NET developers.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Recurly, Inc.")] [assembly: AssemblyProduct("Recurly")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("25932cc0-45c7-4db4-b8d5-dd172555522c")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.4.2.2")] [assembly: AssemblyFileVersion("1.4.2.2")]
mit
C#
d7d3c4f4923bdb181a48dd001be0a6cb26926d15
prepare for 1.3.0 release
yagyemang/im-only-resting,krishnarajnairmk/im-only-resting,krishnarajnairmk/im-only-resting,yagyemang/im-only-resting,yhtsnda/im-only-resting,yagyemang/im-only-resting,krishnarajnairmk/im-only-resting,ikazuaki/im-only-resting,yhtsnda/im-only-resting,yhtsnda/im-only-resting,ikazuaki/im-only-resting,ikazuaki/im-only-resting
Ior/Properties/AssemblyInfo.cs
Ior/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("I'm Only Resting")] [assembly: AssemblyDescription("http://www.swensensoftware.com/im-only-resting")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("I'm Only Resting")] [assembly: AssemblyCopyright("Copyright © Swensen Software 2012 - 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("42d77ebc-de54-4916-b931-de852d2bacff")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.3.0.*")] [assembly: AssemblyFileVersion("1.3.0.*")]
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("I'm Only Resting")] [assembly: AssemblyDescription("http://www.swensensoftware.com/im-only-resting")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("I'm Only Resting")] [assembly: AssemblyCopyright("Copyright © Swensen Software 2012 - 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("42d77ebc-de54-4916-b931-de852d2bacff")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.2.0.*")] [assembly: AssemblyFileVersion("1.2.0.*")]
apache-2.0
C#
88e66860a6c3131f0a012e5f3a9fa80ca3c55ff1
update command sample to use CommandExecuted, Log
RogueException/Discord.Net,AntiTcb/Discord.Net
samples/02_commands_framework/Services/CommandHandlingService.cs
samples/02_commands_framework/Services/CommandHandlingService.cs
using System; using System.Reflection; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Discord; using Discord.Commands; using Discord.WebSocket; namespace _02_commands_framework.Services { public class CommandHandlingService { private readonly CommandService _commands; private readonly DiscordSocketClient _discord; private readonly IServiceProvider _services; public CommandHandlingService(IServiceProvider services) { _commands = services.GetRequiredService<CommandService>(); _discord = services.GetRequiredService<DiscordSocketClient>(); _services = services; _commands.CommandExecuted += CommandExecutedAsync; _commands.Log += LogAsync; _discord.MessageReceived += MessageReceivedAsync; } public async Task InitializeAsync() { await _commands.AddModulesAsync(Assembly.GetEntryAssembly(), _services); } public async Task MessageReceivedAsync(SocketMessage rawMessage) { // Ignore system messages, or messages from other bots if (!(rawMessage is SocketUserMessage message)) return; if (message.Source != MessageSource.User) return; // This value holds the offset where the prefix ends var argPos = 0; if (!message.HasMentionPrefix(_discord.CurrentUser, ref argPos)) return; var context = new SocketCommandContext(_discord, message); await _commands.ExecuteAsync(context, argPos, _services); // we will handle the result in CommandExecutedAsync } public async Task CommandExecutedAsync(Optional<CommandInfo> command, ICommandContext context, IResult result) { // command is unspecified when there was a search failure (command not found); we don't care about these errors if (!command.IsSpecified) return; // the command was succesful, we don't care about this result, unless we want to log that a command succeeded. if (result.IsSuccess) return; // the command failed, let's notify the user that something happened. await context.Channel.SendMessageAsync($"error: {result.ToString()}"); } private Task LogAsync(LogMessage log) { Console.WriteLine(log.ToString()); return Task.CompletedTask; } } }
using System; using System.Reflection; using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Discord; using Discord.Commands; using Discord.WebSocket; namespace _02_commands_framework.Services { public class CommandHandlingService { private readonly CommandService _commands; private readonly DiscordSocketClient _discord; private readonly IServiceProvider _services; public CommandHandlingService(IServiceProvider services) { _commands = services.GetRequiredService<CommandService>(); _discord = services.GetRequiredService<DiscordSocketClient>(); _services = services; _discord.MessageReceived += MessageReceivedAsync; } public async Task InitializeAsync() { await _commands.AddModulesAsync(Assembly.GetEntryAssembly(), _services); } public async Task MessageReceivedAsync(SocketMessage rawMessage) { // Ignore system messages, or messages from other bots if (!(rawMessage is SocketUserMessage message)) return; if (message.Source != MessageSource.User) return; // This value holds the offset where the prefix ends var argPos = 0; if (!message.HasMentionPrefix(_discord.CurrentUser, ref argPos)) return; var context = new SocketCommandContext(_discord, message); var result = await _commands.ExecuteAsync(context, argPos, _services); if (result.Error.HasValue && result.Error.Value != CommandError.UnknownCommand) // it's bad practice to send 'unknown command' errors await context.Channel.SendMessageAsync(result.ToString()); } } }
mit
C#
01e26b8719a4ac5aa8b203b699f795cc04a80eb1
Add interface to build compatible classes (read: viewmodels)
roman-yagodin/R7.University,roman-yagodin/R7.University,roman-yagodin/R7.University
R7.University/Models/EduProgramProfileFormInfo.cs
R7.University/Models/EduProgramProfileFormInfo.cs
// // EduProgramProfileForm.cs // // Author: // Roman M. Yagodin <[email protected]> // // Copyright (c) 2015 Roman M. Yagodin // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using System.Collections.Generic; using DotNetNuke.ComponentModel.DataAnnotations; namespace R7.University { interface IEduProgramProfileForm { long EduProgramProfileFormID { get; set; } int EduProgramProfileID { get; set; } int EduFormID { get; set; } int TimeToLearn { get; set; } bool IsAdmissive { get; set; } } [TableName ("University_EduProgramProfileForms")] [PrimaryKey ("EduProgramProfileFormID", AutoIncrement = true)] public class EduProgramProfileFormInfo: IEduProgramProfileForm { #region IEduProgramProfileForm implementation public long EduProgramProfileFormID { get; set; } public int EduProgramProfileID { get; set; } public int EduFormID { get; set; } public int TimeToLearn { get; set; } // TODO: Rename to IsAppliable public bool IsAdmissive { get; set; } #endregion [IgnoreColumn] public EduProgramProfileInfo EduProgramProfile { get; set; } [IgnoreColumn] public EduFormInfo EduForm { get; set; } public void SetTimeToLearn (int years, int months) { TimeToLearn = years * 12 + months; } } }
// // EduProgramProfileForm.cs // // Author: // Roman M. Yagodin <[email protected]> // // Copyright (c) 2015 Roman M. Yagodin // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. using System; using System.Collections.Generic; using DotNetNuke.ComponentModel.DataAnnotations; namespace R7.University { [TableName ("University_EduProgramProfileForms")] [PrimaryKey ("EduProgramProfileFormID", AutoIncrement = true)] public class EduProgramProfileFormInfo { public long EduProgramProfileFormID { get; set; } public int EduProgramProfileID { get; set; } public int EduFormID { get; set; } public int TimeToLearn { get; set; } public bool IsAdmissive { get; set; } [IgnoreColumn] public EduProgramProfileInfo EduProgramProfile { get; set; } [IgnoreColumn] public EduFormInfo EduForm { get; set; } public void SetTimeToLearn (int years, int months) { TimeToLearn = years * 12 + months; } } }
agpl-3.0
C#
e2962f7899ddde38cc5cef1068868e60d071335f
Revert "Updated name."
tphx/StreamChatSharp
StreamChatSharp/StreamChatSharp/ConnectionData.cs
StreamChatSharp/StreamChatSharp/ConnectionData.cs
// The MIT License (MIT) // // Copyright (c) 2014 TPHX // // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated // documentation files (the "Software"), to deal in the Software without restriction, including without limitation the // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in all copies or substantial portions of // the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO // THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. namespace Tphx.StreamChatSharp { /// <summary> /// Contains the information needed to connect to the Twitch IRC server. /// </summary> public class ConnectionData { /// <summary> /// Defines the arguments required to connect to a server. /// </summary> /// <param name="nick">Nickname to connect with.</param> /// <param name="oAuth">OAuth to connect with.</param> /// <param name="hostName">Hostname to connect to.</param> /// <param name="port">Port to connect on.</param> public ConnectionData(string nick, string oAuth, string hostName, int port) { this.Nickname = nick; this.Password = oAuth; this.HostName = hostName; this.Port = port; } /// <summary> /// Nickname to connect with. /// </summary> public string Nickname { get; set; } /// <summary> /// Password to connect with. /// </summary> public string Password { get; set; } /// <summary> /// Hostname to connect to. /// </summary> public string HostName { get; set; } /// <summary> /// Port to connect on. /// </summary> public int Port { get; set; } } }
// The MIT License (MIT) // // Copyright (c) 2014 TPHX // // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated // documentation files (the "Software"), to deal in the Software without restriction, including without limitation the // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to the following conditions: // The above copyright notice and this permission notice shall be included in all copies or substantial portions of // the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO // THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. namespace Tphx.StreamChatSharp { /// <summary> /// Contains the information needed to connect to the Twitch IRC server. /// </summary> public class ConnectionData { /// <summary> /// Defines the arguments required to connect to a server. /// </summary> /// <param name="nick">Nickname to connect with.</param> /// <param name="nickname">OAuth to connect with.</param> /// <param name="hostName">Hostname to connect to.</param> /// <param name="port">Port to connect on.</param> public ConnectionData(string nick, string nickname, string hostName, int port) { this.Nickname = nick; this.Password = nickname; this.HostName = hostName; this.Port = port; } /// <summary> /// Nickname to connect with. /// </summary> public string Nickname { get; set; } /// <summary> /// Password to connect with. /// </summary> public string Password { get; set; } /// <summary> /// Hostname to connect to. /// </summary> public string HostName { get; set; } /// <summary> /// Port to connect on. /// </summary> public int Port { get; set; } } }
mit
C#
f7b987bc9f0190f8ea29aeab3a3582ff1db0461d
Update DotNetXmlDeserializer.cs
tiksn/TIKSN-Framework
TIKSN.Core/Serialization/DotNetXmlDeserializer.cs
TIKSN.Core/Serialization/DotNetXmlDeserializer.cs
using System.IO; using System.Text; using System.Xml.Serialization; namespace TIKSN.Serialization { public class DotNetXmlDeserializer : DeserializerBase<string> { protected override T DeserializeInternal<T>(string serial) { if (string.IsNullOrEmpty(serial)) { return default; } using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(serial))) { var serializer = new XmlSerializer(typeof(T)); return (T)serializer.Deserialize(stream); } } } }
using System.IO; using System.Text; using System.Xml.Serialization; namespace TIKSN.Serialization { public class DotNetXmlDeserializer : DeserializerBase<string> { protected override T DeserializeInternal<T>(string serial) { if (string.IsNullOrEmpty(serial)) { return default(T); } using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(serial))) { var serializer = new XmlSerializer(typeof(T)); return (T)serializer.Deserialize(stream); } } } }
mit
C#
4fba6389e22bdfaf8481fe05c53ef20516ee7275
Fix spelling mistake.
IvionSauce/MeidoBot
MinimalistParsers/MediaDispatch.cs
MinimalistParsers/MediaDispatch.cs
using System; using System.IO; namespace MinimalistParsers { public static class MediaDispatch { static Func<Stream, MediaProperties>[] mediaDispatch; static MediaDispatch() { mediaDispatch = new Func<Stream, MediaProperties>[] { Png.Parse, Gif.Parse, Jpeg.Parse, Ebml.Parse }; } public static MediaProperties Parse(byte[] data) { if (data == null) throw new ArgumentNullException("data"); return Parse(new MemoryStream(data)); } public static MediaProperties Parse(Stream stream) { if (stream == null) throw new ArgumentNullException("stream"); if (!stream.CanSeek) throw new ArgumentException("Stream must be seekable."); foreach (var f in mediaDispatch) { stream.Position = 0; MediaProperties props = f(stream); if (PropSuccess(props)) return props; } return new MediaProperties(); } static bool PropSuccess(MediaProperties props) { if (props.Type == MediaType.NotSupported) return false; else return true; } } }
using System; using System.IO; namespace MinimalistParsers { public static class MediaDispatch { static Func<Stream, MediaProperties>[] mediaDispatch; static MediaDispatch() { mediaDispatch = new Func<Stream, MediaProperties>[] { Png.Parse, Gif.Parse, Jpeg.Parse, Ebml.Parse }; } public static MediaProperties Parse(byte[] data) { if (data == null) throw new ArgumentNullException("data"); return Parse(new MemoryStream(data)); } public static MediaProperties Parse(Stream stream) { if (stream == null) throw new ArgumentNullException("stream"); if (!stream.CanSeek) throw new ArgumentException("Stream must be seekable."); foreach (var f in mediaDispatch) { stream.Position = 0; MediaProperties props = f(stream); if (PropSucces(props)) return props; } return new MediaProperties(); } static bool PropSucces(MediaProperties props) { if (props.Type == MediaType.NotSupported) return false; else return true; } } }
bsd-2-clause
C#
5392acf35aa62c5b03fa6e9ebddb87b7be8da2ed
rename argument from value to valueProvider
cvent/Metrics.NET,etishor/Metrics.NET,huoxudong125/Metrics.NET,DeonHeyns/Metrics.NET,Recognos/Metrics.NET,MetaG8/Metrics.NET,huoxudong125/Metrics.NET,alhardy/Metrics.NET,ntent-ad/Metrics.NET,alhardy/Metrics.NET,ntent-ad/Metrics.NET,Liwoj/Metrics.NET,MetaG8/Metrics.NET,Recognos/Metrics.NET,cvent/Metrics.NET,DeonHeyns/Metrics.NET,Liwoj/Metrics.NET,mnadel/Metrics.NET,mnadel/Metrics.NET,etishor/Metrics.NET,MetaG8/Metrics.NET
Src/Metrics/MetricValueSource.cs
Src/Metrics/MetricValueSource.cs
 namespace Metrics { /// <summary> /// Indicates the ability to provide the value for a metric. /// This is the raw value. Consumers should use <see cref="MetricValueSource{T}"/> /// </summary> /// <typeparam name="T">Type of the value returned by the metric</typeparam> public interface MetricValueProvider<T> : Utils.IHideObjectMembers where T : struct { /// <summary> /// The current value of the metric. /// </summary> T Value { get; } } /// <summary> /// Provides the value of a metric and information about units. /// This is the class that metric consumers should use. /// </summary> /// <typeparam name="T">Type of the metric value</typeparam> public abstract class MetricValueSource<T> : Utils.IHideObjectMembers where T : struct { private readonly MetricValueProvider<T> valueProvider; protected MetricValueSource(string name, MetricValueProvider<T> valueProvider, Unit unit) { this.Name = name; this.Unit = unit; this.valueProvider = valueProvider; } /// <summary> /// Name of the metric. /// </summary> public string Name { get; private set; } /// <summary> /// The current value of the metric. /// </summary> public T Value { get { return this.valueProvider.Value; } } /// <summary> /// Unit representing what the metric is measuring. /// </summary> public Unit Unit { get; private set; } } }
 namespace Metrics { /// <summary> /// Indicates the ability to provide the value for a metric. /// This is the raw value. Consumers should use <see cref="MetricValueSource{T}"/> /// </summary> /// <typeparam name="T">Type of the value returned by the metric</typeparam> public interface MetricValueProvider<T> : Utils.IHideObjectMembers where T : struct { /// <summary> /// The current value of the metric. /// </summary> T Value { get; } } /// <summary> /// Provides the value of a metric and information about units. /// This is the class that metric consumers should use. /// </summary> /// <typeparam name="T">Type of the metric value</typeparam> public abstract class MetricValueSource<T> : Utils.IHideObjectMembers where T : struct { private readonly MetricValueProvider<T> value; protected MetricValueSource(string name, MetricValueProvider<T> value, Unit unit) { this.Name = name; this.Unit = unit; this.value = value; } /// <summary> /// Name of the metric. /// </summary> public string Name { get; private set; } /// <summary> /// The current value of the metric. /// </summary> public T Value { get { return this.value.Value; } } /// <summary> /// Unit representing what the metric is measuring. /// </summary> public Unit Unit { get; private set; } } }
apache-2.0
C#
af4fd31750394dba96835f3f32d98909abdaae59
Set correct version
TheSylence/Twice
Twice/Properties/AssemblyInfo.cs
Twice/Properties/AssemblyInfo.cs
using Anotar.NLog; using System; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; [assembly: AssemblyTitle( "Twice" )] [assembly: AssemblyDescription( "Twitter Client for Windows" )] [assembly: AssemblyConfiguration( "" )] [assembly: AssemblyCompany( "btbsoft.org" )] [assembly: AssemblyProduct( "Twice" )] [assembly: AssemblyCopyright( "Copyright © btbsoft.org 2016" )] [assembly: AssemblyTrademark( "" )] [assembly: AssemblyCulture( "" )] [assembly: CLSCompliant( false )] [assembly: ComVisible( false )] [assembly: ThemeInfo( ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly )] [assembly: LogMinimalMessage] [assembly: AssemblyVersion( "0.1.0.0" )] [assembly: AssemblyFileVersion( "0.1.0.0" )] [assembly: InternalsVisibleTo( "Twice.Tests" )] [assembly: InternalsVisibleTo( "DynamicProxyGenAssembly2" )]
using Anotar.NLog; using System; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; [assembly: AssemblyTitle( "Twice" )] [assembly: AssemblyDescription( "Twitter Client for Windows" )] [assembly: AssemblyConfiguration( "" )] [assembly: AssemblyCompany( "btbsoft.org" )] [assembly: AssemblyProduct( "Twice" )] [assembly: AssemblyCopyright( "Copyright © btbsoft.org 2016" )] [assembly: AssemblyTrademark( "" )] [assembly: AssemblyCulture( "" )] [assembly: CLSCompliant( false )] [assembly: ComVisible( false )] [assembly: ThemeInfo( ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly )] [assembly: LogMinimalMessage] [assembly: AssemblyVersion( "0.1.0.1" )] [assembly: AssemblyFileVersion( "0.1.0.1" )] [assembly: InternalsVisibleTo( "Twice.Tests" )] [assembly: InternalsVisibleTo( "DynamicProxyGenAssembly2" )]
mit
C#
d46ee65d20fe026afb69aba01dbd4c3798743859
Fix non RBGA32 PNGs decoding incorrectly on iOS
EVAST9919/osu-framework,peppy/osu-framework,ZLima12/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,ppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,ZLima12/osu-framework,peppy/osu-framework,peppy/osu-framework
osu.Framework.iOS/Graphics/Textures/IOSTextureLoaderStore.cs
osu.Framework.iOS/Graphics/Textures/IOSTextureLoaderStore.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.IO; using System.Runtime.InteropServices; using CoreGraphics; using Foundation; using osu.Framework.Graphics.Textures; using osu.Framework.IO.Stores; using SixLabors.ImageSharp; using UIKit; namespace osu.Framework.iOS.Graphics.Textures { public class IOSTextureLoaderStore : TextureLoaderStore { public IOSTextureLoaderStore(IResourceStore<byte[]> store) : base(store) { } protected override unsafe Image<TPixel> ImageFromStream<TPixel>(Stream stream) { using (var uiImage = UIImage.LoadFromData(NSData.FromStream(stream))) { int width = (int)uiImage.Size.Width; int height = (int)uiImage.Size.Height; IntPtr data = Marshal.AllocHGlobal(width * height * 4); using (CGBitmapContext textureContext = new CGBitmapContext(data, width, height, 8, width * 4, CGColorSpace.CreateDeviceRGB(), CGImageAlphaInfo.PremultipliedLast)) textureContext.DrawImage(new CGRect(0, 0, width, height), uiImage.CGImage); // NOTE: this will probably only be correct for Rgba32, will need to look into other pixel formats var image = Image.LoadPixelData<TPixel>( new ReadOnlySpan<byte>(data.ToPointer(), width * height * 4), width, height); Marshal.FreeHGlobal(data); return image; } } } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.IO; using System.Runtime.InteropServices; using CoreGraphics; using Foundation; using osu.Framework.Graphics.Textures; using osu.Framework.IO.Stores; using SixLabors.ImageSharp; using UIKit; namespace osu.Framework.iOS.Graphics.Textures { public class IOSTextureLoaderStore : TextureLoaderStore { public IOSTextureLoaderStore(IResourceStore<byte[]> store) : base(store) { } protected override unsafe Image<TPixel> ImageFromStream<TPixel>(Stream stream) { using (var uiImage = UIImage.LoadFromData(NSData.FromStream(stream))) { int width = (int)uiImage.Size.Width; int height = (int)uiImage.Size.Height; IntPtr data = Marshal.AllocHGlobal(width * height * 4); using (CGBitmapContext textureContext = new CGBitmapContext(data, width, height, 8, width * 4, uiImage.CGImage.ColorSpace, CGImageAlphaInfo.PremultipliedLast)) textureContext.DrawImage(new CGRect(0, 0, width, height), uiImage.CGImage); // NOTE: this will probably only be correct for Rgba32, will need to look into other pixel formats var image = Image.LoadPixelData<TPixel>( new ReadOnlySpan<byte>(data.ToPointer(), width * height * 4), width, height); Marshal.FreeHGlobal(data); return image; } } } }
mit
C#
f9504118a5ab6b5d6060520d997fea5f72a808a2
Remove using.
Nabile-Rahmani/osu-framework,Tom94/osu-framework,ZLima12/osu-framework,default0/osu-framework,RedNesto/osu-framework,peppy/osu-framework,DrabWeb/osu-framework,DrabWeb/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,RedNesto/osu-framework,default0/osu-framework,ppy/osu-framework,peppy/osu-framework,Nabile-Rahmani/osu-framework,paparony03/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,EVAST9919/osu-framework,Tom94/osu-framework,smoogipooo/osu-framework,naoey/osu-framework,EVAST9919/osu-framework,naoey/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,DrabWeb/osu-framework,ppy/osu-framework,paparony03/osu-framework
osu.Framework/Graphics/Containers/CircularMaskedContainer.cs
osu.Framework/Graphics/Containers/CircularMaskedContainer.cs
// Copyright (c) 2007-2017 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System; namespace osu.Framework.Graphics.Containers { /// <summary> /// A container which is rounded (via automatic corner-radius) on the shortest edge. /// </summary> public class CircularMaskedContainer : Container { public CircularMaskedContainer() { Masking = true; } public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) { if (!Masking) throw new InvalidOperationException($@"{nameof(CircularMaskedContainer)} must always have masking applied"); return base.Invalidate(invalidation, source, shallPropagate); } public override float CornerRadius { get { return Math.Min(DrawSize.X, DrawSize.Y) / 2f; } set { throw new InvalidOperationException($"Cannot manually set {nameof(CornerRadius)} of {nameof(CircularMaskedContainer)}."); } } } }
// Copyright (c) 2007-2017 ppy Pty Ltd <[email protected]>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System; using System.Diagnostics; namespace osu.Framework.Graphics.Containers { /// <summary> /// A container which is rounded (via automatic corner-radius) on the shortest edge. /// </summary> public class CircularMaskedContainer : Container { public CircularMaskedContainer() { Masking = true; } public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) { if (!Masking) throw new InvalidOperationException($@"{nameof(CircularMaskedContainer)} must always have masking applied"); return base.Invalidate(invalidation, source, shallPropagate); } public override float CornerRadius { get { return Math.Min(DrawSize.X, DrawSize.Y) / 2f; } set { throw new InvalidOperationException($"Cannot manually set {nameof(CornerRadius)} of {nameof(CircularMaskedContainer)}."); } } } }
mit
C#
ec3b974ab51f8043c7c8dd4b5954c13a32fbd1c9
Add GetMemberValue and GetMemberValueOrNull
nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke
source/Nuke.Common/ValueInjection/ValueInjectionAttributeBase.cs
source/Nuke.Common/ValueInjection/ValueInjectionAttributeBase.cs
// 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 System.Reflection; using JetBrains.Annotations; using Nuke.Common.Utilities; using Nuke.Common.Utilities.Collections; namespace Nuke.Common.ValueInjection { [PublicAPI] [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] [MeansImplicitUse(ImplicitUseKindFlags.Assign)] public abstract class ValueInjectionAttributeBase : Attribute { [CanBeNull] public object TryGetValue(MemberInfo member, object instance) { return ControlFlow.SuppressErrors(() => GetValue(member, instance), includeStackTrace: true); } [CanBeNull] public abstract object GetValue(MemberInfo member, object instance); public virtual int Priority => 0; [CanBeNull] protected T GetMemberValue<T>(string memberName, object instance) { var type = instance.GetType(); var member = type.GetMember(memberName, ReflectionUtility.All) .SingleOrDefaultOrError($"Found multiple members with the name '{memberName}' in '{type.Name}'.") .NotNull($"No member '{memberName}' found in '{type.Name}'."); ControlFlow.Assert(typeof(T).IsAssignableFrom(member.GetMemberType()), $"Member '{type.Name}.{member.Name} must be of type {typeof(T).Name}"); return member.GetValue<T>(instance); } [CanBeNull] protected T GetMemberValueOrNull<T>([CanBeNull] string memberName, object instance) { return memberName != null ? GetMemberValue<T>(memberName, instance) : default; } } }
// 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 System.Reflection; using JetBrains.Annotations; namespace Nuke.Common.ValueInjection { [PublicAPI] [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] [MeansImplicitUse(ImplicitUseKindFlags.Assign)] public abstract class ValueInjectionAttributeBase : Attribute { [CanBeNull] public object TryGetValue(MemberInfo member, object instance) { return ControlFlow.SuppressErrors(() => GetValue(member, instance), includeStackTrace: true); } [CanBeNull] public abstract object GetValue(MemberInfo member, object instance); public virtual int Priority => 0; } }
mit
C#
8b75a6186e46926e4105a91b49e9a6663b118c39
change alert span back to i temporarily
smbc-digital/iag-webapp,smbc-digital/iag-webapp,smbc-digital/iag-webapp
src/StockportWebapp/Views/stockportgov/Shared/GlobalAlert.cshtml
src/StockportWebapp/Views/stockportgov/Shared/GlobalAlert.cshtml
@using StockportWebapp.Models @using StockportWebapp.Utils @inject ICookiesHelper CookiesHelper @model Alert @{ var alertCookies = CookiesHelper.GetCookies<Alert>("alerts"); var isDismissed = alertCookies != null && alertCookies.Contains(Model.Slug) && !Model.IsStatic; } @if (!isDismissed) { <div class="[email protected]()"> <div class="grid-container grid-100 global-alert-container"> <div class="grid-100 mobile-grid-100 tablet-grid-100 global-alert grid-parent"> <div class="hide-on-mobile hide-on-tablet global-alert-icon [email protected]()"> <i></i> </div> <div class="grid-80 mobile-grid-95 global-alert-text-container"> <div class="[email protected]()"> <h3>@Model.Title</h3> @Html.Raw(Model.Body) </div> </div> @if (!Model.IsStatic) { <div class="global-alert-close-container"> <a href="javascript:void(0)"> <div class="[email protected]()"> <i class="close-alert" data-slug="@Model.Slug" data-parent="[email protected]()" aria-hidden="true"></i> </div> </a> </div> } </div> </div> </div> }
@using StockportWebapp.Models @using StockportWebapp.Utils @inject ICookiesHelper CookiesHelper @model Alert @{ var alertCookies = CookiesHelper.GetCookies<Alert>("alerts"); var isDismissed = alertCookies != null && alertCookies.Contains(Model.Slug) && !Model.IsStatic; } @if (!isDismissed) { <div class="[email protected]()"> <div class="grid-container grid-100 global-alert-container"> <div class="grid-100 mobile-grid-100 tablet-grid-100 global-alert grid-parent"> <div class="hide-on-mobile hide-on-tablet global-alert-icon [email protected]()"> <i></i> </div> <div class="grid-80 mobile-grid-95 global-alert-text-container"> <div class="[email protected]()"> <h3>@Model.Title</h3> @Html.Raw(Model.Body) </div> </div> @if (!Model.IsStatic) { <div class="global-alert-close-container"> <a href="javascript:void(0)"> <div class="[email protected]()"> <span class="close-alert" data-slug="@Model.Slug" data-parent="[email protected]()" aria-hidden="true"></span> </div> </a> </div> } </div> </div> </div> }
mit
C#
dc36ba92958c138dbbba1cdc9fb44986c43d02e4
update the directory helper to preference the custom app data folder instead of the default location
cjmurph/PmsService,cjmurph/PmsService
PlexServiceCommon/PlexDirHelper.cs
PlexServiceCommon/PlexDirHelper.cs
using System; using System.IO; using Microsoft.Win32; namespace PlexServiceCommon { public static class PlexDirHelper { /// <summary> /// Returns the full path and filename of the plex media server executable /// </summary> /// <returns></returns> public static string GetPlexDataDir() { //set appDataFolder to the default user local app data folder var appDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); //check if the user has a custom path specified in the registry, if so, update the path to return this instead var is64Bit = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432")); var architecture = is64Bit ? RegistryView.Registry64 : RegistryView.Registry32; try { using var pmsDataKey = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, architecture).OpenSubKey(@"Software\Plex, Inc.\Plex Media Server"); if (pmsDataKey is not null) appDataFolder = Path.Combine((string)pmsDataKey.GetValue("LocalAppdataPath"), "Plex Media Server"); } catch { } var path = Path.Combine(appDataFolder, "Plex Media Server"); if (Directory.Exists(path)) return path; return string.Empty; } } }
using System; using System.IO; using Microsoft.Win32; namespace PlexServiceCommon { public static class PlexDirHelper { /// <summary> /// Returns the full path and filename of the plex media server executable /// </summary> /// <returns></returns> public static string GetPlexDataDir() { var result = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData); var path = Path.Combine(result, "Plex Media Server"); if (Directory.Exists(path)) { return path; } result = string.Empty; var is64Bit = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("PROCESSOR_ARCHITEW6432")); var architecture = is64Bit ? RegistryView.Registry64 : RegistryView.Registry32; using var pmsDataKey = RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, architecture) .OpenSubKey(@"Software\Plex, Inc.\Plex Media Server"); if (pmsDataKey == null) { return result; } path = Path.Combine((string) pmsDataKey.GetValue("LocalAppdataPath"), "Plex Media Server"); result = path; return result; } } }
mit
C#
8a83a22ff82c32ca1df47b9f725f9f403154ee1c
make console player a bit user friendly.
atsushieno/managed-midi
tools/managed-midi-player-console/managed-midi-player-console.cs
tools/managed-midi-player-console/managed-midi-player-console.cs
using System; using System.Collections.Generic; using System.IO; using System.Text; using System.Threading; using Commons.Music.Midi; using PortMidiSharp; using Timer = System.Timers.Timer; namespace Commons.Music.Midi.Player { public class Driver { static void ShowHelp () { Console.WriteLine (@" managed-midi-player-console [options] SMF-files(*.mid) Options: --help show this help. --device:x specifies MIDI output device by ID. "); Console.WriteLine ("List of MIDI output device IDs: "); foreach (var dev in MidiDeviceManager.AllDevices) if (dev.IsOutput) Console.WriteLine ("\t{0}: {1}", dev.ID, dev.Name); } public static void Main (string [] args) { int outdev = MidiDeviceManager.DefaultOutputDeviceID; var files = new List<string> (); if (args.Length == 0) { ShowHelp (); return; } foreach (var arg in args) { if (arg == "--help") { ShowHelp (); return; } if (arg.StartsWith ("--device:")) { if (!int.TryParse (arg.Substring (9), out outdev)) { ShowHelp (); Console.WriteLine (); Console.WriteLine ("Invalid MIDI output device ID."); return; } } else files.Add (arg); } var output = MidiDeviceManager.OpenOutput (outdev); foreach (var arg in files) { var parser = new SmfReader (File.OpenRead (arg)); parser.Parse (); var player = new PortMidiPlayer (output, parser.Music); player.StartLoop (); player.PlayAsync (); Console.WriteLine ("empty line to quit, P to pause and resume"); while (true) { string line = Console.ReadLine (); if (line == "P") { if (player.State == PlayerState.Playing) player.PauseAsync (); else player.PlayAsync (); } else if (line == "") { player.Dispose (); break; } else Console.WriteLine ("what do you mean by '{0}' ?", line); } } } } }
using System; using System.Collections.Generic; using System.IO; using System.Text; using System.Threading; using Commons.Music.Midi; using PortMidiSharp; using Timer = System.Timers.Timer; namespace Commons.Music.Midi.Player { public class Driver { public static void Main (string [] args) { int outdev = MidiDeviceManager.DefaultOutputDeviceID; var files = new List<string> (); foreach (var arg in args) { if (arg.StartsWith ("--device:")) { if (!int.TryParse (arg.Substring (9), out outdev)) { Console.WriteLine ("Specify device ID: "); foreach (var dev in MidiDeviceManager.AllDevices) if (dev.IsOutput) Console.WriteLine ("{0}: {1}", dev.ID, dev.Name); return; } } else files.Add (arg); } var output = MidiDeviceManager.OpenOutput (outdev); foreach (var arg in files) { var parser = new SmfReader (File.OpenRead (arg)); parser.Parse (); var player = new PortMidiPlayer (output, parser.Music); player.StartLoop (); player.PlayAsync (); Console.WriteLine ("empty line to quit, P to pause and resume"); while (true) { string line = Console.ReadLine (); if (line == "P") { if (player.State == PlayerState.Playing) player.PauseAsync (); else player.PlayAsync (); } else if (line == "") { player.Dispose (); break; } else Console.WriteLine ("what do you mean by '{0}' ?", line); } } } } }
mit
C#
0d00e61f4184726542d15d6b22b82ed69bf14cb3
Add PTypeError subclass of JsonErrorInfo for type errors.
PenguinF/sandra-three
Sandra.UI.WF/Storage/PTypeError.cs
Sandra.UI.WF/Storage/PTypeError.cs
#region License /********************************************************************************* * PTypeError.cs * * Copyright (c) 2004-2018 Henk Nicolai * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *********************************************************************************/ #endregion using SysExtensions.Text.Json; using System; namespace Sandra.UI.WF.Storage { /// <summary> /// Represents an error caused by a value being of a different type than expected. /// </summary> public class PTypeError : JsonErrorInfo { /// <summary> /// Gets the context insensitive information for this error message. /// </summary> public ITypeErrorBuilder TypeErrorBuilder { get; } private PTypeError(ITypeErrorBuilder typeErrorBuilder, int start, int length) : base(JsonErrorCode.Custom, start, length) { TypeErrorBuilder = typeErrorBuilder; } /// <summary> /// Initializes a new instance of <see cref="PTypeError"/>. /// </summary> /// <param name="typeErrorBuilder"> /// The context insensitive information for this error message. /// </param> /// <returns> /// A <see cref="PTypeError"/> instance which generates a localized error message. /// </returns> /// <exception cref="ArgumentNullException"> /// <paramref name="typeErrorBuilder"/> is null. /// </exception> public static PTypeError Create(ITypeErrorBuilder typeErrorBuilder, int start, int length) { if (typeErrorBuilder == null) throw new ArgumentNullException(nameof(typeErrorBuilder)); return new PTypeError( typeErrorBuilder, start, length); } } }
#region License /********************************************************************************* * PTypeError.cs * * Copyright (c) 2004-2018 Henk Nicolai * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *********************************************************************************/ #endregion namespace Sandra.UI.WF.Storage { }
apache-2.0
C#
41a8ad6df8f0e12d676dee05eb14248df83b5162
modify model type in view
OlegKleyman/AlphaDev,OlegKleyman/AlphaDev,OlegKleyman/AlphaDev
web/AlphaDev.Web/Views/Posts/Create.cshtml
web/AlphaDev.Web/Views/Posts/Create.cshtml
@model AlphaDev.Web.Models.CreatePostViewModel @{ ViewBag.Title = "Create Post"; } @section styles { <link href="~/lib/bootstrap-markdown/css/bootstrap-markdown.min.css" rel="stylesheet" /> } <h1 class="text-center">Create Post</h1> <form method="post"> <div class="col-lg-12"> <div> <div> <label asp-for="Title"></label> </div> <div> <span asp-validation-for="Title" class="text-danger"></span> <input asp-for="Title" class="form-control" /> </div> </div> <div> <span asp-validation-for="Content" class="text-danger"></span> <textarea asp-for="Content" data-provide="markdown" class="blogEditor"></textarea> </div> </div> </form> @section scripts { <script src="~/lib/marked/lib/marked.js"></script> <script src="~/lib/bootstrap-markdown/js/bootstrap-markdown.js"></script> <script type="text/javascript"> $('#Content').markdown({ savable: true, onChange: function(){ Prism.highlightAll(); }, onSave: function () { $('form').submit(); } }) </script> }
@model AlphaDev.Web.Models.CreatePost @{ ViewBag.Title = "Create Post"; } @section styles { <link href="~/lib/bootstrap-markdown/css/bootstrap-markdown.min.css" rel="stylesheet" /> } <h1 class="text-center">Create Post</h1> <form method="post"> <div class="col-lg-12"> <div> <div> <label asp-for="Title"></label> </div> <div> <span asp-validation-for="Title" class="text-danger"></span> <input asp-for="Title" class="form-control" /> </div> </div> <div> <span asp-validation-for="Content" class="text-danger"></span> <textarea asp-for="Content" data-provide="markdown" class="blogEditor"></textarea> </div> </div> </form> @section scripts { <script src="~/lib/marked/lib/marked.js"></script> <script src="~/lib/bootstrap-markdown/js/bootstrap-markdown.js"></script> <script type="text/javascript"> $('#Content').markdown({ savable: true, onChange: function(){ Prism.highlightAll(); }, onSave: function () { $('form').submit(); } }) </script> }
unlicense
C#
430682d336aa2bdfae74dcba36c8a3523bbad28a
Add Controls prop to Guitar model
michaelp0730/MichaelsMusic,michaelp0730/MichaelsMusic,michaelp0730/MichaelsMusic
MichaelsMusic/Models/Guitar.cs
MichaelsMusic/Models/Guitar.cs
namespace MichaelsMusic.Models { public class Guitar : Item { public bool CoilTap { get; set; } public bool IsHardtail { get; set; } public bool IsTopJack { get; set; } public decimal ScaleLength { get; set; } public int Frets { get; set; } public int Strings { get; set; } public string Binding { get; set; } public string BodyStyle { get; set; } public string Bridge { get; set; } public string BridgePickup { get; set; } public string Capacitors { get; set; } public string Controls { get; set; } public string Finish { get; set; } public string Fretboard { get; set; } public string Fretwire { get; set; } public string Headstock { get; set; } public string InlayMaterial { get; set; } public string InlayShape { get; set; } public string Knobs { get; set; } public string MiddlePickup { get; set; } public string NeckFinish { get; set; } public string NeckJoint { get; set; } public string NeckMaterial { get; set; } public string NeckPickup { get; set; } public string NeckShape { get; set; } public string Nut { get; set; } public string PickupSelector { get; set; } public string Tuners { get; set; } } }
namespace MichaelsMusic.Models { public class Guitar : Item { public bool CoilTap { get; set; } public bool IsHardtail { get; set; } public bool IsTopJack { get; set; } public decimal ScaleLength { get; set; } public int Frets { get; set; } public int Strings { get; set; } public string Binding { get; set; } public string BodyStyle { get; set; } public string Bridge { get; set; } public string BridgePickup { get; set; } public string Capacitors { get; set; } public string Finish { get; set; } public string Fretboard { get; set; } public string Fretwire { get; set; } public string Headstock { get; set; } public string InlayMaterial { get; set; } public string InlayShape { get; set; } public string Knobs { get; set; } public string MiddlePickup { get; set; } public string NeckFinish { get; set; } public string NeckJoint { get; set; } public string NeckMaterial { get; set; } public string NeckPickup { get; set; } public string NeckShape { get; set; } public string Nut { get; set; } public string PickupSelector { get; set; } public string Tuners { get; set; } } }
mit
C#
a35e11334b94c47c34c5dd5b40f83e0c94e1b8f2
Refactor on MvbCollection
markjackmilian/MVB
Mvb/Mvb.Cross/MvbCollection.cs
Mvb/Mvb.Cross/MvbCollection.cs
using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; using System.ComponentModel; using System.Linq; namespace Mvb.Cross { public class MvbCollection<T> : ObservableCollection<T> { public MvbCollection() : base() {} public MvbCollection(IEnumerable<T> collection) : base(collection) {} public MvbCollection(List<T> list) : base(list) {} /// <summary> /// Adds the range. /// </summary> /// <returns>The range.</returns> /// <param name="range">Range.</param> public void AddRange(IEnumerable<T> range) { var startIndexd = this.Items.Count-1; foreach (var item in range) { Items.Add(item); } this.OnPropertyChanged(new PropertyChangedEventArgs("Count")); this.OnPropertyChanged(new PropertyChangedEventArgs("Item[]")); this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, range.ToList(), startIndexd)); } /// <summary> /// Reset the collection and addrange the specified range. /// This will fire a NotifyCollectionChanged for reset followed by a NotifyCollectionChanged for add /// </summary> /// <param name="range">Range.</param> public void Reset(IEnumerable<T> range) { this.Items.Clear(); this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); this.AddRange(range); } } }
using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Mvb.Cross { public class MvbCollection<T> : ObservableCollection<T> { public MvbCollection() : base() { } public MvbCollection(IEnumerable<T> collection) : base(collection) { } public MvbCollection(List<T> list) : base(list) { } public void AddRange(IEnumerable<T> range) { var startIndexd = this.Items.Count-1; foreach (var item in range) { Items.Add(item); } this.OnPropertyChanged(new PropertyChangedEventArgs("Count")); this.OnPropertyChanged(new PropertyChangedEventArgs("Item[]")); //this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); this.OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, range.ToList(), startIndexd)); } public void Reset(IEnumerable<T> range) { this.Items.Clear(); this.AddRange(range); } } }
apache-2.0
C#
e969c60fa735fef879f0d566b81ffd4674ea3573
Split protection type enumerations
magenta-aps/cprbroker,magenta-aps/cprbroker,magenta-aps/cprbroker,OS2CPRbroker/cprbroker,OS2CPRbroker/cprbroker
PART/Source/Core/Schemas/Intervals/DataTypeTags.cs
PART/Source/Core/Schemas/Intervals/DataTypeTags.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CprBroker.Schemas.Part { public enum DataTypeTags { None, CivilStatus, Separation, Name, Address, Church, NameAndAddressProtection, ResearchProtection, LocalDirectoryProtection, MarketingProtection, PNR, Citizenship } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CprBroker.Schemas.Part { public enum DataTypeTags { CivilStatus, Separation, Name, Address, Church, Protection, PNR, Citizenship } }
mpl-2.0
C#
aca45a7d2675e8add54c2ce531f2d02ee62a1572
add new types for requests
ucdavis/Purchasing,ucdavis/Purchasing,ucdavis/Purchasing
Purchasing.Web/Views/Order/_BusinessPurpose.cshtml
Purchasing.Web/Views/Order/_BusinessPurpose.cshtml
@model OrderModifyModel <section> <header class="ui-widget-header ui-corner-top">Business Purpose</header> <div class="section-contents"> <div class="section-text"> <p> Please enter your business purpose for placing this order request. </p> </div> <ul> <li> <div class="editor-label required">Request Type</div> <div class="editor-field"> @this.Select("requestType").Options(new [] { "Purchasing", "Payment/Refund", "Travel or Entertainment", "PCARD Receipt", "Other" }).Class("request-types").Selected(Model.Order.RequestType ?? "Purchasing") </div> </li> <li> <div class="editor-label required">Business Purpose</div> <div class="editor-field"> <textarea name="businessPurpose" placeholder="enter your business purpose for placing this order" rows="4" cols="50">@Model.Order.BusinessPurpose</textarea> </div> </li> </ul> </div> </section>
@model OrderModifyModel <section> <header class="ui-widget-header ui-corner-top">Business Purpose</header> <div class="section-contents"> <div class="section-text"> <p> Please enter your business purpose for placing this order request. </p> </div> <ul> <li> <div class="editor-label required">Request Type</div> <div class="editor-field"> @this.Select("requestType").Options(new [] { "Purchasing", "Travel or Entertainment" }).Class("request-types").Selected(Model.Order.RequestType ?? "Purchasing") </div> </li> <li> <div class="editor-label required">Business Purpose</div> <div class="editor-field"> <textarea name="businessPurpose" placeholder="enter your business purpose for placing this order" rows="4" cols="50">@Model.Order.BusinessPurpose</textarea> </div> </li> </ul> </div> </section>
mit
C#
b126808cb1a00671c48a5a6577dfd47224ebb435
change title value
GusJassal/agri-nmp,GusJassal/agri-nmp,GusJassal/agri-nmp,GusJassal/agri-nmp
Server/src/SERVERAPI/Controllers/HomeController.cs
Server/src/SERVERAPI/Controllers/HomeController.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.NodeServices; namespace SERVERAPI.Controllers { public class JSONResponse { public string type; public byte[] data; } public class HomeController : Controller { public IActionResult Index() { ViewBag.Title = "NMP"; return View(); } [HttpGet] public async Task<IActionResult> Print([FromServices] INodeServices nodeServices) { JSONResponse result = null; var options = new { format = "letter", orientation = "landscape" }; var opts = new { orientation = "landscape", }; string rawdata = "<!DOCTYPE html><html><head><meta charset='utf-8' /><title></title></head><body><div style='width: 100%; background-color:lightgreen'>Section 1</div><br><div style='page -break-after:always; '></div><div style='width: 100%; background-color:lightgreen'>Section 2</div></body></html>"; // execute the Node.js component result = await nodeServices.InvokeAsync<JSONResponse>("pdf.js", rawdata, options); return new FileContentResult(result.data, "application/pdf"); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.NodeServices; namespace SERVERAPI.Controllers { public class JSONResponse { public string type; public byte[] data; } public class HomeController : Controller { public IActionResult Index() { return View(); } [HttpGet] public async Task<IActionResult> Print([FromServices] INodeServices nodeServices) { JSONResponse result = null; var options = new { format = "letter", orientation = "landscape" }; var opts = new { orientation = "landscape", }; string rawdata = "<!DOCTYPE html><html><head><meta charset='utf-8' /><title></title></head><body><div style='width: 100%; background-color:lightgreen'>Section 1</div><br><div style='page -break-after:always; '></div><div style='width: 100%; background-color:lightgreen'>Section 2</div></body></html>"; // execute the Node.js component result = await nodeServices.InvokeAsync<JSONResponse>("pdf.js", rawdata, options); return new FileContentResult(result.data, "application/pdf"); } } }
apache-2.0
C#
0b00c67340a0be7c0713ec0bb978aa8efd88b3cc
add shadow step and death spiral precooldown
Foglio1024/Tera-custom-cooldowns,Foglio1024/Tera-custom-cooldowns
TCC.Core/ClassSpecific/ReaperAbnormalityTracker.cs
TCC.Core/ClassSpecific/ReaperAbnormalityTracker.cs
using TCC.Data; using TCC.Parsing.Messages; using TCC.ViewModels; namespace TCC.ClassSpecific { public class ReaperAbnormalityTracker : ClassAbnormalityTracker { private const int ShadowReapingId = 10151010; private const int ShadowStepId = 10151000; private const int DeathSpiralId = 10151131; public override void CheckAbnormality(S_ABNORMALITY_BEGIN p) { if (p.TargetId != SessionManager.CurrentPlayer.EntityId) return; CheckShadowReaping(p); CheckShadowStep(p); CheckDeathSpiral(p); } private void CheckDeathSpiral(S_ABNORMALITY_BEGIN p) { if (p.AbnormalityId != DeathSpiralId) return; if (!SessionManager.SkillsDatabase.TryGetSkillByIconName("icon_skills.chainbrandish_tex", SessionManager.CurrentPlayer.Class, out var sk)) return; CooldownWindowViewModel.Instance.AddOrRefresh(new SkillCooldown(sk, p.Duration, CooldownType.Skill, CooldownWindowViewModel.Instance.GetDispatcher(), true, true)); } private void CheckShadowStep(S_ABNORMALITY_BEGIN p) { if (p.AbnormalityId != ShadowStepId) return; if (!SessionManager.SkillsDatabase.TryGetSkillByIconName("icon_skills.instantleap_tex", SessionManager.CurrentPlayer.Class, out var sk)) return; CooldownWindowViewModel.Instance.AddOrRefresh(new SkillCooldown(sk, p.Duration, CooldownType.Skill, CooldownWindowViewModel.Instance.GetDispatcher(), true, true)); } public override void CheckAbnormality(S_ABNORMALITY_REFRESH p) { if (p.TargetId != SessionManager.CurrentPlayer.EntityId) return; CheckShadowReaping(p); } public override void CheckAbnormality(S_ABNORMALITY_END p) { if (p.TargetId != SessionManager.CurrentPlayer.EntityId) return; CheckShadowReaping(p); } private static void CheckShadowReaping(S_ABNORMALITY_BEGIN p) { if (ShadowReapingId != p.AbnormalityId) return; ((ReaperBarManager)ClassWindowViewModel.Instance.CurrentManager).ShadowReaping.Buff.Start(p.Duration); } private static void CheckShadowReaping(S_ABNORMALITY_REFRESH p) { if (ShadowReapingId != p.AbnormalityId) return; ((ReaperBarManager)ClassWindowViewModel.Instance.CurrentManager).ShadowReaping.Buff.Refresh(p.Duration); } private static void CheckShadowReaping(S_ABNORMALITY_END p) { if (ShadowReapingId != p.AbnormalityId) return; ((ReaperBarManager)ClassWindowViewModel.Instance.CurrentManager).ShadowReaping.Buff.Refresh(0); } } }
using TCC.Parsing.Messages; using TCC.ViewModels; namespace TCC.ClassSpecific { public class ReaperAbnormalityTracker : ClassAbnormalityTracker { private const int ShadowReapingId = 10151010; public override void CheckAbnormality(S_ABNORMALITY_BEGIN p) { if (p.TargetId != SessionManager.CurrentPlayer.EntityId) return; CheckShadowReaping(p); } public override void CheckAbnormality(S_ABNORMALITY_REFRESH p) { if (p.TargetId != SessionManager.CurrentPlayer.EntityId) return; CheckShadowReaping(p); } public override void CheckAbnormality(S_ABNORMALITY_END p) { if (p.TargetId != SessionManager.CurrentPlayer.EntityId) return; CheckShadowReaping(p); } private static void CheckShadowReaping(S_ABNORMALITY_BEGIN p) { if (ShadowReapingId != p.AbnormalityId) return; ((ReaperBarManager)ClassWindowViewModel.Instance.CurrentManager).ShadowReaping.Buff.Start(p.Duration); } private static void CheckShadowReaping(S_ABNORMALITY_REFRESH p) { if (ShadowReapingId != p.AbnormalityId) return; ((ReaperBarManager)ClassWindowViewModel.Instance.CurrentManager).ShadowReaping.Buff.Refresh(p.Duration); } private static void CheckShadowReaping(S_ABNORMALITY_END p) { if (ShadowReapingId != p.AbnormalityId) return; ((ReaperBarManager)ClassWindowViewModel.Instance.CurrentManager).ShadowReaping.Buff.Refresh(0); } } }
mit
C#
a185cffe7a5630f453ac6c6b9edcb7cc673b596c
Fix licenses
nizhikov/ignite,chandresh-pancholi/ignite,apache/ignite,andrey-kuznetsov/ignite,ascherbakoff/ignite,nizhikov/ignite,chandresh-pancholi/ignite,nizhikov/ignite,SomeFire/ignite,SomeFire/ignite,xtern/ignite,nizhikov/ignite,apache/ignite,NSAmelchev/ignite,andrey-kuznetsov/ignite,SomeFire/ignite,samaitra/ignite,xtern/ignite,andrey-kuznetsov/ignite,daradurvs/ignite,daradurvs/ignite,chandresh-pancholi/ignite,NSAmelchev/ignite,samaitra/ignite,andrey-kuznetsov/ignite,nizhikov/ignite,samaitra/ignite,SomeFire/ignite,nizhikov/ignite,SomeFire/ignite,SomeFire/ignite,chandresh-pancholi/ignite,xtern/ignite,daradurvs/ignite,xtern/ignite,ascherbakoff/ignite,nizhikov/ignite,andrey-kuznetsov/ignite,andrey-kuznetsov/ignite,NSAmelchev/ignite,apache/ignite,SomeFire/ignite,NSAmelchev/ignite,ascherbakoff/ignite,chandresh-pancholi/ignite,ascherbakoff/ignite,samaitra/ignite,apache/ignite,apache/ignite,daradurvs/ignite,samaitra/ignite,xtern/ignite,chandresh-pancholi/ignite,xtern/ignite,nizhikov/ignite,ascherbakoff/ignite,NSAmelchev/ignite,ascherbakoff/ignite,daradurvs/ignite,SomeFire/ignite,ascherbakoff/ignite,xtern/ignite,samaitra/ignite,NSAmelchev/ignite,apache/ignite,daradurvs/ignite,samaitra/ignite,chandresh-pancholi/ignite,andrey-kuznetsov/ignite,nizhikov/ignite,daradurvs/ignite,samaitra/ignite,daradurvs/ignite,samaitra/ignite,andrey-kuznetsov/ignite,NSAmelchev/ignite,andrey-kuznetsov/ignite,daradurvs/ignite,daradurvs/ignite,andrey-kuznetsov/ignite,NSAmelchev/ignite,SomeFire/ignite,xtern/ignite,ascherbakoff/ignite,SomeFire/ignite,ascherbakoff/ignite,NSAmelchev/ignite,apache/ignite,chandresh-pancholi/ignite,apache/ignite,chandresh-pancholi/ignite,xtern/ignite,samaitra/ignite,apache/ignite
modules/platforms/dotnet/Apache.Ignite.Core.Tests/DisposeAction.cs
modules/platforms/dotnet/Apache.Ignite.Core.Tests/DisposeAction.cs
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ namespace Apache.Ignite.Core.Tests { using System; using Apache.Ignite.Core.Impl.Common; /// <summary> /// Wraps an action to be executed on Dispose call. /// </summary> public class DisposeAction : IDisposable { /** */ private readonly Action _action; /// <summary> /// Initializes a new instance of <see cref="DisposeAction"/>. /// </summary> /// <param name="action">Action.</param> public DisposeAction(Action action) { IgniteArgumentCheck.NotNull(action, "action"); _action = action; } /** <inheritdoc /> */ public void Dispose() { _action(); } } }
/* * Copyright 2019 GridGain Systems, Inc. and Contributors. * * Licensed under the GridGain Community Edition License (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.gridgain.com/products/software/community-edition/gridgain-community-edition-license * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ namespace Apache.Ignite.Core.Tests { using System; using Apache.Ignite.Core.Impl.Common; /// <summary> /// Wraps an action to be executed on Dispose call. /// </summary> public class DisposeAction : IDisposable { /** */ private readonly Action _action; /// <summary> /// Initializes a new instance of <see cref="DisposeAction"/>. /// </summary> /// <param name="action">Action.</param> public DisposeAction(Action action) { IgniteArgumentCheck.NotNull(action, "action"); _action = action; } /** <inheritdoc /> */ public void Dispose() { _action(); } } }
apache-2.0
C#
b137fc7f1cd1881e9e1460d1114ca51ce7255396
Fix spelling error.
bcjobs/infrastructure
IoC/Types.cs
IoC/Types.cs
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace IoC { public abstract class Types : IEnumerable<Type> { public static Types Local { get; } = new AssemblyTypes(Assemblies.Local); public static Types In(string directory) => In(Assemblies.In(directory)); public static Types In(Assemblies assemblies) => new AssemblyTypes(assemblies); public abstract IEnumerator<Type> GetEnumerator(); IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } public Types With<TAttribute>() where TAttribute : Attribute { return new SelectedTypes( this, t => t.IsDefined(typeof(TAttribute), false)); } public Types KindOf(string kind) { return new SelectedTypes( this, t => t.Namespace?.EndsWith("." + kind) == true); } public static Types operator +(Types x, Types y) { return new CombinedTypes(x, y); } } }
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace IoC { public abstract class Types : IEnumerable<Type> { public static Types Local { get; } = new AssemblyTypes(Assemblies.Local); public static Types In(string directory) => In(Assemblies.In(directory)); public static Types In(Assemblies assemblies) => new AssemblyTypes(assemblies); public abstract IEnumerator<Type> GetEnumerator(); IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } public Types With<TAttribyte>() where TAttribyte : Attribute { return new SelectedTypes( this, t => t.IsDefined(typeof(TAttribyte), false)); } public Types KindOf(string kind) { return new SelectedTypes( this, t => t.Namespace?.EndsWith("." + kind) == true); } public static Types operator +(Types x, Types y) { return new CombinedTypes(x, y); } } }
mit
C#
0685b8fb69bd470e01a3e0d8cf0927527c2da82c
Update Palindrome-Checker.cs
DeanCabral/Code-Snippets
Console/Palindrome-Checker.cs
Console/Palindrome-Checker.cs
class Palindrome { static void Main(string[] args) { GetUserInput(); } static void GetUserInput() { string input = ""; string output = ""; Console.Write("Enter a word: "); input = Console.ReadLine(); input = input.ToLower(); output = Palindrome.IsPalindrome(input) ? "This word is a Palindrome. True." : "This word is not a Palindrome. False."; Console.WriteLine(output); Console.WriteLine(); GetUserInput(); } static bool IsPalindrome(string word) { List<char> characters = new List<char>(); int count = 0; foreach (char c in word) { characters.Add(c); } for (int i = 0; i < characters.Count; i++) { if (characters[i] == characters[(characters.Count - 1) - i]) count++; } return word.Length == count; } }
class Palindrome { static void Main(string[] args) { GetUserInput(); } static void GetUserInput() { string input = ""; string output = ""; Console.Write("Enter a word: "); input = Console.ReadLine(); input = input.ToLower(); output = Palindrome.IsPalindrome(input) ? "This word is a Palindrome. True." : "This word is not a Palindrome. False."; Console.WriteLine(output); Console.WriteLine(); GetUserInput(); } static bool IsPalindrome(string word) { List<char> characters = new List<char>(); int count = 0; foreach (char c in word) { characters.Add(c); } for (int i = 0; i < characters.Count; i++) { if (characters[i] == characters[(characters.Count - 1) - i]) count++; } return word.Length == count; } }
mit
C#
8031e4874db385b2122f699930027637dd84f118
Add doc comments for Author and Committer
shiftkey/octokit.net,shana/octokit.net,alfhenrik/octokit.net,ivandrofly/octokit.net,eriawan/octokit.net,octokit/octokit.net,hahmed/octokit.net,alfhenrik/octokit.net,thedillonb/octokit.net,M-Zuber/octokit.net,mminns/octokit.net,editor-tools/octokit.net,Sarmad93/octokit.net,rlugojr/octokit.net,octokit-net-test-org/octokit.net,octokit/octokit.net,dampir/octokit.net,SmithAndr/octokit.net,gdziadkiewicz/octokit.net,shiftkey-tester-org-blah-blah/octokit.net,hahmed/octokit.net,SamTheDev/octokit.net,editor-tools/octokit.net,octokit-net-test-org/octokit.net,khellang/octokit.net,chunkychode/octokit.net,gdziadkiewicz/octokit.net,shiftkey-tester/octokit.net,eriawan/octokit.net,devkhan/octokit.net,fake-organization/octokit.net,devkhan/octokit.net,bslliw/octokit.net,dampir/octokit.net,gabrielweyer/octokit.net,thedillonb/octokit.net,chunkychode/octokit.net,SmithAndr/octokit.net,shiftkey-tester/octokit.net,ivandrofly/octokit.net,shiftkey/octokit.net,SamTheDev/octokit.net,gabrielweyer/octokit.net,M-Zuber/octokit.net,khellang/octokit.net,TattsGroup/octokit.net,shana/octokit.net,Sarmad93/octokit.net,TattsGroup/octokit.net,adamralph/octokit.net,rlugojr/octokit.net,mminns/octokit.net,shiftkey-tester-org-blah-blah/octokit.net
Octokit/Models/Response/GitHubCommit.cs
Octokit/Models/Response/GitHubCommit.cs
using System.Collections.Generic; using System.Diagnostics; namespace Octokit { /// <summary> /// An enhanced git commit containing links to additional resources /// </summary> [DebuggerDisplay("{DebuggerDisplay,nq}")] public class GitHubCommit : GitReference { public GitHubCommit() { } public GitHubCommit(string url, string label, string @ref, string sha, User user, Repository repository, Author author, string commentsUrl, Commit commit, Author committer, string htmlUrl, GitHubCommitStats stats, IReadOnlyList<GitReference> parents, IReadOnlyList<GitHubCommitFile> files) : base(url, label, @ref, sha, user, repository) { Author = author; CommentsUrl = commentsUrl; Commit = commit; Committer = committer; HtmlUrl = htmlUrl; Stats = stats; Parents = parents; Files = files; } /// <summary> /// Gets the GitHub account information for the commit author. It attempts to match the email /// address used in the commit with the email addresses registered with the GitHub account. /// If no account corresponds to the commit email, then this property is null. /// </summary> public Author Author { get; protected set; } public string CommentsUrl { get; protected set; } public Commit Commit { get; protected set; } /// <summary> /// Gets the GitHub account information for the commit committer. It attempts to match the email /// address used in the commit with the email addresses registered with the GitHub account. /// If no account corresponds to the commit email, then this property is null. /// </summary> public Author Committer { get; protected set; } public string HtmlUrl { get; protected set; } public GitHubCommitStats Stats { get; protected set; } public IReadOnlyList<GitReference> Parents { get; protected set; } public IReadOnlyList<GitHubCommitFile> Files { get; protected set; } } }
using System.Collections.Generic; using System.Diagnostics; namespace Octokit { /// <summary> /// An enhanced git commit containing links to additional resources /// </summary> [DebuggerDisplay("{DebuggerDisplay,nq}")] public class GitHubCommit : GitReference { public GitHubCommit() { } public GitHubCommit(string url, string label, string @ref, string sha, User user, Repository repository, Author author, string commentsUrl, Commit commit, Author committer, string htmlUrl, GitHubCommitStats stats, IReadOnlyList<GitReference> parents, IReadOnlyList<GitHubCommitFile> files) : base(url, label, @ref, sha, user, repository) { Author = author; CommentsUrl = commentsUrl; Commit = commit; Committer = committer; HtmlUrl = htmlUrl; Stats = stats; Parents = parents; Files = files; } public Author Author { get; protected set; } public string CommentsUrl { get; protected set; } public Commit Commit { get; protected set; } public Author Committer { get; protected set; } public string HtmlUrl { get; protected set; } public GitHubCommitStats Stats { get; protected set; } public IReadOnlyList<GitReference> Parents { get; protected set; } public IReadOnlyList<GitHubCommitFile> Files { get; protected set; } } }
mit
C#
1ccac7c9e48a776afa118a4d44ba5335a598fc83
Check comment values in IniKeyValueTest
aloneguid/config
src/Config.Net.Tests/Stores/Formats/IniKeyValueTest.cs
src/Config.Net.Tests/Stores/Formats/IniKeyValueTest.cs
using Config.Net.Stores.Formats.Ini; using Xunit; namespace Config.Net.Tests.Stores.Formats { public class IniKeyValueTest { [Theory] [InlineData("key=value", "key", "value", null)] [InlineData("key=value;123", "key", "value", "123")] [InlineData("key==value", "key", "=value", null)] [InlineData("key=value;value;value", "key", "value;value", "value")] [InlineData("key=value=value;value", "key", "value=value", "value")] [InlineData("key=value;rest;", "key", "value;rest", "")] public void FromLine_ParsingInlineComments(string input, string expectedKey, string expectedValue, string expectedComment) { IniKeyValue kv = IniKeyValue.FromLine(input, true); Assert.Equal(expectedKey, kv.Key); Assert.Equal(expectedValue, kv.Value); if (expectedComment == null) { Assert.Null(kv.Comment); } else { Assert.Equal(expectedComment, kv.Comment.Value); } } [Theory] [InlineData("key=value", "key", "value")] [InlineData("key=value;123", "key", "value;123")] [InlineData("key==value", "key", "=value")] [InlineData("key=value;value;value", "key", "value;value;value")] [InlineData("key=value=value;value", "key", "value=value;value")] public void FromLine_IgnoringInlineComments(string input, string expectedKey, string expectedValue) { IniKeyValue kv = IniKeyValue.FromLine(input, false); Assert.Equal(expectedKey, kv.Key); Assert.Equal(expectedValue, kv.Value); Assert.Null(kv.Comment); } } }
using Config.Net.Stores.Formats.Ini; using Xunit; namespace Config.Net.Tests.Stores.Formats { public class IniKeyValueTest { [Theory] [InlineData("key=value", "key", "value")] [InlineData("key=value;123", "key", "value")] [InlineData("key==value", "key", "=value")] [InlineData("key=value;value;value", "key", "value;value")] [InlineData("key=value=value;value", "key", "value=value")] public void FromLine_ParsingInlineComments(string input, string expectedKey, string expectedValue) { IniKeyValue kv = IniKeyValue.FromLine(input, true); Assert.Equal(expectedKey, kv.Key); Assert.Equal(expectedValue, kv.Value); } [Theory] [InlineData("key=value", "key", "value")] [InlineData("key=value;123", "key", "value;123")] [InlineData("key==value", "key", "=value")] [InlineData("key=value;value;value", "key", "value;value;value")] [InlineData("key=value=value;value", "key", "value=value;value")] public void FromLine_IgnoringInlineComments(string input, string expectedKey, string expectedValue) { IniKeyValue kv = IniKeyValue.FromLine(input, false); Assert.Equal(expectedKey, kv.Key); Assert.Equal(expectedValue, kv.Value); } } }
mit
C#
a41886a86b451c08447b3c1610b8c504d48e1a31
set default for now to get tests passing
IdentityServer/IdentityServer4.EntityFramework,IdentityServer/IdentityServer4.EntityFramework,IdentityServer/IdentityServer4.EntityFramework,IdentityServer/IdentityServer4.EntityFramework
src/IdentityServer4.EntityFramework/Entities/Client.cs
src/IdentityServer4.EntityFramework/Entities/Client.cs
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved. // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. using System.Collections.Generic; using static IdentityServer4.IdentityServerConstants; namespace IdentityServer4.EntityFramework.Entities { public class Client { public int Id { get; set; } public string ClientId { get; set; } public string ProtocolType { get; set; } = ProtocolTypes.OpenIdConnect; public string ClientName { get; set; } public bool Enabled { get; set; } public List<ClientSecret> ClientSecrets { get; set; } public bool RequireClientSecret { get; set; } public string ClientUri { get; set; } public string LogoUri { get; set; } public bool RequireConsent { get; set; } public bool AllowRememberConsent { get; set; } public List<ClientGrantType> AllowedGrantTypes { get; set; } public bool RequirePkce { get; set; } public bool AllowPlainTextPkce { get; set; } public bool AllowAccessTokensViaBrowser { get; set; } public List<ClientRedirectUri> RedirectUris { get; set; } public List<ClientPostLogoutRedirectUri> PostLogoutRedirectUris { get; set; } public string LogoutUri { get; set; } public bool LogoutSessionRequired { get; set; } public bool AllowAccessToAllScopes { get; set; } public List<ClientScope> AllowedScopes { get; set; } public int IdentityTokenLifetime { get; set; } public int AccessTokenLifetime { get; set; } public int AuthorizationCodeLifetime { get; set; } public int AbsoluteRefreshTokenLifetime { get; set; } public int SlidingRefreshTokenLifetime { get; set; } public int RefreshTokenUsage { get; set; } public bool UpdateAccessTokenClaimsOnRefresh { get; set; } public int RefreshTokenExpiration { get; set; } public int AccessTokenType { get; set; } public bool EnableLocalLogin { get; set; } public List<ClientIdPRestriction> IdentityProviderRestrictions { get; set; } public bool IncludeJwtId { get; set; } public List<ClientClaim> Claims { get; set; } public bool AlwaysSendClientClaims { get; set; } public bool PrefixClientClaims { get; set; } public List<ClientCorsOrigin> AllowedCorsOrigins { get; set; } } }
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved. // Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. using System.Collections.Generic; namespace IdentityServer4.EntityFramework.Entities { public class Client { public int Id { get; set; } public string ClientId { get; set; } public string ProtocolType { get; set; } public string ClientName { get; set; } public bool Enabled { get; set; } public List<ClientSecret> ClientSecrets { get; set; } public bool RequireClientSecret { get; set; } public string ClientUri { get; set; } public string LogoUri { get; set; } public bool RequireConsent { get; set; } public bool AllowRememberConsent { get; set; } public List<ClientGrantType> AllowedGrantTypes { get; set; } public bool RequirePkce { get; set; } public bool AllowPlainTextPkce { get; set; } public bool AllowAccessTokensViaBrowser { get; set; } public List<ClientRedirectUri> RedirectUris { get; set; } public List<ClientPostLogoutRedirectUri> PostLogoutRedirectUris { get; set; } public string LogoutUri { get; set; } public bool LogoutSessionRequired { get; set; } public bool AllowAccessToAllScopes { get; set; } public List<ClientScope> AllowedScopes { get; set; } public int IdentityTokenLifetime { get; set; } public int AccessTokenLifetime { get; set; } public int AuthorizationCodeLifetime { get; set; } public int AbsoluteRefreshTokenLifetime { get; set; } public int SlidingRefreshTokenLifetime { get; set; } public int RefreshTokenUsage { get; set; } public bool UpdateAccessTokenClaimsOnRefresh { get; set; } public int RefreshTokenExpiration { get; set; } public int AccessTokenType { get; set; } public bool EnableLocalLogin { get; set; } public List<ClientIdPRestriction> IdentityProviderRestrictions { get; set; } public bool IncludeJwtId { get; set; } public List<ClientClaim> Claims { get; set; } public bool AlwaysSendClientClaims { get; set; } public bool PrefixClientClaims { get; set; } public List<ClientCorsOrigin> AllowedCorsOrigins { get; set; } } }
apache-2.0
C#
94022e12b814a7d30b1b74257f7f10b53525a099
Update version number
GibraltarSoftware/Gibraltar.Agent.EntityFramework
src/Agent.EntityFramework/Properties/AssemblyInfo.cs
src/Agent.EntityFramework/Properties/AssemblyInfo.cs
#region File Header and License // /* // AssemblyInfo.cs // Copyright 2013 Gibraltar Software, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // */ #endregion using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Loupe Agent for Entity Framework 6")] [assembly: AssemblyDescription("Extends Entity Framework to capture diagnostic and performance information with Loupe")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Gibraltar Software, Inc.")] [assembly: AssemblyProduct("Gibraltar.Agent.EntityFramework")] [assembly: AssemblyCopyright("Copyright © 2013-2018 Gibraltar Software, Inc.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("b328afaa-b838-413d-b2be-9492ca12dde3")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("4.0.0.0")] [assembly: AssemblyFileVersion("4.6.4.0")] //releases are sych'ed up to Loupe build numbers [assembly: AssemblyInformationalVersion("4.6.4.0")] //releases are sych'ed up to Loupe build numbers
#region File Header and License // /* // AssemblyInfo.cs // Copyright 2013 Gibraltar Software, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // */ #endregion using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Loupe Agent for Entity Framework 6")] [assembly: AssemblyDescription("Extends Entity Framework to capture diagnostic and performance information with Loupe")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Gibraltar Software, Inc.")] [assembly: AssemblyProduct("Gibraltar.Agent.EntityFramework")] [assembly: AssemblyCopyright("Copyright © 2013-2015 Gibraltar Software, Inc.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("b328afaa-b838-413d-b2be-9492ca12dde3")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("4.0.0.0")] [assembly: AssemblyFileVersion("4.0.0.3015")] //releases are sych'ed up to Loupe build numbers [assembly: AssemblyInformationalVersion("4.0.0.3015")] //releases are sych'ed up to Loupe build numbers
apache-2.0
C#
1680c646de4530c993af00fa9e37a086157d5dd3
Fix region test
appharbor/appharbor-cli
src/AppHarbor.Tests/Commands/CreateAppCommandTest.cs
src/AppHarbor.Tests/Commands/CreateAppCommandTest.cs
using System.IO; using System.Linq; using AppHarbor.Commands; using AppHarbor.Model; using Moq; using Ploeh.AutoFixture.Xunit; using Xunit; using Xunit.Extensions; namespace AppHarbor.Tests.Commands { public class CreateAppCommandTest { [Theory, AutoCommandData] public void ShouldThrowWhenNoArguments(CreateAppCommand command) { var exception = Assert.Throws<CommandException>(() => command.Execute(new string[0])); Assert.Equal("An application name must be provided to create an application", exception.Message); } [Theory, AutoCommandData] public void ShouldCreateApplicationWithOnlyName([Frozen]Mock<IAppHarborClient> client, CreateAppCommand command) { var arguments = new string[] { "foo" }; command.Execute(arguments); client.Verify(x => x.CreateApplication(arguments.First(), arguments.Skip(1).FirstOrDefault()), Times.Once()); } [Theory, AutoCommandData] public void ShouldSetRegionIsSpecified([Frozen]Mock<IAppHarborClient> client, [Frozen]Mock<TextWriter> writer, Mock<CreateAppCommand> command, string regionName, string applicationSlug) { client.Setup(x => x.CreateApplication(applicationSlug, regionName)).Returns(new CreateResult { Id = applicationSlug }); command.Object.Execute(new string[] { applicationSlug, "-r", regionName }); client.VerifyAll(); } [Theory, AutoCommandData] public void ShouldSetupApplicationLocallyAfterCreationIfNotConfigured([Frozen]Mock<IApplicationConfiguration> applicationConfiguration, [Frozen]Mock<IAppHarborClient> client, CreateAppCommand command, CreateResult result, User user, string[] arguments) { client.Setup(x => x.CreateApplication(It.IsAny<string>(), It.IsAny<string>())).Returns(result); client.Setup(x => x.GetUser()).Returns(user); applicationConfiguration.Setup(x => x.GetApplicationId()).Throws<ApplicationConfigurationException>(); command.Execute(arguments); applicationConfiguration.Verify(x => x.SetupApplication(result.Id, user), Times.Once()); } [Theory, AutoCommandData] public void ShouldNotSetupApplicationIfAlreadyConfigured([Frozen]Mock<IApplicationConfiguration> applicationConfiguration, [Frozen]Mock<TextWriter> writer, CreateAppCommand command, string[] arguments, string applicationName) { applicationConfiguration.Setup(x => x.GetApplicationId()).Returns(applicationName); command.Execute(arguments); writer.Verify(x => x.WriteLine("This directory is already configured to track application \"{0}\".", applicationName), Times.Once()); } [Theory, AutoCommandData] public void ShouldPrintSuccessMessageAfterCreatingApplication([Frozen]Mock<IAppHarborClient> client, [Frozen]Mock<TextWriter> writer, Mock<CreateAppCommand> command, string applicationName, string applicationSlug) { client.Setup(x => x.CreateApplication(applicationName, null)).Returns(new CreateResult { Id = applicationSlug }); command.Object.Execute(new string[] { applicationName }); writer.Verify(x => x.WriteLine("Created application \"{0}\" | URL: https://{0}.apphb.com", applicationSlug), Times.Once()); } } }
using System.IO; using System.Linq; using AppHarbor.Commands; using AppHarbor.Model; using Moq; using Ploeh.AutoFixture.Xunit; using Xunit; using Xunit.Extensions; namespace AppHarbor.Tests.Commands { public class CreateAppCommandTest { [Theory, AutoCommandData] public void ShouldThrowWhenNoArguments(CreateAppCommand command) { var exception = Assert.Throws<CommandException>(() => command.Execute(new string[0])); Assert.Equal("An application name must be provided to create an application", exception.Message); } [Theory, AutoCommandData] public void ShouldCreateApplicationWithOnlyName([Frozen]Mock<IAppHarborClient> client, CreateAppCommand command) { var arguments = new string[] { "foo" }; VerifyArguments(client, command, arguments); } [Theory, AutoCommandData] public void ShouldCreateApplicationWithRegion([Frozen]Mock<IAppHarborClient> client, CreateAppCommand command, string[] arguments) { VerifyArguments(client, command, arguments); } private static void VerifyArguments(Mock<IAppHarborClient> client, CreateAppCommand command, string[] arguments) { command.Execute(arguments); client.Verify(x => x.CreateApplication(arguments.First(), arguments.Skip(1).FirstOrDefault()), Times.Once()); } [Theory, AutoCommandData] public void ShouldSetupApplicationLocallyAfterCreationIfNotConfigured([Frozen]Mock<IApplicationConfiguration> applicationConfiguration, [Frozen]Mock<IAppHarborClient> client, CreateAppCommand command, CreateResult result, User user, string[] arguments) { client.Setup(x => x.CreateApplication(It.IsAny<string>(), It.IsAny<string>())).Returns(result); client.Setup(x => x.GetUser()).Returns(user); applicationConfiguration.Setup(x => x.GetApplicationId()).Throws<ApplicationConfigurationException>(); command.Execute(arguments); applicationConfiguration.Verify(x => x.SetupApplication(result.Id, user), Times.Once()); } [Theory, AutoCommandData] public void ShouldNotSetupApplicationIfAlreadyConfigured([Frozen]Mock<IApplicationConfiguration> applicationConfiguration, [Frozen]Mock<TextWriter> writer, CreateAppCommand command, string[] arguments, string applicationName) { applicationConfiguration.Setup(x => x.GetApplicationId()).Returns(applicationName); command.Execute(arguments); writer.Verify(x => x.WriteLine("This directory is already configured to track application \"{0}\".", applicationName), Times.Once()); } [Theory, AutoCommandData] public void ShouldPrintSuccessMessageAfterCreatingApplication([Frozen]Mock<IAppHarborClient> client, [Frozen]Mock<TextWriter> writer, Mock<CreateAppCommand> command, string applicationName, string applicationSlug) { client.Setup(x => x.CreateApplication(applicationName, null)).Returns(new CreateResult { Id = applicationSlug }); command.Object.Execute(new string[] { applicationName }); writer.Verify(x => x.WriteLine("Created application \"{0}\" | URL: https://{0}.apphb.com", applicationSlug), Times.Once()); } [Theory, AutoCommandData] public void ShouldSetRegionIsSpecified([Frozen]Mock<IAppHarborClient> client, [Frozen]Mock<TextWriter> writer, Mock<CreateAppCommand> command, string regionName, string applicationSlug) { client.Setup(x => x.CreateApplication(applicationSlug, regionName)).Returns(new CreateResult { Id = applicationSlug }); command.Object.Execute(new string[] { applicationSlug, "-r", regionName }); client.VerifyAll(); } } }
mit
C#
7ddadfd5464e8de508a457314a4c47e2cfdceb9f
Remove CornerRadius prop from MenuFlyoutPresenter
SuperJMN/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,SuperJMN/Avalonia,SuperJMN/Avalonia
src/Avalonia.Controls/Flyouts/MenuFlyoutPresenter.cs
src/Avalonia.Controls/Flyouts/MenuFlyoutPresenter.cs
using System; using Avalonia.Controls.Generators; using Avalonia.Controls.Platform; using Avalonia.Controls.Primitives; using Avalonia.LogicalTree; namespace Avalonia.Controls { public class MenuFlyoutPresenter : MenuBase { public MenuFlyoutPresenter() :base(new DefaultMenuInteractionHandler(true)) { } public override void Close() { // DefaultMenuInteractionHandler calls this var host = this.FindLogicalAncestorOfType<Popup>(); if (host != null) { SelectedIndex = -1; host.IsOpen = false; } } public override void Open() { throw new NotSupportedException("Use MenuFlyout.ShowAt(Control) instead"); } protected override IItemContainerGenerator CreateItemContainerGenerator() { return new MenuItemContainerGenerator(this); } protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e) { base.OnDetachedFromVisualTree(e); foreach (var i in LogicalChildren) { if (i is MenuItem menuItem) { menuItem.IsSubMenuOpen = false; } } } } }
using System; using Avalonia.Controls.Generators; using Avalonia.Controls.Platform; using Avalonia.Controls.Primitives; using Avalonia.LogicalTree; namespace Avalonia.Controls { public class MenuFlyoutPresenter : MenuBase { public static readonly StyledProperty<CornerRadius> CornerRadiusProperty = Border.CornerRadiusProperty.AddOwner<FlyoutPresenter>(); public CornerRadius CornerRadius { get => GetValue(CornerRadiusProperty); set => SetValue(CornerRadiusProperty, value); } public MenuFlyoutPresenter() :base(new DefaultMenuInteractionHandler(true)) { } public override void Close() { // DefaultMenuInteractionHandler calls this var host = this.FindLogicalAncestorOfType<Popup>(); if (host != null) { SelectedIndex = -1; host.IsOpen = false; } } public override void Open() { throw new NotSupportedException("Use MenuFlyout.ShowAt(Control) instead"); } protected override IItemContainerGenerator CreateItemContainerGenerator() { return new MenuItemContainerGenerator(this); } protected override void OnDetachedFromVisualTree(VisualTreeAttachmentEventArgs e) { base.OnDetachedFromVisualTree(e); foreach (var i in LogicalChildren) { if (i is MenuItem menuItem) { menuItem.IsSubMenuOpen = false; } } } } }
mit
C#
9f4fa7b2f98e8833fb244088c19af810ad3debfc
Fix race in VBCSCompiler test
wvdd007/roslyn,KirillOsenkov/roslyn,CyrusNajmabadi/roslyn,reaction1989/roslyn,eriawan/roslyn,AlekseyTs/roslyn,reaction1989/roslyn,eriawan/roslyn,tannergooding/roslyn,heejaechang/roslyn,tannergooding/roslyn,bartdesmet/roslyn,aelij/roslyn,AmadeusW/roslyn,weltkante/roslyn,shyamnamboodiripad/roslyn,wvdd007/roslyn,sharwell/roslyn,shyamnamboodiripad/roslyn,brettfo/roslyn,panopticoncentral/roslyn,gafter/roslyn,eriawan/roslyn,heejaechang/roslyn,mgoertz-msft/roslyn,stephentoub/roslyn,CyrusNajmabadi/roslyn,tannergooding/roslyn,bartdesmet/roslyn,diryboy/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,jmarolf/roslyn,aelij/roslyn,weltkante/roslyn,ErikSchierboom/roslyn,KevinRansom/roslyn,mgoertz-msft/roslyn,panopticoncentral/roslyn,diryboy/roslyn,physhi/roslyn,jmarolf/roslyn,reaction1989/roslyn,wvdd007/roslyn,ErikSchierboom/roslyn,KirillOsenkov/roslyn,stephentoub/roslyn,KevinRansom/roslyn,physhi/roslyn,davkean/roslyn,genlu/roslyn,ErikSchierboom/roslyn,jasonmalinowski/roslyn,mavasani/roslyn,gafter/roslyn,mavasani/roslyn,mgoertz-msft/roslyn,KirillOsenkov/roslyn,bartdesmet/roslyn,mavasani/roslyn,KevinRansom/roslyn,tmat/roslyn,CyrusNajmabadi/roslyn,AmadeusW/roslyn,dotnet/roslyn,tmat/roslyn,AmadeusW/roslyn,jasonmalinowski/roslyn,dotnet/roslyn,gafter/roslyn,tmat/roslyn,weltkante/roslyn,physhi/roslyn,genlu/roslyn,panopticoncentral/roslyn,jmarolf/roslyn,heejaechang/roslyn,diryboy/roslyn,davkean/roslyn,dotnet/roslyn,sharwell/roslyn,aelij/roslyn,stephentoub/roslyn,brettfo/roslyn,sharwell/roslyn,davkean/roslyn,brettfo/roslyn,genlu/roslyn,AlekseyTs/roslyn,AlekseyTs/roslyn
src/Compilers/Server/VBCSCompilerTests/Extensions.cs
src/Compilers/Server/VBCSCompilerTests/Extensions.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace Microsoft.CodeAnalysis.CompilerServer.UnitTests { internal static class Extensions { public static Task ToTask(this WaitHandle handle, int? timeoutMilliseconds) { RegisteredWaitHandle registeredHandle = null; var tcs = new TaskCompletionSource<object>(); registeredHandle = ThreadPool.RegisterWaitForSingleObject( handle, (_, timeout) => { tcs.TrySetResult(null); if (registeredHandle is object) { registeredHandle.Unregister(waitObject: null); } }, null, timeoutMilliseconds ?? -1, executeOnlyOnce: true); return tcs.Task; } public static async Task WaitOneAsync(this WaitHandle handle, int? timeoutMilliseconds = null) => await handle.ToTask(timeoutMilliseconds); public static async ValueTask<T> TakeAsync<T>(this BlockingCollection<T> collection, TimeSpan? pollTimeSpan = null, CancellationToken cancellationToken = default) { var delay = pollTimeSpan ?? TimeSpan.FromSeconds(.25); do { if (collection.TryTake(out T value)) { return value; } await Task.Delay(delay, cancellationToken).ConfigureAwait(false); cancellationToken.ThrowIfCancellationRequested(); } while (true); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; namespace Microsoft.CodeAnalysis.CompilerServer.UnitTests { internal static class Extensions { public static Task<bool> ToTask(this WaitHandle handle, int? timeoutMilliseconds) { RegisteredWaitHandle registeredHandle = null; var tcs = new TaskCompletionSource<bool>(); registeredHandle = ThreadPool.RegisterWaitForSingleObject( handle, (_, timedOut) => { tcs.TrySetResult(!timedOut); if (!timedOut) { registeredHandle.Unregister(waitObject: null); } }, null, timeoutMilliseconds ?? -1, executeOnlyOnce: true); return tcs.Task; } public static async Task<bool> WaitOneAsync(this WaitHandle handle, int? timeoutMilliseconds = null) => await handle.ToTask(timeoutMilliseconds); public static async ValueTask<T> TakeAsync<T>(this BlockingCollection<T> collection, TimeSpan? pollTimeSpan = null, CancellationToken cancellationToken = default) { var delay = pollTimeSpan ?? TimeSpan.FromSeconds(.25); do { if (collection.TryTake(out T value)) { return value; } await Task.Delay(delay, cancellationToken).ConfigureAwait(false); cancellationToken.ThrowIfCancellationRequested(); } while (true); } } }
mit
C#
b5c3d7ed80971e8df3a72a7b8654453594a8fdf1
add directories, which only contain the git repository
anyeloamt1/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,willdean/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,Monepi/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,jiangzm/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,Monepi/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,hakim89/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,YelaSeamless/Bonobo-Git-Server,KiritoStudio/Bonobo-Git-Server,dunderburken/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,Monepi/Bonobo-Git-Server,snoopydo/Bonobo-Git-Server,larshg/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,lkho/Bonobo-Git-Server,dunderburken/Bonobo-Git-Server,forgetz/Bonobo-Git-Server,yonglehou/Bonobo-Git-Server,yonglehou/Bonobo-Git-Server,kfarnung/Bonobo-Git-Server,YelaSeamless/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,Acute-sales-ltd/Bonobo-Git-Server,willdean/Bonobo-Git-Server,hakim89/Bonobo-Git-Server,darioajr/Bonobo-Git-Server,RedX2501/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,kfarnung/Bonobo-Git-Server,RedX2501/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,RedX2501/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,willdean/Bonobo-Git-Server,lkho/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,KiritoStudio/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,hakim89/Bonobo-Git-Server,Monepi/Bonobo-Git-Server,crowar/Bonobo-Git-Server,KiritoStudio/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,yonglehou/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,snoopydo/Bonobo-Git-Server,darioajr/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,larshg/Bonobo-Git-Server,braegelno5/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,dunderburken/Bonobo-Git-Server,gencer/Bonobo-Git-Server,snoopydo/Bonobo-Git-Server,KiritoStudio/Bonobo-Git-Server,jiangzm/Bonobo-Git-Server,gencer/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,YelaSeamless/Bonobo-Git-Server,jiangzm/Bonobo-Git-Server,yonglehou/Bonobo-Git-Server,larrynung/Bonobo-Git-Server,braegelno5/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,larshg/Bonobo-Git-Server,willdean/Bonobo-Git-Server,yonglehou/Bonobo-Git-Server,larrynung/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,YelaSeamless/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,hakim89/Bonobo-Git-Server,anyeloamt1/Bonobo-Git-Server,crowar/Bonobo-Git-Server,kfarnung/Bonobo-Git-Server,snoopydo/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,dunderburken/Bonobo-Git-Server,braegelno5/Bonobo-Git-Server,crowar/Bonobo-Git-Server,larrynung/Bonobo-Git-Server,dunderburken/Bonobo-Git-Server,darioajr/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,larshg/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,Monepi/Bonobo-Git-Server,jiangzm/Bonobo-Git-Server,snoopydo/Bonobo-Git-Server,darioajr/Bonobo-Git-Server,crowar/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,larrynung/Bonobo-Git-Server,gencer/Bonobo-Git-Server,Acute-sales-ltd/Bonobo-Git-Server,lkho/Bonobo-Git-Server,kfarnung/Bonobo-Git-Server,hakim89/Bonobo-Git-Server,yonglehou/Bonobo-Git-Server,YelaSeamless/Bonobo-Git-Server,NipponSysits/IIS.Git-Connector,jiangzm/Bonobo-Git-Server,darioajr/Bonobo-Git-Server,willdean/Bonobo-Git-Server,YelaSeamless/Bonobo-Git-Server,PGM-NipponSysits/IIS.Git-Connector,snoopydo/Bonobo-Git-Server,crowar/Bonobo-Git-Server,RedX2501/Bonobo-Git-Server,lkho/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,igoryok-zp/Bonobo-Git-Server,Webmine/Bonobo-Git-Server,hakim89/Bonobo-Git-Server,larrynung/Bonobo-Git-Server,dunderburken/Bonobo-Git-Server,larrynung/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,KiritoStudio/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,padremortius/Bonobo-Git-Server,Ollienator/Bonobo-Git-Server,gencer/Bonobo-Git-Server,KiritoStudio/Bonobo-Git-Server,crowar/Bonobo-Git-Server,braegelno5/Bonobo-Git-Server,jiangzm/Bonobo-Git-Server,darioajr/Bonobo-Git-Server,Monepi/Bonobo-Git-Server
Bonobo.Git.Server/Data/Update/RepositorySynchronizer.cs
Bonobo.Git.Server/Data/Update/RepositorySynchronizer.cs
using Bonobo.Git.Server.Configuration; using Bonobo.Git.Server.Models; using LibGit2Sharp; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Web.Mvc; namespace Bonobo.Git.Server.Data.Update { public class RepositorySynchronizer { IRepositoryRepository _repositoryRepository = DependencyResolver.Current.GetService<IRepositoryRepository>(); public virtual void Run() { CheckForNewRepositories(); } private void CheckForNewRepositories() { IEnumerable<string> directories = Directory.EnumerateDirectories(UserConfiguration.Current.Repositories); foreach (string directory in directories) { string name = Path.GetFileName(directory); RepositoryModel repository = _repositoryRepository.GetRepository(name); if (repository == null) { if (LibGit2Sharp.Repository.IsValid(directory)) { repository = new RepositoryModel(); repository.Description = "Discovered in file system."; repository.Name = name; repository.AnonymousAccess = false; _repositoryRepository.Create(repository); } } } } } }
using Bonobo.Git.Server.Configuration; using Bonobo.Git.Server.Models; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Web.Mvc; namespace Bonobo.Git.Server.Data.Update { public class RepositorySynchronizer { IRepositoryRepository _repositoryRepository = DependencyResolver.Current.GetService<IRepositoryRepository>(); public virtual void Run() { CheckForNewRepositories(); } private void CheckForNewRepositories() { IEnumerable<string> directories = Directory.EnumerateDirectories(UserConfiguration.Current.Repositories); foreach (string directory in directories) { string name = Path.GetFileName(directory); RepositoryModel repository = _repositoryRepository.GetRepository(name); if (repository == null) { repository = new RepositoryModel(); repository.Description = "Discovered in file system."; repository.Name = name; repository.AnonymousAccess = false; _repositoryRepository.Create(repository); } } } } }
mit
C#
34dea9c54c6f99c97f54649f4641af5e859d7fd8
Fix StyleCop errors
kant2002/Dub
Dub/Dub.Web.Mvc/CordovaAuthenticationFilterAttribute.cs
Dub/Dub.Web.Mvc/CordovaAuthenticationFilterAttribute.cs
// ----------------------------------------------------------------------- // <copyright file="CordovaAuthenticationFilterAttribute.cs" company="Andrey Kurdiumov"> // Copyright (c) Andrey Kurdiumov. All rights reserved. // </copyright> // ----------------------------------------------------------------------- namespace Dub.Web.Mvc { using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Web.Http.Controllers; using System.Web.Http.Filters; using Microsoft.Owin.Security.DataProtection; /// <summary> /// Authentication filter which use custom header for sending authentication token. /// </summary> public class CordovaAuthenticationFilterAttribute : AuthorizationFilterAttribute { /// <summary> /// Custom header for the API key. /// </summary> public const string DefaultAuthenticationHeader = "X-Auth-Token"; /// <summary> /// Initializes a new instance of the <see cref="CordovaAuthenticationFilterAttribute"/> class. /// </summary> /// <param name="header">HTTP header used for the delivering authentication header.</param> public CordovaAuthenticationFilterAttribute(string header = DefaultAuthenticationHeader) { this.AuthenticationHeader = header; } /// <summary> /// Gets or sets authentication header which used for delivering security token. /// </summary> public string AuthenticationHeader { get; set; } /// <summary> /// Calls when a process requests authorization. /// </summary> /// <param name="actionContext">The action context, which encapsulates information for using <see cref="AuthorizationFilterAttribute"/>.</param> public override void OnAuthorization(HttpActionContext actionContext) { base.OnAuthorization(actionContext); } } }
namespace Dub.Web.Mvc { using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Web.Http.Controllers; using System.Web.Http.Filters; using Microsoft.Owin.Security.DataProtection; /// <summary> /// Authentication filter which use custom header for sending authentication token. /// </summary> public class CordovaAuthenticationFilterAttribute : AuthorizationFilterAttribute { /// <summary> /// Custom header for the API key. /// </summary> public const string DefaultAuthenticationHeader = "X-Auth-Token"; /// <summary> /// Initialize a new instance of the <see cref="CordovaAuthenticationFilterAttribute"/> class. /// </summary> /// <param name="header">HTTP header used for the delivering authentication header.</param> public CordovaAuthenticationFilterAttribute(string header = DefaultAuthenticationHeader) { this.AuthenticationHeader = header; } /// <summary> /// Gets or sets authentication header which used for delivering security token. /// </summary> public string AuthenticationHeader { get; set; } /// <summary> /// Calls when a process requests authorization. /// </summary> /// <param name="actionContext">The action context, which encapsulates information for using <see cref="AuthorizationFilterAttribute"/>.</param> public override void OnAuthorization(HttpActionContext actionContext) { base.OnAuthorization(actionContext); } } }
apache-2.0
C#
4176e35e316789b4b3659743a7bc4cfebe1adb5c
Resolve #617 -- Re-enable commented tests (#744)
LeagueSandbox/GameServer
GameServerLibTests/Tests/Chatbox/ChatboxManagerTests.cs
GameServerLibTests/Tests/Chatbox/ChatboxManagerTests.cs
using LeagueSandbox.GameServer; using LeagueSandbox.GameServer.Chatbox; using LeagueSandbox.GameServer.Content; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace LeagueSandbox.GameServerTests.Tests.Chatbox { [TestClass] public class ChatboxManagerTests { private readonly Game _game = new Game(new ItemManager()); [TestMethod] public void AddCommandTest() { var chatboxManager = new ChatCommandManager(_game); var command = new TestCommand(_game, chatboxManager, "ChatboxManagerTestsTestCommand", ""); var result = chatboxManager.AddCommand(command); Assert.AreEqual(true, result); result = chatboxManager.AddCommand(command); Assert.AreEqual(false, result); } [TestMethod] public void RemoveCommandTest() { var chatboxManager = new ChatCommandManager(_game); var command = new TestCommand(_game, chatboxManager, "ChatboxManagerTestsTestCommand", ""); var result = chatboxManager.AddCommand(command); Assert.AreEqual(true, result); var result2 = chatboxManager.RemoveCommand("ChatboxManagerTestsTestCommand"); var commands = chatboxManager.GetCommandsStrings(); Assert.AreEqual(true, result2); if (commands.Contains("ChatboxManagerTestsTestCommand")) { Assert.Fail(); } } } }
using Microsoft.VisualStudio.TestTools.UnitTesting; namespace LeagueSandbox.GameServerTests.Tests.Chatbox { [TestClass] public class ChatboxManagerTests { [TestMethod] public void AddCommandTest() { /* var chatboxManager = _kernel.Get<ChatCommandManager>(); var command = new TestCommand(chatboxManager, "ChatboxManagerTestsTestCommand", ""); var result = chatboxManager.AddCommand(command); Assert.AreEqual(true, result); result = chatboxManager.AddCommand(command); Assert.AreEqual(false, result); */ } [TestMethod] public void RemoveCommandTest() { /* var chatboxManager = _kernel.Get<ChatCommandManager>(); var command = new TestCommand(chatboxManager, "ChatboxManagerTestsTestCommand", ""); var result = chatboxManager.AddCommand(command); Assert.AreEqual(true, result); var result2 = chatboxManager.RemoveCommand("ChatboxManagerTestsTestCommand"); var commands = chatboxManager.GetCommandsStrings(); Assert.AreEqual(true, result2); if (commands.Contains("ChatboxManagerTestsTestCommand")) { Assert.Fail(); } */ } } }
agpl-3.0
C#
bdc61e43b3dd976ebe193b7babb1576bb676af0d
Fix HideHoldOutPlugin.cs
Nogrod/Oxide-2,bawNg/Oxide,LaserHydra/Oxide,Nogrod/Oxide-2,bawNg/Oxide,Visagalis/Oxide,LaserHydra/Oxide,Visagalis/Oxide
Games/Unity/Oxide.Game.HideHoldOut/HideHoldOutPlugin.cs
Games/Unity/Oxide.Game.HideHoldOut/HideHoldOutPlugin.cs
using Oxide.Core; using Oxide.Core.Plugins; using Oxide.Game.HideHoldOut.Libraries; namespace Oxide.Plugins { public abstract class HideHoldOutPlugin : CSharpPlugin { protected Command cmd; protected HideHoldOut h2o; public override void SetPluginInfo(string name, string path) { base.SetPluginInfo(name, path); cmd = Interface.Oxide.GetLibrary<Command>(); h2o = Interface.Oxide.GetLibrary<HideHoldOut>("H2o"); } public override void HandleAddedToManager(PluginManager manager) { foreach (var method in GetType().GetMethods(BindingFlags.NonPublic | BindingFlags.Instance)) { var attributes = method.GetCustomAttributes(typeof(ConsoleCommandAttribute), true); if (attributes.Length > 0) { var attribute = attributes[0] as ConsoleCommandAttribute; cmd.AddConsoleCommand(attribute?.Command, this, method.Name); continue; } attributes = method.GetCustomAttributes(typeof(ChatCommandAttribute), true); if (attributes.Length > 0) { var attribute = attributes[0] as ChatCommandAttribute; cmd.AddChatCommand(attribute?.Command, this, method.Name); } } base.HandleAddedToManager(manager); } } }
using Oxide.Core; using Oxide.Game.HideHoldOut.Libraries; namespace Oxide.Plugins { public abstract class HideHoldOutPlugin : CSharpPlugin { protected Command cmd; protected HideHoldOut h2o; public override void SetPluginInfo(string name, string path) { base.SetPluginInfo(name, path); cmd = Interface.Oxide.GetLibrary<Command>(); h2o = Interface.Oxide.GetLibrary<HideHoldOut>("H2o"); } public override void HandleAddedToManager(PluginManager manager) { foreach (var method in GetType().GetMethods(BindingFlags.NonPublic | BindingFlags.Instance)) { var attributes = method.GetCustomAttributes(typeof(ConsoleCommandAttribute), true); if (attributes.Length > 0) { var attribute = attributes[0] as ConsoleCommandAttribute; cmd.AddConsoleCommand(attribute?.Command, this, method.Name); continue; } attributes = method.GetCustomAttributes(typeof(ChatCommandAttribute), true); if (attributes.Length > 0) { var attribute = attributes[0] as ChatCommandAttribute; cmd.AddChatCommand(attribute?.Command, this, method.Name); } } base.HandleAddedToManager(manager); } } }
mit
C#
255fc29f75e8dfc63f7bf51808b7fff92fbb84ec
Fix mono bug in the FontHelper class
ermshiperete/libpalaso,sillsdev/libpalaso,darcywong00/libpalaso,andrew-polk/libpalaso,gmartin7/libpalaso,mccarthyrb/libpalaso,andrew-polk/libpalaso,tombogle/libpalaso,glasseyes/libpalaso,hatton/libpalaso,gmartin7/libpalaso,gtryus/libpalaso,ermshiperete/libpalaso,mccarthyrb/libpalaso,mccarthyrb/libpalaso,sillsdev/libpalaso,hatton/libpalaso,mccarthyrb/libpalaso,andrew-polk/libpalaso,marksvc/libpalaso,ddaspit/libpalaso,gmartin7/libpalaso,gtryus/libpalaso,JohnThomson/libpalaso,chrisvire/libpalaso,andrew-polk/libpalaso,chrisvire/libpalaso,gmartin7/libpalaso,JohnThomson/libpalaso,darcywong00/libpalaso,marksvc/libpalaso,chrisvire/libpalaso,ddaspit/libpalaso,ddaspit/libpalaso,glasseyes/libpalaso,tombogle/libpalaso,chrisvire/libpalaso,marksvc/libpalaso,sillsdev/libpalaso,hatton/libpalaso,tombogle/libpalaso,gtryus/libpalaso,ddaspit/libpalaso,ermshiperete/libpalaso,JohnThomson/libpalaso,darcywong00/libpalaso,ermshiperete/libpalaso,hatton/libpalaso,glasseyes/libpalaso,glasseyes/libpalaso,tombogle/libpalaso,gtryus/libpalaso,sillsdev/libpalaso,JohnThomson/libpalaso
PalasoUIWindowsForms.Tests/FontTests/FontHelperTests.cs
PalasoUIWindowsForms.Tests/FontTests/FontHelperTests.cs
using System; using System.Drawing; using System.Linq; using NUnit.Framework; using Palaso.UI.WindowsForms; namespace PalasoUIWindowsForms.Tests.FontTests { [TestFixture] public class FontHelperTests { [SetUp] public void SetUp() { // setup code goes here } [TearDown] public void TearDown() { // tear down code goes here } [Test] public void MakeFont_FontName_ValidFont() { Font sourceFont = SystemFonts.DefaultFont; Font returnFont = FontHelper.MakeFont(sourceFont.FontFamily.Name); Assert.AreEqual(sourceFont.FontFamily.Name, returnFont.FontFamily.Name); } [Test] public void MakeFont_FontNameAndStyle_ValidFont() { // use Times New Roman foreach (var family in FontFamily.Families.Where(family => family.Name == "Times New Roman")) { Font sourceFont = new Font(family, 10f, FontStyle.Regular); Font returnFont = FontHelper.MakeFont(sourceFont, FontStyle.Bold); Assert.AreEqual(sourceFont.FontFamily.Name, returnFont.FontFamily.Name); Assert.AreEqual(FontStyle.Bold, returnFont.Style & FontStyle.Bold); break; } } } }
using System; using System.Drawing; using NUnit.Framework; using Palaso.UI.WindowsForms; namespace PalasoUIWindowsForms.Tests.FontTests { [TestFixture] public class FontHelperTests { [SetUp] public void SetUp() { // setup code goes here } [TearDown] public void TearDown() { // tear down code goes here } [Test] public void MakeFont_FontAndStyle_ValidFont() { Font sourceFont = SystemFonts.DefaultFont; Font returnFont = FontHelper.MakeFont(sourceFont, FontStyle.Bold); Assert.AreEqual(sourceFont.FontFamily.Name, returnFont.FontFamily.Name); Assert.AreEqual(FontStyle.Bold, returnFont.Style & FontStyle.Bold); } } }
mit
C#
adefb771ede1feb349cfb5240be7b5403c870d26
add unique index from Name
AlejandroCano/extensions,signumsoftware/framework,signumsoftware/extensions,MehdyKarimpour/extensions,AlejandroCano/extensions,MehdyKarimpour/extensions,signumsoftware/framework,signumsoftware/extensions
Signum.Entities.Extensions/Dynamic/DynamicExpression.cs
Signum.Entities.Extensions/Dynamic/DynamicExpression.cs
using Signum.Entities; using Signum.Entities.Basics; using Signum.Utilities; using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Text; using System.Threading.Tasks; namespace Signum.Entities.Dynamic { [Serializable, EntityKind(EntityKind.Main, EntityData.Transactional)] public class DynamicExpressionEntity : Entity { [NotNullable, SqlDbType(Size = 100), UniqueIndex] [StringLengthValidator(AllowNulls = false, Min = 3, Max = 100), IdentifierValidator(IdentifierType.PascalAscii)] public string Name { get; set; } [NotNullable, SqlDbType(Size = 100)] [StringLengthValidator(AllowNulls = false, Min = 3, Max = 100)] public string FromType { get; set; } [NotNullable, SqlDbType(Size = 100)] [StringLengthValidator(AllowNulls = false, Min = 3, Max = 100)] public string ReturnType { get; set; } [NotNullable, SqlDbType(Size = int.MaxValue)] [StringLengthValidator(AllowNulls = false, Min = 1, MultiLine = true)] public string Body { get; set; } [SqlDbType(Size = 100)] [StringLengthValidator(AllowNulls = true, Min = 1, Max = 100)] public string Format { get; set; } [SqlDbType(Size = 100)] [StringLengthValidator(AllowNulls = true, Min = 1, Max = 100)] public string Unit { get; set; } public DynamicExpressionTranslation Translation { get; set; } static Expression<Func<DynamicExpressionEntity, string>> ToStringExpression = @this => @this.ReturnType + " " + @this.Name + "(" + @this.FromType + " e)"; [ExpressionField] public override string ToString() { return ToStringExpression.Evaluate(this); } } public enum DynamicExpressionTranslation { TranslateExpressionName, ReuseTranslationOfReturnType, NoTranslation, } [AutoInit] public static class DynamicExpressionOperation { public static readonly ConstructSymbol<DynamicExpressionEntity>.From<DynamicExpressionEntity> Clone; public static readonly ExecuteSymbol<DynamicExpressionEntity> Save; public static readonly DeleteSymbol<DynamicExpressionEntity> Delete; } public interface IDynamicExpressionEvaluator { object EvaluateUntyped(Entity entity); } }
using Signum.Entities; using Signum.Entities.Basics; using Signum.Utilities; using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Text; using System.Threading.Tasks; namespace Signum.Entities.Dynamic { [Serializable, EntityKind(EntityKind.Main, EntityData.Transactional)] public class DynamicExpressionEntity : Entity { [NotNullable, SqlDbType(Size = 100)] [StringLengthValidator(AllowNulls = false, Min = 3, Max = 100), IdentifierValidator(IdentifierType.PascalAscii)] public string Name { get; set; } [NotNullable, SqlDbType(Size = 100)] [StringLengthValidator(AllowNulls = false, Min = 3, Max = 100)] public string FromType { get; set; } [NotNullable, SqlDbType(Size = 100)] [StringLengthValidator(AllowNulls = false, Min = 3, Max = 100)] public string ReturnType { get; set; } [NotNullable, SqlDbType(Size = int.MaxValue)] [StringLengthValidator(AllowNulls = false, Min = 1, MultiLine = true)] public string Body { get; set; } [SqlDbType(Size = 100)] [StringLengthValidator(AllowNulls = true, Min = 1, Max = 100)] public string Format { get; set; } [SqlDbType(Size = 100)] [StringLengthValidator(AllowNulls = true, Min = 1, Max = 100)] public string Unit { get; set; } public DynamicExpressionTranslation Translation { get; set; } static Expression<Func<DynamicExpressionEntity, string>> ToStringExpression = @this => @this.ReturnType + " " + @this.Name + "(" + @this.FromType + " e)"; [ExpressionField] public override string ToString() { return ToStringExpression.Evaluate(this); } } public enum DynamicExpressionTranslation { TranslateExpressionName, ReuseTranslationOfReturnType, NoTranslation, } [AutoInit] public static class DynamicExpressionOperation { public static readonly ConstructSymbol<DynamicExpressionEntity>.From<DynamicExpressionEntity> Clone; public static readonly ExecuteSymbol<DynamicExpressionEntity> Save; public static readonly DeleteSymbol<DynamicExpressionEntity> Delete; } public interface IDynamicExpressionEvaluator { object EvaluateUntyped(Entity entity); } }
mit
C#
f080b9ed311b1fe948b81632ae9fc5177bb6ee2a
update version
prodot/ReCommended-Extension
Sources/ReCommendedExtension/Properties/AssemblyInfo.cs
Sources/ReCommendedExtension/Properties/AssemblyInfo.cs
using System.Reflection; using ReCommendedExtension; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle(ZoneMarker.ExtensionName)] [assembly: AssemblyDescription(ZoneMarker.ExtensionDescription)] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("prodot GmbH")] [assembly: AssemblyProduct(ZoneMarker.ExtensionId)] [assembly: AssemblyCopyright("© 2012-2020 prodot GmbH")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("5.3.1.0")] [assembly: AssemblyFileVersion("5.3.1")]
using System.Reflection; using ReCommendedExtension; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle(ZoneMarker.ExtensionName)] [assembly: AssemblyDescription(ZoneMarker.ExtensionDescription)] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("prodot GmbH")] [assembly: AssemblyProduct(ZoneMarker.ExtensionId)] [assembly: AssemblyCopyright("© 2012-2020 prodot GmbH")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("5.3.0.0")] [assembly: AssemblyFileVersion("5.3.0")]
apache-2.0
C#
5a88b31a1051c05552219f97659d485ed7d8fcc6
Remove NET5_0 logic
carbon/Amazon
src/Amazon.S3/Helpers/HttpResponseMessageExtensions.cs
src/Amazon.S3/Helpers/HttpResponseMessageExtensions.cs
using System.Net.Http; namespace Amazon.S3; internal static class HttpResponseMessageExtensions { public static Dictionary<string, string> GetProperties(this HttpResponseMessage response) { var baseHeaders = response.Headers.NonValidated; var contentHeaders = response.Content.Headers.NonValidated; var result = new Dictionary<string, string>(baseHeaders.Count + contentHeaders.Count); foreach (var header in baseHeaders) { result.Add(header.Key, header.Value.ToString()); } foreach (var header in contentHeaders) { result.Add(header.Key, header.Value.ToString()); } return result; } }
using System.Collections.Generic; using System.Net.Http; namespace Amazon.S3 { internal static class HttpResponseMessageExtensions { public static Dictionary<string, string> GetProperties(this HttpResponseMessage response) { #if NET5_0 var result = new Dictionary<string, string>(16); foreach (var header in response.Headers) { result.Add(header.Key, string.Join(';', header.Value)); } foreach (var header in response.Content.Headers) { result.Add(header.Key, string.Join(';', header.Value)); } #else var baseHeaders = response.Headers.NonValidated; var contentHeaders = response.Content.Headers.NonValidated; var result = new Dictionary<string, string>(baseHeaders.Count + contentHeaders.Count); foreach (var header in baseHeaders) { result.Add(header.Key, header.Value.ToString()); } foreach (var header in contentHeaders) { result.Add(header.Key, header.Value.ToString()); } #endif return result; } } }
mit
C#
13b94c01eddaeb15873f7f353ae50e5b3f50d319
Add check for HasException on test static_Reply_From__action
LeandroMBarreto/MlIB.Reply,LeandroMBarreto/lib-Reply
source/MlIB.Reply.Tests.Unit/Features/static_Reply_From__action.cs
source/MlIB.Reply.Tests.Unit/Features/static_Reply_From__action.cs
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace MlIB.Reply.Tests.Unit.Features { [TestClass] public class static_Reply_From__action { // UNIT UNDER TEST: // public static IReplyEx<Exception> From(Action action) //I: action null //O: NullReferenceException //O: "ERROR: CANNOT EXECUTE A NULL ACTION!!" [TestMethod] public void static_Reply_From_action_null() { try { M.Action action = null; var result = M.Reply.From(action); } catch (Exception ex) { Assert.IsInstanceOfType(ex, typeof(NullReferenceException), "FAIL TYPE"); Assert.AreEqual("ERROR: CANNOT EXECUTE A NULL ACTION!!", ex.Message, "FAIL Message"); } } //I: action ok //O: HasError false //O: HasException false //O: Value null //O: Exception null [TestMethod] public void static_Reply_From_action_ok() { var result = M.Reply.From(() => Stubs.VoidMethods.PlayStaticSound()); Assert.IsFalse(result.HasError, "FAIL HasError"); Assert.IsFalse(result.HasException, "FAIL HasException"); Assert.IsNull(result.Value, "FAIL Value"); Assert.IsNull(result.Exception, "FAIL Exception"); } //I: action throwing //O: HasError true //O: HasException true //O: Value exception //O: Exception exception [TestMethod] public void static_Reply_From_action_throwing() { var result = M.Reply.From(() => Stubs.VoidMethods.PlayInexistentSound()); Assert.IsTrue(result.HasError, "FAIL HasError"); Assert.IsTrue(result.HasException, "FAIL HasException"); Assert.AreSame(Stubs.VoidMethods.EXCEPTION, result.Value, "FAIL Value"); Assert.AreSame(Stubs.VoidMethods.EXCEPTION, result.Exception, "FAIL Exception"); } } }
using System; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace MlIB.Reply.Tests.Unit.Features { [TestClass] public class static_Reply_From__action { // UNIT UNDER TEST: // public static IReplyEx<Exception> From(Action action) //I: action null //O: NullReferenceException //O: "ERROR: CANNOT EXECUTE A NULL ACTION!!" [TestMethod] public void static_Reply_From_action_null() { try { M.Action action = null; var result = M.Reply.From(action); } catch (Exception ex) { Assert.IsInstanceOfType(ex, typeof(NullReferenceException), "FAIL TYPE"); Assert.AreEqual("ERROR: CANNOT EXECUTE A NULL ACTION!!", ex.Message, "FAIL Message"); } } //I: action ok //O: HasError false //O: Value null //O: Exception null [TestMethod] public void static_Reply_From_action_ok() { var result = M.Reply.From(() => Stubs.VoidMethods.PlayStaticSound()); Assert.IsFalse(result.HasError, "FAIL HasError"); Assert.IsNull(result.Value, "FAIL Value"); Assert.IsNull(result.Exception, "FAIL Exception"); } //I: action throwing //O: HasError true //O: Value exception //O: Exception exception [TestMethod] public void static_Reply_From_action_throwing() { var result = M.Reply.From(() => Stubs.VoidMethods.PlayInexistentSound()); Assert.IsTrue(result.HasError, "FAIL HasError"); Assert.AreSame(Stubs.VoidMethods.EXCEPTION, result.Value, "FAIL Value"); Assert.AreSame(Stubs.VoidMethods.EXCEPTION, result.Exception, "FAIL Exception"); } } }
mit
C#
46a5643f422920d435223e6aac2f3b0e6b71d9a6
Fix blog picture
PioneerCode/pioneer-blog,PioneerCode/pioneer-blog,PioneerCode/pioneer-blog,PioneerCode/pioneer-blog
src/Pioneer.Blog/Views/Post/_FooterPopularPosts.cshtml
src/Pioneer.Blog/Views/Post/_FooterPopularPosts.cshtml
<section class="popular-posts"> @{var l = 0;} @foreach (var post in ViewBag.PopularPosts) { if (l == 0 || l == 2 || l == 4) { @:<div class="row"> } <div class="large-6 medium-6 columns content"> <div class="row"> <div class="large-6 columns"> <a href="/post/@post.Url" title="@post.Title"> <img src="/blogs/@post.Url/@post.SmallImage" alt="@post.Title" /> </a> </div> <div class="large-6 columns"> <p> <a href="/post/@post.Url" title="@post.Title"> <b>@post.Title</b> </a> </p> <p class="category"> <a href="/category/@post.Category.Url" title="@("Category - " + post.Category.Name)">@post.Category.Name</a> </p> </div> </div> </div> if (l == 1 || l == 3) { @:</div> } l++; } </section>
<section class="popular-posts"> @{var l = 0;} @foreach (var post in ViewBag.PopularPosts) { if (l == 0 || l == 2 || l == 4) { @:<div class="row"> } <div class="large-6 medium-6 columns content"> <div class="row"> <div class="large-6 columns"> <a href="/post/@post.Url" title="@post.Title"> <img src="@post.SmallImage" alt="@post.Title" /> </a> </div> <div class="large-6 columns"> <p> <a href="/post/@post.Url" title="@post.Title"> <b>@post.Title</b> </a> </p> <p class="category"> <a href="/category/@post.Category.Url" title="@("Category - " + post.Category.Name)">@post.Category.Name</a> </p> </div> </div> </div> if (l == 1 || l == 3) { @:</div> } l++; } </section>
mit
C#
d2d7b4dce7bb578eefbf078428f1ae0b34f33437
Make `_typeReaderTypeInfo` static
RogueException/Discord.Net,LassieME/Discord.Net,AntiTcb/Discord.Net,Confruggy/Discord.Net
src/Discord.Net.Commands/Attributes/OverrideTypeReaderAttribute.cs
src/Discord.Net.Commands/Attributes/OverrideTypeReaderAttribute.cs
using System; using System.Reflection; namespace Discord.Commands { [AttributeUsage(AttributeTargets.Parameter)] public class OverrideTypeReaderAttribute : Attribute { private static readonly TypeInfo _typeReaderTypeInfo = typeof(TypeReader).GetTypeInfo(); public Type TypeReader { get; } public OverrideTypeReaderAttribute(Type overridenTypeReader) { if (!_typeReaderTypeInfo.IsAssignableFrom(overridenTypeReader.GetTypeInfo())) throw new ArgumentException($"{nameof(overridenTypeReader)} must inherit from {nameof(TypeReader)}"); TypeReader = overridenTypeReader; } } }
using System; using System.Reflection; namespace Discord.Commands { [AttributeUsage(AttributeTargets.Parameter)] public class OverrideTypeReaderAttribute : Attribute { private readonly TypeInfo _typeReaderTypeInfo = typeof(TypeReader).GetTypeInfo(); public Type TypeReader { get; } public OverrideTypeReaderAttribute(Type overridenTypeReader) { if (!_typeReaderTypeInfo.IsAssignableFrom(overridenTypeReader.GetTypeInfo())) throw new ArgumentException($"{nameof(overridenTypeReader)} must inherit from {nameof(TypeReader)}"); TypeReader = overridenTypeReader; } } }
mit
C#
2c282682780910e88dd894dd511b525c390c32b2
Use DriverConnectionProvider if a connection string or connection string name is specified.
nkreipke/nhibernate-core,lnu/nhibernate-core,nhibernate/nhibernate-core,gliljas/nhibernate-core,hazzik/nhibernate-core,fredericDelaporte/nhibernate-core,livioc/nhibernate-core,nhibernate/nhibernate-core,ManufacturingIntelligence/nhibernate-core,hazzik/nhibernate-core,nkreipke/nhibernate-core,nhibernate/nhibernate-core,gliljas/nhibernate-core,hazzik/nhibernate-core,alobakov/nhibernate-core,hazzik/nhibernate-core,ngbrown/nhibernate-core,nhibernate/nhibernate-core,fredericDelaporte/nhibernate-core,nkreipke/nhibernate-core,alobakov/nhibernate-core,RogerKratz/nhibernate-core,fredericDelaporte/nhibernate-core,livioc/nhibernate-core,gliljas/nhibernate-core,gliljas/nhibernate-core,ManufacturingIntelligence/nhibernate-core,ngbrown/nhibernate-core,RogerKratz/nhibernate-core,ManufacturingIntelligence/nhibernate-core,livioc/nhibernate-core,alobakov/nhibernate-core,RogerKratz/nhibernate-core,ngbrown/nhibernate-core,lnu/nhibernate-core,RogerKratz/nhibernate-core,lnu/nhibernate-core,fredericDelaporte/nhibernate-core
src/NHibernate/Connection/ConnectionProviderFactory.cs
src/NHibernate/Connection/ConnectionProviderFactory.cs
using System; using System.Collections; using log4net; using NHibernate.Util; using Environment = NHibernate.Cfg.Environment; namespace NHibernate.Connection { /// <summary> /// Instanciates a connection provider given configuration properties. /// </summary> public sealed class ConnectionProviderFactory { private static readonly ILog log = LogManager.GetLogger( typeof( ConnectionProviderFactory ) ); // cannot be instantiated private ConnectionProviderFactory() { throw new InvalidOperationException( "ConnectionProviderFactory can not be instantiated." ); } /// <summary> /// /// </summary> /// <param name="settings"></param> /// <returns></returns> public static IConnectionProvider NewConnectionProvider( IDictionary settings ) { IConnectionProvider connections = null; string providerClass = settings[ Environment.ConnectionProvider ] as string; if( providerClass != null ) { try { log.Info( "Initializing connection provider: " + providerClass ); connections = ( IConnectionProvider ) Activator.CreateInstance( ReflectHelper.ClassForName( providerClass ) ); } catch( Exception e ) { log.Fatal( "Could not instantiate connection provider", e ); throw new HibernateException( "Could not instantiate connection provider: " + providerClass, e ); } } else if (settings[ Environment.ConnectionString ] != null || settings[Environment.ConnectionStringName] != null) { connections = new DriverConnectionProvider(); } else { log.Info("No connection provider specified, UserSuppliedConnectionProvider will be used."); connections = new UserSuppliedConnectionProvider(); } connections.Configure( settings ); return connections; } } }
using System; using System.Collections; using log4net; using NHibernate.Util; using Environment = NHibernate.Cfg.Environment; namespace NHibernate.Connection { /// <summary> /// Instanciates a connection provider given configuration properties. /// </summary> public sealed class ConnectionProviderFactory { private static readonly ILog log = LogManager.GetLogger( typeof( ConnectionProviderFactory ) ); // cannot be instantiated private ConnectionProviderFactory() { throw new InvalidOperationException( "ConnectionProviderFactory can not be instantiated." ); } /// <summary> /// /// </summary> /// <param name="settings"></param> /// <returns></returns> public static IConnectionProvider NewConnectionProvider( IDictionary settings ) { IConnectionProvider connections = null; string providerClass = settings[ Environment.ConnectionProvider ] as string; if( providerClass != null ) { try { log.Info( "Initializing connection provider: " + providerClass ); connections = ( IConnectionProvider ) Activator.CreateInstance( ReflectHelper.ClassForName( providerClass ) ); } catch( Exception e ) { log.Fatal( "Could not instantiate connection provider", e ); throw new HibernateException( "Could not instantiate connection provider: " + providerClass, e ); } } else { connections = new UserSuppliedConnectionProvider(); } connections.Configure( settings ); return connections; } } }
lgpl-2.1
C#
ec59ace1ea217665de9ada352526f7c4c65f165b
Add LocationId to Locations Model
andrelmp/eShopOnContainers,albertodall/eShopOnContainers,dotnet-architecture/eShopOnContainers,productinfo/eShopOnContainers,andrelmp/eShopOnContainers,andrelmp/eShopOnContainers,productinfo/eShopOnContainers,TypeW/eShopOnContainers,dotnet-architecture/eShopOnContainers,productinfo/eShopOnContainers,skynode/eShopOnContainers,TypeW/eShopOnContainers,andrelmp/eShopOnContainers,productinfo/eShopOnContainers,productinfo/eShopOnContainers,andrelmp/eShopOnContainers,albertodall/eShopOnContainers,dotnet-architecture/eShopOnContainers,TypeW/eShopOnContainers,andrelmp/eShopOnContainers,dotnet-architecture/eShopOnContainers,skynode/eShopOnContainers,TypeW/eShopOnContainers,dotnet-architecture/eShopOnContainers,albertodall/eShopOnContainers,skynode/eShopOnContainers,TypeW/eShopOnContainers,albertodall/eShopOnContainers,skynode/eShopOnContainers,skynode/eShopOnContainers,albertodall/eShopOnContainers,productinfo/eShopOnContainers
src/Services/Location/Locations.API/Model/Locations.cs
src/Services/Location/Locations.API/Model/Locations.cs
namespace Microsoft.eShopOnContainers.Services.Locations.API.Model { using MongoDB.Bson; using MongoDB.Driver.GeoJsonObjectModel; using System.Collections.Generic; using MongoDB.Bson.Serialization.Attributes; public class Locations { [BsonRepresentation(BsonType.ObjectId)] public string Id { get; set; } public int LocationId { get; set; } public string Code { get; set; } [BsonRepresentation(BsonType.ObjectId)] public string Parent_Id { get; set; } public string Description { get; set; } public double Latitude { get; set; } public double Longitude { get; set; } public GeoJsonPoint<GeoJson2DGeographicCoordinates> Location { get; private set; } public GeoJsonPolygon<GeoJson2DGeographicCoordinates> Polygon { get; private set; } public void SetLocation(double lon, double lat) => SetPosition(lon, lat); public void SetArea(List<GeoJson2DGeographicCoordinates> coordinatesList) => SetPolygon(coordinatesList); private void SetPosition(double lon, double lat) { Latitude = lat; Longitude = lon; Location = new GeoJsonPoint<GeoJson2DGeographicCoordinates>( new GeoJson2DGeographicCoordinates(lon, lat)); } private void SetPolygon(List<GeoJson2DGeographicCoordinates> coordinatesList) { Polygon = new GeoJsonPolygon<GeoJson2DGeographicCoordinates>(new GeoJsonPolygonCoordinates<GeoJson2DGeographicCoordinates>( new GeoJsonLinearRingCoordinates<GeoJson2DGeographicCoordinates>(coordinatesList))); } } }
namespace Microsoft.eShopOnContainers.Services.Locations.API.Model { using MongoDB.Bson; using MongoDB.Driver.GeoJsonObjectModel; using System.Collections.Generic; using MongoDB.Bson.Serialization.Attributes; public class Locations { [BsonRepresentation(BsonType.ObjectId)] public string Id { get; set; } public string Code { get; set; } [BsonRepresentation(BsonType.ObjectId)] public string Parent_Id { get; set; } public string Description { get; set; } public double Latitude { get; set; } public double Longitude { get; set; } public GeoJsonPoint<GeoJson2DGeographicCoordinates> Location { get; private set; } public GeoJsonPolygon<GeoJson2DGeographicCoordinates> Polygon { get; private set; } public void SetLocation(double lon, double lat) => SetPosition(lon, lat); public void SetArea(List<GeoJson2DGeographicCoordinates> coordinatesList) => SetPolygon(coordinatesList); private void SetPosition(double lon, double lat) { Latitude = lat; Longitude = lon; Location = new GeoJsonPoint<GeoJson2DGeographicCoordinates>( new GeoJson2DGeographicCoordinates(lon, lat)); } private void SetPolygon(List<GeoJson2DGeographicCoordinates> coordinatesList) { Polygon = new GeoJsonPolygon<GeoJson2DGeographicCoordinates>(new GeoJsonPolygonCoordinates<GeoJson2DGeographicCoordinates>( new GeoJsonLinearRingCoordinates<GeoJson2DGeographicCoordinates>(coordinatesList))); } } }
mit
C#
19a186ae96f220e7cc7ceccbc62618ff91f37bfe
Remove trailing spaces from stamnummer.
Chirojeugd-Vlaanderen/gap,Chirojeugd-Vlaanderen/gap,Chirojeugd-Vlaanderen/gap
Solution/Chiro.Gap.Api/MappingHelper.cs
Solution/Chiro.Gap.Api/MappingHelper.cs
/* * Copyright 2017 Chirojeugd-Vlaanderen vzw. See the NOTICE file at the * top-level directory of this distribution, and at * https://gapwiki.chiro.be/copyright * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using AutoMapper; using Chiro.Gap.Api.Models; using Chiro.Gap.ServiceContracts.DataContracts; namespace Chiro.Gap.Api { public static class MappingHelper { public static void CreateMappings() { // TODO: Damn, nog steeds automapper 3. (zie #5401). Mapper.CreateMap<GroepInfo, GroepModel>() .ForMember(dst => dst.StamNummer, opt => opt.MapFrom(src => src.StamNummer.Trim())); } } }
/* * Copyright 2017 Chirojeugd-Vlaanderen vzw. See the NOTICE file at the * top-level directory of this distribution, and at * https://gapwiki.chiro.be/copyright * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ using System; using System.Collections.Generic; using System.Linq; using System.Web; using AutoMapper; using Chiro.Gap.Api.Models; using Chiro.Gap.ServiceContracts.DataContracts; namespace Chiro.Gap.Api { public static class MappingHelper { public static void CreateMappings() { // TODO: Damn, nog steeds automapper 3. (zie #5401). Mapper.CreateMap<GroepInfo, GroepModel>(); } } }
apache-2.0
C#
fdd06c58b1d1305e575699a8e3371d070904944f
Fix remove logging controller apiKey parameter
Ontica/Empiria.Extended
WebApi/Controllers/LoggingController.cs
WebApi/Controllers/LoggingController.cs
/* Empiria Extensions Framework ****************************************************************************** * * * Module : Empiria Web Api Component : Base controllers * * Assembly : Empiria.WebApi.dll Pattern : Web Api Controller * * Type : LoggingController License : Please read LICENSE.txt file * * * * Summary : Contains web api methods for application log services. * * * ************************* Copyright(c) La Vía Óntica SC, Ontica LLC and contributors. All rights reserved. **/ using System; using System.Web.Http; using Empiria.Logging; using Empiria.Security; namespace Empiria.WebApi.Controllers { /// <summary>Contains web api methods for application log services.</summary> public class LoggingController : WebApiController { #region Public APIs /// <summary>Stores an array of log entries.</summary> /// <param name="logEntries">The non-empty array of LogEntryModel instances.</param> [HttpPost, AllowAnonymous] [Route("v1/logging")] public void PostLogEntryArray([FromBody] LogEntryModel[] logEntries) { try { ClientApplication clientApplication = base.GetClientApplication(); var logTrail = new LogTrail(clientApplication); logTrail.Write(logEntries); } catch (Exception e) { throw base.CreateHttpException(e); } } #endregion Public APIs } // class LoggingController } // namespace Empiria.WebApi.Controllers
/* Empiria Extensions Framework ****************************************************************************** * * * Solution : Empiria Extensions Framework System : Empiria Microservices * * Namespace : Empiria.Microservices Assembly : Empiria.Microservices.dll * * Type : LoggingController Pattern : Web API Controller * * Version : 1.0 License : Please read license.txt file * * * * Summary : Contains web api methods for application log services. * * * ********************************** Copyright(c) 2016-2017. La Vía Óntica SC, Ontica LLC and contributors. **/ using System; using System.Web.Http; using Empiria.Logging; using Empiria.Security; using Empiria.WebApi; namespace Empiria.Microservices { /// <summary>Contains web api methods for application log services.</summary> public class LoggingController : WebApiController { #region Public APIs /// <summary>Stores an array of log entries.</summary> /// <param name="logEntries">The non-empty array of LogEntryModel instances.</param> [HttpPost, AllowAnonymous] [Route("v1/logging")] public void PostLogEntryArray(string apiKey, [FromBody] LogEntryModel[] logEntries) { try { ClientApplication clientApplication = base.GetClientApplication(); var logTrail = new LogTrail(clientApplication); logTrail.Write(logEntries); } catch (Exception e) { throw base.CreateHttpException(e); } } #endregion Public APIs } // class LoggingController } // namespace Empiria.Microservices
agpl-3.0
C#
c41eb3ba10ca08d7266a2cbf83cc3977c663af28
Remove unused visibility flags
space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14-content,space-wizards/space-station-14,space-wizards/space-station-14,space-wizards/space-station-14-content,space-wizards/space-station-14-content,space-wizards/space-station-14
Content.Server/GameObjects/VisibilityFlags.cs
Content.Server/GameObjects/VisibilityFlags.cs
using System; namespace Content.Server.GameObjects { [Flags] public enum VisibilityFlags { Ghost = 2, } }
using System; namespace Content.Server.GameObjects { [Flags] public enum VisibilityFlags { None = 0, Normal = 1, Ghost = 2, } }
mit
C#
35c7118c02562e5ec618351f7859d44898dec31d
add localhost5000 to cors
MassDebaters/DebateApp,MassDebaters/DebateApp,MassDebaters/DebateApp
DebateAppDomain/DebateAppDomainAPI/Startup.cs
DebateAppDomain/DebateAppDomainAPI/Startup.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; namespace DebateAppDomainAPI { public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc(); services.AddCors(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseCors(builder => builder.WithOrigins("http://localhost:8000") .AllowAnyHeader().WithOrigins("http://localhost/Mansion").WithOrigins("http://localhost:5000"); app.UseMvc(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; namespace DebateAppDomainAPI { public class Startup { public Startup(IConfiguration configuration) { Configuration = configuration; } public IConfiguration Configuration { get; } // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddMvc(); services.AddCors(); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseCors(builder => builder.WithOrigins("http://localhost:8000") .AllowAnyHeader().WithOrigins("http://localhost/Mansion")); app.UseMvc(); } } }
mit
C#
9047888cee57b16ab9d5bda299123d46f5014404
fix test
splitice/IPTables.Net,splitice/IPTables.Net,splitice/IPTables.Net,splitice/IPTables.Net
IPTables.Net.Tests/SingleMssRuleParseTests.cs
IPTables.Net.Tests/SingleMssRuleParseTests.cs
using System; using IPTables.Net.Iptables; using NUnit.Framework; namespace IPTables.Net.Tests { [TestFixture] internal class SingleMssRuleParseTests { [Test] public void TestMssRange() { String rule = "-A INPUT -m tcpmss --set-mss 10:100 -j ACCEPT"; IpTablesChainSet chains = new IpTablesChainSet(4); IpTablesRule irule = IpTablesRule.Parse(rule, null, chains, 4); Assert.AreEqual(rule, irule.GetActionCommand()); } } }
using System; using IPTables.Net.Iptables; using NUnit.Framework; namespace IPTables.Net.Tests { [TestFixture] internal class SingleMssRuleParseTests { [Test] public void TestMssRange() { String rule = "-A INPUT -m tcpmss --mss 10:100 -j ACCEPT"; IpTablesChainSet chains = new IpTablesChainSet(4); IpTablesRule irule = IpTablesRule.Parse(rule, null, chains, 4); Assert.AreEqual(rule, irule.GetActionCommand()); } } }
apache-2.0
C#
2274bf1f10b70248ab249ffd92209a69a4952961
Use local function to verify mimetype string.
TastesLikeTurkey/Papyrus
Papyrus/Papyrus/Extensions/EbookExtensions.cs
Papyrus/Papyrus/Extensions/EbookExtensions.cs
using System; using System.Threading.Tasks; using Windows.Storage; namespace Papyrus { public static class EBookExtensions { public static async Task<bool> VerifyMimetypeAsync(this EBook ebook) { bool VerifyMimetypeString(string value) => value == "application/epub+zip"; if (ebook._rootFolder == null) // Make sure a root folder was specified. return false; var mimetypeFile = await ebook._rootFolder.GetItemAsync("mimetype"); if (mimetypeFile == null) // Make sure file exists. return false; var fileContents = await FileIO.ReadTextAsync(mimetypeFile as StorageFile); if (!VerifyMimetypeString(fileContents)) // Make sure file contents are correct. return false; return true; } } }
using System; using System.Threading.Tasks; using Windows.Storage; namespace Papyrus { public static class EBookExtensions { public static async Task<bool> VerifyMimetypeAsync(this EBook ebook) { var mimetypeFile = await ebook._rootFolder.GetItemAsync("mimetype"); if (mimetypeFile == null) // Make sure file exists. return false; var fileContents = await FileIO.ReadTextAsync(mimetypeFile as StorageFile); if (fileContents != "application/epub+zip") // Make sure file contents are correct. return false; return true; } } }
mit
C#
cd6b407740d7239a8e09ff07294cb51c5641eb2c
Undo change.
CaptainHayashi/roslyn,mavasani/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,mavasani/roslyn,nguerrera/roslyn,amcasey/roslyn,CaptainHayashi/roslyn,CyrusNajmabadi/roslyn,KevinRansom/roslyn,eriawan/roslyn,bkoelman/roslyn,diryboy/roslyn,CaptainHayashi/roslyn,zooba/roslyn,ErikSchierboom/roslyn,DustinCampbell/roslyn,AlekseyTs/roslyn,tvand7093/roslyn,ErikSchierboom/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,paulvanbrenk/roslyn,AmadeusW/roslyn,TyOverby/roslyn,pdelvo/roslyn,bkoelman/roslyn,jasonmalinowski/roslyn,bkoelman/roslyn,gafter/roslyn,MattWindsor91/roslyn,orthoxerox/roslyn,VSadov/roslyn,tvand7093/roslyn,jeffanders/roslyn,OmarTawfik/roslyn,davkean/roslyn,akrisiun/roslyn,physhi/roslyn,AmadeusW/roslyn,AlekseyTs/roslyn,amcasey/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,mattscheffer/roslyn,tannergooding/roslyn,AnthonyDGreen/roslyn,heejaechang/roslyn,Giftednewt/roslyn,Giftednewt/roslyn,agocke/roslyn,dotnet/roslyn,jmarolf/roslyn,dpoeschl/roslyn,mmitche/roslyn,yeaicc/roslyn,VSadov/roslyn,MattWindsor91/roslyn,abock/roslyn,robinsedlaczek/roslyn,nguerrera/roslyn,DustinCampbell/roslyn,AnthonyDGreen/roslyn,drognanar/roslyn,cston/roslyn,xasx/roslyn,heejaechang/roslyn,khyperia/roslyn,aelij/roslyn,KevinRansom/roslyn,akrisiun/roslyn,jasonmalinowski/roslyn,aelij/roslyn,abock/roslyn,brettfo/roslyn,TyOverby/roslyn,sharwell/roslyn,swaroop-sridhar/roslyn,Giftednewt/roslyn,wvdd007/roslyn,KirillOsenkov/roslyn,orthoxerox/roslyn,yeaicc/roslyn,TyOverby/roslyn,jcouv/roslyn,OmarTawfik/roslyn,cston/roslyn,stephentoub/roslyn,jasonmalinowski/roslyn,Hosch250/roslyn,tvand7093/roslyn,paulvanbrenk/roslyn,swaroop-sridhar/roslyn,CyrusNajmabadi/roslyn,weltkante/roslyn,wvdd007/roslyn,mattscheffer/roslyn,shyamnamboodiripad/roslyn,diryboy/roslyn,panopticoncentral/roslyn,genlu/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,mattwar/roslyn,AlekseyTs/roslyn,jamesqo/roslyn,KirillOsenkov/roslyn,lorcanmooney/roslyn,robinsedlaczek/roslyn,OmarTawfik/roslyn,robinsedlaczek/roslyn,jeffanders/roslyn,Hosch250/roslyn,gafter/roslyn,Hosch250/roslyn,tmat/roslyn,bartdesmet/roslyn,jeffanders/roslyn,reaction1989/roslyn,shyamnamboodiripad/roslyn,jkotas/roslyn,genlu/roslyn,sharwell/roslyn,wvdd007/roslyn,agocke/roslyn,weltkante/roslyn,tmeschter/roslyn,jkotas/roslyn,dotnet/roslyn,mattwar/roslyn,physhi/roslyn,jmarolf/roslyn,stephentoub/roslyn,genlu/roslyn,physhi/roslyn,jcouv/roslyn,MichalStrehovsky/roslyn,mgoertz-msft/roslyn,mattscheffer/roslyn,KirillOsenkov/roslyn,srivatsn/roslyn,lorcanmooney/roslyn,khyperia/roslyn,MattWindsor91/roslyn,kelltrick/roslyn,kelltrick/roslyn,VSadov/roslyn,AnthonyDGreen/roslyn,dotnet/roslyn,jkotas/roslyn,pdelvo/roslyn,lorcanmooney/roslyn,ErikSchierboom/roslyn,tmat/roslyn,pdelvo/roslyn,sharwell/roslyn,nguerrera/roslyn,eriawan/roslyn,panopticoncentral/roslyn,DustinCampbell/roslyn,panopticoncentral/roslyn,mgoertz-msft/roslyn,brettfo/roslyn,MichalStrehovsky/roslyn,davkean/roslyn,yeaicc/roslyn,orthoxerox/roslyn,stephentoub/roslyn,zooba/roslyn,bartdesmet/roslyn,agocke/roslyn,tmeschter/roslyn,zooba/roslyn,akrisiun/roslyn,mattwar/roslyn,srivatsn/roslyn,mgoertz-msft/roslyn,KevinRansom/roslyn,srivatsn/roslyn,swaroop-sridhar/roslyn,reaction1989/roslyn,davkean/roslyn,weltkante/roslyn,dpoeschl/roslyn,jamesqo/roslyn,amcasey/roslyn,jmarolf/roslyn,drognanar/roslyn,mmitche/roslyn,drognanar/roslyn,tannergooding/roslyn,mmitche/roslyn,tmat/roslyn,AmadeusW/roslyn,gafter/roslyn,MichalStrehovsky/roslyn,paulvanbrenk/roslyn,dpoeschl/roslyn,abock/roslyn,reaction1989/roslyn,bartdesmet/roslyn,MattWindsor91/roslyn,xasx/roslyn,jcouv/roslyn,eriawan/roslyn,brettfo/roslyn,diryboy/roslyn,heejaechang/roslyn,tannergooding/roslyn,kelltrick/roslyn,aelij/roslyn,tmeschter/roslyn,xasx/roslyn,khyperia/roslyn,jamesqo/roslyn,CyrusNajmabadi/roslyn,cston/roslyn
src/Features/Core/Portable/AddPackage/AbstractAddSpecificPackageCodeFixProvider.cs
src/Features/Core/Portable/AddPackage/AbstractAddSpecificPackageCodeFixProvider.cs
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.Packaging; using Microsoft.CodeAnalysis.SymbolSearch; namespace Microsoft.CodeAnalysis.AddPackage { internal abstract partial class AbstractAddSpecificPackageCodeFixProvider : AbstractAddPackageCodeFixProvider { /// <summary> /// Values for these parameters can be provided (during testing) for mocking purposes. /// </summary> protected AbstractAddSpecificPackageCodeFixProvider( IPackageInstallerService packageInstallerService = null, ISymbolSearchService symbolSearchService = null) : base(packageInstallerService, symbolSearchService) { } protected override bool IncludePrerelease => true; public override async Task RegisterCodeFixesAsync(CodeFixContext context) { var cancellationToken = context.CancellationToken; var assemblyName = GetAssemblyName(context.Diagnostics[0].Id); if (assemblyName != null) { var assemblyNames = new HashSet<string> { assemblyName }; var addPackageCodeActions = await GetAddPackagesCodeActionsAsync(context, assemblyNames).ConfigureAwait(false); context.RegisterFixes(addPackageCodeActions, context.Diagnostics); } } protected abstract string GetAssemblyName(string id); } }
// Copyright (c) Microsoft. 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.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.Packaging; using Microsoft.CodeAnalysis.SymbolSearch; namespace Microsoft.CodeAnalysis.AddPackage { internal abstract partial class AbstractAddSpecificPackageCodeFixProvider : AbstractAddPackageCodeFixProvider { /// <summary> /// Values for these parameters can be provided (during testing) for mocking purposes. /// </summary> protected AbstractAddSpecificPackageCodeFixProvider( IPackageInstallerService packageInstallerService = null, ISymbolSearchService symbolSearchService = null) : base(packageInstallerService, symbolSearchService) { } protected override bool IncludePrerelease => true; public override async Task RegisterCodeFixesAsync(CodeFixContext context) { var cancellationToken = context.CancellationToken; var assemblyName = GetAssemblyName(context.Diagnostics[0].Id); // context.Document.Project.WithCompilationOptions if (assemblyName != null) { var assemblyNames = new HashSet<string> { assemblyName }; var addPackageCodeActions = await GetAddPackagesCodeActionsAsync(context, assemblyNames).ConfigureAwait(false); context.RegisterFixes(addPackageCodeActions, context.Diagnostics); } } protected abstract string GetAssemblyName(string id); class MyCodeAction : CodeAction.SolutionChangeAction { public MyCodeAction(string title, Func<CancellationToken, Task<Solution>> createChangedSolution) : base(title, createChangedSolution) { } } } }
apache-2.0
C#
97581d8b6c400ec32d84305a776a4dcba51cc34a
Rename GenerateWallet menuitem to WalletManager
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi.Gui/Shell/MainMenu/ToolsMainMenuItems.cs
WalletWasabi.Gui/Shell/MainMenu/ToolsMainMenuItems.cs
using AvalonStudio.MainMenu; using AvalonStudio.Menus; using System; using System.Collections.Generic; using System.Composition; using System.Text; namespace WalletWasabi.Gui.Shell.MainMenu { internal class ToolsMainMenuItems { private IMenuItemFactory _menuItemFactory; [ImportingConstructor] public ToolsMainMenuItems(IMenuItemFactory menuItemFactory) { _menuItemFactory = menuItemFactory; } #region MainMenu [ExportMainMenuItem("Tools")] [DefaultOrder(1)] public IMenuItem Tools => _menuItemFactory.CreateHeaderMenuItem("Tools", null); #endregion MainMenu #region Group [ExportMainMenuDefaultGroup("Tools", "Managers")] [DefaultOrder(0)] public object ManagersGroup => null; [ExportMainMenuDefaultGroup("Tools", "Settings")] [DefaultOrder(1)] public object SettingsGroup => null; #endregion Group #region MenuItem [ExportMainMenuItem("Tools", "Wallet Manager")] [DefaultOrder(0)] [DefaultGroup("Managers")] public IMenuItem WalletManager => _menuItemFactory.CreateCommandMenuItem("Tools.WalletManager"); [ExportMainMenuItem("Tools", "Settings")] [DefaultOrder(1)] [DefaultGroup("Settings")] public IMenuItem Settings => _menuItemFactory.CreateCommandMenuItem("Tools.Settings"); #endregion MenuItem } }
using AvalonStudio.MainMenu; using AvalonStudio.Menus; using System; using System.Collections.Generic; using System.Composition; using System.Text; namespace WalletWasabi.Gui.Shell.MainMenu { internal class ToolsMainMenuItems { private IMenuItemFactory _menuItemFactory; [ImportingConstructor] public ToolsMainMenuItems(IMenuItemFactory menuItemFactory) { _menuItemFactory = menuItemFactory; } #region MainMenu [ExportMainMenuItem("Tools")] [DefaultOrder(1)] public IMenuItem Tools => _menuItemFactory.CreateHeaderMenuItem("Tools", null); #endregion MainMenu #region Group [ExportMainMenuDefaultGroup("Tools", "Managers")] [DefaultOrder(0)] public object ManagersGroup => null; [ExportMainMenuDefaultGroup("Tools", "Settings")] [DefaultOrder(1)] public object SettingsGroup => null; #endregion Group #region MenuItem [ExportMainMenuItem("Tools", "Wallet Manager")] [DefaultOrder(0)] [DefaultGroup("Managers")] public IMenuItem GenerateWallet => _menuItemFactory.CreateCommandMenuItem("Tools.WalletManager"); [ExportMainMenuItem("Tools", "Settings")] [DefaultOrder(1)] [DefaultGroup("Settings")] public IMenuItem Settings => _menuItemFactory.CreateCommandMenuItem("Tools.Settings"); #endregion MenuItem } }
mit
C#
9445ca7de83913d883383fe7a291ebddace23285
Save xpub instead of hex (wallet compatibility)
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi/JsonConverters/ExtPubKeyJsonConverter.cs
WalletWasabi/JsonConverters/ExtPubKeyJsonConverter.cs
using NBitcoin; using Newtonsoft.Json; using System; namespace WalletWasabi.JsonConverters { public class ExtPubKeyJsonConverter : JsonConverter { /// <inheritdoc /> public override bool CanConvert(Type objectType) { return objectType == typeof(ExtPubKey); } /// <inheritdoc /> public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var s = (string)reader.Value; ExtPubKey epk; try { epk = ExtPubKey.Parse(s); } catch { // Try hex, Old wallet format was like this. epk = new ExtPubKey(ByteHelpers.FromHex(s)); } return epk; } /// <inheritdoc /> public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { var epk = (ExtPubKey)value; var xpub = epk.GetWif(Network.Main).ToWif(); writer.WriteValue(xpub); } } }
using NBitcoin; using Newtonsoft.Json; using System; namespace WalletWasabi.JsonConverters { public class ExtPubKeyJsonConverter : JsonConverter { /// <inheritdoc /> public override bool CanConvert(Type objectType) { return objectType == typeof(ExtPubKey); } /// <inheritdoc /> public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var hex = (string)reader.Value; return new ExtPubKey(ByteHelpers.FromHex(hex)); } /// <inheritdoc /> public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) { var epk = (ExtPubKey)value; var hex = ByteHelpers.ToHex(epk.ToBytes()); writer.WriteValue(hex); } } }
mit
C#
152c051c2a55bdea2cf8d334949de687fc4257e5
Add pixel threshold to MeshCreatorData.
uclagamelab/MeshCreator
Assets/Scripts/MeshCreatorData.cs
Assets/Scripts/MeshCreatorData.cs
using UnityEngine; using System.Collections; public class MeshCreatorData : MonoBehaviour { public string errorMessage = "reinstall the mesh creator package."; // use this texture for creating the outine public Texture2D outlineTexture; public float pixelTransparencyThreshold = 255; public const float versionNumber = 0.6f; // settings for what the script will create public bool uvWrapMesh = true; public bool createEdges = true; public bool createBacksidePlane = false; // stores an automatically created material public Material frontMaterial; // total height, width, and depth of the resulting mesh public float meshHeight = 1.0f; public float meshWidth = 1.0f; public float meshDepth = 0.1f; // set center pivot offset public float pivotHeightOffset = 0.0f; public float pivotWidthOffset = 0.0f; public float pivotDepthOffset = 0.0f; // store the last pivot offset used so it can be subtracted from next public Vector3 lastPivotOffset = Vector3.zero; // collider settings public bool generateCollider = true; public bool usePrimitiveCollider = true; public float smallestBoxArea = 100.0f; public bool useAutoGeneratedMaterial = false; public bool usePhysicMaterial = false; public PhysicMaterial physicMaterial; public bool setTriggers = false; public bool addRigidBody = false; public string idNumber = ""; public bool mergeClosePoints = false; public float mergeDistance = 0.0f; }
using UnityEngine; using System.Collections; public class MeshCreatorData : MonoBehaviour { public string errorMessage = "reinstall the mesh creator package."; // use this texture for creating the outine public Texture2D outlineTexture; public const float versionNumber = 0.6f; // settings for what the script will create public bool uvWrapMesh = true; public bool createEdges = true; public bool createBacksidePlane = false; // stores an automatically created material public Material frontMaterial; // total height, width, and depth of the resulting mesh public float meshHeight = 1.0f; public float meshWidth = 1.0f; public float meshDepth = 0.1f; // offset the placement of the mesh from //public float heightOffset = 0.5f; //public float widthOffset = 0.0f; //public float depthOffset = 0.0f; // set center pivot offset public float pivotHeightOffset = 0.0f; public float pivotWidthOffset = 0.0f; public float pivotDepthOffset = 0.0f; // store the last pivot offset used so it can be subtracted from next public Vector3 lastPivotOffset = Vector3.zero; // collider settings public bool generateCollider = true; public bool usePrimitiveCollider = true; public float smallestBoxArea = 100.0f; public bool useAutoGeneratedMaterial = false; public bool usePhysicMaterial = false; public PhysicMaterial physicMaterial; public bool setTriggers = false; // for future use //public bool useBoxCollider = true; //public float minCapsuleRadius = 0.1f; //public float maxCapsuleRadius = 0.35f; public bool addRigidBody = false; public string idNumber = ""; public bool mergeClosePoints = false; public float mergeDistance = 0.0f; }
bsd-2-clause
C#
47e5555d6cf2d0644c1216ea8f4e68c2ac134197
Update JsonWebKeySet with RawData property (#463)
IdentityModel/IdentityModel,IdentityModel/IdentityModel
src/Jwk/JsonWebKeySet.cs
src/Jwk/JsonWebKeySet.cs
//------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. // All rights reserved. // // This code is licensed under the MIT License. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files(the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions : // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // //------------------------------------------------------------------------------ using System; using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Serialization; namespace IdentityModel.Jwk; /// <summary> /// Contains a collection of <see cref="JsonWebKey"/> that can be populated from a json string. /// </summary> public class JsonWebKeySet { /// <summary> /// Initializes an new instance of <see cref="JsonWebKeySet"/>. /// </summary> public JsonWebKeySet() { } /// <summary> /// Initializes an new instance of <see cref="JsonWebKeySet"/> from a json string. /// </summary> /// <param name="json">a json string containing values.</param> /// <exception cref="ArgumentNullException">if 'json' is null or whitespace.</exception> public JsonWebKeySet(string json) { if (string.IsNullOrWhiteSpace(json)) throw new ArgumentNullException(nameof(json)); var jwebKeys = JsonSerializer.Deserialize<JsonWebKeySet>(json); Keys = jwebKeys.Keys; RawData = json; } /// <summary> /// A list of JSON web keys /// </summary> [JsonPropertyName("keys")] public List<JsonWebKey> Keys { get; set; } = new(); /// <summary> /// The JSON string used to deserialize this object /// </summary> [JsonIgnore] public string RawData { get; set; }; }
//------------------------------------------------------------------------------ // // Copyright (c) Microsoft Corporation. // All rights reserved. // // This code is licensed under the MIT License. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files(the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and / or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions : // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // //------------------------------------------------------------------------------ using System; using System.Collections.Generic; using System.Text.Json; using System.Text.Json.Serialization; namespace IdentityModel.Jwk; /// <summary> /// Contains a collection of <see cref="JsonWebKey"/> that can be populated from a json string. /// </summary> public class JsonWebKeySet { /// <summary> /// Initializes an new instance of <see cref="JsonWebKeySet"/>. /// </summary> public JsonWebKeySet() { } /// <summary> /// Initializes an new instance of <see cref="JsonWebKeySet"/> from a json string. /// </summary> /// <param name="json">a json string containing values.</param> /// <exception cref="ArgumentNullException">if 'json' is null or whitespace.</exception> public JsonWebKeySet(string json) { if (string.IsNullOrWhiteSpace(json)) throw new ArgumentNullException(nameof(json)); var jwebKeys = JsonSerializer.Deserialize<JsonWebKeySet>(json); Keys = jwebKeys.Keys; } /// <summary> /// A list of JSON web keys /// </summary> [JsonPropertyName("keys")] public List<JsonWebKey> Keys { get; set; } = new(); }
apache-2.0
C#
0c3651074d010811f6fa7aa5d0303e7cadceb0ea
Increment Version
zamanak/Zamanak.WebService
Zamanak.WebService/Properties/AssemblyInfo.cs
Zamanak.WebService/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Zamanak.WebService")] [assembly: AssemblyDescription("This is a client of Zamanak (www.zamanak.ir) web service")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Zamanak")] [assembly: AssemblyProduct("Zamanak.WebService")] [assembly: AssemblyCopyright("Copyright © Zamanak 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("483458e5-4d71-43a0-88c1-6cabe72154e3")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.2.0")] [assembly: AssemblyFileVersion("1.0.2.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Zamanak.WebService")] [assembly: AssemblyDescription("This is a client of Zamanak (www.zamanak.ir) web service")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Zamanak")] [assembly: AssemblyProduct("Zamanak.WebService")] [assembly: AssemblyCopyright("Copyright © Zamanak 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("483458e5-4d71-43a0-88c1-6cabe72154e3")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.1.0")] [assembly: AssemblyFileVersion("1.0.1.0")]
mit
C#
23d1663efb133f10d52980b0ae7cec2a908512cf
Add converters for System.Drawing structures.
eylvisaker/AgateLib
drivers/AgateWinForms/FormsInterop.cs
drivers/AgateWinForms/FormsInterop.cs
using System; using System.Collections.Generic; using System.Text; using Draw = System.Drawing; using ERY.AgateLib.Geometry; namespace ERY.AgateLib.WinForms { public static class FormsInterop { public static Draw.Color ConvertColor(Color clr) { return Draw.Color.FromArgb(clr.ToArgb()); } public static Color ConvertColor(Draw.Color clr) { return Color.FromArgb(clr.ToArgb()); } public static Draw.Rectangle ConvertRectangle(Rectangle rect) { return new Draw.Rectangle(rect.X, rect.Y, rect.Width, rect.Height); } public static Rectangle ConvertRectangle(Draw.Rectangle rect) { return new Rectangle(rect.X, rect.Y, rect.Width, rect.Height); } public static Draw.RectangleF ConvertRectangleF(RectangleF rect) { return new Draw.RectangleF(rect.X, rect.Y, rect.Width, rect.Height); } public static RectangleF ConvertRectangleF(Draw.RectangleF rect) { return new RectangleF(rect.X, rect.Y, rect.Width, rect.Height); } public static Point ConvertPoint(Draw.Point pt) { return new Point(pt.X, pt.Y); } public static Draw.Point ConvertPoint(Point pt) { return new Draw.Point(pt.X, pt.Y); } public static PointF ConvertPointF(Draw.PointF pt) { return new PointF(pt.X, pt.Y); } public static Draw.PointF ConvertPointF(PointF pt) { return new Draw.PointF(pt.X, pt.Y); } public static Size ConvertSize(Draw.Size pt) { return new Size(pt.Width, pt.Height); } public static Draw.Size ConvertSize(Size pt) { return new Draw.Size(pt.Width, pt.Height); } public static SizeF ConvertSizeF(Draw.SizeF pt) { return new SizeF(pt.Width, pt.Height); } public static Draw.SizeF ConvertSizeF(SizeF pt) { return new Draw.SizeF(pt.Width, pt.Height); } } }
using System; using System.Collections.Generic; using System.Text; using Draw = System.Drawing; using Geo = ERY.AgateLib.Geometry; namespace ERY.AgateLib.WinForms { public static class FormsInterop { public static Draw.Rectangle ToRectangle(Geo.Rectangle rect) { return new System.Drawing.Rectangle(rect.X, rect.Y, rect.Width, rect.Height); } } }
mit
C#
ddf539fe7ec545577199c494364ad29e4341dbdb
Remove unnecessary comment
Antaris/RazorEngine,Antaris/RazorEngine
src/test/Test.RazorEngine.Core/ActivatorTestFixture.cs
src/test/Test.RazorEngine.Core/ActivatorTestFixture.cs
namespace RazorEngine.Tests { using System; using System.IO; using Moq; using NUnit.Framework; using Compilation; using Configuration; using Templating; using TestTypes; using TestTypes.Activation; using Text; #if NET45 using Autofac; using Autofac.Features.ResolveAnything; /// <summary> /// Defines a test fixture that provides tests for the <see cref="IActivator"/> type. /// </summary> [TestFixture] public class ActivatorTestFixture { #region Tests /// <summary> /// Tests that a custom activator can be used. In this test case, we're using Autofac /// to handle a instantiation of a custom activator. /// </summary> [Test] public void TemplateService_CanSupportCustomActivator_WithAutofac() { #if RAZOR4 Assert.Ignore("We need to add roslyn to generate custom constructors!"); #endif var container = new ContainerBuilder(); container.RegisterType<ReverseTextFormatter>() .AsSelf() .As<ITextFormatter>(); container.RegisterSource(new AnyConcreteTypeNotAlreadyRegisteredSource()); var config = new TemplateServiceConfiguration { Activator = new AutofacTemplateActivator(container.Build()), BaseTemplateType = typeof(CustomTemplateBase<>), CompilerServiceFactory = new DefaultCompilerServiceFactory() }; using (var service = RazorEngineService.Create(config)) { const string template = "<h1>Hello @Format(Model.Forename)</h1>"; const string expected = "<h1>Hello ttaM</h1>"; var model = new Person { Forename = "Matt" }; string result = service.RunCompile(templateSource: template, name: "template", model: model); Assert.That(result == expected, "Result does not match expected: " + result); } } #endregion } #endif }
namespace RazorEngine.Tests { using System; using System.IO; using Moq; using NUnit.Framework; using Compilation; using Configuration; using Templating; using TestTypes; using TestTypes.Activation; using Text; #if NET45 using Autofac; using Autofac.Features.ResolveAnything; /// <summary> /// Defines a test fixture that provides tests for the <see cref="IActivator"/> type. /// </summary> [TestFixture] public class ActivatorTestFixture { #region Tests /// <summary> /// Tests that a custom activator can be used. In this test case, we're using Autofac /// to handle a instantiation of a custom activator. /// </summary> [Test] public void TemplateService_CanSupportCustomActivator_WithAutofac() { #if RAZOR4 Assert.Ignore("We need to add roslyn to generate custom constructors!"); #endif var container = new ContainerBuilder(); container.RegisterType<ReverseTextFormatter>() .AsSelf() .As<ITextFormatter>(); container.RegisterSource(new AnyConcreteTypeNotAlreadyRegisteredSource()); // TODO: We are forcing it to use the DefaultCompilerServiceFactory // because there has not been supported added for Roslyn to generate // custom constructors. var config = new TemplateServiceConfiguration { Activator = new AutofacTemplateActivator(container.Build()), BaseTemplateType = typeof(CustomTemplateBase<>), CompilerServiceFactory = new DefaultCompilerServiceFactory() }; using (var service = RazorEngineService.Create(config)) { const string template = "<h1>Hello @Format(Model.Forename)</h1>"; const string expected = "<h1>Hello ttaM</h1>"; var model = new Person { Forename = "Matt" }; string result = service.RunCompile(templateSource: template, name: "template", model: model); Assert.That(result == expected, "Result does not match expected: " + result); } } #endregion } #endif }
apache-2.0
C#
8c79cf3aec7727995cd04f93d10fb70fc4561781
Increase version to 2.3.0
Azure/amqpnetlite
src/Properties/Version.cs
src/Properties/Version.cs
// ------------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation // All rights reserved. // // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this // file except in compliance with the License. You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR // NON-INFRINGEMENT. // // See the Apache Version 2.0 License for specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------------------ using System.Reflection; // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // [assembly: AssemblyVersion("2.1.0")] [assembly: AssemblyFileVersion("2.3.0")] [assembly: AssemblyInformationalVersion("2.3.0")]
// ------------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation // All rights reserved. // // Licensed under the Apache License, Version 2.0 (the ""License""); you may not use this // file except in compliance with the License. You may obtain a copy of the License at // http://www.apache.org/licenses/LICENSE-2.0 // // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, // EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR // CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR // NON-INFRINGEMENT. // // See the Apache Version 2.0 License for specific language governing permissions and // limitations under the License. // ------------------------------------------------------------------------------------ using System.Reflection; // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // [assembly: AssemblyVersion("2.1.0")] [assembly: AssemblyFileVersion("2.2.0")] [assembly: AssemblyInformationalVersion("2.2.0")]
apache-2.0
C#
69fd2e6a6649200c9d7690f3fe2da47067636395
Set XmlLocalizationSource.RootDirectoryOfApplication on startup.
fengyeju/aspnetboilerplate,berdankoca/aspnetboilerplate,690486439/aspnetboilerplate,verdentk/aspnetboilerplate,verdentk/aspnetboilerplate,fengyeju/aspnetboilerplate,verdentk/aspnetboilerplate,fengyeju/aspnetboilerplate,ilyhacker/aspnetboilerplate,ZhaoRd/aspnetboilerplate,ZhaoRd/aspnetboilerplate,andmattia/aspnetboilerplate,lemestrez/aspnetboilerplate,abdllhbyrktr/aspnetboilerplate,lemestrez/aspnetboilerplate,zquans/aspnetboilerplate,andmattia/aspnetboilerplate,s-takatsu/aspnetboilerplate,s-takatsu/aspnetboilerplate,ryancyq/aspnetboilerplate,lvjunlei/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,ShiningRush/aspnetboilerplate,berdankoca/aspnetboilerplate,abdllhbyrktr/aspnetboilerplate,Nongzhsh/aspnetboilerplate,AlexGeller/aspnetboilerplate,zquans/aspnetboilerplate,4nonym0us/aspnetboilerplate,lvjunlei/aspnetboilerplate,SXTSOFT/aspnetboilerplate,abdllhbyrktr/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,yuzukwok/aspnetboilerplate,SXTSOFT/aspnetboilerplate,oceanho/aspnetboilerplate,lvjunlei/aspnetboilerplate,zclmoon/aspnetboilerplate,zclmoon/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,690486439/aspnetboilerplate,ryancyq/aspnetboilerplate,4nonym0us/aspnetboilerplate,oceanho/aspnetboilerplate,carldai0106/aspnetboilerplate,ryancyq/aspnetboilerplate,ZhaoRd/aspnetboilerplate,Nongzhsh/aspnetboilerplate,s-takatsu/aspnetboilerplate,ShiningRush/aspnetboilerplate,lemestrez/aspnetboilerplate,Nongzhsh/aspnetboilerplate,yuzukwok/aspnetboilerplate,ilyhacker/aspnetboilerplate,AlexGeller/aspnetboilerplate,jaq316/aspnetboilerplate,oceanho/aspnetboilerplate,beratcarsi/aspnetboilerplate,beratcarsi/aspnetboilerplate,carldai0106/aspnetboilerplate,4nonym0us/aspnetboilerplate,carldai0106/aspnetboilerplate,ilyhacker/aspnetboilerplate,berdankoca/aspnetboilerplate,beratcarsi/aspnetboilerplate,690486439/aspnetboilerplate,luchaoshuai/aspnetboilerplate,ShiningRush/aspnetboilerplate,zquans/aspnetboilerplate,carldai0106/aspnetboilerplate,andmattia/aspnetboilerplate,virtualcca/aspnetboilerplate,yuzukwok/aspnetboilerplate,zclmoon/aspnetboilerplate,virtualcca/aspnetboilerplate,jaq316/aspnetboilerplate,jaq316/aspnetboilerplate,SXTSOFT/aspnetboilerplate,ryancyq/aspnetboilerplate,virtualcca/aspnetboilerplate,aspnetboilerplate/aspnetboilerplate,AlexGeller/aspnetboilerplate,luchaoshuai/aspnetboilerplate
src/Abp.AspNetCore/AspNetCore/AbpStartup.cs
src/Abp.AspNetCore/AspNetCore/AbpStartup.cs
using System; using Abp.Localization.Sources.Xml; using Abp.Threading; using Castle.Windsor.MsDependencyInjection; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; namespace Abp.AspNetCore { //TODO: Inject all available services? public abstract class AbpStartup : IDisposable { protected AbpBootstrapper AbpBootstrapper { get; private set; } protected AbpStartup(IHostingEnvironment env, bool initialize = true) { //TODO: TEST XmlLocalizationSource.RootDirectoryOfApplication = env.WebRootPath; AbpBootstrapper = new AbpBootstrapper(); if (initialize) { InitializeAbp(); } } protected virtual void InitializeAbp() { ThreadCultureSanitizer.Sanitize(); AbpBootstrapper.Initialize(); } public virtual IServiceProvider ConfigureServices(IServiceCollection services) { return WindsorRegistrationHelper.CreateServiceProvider(AbpBootstrapper.IocManager.IocContainer, services); } public virtual void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { } public void Dispose() { //AbpBootstrapper.Dispose(); //TODO: Dispose? } } }
using System; using Abp.Threading; using Castle.Windsor.MsDependencyInjection; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; namespace Abp.AspNetCore { //TODO: Inject all available services? public abstract class AbpStartup : IDisposable { protected AbpBootstrapper AbpBootstrapper { get; private set; } protected AbpStartup(IHostingEnvironment env, bool initialize = true) { AbpBootstrapper = new AbpBootstrapper(); if (initialize) { InitializeAbp(); } } protected virtual void InitializeAbp() { ThreadCultureSanitizer.Sanitize(); AbpBootstrapper.Initialize(); } public virtual IServiceProvider ConfigureServices(IServiceCollection services) { return WindsorRegistrationHelper.CreateServiceProvider(AbpBootstrapper.IocManager.IocContainer, services); } public virtual void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { } public void Dispose() { //AbpBootstrapper.Dispose(); //TODO: Dispose? } } }
mit
C#
e520c2ca6c8927e357bdd574479bf81f91606471
update AuthorizationScope enums
vinhch/BizwebSharp
src/BizwebSharp/Enums/AuthorizationScope.cs
src/BizwebSharp/Enums/AuthorizationScope.cs
using System.Runtime.Serialization; using BizwebSharp.Converters; using Newtonsoft.Json; namespace BizwebSharp.Enums { [JsonConverter(typeof(NullableEnumConverter<AuthorizationScope>))] public enum AuthorizationScope { [EnumMember(Value = "read_content")] ReadContent, [EnumMember(Value = "write_content")] WriteContent, [EnumMember(Value = "read_themes")] ReadThemes, [EnumMember(Value = "write_themes")] WriteThemes, [EnumMember(Value = "read_products")] ReadProducts, [EnumMember(Value = "write_products")] WriteProducts, [EnumMember(Value = "read_customers")] ReadCustomers, [EnumMember(Value = "write_customers")] WriteCustomers, [EnumMember(Value = "read_orders")] ReadOrders, [EnumMember(Value = "write_orders")] WriteOrders, [EnumMember(Value = "read_script_tags")] ReadScriptTags, [EnumMember(Value = "write_script_tags")] WriteScriptTags, [EnumMember(Value = "read_fulfillments")] ReadFulfillments, [EnumMember(Value = "write_fulfillments")] WriteFulfillments, [EnumMember(Value = "read_shipping")] ReadShipping, [EnumMember(Value = "write_shipping")] WriteShipping, [EnumMember(Value = "read_analytics")] ReadAnalytics, [EnumMember(Value = "read_users")] ReadUsers, [EnumMember(Value = "write_users")] WriteUsers, [EnumMember(Value = "read_discounts")] ReadDiscounts, [EnumMember(Value = "write_discounts")] WriteDiscounts } }
using System.Runtime.Serialization; using BizwebSharp.Converters; using Newtonsoft.Json; namespace BizwebSharp.Enums { [JsonConverter(typeof(NullableEnumConverter<AuthorizationScope>))] public enum AuthorizationScope { [EnumMember(Value = "read_content")] ReadContent, [EnumMember(Value = "write_content")] WriteContent, [EnumMember(Value = "read_themes")] ReadThemes, [EnumMember(Value = "write_themes")] WriteThemes, [EnumMember(Value = "read_products")] ReadProducts, [EnumMember(Value = "write_products")] WriteProducts, [EnumMember(Value = "read_customers")] ReadCustomers, [EnumMember(Value = "write_customers")] WriteCustomers, [EnumMember(Value = "read_orders")] ReadOrders, [EnumMember(Value = "write_orders")] WriteOrders, [EnumMember(Value = "read_script_tags")] ReadScriptTags, [EnumMember(Value = "write_script_tags")] WriteScriptTags, [EnumMember(Value = "read_fulfillments")] ReadFulfillments, [EnumMember(Value = "write_fulfillments")] WriteFulfillments, [EnumMember(Value = "read_shipping")] ReadShipping, [EnumMember(Value = "write_shipping")] WriteShipping, [EnumMember(Value = "read_analytics")] ReadAnalytics, [EnumMember(Value = "read_users")] ReadUsers, [EnumMember(Value = "write_users")] WriteUsers } }
mit
C#
310f5b78dc371386619d9ada997947cec0ea82a9
Update ScriptOptions.cs
nicklv/n2cms,VoidPointerAB/n2cms,DejanMilicic/n2cms,n2cms/n2cms,n2cms/n2cms,VoidPointerAB/n2cms,EzyWebwerkstaden/n2cms,n2cms/n2cms,bussemac/n2cms,DejanMilicic/n2cms,SntsDev/n2cms,SntsDev/n2cms,SntsDev/n2cms,SntsDev/n2cms,nimore/n2cms,nimore/n2cms,nicklv/n2cms,nicklv/n2cms,n2cms/n2cms,bussemac/n2cms,bussemac/n2cms,EzyWebwerkstaden/n2cms,bussemac/n2cms,EzyWebwerkstaden/n2cms,EzyWebwerkstaden/n2cms,EzyWebwerkstaden/n2cms,DejanMilicic/n2cms,bussemac/n2cms,nimore/n2cms,VoidPointerAB/n2cms,nicklv/n2cms,nicklv/n2cms,DejanMilicic/n2cms,nimore/n2cms,VoidPointerAB/n2cms
src/Framework/N2/Resources/ScriptOptions.cs
src/Framework/N2/Resources/ScriptOptions.cs
using System; namespace N2.Resources { [Flags] public enum ScriptOptions { /// <summary>Add the script exactly as given.</summary> None = 1, /// <summary>Embed the script in script tags.</summary> ScriptTags = 2, /// <summary>Embed the script in script tags and use jQuery to await document loaded event.</summary> DocumentReady = 4, /// <summary>The script is located at the supplied url.</summary> Include = 8, /// <summary>Try to register this before any other scripts.</summary> Prioritize = 16 } }
using System; namespace N2.Resources { [Flags] public enum ScriptOptions { /// <summary>Add the script exactly as given.</summary> None = 1, /// <summary>Embed the script in script tags.</summary> ScriptTags = 2, /// <summary>Embed the script in script tags and use jQuery to await document loaded event.</summary> DocumentReady = 4, /// <summary>The script is located at the supplied url.</summary> Include = 8, /// <summary>Try to register this before any other scripts.</summary> Prioritize = 18 } }
lgpl-2.1
C#
cd7414005d1f5a3bf36f83d7ae7e66c6156b9e9c
Debug output removed
drussilla/ConsoleX
Project/Assets/TestConsole.cs
Project/Assets/TestConsole.cs
using UnityEngine; using ConsoleX; using ConsoleX.Helpers; public class TestConsole : MonoBehaviour { public ConsoleController ConsoleController; // Use this for initialization void Start () { ConsoleController.Console.RegisterCommand("test", strings => {Debug.Log("test");}); ConsoleController.Console.RegisterCommand("test2", strings => { Debug.Log("test2"); }); } // Update is called once per frame private void Update() { if (Input.GetKeyDown(KeyCode.BackQuote)) { if (!ConsoleController.IsVisible) { ConsoleController.Show(); } else { ConsoleController.Hide(); } } //Event currentEvent = new Event(); //while (Event.PopEvent(currentEvent)) //{ // if (currentEvent.rawType == EventType.KeyDown && // currentEvent.character == '`') // { // currentEvent.Use(); // break; // } //} } }
using UnityEngine; using ConsoleX; using ConsoleX.Helpers; public class TestConsole : MonoBehaviour { public ConsoleController ConsoleController; // Use this for initialization void Start () { ConsoleController.Console.RegisterCommand("test", strings => {Debug.Log("test");}); ConsoleController.Console.RegisterCommand("test2", strings => { Debug.Log("test2"); }); Debug.Log(Time.frameCount); StartCoroutine(this.DoActionAfterFrames(() => Debug.Log(Time.frameCount), 5)); } // Update is called once per frame private void Update() { if (Input.GetKeyDown(KeyCode.BackQuote)) { if (!ConsoleController.IsVisible) { ConsoleController.Show(); } else { ConsoleController.Hide(); } } //Event currentEvent = new Event(); //while (Event.PopEvent(currentEvent)) //{ // if (currentEvent.rawType == EventType.KeyDown && // currentEvent.character == '`') // { // currentEvent.Use(); // break; // } //} } }
mit
C#
abd6c7de2b9c7655ea54cc25977a83660e73899c
Fix help.
KirillOsenkov/CodeCleanupTools
dos2unix/dos2unix.cs
dos2unix/dos2unix.cs
using System; using System.IO; class dos2unix { static void Main(string[] args) { if (args.Length != 1) { PrintHelp(); return; } string input = args[0]; if (!File.Exists(input)) { Console.WriteLine($"Input file {input} doesn't exist"); return; } Convert(input); } private static void PrintHelp() { Console.WriteLine("A tool to convert a file from CRLF to LF. Rewrites the file in-place."); Console.WriteLine(" Usage: dos2unix <filepath>"); } private static void Convert(string filePath) { var lines = File.ReadAllLines(filePath); var text = string.Join("\n", lines); File.WriteAllText(filePath, text); } }
using System; using System.IO; class dos2unix { static void Main(string[] args) { if (args.Length != 1) { PrintHelp(); return; } string input = args[0]; if (!File.Exists(input)) { Console.WriteLine($"Input file {input} doesn't exist"); return; } Convert(input); } private static void PrintHelp() { Console.WriteLine("A tool to convert a file from CRLF to LF"); Console.WriteLine(" Usage: dos2unix <input> <output>"); } private static void Convert(string filePath) { var lines = File.ReadAllLines(filePath); var text = string.Join("\n", lines); File.WriteAllText(filePath, text); } }
apache-2.0
C#
2c35fcfa72560b2f3dead1627792c6e9edfead16
Add comment.
pdelvo/roslyn,dpoeschl/roslyn,mmitche/roslyn,wvdd007/roslyn,yeaicc/roslyn,bartdesmet/roslyn,mattscheffer/roslyn,dpoeschl/roslyn,jcouv/roslyn,bartdesmet/roslyn,TyOverby/roslyn,mgoertz-msft/roslyn,kelltrick/roslyn,AnthonyDGreen/roslyn,MichalStrehovsky/roslyn,nguerrera/roslyn,srivatsn/roslyn,panopticoncentral/roslyn,tvand7093/roslyn,orthoxerox/roslyn,mgoertz-msft/roslyn,abock/roslyn,genlu/roslyn,jamesqo/roslyn,jmarolf/roslyn,AmadeusW/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,jkotas/roslyn,nguerrera/roslyn,xasx/roslyn,ErikSchierboom/roslyn,khyperia/roslyn,aelij/roslyn,CyrusNajmabadi/roslyn,MattWindsor91/roslyn,VSadov/roslyn,KirillOsenkov/roslyn,tmeschter/roslyn,lorcanmooney/roslyn,jasonmalinowski/roslyn,kelltrick/roslyn,AmadeusW/roslyn,mmitche/roslyn,paulvanbrenk/roslyn,abock/roslyn,lorcanmooney/roslyn,tvand7093/roslyn,weltkante/roslyn,jkotas/roslyn,stephentoub/roslyn,AnthonyDGreen/roslyn,ErikSchierboom/roslyn,weltkante/roslyn,eriawan/roslyn,mattscheffer/roslyn,TyOverby/roslyn,jamesqo/roslyn,OmarTawfik/roslyn,VSadov/roslyn,reaction1989/roslyn,TyOverby/roslyn,tvand7093/roslyn,jmarolf/roslyn,khyperia/roslyn,paulvanbrenk/roslyn,khyperia/roslyn,KevinRansom/roslyn,OmarTawfik/roslyn,eriawan/roslyn,genlu/roslyn,wvdd007/roslyn,CaptainHayashi/roslyn,dotnet/roslyn,jcouv/roslyn,swaroop-sridhar/roslyn,yeaicc/roslyn,KevinRansom/roslyn,KirillOsenkov/roslyn,brettfo/roslyn,yeaicc/roslyn,reaction1989/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,CaptainHayashi/roslyn,heejaechang/roslyn,MattWindsor91/roslyn,AlekseyTs/roslyn,jkotas/roslyn,jasonmalinowski/roslyn,jamesqo/roslyn,AmadeusW/roslyn,tmeschter/roslyn,robinsedlaczek/roslyn,mavasani/roslyn,swaroop-sridhar/roslyn,physhi/roslyn,Giftednewt/roslyn,diryboy/roslyn,bkoelman/roslyn,genlu/roslyn,Giftednewt/roslyn,aelij/roslyn,gafter/roslyn,tmat/roslyn,reaction1989/roslyn,diryboy/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,mavasani/roslyn,AlekseyTs/roslyn,MattWindsor91/roslyn,heejaechang/roslyn,shyamnamboodiripad/roslyn,Hosch250/roslyn,brettfo/roslyn,jmarolf/roslyn,mmitche/roslyn,MichalStrehovsky/roslyn,AnthonyDGreen/roslyn,robinsedlaczek/roslyn,pdelvo/roslyn,cston/roslyn,DustinCampbell/roslyn,bartdesmet/roslyn,agocke/roslyn,stephentoub/roslyn,tannergooding/roslyn,AlekseyTs/roslyn,DustinCampbell/roslyn,diryboy/roslyn,agocke/roslyn,bkoelman/roslyn,mattscheffer/roslyn,tmeschter/roslyn,CyrusNajmabadi/roslyn,srivatsn/roslyn,dotnet/roslyn,paulvanbrenk/roslyn,Hosch250/roslyn,xasx/roslyn,CaptainHayashi/roslyn,agocke/roslyn,orthoxerox/roslyn,gafter/roslyn,Giftednewt/roslyn,tmat/roslyn,bkoelman/roslyn,mgoertz-msft/roslyn,pdelvo/roslyn,sharwell/roslyn,brettfo/roslyn,jcouv/roslyn,OmarTawfik/roslyn,tmat/roslyn,CyrusNajmabadi/roslyn,MichalStrehovsky/roslyn,MattWindsor91/roslyn,sharwell/roslyn,weltkante/roslyn,jasonmalinowski/roslyn,mavasani/roslyn,cston/roslyn,dotnet/roslyn,sharwell/roslyn,panopticoncentral/roslyn,aelij/roslyn,davkean/roslyn,stephentoub/roslyn,ErikSchierboom/roslyn,orthoxerox/roslyn,robinsedlaczek/roslyn,davkean/roslyn,swaroop-sridhar/roslyn,dpoeschl/roslyn,VSadov/roslyn,abock/roslyn,kelltrick/roslyn,davkean/roslyn,wvdd007/roslyn,xasx/roslyn,panopticoncentral/roslyn,cston/roslyn,gafter/roslyn,KevinRansom/roslyn,Hosch250/roslyn,tannergooding/roslyn,srivatsn/roslyn,DustinCampbell/roslyn,KirillOsenkov/roslyn,nguerrera/roslyn,tannergooding/roslyn,eriawan/roslyn,shyamnamboodiripad/roslyn,physhi/roslyn,shyamnamboodiripad/roslyn,heejaechang/roslyn,physhi/roslyn,lorcanmooney/roslyn
src/Features/Core/Portable/AddImport/CodeActions/ProjectSymbolReferenceCodeAction.cs
src/Features/Core/Portable/AddImport/CodeActions/ProjectSymbolReferenceCodeAction.cs
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Immutable; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.AddImport { internal abstract partial class AbstractAddImportCodeFixProvider<TSimpleNameSyntax> { /// <summary> /// Code action for adding an import when we find a symbol in source in either our /// starting project, or some other unreferenced project in the solution. If we /// find a source symbol in a different project, we'll also add a p2p reference when /// we apply the code action. /// </summary> private class ProjectSymbolReferenceCodeAction : SymbolReferenceCodeAction { /// <summary> /// The optional id for a <see cref="Project"/> we'd like to add a reference to. /// </summary> private readonly ProjectId _projectReferenceToAdd; public ProjectSymbolReferenceCodeAction( Document originalDocument, ImmutableArray<TextChange> textChanges, string title, ImmutableArray<string> tags, CodeActionPriority priority, ProjectId projectReferenceToAdd) : base(originalDocument, textChanges, title, tags, priority) { // We only want to add a project reference if the project the import references // is different from the project we started from. if (projectReferenceToAdd != originalDocument.Project.Id) { _projectReferenceToAdd = projectReferenceToAdd; } } internal override bool PerformFinalApplicabilityCheck => _projectReferenceToAdd != null; internal override bool IsApplicable(Workspace workspace) => _projectReferenceToAdd != null && workspace.CanAddProjectReference(OriginalDocument.Project.Id, _projectReferenceToAdd); protected override Project UpdateProject(Project project) { return _projectReferenceToAdd == null ? project : project.AddProjectReference(new ProjectReference(_projectReferenceToAdd)); } } } }
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Immutable; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.AddImport { internal abstract partial class AbstractAddImportCodeFixProvider<TSimpleNameSyntax> { private class ProjectSymbolReferenceCodeAction : SymbolReferenceCodeAction { /// <summary> /// The optional id for a <see cref="Project"/> we'd like to add a reference to. /// </summary> private readonly ProjectId _projectReferenceToAdd; public ProjectSymbolReferenceCodeAction( Document originalDocument, ImmutableArray<TextChange> textChanges, string title, ImmutableArray<string> tags, CodeActionPriority priority, ProjectId projectReferenceToAdd) : base(originalDocument, textChanges, title, tags, priority) { // We only want to add a project reference if the project the import references // is different from the project we started from. if (projectReferenceToAdd != originalDocument.Project.Id) { _projectReferenceToAdd = projectReferenceToAdd; } } internal override bool PerformFinalApplicabilityCheck => _projectReferenceToAdd != null; internal override bool IsApplicable(Workspace workspace) => _projectReferenceToAdd != null && workspace.CanAddProjectReference(OriginalDocument.Project.Id, _projectReferenceToAdd); protected override Project UpdateProject(Project project) { return _projectReferenceToAdd == null ? project : project.AddProjectReference(new ProjectReference(_projectReferenceToAdd)); } } } }
mit
C#
75425fd968968bd1a4d8a5d7056e31497717d6e1
Add more properties to AnimationView
modplug/LottieXamarin,martijn00/LottieXamarin,fabionuno/LottieXamarin,fabionuno/LottieXamarin,martijn00/LottieXamarin
Lottie.Forms/AnimationView.cs
Lottie.Forms/AnimationView.cs
using System; using Xamarin.Forms; namespace Lottie.Forms { public class AnimationView : View { public static readonly BindableProperty ProgressProperty = BindableProperty.Create(nameof(Progress), typeof(float), typeof(AnimationView), default(float)); public static readonly BindableProperty LoopProperty = BindableProperty.Create(nameof(Loop), typeof(bool), typeof(AnimationView), default(bool)); public static readonly BindableProperty IsPlayingProperty = BindableProperty.Create(nameof(IsPlaying), typeof(bool), typeof(AnimationView), default(bool)); public static readonly BindableProperty DurationProperty = BindableProperty.Create(nameof(Duration), typeof(TimeSpan), typeof(AnimationView), default(TimeSpan)); public static readonly BindableProperty AnimationProperty = BindableProperty.Create(nameof(Animation), typeof(string), typeof(AnimationView), default(string)); public float Progress { get { return (float) GetValue(ProgressProperty); } set { SetValue(ProgressProperty, value); } } public string Animation { get { return (string) GetValue(AnimationProperty); } set { SetValue(AnimationProperty, value); } } public TimeSpan Duration { get { return (TimeSpan) GetValue(DurationProperty); } set { SetValue(DurationProperty, value); } } public bool Loop { get { return (bool) GetValue(LoopProperty); } set { SetValue(LoopProperty, value); } } public bool IsPlaying { get { return (bool) GetValue(IsPlayingProperty); } set { SetValue(IsPlayingProperty, value); } } public event EventHandler OnPlay; public void Play() { OnPlay?.Invoke(this, new EventArgs()); } public event EventHandler OnPause; public void Pause() { OnPause?.Invoke(this, new EventArgs()); } } }
using System; namespace Lottie.Forms { public class AnimationView : Xamarin.Forms.View { public static readonly Xamarin.Forms.BindableProperty ProgressProperty = Xamarin.Forms.BindableProperty.Create(nameof(Progress), typeof(float), typeof(Lottie.Forms.AnimationView), default(float)); public float Progress { get { return (float)GetValue(ProgressProperty); } set { SetValue(ProgressProperty, value); } } public static readonly Xamarin.Forms.BindableProperty AnimationProperty = Xamarin.Forms.BindableProperty.Create(nameof(Animation), typeof(string), typeof(Lottie.Forms.AnimationView), default(string), Xamarin.Forms.BindingMode.OneWay); public string Animation { get { return (string)GetValue(AnimationProperty); } set { SetValue(AnimationProperty, value); } } // TODO: Loop, Autoplay, IsPlaying, Duration public event EventHandler OnPlay; public void Play() { OnPlay?.Invoke(this, new EventArgs()); } public event EventHandler OnPause; public void Pause() { OnPause?.Invoke(this, new EventArgs()); } } }
apache-2.0
C#
0239c109292bf30e9e8c9366a12445dc9ff76439
Add localised test coverage of new wait function
EVAST9919/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,peppy/osu-framework,ZLima12/osu-framework,ppy/osu-framework,peppy/osu-framework,smoogipooo/osu-framework,smoogipooo/osu-framework,EVAST9919/osu-framework,ZLima12/osu-framework,ppy/osu-framework,EVAST9919/osu-framework,ppy/osu-framework
osu.Framework.Tests/Threading/AsyncDisposalQueueTest.cs
osu.Framework.Tests/Threading/AsyncDisposalQueueTest.cs
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Logging; namespace osu.Framework.Tests.Threading { [TestFixture] public class AsyncDisposalQueueTest { [Test] public void TestManyAsyncDisposal() { var objects = new List<DisposableObject>(); for (int i = 0; i < 10000; i++) objects.Add(new DisposableObject()); objects.ForEach(AsyncDisposalQueue.Enqueue); int attempts = 1000; while (!objects.All(o => o.IsDisposed)) { if (attempts-- == 0) Assert.Fail("Expected all objects to dispose."); Thread.Sleep(10); } Logger.Log(objects.Select(d => d.TaskId).Distinct().Count().ToString()); // It's very unlikely for this to fail by chance due to the number of objects being disposed and computational time requirement of task scheduling Assert.That(objects.Select(d => d.TaskId).Distinct().Count(), Is.LessThan(objects.Count)); } [Test] public void TestManyAsyncDisposalUsingWait() { var objects = new List<DisposableObject>(); for (int i = 0; i < 10000; i++) objects.Add(new DisposableObject()); objects.ForEach(AsyncDisposalQueue.Enqueue); AsyncDisposalQueue.WaitForEmpty(); Assert.That(objects.All(o => o.IsDisposed)); } private class DisposableObject : IDisposable { public int? TaskId { get; private set; } public bool IsDisposed { get; private set; } public void Dispose() { TaskId = Task.CurrentId; IsDisposed = true; } } } }
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Logging; namespace osu.Framework.Tests.Threading { [TestFixture] public class AsyncDisposalQueueTest { [Test] public void TestManyAsyncDisposal() { var objects = new List<DisposableObject>(); for (int i = 0; i < 10000; i++) objects.Add(new DisposableObject()); objects.ForEach(AsyncDisposalQueue.Enqueue); int attempts = 1000; while (!objects.All(o => o.IsDisposed)) { if (attempts-- == 0) Assert.Fail("Expected all objects to dispose."); Thread.Sleep(10); } Logger.Log(objects.Select(d => d.TaskId).Distinct().Count().ToString()); // It's very unlikely for this to fail by chance due to the number of objects being disposed and computational time requirement of task scheduling Assert.That(objects.Select(d => d.TaskId).Distinct().Count(), Is.LessThan(objects.Count)); } private class DisposableObject : IDisposable { public int? TaskId { get; private set; } public bool IsDisposed { get; private set; } public void Dispose() { TaskId = Task.CurrentId; IsDisposed = true; } } } }
mit
C#