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
0e82ec449df2f476792df8ccd1a762be3c04407b
Update minor version
rafd123/PowerBridge
src/PowerBridge/Properties/AssemblyInfo.cs
src/PowerBridge/Properties/AssemblyInfo.cs
using System; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Resources; [assembly: CLSCompliant(true)] [assembly: ComVisible(false)] [assembly: AssemblyTitle("PowerBridge")] [assembly: AssemblyDescription("Build tasks that enable running PowerShell scripts from MSBuild.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Rafael Dowling Goodman")] [assembly: AssemblyProduct("PowerBridge")] [assembly: AssemblyCopyright("Copyright © Rafael Dowling Goodman 2014")] [assembly: AssemblyVersion("1.3.*")] [assembly: NeutralResourcesLanguageAttribute("en-US")] [assembly: InternalsVisibleTo("PowerBridge.Tests")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
using System; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Resources; [assembly: CLSCompliant(true)] [assembly: ComVisible(false)] [assembly: AssemblyTitle("PowerBridge")] [assembly: AssemblyDescription("Build tasks that enable running PowerShell scripts from MSBuild.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Rafael Dowling Goodman")] [assembly: AssemblyProduct("PowerBridge")] [assembly: AssemblyCopyright("Copyright © Rafael Dowling Goodman 2014")] [assembly: AssemblyVersion("1.2.*")] [assembly: NeutralResourcesLanguageAttribute("en-US")] [assembly: InternalsVisibleTo("PowerBridge.Tests")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
mit
C#
d0a17d17ed92b55183e441a5c6c2e89d40c97592
Refactor TrimControllerFromTypeName
danmalcolm/RezRouting.Net,danmalcolm/RezRouting.Net,danmalcolm/RezRouting.Net
src/RezRouting/Utility/RouteValueHelper.cs
src/RezRouting/Utility/RouteValueHelper.cs
using System; namespace RezRouting.Utility { internal static class RouteValueHelper { public static string TrimControllerFromTypeName(Type controllerType) { string value = controllerType.Name; if (value.EndsWith("controller", StringComparison.InvariantCultureIgnoreCase)) { value = value.Substring(0, value.Length - 10); } return value; } } }
using System; namespace RezRouting.Utility { internal static class RouteValueHelper { public static string TrimControllerFromTypeName(Type controllerType) { string value = controllerType.Name; int index = value.LastIndexOf("Controller", StringComparison.InvariantCultureIgnoreCase); if (index != -1) { value = value.Substring(0, index); } return value; } } }
mit
C#
1c74e56bab1679e7d42a52b7cc84126e66a10dad
Increase the point at which normal keys start in ManiaAction
ppy/osu,UselessToucan/osu,EVAST9919/osu,DrabWeb/osu,peppy/osu-new,smoogipoo/osu,DrabWeb/osu,NeoAdonis/osu,ppy/osu,Frontear/osuKyzer,2yangk23/osu,smoogipoo/osu,peppy/osu,johnneijzen/osu,EVAST9919/osu,Nabile-Rahmani/osu,DrabWeb/osu,naoey/osu,ZLima12/osu,ppy/osu,peppy/osu,UselessToucan/osu,2yangk23/osu,NeoAdonis/osu,johnneijzen/osu,NeoAdonis/osu,ZLima12/osu,UselessToucan/osu,peppy/osu,naoey/osu,smoogipoo/osu,naoey/osu,smoogipooo/osu
osu.Game.Rulesets.Mania/ManiaInputManager.cs
osu.Game.Rulesets.Mania/ManiaInputManager.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.ComponentModel; using osu.Framework.Input.Bindings; using osu.Game.Rulesets.UI; namespace osu.Game.Rulesets.Mania { public class ManiaInputManager : RulesetInputManager<ManiaAction> { public ManiaInputManager(RulesetInfo ruleset, int variant) : base(ruleset, variant, SimultaneousBindingMode.Unique) { } } public enum ManiaAction { [Description("Special")] Special, [Description("Special")] Specia2, [Description("Key 1")] Key1 = 1000, [Description("Key 2")] Key2, [Description("Key 3")] Key3, [Description("Key 4")] Key4, [Description("Key 5")] Key5, [Description("Key 6")] Key6, [Description("Key 7")] Key7, [Description("Key 8")] Key8, [Description("Key 9")] Key9 } }
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.ComponentModel; using osu.Framework.Input.Bindings; using osu.Game.Rulesets.UI; namespace osu.Game.Rulesets.Mania { public class ManiaInputManager : RulesetInputManager<ManiaAction> { public ManiaInputManager(RulesetInfo ruleset, int variant) : base(ruleset, variant, SimultaneousBindingMode.Unique) { } } public enum ManiaAction { [Description("Special")] Special, [Description("Special")] Specia2, [Description("Key 1")] Key1 = 10, [Description("Key 2")] Key2, [Description("Key 3")] Key3, [Description("Key 4")] Key4, [Description("Key 5")] Key5, [Description("Key 6")] Key6, [Description("Key 7")] Key7, [Description("Key 8")] Key8, [Description("Key 9")] Key9 } }
mit
C#
4b62ae94105f8fc33a2aa10ce6a854cbef88ee1c
Remove code form C# OpenCL code generator.
unstope/Brahma.FSharp,ksmirenko/Brahma.FSharp,gsvgit/Brahma.FSharp,YaccConstructor/Brahma.FSharp,gsvgit/Brahma.FSharp,VaseninaAnna/Brahma.FSharp,ksmirenko/Brahma.FSharp,YaccConstructor/Brahma.FSharp,VaseninaAnna/Brahma.FSharp,VaseninaAnna/Brahma.FSharp,unstope/Brahma.FSharp,gsvgit/Brahma.FSharp,YaccConstructor/Brahma.FSharp,unstope/Brahma.FSharp,YaccConstructor/Brahma.FSharp,VaseninaAnna/Brahma.FSharp,ksmirenko/Brahma.FSharp,ksmirenko/Brahma.FSharp
Source/Brahma.OpenCL/CLCodeGenerator.cs
Source/Brahma.OpenCL/CLCodeGenerator.cs
#region License and Copyright Notice // Copyright (c) 2010 Ananth B. // All rights reserved. // // The contents of this file are made available under the terms of the // Eclipse Public License v1.0 (the "License") which accompanies this // distribution, and is available at the following URL: // http://www.opensource.org/licenses/eclipse-1.0.php // // Software distributed under the License is distributed on an "AS IS" basis, // WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for // the specific language governing rights and limitations under the License. // // By using this software in any fashion, you are agreeing to be bound by the // terms of the License. #endregion using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Text; namespace Brahma.OpenCL { public static class CLCodeGenerator { public const string KernelName = "brahmaKernel"; private sealed class CodeGenerator : ExpressionVisitor { } } }
#region License and Copyright Notice // Copyright (c) 2010 Ananth B. // All rights reserved. // // The contents of this file are made available under the terms of the // Eclipse Public License v1.0 (the "License") which accompanies this // distribution, and is available at the following URL: // http://www.opensource.org/licenses/eclipse-1.0.php // // Software distributed under the License is distributed on an "AS IS" basis, // WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for // the specific language governing rights and limitations under the License. // // By using this software in any fashion, you are agreeing to be bound by the // terms of the License. #endregion using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Text; namespace Brahma.OpenCL { public static class CLCodeGenerator { public const string KernelName = "brahmaKernel"; private sealed class CodeGenerator : ExpressionVisitor { private readonly ComputeProvider _provider; private readonly LambdaExpression _lambda; private readonly List<MemberExpression> _closures = new List<MemberExpression>(); private string _functionName = string.Empty; private struct FunctionDescriptor { public string Code; public Type ReturnType; public Type[] ParameterTypes; } private readonly Dictionary<string, FunctionDescriptor> _functions = new Dictionary<string, FunctionDescriptor>(); private StringBuilder _code = new StringBuilder(); private readonly List<string> _declaredMembers = new List<string>(); private static IEnumerable<Type> GetAllButLast(Type[] types) { for (int i = 0; i < types.Length; i++) if (i < types.Length - 1) yield return types[i]; } } } }
epl-1.0
C#
46234df1e66946273a8e89b93ecdcda625c3f5f6
Disable parallel tests again
PlayFab/consuldotnet
Consul.Test/Properties/AssemblyInfo.cs
Consul.Test/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; using Xunit; // 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("ConsulTest")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ConsulTest")] [assembly: AssemblyCopyright("Copyright © 2015")] [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("0728d942-1598-4fad-94b7-950f4777cb27")] // 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: CollectionBehavior(DisableTestParallelization = true)]
using System.Reflection; using System.Runtime.InteropServices; using Xunit; // 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("ConsulTest")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ConsulTest")] [assembly: AssemblyCopyright("Copyright © 2015")] [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("0728d942-1598-4fad-94b7-950f4777cb27")] // 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: CollectionBehavior(DisableTestParallelization = true)]
apache-2.0
C#
40910dbe4ffa868557fff7b50a2d07e3ee1c22e7
Use flags for environments for being able to do bit wise operations
mattgwagner/CertiPay.Common
CertiPay.Common/EnvUtil.cs
CertiPay.Common/EnvUtil.cs
using CertiPay.Common.Logging; using System; using System.Configuration; namespace CertiPay.Common { /// <summary> /// A mechanism for determining the current execution environment based on a configuration setting. /// Useful for executing different code paths if running locally our outside of production. /// /// This requires that ConfigurationManager.AppSettings["Environment"] is set to Local/Test/Staging/Production /// </summary> public static class EnvUtil { [Flags] public enum Environment : byte { Local = 0, Test = 1 << 0, Staging = 1 << 1, Production = 1 << 2 } /// <summary> /// Returns the current executing environment. Defaults to Local if no value is set in the config /// </summary> public static Environment Current { get { return current.Value; } } /// <summary> /// Returns true if the current environment is marked as Environment.Local /// </summary> public static Boolean IsLocal { get { return Environment.Local == Current; } } /// <summary> /// Returns true if the current environment is marked as Environment.Test /// </summary> public static Boolean IsTest { get { return Environment.Test == Current; } } /// <summary> /// Returns true if the current environment is marked as Environment.Staging /// </summary> public static Boolean IsStaging { get { return Environment.Staging == Current; } } /// <summary> /// Returns true if the current environment is marked as Environment.Production /// </summary> public static Boolean IsProd { get { return Environment.Production == Current; } } private static readonly Lazy<Environment> current = new Lazy<Environment>(() => { Environment environment = Environment.Local; String envString = ConfigurationManager.AppSettings["Environment"].TrimToNull() ?? "Local"; if (!Enum.TryParse<Environment>(value: envString, ignoreCase: true, result: out environment)) LogManager.GetLogger("EnvUtil").Warn("Environment configuration is invalid. {0}", envString); return environment; }); } }
using CertiPay.Common.Logging; using System; using System.Configuration; namespace CertiPay.Common { /// <summary> /// A mechanism for determining the current execution environment based on a configuration setting. /// Useful for executing different code paths if running locally our outside of production. /// /// This requires that ConfigurationManager.AppSettings["Environment"] is set to Local/Test/Staging/Production /// </summary> public static class EnvUtil { public enum Environment { Local, Test, Staging, Production } /// <summary> /// Returns the current executing environment. Defaults to Local if no value is set in the config /// </summary> public static Environment Current { get { return current.Value; } } /// <summary> /// Returns true if the current environment is marked as Environment.Local /// </summary> public static Boolean IsLocal { get { return Environment.Local == Current; } } /// <summary> /// Returns true if the current environment is marked as Environment.Test /// </summary> public static Boolean IsTest { get { return Environment.Test == Current; } } /// <summary> /// Returns true if the current environment is marked as Environment.Staging /// </summary> public static Boolean IsStaging { get { return Environment.Staging == Current; } } /// <summary> /// Returns true if the current environment is marked as Environment.Production /// </summary> public static Boolean IsProd { get { return Environment.Production == Current; } } private static readonly Lazy<Environment> current = new Lazy<Environment>(() => { Environment environment = Environment.Local; String envString = ConfigurationManager.AppSettings["Environment"].TrimToNull() ?? "Local"; if (!Enum.TryParse<Environment>(value: envString, ignoreCase: true, result: out environment)) LogManager.GetLogger("EnvUtil").Warn("Environment configuration is invalid. {0}", envString); return environment; }); } }
mit
C#
a465d5afcfa44c262c0f0490a145458104e0ea2b
fix build problems
WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common,WeihanLi/WeihanLi.Common
benchmark/WeihanLi.Common.Benchmark/Program.cs
benchmark/WeihanLi.Common.Benchmark/Program.cs
using System; using BenchmarkDotNet.Running; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; namespace WeihanLi.Common.Benchmark { public class Program { public static void Main(string[] args) { var configurationBuilder = new ConfigurationBuilder(); configurationBuilder.AddJsonFile("appsettings.json"); var serviceCollection = new ServiceCollection(); serviceCollection.AddSingleton<IConfiguration>(configurationBuilder.Build()); DependencyResolver.SetDependencyResolver(serviceCollection.BuildServiceProvider()); BenchmarkRunner.Run<MapperTest>(); Console.ReadLine(); } } }
using System; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; namespace WeihanLi.Common.Benchmark { public class Program { public static void Main(string[] args) { var configurationBuilder = new ConfigurationBuilder(); configurationBuilder.AddJsonFile("appsettings.json"); var serviceCollection = new ServiceCollection(); serviceCollection.AddSingleton<IConfiguration>(configurationBuilder.Build()); DependencyResolver.SetDependencyResolver(serviceCollection.BuildServiceProvider()); // BenchmarkRunner.Run<MapperTest>(); new DbExtensionsTest().MainTest(); Console.ReadLine(); } } }
mit
C#
64c04e2f4c7367f12e7227772b5acd0d3a018cf6
Enable CLR Thread Pool via a MSBuild flag (default enabled on Unix)
mmitche/corefx,wtgodbe/corefx,mmitche/corefx,ptoonen/corefx,Jiayili1/corefx,shimingsg/corefx,zhenlan/corefx,Ermiar/corefx,Ermiar/corefx,ravimeda/corefx,ravimeda/corefx,Ermiar/corefx,zhenlan/corefx,shimingsg/corefx,ericstj/corefx,mmitche/corefx,zhenlan/corefx,ptoonen/corefx,ptoonen/corefx,ericstj/corefx,Ermiar/corefx,shimingsg/corefx,shimingsg/corefx,Ermiar/corefx,Jiayili1/corefx,wtgodbe/corefx,mmitche/corefx,ViktorHofer/corefx,zhenlan/corefx,wtgodbe/corefx,zhenlan/corefx,Jiayili1/corefx,ptoonen/corefx,ptoonen/corefx,shimingsg/corefx,zhenlan/corefx,ViktorHofer/corefx,ViktorHofer/corefx,Ermiar/corefx,mmitche/corefx,ericstj/corefx,BrennanConroy/corefx,ViktorHofer/corefx,ravimeda/corefx,ericstj/corefx,wtgodbe/corefx,mmitche/corefx,ericstj/corefx,ViktorHofer/corefx,zhenlan/corefx,ravimeda/corefx,ravimeda/corefx,ravimeda/corefx,ravimeda/corefx,Jiayili1/corefx,wtgodbe/corefx,ptoonen/corefx,Ermiar/corefx,ericstj/corefx,mmitche/corefx,shimingsg/corefx,BrennanConroy/corefx,wtgodbe/corefx,ericstj/corefx,Jiayili1/corefx,Jiayili1/corefx,shimingsg/corefx,Jiayili1/corefx,ViktorHofer/corefx,ViktorHofer/corefx,ptoonen/corefx,BrennanConroy/corefx,wtgodbe/corefx
src/Common/src/CoreLib/Interop/Windows/Interop.Errors.cs
src/Common/src/CoreLib/Interop/Windows/Interop.Errors.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. internal partial class Interop { // As defined in winerror.h and https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382.aspx internal partial class Errors { internal const int ERROR_SUCCESS = 0x0; internal const int ERROR_FILE_NOT_FOUND = 0x2; internal const int ERROR_PATH_NOT_FOUND = 0x3; internal const int ERROR_ACCESS_DENIED = 0x5; internal const int ERROR_INVALID_HANDLE = 0x6; internal const int ERROR_NOT_ENOUGH_MEMORY = 0x8; internal const int ERROR_INVALID_DRIVE = 0xF; internal const int ERROR_NO_MORE_FILES = 0x12; internal const int ERROR_NOT_READY = 0x15; internal const int ERROR_SHARING_VIOLATION = 0x20; internal const int ERROR_HANDLE_EOF = 0x26; internal const int ERROR_FILE_EXISTS = 0x50; internal const int ERROR_INVALID_PARAMETER = 0x57; internal const int ERROR_BROKEN_PIPE = 0x6D; internal const int ERROR_INSUFFICIENT_BUFFER = 0x7A; internal const int ERROR_INVALID_NAME = 0x7B; internal const int ERROR_BAD_PATHNAME = 0xA1; internal const int ERROR_ALREADY_EXISTS = 0xB7; internal const int ERROR_ENVVAR_NOT_FOUND = 0xCB; internal const int ERROR_FILENAME_EXCED_RANGE = 0xCE; internal const int ERROR_NO_DATA = 0xE8; internal const int ERROR_MORE_DATA = 0xEA; internal const int ERROR_NO_MORE_ITEMS = 0x103; internal const int ERROR_NOT_OWNER = 0x120; internal const int ERROR_TOO_MANY_POSTS = 0x12A; internal const int ERROR_ARITHMETIC_OVERFLOW = 0x216; internal const int ERROR_MUTANT_LIMIT_EXCEEDED = 0x24B; internal const int ERROR_OPERATION_ABORTED = 0x3E3; internal const int ERROR_IO_PENDING = 0x3E5; internal const int ERROR_NO_UNICODE_TRANSLATION = 0x459; internal const int ERROR_NOT_FOUND = 0x490; internal const int ERROR_BAD_IMPERSONATION_LEVEL = 0x542; internal const int E_FILENOTFOUND = unchecked((int)0x80070002); internal const int ERROR_TIMEOUT = 0x000005B4; } }
// 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. internal partial class Interop { // As defined in winerror.h and https://msdn.microsoft.com/en-us/library/windows/desktop/ms681382.aspx internal partial class Errors { internal const int ERROR_SUCCESS = 0x0; internal const int ERROR_FILE_NOT_FOUND = 0x2; internal const int ERROR_PATH_NOT_FOUND = 0x3; internal const int ERROR_ACCESS_DENIED = 0x5; internal const int ERROR_INVALID_HANDLE = 0x6; internal const int ERROR_NOT_ENOUGH_MEMORY = 0x8; internal const int ERROR_INVALID_DRIVE = 0xF; internal const int ERROR_NO_MORE_FILES = 0x12; internal const int ERROR_NOT_READY = 0x15; internal const int ERROR_SHARING_VIOLATION = 0x20; internal const int ERROR_HANDLE_EOF = 0x26; internal const int ERROR_FILE_EXISTS = 0x50; internal const int ERROR_INVALID_PARAMETER = 0x57; internal const int ERROR_BROKEN_PIPE = 0x6D; internal const int ERROR_INSUFFICIENT_BUFFER = 0x7A; internal const int ERROR_INVALID_NAME = 0x7B; internal const int ERROR_BAD_PATHNAME = 0xA1; internal const int ERROR_ALREADY_EXISTS = 0xB7; internal const int ERROR_ENVVAR_NOT_FOUND = 0xCB; internal const int ERROR_FILENAME_EXCED_RANGE = 0xCE; internal const int ERROR_NO_DATA = 0xE8; internal const int ERROR_MORE_DATA = 0xEA; internal const int ERROR_NO_MORE_ITEMS = 0x103; internal const int ERROR_NOT_OWNER = 0x120; internal const int ERROR_TOO_MANY_POSTS = 0x12A; internal const int ERROR_ARITHMETIC_OVERFLOW = 0x216; internal const int ERROR_MUTANT_LIMIT_EXCEEDED = 0x24B; internal const int ERROR_OPERATION_ABORTED = 0x3E3; internal const int ERROR_IO_PENDING = 0x3E5; internal const int ERROR_NO_UNICODE_TRANSLATION = 0x459; internal const int ERROR_NOT_FOUND = 0x490; internal const int ERROR_BAD_IMPERSONATION_LEVEL = 0x542; internal const int E_FILENOTFOUND = unchecked((int)0x80070002); } }
mit
C#
59a95f43a3846e7077783cec7f914755c7ec5bf2
Set NoDelay as default
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/Microsoft.AspNet.Server.Kestrel/KestrelServerInformation.cs
src/Microsoft.AspNet.Server.Kestrel/KestrelServerInformation.cs
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using Microsoft.AspNet.Server.Features; using Microsoft.AspNet.Server.Kestrel.Filter; using Microsoft.Extensions.Configuration; namespace Microsoft.AspNet.Server.Kestrel { public class KestrelServerInformation : IKestrelServerInformation, IServerAddressesFeature { public ICollection<string> Addresses { get; } = new List<string>(); public int ThreadCount { get; set; } public bool NoDelay { get; set; } = true; public IConnectionFilter ConnectionFilter { get; set; } public void Initialize(IConfiguration configuration) { var urls = configuration["server.urls"] ?? string.Empty; foreach (var url in urls.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)) { Addresses.Add(url); } } } }
// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Collections.Generic; using Microsoft.AspNet.Server.Features; using Microsoft.AspNet.Server.Kestrel.Filter; using Microsoft.Extensions.Configuration; namespace Microsoft.AspNet.Server.Kestrel { public class KestrelServerInformation : IKestrelServerInformation, IServerAddressesFeature { public ICollection<string> Addresses { get; } = new List<string>(); public int ThreadCount { get; set; } public bool NoDelay { get; set; } public IConnectionFilter ConnectionFilter { get; set; } public void Initialize(IConfiguration configuration) { var urls = configuration["server.urls"] ?? string.Empty; foreach (var url in urls.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries)) { Addresses.Add(url); } } } }
apache-2.0
C#
41664d11c1369c7d88d0bf7030653a2706e782d2
remove using not required
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi.Gui/Program.cs
WalletWasabi.Gui/Program.cs
using Avalonia; using AvalonStudio.Shell; using AvalonStudio.Shell.Extensibility.Platforms; using NBitcoin; using System; using System.IO; using System.Threading.Tasks; using WalletWasabi.Gui.ViewModels; using WalletWasabi.Logging; namespace WalletWasabi.Gui { internal class Program { #pragma warning disable IDE1006 // Naming Styles private static async Task Main(string[] args) #pragma warning restore IDE1006 // Naming Styles { Logger.InitializeDefaults(Path.Combine(Global.DataDir, "Logs.txt")); StatusBarViewModel statusBar = null; try { Platform.BaseDirectory = Path.Combine(Global.DataDir, "Gui"); BuildAvaloniaApp().BeforeStarting(async builder => { MainWindowViewModel.Instance = new MainWindowViewModel(); var configFilePath = Path.Combine(Global.DataDir, "Config.json"); var config = new Config(configFilePath); await config.LoadOrCreateDefaultFileAsync(); Logger.LogInfo<Config>("Config is successfully initialized."); Global.InitializeConfig(config); if (!File.Exists(Global.IndexFilePath)) // Load the index file from working folder if we have it. { var cachedIndexFilePath = Path.Combine("Assets", Path.GetFileName(Global.IndexFilePath)); if (File.Exists(cachedIndexFilePath)) { File.Copy(cachedIndexFilePath, Global.IndexFilePath, overwrite: false); } } Global.InitializeNoWallet(); statusBar = new StatusBarViewModel(Global.Nodes.ConnectedNodes, Global.MemPoolService, Global.IndexDownloader, Global.UpdateChecker); MainWindowViewModel.Instance.StatusBar = statusBar; if (Global.IndexDownloader.Network != Network.Main) { MainWindowViewModel.Instance.Title += $" - {Global.IndexDownloader.Network}"; } }).StartShellApp<AppBuilder, MainWindow>("Wasabi Wallet", null, () => MainWindowViewModel.Instance); } catch (Exception ex) { Logger.LogCritical<Program>(ex); throw; } finally { statusBar?.Dispose(); await Global.DisposeAsync(); } } private static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure<App>().UsePlatformDetect().UseReactiveUI(); } }
using Avalonia; using AvalonStudio.Shell; using AvalonStudio.Shell.Extensibility.Platforms; using NBitcoin; using System; using System.IO; using System.Runtime.InteropServices; using System.Threading.Tasks; using WalletWasabi.Gui.ViewModels; using WalletWasabi.Logging; namespace WalletWasabi.Gui { internal class Program { #pragma warning disable IDE1006 // Naming Styles private static async Task Main(string[] args) #pragma warning restore IDE1006 // Naming Styles { Logger.InitializeDefaults(Path.Combine(Global.DataDir, "Logs.txt")); StatusBarViewModel statusBar = null; try { Platform.BaseDirectory = Path.Combine(Global.DataDir, "Gui"); BuildAvaloniaApp().BeforeStarting(async builder => { MainWindowViewModel.Instance = new MainWindowViewModel(); var configFilePath = Path.Combine(Global.DataDir, "Config.json"); var config = new Config(configFilePath); await config.LoadOrCreateDefaultFileAsync(); Logger.LogInfo<Config>("Config is successfully initialized."); Global.InitializeConfig(config); if (!File.Exists(Global.IndexFilePath)) // Load the index file from working folder if we have it. { var cachedIndexFilePath = Path.Combine("Assets", Path.GetFileName(Global.IndexFilePath)); if (File.Exists(cachedIndexFilePath)) { File.Copy(cachedIndexFilePath, Global.IndexFilePath, overwrite: false); } } Global.InitializeNoWallet(); statusBar = new StatusBarViewModel(Global.Nodes.ConnectedNodes, Global.MemPoolService, Global.IndexDownloader, Global.UpdateChecker); MainWindowViewModel.Instance.StatusBar = statusBar; if (Global.IndexDownloader.Network != Network.Main) { MainWindowViewModel.Instance.Title += $" - {Global.IndexDownloader.Network}"; } }).StartShellApp<AppBuilder, MainWindow>("Wasabi Wallet", null, () => MainWindowViewModel.Instance); } catch (Exception ex) { Logger.LogCritical<Program>(ex); throw; } finally { statusBar?.Dispose(); await Global.DisposeAsync(); } } private static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure<App>().UsePlatformDetect().UseReactiveUI(); } }
mit
C#
2fd2d0a852232c55602fa3dc2f2556546ffba97a
Remove unused field, for now
github-for-unity/Unity,github-for-unity/Unity,mpOzelot/Unity,github-for-unity/Unity,mpOzelot/Unity
src/UnityExtension/Assets/Editor/GitHub.Unity/UI/LoadingView.cs
src/UnityExtension/Assets/Editor/GitHub.Unity/UI/LoadingView.cs
using System; using System.Linq; using System.Threading.Tasks; using Octokit; using Rackspace.Threading; using UnityEditor; using UnityEngine; namespace GitHub.Unity { class LoadingView : Subview { private static readonly Vector2 viewSize = new Vector2(300, 250); private const string WindowTitle = "Loading..."; private const string Header = ""; public override void InitializeView(IView parent) { base.InitializeView(parent); Title = WindowTitle; Size = viewSize; } public override void OnGUI() {} public override bool IsBusy { get { return false; } } } }
using System; using System.Linq; using System.Threading.Tasks; using Octokit; using Rackspace.Threading; using UnityEditor; using UnityEngine; namespace GitHub.Unity { class LoadingView : Subview { private static readonly Vector2 viewSize = new Vector2(300, 250); private bool isBusy; private const string WindowTitle = "Loading..."; private const string Header = ""; public override void InitializeView(IView parent) { base.InitializeView(parent); Title = WindowTitle; Size = viewSize; } public override void OnGUI() {} public override bool IsBusy { get { return false; } } } }
mit
C#
a6e2bea1d9714f0defe26b34f365255384b78c00
Remove unnecessary code.
jcouv/roslyn,ErikSchierboom/roslyn,AmadeusW/roslyn,jeffanders/roslyn,balajikris/roslyn,gafter/roslyn,KevinH-MS/roslyn,drognanar/roslyn,vslsnap/roslyn,AmadeusW/roslyn,weltkante/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,heejaechang/roslyn,dpoeschl/roslyn,Shiney/roslyn,sharwell/roslyn,ErikSchierboom/roslyn,jaredpar/roslyn,bkoelman/roslyn,nguerrera/roslyn,ljw1004/roslyn,natidea/roslyn,Hosch250/roslyn,CaptainHayashi/roslyn,jcouv/roslyn,swaroop-sridhar/roslyn,srivatsn/roslyn,CyrusNajmabadi/roslyn,bkoelman/roslyn,mgoertz-msft/roslyn,rgani/roslyn,diryboy/roslyn,Pvlerick/roslyn,brettfo/roslyn,davkean/roslyn,aelij/roslyn,MichalStrehovsky/roslyn,balajikris/roslyn,zooba/roslyn,paulvanbrenk/roslyn,orthoxerox/roslyn,tmeschter/roslyn,leppie/roslyn,agocke/roslyn,dotnet/roslyn,jamesqo/roslyn,CyrusNajmabadi/roslyn,physhi/roslyn,KiloBravoLima/roslyn,dotnet/roslyn,aelij/roslyn,balajikris/roslyn,a-ctor/roslyn,abock/roslyn,kelltrick/roslyn,rgani/roslyn,genlu/roslyn,agocke/roslyn,MichalStrehovsky/roslyn,gafter/roslyn,tvand7093/roslyn,orthoxerox/roslyn,jcouv/roslyn,dotnet/roslyn,shyamnamboodiripad/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,paulvanbrenk/roslyn,tmat/roslyn,mmitche/roslyn,sharwell/roslyn,AlekseyTs/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,vslsnap/roslyn,wvdd007/roslyn,physhi/roslyn,nguerrera/roslyn,KirillOsenkov/roslyn,amcasey/roslyn,jamesqo/roslyn,a-ctor/roslyn,eriawan/roslyn,mgoertz-msft/roslyn,AmadeusW/roslyn,eriawan/roslyn,tmeschter/roslyn,pdelvo/roslyn,leppie/roslyn,jamesqo/roslyn,akrisiun/roslyn,budcribar/roslyn,tannergooding/roslyn,KevinH-MS/roslyn,jasonmalinowski/roslyn,stephentoub/roslyn,AArnott/roslyn,jaredpar/roslyn,bbarry/roslyn,VSadov/roslyn,khyperia/roslyn,srivatsn/roslyn,akrisiun/roslyn,mmitche/roslyn,dpoeschl/roslyn,MattWindsor91/roslyn,mmitche/roslyn,xoofx/roslyn,leppie/roslyn,TyOverby/roslyn,reaction1989/roslyn,kelltrick/roslyn,AArnott/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn,budcribar/roslyn,wvdd007/roslyn,jkotas/roslyn,panopticoncentral/roslyn,aelij/roslyn,paulvanbrenk/roslyn,dpoeschl/roslyn,Hosch250/roslyn,MattWindsor91/roslyn,Shiney/roslyn,sharwell/roslyn,Giftednewt/roslyn,shyamnamboodiripad/roslyn,jhendrixMSFT/roslyn,lorcanmooney/roslyn,gafter/roslyn,TyOverby/roslyn,AlekseyTs/roslyn,tmat/roslyn,yeaicc/roslyn,sharadagrawal/Roslyn,ljw1004/roslyn,bbarry/roslyn,agocke/roslyn,jmarolf/roslyn,panopticoncentral/roslyn,Pvlerick/roslyn,Pvlerick/roslyn,davkean/roslyn,jeffanders/roslyn,mattwar/roslyn,KirillOsenkov/roslyn,mavasani/roslyn,lorcanmooney/roslyn,mattwar/roslyn,srivatsn/roslyn,drognanar/roslyn,CaptainHayashi/roslyn,bkoelman/roslyn,DustinCampbell/roslyn,MichalStrehovsky/roslyn,AlekseyTs/roslyn,MatthieuMEZIL/roslyn,Giftednewt/roslyn,yeaicc/roslyn,jmarolf/roslyn,Giftednewt/roslyn,xoofx/roslyn,robinsedlaczek/roslyn,ericfe-ms/roslyn,jasonmalinowski/roslyn,KiloBravoLima/roslyn,natidea/roslyn,AnthonyDGreen/roslyn,vslsnap/roslyn,heejaechang/roslyn,CyrusNajmabadi/roslyn,VSadov/roslyn,tmeschter/roslyn,rgani/roslyn,tmat/roslyn,jhendrixMSFT/roslyn,OmarTawfik/roslyn,mgoertz-msft/roslyn,orthoxerox/roslyn,genlu/roslyn,yeaicc/roslyn,nguerrera/roslyn,jmarolf/roslyn,KevinRansom/roslyn,tvand7093/roslyn,amcasey/roslyn,zooba/roslyn,eriawan/roslyn,pdelvo/roslyn,genlu/roslyn,ericfe-ms/roslyn,diryboy/roslyn,budcribar/roslyn,brettfo/roslyn,weltkante/roslyn,khyperia/roslyn,OmarTawfik/roslyn,swaroop-sridhar/roslyn,Shiney/roslyn,reaction1989/roslyn,AArnott/roslyn,AnthonyDGreen/roslyn,tvand7093/roslyn,jkotas/roslyn,heejaechang/roslyn,michalhosala/roslyn,swaroop-sridhar/roslyn,khyperia/roslyn,jasonmalinowski/roslyn,cston/roslyn,kelltrick/roslyn,xoofx/roslyn,mattscheffer/roslyn,KiloBravoLima/roslyn,sharadagrawal/Roslyn,OmarTawfik/roslyn,TyOverby/roslyn,MattWindsor91/roslyn,AnthonyDGreen/roslyn,davkean/roslyn,Hosch250/roslyn,stephentoub/roslyn,mattscheffer/roslyn,MattWindsor91/roslyn,weltkante/roslyn,KirillOsenkov/roslyn,KevinRansom/roslyn,brettfo/roslyn,ljw1004/roslyn,DustinCampbell/roslyn,amcasey/roslyn,cston/roslyn,mattscheffer/roslyn,KevinRansom/roslyn,ericfe-ms/roslyn,MatthieuMEZIL/roslyn,lorcanmooney/roslyn,mavasani/roslyn,xasx/roslyn,CaptainHayashi/roslyn,jeffanders/roslyn,natidea/roslyn,cston/roslyn,mattwar/roslyn,bartdesmet/roslyn,tannergooding/roslyn,panopticoncentral/roslyn,diryboy/roslyn,stephentoub/roslyn,VSadov/roslyn,ErikSchierboom/roslyn,jhendrixMSFT/roslyn,reaction1989/roslyn,physhi/roslyn,KevinH-MS/roslyn,abock/roslyn,xasx/roslyn,robinsedlaczek/roslyn,jaredpar/roslyn,zooba/roslyn,mavasani/roslyn,wvdd007/roslyn,sharadagrawal/Roslyn,MatthieuMEZIL/roslyn,michalhosala/roslyn,tannergooding/roslyn,michalhosala/roslyn,xasx/roslyn,a-ctor/roslyn,drognanar/roslyn,abock/roslyn,DustinCampbell/roslyn,bbarry/roslyn,bartdesmet/roslyn,pdelvo/roslyn,jkotas/roslyn,robinsedlaczek/roslyn,akrisiun/roslyn
src/Workspaces/Core/Portable/Workspace/Host/ILanguageService.cs
src/Workspaces/Core/Portable/Workspace/Host/ILanguageService.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. namespace Microsoft.CodeAnalysis.Host { /// <summary> /// Empty interface just to mark language services. /// </summary> public interface ILanguageService { } }
// 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 Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.Host { /// <summary> /// Empty interface just to mark language services. /// </summary> public interface ILanguageService { } }
mit
C#
ca4c9ff43084f90f715f0ca4eb44c7d397fb39ea
Handle physical back button in result view
Bigsby/Xamarin.Forms.OAuth
src/Xamarin.Forms.OAuth/OAuthTestApp/OAuthTestApp/ResultPage.cs
src/Xamarin.Forms.OAuth/OAuthTestApp/OAuthTestApp/ResultPage.cs
using System; using Xamarin.Forms; using Xamarin.Forms.OAuth; using Xamarin.Forms.OAuth.Views; namespace OAuthTestApp { public class ResultPage : ContentPage, IBackHandlingView { private readonly Action _returnCallback; public ResultPage(AuthenticatonResult result, Action returnCallback) { _returnCallback = returnCallback; var stack = new StackLayout { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center }; if (result) { stack.Children.Add(new Label { Text = $"Provider: {result.Account.Provider}" }); stack.Children.Add(new Label { Text = $"Id: {result.Account.Id}" }); stack.Children.Add(new Label { Text = $"Name: {result.Account.DisplayName}" }); stack.Children.Add(new Label { Text = $"Access Token: {result.Account.AccessToken}" }); } else { stack.Children.Add(new Label { Text = "Authentication failed!" }); stack.Children.Add(new Label { Text = $"Reason: {result.ErrorMessage}" }); } stack.Children.Add(new Button { Text = "Back", Command = new Command(returnCallback) }); Content = stack; } public void HandleBack() { _returnCallback?.Invoke(); } } }
using System; using Xamarin.Forms; using Xamarin.Forms.OAuth; namespace OAuthTestApp { public class ResultPage : ContentPage { public ResultPage(AuthenticatonResult result, Action returnCallback) { var stack = new StackLayout { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center }; if (result) { stack.Children.Add(new Label { Text = $"Provider: {result.Account.Provider}" }); stack.Children.Add(new Label { Text = $"Id: {result.Account.Id}" }); stack.Children.Add(new Label { Text = $"Name: {result.Account.DisplayName}" }); stack.Children.Add(new Label { Text = $"Access Token: {result.Account.AccessToken}" }); } else { stack.Children.Add(new Label { Text = "Authentication failed!" }); stack.Children.Add(new Label { Text = $"Reason: {result.ErrorMessage}" }); } stack.Children.Add(new Button { Text = "Back", Command = new Command(returnCallback) }); Content = stack; } } }
mit
C#
e0f5f6b7ec13295ddf9b78d3178041e771247bbc
Bump minor version
robvdlv/OwinHttpMessageHandler,Jonne/OwinHttpMessageHandler,damianh/OwinHttpMessageHandler
src/SharedAssemblyInfo.cs
src/SharedAssemblyInfo.cs
// -------------------------------------------------------------------------------------------------------------------- // <Copyright company="BEAM Financial Solutions Ltd" file="SharedAssemblyInfo.cs"> // Copyright © 2009-2012 BEAM Financial Solutions Ltd // </Copyright> // -------------------------------------------------------------------------------------------------------------------- using System.Reflection; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Damian Hickey")] [assembly: AssemblyProduct("OwinHttpMessageHandler")] [assembly: AssemblyCopyright("Damian Hickey 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("0.5.0.0")] [assembly: AssemblyFileVersion("0.5.0.0")]
// -------------------------------------------------------------------------------------------------------------------- // <Copyright company="BEAM Financial Solutions Ltd" file="SharedAssemblyInfo.cs"> // Copyright © 2009-2012 BEAM Financial Solutions Ltd // </Copyright> // -------------------------------------------------------------------------------------------------------------------- using System.Reflection; [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Damian Hickey")] [assembly: AssemblyProduct("OwinHttpMessageHandler")] [assembly: AssemblyCopyright("Damian Hickey 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyVersion("0.4.0.0")] [assembly: AssemblyFileVersion("0.4.0.0")]
mit
C#
ae4233f77225eacc8ea44092c76974f83e8722da
Update BatchEmailParameter.cs
marmind/MailChimp.NET-APIv2,danesparza/MailChimp.NET
MailChimp/Lists/BatchEmailParameter.cs
MailChimp/Lists/BatchEmailParameter.cs
using System.Runtime.Serialization; using MailChimp.Helper; namespace MailChimp.Lists { [DataContract] public class BatchEmailParameter { public BatchEmailParameter() { this.EmailType = "html"; } /// <summary> /// Email information for the customer /// </summary> [DataMember(Name = "email")] public EmailParameter Email { get; set; } /// <summary> /// for the email type option (html or text). Defaults to html /// </summary> [DataMember(Name = "email_type")] public string EmailType { get; set; } /// <summary> /// data for the various list specific and special merge vars /// </summary> [DataMember(Name = "merge_vars")] public object MergVars { get; set; } } }
using System.Runtime.Serialization; using MailChimp.Helper; namespace MailChimp.Lists { [DataContract] public class BatchEmailParameter { public BatchEmailParameter() { this.EmailType = "html"; } /// <summary> /// Email information for the customer /// </summary> [DataMember(Name = "email")] public EmailParameter Email { get; set; } /// <summary> /// for the email type option (html or text). Defaults to html /// </summary> [DataMember(Name = "email_type")] public string EmailType { get; set; } /// <summary> /// data for the various list specific and special merge vars /// </summary> [DataMember(Name = "merge_vars")] public MergeVar MergVars { get; set; } } }
mit
C#
cbdbb4172cc9cdd783a6527668a4fd18f12a08e2
remove version from assembly info
bdukes/Dnn.Platform,valadas/Dnn.Platform,valadas/Dnn.Platform,EPTamminga/Dnn.Platform,svdv71/Dnn.Platform,RichardHowells/Dnn.Platform,wael101/Dnn.Platform,mitchelsellers/Dnn.Platform,robsiera/Dnn.Platform,robsiera/Dnn.Platform,wael101/Dnn.Platform,dnnsoftware/Dnn.Platform,nvisionative/Dnn.Platform,wael101/Dnn.Platform,RichardHowells/Dnn.Platform,RichardHowells/Dnn.Platform,valadas/Dnn.Platform,mitchelsellers/Dnn.Platform,dnnsoftware/Dnn.Platform,bdukes/Dnn.Platform,dnnsoftware/Dnn.Platform,valadas/Dnn.Platform,mitchelsellers/Dnn.Platform,svdv71/Dnn.Platform,nvisionative/Dnn.Platform,EPTamminga/Dnn.Platform,robsiera/Dnn.Platform,dnnsoftware/Dnn.Platform,mitchelsellers/Dnn.Platform,valadas/Dnn.Platform,EPTamminga/Dnn.Platform,bdukes/Dnn.Platform,RichardHowells/Dnn.Platform,svdv71/Dnn.Platform,mitchelsellers/Dnn.Platform,dnnsoftware/Dnn.Platform,nvisionative/Dnn.Platform,bdukes/Dnn.Platform
SolutionInfo.cs
SolutionInfo.cs
#region Copyright // // DotNetNuke® - http://www.dotnetnuke.com // Copyright (c) 2002-2018 // by DotNetNuke Corporation // // 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 #region Usings using System.Reflection; #endregion // 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. // Review the values of the assembly attributes [assembly: AssemblyCompany("DNN Corporation")] [assembly: AssemblyProduct("http://www.dnnsoftware.com")] [assembly: AssemblyCopyright("DotNetNuke is copyright 2002-2018 by DNN Corporation. All Rights Reserved.")] [assembly: AssemblyTrademark("DNN")]
#region Copyright // // DotNetNuke® - http://www.dotnetnuke.com // Copyright (c) 2002-2018 // by DotNetNuke Corporation // // 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 #region Usings using System.Reflection; #endregion // 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. // Review the values of the assembly attributes [assembly: AssemblyCompany("DNN Corporation")] [assembly: AssemblyProduct("http://www.dnnsoftware.com")] [assembly: AssemblyCopyright("DotNetNuke is copyright 2002-2018 by DNN Corporation. All Rights Reserved.")] [assembly: AssemblyTrademark("DNN")] // 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("9.2.2.0")] [assembly: AssemblyFileVersion("9.2.2.0")]
mit
C#
75f88f087620ac0609f5dd852a85b1094b602c8a
Move input block for thread safe
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 { public static class Program { //public static I18n i18n; static void Main(string[] args) { /* 程序工作流程: * 1.程序枚举所有插件,保存所有IPlugin到List中 * 2.程序整理出所有的List<ISourceBase> * 3.初始化Sync类,Sync类检测配置文件,用正确的类初始化SyncInstance * 4.程序IO Manager开始工作,等待用户输入 */ I18n.Instance.ApplyLanguage(new DefaultI18n()); while(true) { SyncHost.Instance = new SyncHost(); SyncHost.Instance.Load(); CurrentIO.WriteWelcome(); string cmd = ""; while (true) { SyncHost.Instance.Commands.invokeCmdString(cmd); cmd = CurrentIO.ReadCommand(); } } } } }
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 { public static class Program { //public static I18n i18n; static void Main(string[] args) { /* 程序工作流程: * 1.程序枚举所有插件,保存所有IPlugin到List中 * 2.程序整理出所有的List<ISourceBase> * 3.初始化Sync类,Sync类检测配置文件,用正确的类初始化SyncInstance * 4.程序IO Manager开始工作,等待用户输入 */ I18n.Instance.ApplyLanguage(new DefaultI18n()); while(true) { SyncHost.Instance = new SyncHost(); SyncHost.Instance.Load(); CurrentIO.WriteWelcome(); string cmd = CurrentIO.ReadCommand(); while (true) { SyncHost.Instance.Commands.invokeCmdString(cmd); cmd = CurrentIO.ReadCommand(); } } } } }
mit
C#
0e3c62a264e8ee089d536c7fd5dfc34707a72ac6
Update Commit Class as subclass of Project class
pfjason/GitLab-dot-NET
Types/Commit.cs
Types/Commit.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; using unirest_net.http; using System.Web; namespace GitLab { public partial class GitLab { public partial class Project { public class Commit { public string id, short_id, title, author_name, author_email, created_at, message; public string[] parent_ids; public bool allow_failure; } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json; using unirest_net.http; using System.Web; namespace GitLab { public partial class GitLab { class Commit { } } }
mit
C#
b8a1e173d1c577e80186e4d19656b741da4800f2
Update dictionary tests
cjlpowers/TypeScripter,cjlpowers/TypeScripter
Src/TypeScripter.Tests/Dictionaries.cs
Src/TypeScripter.Tests/Dictionaries.cs
using System.Collections.Generic; using NUnit.Framework; using TypeScripter.Tests; namespace TypeScripter { #region Example Constructs public class Order { public Dictionary<string, OrderLineItem> OrderLines { get; set; } public Dictionary<int, OrderLineItem> LinesByIndex { get; set; } public Dictionary<string, string> SimpleDict1 { get; set; } public Dictionary<int, int> SimpleDict2 { get; set; } public OrderDictionary SimpleDict3 { get; set; } public Order(Dictionary<string, OrderLineItem> orderLines, Dictionary<int, OrderLineItem> linesByIndex, Dictionary<string, string> simpleDict1, Dictionary<int, int> simpleDict2) { OrderLines = orderLines; LinesByIndex = linesByIndex; SimpleDict1 = simpleDict1; SimpleDict2 = simpleDict2; } } public class OrderLineItem { public string Id { get; set; } public string Name { get; set; } } public class OrderDictionary: Dictionary<string, Order> { } #endregion [TestFixture] public class Dictionaries : Test { [Test] public void OutputTest() { var scripter = new TypeScripter.Scripter(); var output = scripter .AddType(typeof(Order)) .ToString(); ValidateTypeScript(output); } [Test] public void TestThatDictionaryIsRendered() { var scripter = new TypeScripter.Scripter(); var output = scripter .AddType(typeof(Order)) .ToString(); // we want to descent to generic type Assert.True(output.Contains("OrderLineItem")); ValidateTypeScript(output); // inline interfaces for dictionaries are generated Assert.True(output.Contains("LinesByIndex: {[key: number]: TypeScripter.OrderLineItem;}")); Assert.True(output.Contains("OrderLines: {[key: string]: TypeScripter.OrderLineItem;}")); Assert.True(output.Contains("SimpleDict1: {[key: string]: string;}")); Assert.True(output.Contains("SimpleDict2: {[key: number]: number;}")); Assert.True(output.Contains("SimpleDict3: TypeScripter.OrderDictionary;")); } } }
using System.Collections.Generic; using NUnit.Framework; using TypeScripter.Tests; namespace TypeScripter { #region Example Constructs public class Order { public Dictionary<string, OrderLineItem> OrderLines { get; set; } public Dictionary<int, OrderLineItem> LinesByIndex { get; set; } public Dictionary<string, string> SimpleDict1 { get; set; } public Dictionary<int, int> SimpleDict2 { get; set; } public Order(Dictionary<string, OrderLineItem> orderLines, Dictionary<int, OrderLineItem> linesByIndex, Dictionary<string, string> simpleDict1, Dictionary<int, int> simpleDict2) { OrderLines = orderLines; LinesByIndex = linesByIndex; SimpleDict1 = simpleDict1; SimpleDict2 = simpleDict2; } } public class OrderLineItem { public string Id { get; set; } public string Name { get; set; } } #endregion [TestFixture] public class Dictionaries : Test { [Test] public void OutputTest() { var scripter = new TypeScripter.Scripter(); var output = scripter .AddType(typeof(Order)) .ToString(); ValidateTypeScript(output); } [Test] public void TestThatDictionaryIsRendered() { var scripter = new TypeScripter.Scripter(); var output = scripter .AddType(typeof(Order)) .ToString(); // we want to descent to generic type Assert.True(output.Contains("OrderLineItem")); // inline interfaces for dictionaries are generated Assert.True(output.Contains("LinesByIndex: {[key: number]: TypeScripter.OrderLineItem;}")); Assert.True(output.Contains("OrderLines: {[key: string]: TypeScripter.OrderLineItem;}")); Assert.True(output.Contains("SimpleDict1: {[key: string]: string;}")); Assert.True(output.Contains("SimpleDict2: {[key: number]: number;}")); } } }
mit
C#
90a079bf5a56426b69cc13f4a50b3cf8cc5efdf0
edit tariffs repo
VladTsiukin/AirlineTicketOffice
AirlineTicketOffice.Repository/Repositories/TariffsRepository.cs
AirlineTicketOffice.Repository/Repositories/TariffsRepository.cs
using AirlineTicketOffice.Data; using AirlineTicketOffice.Model.IRepository; using AirlineTicketOffice.Model.Models; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace AirlineTicketOffice.Repository.Repositories { public sealed class TariffsRepository : BaseModelRepository<GetTariffs_ATO>, ITariffsRepository { public IEnumerable<TariffModel> GetAll() { return _context.GetTariffs_ATO.AsNoTracking().ToList().Select((GetTariffs_ATO t) => { return new TariffModel { RateID = t.RateID, RateName = t.RateName, TicketRefund = t.TicketRefund, BookingChanges = t.BookingChanges, BaggageAllowance = t.BaggageAllowance, FreeFood = t.FreeFood, TypeOfPlace = t.TypeOfPlace }; }); } } }
using AirlineTicketOffice.Data; using AirlineTicketOffice.Model.IRepository; using AirlineTicketOffice.Model.Models; using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace AirlineTicketOffice.Repository.Repositories { public sealed class TariffsRepository : BaseModelRepository<TariffModel>, ITariffsRepository { public IEnumerable<TariffModel> GetAll() { return _context.GetTariffs_ATO.AsNoTracking().ToList().Select((GetTariffs_ATO t) => { return new TariffModel { RateID = t.RateID, RateName = t.RateName, TicketRefund = t.TicketRefund, BookingChanges = t.BookingChanges, BaggageAllowance = t.BaggageAllowance, FreeFood = t.FreeFood, TypeOfPlace = t.TypeOfPlace }; }); } } }
mit
C#
55c5155b92d7216413e138b668b99222f53e3a89
Make TorControlClient disposable
JSkimming/TorSharp,joelverhagen/TorSharp
TorSharp/Tools/Tor/TorControlClient.cs
TorSharp/Tools/Tor/TorControlClient.cs
using System; using System.IO; using System.Net.Sockets; using System.Text; using System.Threading.Tasks; namespace Knapcode.TorSharp.Tools.Tor { public class TorControlClient : IDisposable { private const string SuccessResponse = "250 OK"; private const int BufferSize = 256; private TcpClient _tcpClient; private StreamReader _reader; private StreamWriter _writer; public async Task ConnectAsync(string hostname, int port) { _tcpClient = new TcpClient(); await _tcpClient.ConnectAsync(hostname, port); var networkStream = _tcpClient.GetStream(); _reader = new StreamReader(networkStream, Encoding.ASCII, false, BufferSize, true); _writer = new StreamWriter(networkStream, Encoding.ASCII, BufferSize, true); } public async Task AuthenticateAsync(string password) { var command = password != null ? $"AUTHENTICATE \"{password}\"" : "AUTHENTICATE"; await SendCommandAsync(command); } public async Task CleanCircuitsAsync() { await SendCommandAsync("SIGNAL NEWNYM"); } public void Dispose() { if (_tcpClient != null) { _tcpClient.Close(); _reader.Dispose(); _writer.Dispose(); } } public void Close() { Dispose(); } private async Task<string> SendCommandAsync(string command) { if (_tcpClient == null) { throw new TorControlException("The Tor control client has not connected."); } await _writer.WriteLineAsync(command); await _writer.FlushAsync(); var response = await _reader.ReadLineAsync(); if (response != SuccessResponse) { throw new TorControlException($"The command to authenticate failed with error: {response}"); } return response; } } }
using System.IO; using System.Net.Sockets; using System.Text; using System.Threading.Tasks; namespace Knapcode.TorSharp.Tools.Tor { public class TorControlClient { private const string SuccessResponse = "250 OK"; private const int BufferSize = 256; private TcpClient _tcpClient; private StreamReader _reader; private StreamWriter _writer; public async Task ConnectAsync(string hostname, int port) { _tcpClient = new TcpClient(); await _tcpClient.ConnectAsync(hostname, port); var networkStream = _tcpClient.GetStream(); _reader = new StreamReader(networkStream, Encoding.ASCII, false, BufferSize, true); _writer = new StreamWriter(networkStream, Encoding.ASCII, BufferSize, true); } public async Task AuthenticateAsync(string password) { var command = password != null ? $"AUTHENTICATE \"{password}\"" : "AUTHENTICATE"; await SendCommandAsync(command); } public async Task CleanCircuitsAsync() { await SendCommandAsync("SIGNAL NEWNYM"); } public void Close() { if (_tcpClient != null) { _tcpClient.Close(); _reader.Dispose(); _writer.Dispose(); } } private async Task<string> SendCommandAsync(string command) { if (_tcpClient == null) { throw new TorControlException("The Tor control client has not connected."); } await _writer.WriteLineAsync(command); await _writer.FlushAsync(); var response = await _reader.ReadLineAsync(); if (response != SuccessResponse) { throw new TorControlException($"The command to authenticate failed with error: {response}"); } return response; } } }
mit
C#
0346d99da23d457b513620d236de02bbfb85bbaf
Add comment
tigrouind/LifeDISA,tigrouind/LifeDISA
Shared/DosBox.cs
Shared/DosBox.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; namespace Shared { public class DosBox { public static int SearchProcess() { int? processId = Process.GetProcesses() .Where(x => GetProcessName(x).StartsWith("DOSBOX", StringComparison.InvariantCultureIgnoreCase)) .Select(x => (int?)x.Id) .FirstOrDefault(); if(processId.HasValue) { return processId.Value; } return -1; } static string GetProcessName(Process process) { try { return process.ProcessName; } catch { return string.Empty; } } public static IEnumerable<DosMCB> GetMCBs(byte[] memory, int offset) { int firstMCB = memory.ReadUnsignedShort(0x0824 + offset) * 16; //sysvars (list of lists) (0x80) + firstMCB (0x24) (see DOSBox/dos_inc.h) //scan DOS memory control block (MCB) chain int pos = firstMCB + offset; while (pos <= (memory.Length - 16)) { var blockTag = memory[pos]; var blockOwner = memory.ReadUnsignedShort(pos + 1); var blockSize = memory.ReadUnsignedShort(pos + 3); #if DEBUG var blockName = Encoding.ASCII.GetString(memory, pos + 8, 8).Replace("\0", string.Empty); #endif if (blockTag != 0x4D && blockTag != 0x5A) { break; } yield return new DosMCB { Position = pos + 16 - offset, Size = blockSize * 16, Owner = blockOwner * 16, #if DEBUG Name = blockName #endif }; if(blockTag == 0x5A) //last tag should be 0x5A { break; } pos += blockSize * 16 + 16; } } public static bool GetExeEntryPoint(byte[] memory, out int entryPoint) { int psp = memory.ReadUnsignedShort(0x0B30) * 16; // 0xB2 (dos swappable area) + 0x10 (current PSP) (see DOSBox/dos_inc.h) if (psp > 0) { int exeSize = memory.ReadUnsignedShort(psp - 16 + 3) * 16; if (exeSize > 100 * 1024 && exeSize < 200 * 1024) //is AITD exe loaded yet? { entryPoint = psp + 0x100; return true; } } entryPoint = -1; return false; } } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; namespace Shared { public class DosBox { public static int SearchProcess() { int? processId = Process.GetProcesses() .Where(x => GetProcessName(x).StartsWith("DOSBOX", StringComparison.InvariantCultureIgnoreCase)) .Select(x => (int?)x.Id) .FirstOrDefault(); if(processId.HasValue) { return processId.Value; } return -1; } static string GetProcessName(Process process) { try { return process.ProcessName; } catch { return string.Empty; } } public static IEnumerable<DosMCB> GetMCBs(byte[] memory, int offset) { //scan DOS memory control block (MCB) chain int pos = memory.ReadUnsignedShort(0x0824 + offset) * 16 + offset; while (pos <= (memory.Length - 16)) { var blockTag = memory[pos]; var blockOwner = memory.ReadUnsignedShort(pos + 1); var blockSize = memory.ReadUnsignedShort(pos + 3); #if DEBUG var blockName = Encoding.ASCII.GetString(memory, pos + 8, 8).Replace("\0", string.Empty); #endif if (blockTag != 0x4D && blockTag != 0x5A) { break; } yield return new DosMCB { Position = pos + 16 - offset, Size = blockSize * 16, Owner = blockOwner * 16, #if DEBUG Name = blockName #endif }; if(blockTag == 0x5A) //last tag should be 0x5A { break; } pos += blockSize * 16 + 16; } } public static bool GetExeEntryPoint(byte[] memory, out int entryPoint) { int psp = memory.ReadUnsignedShort(0x0B30) * 16; if (psp > 0) { int exeSize = memory.ReadUnsignedShort(psp - 16 + 3) * 16; if (exeSize > 100 * 1024 && exeSize < 200 * 1024) //is AITD exe loaded yet? { entryPoint = psp + 0x100; return true; } } entryPoint = -1; return false; } } }
mit
C#
045a611730a253c43330e932eb661f7fe262a2ad
Disable UWP C++ (for now)
Azure/azure-iot-hub-vs-cs,Azure/azure-iot-hub-vs-cs,Azure/azure-iot-hub-vs-cs
AzureIoTHubConnectedServiceLibrary/Handler.VisualC.WAC.cs
AzureIoTHubConnectedServiceLibrary/Handler.VisualC.WAC.cs
using Microsoft.VisualStudio.ConnectedServices; namespace AzureIoTHubConnectedService { #if false // Disabled to a bug: https://github.com/Azure/azure-iot-sdks/issues/289 [ConnectedServiceHandlerExport("Microsoft.AzureIoTHubService", AppliesTo = "VisualC+WindowsAppContainer")] #endif internal class CppHandlerWAC : GenericAzureIoTHubServiceHandler { protected override HandlerManifest BuildHandlerManifest(ConnectedServiceHandlerContext context) { HandlerManifest manifest = new HandlerManifest(); manifest.PackageReferences.Add(new NuGetReference("Newtonsoft.Json", "6.0.8")); manifest.PackageReferences.Add(new NuGetReference("Microsoft.Azure.Devices.Client", "1.0.1")); manifest.Files.Add(new FileToAdd("CPP/WAC/azure_iot_hub.cpp")); manifest.Files.Add(new FileToAdd("CPP/WAC/azure_iot_hub.h")); return manifest; } protected override AddServiceInstanceResult CreateAddServiceInstanceResult(ConnectedServiceHandlerContext context) { return new AddServiceInstanceResult( "", null ); } protected override ConnectedServiceHandlerHelper GetConnectedServiceHandlerHelper(ConnectedServiceHandlerContext context) { return new AzureIoTHubConnectedServiceHandlerHelper(context); } } }
using Microsoft.VisualStudio.ConnectedServices; namespace AzureIoTHubConnectedService { [ConnectedServiceHandlerExport("Microsoft.AzureIoTHubService", AppliesTo = "VisualC+WindowsAppContainer")] internal class CppHandlerWAC : GenericAzureIoTHubServiceHandler { protected override HandlerManifest BuildHandlerManifest(ConnectedServiceHandlerContext context) { HandlerManifest manifest = new HandlerManifest(); manifest.PackageReferences.Add(new NuGetReference("Newtonsoft.Json", "6.0.8")); manifest.PackageReferences.Add(new NuGetReference("Microsoft.Azure.Devices.Client", "1.0.1")); manifest.Files.Add(new FileToAdd("CPP/WAC/azure_iot_hub.cpp")); manifest.Files.Add(new FileToAdd("CPP/WAC/azure_iot_hub.h")); return manifest; } protected override AddServiceInstanceResult CreateAddServiceInstanceResult(ConnectedServiceHandlerContext context) { return new AddServiceInstanceResult( "", null ); } protected override ConnectedServiceHandlerHelper GetConnectedServiceHandlerHelper(ConnectedServiceHandlerContext context) { return new AzureIoTHubConnectedServiceHandlerHelper(context); } } }
mit
C#
ec2182e6437a162c6df7fbdd12b96f6ff4fb0acc
Add missing documentation
tgstation/tgstation-server-tools,tgstation/tgstation-server,tgstation/tgstation-server
src/Tgstation.Server.Host/Configuration/ControlPanelConfiguration.cs
src/Tgstation.Server.Host/Configuration/ControlPanelConfiguration.cs
using System.Collections.Generic; namespace Tgstation.Server.Host.Configuration { /// <summary> /// Configuration options for the web control panel /// </summary> public sealed class ControlPanelConfiguration { /// <summary> /// The key for the <see cref="Microsoft.Extensions.Configuration.IConfigurationSection"/> the <see cref="ControlPanelConfiguration"/> resides in /// </summary> public const string Section = "ControlPanel"; /// <summary> /// If the control panel is enabled /// </summary> public bool Enable { get; set; } /// <summary> /// If any origin is allowed for CORS requests. This overrides <see cref="AllowedOrigins"/> /// </summary> public bool AllowAnyOrigin { get; set; } /// <summary> /// The channel to retrieve the webpanel from. "local" uses the bundled version. /// </summary> public string Channel { get; set; } /// <summary> /// Origins allowed for CORS requests /// </summary> public ICollection<string> AllowedOrigins { get; set; } } }
using System.Collections.Generic; namespace Tgstation.Server.Host.Configuration { /// <summary> /// Configuration options for the web control panel /// </summary> public sealed class ControlPanelConfiguration { /// <summary> /// The key for the <see cref="Microsoft.Extensions.Configuration.IConfigurationSection"/> the <see cref="ControlPanelConfiguration"/> resides in /// </summary> public const string Section = "ControlPanel"; /// <summary> /// If the control panel is enabled /// </summary> public bool Enable { get; set; } /// <summary> /// If any origin is allowed for CORS requests. This overrides <see cref="AllowedOrigins"/> /// </summary> public bool AllowAnyOrigin { get; set; } public string Channel { get; set; } /// <summary> /// Origins allowed for CORS requests /// </summary> public ICollection<string> AllowedOrigins { get; set; } } }
agpl-3.0
C#
6d8bed051c3bab1899e9793c23f1fde6ec9bd2b7
Update User.cs
jcvandan/XeroAPI.Net,TDaphneB/XeroAPI.Net,MatthewSteeples/XeroAPI.Net,XeroAPI/XeroAPI.Net
source/XeroApi/Model/User.cs
source/XeroApi/Model/User.cs
using System; namespace XeroApi.Model { public class User : EndpointModelBase { [ItemId] public Guid? UserID { get; set; } public string EmailAddress { get; set; } public string FirstName { get; set; } public string LastName { get; set; } [ReadOnly] public DateTime UpdatedDateUTC { get; set; } [ReadOnly] public bool IsSubscriber { get; set; } [ReadOnly] public string OrganisationRole { get; set; } public string FullName { get { return string.Concat(FirstName, " ", LastName); } } } public class Users : ModelList<User> { } }
using System; namespace XeroApi.Model { public class User : EndpointModelBase { [ItemId] public Guid? UserID { get; set; } public string FirstName { get; set; } public string LastName { get; set; } [ReadOnly] public DateTime UpdatedDateUTC { get; set; } [ReadOnly] public bool IsSubscriber { get; set; } [ReadOnly] public string OrganisationRole { get; set; } public string FullName { get { return string.Concat(FirstName, " ", LastName); } } } public class Users : ModelList<User> { } }
mit
C#
045e26d1ebac6a462f1031d4725361cd57d01cae
Update Gravatar downloader to HttpClient and cancellation tokens.
Cheesebaron/xamarin-store-app
Shared/Data/Gravatar.cs
Shared/Data/Gravatar.cs
using System; using System.IO; using System.Net.Http; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Security.Cryptography; #if __IOS__ using MonoTouch.Foundation; #endif using ModernHttpClient; namespace XamarinStore { class Gravatar { public enum Rating { G, PG, R, X } const string _url = "http://www.gravatar.com/avatar.php?gravatar_id="; public static string GetURL (string email, int size, Rating rating = Rating.PG) { var hash = MD5Hash (email.ToLower ()); if (size < 1 | size > 600) { throw new ArgumentOutOfRangeException("size", "The image size should be between 20 and 80"); } return _url + hash + "&s=" + size + "&r=" + rating.ToString ().ToLower (); } public static async Task<byte[]> GetImageBytes (string email, int size, CancellationToken token, Rating rating = Rating.PG) { var url = GetURL (email, size, rating); #if __IOS__ var client = new HttpClient(new NSUrlSessionHandler()); #else var client = new HttpClient(new OkHttpNetworkHandler()); #endif var res = await client.GetAsync(url, token); if (!res.IsSuccessStatusCode) return null; if (token.IsCancellationRequested) token.ThrowIfCancellationRequested(); return await res.Content.ReadAsByteArrayAsync(); } #if __IOS__ public static async Task<NSData> GetImageData (string email, int size, Rating rating = Rating.PG) { byte[] data = await GetImageBytes (email, size, rating); return NSData.FromStream (new System.IO.MemoryStream (data)); } #endif static string MD5Hash (string input) { var hasher = MD5.Create (); var builder = new StringBuilder (); var data = hasher.ComputeHash (Encoding.Default.GetBytes (input)); foreach (var datum in data) builder.Append (datum.ToString ("x2")); return builder.ToString (); } } }
using System; using System.IO; using System.Net; using System.Text; using System.Threading.Tasks; using System.Security.Cryptography; #if __IOS__ using MonoTouch.Foundation; #endif namespace XamarinStore { class Gravatar { public enum Rating { G, PG, R, X } const string _url = "http://www.gravatar.com/avatar.php?gravatar_id="; public static string GetURL (string email, int size, Rating rating = Rating.PG) { var hash = MD5Hash (email.ToLower ()); if (size < 1 | size > 600) { throw new ArgumentOutOfRangeException("size", "The image size should be between 20 and 80"); } return _url + hash + "&s=" + size.ToString () + "&r=" + rating.ToString ().ToLower (); } public static async Task<byte[]> GetImageBytes (string email, int size, Rating rating = Rating.PG) { var url = GetURL (email, size, rating); var client = new WebClient (); return await client.DownloadDataTaskAsync (url); } #if __IOS__ public static async Task<NSData> GetImageData (string email, int size, Rating rating = Rating.PG) { byte[] data = await GetImageBytes (email, size, rating); return NSData.FromStream (new System.IO.MemoryStream (data)); } #endif static string MD5Hash (string input) { var hasher = MD5.Create (); var builder = new StringBuilder (); byte[] data = hasher.ComputeHash (Encoding.Default.GetBytes (input)); foreach (byte datum in data) builder.Append (datum.ToString ("x2")); return builder.ToString (); } } }
mit
C#
f35fafbb48978000194877d602554214edf0fb73
Adjust Kevin's bio
planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell
src/Firehose.Web/Authors/KevinMarquette.cs
src/Firehose.Web/Authors/KevinMarquette.cs
using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel.Syndication; using System.Web; using Firehose.Web.Infrastructure; namespace Firehose.Web.Authors { public class KevinMarquette : IAmAMicrosoftMVP { public string FirstName => "Kevin"; public string LastName => "Marquette"; public string ShortBioOrTagLine => "Principal DevOps Engineer, Microsoft MVP, 2018 PowerShell Community Hero, and SoCal PowerShell UserGroup Organizer."; public string StateOrRegion => "Orange County, USA"; public string EmailAddress => "kevmar@gmail.com"; public string TwitterHandle => "kevinmarquette"; public string GitHubHandle => "kevinmarquette"; public string GravatarHash => "d7d29e9573b5da44d9886df24fcc6142"; public GeoPosition Position => new GeoPosition(33.6800000,-117.7900000); public Uri WebSite => new Uri("https://PowerShellExplained.com"); public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://powershellexplained.com/feed.xml"); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel.Syndication; using System.Web; using Firehose.Web.Infrastructure; namespace Firehose.Web.Authors { public class KevinMarquette : IAmAMicrosoftMVP { public string FirstName => "Kevin"; public string LastName => "Marquette"; public string ShortBioOrTagLine => "Sr. DevOps Engineer, 2018 PowerShell Community Hero, Microsoft MVP, and SoCal PowerShell UserGroup Organizer."; public string StateOrRegion => "Orange County, USA"; public string EmailAddress => "kevmar@gmail.com"; public string TwitterHandle => "kevinmarquette"; public string GitHubHandle => "kevinmarquette"; public string GravatarHash => "d7d29e9573b5da44d9886df24fcc6142"; public GeoPosition Position => new GeoPosition(33.6800000,-117.7900000); public Uri WebSite => new Uri("https://PowerShellExplained.com"); public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://powershellexplained.com/feed.xml"); } } } }
mit
C#
5b8511bda1bcacc5f9f148c5ba91fdc782451973
Increment version to v1.1.0.13
XeroAPI/XeroAPI.Net,TDaphneB/XeroAPI.Net,MatthewSteeples/XeroAPI.Net,jcvandan/XeroAPI.Net
source/XeroApi/Properties/AssemblyInfo.cs
source/XeroApi/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("XeroApi")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Xero")] [assembly: AssemblyProduct("XeroApi")] [assembly: AssemblyCopyright("Copyright © Xero 2011")] [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("e18a84e7-ba04-4368-b4c9-0ea0cc78ddef")] // 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.1.0.13")] [assembly: AssemblyFileVersion("1.1.0.13")]
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("XeroApi")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Xero")] [assembly: AssemblyProduct("XeroApi")] [assembly: AssemblyCopyright("Copyright © Xero 2011")] [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("e18a84e7-ba04-4368-b4c9-0ea0cc78ddef")] // 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.1.0.12")] [assembly: AssemblyFileVersion("1.1.0.12")]
mit
C#
93502792300a1c92b67cb9c093b2acf1e22e1983
Send close message when close connection to the EchoLogger server.
zwcloud/ImGui,zwcloud/ImGui,zwcloud/ImGui
src/ImGui/Development/Logger/EchoLogger.cs
src/ImGui/Development/Logger/EchoLogger.cs
using System; using System.Diagnostics; using System.Net.Sockets; namespace ImGui { public class EchoLogger : ILogger { private static TcpClient client; private static NetworkStream stream; public static void Show() { client = new TcpClient("127.0.0.1", 13000); stream = client.GetStream(); } public static void Hide() { //dummy } public static void Close() { SendMessage("q\n"); stream.Close(); client.Close(); } public void Clear() { //dummy } private static void SendMessage(string message) { if (!stream.CanWrite) { return; } Byte[] data = System.Text.Encoding.ASCII.GetBytes(message+'\n'); stream.Write(data, 0, data.Length); } public void Msg(string format, params object[] args) { SendMessage(string.Format(format, args)); } public void Warning(string format, params object[] args) { SendMessage(string.Format(format, args)); } public void Error(string format, params object[] args) { SendMessage(string.Format(format, args)); } } }
using System; using System.Diagnostics; using System.Net.Sockets; namespace ImGui { public class EchoLogger : ILogger { private static TcpClient client; private static NetworkStream stream; public static void Show() { client = new TcpClient("127.0.0.1", 13000); stream = client.GetStream(); } public static void Hide() { //dummy } public static void Close() { stream.Close(); client.Close(); } public void Clear() { //dummy } private void SendMessage(string message) { if (!stream.CanWrite) { return; } Byte[] data = System.Text.Encoding.ASCII.GetBytes(message+'\n'); stream.Write(data, 0, data.Length); } public void Msg(string format, params object[] args) { SendMessage(string.Format(format, args)); } public void Warning(string format, params object[] args) { SendMessage(string.Format(format, args)); } public void Error(string format, params object[] args) { SendMessage(string.Format(format, args)); } } }
agpl-3.0
C#
44da8e5fd7c8255eff2aeabb142fa6d204b3fe66
add thumbnail path for video messages
spkl/3ma-backup-viewer
src/3maBackupReader/Messages/VideoMessage.cs
src/3maBackupReader/Messages/VideoMessage.cs
using System.IO; namespace LateNightStupidities.IIImaBackupReader.Messages { /// <summary> /// A message with an attached video. /// </summary> public class VideoMessage : MediaMessage { /// <summary> /// Gets the file name of the thumbnail in the backup folder. /// </summary> public string ThumbnailFileName => $"message_media_{this.Uid}"; /// <summary> /// Gets the file path of the thumbnail. /// </summary> public string ThumbnailFilePath => Path.Combine(Path.GetDirectoryName(this.Conversation.FilePath), this.ThumbnailFileName); internal VideoMessage() { } } }
namespace LateNightStupidities.IIImaBackupReader.Messages { /// <summary> /// A message with an attached video. /// </summary> public class VideoMessage : MediaMessage { internal VideoMessage() { } } }
mit
C#
0058f42127d040ac20934e55225699234fd744a7
add default timeout configuration for kafka client.
dotnetcore/CAP,ouraspnet/cap,dotnetcore/CAP,dotnetcore/CAP
src/DotNetCore.CAP.Kafka/CAP.KafkaOptions.cs
src/DotNetCore.CAP.Kafka/CAP.KafkaOptions.cs
// Copyright (c) .NET Core Community. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; // ReSharper disable once CheckNamespace namespace DotNetCore.CAP { /// <summary> /// Provides programmatic configuration for the CAP kafka project. /// </summary> public class KafkaOptions { /// <summary> /// librdkafka configuration parameters (refer to https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md). /// <para> /// Topic configuration parameters are specified via the "default.topic.config" sub-dictionary config parameter. /// </para> /// </summary> public readonly ConcurrentDictionary<string, object> MainConfig; private IEnumerable<KeyValuePair<string, object>> _kafkaConfig; public KafkaOptions() { MainConfig = new ConcurrentDictionary<string, object>(); } /// <summary> /// Producer connection pool size, default is 10 /// </summary> public int ConnectionPoolSize { get; set; } = 10; /// <summary> /// The `bootstrap.servers` item config of <see cref="MainConfig" />. /// <para> /// Initial list of brokers as a CSV list of broker host or host:port. /// </para> /// </summary> public string Servers { get; set; } internal IEnumerable<KeyValuePair<string, object>> AsKafkaConfig() { if (_kafkaConfig == null) { if (string.IsNullOrWhiteSpace(Servers)) { throw new ArgumentNullException(nameof(Servers)); } MainConfig["bootstrap.servers"] = Servers; MainConfig["queue.buffering.max.ms"] = "10"; MainConfig["socket.blocking.max.ms"] = "10"; MainConfig["enable.auto.commit"] = "false"; MainConfig["log.connection.close"] = "false"; MainConfig["request.timeout.ms"] = "3000"; MainConfig["message.timeout.ms"] = "5000"; _kafkaConfig = MainConfig.AsEnumerable(); } return _kafkaConfig; } } }
// Copyright (c) .NET Core Community. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; // ReSharper disable once CheckNamespace namespace DotNetCore.CAP { /// <summary> /// Provides programmatic configuration for the CAP kafka project. /// </summary> public class KafkaOptions { /// <summary> /// librdkafka configuration parameters (refer to https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md). /// <para> /// Topic configuration parameters are specified via the "default.topic.config" sub-dictionary config parameter. /// </para> /// </summary> public readonly ConcurrentDictionary<string, object> MainConfig; private IEnumerable<KeyValuePair<string, object>> _kafkaConfig; public KafkaOptions() { MainConfig = new ConcurrentDictionary<string, object>(); } /// <summary> /// Producer connection pool size, default is 10 /// </summary> public int ConnectionPoolSize { get; set; } = 10; /// <summary> /// The `bootstrap.servers` item config of <see cref="MainConfig" />. /// <para> /// Initial list of brokers as a CSV list of broker host or host:port. /// </para> /// </summary> public string Servers { get; set; } internal IEnumerable<KeyValuePair<string, object>> AsKafkaConfig() { if (_kafkaConfig == null) { if (string.IsNullOrWhiteSpace(Servers)) { throw new ArgumentNullException(nameof(Servers)); } MainConfig["bootstrap.servers"] = Servers; MainConfig["queue.buffering.max.ms"] = "10"; MainConfig["socket.blocking.max.ms"] = "10"; MainConfig["enable.auto.commit"] = "false"; MainConfig["log.connection.close"] = "false"; _kafkaConfig = MainConfig.AsEnumerable(); } return _kafkaConfig; } } }
mit
C#
b6620de6ecb38ecf54dff008daeaabfaa69e2a0a
fix regression
nerai/CMenu
src/ExampleMenu/Procedures/ProcManager.cs
src/ExampleMenu/Procedures/ProcManager.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using ConsoleMenu; namespace ExampleMenu.Procedures { public class ProcManager { private class Proc { public readonly List<string> Commands = new List<string> (); public readonly Dictionary<string, int> JumpMarks = new Dictionary<string, int> (); public Proc (IEnumerable<string> content) { Commands = new List<string> (content); for (int i = 0; i < Commands.Count; i++) { var s = Commands[i]; if (s.StartsWith (":")) { s = s.Substring (1); var name = MenuUtil.SplitFirstWord (ref s); JumpMarks[name] = i; Commands[i] = s; } } } } private readonly Dictionary<string, Proc> _Procs = new Dictionary<string, Proc> (); private bool _RequestReturn = false; private string _RequestJump = null; public void AddProc (string name, IEnumerable<string> content) { if (_Procs.ContainsKey (name)) { Console.WriteLine ("Procedure \"" + name + "\" is already defined."); return; } var proc = new Proc (content); _Procs.Add (name, proc); } public IEnumerable<string> GenerateInput (string procname) { Proc proc; if (!_Procs.TryGetValue (procname, out proc)) { Console.WriteLine ("Unknown procedure: " + proc); yield break; } int i = 0; while (i < proc.Commands.Count) { var line = proc.Commands[i]; yield return line; i++; if (_RequestReturn) { _RequestReturn = false; break; } if (_RequestJump != null) { i = proc.JumpMarks[_RequestJump]; // todo check _RequestJump = null; } } } public void Return () { _RequestReturn = true; } public void Jump (string mark) { _RequestJump = mark; } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using ConsoleMenu; namespace ExampleMenu.Procedures { public class ProcManager { private class Proc { public readonly List<string> Commands = new List<string> (); public readonly Dictionary<string, int> JumpMarks = new Dictionary<string, int> (); public Proc (IEnumerable<string> content) { Commands = new List<string> (content); for (int i = 0; i < Commands.Count; i++) { var s = Commands[i]; if (s.StartsWith (":")) { s = s.Substring (1); var name = MenuUtil.SplitFirstWord (ref s); JumpMarks[name] = i; Commands[i] = s; } } } } private readonly Dictionary<string, Proc> _Procs = new Dictionary<string, Proc> (); private bool _RequestReturn = false; private string _RequestJump = null; public void AddProc (string name, IEnumerable<string> content) { var proc = new Proc (content); _Procs.Add (name, proc); } public IEnumerable<string> GenerateInput (string procname) { Proc proc; if (!_Procs.TryGetValue (procname, out proc)) { Console.WriteLine ("Unknown procedure: " + proc); yield break; } int i = 0; while (i < proc.Commands.Count) { var line = proc.Commands[i]; yield return line; if (_RequestReturn) { _RequestReturn = false; break; } if (_RequestJump != null) { i = proc.JumpMarks[_RequestJump]; // todo check _RequestJump = null; break; } } } public void Return () { _RequestReturn = true; } public void Jump (string mark) { _RequestJump = mark; } } }
mit
C#
838a7d90e716d2352253cb1c638fdde2ba466a19
Add specs for implicit byte array to version conversion where byte array is invalid.
jagrem/msg
src/Msg.UnitTests/VersionSpecs.cs
src/Msg.UnitTests/VersionSpecs.cs
using NUnit.Framework; using Msg.Domain; using FluentAssertions; using System; using Version = Msg.Domain.Version; namespace Msg.UnitTests { [TestFixture] public class VersionSpecs { static readonly Func<byte[],Version> convertByteArray = b => b; [Test] public void Given_any_version_When_converting_to_a_byte_array_Then_AMQP_followed_by_zero_are_the_first_five_bytes() { var subject = new Version (1, 2, 3); byte[] result = subject; result.Should ().ContainInOrder ((byte)'A', (byte)'M', (byte)'Q', (byte)'P', (byte)0); } [Test] public void Given_a_version_When_converting_to_a_byte_array_Then_the_sixth_byte_equals_the_major_version_number() { var subject = new Version (1, 2, 3); byte[] result = subject; result.Should ().HaveElementAt (5, (byte)1); } [Test] public void Given_a_version_When_converting_to_a_byte_array_Then_the_seventh_byte_equals_the_minor_version_number() { var subject = new Version (1, 2, 3); byte[] result = subject; result.Should ().HaveElementAt (6, (byte)2); } [Test] public void Given_a_version_When_converting_to_a_byte_array_Then_the_eight_byte_equals_the_revision_number() { var subject = new Version (1, 2, 3); byte[] result = subject; result.Should ().HaveElementAt (7, (byte)3); } [Test] public void Given_a_byte_array_When_converting_to_a_version_Then_the_version_number_is_correct() { var subject = new byte[] { (byte)'A', (byte)'M', (byte)'Q', (byte)'P', (byte)0, (byte)1, (byte)2, (byte)3 }; Version result = subject; result.Major.Should ().Be (1); result.Minor.Should ().Be (2); result.Revision.Should ().Be (3); } [Test] public void Given_an_empty_byte_array_When_converting_to_a_version_Then_an_exception_is_thrown() { var subject = new byte[0]; Action result = () => convertByteArray (subject); result.ShouldThrow<ArgumentException> (); } [Test] public void Given_a_byte_array_that_is_too_short_When_converting_to_a_version_Then_an_exception_is_thrown() { var subject = new byte[] { (byte)'Z', (byte)'S', (byte)'X', (byte)'F', (byte)0, (byte)1, (byte)2 }; Action result = () => convertByteArray (subject); result.ShouldThrow<ArgumentException> (); } [Test] public void Given_a_byte_array_that_is_too_long_When_converting_to_a_version_Then_an_exception_is_thrown() { var subject = new byte[] { (byte)'Z', (byte)'S', (byte)'X', (byte)'F', (byte)0, (byte)1, (byte)2, (byte)3, (byte)4 }; Action result = () => convertByteArray (subject); result.ShouldThrow<ArgumentException> (); } [Test] public void Given_a_byte_array_with_an_fifth_byte_greater_than_zero_When_converting_to_a_version_Then_an_exception_is_thrown() { var subject = new byte[] { (byte)'Z', (byte)'S', (byte)'X', (byte)'F', (byte)7, (byte)1, (byte)2, (byte)3 }; Action result = () => convertByteArray (subject); result.ShouldThrow<ArgumentException> (); } [Test] public void Given_a_byte_array_that_doesnt_start_with_AMQP_When_converting_to_a_version_Then_an_exception_is_thrown() { var subject = new byte[] { (byte)'Z', (byte)'S', (byte)'X', (byte)'F', (byte)7, (byte)1, (byte)2, (byte)3 }; Action result = () => convertByteArray (subject); result.ShouldThrow<ArgumentException> (); } } }
using NUnit.Framework; using Msg.Domain; using FluentAssertions; namespace Msg.UnitTests { [TestFixture] public class VersionSpecs { [Test] public void Given_any_version_When_converting_to_a_byte_array_Then_AMQP_followed_by_zero_are_the_first_five_bytes() { var subject = new Version (1, 2, 3); byte[] result = subject; result.Should ().ContainInOrder ((byte)'A', (byte)'M', (byte)'Q', (byte)'P', (byte)0); } [Test] public void Given_a_version_When_converting_to_a_byte_array_Then_the_sixth_byte_equals_the_major_version_number() { var subject = new Version (1, 2, 3); byte[] result = subject; result.Should ().HaveElementAt (5, (byte)1); } [Test] public void Given_a_version_When_converting_to_a_byte_array_Then_the_seventh_byte_equals_the_minor_version_number() { var subject = new Version (1, 2, 3); byte[] result = subject; result.Should ().HaveElementAt (6, (byte)2); } [Test] public void Given_a_version_When_converting_to_a_byte_array_Then_the_eight_byte_equals_the_revision_number() { var subject = new Version (1, 2, 3); byte[] result = subject; result.Should ().HaveElementAt (7, (byte)3); } [Test] public void Given_a_byte_array_When_converting_to_a_version_Then_the_version_number_is_correct() { var subject = new byte[] { (byte)'A', (byte)'M', (byte)'Q', (byte)'P', (byte)0, (byte)1, (byte)2, (byte)3 }; Version result = subject; result.Major.Should ().Be (1); result.Minor.Should ().Be (2); result.Revision.Should ().Be (3); } } }
apache-2.0
C#
334fb7d4753386c6d534efe27e80e421a3b8a94f
Add additional params to index request
UselessToucan/osu,peppy/osu-new,peppy/osu,smoogipoo/osu,peppy/osu,ppy/osu,UselessToucan/osu,UselessToucan/osu,NeoAdonis/osu,smoogipoo/osu,NeoAdonis/osu,ppy/osu,smoogipoo/osu,peppy/osu,smoogipooo/osu,ppy/osu,NeoAdonis/osu
osu.Game/Online/Multiplayer/IndexPlaylistScoresRequest.cs
osu.Game/Online/Multiplayer/IndexPlaylistScoresRequest.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; using Newtonsoft.Json; using osu.Framework.IO.Network; using osu.Game.Extensions; using osu.Game.Online.API; using osu.Game.Online.API.Requests; namespace osu.Game.Online.Multiplayer { /// <summary> /// Returns a list of scores for the specified playlist item. /// </summary> public class IndexPlaylistScoresRequest : APIRequest<RoomPlaylistScores> { private readonly int roomId; private readonly int playlistItemId; private readonly Cursor cursor; private readonly MultiplayerScoresSort? sort; public IndexPlaylistScoresRequest(int roomId, int playlistItemId, Cursor cursor = null, MultiplayerScoresSort? sort = null) { this.roomId = roomId; this.playlistItemId = playlistItemId; this.cursor = cursor; this.sort = sort; } protected override WebRequest CreateWebRequest() { var req = base.CreateWebRequest(); req.AddCursor(cursor); switch (sort) { case MultiplayerScoresSort.Ascending: req.AddParameter("sort", "scores_asc"); break; case MultiplayerScoresSort.Descending: req.AddParameter("sort", "scores_desc"); break; } return req; } protected override string Target => $@"rooms/{roomId}/playlist/{playlistItemId}/scores"; } public class RoomPlaylistScores { [JsonProperty("scores")] public List<MultiplayerScore> Scores { get; set; } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; using Newtonsoft.Json; using osu.Game.Online.API; namespace osu.Game.Online.Multiplayer { public class IndexPlaylistScoresRequest : APIRequest<RoomPlaylistScores> { private readonly int roomId; private readonly int playlistItemId; public IndexPlaylistScoresRequest(int roomId, int playlistItemId) { this.roomId = roomId; this.playlistItemId = playlistItemId; } protected override string Target => $@"rooms/{roomId}/playlist/{playlistItemId}/scores"; } public class RoomPlaylistScores { [JsonProperty("scores")] public List<MultiplayerScore> Scores { get; set; } } }
mit
C#
168a7a588b62b3f087e1d6e9785b7e8eeb2f9959
Add xmldoc to ctor also
peppy/osu,NeoAdonis/osu,smoogipooo/osu,NeoAdonis/osu,ppy/osu,ppy/osu,smoogipoo/osu,peppy/osu,smoogipoo/osu,smoogipoo/osu,peppy/osu,ppy/osu,NeoAdonis/osu
osu.Game/Rulesets/Difficulty/TimedDifficultyAttributes.cs
osu.Game/Rulesets/Difficulty/TimedDifficultyAttributes.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; namespace osu.Game.Rulesets.Difficulty { /// <summary> /// Wraps a <see cref="DifficultyAttributes"/> object and adds a time value for which the attribute is valid. /// Output by <see cref="DifficultyCalculator.CalculateTimed"/>. /// </summary> public class TimedDifficultyAttributes : IComparable<TimedDifficultyAttributes> { /// <summary> /// The non-clock-adjusted time value at which the attributes take effect. /// </summary> public readonly double Time; /// <summary> /// The attributes. /// </summary> public readonly DifficultyAttributes Attributes; /// <summary> /// Creates new <see cref="TimedDifficultyAttributes"/>. /// </summary> /// <param name="time">The non-clock-adjusted time value at which the attributes take effect.</param> /// <param name="attributes">The attributes.</param> public TimedDifficultyAttributes(double time, DifficultyAttributes attributes) { Time = time; Attributes = attributes; } public int CompareTo(TimedDifficultyAttributes other) => Time.CompareTo(other.Time); } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; namespace osu.Game.Rulesets.Difficulty { /// <summary> /// Wraps a <see cref="DifficultyAttributes"/> object and adds a time value for which the attribute is valid. /// Output by <see cref="DifficultyCalculator.CalculateTimed"/>. /// </summary> public class TimedDifficultyAttributes : IComparable<TimedDifficultyAttributes> { /// <summary> /// The non-clock-adjusted time value at which the attributes take effect. /// </summary> public readonly double Time; /// <summary> /// The attributes. /// </summary> public readonly DifficultyAttributes Attributes; public TimedDifficultyAttributes(double time, DifficultyAttributes attributes) { Time = time; Attributes = attributes; } public int CompareTo(TimedDifficultyAttributes other) => Time.CompareTo(other.Time); } }
mit
C#
4507fb0c641f87978c8bcff4cd1682ae03c26ab0
Use an ordinal string comparer to sort the parameters for validation
syntaxtree/SyntaxTree.FastSpring
FastSpringFormValidator.cs
FastSpringFormValidator.cs
using System; using System.Collections.Specialized; using System.Linq; using System.Security.Cryptography; using System.Text; namespace SyntaxTree.FastSpring { internal static class FastSpringFormValidator { public static bool IsValidNotification(this NameValueCollection form, string privateKey) { const string dataParameter = "security_data"; const string hashParameter = "security_hash"; if (!form.HasParameter(dataParameter) || !form.HasParameter(hashParameter)) return false; var value = form[dataParameter] + privateKey; return form.HashMatches(hashParameter, value); } public static bool IsValidLicenseRequest(this NameValueCollection form, string privateKey) { const string hashParameter = "security_request_hash"; if (!form.HasParameter(hashParameter)) return false; var value = form.AllKeys .Where(k => k != hashParameter) .OrderBy(k => k, StringComparer.Ordinal) .Select(k => form[k]) .Aggregate(new StringBuilder(), (sb, v) => sb.Append(v)) .Append(privateKey) .ToString(); return form.HashMatches(hashParameter, value); } private static bool HashMatches(this NameValueCollection form, string hashParameter, string value) { return form[hashParameter].ToLowerInvariant() == Md5HashOf(value); } private static bool HasParameter(this NameValueCollection form, string parameter) { return form[parameter] != null; } private static string Md5HashOf(string value) { return MD5.Create() .ComputeHash(Encoding.UTF8.GetBytes(value)) .Aggregate(new StringBuilder(), (sb, b) => sb.Append(b.ToString("x2"))) .ToString(); } } }
using System.Collections.Specialized; using System.Linq; using System.Security.Cryptography; using System.Text; namespace SyntaxTree.FastSpring { internal static class FastSpringFormValidator { public static bool IsValidNotification(this NameValueCollection form, string privateKey) { const string dataParameter = "security_data"; const string hashParameter = "security_hash"; if (!form.HasParameter(dataParameter) || !form.HasParameter(hashParameter)) return false; var value = form[dataParameter] + privateKey; return form.HashMatches(hashParameter, value); } public static bool IsValidLicenseRequest(this NameValueCollection form, string privateKey) { const string hashParameter = "security_request_hash"; if (!form.HasParameter(hashParameter)) return false; var value = form.AllKeys .Where(k => k != hashParameter) .OrderBy(k => k) .Select(k => form[k]) .Aggregate(new StringBuilder(), (sb, v) => sb.Append(v)) .Append(privateKey) .ToString(); return form.HashMatches(hashParameter, value); } private static bool HashMatches(this NameValueCollection form, string hashParameter, string value) { return form[hashParameter].ToLowerInvariant() == Md5HashOf(value); } private static bool HasParameter(this NameValueCollection form, string parameter) { return form[parameter] != null; } private static string Md5HashOf(string value) { return MD5.Create() .ComputeHash(Encoding.UTF8.GetBytes(value)) .Aggregate(new StringBuilder(), (sb, b) => sb.Append(b.ToString("x2"))) .ToString(); } } }
mit
C#
71c6b3c044ec13f6b60cebaffe8fc604a06b21c2
Add descriptive comments to CreatubblesConfiguration
creatubbles/ctb-api-unity
Assets/Scripts/CreatubblesConfiguration.cs
Assets/Scripts/CreatubblesConfiguration.cs
// // CreatubblesApiClientConfiguration.cs // CreatubblesApiClient // // Copyright (c) 2016 Creatubbles Pte. Ltd. // // 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 Creatubbles.Api; public class CreatubblesConfiguration: IApiConfiguration { /* API base url. Should be: - "https://api.staging.creatubbles.com" for Debug builds - "https://api.creatubbles.com" for Release builds */ public string BaseUrl { get { return "https://api.staging.creatubbles.com"; } } /* Personal application identifier. Please contact support@creatubbles.com to obtain it. */ public string AppId { get { return SecretData.AppId; } } /* Personal application secret. Please contact support@creatubbles.com to obtain it. */ public string AppSecret { get { return SecretData.AppSecret; } } /* API version string. */ public string ApiVersion { get { return "v2"; } } /* Locale code used for getting localized responses from servers. Example values: “en”, “pl”, “de”. Can be null. See: https://partners.creatubbles.com/api/#locales for details */ public string Locale { get { return "en"; } } }
// // CreatubblesApiClientConfiguration.cs // CreatubblesApiClient // // Copyright (c) 2016 Creatubbles Pte. Ltd. // // 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 Creatubbles.Api; public class CreatubblesConfiguration: IApiConfiguration { public string BaseUrl { get { return "https://api.staging.creatubbles.com"; } } public string AppId { get { return SecretData.AppId; } } public string AppSecret { get { return SecretData.AppSecret; } } public string ApiVersion { get { return "v2"; } } public string Locale { get { return "en"; } } }
mit
C#
a5498b2ff5d8a4b33c9ffab0a7a65a2386ead0e4
test masking matrix rows/cols
Haishi2016/Vault818,Haishi2016/Vault818,Haishi2016/Vault818,Haishi2016/Vault818,Haishi2016/Vault818,Haishi2016/Vault818,Haishi2016/Vault818
Diner/MathNetTests/MathNetTests/Program.cs
Diner/MathNetTests/MathNetTests/Program.cs
using MathNet.Numerics.LinearAlgebra; using MathNet.Numerics.LinearAlgebra.Complex; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MathNetTests { class Program { static void Main(string[] args) { var matrix = CreateMatrix.DenseOfArray<double>(new double[,] { { 1.0, -1.0, 2.0}, { 0.0, -3.0, 1.0}}); var vector = CreateVector.Dense<double>(new double[] { 2, 1, 0 }); //Matrix-Vector product Console.WriteLine(MatrixDotVector(matrix, vector)); //Expected: [1 -3] //Hadamard Procut Console.WriteLine(HadamardProduct(vector, vector)); //Expected: [4,1,0] //Pointwise substraction Console.WriteLine(PointwiseSubstraction(vector, vector)); //Expected: [0,0,0] Console.WriteLine(PointwiseSubstraction(matrix, matrix)); //Expected: [0,0,0][0,0,0] //Mask a row/column (but not clear it) var uMatrix = CreateMatrix.Dense<double>(2, 3, 1.0); uMatrix.ClearColumns(0, 2); var cMatrix = CreateMatrix.Dense<double>(2, 3, 1.0); cMatrix.ClearColumn(1); //with 1st and 3rd columns masked var newMatrix = matrix.PointwiseMultiply(uMatrix); Console.WriteLine(newMatrix); //original matrix Console.WriteLine(matrix); //update the newMatrix newMatrix[0, 1] = 100; newMatrix[1, 1] = 200; Console.WriteLine(newMatrix); //push new values back to original matrix = matrix.PointwiseMultiply(cMatrix) + newMatrix.PointwiseMultiply(uMatrix); Console.WriteLine(matrix); } static Vector<double> MatrixDotVector(Matrix<double> matrix, Vector<double> vector) { return matrix * vector; } static Vector<double> HadamardProduct(Vector<double> a, Vector<double> b) { return a.PointwiseMultiply(b); } static Vector<double> PointwiseSubstraction(Vector<double> a, Vector<double> b) { return a - b; } static Matrix<double> PointwiseSubstraction(Matrix<double> a, Matrix<double> b) { return a - b; } } }
using MathNet.Numerics.LinearAlgebra; using MathNet.Numerics.LinearAlgebra.Complex; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MathNetTests { class Program { static void Main(string[] args) { var matrix = CreateMatrix.DenseOfArray<double>(new double[,] { { 1.0, -1.0, 2.0}, { 0.0, -3.0, 1.0}}); var vector = CreateVector.Dense<double>(new double[] { 2, 1, 0 }); //Matrix-Vector product Console.WriteLine(MatrixDotVector(matrix, vector)); //Expected: [1 -3] //Hadamard Procut Console.WriteLine(HadamardProduct(vector, vector)); //Expected: [4,1,0] //Pointwise substraction Console.WriteLine(PointwiseSubstraction(vector, vector)); //Expected: [0,0,0] Console.WriteLine(PointwiseSubstraction(matrix, matrix)); //Expected: [0,0,0][0,0,0] } static Vector<double> MatrixDotVector(Matrix<double> matrix, Vector<double> vector) { return matrix * vector; } static Vector<double> HadamardProduct(Vector<double> a, Vector<double> b) { return a.PointwiseMultiply(b); } static Vector<double> PointwiseSubstraction(Vector<double> a, Vector<double> b) { return a - b; } static Matrix<double> PointwiseSubstraction(Matrix<double> a, Matrix<double> b) { return a - b; } } }
mit
C#
82cb85bba1c0ba0e2ac8343f9f6716a6afbf9f82
Fix concurrency issue accessing Dictionary instance
li0803/Orchard,xiaobudian/Orchard,austinsc/Orchard,smartnet-developers/Orchard,hbulzy/Orchard,harmony7/Orchard,m2cms/Orchard,Ermesx/Orchard,bigfont/orchard-continuous-integration-demo,qt1/Orchard,kouweizhong/Orchard,armanforghani/Orchard,OrchardCMS/Orchard,omidnasri/Orchard,MetSystem/Orchard,tobydodds/folklife,mgrowan/Orchard,Serlead/Orchard,AdvantageCS/Orchard,Codinlab/Orchard,marcoaoteixeira/Orchard,hhland/Orchard,TalaveraTechnologySolutions/Orchard,jtkech/Orchard,AEdmunds/beautiful-springtime,alejandroaldana/Orchard,huoxudong125/Orchard,arminkarimi/Orchard,harmony7/Orchard,bedegaming-aleksej/Orchard,omidnasri/Orchard,andyshao/Orchard,aaronamm/Orchard,geertdoornbos/Orchard,vard0/orchard.tan,AdvantageCS/Orchard,luchaoshuai/Orchard,AndreVolksdorf/Orchard,OrchardCMS/Orchard,mgrowan/Orchard,Praggie/Orchard,Morgma/valleyviewknolls,oxwanawxo/Orchard,Serlead/Orchard,Morgma/valleyviewknolls,abhishekluv/Orchard,Codinlab/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,ericschultz/outercurve-orchard,xiaobudian/Orchard,SeyDutch/Airbrush,huoxudong125/Orchard,omidnasri/Orchard,huoxudong125/Orchard,rtpHarry/Orchard,rtpHarry/Orchard,TaiAivaras/Orchard,TalaveraTechnologySolutions/Orchard,emretiryaki/Orchard,brownjordaninternational/OrchardCMS,cooclsee/Orchard,ehe888/Orchard,abhishekluv/Orchard,Serlead/Orchard,austinsc/Orchard,Praggie/Orchard,luchaoshuai/Orchard,caoxk/orchard,mgrowan/Orchard,Cphusion/Orchard,hhland/Orchard,Fogolan/OrchardForWork,arminkarimi/Orchard,li0803/Orchard,xkproject/Orchard,aaronamm/Orchard,LaserSrl/Orchard,Dolphinsimon/Orchard,jagraz/Orchard,austinsc/Orchard,Lombiq/Orchard,omidnasri/Orchard,andyshao/Orchard,mgrowan/Orchard,geertdoornbos/Orchard,brownjordaninternational/OrchardCMS,kgacova/Orchard,SeyDutch/Airbrush,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,angelapper/Orchard,jerryshi2007/Orchard,DonnotRain/Orchard,TalaveraTechnologySolutions/Orchard,vard0/orchard.tan,Dolphinsimon/Orchard,AndreVolksdorf/Orchard,xiaobudian/Orchard,KeithRaven/Orchard,NIKASoftwareDevs/Orchard,AndreVolksdorf/Orchard,jimasp/Orchard,salarvand/Portal,JRKelso/Orchard,SouleDesigns/SouleDesigns.Orchard,johnnyqian/Orchard,asabbott/chicagodevnet-website,enspiral-dev-academy/Orchard,stormleoxia/Orchard,SeyDutch/Airbrush,TalaveraTechnologySolutions/Orchard,KeithRaven/Orchard,LaserSrl/Orchard,OrchardCMS/Orchard-Harvest-Website,grapto/Orchard.CloudBust,Ermesx/Orchard,OrchardCMS/Orchard,openbizgit/Orchard,mgrowan/Orchard,phillipsj/Orchard,fassetar/Orchard,Serlead/Orchard,Sylapse/Orchard.HttpAuthSample,stormleoxia/Orchard,SzymonSel/Orchard,harmony7/Orchard,dozoft/Orchard,dburriss/Orchard,TalaveraTechnologySolutions/Orchard,jagraz/Orchard,qt1/Orchard,fortunearterial/Orchard,ehe888/Orchard,dcinzona/Orchard-Harvest-Website,xiaobudian/Orchard,salarvand/orchard,hbulzy/Orchard,xkproject/Orchard,emretiryaki/Orchard,MetSystem/Orchard,jchenga/Orchard,jaraco/orchard,xkproject/Orchard,smartnet-developers/Orchard,phillipsj/Orchard,dcinzona/Orchard,xiaobudian/Orchard,planetClaire/Orchard-LETS,jimasp/Orchard,fortunearterial/Orchard,openbizgit/Orchard,kgacova/Orchard,JRKelso/Orchard,SeyDutch/Airbrush,jersiovic/Orchard,yersans/Orchard,Inner89/Orchard,bigfont/orchard-cms-modules-and-themes,salarvand/orchard,austinsc/Orchard,AEdmunds/beautiful-springtime,omidnasri/Orchard,sebastienros/msc,salarvand/orchard,abhishekluv/Orchard,asabbott/chicagodevnet-website,fortunearterial/Orchard,salarvand/orchard,SouleDesigns/SouleDesigns.Orchard,jerryshi2007/Orchard,dozoft/Orchard,xkproject/Orchard,dburriss/Orchard,jtkech/Orchard,m2cms/Orchard,enspiral-dev-academy/Orchard,SzymonSel/Orchard,Morgma/valleyviewknolls,emretiryaki/Orchard,johnnyqian/Orchard,geertdoornbos/Orchard,Lombiq/Orchard,brownjordaninternational/OrchardCMS,hannan-azam/Orchard,RoyalVeterinaryCollege/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,jimasp/Orchard,infofromca/Orchard,Codinlab/Orchard,SzymonSel/Orchard,Cphusion/Orchard,tobydodds/folklife,jaraco/orchard,JRKelso/Orchard,MpDzik/Orchard,sfmskywalker/Orchard,jagraz/Orchard,tobydodds/folklife,Praggie/Orchard,spraiin/Orchard,jagraz/Orchard,jersiovic/Orchard,harmony7/Orchard,cooclsee/Orchard,dburriss/Orchard,neTp9c/Orchard,dcinzona/Orchard,Praggie/Orchard,planetClaire/Orchard-LETS,angelapper/Orchard,OrchardCMS/Orchard-Harvest-Website,emretiryaki/Orchard,grapto/Orchard.CloudBust,TalaveraTechnologySolutions/Orchard,cryogen/orchard,LaserSrl/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,vard0/orchard.tan,jerryshi2007/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,RoyalVeterinaryCollege/Orchard,TalaveraTechnologySolutions/Orchard,dozoft/Orchard,patricmutwiri/Orchard,aaronamm/Orchard,planetClaire/Orchard-LETS,Lombiq/Orchard,OrchardCMS/Orchard-Harvest-Website,bigfont/orchard-cms-modules-and-themes,geertdoornbos/Orchard,Fogolan/OrchardForWork,abhishekluv/Orchard,stormleoxia/Orchard,Sylapse/Orchard.HttpAuthSample,Dolphinsimon/Orchard,yersans/Orchard,huoxudong125/Orchard,neTp9c/Orchard,JRKelso/Orchard,m2cms/Orchard,omidnasri/Orchard,Inner89/Orchard,Morgma/valleyviewknolls,spraiin/Orchard,DonnotRain/Orchard,oxwanawxo/Orchard,yersans/Orchard,Sylapse/Orchard.HttpAuthSample,DonnotRain/Orchard,phillipsj/Orchard,yersans/Orchard,bedegaming-aleksej/Orchard,abhishekluv/Orchard,grapto/Orchard.CloudBust,dcinzona/Orchard,armanforghani/Orchard,DonnotRain/Orchard,neTp9c/Orchard,AndreVolksdorf/Orchard,andyshao/Orchard,bigfont/orchard-cms-modules-and-themes,qt1/orchard4ibn,jerryshi2007/Orchard,jchenga/Orchard,jimasp/Orchard,TaiAivaras/Orchard,bigfont/orchard-cms-modules-and-themes,dcinzona/Orchard,Anton-Am/Orchard,Inner89/Orchard,dcinzona/Orchard-Harvest-Website,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,infofromca/Orchard,gcsuk/Orchard,kouweizhong/Orchard,arminkarimi/Orchard,ericschultz/outercurve-orchard,sfmskywalker/Orchard,MetSystem/Orchard,infofromca/Orchard,luchaoshuai/Orchard,li0803/Orchard,mvarblow/Orchard,dcinzona/Orchard,KeithRaven/Orchard,NIKASoftwareDevs/Orchard,escofieldnaxos/Orchard,hhland/Orchard,oxwanawxo/Orchard,vard0/orchard.tan,brownjordaninternational/OrchardCMS,patricmutwiri/Orchard,kgacova/Orchard,JRKelso/Orchard,bedegaming-aleksej/Orchard,hbulzy/Orchard,MpDzik/Orchard,grapto/Orchard.CloudBust,vard0/orchard.tan,openbizgit/Orchard,TaiAivaras/Orchard,yonglehou/Orchard,gcsuk/Orchard,sebastienros/msc,TaiAivaras/Orchard,caoxk/orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,kouweizhong/Orchard,johnnyqian/Orchard,patricmutwiri/Orchard,grapto/Orchard.CloudBust,openbizgit/Orchard,fortunearterial/Orchard,bigfont/orchard-continuous-integration-demo,kouweizhong/Orchard,AdvantageCS/Orchard,sfmskywalker/Orchard,Sylapse/Orchard.HttpAuthSample,hannan-azam/Orchard,smartnet-developers/Orchard,Codinlab/Orchard,Morgma/valleyviewknolls,li0803/Orchard,hhland/Orchard,SzymonSel/Orchard,Cphusion/Orchard,mvarblow/Orchard,OrchardCMS/Orchard,SouleDesigns/SouleDesigns.Orchard,Sylapse/Orchard.HttpAuthSample,Serlead/Orchard,RoyalVeterinaryCollege/Orchard,DonnotRain/Orchard,spraiin/Orchard,vairam-svs/Orchard,jersiovic/Orchard,sebastienros/msc,Dolphinsimon/Orchard,Anton-Am/Orchard,SouleDesigns/SouleDesigns.Orchard,brownjordaninternational/OrchardCMS,NIKASoftwareDevs/Orchard,armanforghani/Orchard,omidnasri/Orchard,dcinzona/Orchard-Harvest-Website,MpDzik/Orchard,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,armanforghani/Orchard,cooclsee/Orchard,AdvantageCS/Orchard,escofieldnaxos/Orchard,jchenga/Orchard,m2cms/Orchard,smartnet-developers/Orchard,neTp9c/Orchard,oxwanawxo/Orchard,OrchardCMS/Orchard-Harvest-Website,yonglehou/Orchard,Anton-Am/Orchard,salarvand/Portal,AndreVolksdorf/Orchard,enspiral-dev-academy/Orchard,hbulzy/Orchard,qt1/orchard4ibn,infofromca/Orchard,jaraco/orchard,ehe888/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,AdvantageCS/Orchard,planetClaire/Orchard-LETS,Ermesx/Orchard,asabbott/chicagodevnet-website,OrchardCMS/Orchard-Harvest-Website,NIKASoftwareDevs/Orchard,geertdoornbos/Orchard,enspiral-dev-academy/Orchard,planetClaire/Orchard-LETS,alejandroaldana/Orchard,austinsc/Orchard,MetSystem/Orchard,dburriss/Orchard,aaronamm/Orchard,jtkech/Orchard,vairam-svs/Orchard,qt1/Orchard,SouleDesigns/SouleDesigns.Orchard,qt1/Orchard,Dolphinsimon/Orchard,mvarblow/Orchard,OrchardCMS/Orchard,smartnet-developers/Orchard,MetSystem/Orchard,alejandroaldana/Orchard,jtkech/Orchard,Cphusion/Orchard,vard0/orchard.tan,salarvand/Portal,andyshao/Orchard,fortunearterial/Orchard,marcoaoteixeira/Orchard,infofromca/Orchard,vairam-svs/Orchard,Cphusion/Orchard,Ermesx/Orchard,harmony7/Orchard,xkproject/Orchard,omidnasri/Orchard,caoxk/orchard,LaserSrl/Orchard,jerryshi2007/Orchard,escofieldnaxos/Orchard,gcsuk/Orchard,dcinzona/Orchard-Harvest-Website,abhishekluv/Orchard,IDeliverable/Orchard,emretiryaki/Orchard,m2cms/Orchard,rtpHarry/Orchard,dozoft/Orchard,qt1/orchard4ibn,jimasp/Orchard,salarvand/orchard,cooclsee/Orchard,kgacova/Orchard,sebastienros/msc,Fogolan/OrchardForWork,angelapper/Orchard,kgacova/Orchard,KeithRaven/Orchard,qt1/orchard4ibn,escofieldnaxos/Orchard,sfmskywalker/Orchard,yonglehou/Orchard,OrchardCMS/Orchard-Harvest-Website,dmitry-urenev/extended-orchard-cms-v10.1,IDeliverable/Orchard,Lombiq/Orchard,AEdmunds/beautiful-springtime,TaiAivaras/Orchard,kouweizhong/Orchard,Anton-Am/Orchard,jtkech/Orchard,enspiral-dev-academy/Orchard,johnnyqian/Orchard,TalaveraTechnologySolutions/Orchard,qt1/Orchard,Inner89/Orchard,SeyDutch/Airbrush,vairam-svs/Orchard,jchenga/Orchard,caoxk/orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,cryogen/orchard,qt1/orchard4ibn,fassetar/Orchard,Codinlab/Orchard,andyshao/Orchard,bigfont/orchard-cms-modules-and-themes,oxwanawxo/Orchard,vairam-svs/Orchard,rtpHarry/Orchard,stormleoxia/Orchard,arminkarimi/Orchard,aaronamm/Orchard,dmitry-urenev/extended-orchard-cms-v10.1,SzymonSel/Orchard,angelapper/Orchard,angelapper/Orchard,bigfont/orchard-continuous-integration-demo,ehe888/Orchard,bedegaming-aleksej/Orchard,patricmutwiri/Orchard,ericschultz/outercurve-orchard,IDeliverable/Orchard,IDeliverable/Orchard,hannan-azam/Orchard,alejandroaldana/Orchard,jersiovic/Orchard,tobydodds/folklife,IDeliverable/Orchard,MpDzik/Orchard,RoyalVeterinaryCollege/Orchard,Ermesx/Orchard,Lombiq/Orchard,RoyalVeterinaryCollege/Orchard,MpDzik/Orchard,fassetar/Orchard,luchaoshuai/Orchard,dcinzona/Orchard-Harvest-Website,MpDzik/Orchard,NIKASoftwareDevs/Orchard,Inner89/Orchard,asabbott/chicagodevnet-website,sfmskywalker/Orchard,spraiin/Orchard,dcinzona/Orchard-Harvest-Website,marcoaoteixeira/Orchard,mvarblow/Orchard,marcoaoteixeira/Orchard,marcoaoteixeira/Orchard,escofieldnaxos/Orchard,Anton-Am/Orchard,li0803/Orchard,jersiovic/Orchard,jagraz/Orchard,Fogolan/OrchardForWork,patricmutwiri/Orchard,hannan-azam/Orchard,bedegaming-aleksej/Orchard,bigfont/orchard-continuous-integration-demo,salarvand/Portal,Praggie/Orchard,gcsuk/Orchard,salarvand/Portal,sebastienros/msc,arminkarimi/Orchard,AEdmunds/beautiful-springtime,sfmskywalker/Orchard-Off-The-Grid-Sample-Code,phillipsj/Orchard,fassetar/Orchard,sfmskywalker/Orchard,jaraco/orchard,ericschultz/outercurve-orchard,phillipsj/Orchard,cryogen/orchard,yonglehou/Orchard,yersans/Orchard,stormleoxia/Orchard,omidnasri/Orchard,dburriss/Orchard,jchenga/Orchard,cryogen/orchard,sfmskywalker/Orchard,tobydodds/folklife,hannan-azam/Orchard,rtpHarry/Orchard,Fogolan/OrchardForWork,hbulzy/Orchard,sfmskywalker/Orchard,spraiin/Orchard,princeppy/JPYSites-Orchard-Azure-Live-SourceCode,qt1/orchard4ibn,yonglehou/Orchard,huoxudong125/Orchard,fassetar/Orchard,KeithRaven/Orchard,dozoft/Orchard,cooclsee/Orchard,luchaoshuai/Orchard,gcsuk/Orchard,LaserSrl/Orchard,alejandroaldana/Orchard,johnnyqian/Orchard,neTp9c/Orchard,armanforghani/Orchard,grapto/Orchard.CloudBust,mvarblow/Orchard,tobydodds/folklife,openbizgit/Orchard,hhland/Orchard,ehe888/Orchard
src/Orchard/Caching/Cache.cs
src/Orchard/Caching/Cache.cs
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; namespace Orchard.Caching { public class Cache<TKey, TResult> : ICache<TKey, TResult> { private readonly ConcurrentDictionary<TKey, CacheEntry> _entries; public Cache() { _entries = new ConcurrentDictionary<TKey, CacheEntry>(); } public TResult Get(TKey key, Func<AcquireContext<TKey>, TResult> acquire) { var entry = _entries.AddOrUpdate(key, // "Add" lambda k => CreateEntry(k, acquire), // "Update" lamdba (k, currentEntry) => (currentEntry.Tokens.All(t => t.IsCurrent) ? currentEntry : CreateEntry(k, acquire))); return entry.Result; } private static CacheEntry CreateEntry(TKey k, Func<AcquireContext<TKey>, TResult> acquire) { var entry = new CacheEntry { Tokens = new List<IVolatileToken>() }; var context = new AcquireContext<TKey>(k, volatileItem => entry.Tokens.Add(volatileItem)); entry.Result = acquire(context); return entry; } private class CacheEntry { public TResult Result { get; set; } public IList<IVolatileToken> Tokens { get; set; } } } }
using System; using System.Collections.Generic; using System.Linq; namespace Orchard.Caching { public class Cache<TKey, TResult> : ICache<TKey, TResult> { private readonly Dictionary<TKey, CacheEntry> _entries; public Cache() { _entries = new Dictionary<TKey, CacheEntry>(); } public TResult Get(TKey key, Func<AcquireContext<TKey>, TResult> acquire) { CacheEntry entry; if (!_entries.TryGetValue(key, out entry) || entry.Tokens.Any(t => !t.IsCurrent)) { entry = new CacheEntry { Tokens = new List<IVolatileToken>() }; var context = new AcquireContext<TKey>(key, volatileItem => entry.Tokens.Add(volatileItem)); entry.Result = acquire(context); _entries[key] = entry; } return entry.Result; } private class CacheEntry { public TResult Result { get; set; } public IList<IVolatileToken> Tokens { get; set; } } } }
bsd-3-clause
C#
d9521343fb8dcf5d1aea7958463ff186ec7abbf5
Use local user when not in domain
pecosk/football,pecosk/football
FootballLeague/Services/UsersADSearcher.cs
FootballLeague/Services/UsersADSearcher.cs
using System.Linq; using System.Web; using FootballLeague.Models; using System.DirectoryServices; namespace FootballLeague.Services { public class UsersADSearcher : IUsersADSearcher { public User LoadUserDetails(string userName) { var entry = new DirectoryEntry(); var searcher = new DirectorySearcher(entry); searcher.Filter = "(&(objectClass=user)(sAMAccountName=" + userName + "))"; searcher.PropertiesToLoad.Add("givenName"); searcher.PropertiesToLoad.Add("sn"); searcher.PropertiesToLoad.Add("mail"); try { var userProps = searcher.FindOne().Properties; var mail = userProps["mail"][0].ToString(); var first = userProps["givenName"][0].ToString(); var last = userProps["sn"][0].ToString(); return new User { Name = userName, Mail = mail, FirstName = first, LastName = last }; } catch { return new User { Name = HttpContext.Current.User.Identity.Name.Split('\\').Last(), Mail = "local@user.sk", FirstName = "Local", LastName = "User" }; } } } }
using FootballLeague.Models; using System.DirectoryServices; namespace FootballLeague.Services { public class UsersADSearcher : IUsersADSearcher { public User LoadUserDetails(string userName) { var entry = new DirectoryEntry(); var searcher = new DirectorySearcher(entry); searcher.Filter = "(&(objectClass=user)(sAMAccountName=" + userName + "))"; searcher.PropertiesToLoad.Add("givenName"); searcher.PropertiesToLoad.Add("sn"); searcher.PropertiesToLoad.Add("mail"); var userProps = searcher.FindOne().Properties; var mail = userProps["mail"][0].ToString(); var first = userProps["givenName"][0].ToString(); var last = userProps["sn"][0].ToString(); return new User { Name = userName, Mail = mail, FirstName = first, LastName = last }; } } }
mit
C#
377039400fa0456f15382a024020d43d061fc9ae
Use a set of defines, and some generics
GoCarrot/teak-unity,GoCarrot/teak-unity,GoCarrot/teak-unity,GoCarrot/teak-unity,GoCarrot/teak-unity
Assets/Teak/Editor/TeakPreProcessDefiner.cs
Assets/Teak/Editor/TeakPreProcessDefiner.cs
using UnityEditor; using UnityEditor.Build; #if UNITY_2018_1_OR_NEWER using UnityEditor.Build.Reporting; #endif using UnityEngine; using System.Collections.Generic; class TeakPreProcessDefiner : #if UNITY_2018_1_OR_NEWER IPreprocessBuildWithReport #else IPreprocessBuild #endif { public int callbackOrder { get { return 0; } } public static readonly string[] TeakDefines = new string[] { "TEAK_2_0_OR_NEWER" }; #if UNITY_2018_1_OR_NEWER public void OnPreprocessBuild(BuildReport report) { SetTeakPreprocesorDefines(report.summary.platformGroup); } #else public void OnPreprocessBuild(BuildTarget target, string path) { SetTeakPreprocesorDefines(BuildPipeline.GetBuildTargetGroup(target)); } #endif private void SetTeakPreprocesorDefines(BuildTargetGroup targetGroup) { string[] existingDefines = PlayerSettings.GetScriptingDefineSymbolsForGroup(targetGroup).Split(";"); HashSet<string> defines = new HashSet<string>(existingDefines); defines.UnionWith(TeakDefines); PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, string.Join(";", defines.ToArray())); } }
using UnityEditor; using UnityEditor.Build; #if UNITY_2018_1_OR_NEWER using UnityEditor.Build.Reporting; #endif using UnityEngine; class TeakPreProcessDefiner : #if UNITY_2018_1_OR_NEWER IPreprocessBuildWithReport #else IPreprocessBuild #endif { public int callbackOrder { get { return 0; } } public static readonly string[] TeakDefines = new string[] { "TEAK_2_0_OR_NEWER" }; #if UNITY_2018_1_OR_NEWER public void OnPreprocessBuild(BuildReport report) { SetTeakPreprocesorDefines(report.summary.platformGroup); } #else public void OnPreprocessBuild(BuildTarget target, string path) { SetTeakPreprocesorDefines(BuildPipeline.GetBuildTargetGroup(target)); } #endif private void SetTeakPreprocesorDefines(BuildTargetGroup targetGroup) { string defines = PlayerSettings.GetScriptingDefineSymbolsForGroup(targetGroup); if (!defines.EndsWith(";")) defines += ";"; defines += string.Join(";", TeakDefines); PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, defines); } }
apache-2.0
C#
05edb2cddbc49d597e782106f668c50d8ddafe14
Remove status edit
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
Battery-Commander.Web/Views/Evaluations/Edit.cshtml
Battery-Commander.Web/Views/Evaluations/Edit.cshtml
@model Evaluation @using (Html.BeginForm("Save", "Evaluations", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) { @Html.AntiForgeryToken() @Html.HiddenFor(model => model.Id) @Html.HiddenFor(model => model.Status) @Html.ValidationSummary() <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Ratee) @Html.DropDownListFor(model => model.RateeId, (IEnumerable<SelectListItem>)ViewBag.Soldiers, "-- Select a Soldier --") @Html.ActionLink("Add", "New", "Soldiers") </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Rater) @Html.DropDownListFor(model => model.RaterId, (IEnumerable<SelectListItem>)ViewBag.Soldiers, "-- Select a Soldier --") @Html.ActionLink("Add", "New", "Soldiers") </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.SeniorRater) @Html.DropDownListFor(model => model.SeniorRaterId, (IEnumerable<SelectListItem>)ViewBag.Soldiers, "-- Select a Soldier --") @Html.ActionLink("Add", "New", "Soldiers") </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.EvaluationId) @Html.EditorFor(model => model.EvaluationId) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.StartDate) @Html.EditorFor(model => model.StartDate) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.ThruDate) @Html.EditorFor(model => model.ThruDate) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Type) @Html.DropDownListFor(model => model.Type, Html.GetEnumSelectList<EvaluationType>()) </div> <button type="submit">Save</button> }
@model Evaluation @using (Html.BeginForm("Save", "Evaluations", FormMethod.Post, new { @class = "form-horizontal", role = "form" })) { @Html.AntiForgeryToken() @Html.HiddenFor(model => model.Id) @Html.ValidationSummary() <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Status) @Html.DropDownListFor(model => model.Status, Html.GetEnumSelectList<EvaluationStatus>()) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Ratee) @Html.DropDownListFor(model => model.RateeId, (IEnumerable<SelectListItem>)ViewBag.Soldiers, "-- Select a Soldier --") @Html.ActionLink("Add", "New", "Soldiers") </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Rater) @Html.DropDownListFor(model => model.RaterId, (IEnumerable<SelectListItem>)ViewBag.Soldiers, "-- Select a Soldier --") @Html.ActionLink("Add", "New", "Soldiers") </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.SeniorRater) @Html.DropDownListFor(model => model.SeniorRaterId, (IEnumerable<SelectListItem>)ViewBag.Soldiers, "-- Select a Soldier --") @Html.ActionLink("Add", "New", "Soldiers") </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.EvaluationId) @Html.EditorFor(model => model.EvaluationId) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.StartDate) @Html.EditorFor(model => model.StartDate) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.ThruDate) @Html.EditorFor(model => model.ThruDate) </div> <div class="form-group form-group-lg"> @Html.DisplayNameFor(model => model.Type) @Html.DropDownListFor(model => model.Type, Html.GetEnumSelectList<EvaluationType>()) </div> <button type="submit">Save</button> }
mit
C#
82c585a74f207e3c8b4ccd01c1fe2454fa70637d
Fix helloworld library usage.
roblillack/monoberry,roblillack/monoberry,roblillack/monoberry,roblillack/monoberry
samples/helloworld/Main.cs
samples/helloworld/Main.cs
using System; using System.Threading; using BlackBerry; using BlackBerry.Screen; namespace helloworld { class MainClass { public static void Main (string[] args) { using (var nav = new Navigator ()) using (var ctx = Context.GetInstance (ContextType.Application)) using (var win = new Window (ctx, WindowType.SCREEN_APPLICATION_WINDOW)) { win.AddBuffers (10); win.Identifier = "bla"; var r = new Random(); foreach (var b in win.Buffers) { b.Fill ((uint)r.Next ()); win.Render (b); System.Threading.Thread.Sleep (200); } //nav.AddUri ("", "Browser", "default", "http://google.com/"); //nav.AddUri ("", "Messages", "default", "messages://"); //return; var run = true; while (run) { Dialog.Alert ("CLOSE ME!", "jpo1jo1j1oj1oj1", //new Button ("Timer", Timer), //new Button ("Camera", Cam), //new Button ("Messages", () => nav.Invoke ("messages://")), new Button ("Badge", () => nav.HasBadge = true), new Button ("Browser", () => nav.Invoke ("http://google.com/")), new Button ("Close", () => run = false)); } } } public static void Timer () { using (var dlg = new Dialog ("OMFG–“UNICODE”", "I'm running MØNØ!!!!1")) { dlg.Show (); for (int i = 50; i > 0; i--) { dlg.Message = String.Format("Closing in {0:0.00} seconds.", i/10.0); Thread.Sleep (100); } } } public static void Cam () { using (var c = new Camera (Camera.Unit.Front, Camera.Mode.RW)) { c.TakePhoto (); } Dialog.Alert ("OMFG", "I got camera!1!1", new Button ("Ok!")); } } }
using System; using System.Threading; using BlackBerry; using BlackBerry.Screen; namespace helloworld { class MainClass { public static void Main (string[] args) { using (var nav = new Navigator ()) using (var ctx = new Context ()) using (var win = new Window (ctx, WindowType.SCREEN_APPLICATION_WINDOW)) { win.AddBuffers (10); win.Identifier = "bla"; var r = new Random(); foreach (var b in win.Buffers) { b.Fill (r.Next ()); win.Render (b); System.Threading.Thread.Sleep (200); } //nav.AddUri ("", "Browser", "default", "http://google.com/"); //nav.AddUri ("", "Messages", "default", "messages://"); //return; var run = true; while (run) { Dialog.Alert ("CLOSE ME!", "jpo1jo1j1oj1oj1", //new Button ("Timer", Timer), //new Button ("Camera", Cam), //new Button ("Messages", () => nav.Invoke ("messages://")), new Button ("Badge", () => nav.HasBadge = true), new Button ("Browser", () => nav.Invoke ("http://google.com/")), new Button ("Close", () => run = false)); } } } public static void Timer () { using (var dlg = new Dialog ("OMFG–“UNICODE”", "I'm running MØNØ!!!!1")) { dlg.Show (); for (int i = 50; i > 0; i--) { dlg.Message = String.Format("Closing in {0:0.00} seconds.", i/10.0); Thread.Sleep (100); } } } public static void Cam () { using (var c = new Camera (Camera.Unit.Front, Camera.Mode.RW)) { c.TakePhoto (); } Dialog.Alert ("OMFG", "I got camera!1!1", new Button ("Ok!")); } } }
mit
C#
c1254c650f1b70cb31fcb58ce9aa7be5736e68ee
Add comments about SelectMany
inputfalken/Sharpy
GeneratorAPI/Generation.cs
GeneratorAPI/Generation.cs
using System; using System.Collections.Generic; using System.Linq; namespace GeneratorAPI { public class Generation<T> { private static IEnumerable<TResult> InfiniteEnumerable<TResult>(Func<TResult> fn) { while (true) yield return fn(); } private readonly IEnumerable<T> _infiniteEnumerable; public Generation(IEnumerable<T> infiniteEnumerable) => _infiniteEnumerable = infiniteEnumerable; private Generation(Func<T> fn) : this(InfiniteEnumerable(fn)) { } public Generation<TResult> Select<TResult>(Func<T, TResult> fn) => new Generation<TResult>(_infiniteEnumerable .Select(fn)); public T Take() => _infiniteEnumerable.First(); public IEnumerable<T> Take(int count) => _infiniteEnumerable.Take(count); public Generation<TResult> SelectMany<TResult>(Func<T, Generation<TResult>> fn) => // If SelectMany was used on _infiniteEnumerable<T> with _infiniteEnumerable<TResult> the following would happen. // The first generation of _infiniteEnumerable<T> would be used and we would iterate forever on _infiniteEnumerable<TResult> // With current approach a new Generation<TResult> is created and given a Func<TResult> to its constructor. // The Func passed Generates from the result. new Generation<TResult>(() => fn(Take()).Take()); public Generation<TCompose> SelectMany<TResult, TCompose>(Func<T, Generation<TResult>> fn, Func<T, TResult, TCompose> composer) { return SelectMany(a => fn(a).SelectMany(r => new Generation<TCompose>(() => composer(a, r)))); } public Generation<T> Where(Func<T, bool> predicate) => new Generation<T>( _infiniteEnumerable.Where(predicate)); } }
using System; using System.Collections.Generic; using System.Linq; namespace GeneratorAPI { public class Generation<T> { private static IEnumerable<TResult> InfiniteEnumerable<TResult>(Func<TResult> fn) { while (true) yield return fn(); } private readonly IEnumerable<T> _infiniteEnumerable; public Generation(IEnumerable<T> infiniteEnumerable) => _infiniteEnumerable = infiniteEnumerable; private Generation(Func<T> fn) : this(InfiniteEnumerable(fn)) { } public Generation<TResult> Select<TResult>(Func<T, TResult> fn) => new Generation<TResult>(_infiniteEnumerable .Select(fn)); public T Take() => _infiniteEnumerable.First(); public IEnumerable<T> Take(int count) => _infiniteEnumerable.Take(count); public Generation<TResult> SelectMany<TResult>(Func<T, Generation<TResult>> fn) => new Generation<TResult>( () => fn(Take()).Take()); public Generation<TCompose> SelectMany<TResult, TCompose>(Func<T, Generation<TResult>> fn, Func<T, TResult, TCompose> composer) => SelectMany( arg => fn(arg).SelectMany(result => new Generation<TCompose>(() => composer(arg, result)))); public Generation<T> Where(Func<T, bool> predicate) => new Generation<T>( _infiniteEnumerable.Where(predicate)); } }
mit
C#
5e9cb97b0f4378012652f6f9868bc02b652abe91
update Action response for embedded Region object
vevix/DigitalOcean.API
DigitalOcean.API/Models/Responses/Action.cs
DigitalOcean.API/Models/Responses/Action.cs
using System; namespace DigitalOcean.API.Models.Responses { /// <summary> /// Actions are records of events that have occurred on the resources in your account. These can be things like rebooting a /// Droplet, or transferring an image to a new region. /// </summary> public class Action { /// <summary> /// A unique numeric ID that can be used to identify and reference an action. /// </summary> public int Id { get; set; } /// <summary> /// The current status of the action. This can be "in-progress", "completed", or "errored". /// </summary> public string Status { get; set; } /// <summary> /// This is the type of action that the object represents. For example, this could be "transfer" to represent the state of /// an image transfer action. /// </summary> public string Type { get; set; } /// <summary> /// A time value given in ISO8601 combined date and time format that represents when the action was initiated. /// </summary> public DateTime StartedAt { get; set; } /// <summary> /// A time value given in ISO8601 combined date and time format that represents when the action was completed. /// </summary> public DateTime? CompletedAt { get; set; } /// <summary> /// A unique identifier for the resource that the action is associated with. /// </summary> public int? ResourceId { get; set; } /// <summary> /// The type of resource that the action is associated with. /// </summary> public string ResourceType { get; set; } /// <summary> /// Embedded region object /// </summary> public Region Region { get; set; } /// <summary> /// A slug representing the region where the action occurred. /// </summary> public string RegionSlug { get; set; } } }
using System; namespace DigitalOcean.API.Models.Responses { /// <summary> /// Actions are records of events that have occurred on the resources in your account. These can be things like rebooting a /// Droplet, or transferring an image to a new region. /// </summary> public class Action { /// <summary> /// A unique numeric ID that can be used to identify and reference an action. /// </summary> public int Id { get; set; } /// <summary> /// The current status of the action. This can be "in-progress", "completed", or "errored". /// </summary> public string Status { get; set; } /// <summary> /// This is the type of action that the object represents. For example, this could be "transfer" to represent the state of /// an image transfer action. /// </summary> public string Type { get; set; } /// <summary> /// A time value given in ISO8601 combined date and time format that represents when the action was initiated. /// </summary> public DateTime StartedAt { get; set; } /// <summary> /// A time value given in ISO8601 combined date and time format that represents when the action was completed. /// </summary> public DateTime? CompletedAt { get; set; } /// <summary> /// A unique identifier for the resource that the action is associated with. /// </summary> public int? ResourceId { get; set; } /// <summary> /// The type of resource that the action is associated with. /// </summary> public string ResourceType { get; set; } /// <summary> /// A slug representing the region where the action occurred. /// </summary> public string Region { get; set; } } }
mit
C#
7822dc83f8c7052f3ce74a2751698cdecc387140
Bump Tilemaps Sample Package
SirePi/duality,AdamsLair/duality,RockyTV/duality,Barsonax/duality,BraveSirAndrew/duality,YMRYMR/duality,mfep/duality
DualityPlugins/Tilemaps/Sample/CorePlugin.cs
DualityPlugins/Tilemaps/Sample/CorePlugin.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Duality; namespace Duality.Plugins.Tilemaps.Sample { public class TilemapsSampleCorePlugin : CorePlugin {} }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Duality; namespace Duality.Plugins.Tilemaps.Sample { public class TilemapsSampleCorePlugin : CorePlugin {} }
mit
C#
c5928450ba7e56a07f4b2e148de5e3fccb265dca
add test scenario
UNOPS/nofy
Nofy.EntityFrameworkCore.Tests/MagicTest.cs
Nofy.EntityFrameworkCore.Tests/MagicTest.cs
namespace Nofy.EntityFrameworkCore.Tests { using System.ComponentModel.DataAnnotations; using Nofy.Core; using Nofy.Core.Model; using Xunit; [Collection(nameof(DatabaseCollectionFixture))] public class MagicTest { public MagicTest(DatabaseFixture dbFixture) { this.repository = new NotificationRepository(dbFixture.CreateDataContext()); } private readonly INotificationRepository repository; [Fact] public void CreateNotification() { var service = new NotificationService(this.repository); var n = new Notification( "test", "entityType", "entityId", "role", "1", "test", null, new NotificationAction { ActionLink = "test", Label = "test" }); service.Publish(n); } [Fact] public void LoadData() { var service = new NotificationService(this.repository); var recepients = new[] { new NotificationRecipient("role", "1") }; var results = service.GetNotifications(recepients, 1, 10, true); Assert.NotEmpty(results.Results); } [Fact] public void Validate() { var service = new NotificationService(this.repository); Assert.Throws<ValidationException>(() => { var n = new Notification( "test", "HASIqStELYkMrXDzIkyhAH4ODJ5AIG1zNWvG3RoJLGB9SKnA9aaCwwanHvmd", "HASIqStELYkMrXDzIkyhAH4ODJ5AIG1zNWvG3RoJLGB9SKnA9aaCwwanHvmd", "role", "1", "test", null, new NotificationAction { ActionLink = "test", Label = "test" }); service.Publish(n); }); } } }
namespace Nofy.EntityFrameworkCore.Tests { using System.ComponentModel.DataAnnotations; using Nofy.Core; using Nofy.Core.Model; using Xunit; [Collection(nameof(DatabaseCollectionFixture))] public class MagicTest { public MagicTest(DatabaseFixture dbFixture) { this.repository = new NotificationRepository(dbFixture.CreateDataContext()); } private readonly INotificationRepository repository; [Fact] public void CreateNotification() { var service = new NotificationService(this.repository); var n = new Notification( "test", "entityType", "entityId", "role", "1", "test", null, new NotificationAction { ActionLink = "test", Label = "test" }); service.Publish(n); } [Fact] public void Validate() { var service = new NotificationService(this.repository); Assert.Throws<ValidationException>(() => { var n = new Notification( "test", "HASIqStELYkMrXDzIkyhAH4ODJ5AIG1zNWvG3RoJLGB9SKnA9aaCwwanHvmd", "HASIqStELYkMrXDzIkyhAH4ODJ5AIG1zNWvG3RoJLGB9SKnA9aaCwwanHvmd", "role", "1", "test", null, new NotificationAction { ActionLink = "test", Label = "test" }); service.Publish(n); }); } } }
mit
C#
cc1c95639691dfe89d381471e6b9690b75ef7c09
fix doubling namespaces in FindSymbolsHandler.FindAllSymbols()
x335/omnisharp-server,x335/omnisharp-server,corngood/omnisharp-server,syl20bnr/omnisharp-server,corngood/omnisharp-server,OmniSharp/omnisharp-server,syl20bnr/omnisharp-server
OmniSharp/FindSymbols/FindSymbolsHandler.cs
OmniSharp/FindSymbols/FindSymbolsHandler.cs
using System.Collections.Generic; using System.Linq; using ICSharpCode.NRefactory.TypeSystem; using OmniSharp.Common; using OmniSharp.Solution; namespace OmniSharp.FindSymbols { public class FindSymbolsHandler { private readonly ISolution _solution; public FindSymbolsHandler(ISolution solution) { _solution = solution; } /// <summary> /// Find all symbols that only exist within the solution source tree /// </summary> public QuickFixResponse FindAllSymbols() { IEnumerable<IUnresolvedMember> types = _solution.Projects.SelectMany( project => project.ProjectContent.GetAllTypeDefinitions().SelectMany(t => t.Members)); var quickfixes = types.Select(t => new QuickFix { Text = t.Name + "\t(in " + t.DeclaringTypeDefinition.FullTypeName + ")", FileName = t.UnresolvedFile.FileName, Column = t.Region.BeginColumn, Line = t.Region.BeginLine }); return new QuickFixResponse(quickfixes); } } }
using System.Collections.Generic; using System.Linq; using ICSharpCode.NRefactory.TypeSystem; using OmniSharp.Common; using OmniSharp.Solution; namespace OmniSharp.FindSymbols { public class FindSymbolsHandler { private readonly ISolution _solution; public FindSymbolsHandler(ISolution solution) { _solution = solution; } /// <summary> /// Find all symbols that only exist within the solution source tree /// </summary> public QuickFixResponse FindAllSymbols() { IEnumerable<IUnresolvedMember> types = _solution.Projects.SelectMany( project => project.ProjectContent.GetAllTypeDefinitions().SelectMany(t => t.Members)); var quickfixes = types.Select(t => new QuickFix { Text = t.Name + "\t(in " + t.Namespace + "." + t.DeclaringTypeDefinition.FullTypeName + ")", FileName = t.UnresolvedFile.FileName, Column = t.Region.BeginColumn, Line = t.Region.BeginLine }); return new QuickFixResponse(quickfixes); } } }
mit
C#
1b2b6618e5555f8dc88037a0e5bf1638b827021e
Update Xwt.WPF/Xwt.WPFBackend/ImageViewBackend.cs
residuum/xwt,mminns/xwt,sevoku/xwt,directhex/xwt,TheBrainTech/xwt,mminns/xwt,akrisiun/xwt,mono/xwt,cra0zy/xwt,lytico/xwt,antmicro/xwt,hwthomas/xwt,iainx/xwt,steffenWi/xwt,hamekoz/xwt
Xwt.WPF/Xwt.WPFBackend/ImageViewBackend.cs
Xwt.WPF/Xwt.WPFBackend/ImageViewBackend.cs
// // ImageViewBackend.cs // // Author: // Eric Maupin <ermau@xamarin.com> // // 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 System.Drawing; using System.Windows.Media; using Xwt.Backends; using Image = System.Windows.Controls.Image; namespace Xwt.WPFBackend { public class ImageViewBackend : WidgetBackend, IImageViewBackend { public ImageViewBackend() { Widget = new Image (); } public void SetImage (Xwt.Drawing.Image image) { ImageSource source = DataConverter.AsImageSource (Toolkit.GetBackend (image)); if (source == null) source = DataConverter.AsImageSource (Toolkit.GetBackend (image.ToBitmap ())); if (source == null) throw new ArgumentException ("nativeImage is not of the expected type", "image"); Image.Source = source; } protected Image Image { get { return (Image) NativeWidget; } } } }
// // ImageViewBackend.cs // // Author: // Eric Maupin <ermau@xamarin.com> // // 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 System.Drawing; using System.Windows.Media; using Xwt.Backends; using Image = System.Windows.Controls.Image; namespace Xwt.WPFBackend { public class ImageViewBackend : WidgetBackend, IImageViewBackend { public ImageViewBackend() { Widget = new Image (); } public void SetImage (Xwt.Drawing.Image image) { ImageSource source = DataConverter.AsImageSource (Toolkit.GetBackend (image)); if (source == null) source = DataConverter.AsImageSource (Toolkit.GetBackend (image.ToBitmap ())); if (source == null) throw new ArgumentException ("nativeImage is not of the expected type", "imgage"); Image.Source = source; } protected Image Image { get { return (Image) NativeWidget; } } } }
mit
C#
c5bc56ade78567347b7213efc0d8e4230cf8e62b
Update copyright notice
zpqrtbnk/Zbu.ModelsBuilder,zpqrtbnk/Zbu.ModelsBuilder,zpqrtbnk/Zbu.ModelsBuilder
Zbu.ModelsBuilder/Properties/CommonInfo.cs
Zbu.ModelsBuilder/Properties/CommonInfo.cs
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyProduct("ZpqrtBnk Umbraco ModelsBuilder")] [assembly: AssemblyCompany("Pilotine - ZpqrtBnk")] [assembly: AssemblyCopyright("Copyright © Pilotine - ZpqrtBnk 2013-2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] // versionning // nuget/semver: major.minor.patch [-xxx] // assembly: major.minor.patch.build // nuget sorts the -xxx alphabetically // nuget assembly // 1.8.0-alpha001 1.8.0.0 // 1.8.0-alpha002 1.8.0.1 // 1.8.0-alpha 1.8.0.2 // 1.8.0-beta001 1.8.0.3 // 1.8.0-beta002 1.8.0.4 // 1.8.0-beta 1.8.0.5 // 1.8.0 1.8.0.6 // Vsix // Also need to // Assembly [assembly: AssemblyVersion("2.1.2.42")] [assembly: AssemblyFileVersion("2.1.2.42")] // NuGet Package // Note: cannot release "1.8.0" because it depends on pre-release NuGet packages // so I have to use 1.8.0-final... [assembly: AssemblyInformationalVersion("2.1.2-final")] // Do not remove this line.
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyConfiguration("")] [assembly: AssemblyProduct("ZpqrtBnk Umbraco ModelsBuilder")] [assembly: AssemblyCompany("Pilotine - ZpqrtBnk")] [assembly: AssemblyCopyright("Copyright © Pilotine - ZpqrtBnk 2013-2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] // versionning // nuget/semver: major.minor.patch [-xxx] // assembly: major.minor.patch.build // nuget sorts the -xxx alphabetically // nuget assembly // 1.8.0-alpha001 1.8.0.0 // 1.8.0-alpha002 1.8.0.1 // 1.8.0-alpha 1.8.0.2 // 1.8.0-beta001 1.8.0.3 // 1.8.0-beta002 1.8.0.4 // 1.8.0-beta 1.8.0.5 // 1.8.0 1.8.0.6 // Vsix // Also need to // Assembly [assembly: AssemblyVersion("2.1.2.42")] [assembly: AssemblyFileVersion("2.1.2.42")] // NuGet Package // Note: cannot release "1.8.0" because it depends on pre-release NuGet packages // so I have to use 1.8.0-final... [assembly: AssemblyInformationalVersion("2.1.2-final")] // Do not remove this line.
mit
C#
c3229827342ee9d80165e17bd0750f5a49cf557f
Add planet arriving effect
aornelas/Tiny-Planets,aornelas/Tiny-Planets
Assets/Scripts/GameController.cs
Assets/Scripts/GameController.cs
using UnityEngine; using System.Collections; public class GameController : MonoBehaviour { public GameObject currentPlanet; private int collectiblesNeeded = 3; private PlanetController planetController; private int collectedCount; private bool portalOpened; private bool teleporting; private bool arriving; private Vector3 planetTarget; private bool invokedSwapPlanet; private GravityAttractor gravityAttractor; private float teleportSpeed = 2.5f; void Start() { ResetPlanet(); gravityAttractor = gameObject.GetComponentsInChildren<GravityAttractor>()[0]; } void Update() { if (collectedCount >= collectiblesNeeded && !portalOpened) { Invoke("OpenPortal", 0.25f); portalOpened = true; } if (teleporting) { currentPlanet.transform.Translate(new Vector3(-50, -50, -50) * teleportSpeed * Time.deltaTime); if (!invokedSwapPlanet) { Invoke("SwapPlanet", 1.0f); invokedSwapPlanet = true; } } if (arriving) { currentPlanet.transform.position = Vector3.MoveTowards(currentPlanet.transform.position, planetTarget, teleportSpeed * 35 * Time.deltaTime); if (currentPlanet.transform.position == planetTarget) { arriving = false; } } } public void PickUpCollectible(GameObject collectible) { collectible.GetComponent<CollectibleController>().PickUp(); collectedCount++; } public void TeleportToNextPlanet() { teleporting = true; FlipGravity(); gameObject.transform.FindChild("Planets").GetComponent<AudioSource>().Play(); Invoke("FlipGravity", 0.5f); } private void SwapPlanet() { teleporting = false; planetController.NextPlanet(); currentPlanet = planetController.nextPlanet; planetTarget = currentPlanet.transform.position; currentPlanet.transform.Translate(new Vector3(10, 10, 10)); arriving = true; ResetPlanet(); } private void ResetPlanet() { collectedCount = 0; portalOpened = false; invokedSwapPlanet = false; planetController = currentPlanet.GetComponent<PlanetController>(); } private void FlipGravity() { gravityAttractor.gravity = gravityAttractor.gravity * -1; } private void OpenPortal() { planetController.portal.SetActive(true); GetComponent<AudioSource>().Play(); } }
using UnityEngine; using System.Collections; public class GameController : MonoBehaviour { public GameObject currentPlanet; private int collectiblesNeeded = 3; private PlanetController planetController; private int collectedCount; private bool portalOpened; private bool teleporting; private bool invokedSwapPlanet; private GravityAttractor gravityAttractor; private float teleportSpeed = 2.5f; void Start() { ResetPlanet(); gravityAttractor = gameObject.GetComponentsInChildren<GravityAttractor>()[0]; } void Update() { if (collectedCount >= collectiblesNeeded && !portalOpened) { Invoke("OpenPortal", 0.25f); portalOpened = true; } if (teleporting) { currentPlanet.transform.Translate(new Vector3(-50, -50, -50) * teleportSpeed * Time.deltaTime); if (!invokedSwapPlanet) { Invoke("SwapPlanet", 1.0f); invokedSwapPlanet = true; } } } public void PickUpCollectible(GameObject collectible) { collectible.GetComponent<CollectibleController>().PickUp(); collectedCount++; } public void TeleportToNextPlanet() { teleporting = true; FlipGravity(); gameObject.transform.FindChild("Planets").GetComponent<AudioSource>().Play(); Invoke("FlipGravity", 0.5f); } private void SwapPlanet() { teleporting = false; planetController.NextPlanet(); currentPlanet = planetController.nextPlanet; ResetPlanet(); } private void ResetPlanet() { collectedCount = 0; portalOpened = false; invokedSwapPlanet = false; planetController = currentPlanet.GetComponent<PlanetController>(); } private void FlipGravity() { gravityAttractor.gravity = gravityAttractor.gravity * -1; } private void OpenPortal() { planetController.portal.SetActive(true); GetComponent<AudioSource>().Play(); } }
mit
C#
34bdd2f83e8fe03c519e7af5d251818195a4ee8d
Fix unit test
pdelvo/Pdelvo.Minecraft
Pdelvo.Minecraft.Protocol/Packets/PlayerListPing.cs
Pdelvo.Minecraft.Protocol/Packets/PlayerListPing.cs
using Pdelvo.Minecraft.Network; using System; namespace Pdelvo.Minecraft.Protocol.Packets { /// <summary> /// /// </summary> /// <remarks></remarks> [PacketUsage(PacketUsage.ClientToServer)] public class PlayerListPing : Packet { public byte MagicByte { get; set; } /// <summary> /// Initializes a new instance of the <see cref="PlayerListPing"/> class. /// </summary> /// <remarks></remarks> public PlayerListPing() { Code = 0xFE; MagicByte = 1; } /// <summary> /// Receives the specified reader. /// </summary> /// <param name="reader">The reader.</param> /// <param name="version">The version.</param> /// <remarks></remarks> protected override void OnReceive(BigEndianStream reader, int version) { if (reader == null) throw new System.ArgumentNullException("reader"); try { try { reader.ReadTimeout = 1; } catch (InvalidOperationException) { } MagicByte = reader.ReadByte(); } catch (Exception) { MagicByte = 0; } } /// <summary> /// Sends the specified writer. /// </summary> /// <param name="writer">The writer.</param> /// <param name="version">The version.</param> /// <remarks></remarks> protected override void OnSend(BigEndianStream writer, int version) { if (writer == null) throw new System.ArgumentNullException("writer"); writer.Write(Code); if (version >= 47) writer.Write(MagicByte); } } }
using Pdelvo.Minecraft.Network; using System; namespace Pdelvo.Minecraft.Protocol.Packets { /// <summary> /// /// </summary> /// <remarks></remarks> [PacketUsage(PacketUsage.ClientToServer)] public class PlayerListPing : Packet { public byte MagicByte { get; set; } /// <summary> /// Initializes a new instance of the <see cref="PlayerListPing"/> class. /// </summary> /// <remarks></remarks> public PlayerListPing() { Code = 0xFE; MagicByte = 1; } /// <summary> /// Receives the specified reader. /// </summary> /// <param name="reader">The reader.</param> /// <param name="version">The version.</param> /// <remarks></remarks> protected override void OnReceive(BigEndianStream reader, int version) { if (reader == null) throw new System.ArgumentNullException("reader"); try { reader.ReadTimeout = 1; MagicByte = reader.ReadByte(); } catch (Exception) { MagicByte = 0; } } /// <summary> /// Sends the specified writer. /// </summary> /// <param name="writer">The writer.</param> /// <param name="version">The version.</param> /// <remarks></remarks> protected override void OnSend(BigEndianStream writer, int version) { if (writer == null) throw new System.ArgumentNullException("writer"); writer.Write(Code); if (version >= 47) writer.Write(MagicByte); } } }
mit
C#
892d61a2837590723e2d1a2d97c72a19e825eb43
Fix HelixToolkitException
jotschgl/helix-toolkit,JeremyAnsel/helix-toolkit,Iluvatar82/helix-toolkit,holance/helix-toolkit,helix-toolkit/helix-toolkit,chrkon/helix-toolkit,smischke/helix-toolkit
Source/HelixToolkit.Shared/HelixToolkitException.cs
Source/HelixToolkit.Shared/HelixToolkitException.cs
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="HelixToolkitException.cs" company="Helix Toolkit"> // Copyright (c) 2014 Helix Toolkit contributors // </copyright> // <summary> // Represents errors that occurs in the Helix 3D Toolkit. // </summary> // -------------------------------------------------------------------------------------------------------------------- namespace HelixToolkit.Wpf { using System; /// <summary> /// Represents errors that occurs in the Helix 3D Toolkit. /// </summary> #if !NETFX_CORE [Serializable] #endif public class HelixToolkitException : Exception { /// <summary> /// Initializes a new instance of the <see cref="HelixToolkitException"/> class. /// </summary> /// <param name="formatString"> /// The format string. /// </param> /// <param name="args"> /// The args. /// </param> public HelixToolkitException(string formatString, params object[] args) : base(string.Format(formatString, args)) { } } }
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="HelixToolkitException.cs" company="Helix Toolkit"> // Copyright (c) 2014 Helix Toolkit contributors // </copyright> // <summary> // Represents errors that occurs in the Helix 3D Toolkit. // </summary> // -------------------------------------------------------------------------------------------------------------------- namespace HelixToolkit.Wpf { using System; /// <summary> /// Represents errors that occurs in the Helix 3D Toolkit. /// </summary> [Serializable] public class HelixToolkitException : Exception { /// <summary> /// Initializes a new instance of the <see cref="HelixToolkitException"/> class. /// </summary> /// <param name="formatString"> /// The format string. /// </param> /// <param name="args"> /// The args. /// </param> public HelixToolkitException(string formatString, params object[] args) : base(string.Format(formatString, args)) { } } }
mit
C#
d1fb324a68eadc921c3a78b7156a0e2dd90bc17d
Check that blob container exists, if not create it
projecteon/thecollection,projecteon/thecollection,projecteon/thecollection,projecteon/thecollection
TheCollection.Web/Services/ImageAzureBlobService.cs
TheCollection.Web/Services/ImageAzureBlobService.cs
using Microsoft.WindowsAzure.Storage; using System; using System.Drawing; using System.IO; using System.Threading.Tasks; using Microsoft.WindowsAzure.Storage.Blob; namespace TheCollection.Web.Services { // https://blogs.msdn.microsoft.com/premier_developer/2017/03/14/building-a-simple-photo-album-using-azure-blob-storage-with-net-core/ // https://docs.microsoft.com/en-us/azure/storage/storage-samples-dotnet // https://docs.microsoft.com/en-us/azure/storage/storage-use-emulator // https://www.janaks.com.np/file-upload-asp-net-core-web-api/ // http://stackoverflow.com/questions/41421280/serving-images-from-azure-blob-storage-in-dot-net-core // http://dotnetthoughts.net/working-with-azure-blob-storage-in-aspnet-core/ // http://www.dotnetcurry.com/visualstudio/1328/visual-studio-connected-services-aspnet-core-azure-storage public class ImageAzureBlobService : IImageService { public CloudBlobContainer Container { get; } public ImageAzureBlobService(string connectionString) { var storageAccount = CloudStorageAccount.Parse(connectionString); var blobClient = storageAccount.CreateCloudBlobClient(); Container = blobClient.GetContainerReference("images"); CreateContainerIfNotExistsAsync().Wait(); } public Task Delete(string path) { throw new NotImplementedException(); } public Task<Bitmap> Get(string filename) { var blockBlob = Container.GetBlockBlobReference(filename); return Task.Run(() => { return new Bitmap(blockBlob.Uri.AbsoluteUri); }); } public async Task<string> Upload(Stream stream, string filename) { var blockBlob = Container.GetBlockBlobReference(filename); await blockBlob.UploadFromStreamAsync(stream); return blockBlob?.Uri.ToString(); } private async Task CreateContainerIfNotExistsAsync() { await Container.CreateIfNotExistsAsync(); } } }
using Microsoft.WindowsAzure.Storage; using System; using System.Drawing; using System.IO; using System.Threading.Tasks; namespace TheCollection.Web.Services { // https://blogs.msdn.microsoft.com/premier_developer/2017/03/14/building-a-simple-photo-album-using-azure-blob-storage-with-net-core/ // https://docs.microsoft.com/en-us/azure/storage/storage-samples-dotnet // https://docs.microsoft.com/en-us/azure/storage/storage-use-emulator // https://www.janaks.com.np/file-upload-asp-net-core-web-api/ // http://stackoverflow.com/questions/41421280/serving-images-from-azure-blob-storage-in-dot-net-core // http://dotnetthoughts.net/working-with-azure-blob-storage-in-aspnet-core/ // http://www.dotnetcurry.com/visualstudio/1328/visual-studio-connected-services-aspnet-core-azure-storage public class ImageAzureBlobService : IImageService { string connectionString { get; } public ImageAzureBlobService(string connectionString) { this.connectionString = connectionString; } public Task Delete(string path) { throw new NotImplementedException(); } public Task<Bitmap> Get(string filename) { var storageAccount = CloudStorageAccount.Parse(connectionString); var blobClient = storageAccount.CreateCloudBlobClient(); var container = blobClient.GetContainerReference("images"); var blockBlob = container.GetBlockBlobReference(filename); return Task.Run(() => { return new Bitmap(blockBlob.Uri.AbsoluteUri); }); } public async Task<string> Upload(Stream stream, string filename) { var storageAccount = CloudStorageAccount.Parse(connectionString); var blobClient = storageAccount.CreateCloudBlobClient(); var container = blobClient.GetContainerReference("images"); var blockBlob = container.GetBlockBlobReference(filename); await blockBlob.UploadFromStreamAsync(stream); return blockBlob?.Uri.ToString(); } } }
apache-2.0
C#
86f674d09e7af065690e22de0df61396f8692de9
Remove the UpdateAll implementation of TriggerAction and add DeleteTableObject method
Dav2070/UniversalSoundBoard
UniversalSoundBoard/Common/TriggerAction.cs
UniversalSoundBoard/Common/TriggerAction.cs
using davClassLibrary.Common; using davClassLibrary.Models; using UniversalSoundBoard; using UniversalSoundBoard.DataAccess; using Windows.ApplicationModel.Core; using Windows.UI.Core; namespace UniversalSoundboard.Common { public class TriggerAction : ITriggerAction { public void UpdateAllOfTable(int tableId) { UpdateView(tableId, false); } public void UpdateTableObject(TableObject tableObject, bool fileDownloaded) { UpdateView(tableObject.TableId, fileDownloaded); } public void DeleteTableObject(TableObject tableObject) { UpdateView(tableObject.TableId, false); } private void UpdateView(int tableId, bool fileDownloaded) { if (tableId == FileManager.ImageFileTableId || (tableId == FileManager.SoundFileTableId && !fileDownloaded) || tableId == FileManager.SoundTableId) { // Update the sounds CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { (App.Current as App)._itemViewHolder.AllSoundsChanged = true; FileManager.UpdateGridView(); }); } else if (tableId == FileManager.CategoryTableId) { // Update the categories CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { FileManager.CreateCategoriesList(); (App.Current as App)._itemViewHolder.AllSoundsChanged = true; }); } else if (tableId == FileManager.PlayingSoundTableId) { // Update the playing sounds CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { FileManager.CreatePlayingSoundsList(); }); } } } }
using davClassLibrary.Common; using UniversalSoundBoard; using UniversalSoundBoard.DataAccess; using Windows.ApplicationModel.Core; using Windows.UI.Core; namespace UniversalSoundboard.Common { public class TriggerAction : ITriggerAction { public void UpdateAll() { } public void UpdateAllOfTable(int tableId) { UpdateView(tableId, false); } public void UpdateTableObject(davClassLibrary.Models.TableObject tableObject, bool fileDownloaded) { UpdateView(tableObject.TableId, fileDownloaded); } private void UpdateView(int tableId, bool fileDownloaded) { if (tableId == FileManager.ImageFileTableId || (tableId == FileManager.SoundFileTableId && !fileDownloaded) || tableId == FileManager.SoundTableId) { // Update the sounds CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { (App.Current as App)._itemViewHolder.AllSoundsChanged = true; FileManager.UpdateGridView(); }); } else if (tableId == FileManager.CategoryTableId) { // Update the categories CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { FileManager.CreateCategoriesList(); (App.Current as App)._itemViewHolder.AllSoundsChanged = true; }); } else if (tableId == FileManager.PlayingSoundTableId) { // Update the playing sounds CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { FileManager.CreatePlayingSoundsList(); }); } } } }
mit
C#
82dd3048c826cd92cb129bcb362edd6937430951
change link from aspnet5 to aspnet core
mperdeck/jsnlog.AspNet5Demo,mperdeck/jsnlog.AspNet5Demo
WebSite/src/WebSite/Views/Home/Index.cshtml
WebSite/src/WebSite/Views/Home/Index.cshtml
<h1>ASP.NET CORE demo for JSNLog</h1> <ul> <li> Your log message will appear in the debug window, so run this site in the debugger (F5). </li> <li> To create a log message, click the button below. </li> <li> The click handler is in js/site.js. It uses JSNLog to create the log message and send it to the server. </li> <li> <a href="http://jsnlog.com/Documentation/DownloadInstall/ForAspNetCore">Install JSNLog in your own ASP.NET CORE application</a>. </li> </ul> <p> Your log message: <input type="text" id="log-message" /> </p> <button onclick="onClick()">Log message to server</button> <script src="~/js/site.js"></script> <script src="~/lib/jsnlog/jsnlog.min.js"></script>
<h1>ASP.NET CORE demo for JSNLog</h1> <ul> <li> Your log message will appear in the debug window, so run this site in the debugger (F5). </li> <li> To create a log message, click the button below. </li> <li> The click handler is in js/site.js. It uses JSNLog to create the log message and send it to the server. </li> <li> <a href="http://jsnlog.com/Documentation/DownloadInstall/ForAspNet5">Install JSNLog in your own ASP.NET CORE application</a>. </li> </ul> <p> Your log message: <input type="text" id="log-message" /> </p> <button onclick="onClick()">Log message to server</button> <script src="~/js/site.js"></script> <script src="~/lib/jsnlog/jsnlog.min.js"></script>
mit
C#
196b086ddcc8d89a4340921af040f5f2a5b6f94f
Refactor Outcome.cs as flag
Ackara/Daterpillar
src/Daterpillar.Core/Management/Outcome.cs
src/Daterpillar.Core/Management/Outcome.cs
using System; namespace Gigobyte.Daterpillar.Management { [Flags] public enum Outcome { Equal = 2, NotEqual = 4, SourceEmpty = 8, TargetEmpty = 16 } }
using System; namespace Gigobyte.Daterpillar.Management { public enum Outcome { Equal, NotEqual, SourceEmpty, TargetEmpty } }
mit
C#
cdab80877851a5ab03b36ca4452a358404a5b9f7
Change to allow params array for setting queue behaviors
FoundatioFx/Foundatio,exceptionless/Foundatio
src/Foundatio/Queues/SharedQueueOptions.cs
src/Foundatio/Queues/SharedQueueOptions.cs
using System; using System.Collections.Generic; using System.Linq; namespace Foundatio.Queues { public class SharedQueueOptions<T> : SharedOptions where T : class { public string Name { get; set; } = typeof(T).Name; public int Retries { get; set; } = 2; public TimeSpan WorkItemTimeout { get; set; } = TimeSpan.FromMinutes(5); public ICollection<IQueueBehavior<T>> Behaviors { get; set; } = new List<IQueueBehavior<T>>(); } public class SharedQueueOptionsBuilder<T, TOptions, TBuilder> : SharedOptionsBuilder<TOptions, TBuilder> where T : class where TOptions : SharedQueueOptions<T>, new() where TBuilder : SharedQueueOptionsBuilder<T, TOptions, TBuilder> { public TBuilder Name(string name) { Target.Name = name; return (TBuilder)this; } public TBuilder Retries(int retries) { Target.Retries = retries; return (TBuilder)this; } public TBuilder WorkItemTimeout(TimeSpan timeout) { Target.WorkItemTimeout = timeout; return (TBuilder)this; } public TBuilder Behaviors(params IQueueBehavior<T>[] behaviors) { Target.Behaviors = behaviors; return (TBuilder)this; } public TBuilder AddBehavior(IQueueBehavior<T> behavior) { if (behavior == null) throw new ArgumentNullException(nameof(behavior)); if (Target.Behaviors == null) Target.Behaviors = new List<IQueueBehavior<T>> (); Target.Behaviors.Add(behavior); return (TBuilder)this; } } }
using System; using System.Collections.Generic; using System.Linq; namespace Foundatio.Queues { public class SharedQueueOptions<T> : SharedOptions where T : class { public string Name { get; set; } = typeof(T).Name; public int Retries { get; set; } = 2; public TimeSpan WorkItemTimeout { get; set; } = TimeSpan.FromMinutes(5); public ICollection<IQueueBehavior<T>> Behaviors { get; set; } = new List<IQueueBehavior<T>>(); } public class SharedQueueOptionsBuilder<T, TOptions, TBuilder> : SharedOptionsBuilder<TOptions, TBuilder> where T : class where TOptions : SharedQueueOptions<T>, new() where TBuilder : SharedQueueOptionsBuilder<T, TOptions, TBuilder> { public TBuilder Name(string name) { Target.Name = name; return (TBuilder)this; } public TBuilder Retries(int retries) { Target.Retries = retries; return (TBuilder)this; } public TBuilder WorkItemTimeout(TimeSpan timeout) { Target.WorkItemTimeout = timeout; return (TBuilder)this; } public TBuilder Behaviors(ICollection<IQueueBehavior<T>> behaviors) { Target.Behaviors = behaviors; return (TBuilder)this; } public TBuilder AddBehavior(IQueueBehavior<T> behavior) { if (behavior == null) throw new ArgumentNullException(nameof(behavior)); if (Target.Behaviors == null) Target.Behaviors = new List<IQueueBehavior<T>> (); Target.Behaviors.Add(behavior); return (TBuilder)this; } } }
apache-2.0
C#
b8e8c161f554f1d464465d944ea7472b87e31388
Remove Result from Example again
picklesdoc/pickles,irfanah/pickles,ludwigjossieaux/pickles,blorgbeard/pickles,dirkrombauts/pickles,magicmonty/pickles,picklesdoc/pickles,magicmonty/pickles,irfanah/pickles,magicmonty/pickles,blorgbeard/pickles,ludwigjossieaux/pickles,blorgbeard/pickles,picklesdoc/pickles,ludwigjossieaux/pickles,dirkrombauts/pickles,dirkrombauts/pickles,dirkrombauts/pickles,blorgbeard/pickles,magicmonty/pickles,picklesdoc/pickles,irfanah/pickles,irfanah/pickles
src/Pickles/Pickles/ObjectModel/Example.cs
src/Pickles/Pickles/ObjectModel/Example.cs
#region License /* Copyright [2011] [Jeffrey Cameron] 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; namespace PicklesDoc.Pickles.ObjectModel { public class Example { public string Name { get; set; } public string Description { get; set; } public Table TableArgument { get; set; } } }
#region License /* Copyright [2011] [Jeffrey Cameron] 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; using PicklesDoc.Pickles.TestFrameworks; namespace PicklesDoc.Pickles.ObjectModel { public class Example { public string Name { get; set; } public string Description { get; set; } public Table TableArgument { get; set; } public TestResult Result { get; set; } } }
apache-2.0
C#
8783c703d8cbdf19d9b98b58b0d51f53512b0df4
Add a detailed comment to explain why we test this
richardlawley/stripe.net,stripe/stripe-dotnet
src/Stripe.Tests.XUnit/coupons/_fixture.cs
src/Stripe.Tests.XUnit/coupons/_fixture.cs
using System; using System.Collections.Generic; namespace Stripe.Tests.Xunit { public class coupons_fixture : IDisposable { public StripeCouponCreateOptions CouponCreateOptions { get; set; } public StripeCouponUpdateOptions CouponUpdateOptions { get; set; } public StripeCoupon Coupon { get; set; } public StripeCoupon CouponRetrieved { get; set; } public StripeCoupon CouponUpdated { get; set; } public StripeDeleted CouponDeleted { get; set; } public StripeList<StripeCoupon> CouponsList { get; } public coupons_fixture() { CouponCreateOptions = new StripeCouponCreateOptions() { // Add a space at the end to ensure the ID is properly URL encoded // when passed in the URL for other methods Id = "test-coupon-" + Guid.NewGuid().ToString() + " ", PercentOff = 25, Duration = "repeating", DurationInMonths = 3, }; CouponUpdateOptions = new StripeCouponUpdateOptions { Metadata = new Dictionary<string, string>{{"key_1", "value_1"}} }; var service = new StripeCouponService(Cache.ApiKey); Coupon = service.Create(CouponCreateOptions); CouponRetrieved = service.Get(Coupon.Id); CouponUpdated = service.Update(Coupon.Id, CouponUpdateOptions); CouponsList = service.List(); CouponDeleted = service.Delete(Coupon.Id); } public void Dispose() { } } }
using System; using System.Collections.Generic; namespace Stripe.Tests.Xunit { public class coupons_fixture : IDisposable { public StripeCouponCreateOptions CouponCreateOptions { get; set; } public StripeCouponUpdateOptions CouponUpdateOptions { get; set; } public StripeCoupon Coupon { get; set; } public StripeCoupon CouponRetrieved { get; set; } public StripeCoupon CouponUpdated { get; set; } public StripeDeleted CouponDeleted { get; set; } public StripeList<StripeCoupon> CouponsList { get; } public coupons_fixture() { CouponCreateOptions = new StripeCouponCreateOptions() { Id = "test-coupon-" + Guid.NewGuid().ToString() + " ", PercentOff = 25, Duration = "repeating", DurationInMonths = 3, }; CouponUpdateOptions = new StripeCouponUpdateOptions { Metadata = new Dictionary<string, string>{{"key_1", "value_1"}} }; var service = new StripeCouponService(Cache.ApiKey); Coupon = service.Create(CouponCreateOptions); CouponRetrieved = service.Get(Coupon.Id); CouponUpdated = service.Update(Coupon.Id, CouponUpdateOptions); CouponsList = service.List(); CouponDeleted = service.Delete(Coupon.Id); } public void Dispose() { } } }
apache-2.0
C#
e35059265c5529410f2ac3ab40ec4dea10a5e33a
Apply improved formatting.
Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW
src/NadekoBot/Services/IBotCredentials.cs
src/NadekoBot/Services/IBotCredentials.cs
using System.Collections.Immutable; using Discord; using Mitternacht.Common; namespace Mitternacht.Services { public interface IBotCredentials { ulong ClientId { get; } string Token { get; } ImmutableArray<ulong> OwnerIds { get; } DbConfig Db { get; } string GoogleApiKey { get; } string MashapeKey { get; } string LoLApiKey { get; } string OsuApiKey { get; } string CleverbotApiKey { get; } string CarbonKey { get; } string PatreonCampaignId { get; } string PatreonAccessToken { get; } int TotalShards { get; } string ShardRunCommand { get; } string ShardRunArguments { get; } string ForumUsername { get; } string ForumPassword { get; } bool IsOwner(IUser u); } }
using System.Collections.Immutable; using Discord; using Mitternacht.Common; namespace Mitternacht.Services { public interface IBotCredentials { ulong ClientId { get; } string Token { get; } string GoogleApiKey { get; } ImmutableArray<ulong> OwnerIds { get; } string MashapeKey { get; } string LoLApiKey { get; } string PatreonAccessToken { get; } string CarbonKey { get; } DbConfig Db { get; } string OsuApiKey { get; } bool IsOwner(IUser u); int TotalShards { get; } string ShardRunCommand { get; } string ShardRunArguments { get; } string PatreonCampaignId { get; } string CleverbotApiKey { get; } string ForumUsername { get; } string ForumPassword { get; } } }
mit
C#
4c8df5c1de7da17934ff20bc9ed574a6e7bcf10e
Enable nullable: System.Management.Automation.Tracing.IEtwActivityReverter (#14154)
PaulHigin/PowerShell,TravisEz13/PowerShell,daxian-dbw/PowerShell,JamesWTruher/PowerShell-1,JamesWTruher/PowerShell-1,daxian-dbw/PowerShell,PaulHigin/PowerShell,JamesWTruher/PowerShell-1,TravisEz13/PowerShell,PaulHigin/PowerShell,TravisEz13/PowerShell,JamesWTruher/PowerShell-1,daxian-dbw/PowerShell,PaulHigin/PowerShell,daxian-dbw/PowerShell,TravisEz13/PowerShell
src/System.Management.Automation/utils/tracing/EtwActivityReverter.cs
src/System.Management.Automation/utils/tracing/EtwActivityReverter.cs
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. #nullable enable #if !UNIX namespace System.Management.Automation.Tracing { using System; /// <summary> /// An object that can be used to revert the ETW activity ID of the current thread /// to its original value. /// </summary> [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Etw")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Reverter")] public interface IEtwActivityReverter : IDisposable { /// <summary> /// Reverts the ETW activity ID of the current thread to its original value. /// </summary> /// <remarks> /// <para>Calling <see cref="IDisposable.Dispose"/> has the same effect as /// calling this method and is useful in the C# "using" syntax.</para> /// </remarks> void RevertCurrentActivityId(); } internal class EtwActivityReverter : IEtwActivityReverter { private readonly IEtwEventCorrelator _correlator; private readonly Guid _oldActivityId; private bool _isDisposed; public EtwActivityReverter(IEtwEventCorrelator correlator, Guid oldActivityId) { _correlator = correlator; _oldActivityId = oldActivityId; } public void RevertCurrentActivityId() { Dispose(); } public void Dispose() { if (!_isDisposed) { _correlator.CurrentActivityId = _oldActivityId; _isDisposed = true; GC.SuppressFinalize(this); } } } } #endif
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. #if !UNIX namespace System.Management.Automation.Tracing { using System; /// <summary> /// An object that can be used to revert the ETW activity ID of the current thread /// to its original value. /// </summary> [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Etw")] [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Reverter")] public interface IEtwActivityReverter : IDisposable { /// <summary> /// Reverts the ETW activity ID of the current thread to its original value. /// </summary> /// <remarks> /// <para>Calling <see cref="IDisposable.Dispose"/> has the same effect as /// calling this method and is useful in the C# "using" syntax.</para> /// </remarks> void RevertCurrentActivityId(); } internal class EtwActivityReverter : IEtwActivityReverter { private readonly IEtwEventCorrelator _correlator; private readonly Guid _oldActivityId; private bool _isDisposed; public EtwActivityReverter(IEtwEventCorrelator correlator, Guid oldActivityId) { _correlator = correlator; _oldActivityId = oldActivityId; } public void RevertCurrentActivityId() { Dispose(); } public void Dispose() { if (!_isDisposed) { _correlator.CurrentActivityId = _oldActivityId; _isDisposed = true; GC.SuppressFinalize(this); } } } } #endif
mit
C#
c00e6e29a6f2c32da0ae882f98344afb94770812
Remove `static` usage
NeoAdonis/osu,ppy/osu,smoogipoo/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu-new,ppy/osu,UselessToucan/osu,peppy/osu,UselessToucan/osu,peppy/osu,smoogipooo/osu,NeoAdonis/osu,ppy/osu,smoogipoo/osu,peppy/osu,UselessToucan/osu
osu.Game.Rulesets.Taiko/Edit/Blueprints/HitPlacementBlueprint.cs
osu.Game.Rulesets.Taiko/Edit/Blueprints/HitPlacementBlueprint.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Input.Events; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Rulesets.Taiko.UI; using osuTK; using osuTK.Input; namespace osu.Game.Rulesets.Taiko.Edit.Blueprints { public class HitPlacementBlueprint : PlacementBlueprint { private readonly HitPiece piece; public new Hit HitObject => (Hit)base.HitObject; public HitPlacementBlueprint() : base(new Hit()) { InternalChild = piece = new HitPiece { Size = new Vector2(TaikoHitObject.DEFAULT_SIZE * TaikoPlayfield.DEFAULT_HEIGHT) }; } protected override bool OnMouseDown(MouseDownEvent e) { switch (e.Button) { case MouseButton.Left: HitObject.Type = HitType.Centre; EndPlacement(true); return true; case MouseButton.Right: HitObject.Type = HitType.Rim; EndPlacement(true); return true; } return false; } public override void UpdateTimeAndPosition(SnapResult result) { piece.Position = ToLocalSpace(result.ScreenSpacePosition); base.UpdateTimeAndPosition(result); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Framework.Input.Events; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Rulesets.Taiko.UI; using osuTK; using osuTK.Input; namespace osu.Game.Rulesets.Taiko.Edit.Blueprints { public class HitPlacementBlueprint : PlacementBlueprint { private readonly HitPiece piece; private static Hit hit; public HitPlacementBlueprint() : base(hit = new Hit()) { InternalChild = piece = new HitPiece { Size = new Vector2(TaikoHitObject.DEFAULT_SIZE * TaikoPlayfield.DEFAULT_HEIGHT) }; } protected override bool OnMouseDown(MouseDownEvent e) { switch (e.Button) { case MouseButton.Left: hit.Type = HitType.Centre; EndPlacement(true); return true; case MouseButton.Right: hit.Type = HitType.Rim; EndPlacement(true); return true; } return false; } public override void UpdateTimeAndPosition(SnapResult result) { piece.Position = ToLocalSpace(result.ScreenSpacePosition); base.UpdateTimeAndPosition(result); } } }
mit
C#
861323c4838adf46ee5f95ab78837721ff7e2343
Fix particle plugin.
RichardRanft/Torque6,andr3wmac/Torque6,RichardRanft/Torque6,lukaspj/Torque6,ktotheoz/Torque6,lukaspj/Torque6,andr3wmac/Torque6,lukaspj/Torque6,ktotheoz/Torque6,ktotheoz/Torque6,ktotheoz/Torque6,lukaspj/Torque6,RichardRanft/Torque6,RichardRanft/Torque6,JeffProgrammer/Torque6,JeffProgrammer/Torque6,ktotheoz/Torque6,lukaspj/Torque6,andr3wmac/Torque6,ktotheoz/Torque6,andr3wmac/Torque6,JeffProgrammer/Torque6,lukaspj/Torque6,JeffProgrammer/Torque6,ktotheoz/Torque6,JeffProgrammer/Torque6,lukaspj/Torque6,RichardRanft/Torque6,andr3wmac/Torque6,JeffProgrammer/Torque6,RichardRanft/Torque6,RichardRanft/Torque6,JeffProgrammer/Torque6,andr3wmac/Torque6,lukaspj/Torque6,andr3wmac/Torque6,RichardRanft/Torque6,JeffProgrammer/Torque6,ktotheoz/Torque6,ktotheoz/Torque6,andr3wmac/Torque6
projects/shared-modules/Particles/1/main.cs
projects/shared-modules/Particles/1/main.cs
function Particles::create(%this) { Plugins::load("./Particles"); } function Particles::destroy( %this ) { // }
function Particles::create(%this) { Plugins::load("./Particles.dll"); } function Particles::destroy( %this ) { // }
mit
C#
2bee275d8439f4da0ec5d839bd7c70255d42d207
fix disco doc custom entry serialization
siyo-wang/IdentityServer4,IdentityServer/IdentityServer4,MienDev/IdentityServer4,MienDev/IdentityServer4,chrisowhite/IdentityServer4,jbijlsma/IdentityServer4,jbijlsma/IdentityServer4,MienDev/IdentityServer4,siyo-wang/IdentityServer4,MienDev/IdentityServer4,jbijlsma/IdentityServer4,chrisowhite/IdentityServer4,IdentityServer/IdentityServer4,siyo-wang/IdentityServer4,IdentityServer/IdentityServer4,chrisowhite/IdentityServer4,IdentityServer/IdentityServer4,jbijlsma/IdentityServer4
src/IdentityServer4/Endpoints/Results/DiscoveryDocumentResult.cs
src/IdentityServer4/Endpoints/Results/DiscoveryDocumentResult.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 IdentityServer4.Hosting; using IdentityServer4.Models; using Microsoft.AspNet.Http; using Microsoft.AspNetCore.Http; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Threading.Tasks; namespace IdentityServer4.Endpoints.Results { public class DiscoveryDocumentResult : IEndpointResult { public DiscoveryDocument Document { get; private set; } public Dictionary<string, object> CustomEntries { get; private set; } public DiscoveryDocumentResult(DiscoveryDocument document, Dictionary<string, object> customEntries) { Document = document; CustomEntries = customEntries; } public Task ExecuteAsync(HttpContext context) { if (CustomEntries != null && CustomEntries.Any()) { var jobject = JObject.FromObject(Document); foreach (var item in CustomEntries) { JToken token; if (jobject.TryGetValue(item.Key, out token)) { throw new Exception("Item does already exist - cannot add it via a custom entry: " + item.Key); } if (item.Value.GetType().GetTypeInfo().IsClass) { jobject.Add(new JProperty(item.Key, JToken.FromObject(item.Value))); } else { jobject.Add(new JProperty(item.Key, item.Value)); } } return context.Response.WriteJsonAsync(jobject); } return context.Response.WriteJsonAsync(Document); } } }
// 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 IdentityServer4.Hosting; using IdentityServer4.Models; using Microsoft.AspNet.Http; using Microsoft.AspNetCore.Http; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace IdentityServer4.Endpoints.Results { public class DiscoveryDocumentResult : IEndpointResult { public DiscoveryDocument Document { get; private set; } public Dictionary<string, object> CustomEntries { get; private set; } public DiscoveryDocumentResult(DiscoveryDocument document, Dictionary<string, object> customEntries) { Document = document; CustomEntries = customEntries; } public Task ExecuteAsync(HttpContext context) { if (CustomEntries != null && CustomEntries.Any()) { var jobject = JObject.FromObject(Document); foreach (var item in CustomEntries) { JToken token; if (jobject.TryGetValue(item.Key, out token)) { throw new Exception("Item does already exist - cannot add it via a custom entry: " + item.Key); } jobject.Add(new JProperty(item.Key, item.Value)); return context.Response.WriteJsonAsync(jobject); } } return context.Response.WriteJsonAsync(Document); } } }
apache-2.0
C#
35f0980f18f2fd5d14a31ceeee99be961f683e05
fix connection
NServiceBusSqlPersistence/NServiceBus.SqlPersistence
src/PostgreSqlAcceptanceTests/ConfigureEndpointSqlPersistence.cs
src/PostgreSqlAcceptanceTests/ConfigureEndpointSqlPersistence.cs
using System; using System.Threading.Tasks; using NServiceBus; using NServiceBus.AcceptanceTesting.Support; using NServiceBus.Persistence.Sql; using NServiceBus.Persistence.Sql.ScriptBuilder; public class ConfigureEndpointSqlPersistence : IConfigureEndpointTestExecution { ConfigureEndpointHelper endpointHelper; public Task Configure(string endpointName, EndpointConfiguration configuration, RunSettings settings, PublisherMetadata publisherMetadata) { if (configuration.IsSendOnly()) { return Task.FromResult(0); } var tablePrefix = TableNameCleaner.Clean(endpointName); endpointHelper = new ConfigureEndpointHelper(configuration, tablePrefix, PostgreSqlConnectionBuilder.Build, BuildSqlDialect.PostgreSql, FilterTableExists); var persistence = configuration.UsePersistence<SqlPersistence>(); persistence.ConnectionBuilder(PostgreSqlConnectionBuilder.Build); persistence.SqlDialect<SqlDialect.PostgreSql>(); var subscriptions = persistence.SubscriptionSettings(); subscriptions.DisableCache(); persistence.DisableInstaller(); return Task.FromResult(0); } bool FilterTableExists(Exception exception) { return exception.Message.Contains("Cannot drop the table"); } public Task Cleanup() { return endpointHelper?.Cleanup(); } }
using System; using System.Threading.Tasks; using NServiceBus; using NServiceBus.AcceptanceTesting.Support; using NServiceBus.Persistence.Sql; using NServiceBus.Persistence.Sql.ScriptBuilder; public class ConfigureEndpointSqlPersistence : IConfigureEndpointTestExecution { ConfigureEndpointHelper endpointHelper; public Task Configure(string endpointName, EndpointConfiguration configuration, RunSettings settings, PublisherMetadata publisherMetadata) { if (configuration.IsSendOnly()) { return Task.FromResult(0); } var tablePrefix = TableNameCleaner.Clean(endpointName); endpointHelper = new ConfigureEndpointHelper(configuration, tablePrefix, MsSqlConnectionBuilder.Build, BuildSqlDialect.PostgreSql, FilterTableExists); var persistence = configuration.UsePersistence<SqlPersistence>(); persistence.ConnectionBuilder(PostgreSqlConnectionBuilder.Build); persistence.SqlDialect<SqlDialect.PostgreSql>(); var subscriptions = persistence.SubscriptionSettings(); subscriptions.DisableCache(); persistence.DisableInstaller(); return Task.FromResult(0); } bool FilterTableExists(Exception exception) { return exception.Message.Contains("Cannot drop the table"); } public Task Cleanup() { return endpointHelper?.Cleanup(); } }
mit
C#
bb59ffcba2fcbe3f0154572b61c5c17602b3afbd
Fix exception for loading WAV objects which has been failed to load.
JLChnToZ/BMP-U
Assets/Scripts/BMS/DataObject.cs
Assets/Scripts/BMS/DataObject.cs
using UnityEngine; using UnityObject = UnityEngine.Object; using ManagedBass; namespace BMS { public enum ResourceType { Unknown, bmp, wav, bpm, stop, bga, } public class ResourceObject { readonly int index; internal readonly ResourceType type; string resPath; internal object value; public ResourceObject(int index, ResourceType type, string resPath) { this.index = index; this.type = type; this.resPath = resPath; } public ResourceObject(int index, object value) { this.index = index; this.value = value; if(value is MovieTextureHolder) type = ResourceType.bmp; else if(value is Texture) type = ResourceType.bmp; else if(value is int) type = ResourceType.wav; else type = ResourceType.Unknown; } public string path { get { return resPath; } } public Texture texture { get { return value != null ? ((value as Texture) ?? (value as MovieTextureHolder).Output) : null; } } public int soundEffect { get { return (value is int) ? (int)value : 0; } } public void Dispose() { if(value is UnityObject) { if(Application.isPlaying) UnityObject.Destroy(value as UnityObject); else UnityObject.DestroyImmediate(value as UnityObject); return; } if(value is int) { if(!Bass.StreamFree((int)value)) Debug.LogErrorFormat("Failed to free stream {0} from BASS lib: {1}", value, Bass.LastError); return; } } } public struct BGAObject { public int index; public Rect clipArea; public Vector2 offset; } }
using UnityEngine; using UnityObject = UnityEngine.Object; using ManagedBass; namespace BMS { public enum ResourceType { Unknown, bmp, wav, bpm, stop, bga, } public class ResourceObject { readonly int index; internal readonly ResourceType type; string resPath; internal object value; public ResourceObject(int index, ResourceType type, string resPath) { this.index = index; this.type = type; this.resPath = resPath; } public ResourceObject(int index, object value) { this.index = index; this.value = value; if(value is MovieTextureHolder) type = ResourceType.bmp; else if(value is Texture) type = ResourceType.bmp; else if(value is int) type = ResourceType.wav; else type = ResourceType.Unknown; } public string path { get { return resPath; } } public Texture texture { get { return value != null ? ((value as Texture) ?? (value as MovieTextureHolder).Output) : null; } } public int soundEffect { get { return (int)value; } } public void Dispose() { if(value is UnityObject) { if(Application.isPlaying) UnityObject.Destroy(value as UnityObject); else UnityObject.DestroyImmediate(value as UnityObject); return; } if(value is int) { if(!Bass.StreamFree((int)value)) Debug.LogErrorFormat("Failed to free stream {0} from BASS lib: {1}", value, Bass.LastError); return; } } } public struct BGAObject { public int index; public Rect clipArea; public Vector2 offset; } }
artistic-2.0
C#
685259e5aae2abaf410613ec6a5b58c7948e0e23
Improve matching bonus tracks
zumicts/Audiotica
Audiotica.Data/Mp3MatchEngine.cs
Audiotica.Data/Mp3MatchEngine.cs
#region using System.Threading.Tasks; using Audiotica.Data.Model.Spotify.Models; using Audiotica.Data.Mp3Providers; using IF.Lastfm.Core.Objects; #endregion namespace Audiotica.Data { public static class Mp3MatchEngine { private static readonly IMp3Provider[] Providers = { new NeteaseProvider(), new MeileProvider(), new YouTubeProvider(), new Mp3ClanProvider(), new Mp3TruckProvider(), new SoundCloudProvider() }; public static async Task<string> FindMp3For(string title, string artist) { title = title.ToLower() .Replace("feat.", "ft.") //better alternatives for matching .Replace("- live", "(live)") .Replace("- bonus track", ""); var currentProvider = 0; while (currentProvider < Providers.Length) { var mp3Provider = Providers[currentProvider]; var url = await mp3Provider.GetMatch(title, artist).ConfigureAwait(false); if (url != null) return url; currentProvider++; } return null; } } }
#region using System.Threading.Tasks; using Audiotica.Data.Model.Spotify.Models; using Audiotica.Data.Mp3Providers; using IF.Lastfm.Core.Objects; #endregion namespace Audiotica.Data { public static class Mp3MatchEngine { private static readonly IMp3Provider[] Providers = { new NeteaseProvider(), new MeileProvider(), new YouTubeProvider(), new Mp3ClanProvider(), new Mp3TruckProvider(), new SoundCloudProvider() }; public static async Task<string> FindMp3For(string title, string artist) { title = title.ToLower().Replace("feat.", "ft.").Replace("- live", "(live)"); var currentProvider = 0; while (currentProvider < Providers.Length) { var mp3Provider = Providers[currentProvider]; var url = await mp3Provider.GetMatch(title, artist).ConfigureAwait(false); if (url != null) return url; currentProvider++; } return null; } } }
apache-2.0
C#
d070e356e9f86d4e7a3c2ecf640d8bf5976cf908
Add constructor overload
rhynodegreat/CSharpGameLibrary,vazgriz/CSharpGameLibrary,rhynodegreat/CSharpGameLibrary,vazgriz/CSharpGameLibrary
CSharpGameLibrary/PinnedArray.cs
CSharpGameLibrary/PinnedArray.cs
using System; using System.Runtime.InteropServices; using System.Collections.Generic; namespace CSGL { public class PinnedArray<T> : IDisposable where T : struct { T[] array; GCHandle handle; bool disposed = false; int count; public PinnedArray(T[] array) { this.array = array; if (array != null) { count = array.Length; } Init(); } public PinnedArray(int count) { if (count < 0) throw new ArgumentOutOfRangeException(nameof(count), "Count must be positive"); array = new T[count]; this.count = count; Init(); } public PinnedArray(List<T> list) { array = Interop.GetInternalArray(list); if (array != null) { count = list.Count; } Init(); } void Init() { handle = GCHandle.Alloc(array, GCHandleType.Pinned); } public IntPtr Address { get { return handle.AddrOfPinnedObject(); } } public int Count { get { return count; } } public T this[int i] { get { return array[i]; } set { array[i] = value; } } public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } void Dispose(bool diposing) { if (disposed) return; handle.Free(); if (diposing) { array = null; } disposed = true; } ~PinnedArray() { Dispose(false); } } }
using System; using System.Runtime.InteropServices; namespace CSGL { public class PinnedArray<T> : IDisposable where T : struct { T[] array; GCHandle handle; bool disposed = false; int count; public PinnedArray(T[] array) { this.array = array; if (array != null) { count = array.Length; } Init(); } public PinnedArray(int count) { if (count < 0) throw new ArgumentOutOfRangeException(nameof(count), "Count must be positive"); array = new T[count]; this.count = count; Init(); } void Init() { handle = GCHandle.Alloc(array, GCHandleType.Pinned); } public IntPtr Address { get { return handle.AddrOfPinnedObject(); } } public int Count { get { return count; } } public T this[int i] { get { return array[i]; } set { array[i] = value; } } public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } void Dispose(bool diposing) { if (disposed) return; handle.Free(); if (diposing) { array = null; } disposed = true; } ~PinnedArray() { Dispose(false); } } }
mit
C#
248b79b0ba6329f7e03876758319b0641852a238
correct url for organization list
FacturAPI/facturapi-net
facturapi-net/Router/OrganizationRouter.cs
facturapi-net/Router/OrganizationRouter.cs
using System; using System.Collections.Generic; namespace Facturapi { internal static partial class Router { public static string ListOrganizations(Dictionary<string, object> query = null) { return UriWithQuery("organizations", query); } public static string RetrieveOrganization(string id) { return $"organizations/{id}"; } public static string CreateOrganization() { return "organizations"; } public static string DeleteOrganization(string id) { return RetrieveOrganization(id); } public static string UpdateLegal(string id) { return $"{RetrieveOrganization(id)}/legal"; } public static string UpdateCustomization(string id) { return $"{RetrieveOrganization(id)}/customization"; } public static string UploadLogo(string id) { return $"{RetrieveOrganization(id)}/logo"; } public static string UploadCertificate(string id) { return $"{RetrieveOrganization(id)}/certificate"; } public static string GetApiKeys(string id) { return $"{RetrieveOrganization(id)}/apikeys"; } } }
using System; using System.Collections.Generic; namespace Facturapi { internal static partial class Router { public static string ListOrganizations(Dictionary<string, object> query = null) { return UriWithQuery("organization", query); } public static string RetrieveOrganization(string id) { return $"organizations/{id}"; } public static string CreateOrganization() { return "organizations"; } public static string DeleteOrganization(string id) { return RetrieveOrganization(id); } public static string UpdateLegal(string id) { return $"{RetrieveOrganization(id)}/legal"; } public static string UpdateCustomization(string id) { return $"{RetrieveOrganization(id)}/customization"; } public static string UploadLogo(string id) { return $"{RetrieveOrganization(id)}/logo"; } public static string UploadCertificate(string id) { return $"{RetrieveOrganization(id)}/certificate"; } public static string GetApiKeys(string id) { return $"{RetrieveOrganization(id)}/apikeys"; } } }
mit
C#
3fd58809536aca01aafe610d62a55e21f6951fc5
fix compiler warning
abock/conservatorio,abock/conservatorio,abock/conservatorio
Conservatorio.Mac/AppDelegate.cs
Conservatorio.Mac/AppDelegate.cs
// // AppDelegate.cs // // Author: // Aaron Bockover <aaron.bockover@gmail.com> // // Copyright 2015 Aaron Bockover. All rights reserved. // // 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 AppKit; using Foundation; namespace Conservatorio.Mac { public partial class AppDelegate : NSApplicationDelegate { #pragma warning disable 0414 readonly Sparkle.SUUpdater suupdater = new Sparkle.SUUpdater (); #pragma warning restore 0414 public override void DidFinishLaunching (NSNotification notification) { NewHandler (this); } partial void NewHandler (NSObject sender) { new MainWindowController ().Window.MakeKeyAndOrderFront (this); } partial void ProjectPageHandler (NSObject sender) { NSWorkspace.SharedWorkspace.OpenUrl (new NSUrl ("http://conservator.io")); } } }
// // AppDelegate.cs // // Author: // Aaron Bockover <aaron.bockover@gmail.com> // // Copyright 2015 Aaron Bockover. All rights reserved. // // 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 AppKit; using Foundation; namespace Conservatorio.Mac { public partial class AppDelegate : NSApplicationDelegate { readonly Sparkle.SUUpdater suupdater = new Sparkle.SUUpdater (); public override void DidFinishLaunching (NSNotification notification) { NewHandler (this); } partial void NewHandler (NSObject sender) { new MainWindowController ().Window.MakeKeyAndOrderFront (this); } partial void ProjectPageHandler (NSObject sender) { NSWorkspace.SharedWorkspace.OpenUrl (new NSUrl ("http://conservator.io")); } } }
mit
C#
3eebc2f70f6f904c8f6a7801dee703e6b3ba7d3f
Update GameLoopView based on feedback
feliwir/openSage,feliwir/openSage
src/OpenSage.Game/Diagnostics/GameLoopView.cs
src/OpenSage.Game/Diagnostics/GameLoopView.cs
using System; using System.Globalization; using ImGuiNET; namespace OpenSage.Diagnostics { internal sealed class GameLoopView : DiagnosticView { public GameLoopView(DiagnosticViewContext context) : base(context) { } public override string DisplayName => "Game loop"; protected override void DrawOverride(ref bool isGameViewFocused) { ImGui.Text($"Logic frame: {Game.CurrentFrame}"); ImGui.Separator(); ImGui.Text($"Map time: {FormatTime(Game.MapTime.TotalGameTime)}"); ImGui.Text($"Render time: {FormatTime(Game.RenderTime.TotalGameTime)}"); ImGui.Text($"Frame time: {Game.RenderTime.ElapsedGameTime.TotalMilliseconds.ToString("F2", CultureInfo.InvariantCulture)} ms"); ImGui.Text($"Cumulative update time error: {FormatTime(Game.CumulativeLogicUpdateError)}"); } private static string FormatTime(TimeSpan timeSpan) => $"{timeSpan.TotalMinutes:00}:{timeSpan.TotalSeconds:00}:{timeSpan.Milliseconds:000}"; } }
using ImGuiNET; namespace OpenSage.Diagnostics { internal class GameLoopView : DiagnosticView { public GameLoopView(DiagnosticViewContext context) : base(context) { } public override string DisplayName => "Game loop"; protected override void DrawOverride(ref bool isGameViewFocused) { ImGui.Text($"Logic frame: {Game.CurrentFrame}"); ImGui.Separator(); ImGui.Text($"Map time: {Game.MapTime.TotalGameTime}"); ImGui.Text($"Render time: {Game.RenderTime.TotalGameTime}"); ImGui.Text($"Frame time: {Game.RenderTime.ElapsedGameTime}"); ImGui.Text($"Cumulative update time error: {Game.CumulativeLogicUpdateError}"); } } }
mit
C#
9fcb1e9c256a6cd07208687a98b546126a7f761b
rebase change, add NotEmpty
ritterim/releases,ritterim/releases,ritterim/releases
src/Site/ViewModels/Releases/ShowViewModel.cs
src/Site/ViewModels/Releases/ShowViewModel.cs
using System.Collections.Generic; using RimDev.Releases.Models; using System.Linq; namespace RimDev.Releases.ViewModels.Releases { public class ShowViewModel { public ShowViewModel(GitHubRepository currentRepository) { Releases = new List<ReleaseViewModel>(); CurrentRepository = currentRepository; } public GitHubRepository CurrentRepository { get; set; } public AppSettings AppSettings { get; set; } public IList<ReleaseViewModel> Releases { get; set; } public bool NotEmpty => Releases != null && Releases.Any(); public int Page { get; set; } public int PageSize { get; set; } public int? NextPage { get; set; } public int? PreviousPage { get; set; } public int LastPage { get; set; } public int FirstPage { get; set; } } }
using System.Collections.Generic; using RimDev.Releases.Models; using System.Linq; namespace RimDev.Releases.ViewModels.Releases { public class ShowViewModel { public ShowViewModel(GitHubRepository currentRepository) { Releases = new List<ReleaseViewModel>(); CurrentRepository = currentRepository; } public GitHubRepository CurrentRepository { get; set; } public AppSettings AppSettings { get; set; } public IList<ReleaseViewModel> Releases { get; set; } public bool NotEmpty => Releases != null && Releases.Any(); public int Page { get; set; } public int PageSize { get; set; } public int? NextPage { get; set; } public int? PreviousPage { get; set; } public int LastPage { get; set; } public int FirstPage { get; set; } } }
mit
C#
450bf23c3bf39fb77edcb98a792c3c4da006d76a
Add CurrentSubTreeIndex and CurrentSubTree
yishn/GTPWrapper
GTPWrapper/DataTypes/ListTree.cs
GTPWrapper/DataTypes/ListTree.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace GTPWrapper.DataTypes { public class ListTree<T> { /// <summary> /// Gets or sets the list of elements of this tree. /// </summary> public List<T> Elements { get; set; } /// <summary> /// Gets or sets the list of subtrees of this tree. /// </summary> public List<ListTree<T>> SubTrees { get; set; } /// <summary> /// Gets or sets the index of the current sub tree. /// </summary> public int CurrentSubTreeIndex { get; set; } /// <summary> /// Gets the current sub tree. /// </summary> public ListTree<T> CurrentSubTree { get { return CurrentSubTreeIndex < SubTrees.Count ? SubTrees[CurrentSubTreeIndex] : null; } } /// <summary> /// Initializes a new instance of the ListTreeNode class with an empty list. /// </summary> public ListTree() : this(new List<T>()) { } /// <summary> /// Initializes a new instance of the ListTreeNode class. /// </summary> public ListTree(List<T> list) { this.Elements = list; this.SubTrees = new List<ListTree<T>>(); this.CurrentSubTreeIndex = 0; } /// <summary> /// Returns a linear list of the elements in the tree as IEnumerable. /// </summary> public IEnumerable<T> AsEnumerable() { foreach (T element in this.Elements) yield return element; if (this.CurrentSubTree == null) yield break; foreach (T element in this.CurrentSubTree.AsEnumerable()) yield return element; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace GTPWrapper.DataTypes { public class ListTree<T> { /// <summary> /// Gets or sets the list of elements of this tree. /// </summary> public List<T> Elements { get; set; } /// <summary> /// Gets or sets the list of subtrees of this tree. /// </summary> public List<ListTree<T>> SubTrees { get; set; } /// <summary> /// Initializes a new instance of the ListTreeNode class with an empty list. /// </summary> public ListTree() : this(new List<T>()) { } /// <summary> /// Initializes a new instance of the ListTreeNode class. /// </summary> public ListTree(List<T> list) { this.Elements = list; this.SubTrees = new List<ListTree<T>>(); } /// <summary> /// Returns a linear list of the elements in the tree as IEnumerable. /// </summary> public IEnumerable<T> AsEnumerable() { foreach (T element in this.Elements) yield return element; if (this.SubTrees.Count == 0) yield break; foreach (T element in this.SubTrees[0].AsEnumerable()) yield return element; } } }
mit
C#
ff97f554cdbb3ff10a52254ba6caa3b6111a822b
Check scale every minute
jefking/King.Service
Worker/Scalable/DynamicScaler.cs
Worker/Scalable/DynamicScaler.cs
namespace Worker.Scalable { using King.Service; using System.Collections.Generic; using System.Diagnostics; public class DynamicScaler : AutoScaler<Configuration> { public DynamicScaler(Configuration config) : base(config, 1, 15, 1) { Trace.TraceInformation("Scaler Loaded."); } public override IEnumerable<IScalable> ScaleUnit(Configuration data) { yield return new AdaptiveRunner(new ScalableTask()); yield return new BackoffRunner(new ScalableTask()); // More Likely to scale up } } }
namespace Worker.Scalable { using King.Service; using System.Collections.Generic; using System.Diagnostics; public class DynamicScaler : AutoScaler<Configuration> { public DynamicScaler(Configuration config) : base(config, 1, 15) { Trace.TraceInformation("Scaler Loaded."); } public override IEnumerable<IScalable> ScaleUnit(Configuration data) { Trace.TraceInformation("Scaling up."); yield return new AdaptiveRunner(new ScalableTask()); yield return new BackoffRunner(new ScalableTask()); // More Likely to scale up } } }
mit
C#
c62779b03739388c3ada79a6a030531cb36486f5
Enable NesZord.Tests to se internal members of NesZord.Core
rmterra/NesZord
src/NesZord.Core/Properties/AssemblyInfo.cs
src/NesZord.Core/Properties/AssemblyInfo.cs
using System.Resources; 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("NesZord.Core")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("NesZord.Core")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] // 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: InternalsVisibleTo("NesZord.Tests")]
using System.Resources; 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("NesZord.Core")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("NesZord.Core")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] // 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")]
apache-2.0
C#
f1117eb95074884465d7964acb6115797dded84e
Add support for nested anonymous models
toddams/RazorLight,toddams/RazorLight
src/RazorLight/Extensions/TypeExtensions.cs
src/RazorLight/Extensions/TypeExtensions.cs
using System; using System.Collections.Generic; using System.Dynamic; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; namespace RazorLight.Extensions { public static class TypeExtensions { public static ExpandoObject ToExpando(this object anonymousObject) { if (anonymousObject is ExpandoObject exp) { return exp; } IDictionary<string, object> expando = new ExpandoObject(); foreach (var propertyDescriptor in anonymousObject.GetType().GetTypeInfo().GetProperties()) { var obj = propertyDescriptor.GetValue(anonymousObject); if (obj != null && obj.GetType().IsAnonymousType()) { obj = obj.ToExpando(); } expando.Add(propertyDescriptor.Name, obj); } return (ExpandoObject)expando; } public static bool IsAnonymousType(this Type type) { bool hasCompilerGeneratedAttribute = type.GetTypeInfo() .GetCustomAttributes(typeof(CompilerGeneratedAttribute), false) .Any(); bool nameContainsAnonymousType = type.FullName.Contains("AnonymousType"); bool isAnonymousType = hasCompilerGeneratedAttribute && nameContainsAnonymousType; return isAnonymousType; } } }
using System; using System.Collections.Generic; using System.Dynamic; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; namespace RazorLight.Extensions { public static class TypeExtensions { public static ExpandoObject ToExpando(this object anonymousObject) { if (anonymousObject is ExpandoObject exp) { return exp; } IDictionary<string, object> expando = new ExpandoObject(); foreach (var propertyDescriptor in anonymousObject.GetType().GetTypeInfo().GetProperties()) { var obj = propertyDescriptor.GetValue(anonymousObject); expando.Add(propertyDescriptor.Name, obj); } return (ExpandoObject)expando; } public static bool IsAnonymousType(this Type type) { bool hasCompilerGeneratedAttribute = type.GetTypeInfo() .GetCustomAttributes(typeof(CompilerGeneratedAttribute), false) .Any(); bool nameContainsAnonymousType = type.FullName.Contains("AnonymousType"); bool isAnonymousType = hasCompilerGeneratedAttribute && nameContainsAnonymousType; return isAnonymousType; } } }
apache-2.0
C#
85502570a37faaf83f0792fe22a52c21b3c9d297
Update #9
lucasdavid/Gamedalf,lucasdavid/Gamedalf
Gamedalf.Tests/Testdata/DevelopersTestData.cs
Gamedalf.Tests/Testdata/DevelopersTestData.cs
using Gamedalf.Core.Models; using Gamedalf.Tests.Infrastructure; using System.Collections.Generic; namespace Gamedalf.Tests.Testdata { public class DevelopersTestData : ITestData<Developer> { public ICollection<Developer> Data { get; set; } public DevelopersTestData() { Data = new List<Developer> { new Developer { Id = "developer1", Email = "juan@gmail.com", UserName = "juan@gmail.com", }, new Developer { Id = "developer2", Email = "guilia@db.net", UserName = "guilia@db.net", } }; } } }
using Gamedalf.Core.Models; using Gamedalf.Tests.Infrastructure; using System.Collections.Generic; namespace Gamedalf.Tests.Testdata { public class DevelopersTestData : ITestData<Developer> { public ICollection<Developer> Data { get; set; } public DevelopersTestData() { Data = new List<Developer> { new Developer { Id = "developer1", Email = "lucasolivdavid@gmail.com", UserName = "lucasolivdavid@gmail.com", }, new Developer { Id = "developer2", Email = "maria@db.net", UserName = "maria@db.net", }, new Developer { Id = "developer3", Email = "johnhall@provider.com", UserName = "johnhall@provider.com" }, new Developer { Id = "developer4", Email = "email@mail.com", UserName = "email@mail.com" } }; } } }
mit
C#
74d724bb076a82e39b423f4d29ec3457ebf63c77
Allow translation of boolean filtering text.
neitsa/PrepareLanding,neitsa/PrepareLanding
src/Core/Extensions/FilterBooleanExtensions.cs
src/Core/Extensions/FilterBooleanExtensions.cs
using UnityEngine; using Verse; namespace PrepareLanding.Core.Extensions { public static class FilterBooleanExtensions { public static string ToStringHuman(this FilterBoolean filterBool) { switch (filterBool) { case FilterBoolean.AndFiltering: return "PLMWTT_FilterBooleanOr".Translate(); case FilterBoolean.OrFiltering: return "PLMWTT_FilterBooleanAnd".Translate(); default: return "UNK"; } } public static FilterBoolean Next(this FilterBoolean filterBoolean) { return (FilterBoolean)(((int)filterBoolean + 1) % (int)FilterBoolean.Undefined); } public static Color Color(this FilterBoolean filterBoolean) { switch (filterBoolean) { case FilterBoolean.AndFiltering: return Verse.ColorLibrary.BurntOrange; case FilterBoolean.OrFiltering: return Verse.ColorLibrary.BrightBlue; default: return UnityEngine.Color.black; } } } }
using UnityEngine; namespace PrepareLanding.Core.Extensions { public static class FilterBooleanExtensions { public static string ToStringHuman(this FilterBoolean filterBool) { switch (filterBool) { case FilterBoolean.AndFiltering: return "AND"; case FilterBoolean.OrFiltering: return "OR"; default: return "UNK"; } } public static FilterBoolean Next(this FilterBoolean filterBoolean) { return (FilterBoolean)(((int)filterBoolean + 1) % (int)FilterBoolean.Undefined); } public static Color Color(this FilterBoolean filterBoolean) { switch (filterBoolean) { case FilterBoolean.AndFiltering: return Verse.ColorLibrary.BurntOrange; case FilterBoolean.OrFiltering: return Verse.ColorLibrary.BrightBlue; default: return UnityEngine.Color.black; } } } }
mit
C#
83301ce13be9024b8e1139c2a408d6a53e2bf844
Update PngRenderer.cs
wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D
src/Core2D/Screenshot/Renderers/PngRenderer.cs
src/Core2D/Screenshot/Renderers/PngRenderer.cs
using System.IO; using Avalonia; using Avalonia.Controls; using Avalonia.Media.Imaging; namespace Core2D.Screenshot.Renderers; public static class PngRenderer { public static void Render(Control target, Size size, Stream stream, double dpi = 96) { var pixelSize = new PixelSize((int)size.Width, (int)size.Height); var dpiVector = new Vector(dpi, dpi); using var bitmap = new RenderTargetBitmap(pixelSize, dpiVector); target.Measure(size); target.Arrange(new Rect(size)); bitmap.Render(target); bitmap.Save(stream); } }
using Avalonia; using Avalonia.Controls; using Avalonia.Media.Imaging; namespace Core2D.Screenshot.Renderers; public static class PngRenderer { public static void Render(Control target, Size size, string path, double dpi = 96) { var pixelSize = new PixelSize((int)size.Width, (int)size.Height); var dpiVector = new Vector(dpi, dpi); using var bitmap = new RenderTargetBitmap(pixelSize, dpiVector); target.Measure(size); target.Arrange(new Rect(size)); bitmap.Render(target); bitmap.Save(path); } }
mit
C#
2e926ddd05d7cacb1eed9a6519dc92d5388c14db
Change AssemblyVersion and AssemblyFileVersion to 0.0.1
lydonchandra/visualstudio-wakatime,CodeCavePro/visualstudio-wakatime,wakatime/visualstudio-wakatime,crushjz/visualstudio-wakatime,CodeCavePro/wakatime-sharp,gandarez/visualstudio-wakatime,iwhp/visualstudio-wakatime,pritianka/VS
Properties/AssemblyInfo.cs
Properties/AssemblyInfo.cs
using System; using System.Reflection; using System.Resources; 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("VSPackageWakaTime")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("WakaTime")] [assembly: AssemblyProduct("VSPackageWakaTime")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: CLSCompliant(false)] [assembly: NeutralResourcesLanguage("en-US")] // 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 Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("0.0.1")] [assembly: AssemblyFileVersion("0.0.1")] [assembly: InternalsVisibleTo("VSPackageWakaTime_IntegrationTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100ed8f681fc55bde81467704eba07c3f705ca21f8e864179766c6a034588cd9c2262faaa5c377f0f4fac40ed2564049adf003f19bc13b6d420a1c4d17d998d743fe3cf3ea06957841e7a423d98ea28dd45c43ca7ce3d0722cd859b56101fc1b24f48afc420168a636e486da71c00e9e0909083772c528cb7ecc18ba6e358f5f99a")] [assembly: InternalsVisibleTo("VSPackageWakaTime_UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100ed8f681fc55bde81467704eba07c3f705ca21f8e864179766c6a034588cd9c2262faaa5c377f0f4fac40ed2564049adf003f19bc13b6d420a1c4d17d998d743fe3cf3ea06957841e7a423d98ea28dd45c43ca7ce3d0722cd859b56101fc1b24f48afc420168a636e486da71c00e9e0909083772c528cb7ecc18ba6e358f5f99a")]
using System; using System.Reflection; using System.Resources; 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("VSPackageWakaTime")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("WakaTime")] [assembly: AssemblyProduct("VSPackageWakaTime")] [assembly: AssemblyCopyright("")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: CLSCompliant(false)] [assembly: NeutralResourcesLanguage("en-US")] // 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 Revision and Build Numbers // by using the '*' as shown below: [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: InternalsVisibleTo("VSPackageWakaTime_IntegrationTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100ed8f681fc55bde81467704eba07c3f705ca21f8e864179766c6a034588cd9c2262faaa5c377f0f4fac40ed2564049adf003f19bc13b6d420a1c4d17d998d743fe3cf3ea06957841e7a423d98ea28dd45c43ca7ce3d0722cd859b56101fc1b24f48afc420168a636e486da71c00e9e0909083772c528cb7ecc18ba6e358f5f99a")] [assembly: InternalsVisibleTo("VSPackageWakaTime_UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100ed8f681fc55bde81467704eba07c3f705ca21f8e864179766c6a034588cd9c2262faaa5c377f0f4fac40ed2564049adf003f19bc13b6d420a1c4d17d998d743fe3cf3ea06957841e7a423d98ea28dd45c43ca7ce3d0722cd859b56101fc1b24f48afc420168a636e486da71c00e9e0909083772c528cb7ecc18ba6e358f5f99a")]
bsd-3-clause
C#
d8b3ffa06e72f5ae415e8e402ace4a6839aa0ae3
Use correct Gnome3 default DPI
feliwir/openSage,feliwir/openSage
src/OpenSage.Game/Utilities/PlatformUtility.cs
src/OpenSage.Game/Utilities/PlatformUtility.cs
using System; using System.Runtime.InteropServices; namespace OpenSage.Utilities { public static class PlatformUtility { /// <summary> /// Check if current platform is windows /// </summary> /// <returns></returns> public static bool IsWindowsPlatform() { switch (Environment.OSVersion.Platform) { case PlatformID.Win32Windows: case PlatformID.Win32NT: case PlatformID.WinCE: case PlatformID.Win32S: return true; default: return false; } } public static float GetDefaultDpi() { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { return 96.0f; } else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { return 72.0f; } else { return 96.0f; // TODO: For GNOME3 the default DPI is 96 } } } }
using System; using System.Runtime.InteropServices; namespace OpenSage.Utilities { public static class PlatformUtility { /// <summary> /// Check if current platform is windows /// </summary> /// <returns></returns> public static bool IsWindowsPlatform() { switch (Environment.OSVersion.Platform) { case PlatformID.Win32Windows: case PlatformID.Win32NT: case PlatformID.WinCE: case PlatformID.Win32S: return true; default: return false; } } public static float GetDefaultDpi() { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { return 96.0f; } else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { return 72.0f; } else { return 1.0f; // TODO: What happens on Linux? } } } }
mit
C#
5e4f83b80b158cdf0ddadd60db430a0fc1d83a15
Add more correct catch playfield sizing
ZLima12/osu,UselessToucan/osu,naoey/osu,2yangk23/osu,peppy/osu-new,NeoAdonis/osu,johnneijzen/osu,2yangk23/osu,NeoAdonis/osu,ZLima12/osu,DrabWeb/osu,naoey/osu,UselessToucan/osu,peppy/osu,peppy/osu,ppy/osu,naoey/osu,smoogipoo/osu,ppy/osu,ppy/osu,smoogipooo/osu,NeoAdonis/osu,smoogipoo/osu,DrabWeb/osu,EVAST9919/osu,smoogipoo/osu,EVAST9919/osu,UselessToucan/osu,peppy/osu,johnneijzen/osu,DrabWeb/osu
osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs
osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Input; using osu.Game.Beatmaps; using osu.Game.Input.Handlers; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects.Drawable; using osu.Game.Rulesets.Catch.Replays; using osu.Game.Rulesets.Catch.Scoring; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Replays; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI.Scrolling; using OpenTK; namespace osu.Game.Rulesets.Catch.UI { public class CatchRulesetContainer : ScrollingRulesetContainer<CatchPlayfield, CatchHitObject> { public CatchRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) : base(ruleset, beatmap) { } public override ScoreProcessor CreateScoreProcessor() => new CatchScoreProcessor(this); protected override ReplayInputHandler CreateReplayInputHandler(Replay replay) => new CatchFramedReplayInputHandler(replay); protected override Playfield CreatePlayfield() => new CatchPlayfield(Beatmap.BeatmapInfo.BaseDifficulty, GetVisualRepresentation); public override PassThroughInputManager CreateInputManager() => new CatchInputManager(Ruleset.RulesetInfo); protected override Vector2 PlayfieldArea => new Vector2(0.86f); // matches stable's vertical offset for catcher plate protected override DrawableHitObject<CatchHitObject> GetVisualRepresentation(CatchHitObject h) { switch (h) { case Fruit fruit: return new DrawableFruit(fruit); case JuiceStream stream: return new DrawableJuiceStream(stream, GetVisualRepresentation); case BananaShower banana: return new DrawableBananaShower(banana, GetVisualRepresentation); case TinyDroplet tiny: return new DrawableDroplet(tiny) { Scale = new Vector2(0.5f) }; case Droplet droplet: return new DrawableDroplet(droplet); } return null; } } }
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.Input; using osu.Game.Beatmaps; using osu.Game.Input.Handlers; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects.Drawable; using osu.Game.Rulesets.Catch.Replays; using osu.Game.Rulesets.Catch.Scoring; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Replays; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI.Scrolling; using OpenTK; namespace osu.Game.Rulesets.Catch.UI { public class CatchRulesetContainer : ScrollingRulesetContainer<CatchPlayfield, CatchHitObject> { public CatchRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) : base(ruleset, beatmap) { } public override ScoreProcessor CreateScoreProcessor() => new CatchScoreProcessor(this); protected override ReplayInputHandler CreateReplayInputHandler(Replay replay) => new CatchFramedReplayInputHandler(replay); protected override Playfield CreatePlayfield() => new CatchPlayfield(Beatmap.BeatmapInfo.BaseDifficulty, GetVisualRepresentation); public override PassThroughInputManager CreateInputManager() => new CatchInputManager(Ruleset.RulesetInfo); protected override DrawableHitObject<CatchHitObject> GetVisualRepresentation(CatchHitObject h) { switch (h) { case Fruit fruit: return new DrawableFruit(fruit); case JuiceStream stream: return new DrawableJuiceStream(stream, GetVisualRepresentation); case BananaShower banana: return new DrawableBananaShower(banana, GetVisualRepresentation); case TinyDroplet tiny: return new DrawableDroplet(tiny) { Scale = new Vector2(0.5f) }; case Droplet droplet: return new DrawableDroplet(droplet); } return null; } } }
mit
C#
6106f1b494df2660d9b2285a39d61bc2cb56bca6
Refactor KendoComboBox test
atata-framework/atata-kendoui,atata-framework/atata-kendoui
src/Atata.KendoUI.Tests/KendoComboBoxTest.cs
src/Atata.KendoUI.Tests/KendoComboBoxTest.cs
using NUnit.Framework; namespace Atata.KendoUI.Tests { public class KendoComboBoxTest : UITestFixture { private ComboBoxPage page; protected override void OnSetUp() { page = Go.To<ComboBoxPage>(); } [Test] public void KendoComboBox() { var control = page.Regular; control.Should.BeEnabled(); control.Should.Not.BeReadOnly(); control.Set("Some value"); control.Should.Equal("Some value"); control.SetRandom(out string randomValue); control.Should.Equal(randomValue); control.Set(null); control.Should.BeNull(); } [Test] public void KendoComboBox_Disabled() { var control = page.Disabled; control.Should.BeDisabled(); control.Should.Not.BeReadOnly(); control.Should.Equal("Item 1"); } [Test] public void KendoComboBox_ReadOnly() { var control = page.ReadOnly; control.Should.BeEnabled(); control.Should.BeReadOnly(); control.Should.Equal(ComboBoxPage.ItemValue.Item2); } } }
using NUnit.Framework; namespace Atata.KendoUI.Tests { public class KendoComboBoxTest : UITestFixture { private ComboBoxPage page; protected override void OnSetUp() { page = Go.To<ComboBoxPage>(); } [Test] public void KendoComboBox() { var control = page.Regular; control.Should.BeEnabled(); control.Should.Not.BeReadOnly(); control.Set("Some value"); control.Should.Equal("Some value"); string randomValue; control.SetRandom(out randomValue); control.Should.Equal(randomValue); control.Set(null); control.Should.BeNull(); } [Test] public void KendoComboBox_Disabled() { var control = page.Disabled; control.Should.BeDisabled(); control.Should.Not.BeReadOnly(); control.Should.Equal("Item 1"); } [Test] public void KendoComboBox_ReadOnly() { var control = page.ReadOnly; control.Should.BeEnabled(); control.Should.BeReadOnly(); control.Should.Equal(ComboBoxPage.ItemValue.Item2); } } }
apache-2.0
C#
91d572235eaf43a2ca9eb1ad562849322cd43468
Make $id and $token properties in plugin objects unmodifiable
chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck,chylex/TweetDuck
Plugins/PluginScriptGenerator.cs
Plugins/PluginScriptGenerator.cs
using System.Globalization; using TweetDuck.Plugins.Enums; namespace TweetDuck.Plugins{ static class PluginScriptGenerator{ public static string GenerateConfig(PluginConfig config){ return config.AnyDisabled ? "window.TD_PLUGINS.disabled = [\""+string.Join("\",\"", config.DisabledPlugins)+"\"];" : string.Empty; } public static string GeneratePlugin(string pluginIdentifier, string pluginContents, int pluginToken, PluginEnvironment environment){ return PluginGen .Replace("%params", environment.GetScriptVariables()) .Replace("%id", pluginIdentifier) .Replace("%token", pluginToken.ToString(CultureInfo.InvariantCulture)) .Replace("%contents", pluginContents); } private const string PluginGen = "(function(%params,$d){let tmp={id:'%id',obj:new class extends PluginBase{%contents}};$d(tmp.obj,'$id',{value:'%id'});$d(tmp.obj,'$token',{value:%token});window.TD_PLUGINS.install(tmp);})(%params,Object.defineProperty);"; /* PluginGen (function(%params, $i, $d){ let tmp = { id: '%id', obj: new class extends PluginBase{%contents} }; $d(tmp.obj, '$id', { value: '%id' }); $d(tmp.obj, '$token', { value: %token }); window.TD_PLUGINS.install(tmp); })(%params, Object.defineProperty); */ } }
using System.Text; using TweetDuck.Plugins.Enums; namespace TweetDuck.Plugins{ static class PluginScriptGenerator{ public static string GenerateConfig(PluginConfig config){ return config.AnyDisabled ? "window.TD_PLUGINS.disabled = [\""+string.Join("\",\"", config.DisabledPlugins)+"\"];" : string.Empty; } public static string GeneratePlugin(string pluginIdentifier, string pluginContents, int pluginToken, PluginEnvironment environment){ StringBuilder build = new StringBuilder(2*pluginIdentifier.Length+pluginContents.Length+165); build.Append("(function(").Append(environment.GetScriptVariables()).Append("){"); build.Append("let tmp={"); build.Append("id:\"").Append(pluginIdentifier).Append("\","); build.Append("obj:new class extends PluginBase{").Append(pluginContents).Append("}"); build.Append("};"); build.Append("tmp.obj.$id=\"").Append(pluginIdentifier).Append("\";"); build.Append("tmp.obj.$token=").Append(pluginToken).Append(";"); build.Append("window.TD_PLUGINS.install(tmp);"); build.Append("})(").Append(environment.GetScriptVariables()).Append(");"); return build.ToString(); } } }
mit
C#
634a77748ab4fc326e4d227ec84d7404d21f0b7d
Make ApplyChangesTogether automatically filled to false if not present.
OmniSharp/omnisharp-roslyn,OmniSharp/omnisharp-roslyn
src/OmniSharp.Abstractions/Models/Request.cs
src/OmniSharp.Abstractions/Models/Request.cs
using System.Collections.Generic; using Newtonsoft.Json; namespace OmniSharp.Models { public class Request : SimpleFileRequest { [JsonConverter(typeof(ZeroBasedIndexConverter))] public int Line { get; set; } [JsonConverter(typeof(ZeroBasedIndexConverter))] public int Column { get; set; } public string Buffer { get; set; } public IEnumerable<LinePositionSpanTextChange> Changes { get; set; } [JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)] public bool ApplyChangesTogether { get; set; } } }
using System.Collections.Generic; using Newtonsoft.Json; namespace OmniSharp.Models { public class Request : SimpleFileRequest { [JsonConverter(typeof(ZeroBasedIndexConverter))] public int Line { get; set; } [JsonConverter(typeof(ZeroBasedIndexConverter))] public int Column { get; set; } public string Buffer { get; set; } public IEnumerable<LinePositionSpanTextChange> Changes { get; set; } public bool ApplyChangesTogether { get; set; } } }
mit
C#
615e9e712ba1a3717da270c3e557e499a90d472c
Fix delete page dialog resizing (BL-769)
andrew-polk/BloomDesktop,gmartin7/myBloomFork,JohnThomson/BloomDesktop,andrew-polk/BloomDesktop,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,BloomBooks/BloomDesktop,StephenMcConnel/BloomDesktop,JohnThomson/BloomDesktop,JohnThomson/BloomDesktop,JohnThomson/BloomDesktop,BloomBooks/BloomDesktop,andrew-polk/BloomDesktop,BloomBooks/BloomDesktop,StephenMcConnel/BloomDesktop,BloomBooks/BloomDesktop,BloomBooks/BloomDesktop,StephenMcConnel/BloomDesktop,StephenMcConnel/BloomDesktop,BloomBooks/BloomDesktop,andrew-polk/BloomDesktop,andrew-polk/BloomDesktop,JohnThomson/BloomDesktop,gmartin7/myBloomFork,gmartin7/myBloomFork,StephenMcConnel/BloomDesktop,gmartin7/myBloomFork,andrew-polk/BloomDesktop,gmartin7/myBloomFork
src/BloomExe/Edit/ConfirmRemovePageDialog.cs
src/BloomExe/Edit/ConfirmRemovePageDialog.cs
using System; using System.Drawing; using System.Runtime.InteropServices; using System.Windows.Forms; namespace Bloom.Edit { public partial class ConfirmRemovePageDialog : Form { public string LabelForThingBeingDeleted { get; set; } public ConfirmRemovePageDialog() { InitializeComponent(); _messageLabel.Font = SystemFonts.MessageBoxFont; } public ConfirmRemovePageDialog(string labelForThingBeingDeleted) : this() { LabelForThingBeingDeleted = labelForThingBeingDeleted.Trim(); _messageLabel.Text = string.Format(_messageLabel.Text, LabelForThingBeingDeleted); // Sometimes, setting the text in the previous line will force the table layout control // to resize itself accordingly, which will fire its SizeChanged event. However, // sometimes the text is not long enough to force the table layout to be resized, // therefore, we need to call it manually, just to be sure the form gets sized correctly. HandleTableLayoutSizeChanged(null, null); } private void HandleTableLayoutSizeChanged(object sender, EventArgs e) { if (!IsHandleCreated) CreateHandle(); var scn = Screen.FromControl(this); int padAbove = tableLayout.Top; int padBetween = 17; // empirically determined from initial layout in .Designer.cs file int padBelow = Math.Max(15, ClientSize.Height - cancelBtn.Bottom); var desiredHeight = padAbove + tableLayout.Height + padBetween + cancelBtn.Height + padBelow + (Height - ClientSize.Height); // overhead of dialog window Height = Math.Min(desiredHeight, scn.WorkingArea.Height - 20); } protected override void OnBackColorChanged(EventArgs e) { base.OnBackColorChanged(e); _messageLabel.BackColor = BackColor; } private void deleteBtn_Click(object sender, EventArgs e) { DialogResult = DialogResult.OK; Close(); } private void cancelBtn_Click(object sender, EventArgs e) { DialogResult = DialogResult.Cancel; Close(); } public static bool Confirm() { using (var dlg = new ConfirmRemovePageDialog()) { return DialogResult.OK == dlg.ShowDialog(); } } } }
using System; using System.Drawing; using System.Runtime.InteropServices; using System.Windows.Forms; namespace Bloom.Edit { public partial class ConfirmRemovePageDialog : Form { public string LabelForThingBeingDeleted { get; set; } public ConfirmRemovePageDialog() { InitializeComponent(); _messageLabel.Font = SystemFonts.MessageBoxFont; } public ConfirmRemovePageDialog(string labelForThingBeingDeleted) : this() { LabelForThingBeingDeleted = labelForThingBeingDeleted.Trim(); _messageLabel.Text = string.Format(_messageLabel.Text, LabelForThingBeingDeleted); // Sometimes, setting the text in the previous line will force the table layout control // to resize itself accordingly, which will fire its SizeChanged event. However, // sometimes the text is not long enough to force the table layout to be resized, // therefore, we need to call it manually, just to be sure the form gets sized correctly. HandleTableLayoutSizeChanged(null, null); } private void HandleTableLayoutSizeChanged(object sender, EventArgs e) { if (!IsHandleCreated) CreateHandle(); var scn = Screen.FromControl(this); var desiredHeight = tableLayout.Height + Padding.Top + Padding.Bottom + (Height - ClientSize.Height); Height = Math.Min(desiredHeight, scn.WorkingArea.Height - 20); } protected override void OnBackColorChanged(EventArgs e) { base.OnBackColorChanged(e); _messageLabel.BackColor = BackColor; } private void deleteBtn_Click(object sender, EventArgs e) { DialogResult = DialogResult.OK; Close(); } private void cancelBtn_Click(object sender, EventArgs e) { DialogResult = DialogResult.Cancel; Close(); } public static bool Confirm() { using (var dlg = new ConfirmRemovePageDialog()) { return DialogResult.OK == dlg.ShowDialog(); } } } }
mit
C#
69c740d6f2adbbc6ca123831ad9ec113c43d34ce
Optimize IsValidResourceName function
riganti/dotvvm,riganti/dotvvm,riganti/dotvvm,riganti/dotvvm
src/Framework/Framework/Utils/NamingUtils.cs
src/Framework/Framework/Utils/NamingUtils.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; using DotVVM.Framework.Controls; namespace DotVVM.Framework.Utils { public static class NamingUtils { // It would be nice to have validation methods for all named things here public static bool IsValidResourceName(string name) { // return Regex.IsMatch(name, @"^[a-zA-Z0-9]+([._-][a-zA-Z0-9]+)*$"); // but the regex is slow, so: bool allowedFirstLetter(char ch) => HtmlWriter.IsInRange(ch, 'a', 'z') || HtmlWriter.IsInRange(ch, 'A', 'Z') || HtmlWriter.IsInRange(ch, '0', '9'); bool allowedLetter(char ch) => allowedFirstLetter(ch) || ch is '.' or '_' or '-'; if (name.Length == 0) return false; if (!allowedLetter(name[0])) return false; for (int i = 1; i < name.Length; i++) { if (!allowedLetter(name[i])) return false; if (name[i] is '.' or '_' or '-') { // allowed only once and not at the end if (name.Length <= i + 1 || !allowedFirstLetter(name[i + 1])) return false; } } return true; } public static bool IsValidConcurrencyQueueName(string name) { return name.Length > 0 && (char.IsLetter(name[0]) || name[0] == '_') && name.Skip(1).All(l => char.IsLetterOrDigit(l) || l == '_' || l == '-' || l == '.'); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Text.RegularExpressions; namespace DotVVM.Framework.Utils { public static class NamingUtils { // It would be nice to have validation methods for all named things here public static bool IsValidResourceName(string name) { return Regex.IsMatch(name, @"^[a-zA-Z0-9]+([._-][a-zA-Z0-9]+)*$"); } public static bool IsValidConcurrencyQueueName(string name) { return name.Length > 0 && (char.IsLetter(name[0]) || name[0] == '_') && name.Skip(1).All(l => char.IsLetterOrDigit(l) || l == '_' || l == '-' || l == '.'); } } }
apache-2.0
C#
fdc898d8f7797cf53cdde862793f100197c8308b
Use the message variable
bbqchickenrobot/VisualStudio,github/VisualStudio,pwz3n0/VisualStudio,radnor/VisualStudio,AmadeusW/VisualStudio,naveensrinivasan/VisualStudio,luizbon/VisualStudio,amytruong/VisualStudio,bradthurber/VisualStudio,yovannyr/VisualStudio,Dr0idKing/VisualStudio,shaunstanislaus/VisualStudio,nulltoken/VisualStudio,github/VisualStudio,GProulx/VisualStudio,mariotristan/VisualStudio,HeadhunterXamd/VisualStudio,SaarCohen/VisualStudio,YOTOV-LIMITED/VisualStudio,ChristopherHackett/VisualStudio,GuilhermeSa/VisualStudio,modulexcite/VisualStudio,github/VisualStudio,8v060htwyc/VisualStudio
src/GitHub.Exports.Reactive/Helpers/Guard.cs
src/GitHub.Exports.Reactive/Helpers/Guard.cs
using System; using System.Diagnostics; using System.Globalization; using Splat; namespace GitHub { public static class Guard { /// <summary> /// Validates that the string is not empty. /// </summary> /// <param name="value"></param> public static void ArgumentNotEmptyString(string value, string name) { // We already know the value is not null because of NullGuard.Fody. if (!string.IsNullOrWhiteSpace(value)) return; string message = string.Format(CultureInfo.InvariantCulture, "The value for '{0}' must not be empty", name); #if DEBUG if (!ModeDetector.InUnitTestRunner()) { Debug.Fail(message); } #endif throw new ArgumentException(message, name); } [AttributeUsage(AttributeTargets.Parameter)] internal sealed class ValidatedNotNullAttribute : Attribute { } } }
using System; using System.Diagnostics; using System.Globalization; using Splat; namespace GitHub { public static class Guard { /// <summary> /// Validates that the string is not empty. /// </summary> /// <param name="value"></param> public static void ArgumentNotEmptyString(string value, string name) { // We already know the value is not null because of NullGuard.Fody. if (!string.IsNullOrWhiteSpace(value)) return; string message = string.Format(CultureInfo.InvariantCulture, "The value for '{0}' must not be empty", name); #if DEBUG if (!ModeDetector.InUnitTestRunner()) { Debug.Fail(message); } #endif throw new ArgumentException("String cannot be empty", name); } [AttributeUsage(AttributeTargets.Parameter)] internal sealed class ValidatedNotNullAttribute : Attribute { } } }
mit
C#
426498a203d65c664829f8a255c5589ea9234782
Fix JSON file locking issue
stevedesmond-ca/dotnet-libyear
src/LibYear.Lib/FileTypes/ProjectJsonFile.cs
src/LibYear.Lib/FileTypes/ProjectJsonFile.cs
using System.Collections.Generic; using System.IO; using System.Linq; using Newtonsoft.Json.Linq; namespace LibYear.Lib.FileTypes { public class ProjectJsonFile : IProjectFile { private string _fileContents; public string FileName { get; } public IDictionary<string, PackageVersion> Packages { get; } private readonly object _lock = new object(); public ProjectJsonFile(string filename) { FileName = filename; _fileContents = File.ReadAllText(FileName); Packages = GetDependencies().ToDictionary(p => ((JProperty)p).Name.ToString(), p => PackageVersion.Parse(((JProperty)p).Value.ToString())); } private IEnumerable<JToken> GetDependencies() { return JObject.Parse(_fileContents).Descendants() .Where(d => d.Type == JTokenType.Property && d.Path.Contains("dependencies") && (!d.Path.Contains("[") || d.Path.EndsWith("]")) && ((JProperty)d).Value.Type == JTokenType.String); } public void Update(IEnumerable<Result> results) { lock (_lock) { foreach (var result in results) { _fileContents = _fileContents.Replace($"\"{result.Name}\": \"{result.Installed.Version}\"", $"\"{result.Name}\": \"{result.Latest.Version}\""); } File.WriteAllText(FileName, _fileContents); } } } }
using System.Collections.Generic; using System.IO; using System.Linq; using Newtonsoft.Json.Linq; namespace LibYear.Lib.FileTypes { public class ProjectJsonFile : IProjectFile { private string _fileContents; public string FileName { get; } public IDictionary<string, PackageVersion> Packages { get; } public ProjectJsonFile(string filename) { FileName = filename; _fileContents = File.ReadAllText(FileName); Packages = GetDependencies().ToDictionary(p => ((JProperty)p).Name.ToString(), p => PackageVersion.Parse(((JProperty)p).Value.ToString())); } private IEnumerable<JToken> GetDependencies() { return JObject.Parse(_fileContents).Descendants() .Where(d => d.Type == JTokenType.Property && d.Path.Contains("dependencies") && (!d.Path.Contains("[") || d.Path.EndsWith("]")) && ((JProperty)d).Value.Type == JTokenType.String); } public void Update(IEnumerable<Result> results) { lock (_fileContents) { foreach (var result in results) _fileContents = _fileContents.Replace($"\"{result.Name}\": \"{result.Installed.Version}\"", $"\"{result.Name}\": \"{result.Latest.Version}\""); File.WriteAllText(FileName, _fileContents); } } } }
mit
C#
235239b3fd81d26b269149c0f6dcf70b5bb77119
Replace `InvocationShape.Method` property with field
ocoanet/moq4,Moq/moq4
src/Moq/InvocationShape.cs
src/Moq/InvocationShape.cs
// Copyright (c) 2007, Clarius Consulting, Manas Technology Solutions, InSTEDD. // All rights reserved. Licensed under the BSD 3-Clause License; see License.txt. using System; using System.Collections.Generic; using System.Linq.Expressions; using System.Reflection; namespace Moq { /// <summary> /// Describes the "shape" of an invocation against which concrete <see cref="Invocation"/>s can be matched. /// </summary> internal readonly struct InvocationShape { public readonly MethodInfo Method; private readonly IMatcher[] argumentMatchers; public InvocationShape(MethodInfo method, IReadOnlyList<Expression> arguments) { this.Method = method; this.argumentMatchers = MatcherFactory.CreateMatchers(arguments, method.GetParameters()); } public InvocationShape(MethodInfo method, IMatcher[] argumentMatchers) { this.Method = method; this.argumentMatchers = argumentMatchers; } public IReadOnlyList<IMatcher> ArgumentMatchers => this.argumentMatchers; public bool IsMatch(Invocation invocation) { var arguments = invocation.Arguments; if (this.argumentMatchers.Length != arguments.Length) { return false; } if (invocation.Method != this.Method && !this.IsOverride(invocation.Method)) { return false; } for (int i = 0, n = this.argumentMatchers.Length; i < n; ++i) { if (this.argumentMatchers[i].Matches(arguments[i]) == false) { return false; } } return true; } private bool IsOverride(MethodInfo invocationMethod) { var method = this.Method; if (!method.DeclaringType.IsAssignableFrom(invocationMethod.DeclaringType)) { return false; } if (!method.Name.Equals(invocationMethod.Name, StringComparison.Ordinal)) { return false; } if (method.ReturnType != invocationMethod.ReturnType) { return false; } if (method.IsGenericMethod || invocationMethod.IsGenericMethod) { if (!method.GetGenericArguments().CompareTo(invocationMethod.GetGenericArguments(), exact: false)) { return false; } } else { if (!invocationMethod.GetParameterTypes().CompareTo(method.GetParameterTypes(), exact: true)) { return false; } } return true; } } }
// Copyright (c) 2007, Clarius Consulting, Manas Technology Solutions, InSTEDD. // All rights reserved. Licensed under the BSD 3-Clause License; see License.txt. using System; using System.Collections.Generic; using System.Linq.Expressions; using System.Reflection; namespace Moq { /// <summary> /// Describes the "shape" of an invocation against which concrete <see cref="Invocation"/>s can be matched. /// </summary> internal readonly struct InvocationShape { private readonly MethodInfo method; private readonly IMatcher[] argumentMatchers; public InvocationShape(MethodInfo method, IReadOnlyList<Expression> arguments) { this.method = method; this.argumentMatchers = MatcherFactory.CreateMatchers(arguments, method.GetParameters()); } public InvocationShape(MethodInfo method, IMatcher[] argumentMatchers) { this.method = method; this.argumentMatchers = argumentMatchers; } public IReadOnlyList<IMatcher> ArgumentMatchers => this.argumentMatchers; public MethodInfo Method => this.method; public bool IsMatch(Invocation invocation) { var arguments = invocation.Arguments; if (this.argumentMatchers.Length != arguments.Length) { return false; } if (invocation.Method != this.method && !this.IsOverride(invocation.Method)) { return false; } for (int i = 0, n = this.argumentMatchers.Length; i < n; ++i) { if (this.argumentMatchers[i].Matches(arguments[i]) == false) { return false; } } return true; } private bool IsOverride(MethodInfo invocationMethod) { var method = this.method; if (!method.DeclaringType.IsAssignableFrom(invocationMethod.DeclaringType)) { return false; } if (!method.Name.Equals(invocationMethod.Name, StringComparison.Ordinal)) { return false; } if (method.ReturnType != invocationMethod.ReturnType) { return false; } if (method.IsGenericMethod || invocationMethod.IsGenericMethod) { if (!method.GetGenericArguments().CompareTo(invocationMethod.GetGenericArguments(), exact: false)) { return false; } } else { if (!invocationMethod.GetParameterTypes().CompareTo(method.GetParameterTypes(), exact: true)) { return false; } } return true; } } }
bsd-3-clause
C#
d14f12075059e0358c39eeccce86079475e93024
Remove unused functions
y-iihoshi/ThScoreFileConverter,y-iihoshi/ThScoreFileConverter
ThScoreFileConverterTests/Models/Th15/Stubs/ClearDataPerGameModeStub.cs
ThScoreFileConverterTests/Models/Th15/Stubs/ClearDataPerGameModeStub.cs
using System.Collections.Generic; using System.Collections.Immutable; using ThScoreFileConverter.Models; using ThScoreFileConverter.Models.Th13; using ThScoreFileConverter.Models.Th15; namespace ThScoreFileConverterTests.Models.Th15.Stubs { internal class ClearDataPerGameModeStub : IClearDataPerGameMode { public ClearDataPerGameModeStub() { this.Cards = ImmutableDictionary<int, ISpellCard<Level>>.Empty; this.ClearCounts = ImmutableDictionary<LevelWithTotal, int>.Empty; this.ClearFlags = ImmutableDictionary<LevelWithTotal, int>.Empty; this.Rankings = ImmutableDictionary<LevelWithTotal, IReadOnlyList<IScoreData>>.Empty; } public IReadOnlyDictionary<int, ISpellCard<Level>> Cards { get; set; } public IReadOnlyDictionary<LevelWithTotal, int> ClearCounts { get; set; } public IReadOnlyDictionary<LevelWithTotal, int> ClearFlags { get; set; } public int PlayTime { get; set; } public IReadOnlyDictionary<LevelWithTotal, IReadOnlyList<IScoreData>> Rankings { get; set; } public int TotalPlayCount { get; set; } } }
using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; using ThScoreFileConverter.Extensions; using ThScoreFileConverter.Models; using ThScoreFileConverter.Models.Th13; using ThScoreFileConverter.Models.Th15; namespace ThScoreFileConverterTests.Models.Th15.Stubs { internal class ClearDataPerGameModeStub : IClearDataPerGameMode { public ClearDataPerGameModeStub() { this.Cards = ImmutableDictionary<int, ISpellCard<Level>>.Empty; this.ClearCounts = ImmutableDictionary<LevelWithTotal, int>.Empty; this.ClearFlags = ImmutableDictionary<LevelWithTotal, int>.Empty; this.Rankings = ImmutableDictionary<LevelWithTotal, IReadOnlyList<IScoreData>>.Empty; } public ClearDataPerGameModeStub(IClearDataPerGameMode clearData) { this.Cards = clearData.Cards.ToDictionary( pair => pair.Key, pair => new Th13.Stubs.SpellCardStub<Level>(pair.Value) as ISpellCard<Level>); this.ClearCounts = clearData.ClearCounts.ToDictionary(); this.ClearFlags = clearData.ClearFlags.ToDictionary(); this.PlayTime = clearData.PlayTime; this.Rankings = clearData.Rankings.ToDictionary( pair => pair.Key, pair => pair.Value.Select(score => new ScoreDataStub(score)).ToList() as IReadOnlyList<IScoreData>); this.TotalPlayCount = clearData.TotalPlayCount; } public IReadOnlyDictionary<int, ISpellCard<Level>> Cards { get; set; } public IReadOnlyDictionary<LevelWithTotal, int> ClearCounts { get; set; } public IReadOnlyDictionary<LevelWithTotal, int> ClearFlags { get; set; } public int PlayTime { get; set; } public IReadOnlyDictionary<LevelWithTotal, IReadOnlyList<IScoreData>> Rankings { get; set; } public int TotalPlayCount { get; set; } } }
bsd-2-clause
C#
d04567127c768ccb331b1e139cee7ba3e8a14e4c
Order DownloadLicenses after Compile
nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke
build/Build.Licenses.cs
build/Build.Licenses.cs
// Copyright 2021 Maintainers of NUKE. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using Nuke.Common; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Nuke.Common.IO; using Nuke.Components; using Serilog; using static Nuke.Common.IO.FileSystemTasks; using static Nuke.Common.IO.HttpTasks; partial class Build { AbsolutePath LicensesDirectory => TemporaryDirectory / "licenses"; IEnumerable<(string Project, string Url)> Licenses => new[] { ("Glob", "https://raw.githubusercontent.com/kthompson/glob/develop/LICENSE"), ("ICSharpCode.SharpZipLib", "https://raw.githubusercontent.com/icsharpcode/SharpZipLib/master/LICENSE.txt"), ("JetBrains.Annotations", "https://raw.githubusercontent.com/JetBrains/JetBrains.Annotations/main/license.md"), ("Microsoft.ApplicationInsights", "https://raw.githubusercontent.com/microsoft/ApplicationInsights-dotnet/main/LICENSE"), ("Microsoft.Build", "https://raw.githubusercontent.com/dotnet/msbuild/main/LICENSE"), ("Microsoft.CodeAnalysis", "https://raw.githubusercontent.com/dotnet/roslyn/main/License.txt"), ("Newtonsoft.Json", "https://raw.githubusercontent.com/JamesNK/Newtonsoft.Json/master/LICENSE.md"), ("NuGet", "https://raw.githubusercontent.com/NuGet/NuGet.Client/dev/LICENSE.txt"), ("Octokit", "https://raw.githubusercontent.com/octokit/octokit.net/main/LICENSE.txt"), ("Serilog", "https://raw.githubusercontent.com/serilog/serilog/dev/LICENSE"), ("YamlDotNet", "https://raw.githubusercontent.com/aaubry/YamlDotNet/master/LICENSE.txt") }; Target DownloadLicenses => _ => _ .After<ICompile>() .DependentFor<IPack>() .Executes(() => { EnsureCleanDirectory(LicensesDirectory); var downloadTasks = Licenses.Select(async x => { await HttpDownloadFileAsync(x.Url, LicensesDirectory / $"{x.Project}.txt"); Log.Information("Downloaded license for {Project}", x.Project); }); Task.WaitAll(downloadTasks.ToArray()); }); }
// Copyright 2021 Maintainers of NUKE. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using Nuke.Common; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Nuke.Common.IO; using Nuke.Components; using Serilog; using static Nuke.Common.IO.FileSystemTasks; using static Nuke.Common.IO.HttpTasks; partial class Build { AbsolutePath LicensesDirectory => TemporaryDirectory / "licenses"; IEnumerable<(string Project, string Url)> Licenses => new[] { ("Glob", "https://raw.githubusercontent.com/kthompson/glob/develop/LICENSE"), ("ICSharpCode.SharpZipLib", "https://raw.githubusercontent.com/icsharpcode/SharpZipLib/master/LICENSE.txt"), ("JetBrains.Annotations", "https://raw.githubusercontent.com/JetBrains/JetBrains.Annotations/main/license.md"), ("Microsoft.ApplicationInsights", "https://raw.githubusercontent.com/microsoft/ApplicationInsights-dotnet/main/LICENSE"), ("Microsoft.Build", "https://raw.githubusercontent.com/dotnet/msbuild/main/LICENSE"), ("Microsoft.CodeAnalysis", "https://raw.githubusercontent.com/dotnet/roslyn/main/License.txt"), ("Newtonsoft.Json", "https://raw.githubusercontent.com/JamesNK/Newtonsoft.Json/master/LICENSE.md"), ("NuGet", "https://raw.githubusercontent.com/NuGet/NuGet.Client/dev/LICENSE.txt"), ("Octokit", "https://raw.githubusercontent.com/octokit/octokit.net/main/LICENSE.txt"), ("Serilog", "https://raw.githubusercontent.com/serilog/serilog/dev/LICENSE"), ("YamlDotNet", "https://raw.githubusercontent.com/aaubry/YamlDotNet/master/LICENSE.txt") }; Target DownloadLicenses => _ => _ .Before<ICompile>() .DependentFor<IPack>() .Executes(() => { EnsureCleanDirectory(LicensesDirectory); var downloadTasks = Licenses.Select(async x => { await HttpDownloadFileAsync(x.Url, LicensesDirectory / $"{x.Project}.txt"); Log.Information("Downloaded license for {Project}", x.Project); }); Task.WaitAll(downloadTasks.ToArray()); }); }
mit
C#
f0558a7b59d2a5904176a69f57834ca639d4850b
Add example for state init option to quick-start guide example project.
Learnosity/learnosity-sdk-asp.net,Learnosity/learnosity-sdk-asp.net,Learnosity/learnosity-sdk-asp.net
LearnosityDemo/Pages/ItemsAPIDemo.cshtml.cs
LearnosityDemo/Pages/ItemsAPIDemo.cshtml.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using LearnositySDK.Request; using LearnositySDK.Utils; // static LearnositySDK.Credentials; namespace LearnosityDemo.Pages { public class ItemsAPIDemoModel : PageModel { public void OnGet() { // prepare all the params string service = "items"; JsonObject security = new JsonObject(); security.set("consumer_key", LearnositySDK.Credentials.ConsumerKey); security.set("domain", LearnositySDK.Credentials.Domain); security.set("user_id", Uuid.generate()); string secret = LearnositySDK.Credentials.ConsumerSecret; JsonObject request = new JsonObject(); request.set("user_id", Uuid.generate()); request.set("activity_template_id", "quickstart_examples_activity_template_001"); request.set("session_id", Uuid.generate()); request.set("activity_id", "quickstart_examples_activity_001"); request.set("rendering_type", "assess"); request.set("type", "submit_practice"); request.set("name", "Items API Quickstart"); request.set("state", "initial"); // Instantiate Init class Init init = new Init(service, security, secret, request); // Call the generate() method to retrieve a JavaScript object ViewData["InitJSON"] = init.generate(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using LearnositySDK.Request; using LearnositySDK.Utils; // static LearnositySDK.Credentials; namespace LearnosityDemo.Pages { public class ItemsAPIDemoModel : PageModel { public void OnGet() { // prepare all the params string service = "items"; JsonObject security = new JsonObject(); security.set("consumer_key", LearnositySDK.Credentials.ConsumerKey); security.set("domain", LearnositySDK.Credentials.Domain); security.set("user_id", Uuid.generate()); string secret = LearnositySDK.Credentials.ConsumerSecret; //JsonObject config = new JsonObject(); JsonObject request = new JsonObject(); request.set("user_id", Uuid.generate()); request.set("activity_template_id", "quickstart_examples_activity_template_001"); request.set("session_id", Uuid.generate()); request.set("activity_id", "quickstart_examples_activity_001"); request.set("rendering_type", "assess"); request.set("type", "submit_practice"); request.set("name", "Items API Quickstart"); //request.set("config", config); // Instantiate Init class Init init = new Init(service, security, secret, request); // Call the generate() method to retrieve a JavaScript object ViewData["InitJSON"] = init.generate(); } } }
apache-2.0
C#
756b65d2ea4559f09a71ac7480c5b844a33814d9
Add test case to test StartDateEndDateFinder
wongjiahau/TTAP-UTAR,wongjiahau/TTAP-UTAR
NUnit.Tests2/Test_StartDateEndDateFinder.cs
NUnit.Tests2/Test_StartDateEndDateFinder.cs
using NUnit.Framework; using System; using System.IO; using Time_Table_Arranging_Program; using Time_Table_Arranging_Program.Class; namespace NUnit.Tests2 { [TestFixture] public class Test_StartDateEndDateFinder { string input1 = Helper.RawStringOfTestFile("SampleData-FAM-2017-2ndSem.html"); string input2 = Helper.RawStringOfTestFile("SampleData-FCI-2017-2ndSem.html"); string input3 = Helper.RawStringOfTestFile("Sample HTML.html"); [Test] public void Test_StartDateEndDateFinder_GetStartDate1() { var parser = new StartDateEndDateFinder(input1); Assert.True(parser.GetStartDate() == new DateTime(2017 , 10 , 16 , 0 , 0 , 0)); } [Test] public void Test_StartDateEndDateFinder_GetStartDate2() { var parser = new StartDateEndDateFinder(input2); Assert.True(parser.GetStartDate() == new DateTime(2017, 10, 16, 0, 0, 0)); } [Test] public void Test_StartDateEndDateFinder_GetStartDate3() { var parser = new StartDateEndDateFinder(input3); Assert.True(parser.GetStartDate() == new DateTime(2017, 5, 29, 0, 0, 0)); } [Test] public void Test_StartDateEndDateFinder_GetEndDate1() { var parser = new StartDateEndDateFinder(input1); Assert.True(parser.GetEndDate() == new DateTime(2017, 12, 3, 0, 0, 0)); } [Test] public void Test_StartDateEndDateFinder_GetEndDate2() { var parser = new StartDateEndDateFinder(input2); Assert.True(parser.GetEndDate() == new DateTime(2017, 12, 3, 0, 0, 0)); } [Test] public void Test_StartDateEndDateFinder_GetEndDate3() { var parser = new StartDateEndDateFinder(input3); Assert.True(parser.GetEndDate() == new DateTime(2017, 9, 3, 0, 0, 0)); } } }
using NUnit.Framework; using System; using System.IO; using Time_Table_Arranging_Program; using Time_Table_Arranging_Program.Class; namespace NUnit.Tests2 { [TestFixture] public class Test_StartDateEndDateFinder { string input = Helper.RawStringOfTestFile("SampleData-FAM-2017-2ndSem.html"); [Test] public void Test_StartDateEndDateFinder_GetStartDate() { var parser = new StartDateEndDateFinder(input); Assert.True(parser.GetStartDate() == new DateTime(2017 , 10 , 16 , 0 , 0 , 0)); } [Test] public void Test_StartDateEndDateFinder_GetEndDate() { var parser = new StartDateEndDateFinder(input); Assert.True(parser.GetEndDate() == new DateTime(2017, 12, 3, 0, 0, 0)); } } }
agpl-3.0
C#
8a956c8a70c1bd1a721d28ab75872d71ed6f1ed2
make sure we don't pass bad data to clipboard.
mmoening/agg-sharp,larsbrubaker/agg-sharp,mmoening/agg-sharp,MatterHackers/agg-sharp,mmoening/agg-sharp,jlewin/agg-sharp
Gui/Clipboard/Clipboard.cs
Gui/Clipboard/Clipboard.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MatterHackers.Agg.UI { public static class Clipboard { private static ISystemClipboard clipboard { get; set; } public static bool IsInitialized { get { return clipboard != null; } } public static String GetText() { return clipboard.GetText(); } public static void SetText(string text) { if (text != null && text != "") { clipboard.SetText(text); } } public static bool ContainsText() { return clipboard.ContainsText(); } public static void SetSystemClipboard(ISystemClipboard clipBoard) { clipboard = clipBoard; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MatterHackers.Agg.UI { public static class Clipboard { private static ISystemClipboard clipboard { get; set; } public static bool IsInitialized { get { return clipboard != null; } } public static String GetText() { return clipboard.GetText(); } public static void SetText(string text) { clipboard.SetText(text); } public static bool ContainsText() { return clipboard.ContainsText(); } public static void SetSystemClipboard(ISystemClipboard clipBoard) { clipboard = clipBoard; } } }
bsd-2-clause
C#
3c0724cc734cadca28b4c3c97512c33d20aaa844
implement yes and games url
YesAndGames/four-friends
Assets/Scripts/StateManagement/MainMenu.cs
Assets/Scripts/StateManagement/MainMenu.cs
using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; /// <summary> /// Manages the main menu state. /// </summary> public class MainMenu : IGameState { /// <summary> /// Initialize this component. /// </summary> public override void OnInitializeState () { base.OnInitializeState (); AddHideableElement ("Sqwad", false); EventSystem.current.firstSelectedGameObject = GuiCanvas.transform.Find ("Buttons Container/Play Button").gameObject; } /// <summary> /// Called when the user presses the play button. /// </summary> public void OnPressPlayButton () { HideGUIElement ("Sqwad"); EventSystem.current.SetSelectedGameObject (null); SetAllButtonsEnabled (false); } /// <summary> /// Called when the user presses the other games button. /// </summary> public void OnPressOtherGamesButton () { Application.OpenURL ("http://yesandgames.com"); } /// <summary> /// Called when play begins. /// </summary> public void OnBeginPlay () { Manager.PushState ("Gameplay"); } /// <summary> /// Sets whether or not the buttons on this screen are enabled. /// </summary> private void SetAllButtonsEnabled (bool enabled) { Button[] buttons = GuiCanvas.gameObject.GetComponentsInChildren<Button> (); for (int i = 0; i < buttons.Length; i++) { buttons [i].interactable = enabled; } } }
using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; /// <summary> /// Manages the main menu state. /// </summary> public class MainMenu : IGameState { /// <summary> /// Initialize this component. /// </summary> public override void OnInitializeState () { base.OnInitializeState (); AddHideableElement ("Sqwad", false); EventSystem.current.firstSelectedGameObject = GuiCanvas.transform.Find ("Buttons Container/Play Button").gameObject; } /// <summary> /// Called when the user presses the play button. /// </summary> public void OnPressPlayButton () { HideGUIElement ("Sqwad"); EventSystem.current.SetSelectedGameObject (null); SetAllButtonsEnabled (false); } /// <summary> /// Called when play begins. /// </summary> public void OnBeginPlay () { Manager.PushState ("Gameplay"); } /// <summary> /// Sets whether or not the buttons on this screen are enabled. /// </summary> private void SetAllButtonsEnabled (bool enabled) { Button[] buttons = GuiCanvas.gameObject.GetComponentsInChildren<Button> (); for (int i = 0; i < buttons.Length; i++) { buttons [i].interactable = enabled; } } }
mit
C#
dc3c4915b91581c482d2f005217f6f2e7d29b1db
add missing metadata for release
alexvictoor/BrowserLog,alexvictoor/BrowserLog,alexvictoor/BrowserLog
BrowserLog.NLog/Properties/AssemblyInfo.cs
BrowserLog.NLog/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("BrowserLog.NLog")] [assembly: AssemblyDescription("NLog appender based on HTML5 SSE")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Alexandre Victoor")] [assembly: AssemblyProduct("BrowserLog.NLog")] [assembly: AssemblyCopyright("Copyright © 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("f766f2f5-075c-432f-b195-0bf240826c9e")] // 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.0.0")] [assembly: AssemblyFileVersion("1.4.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("BrowserLog.NLog")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BrowserLog.NLog")] [assembly: AssemblyCopyright("Copyright © 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("f766f2f5-075c-432f-b195-0bf240826c9e")] // 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.0.0")] [assembly: AssemblyFileVersion("1.4.0.0")]
apache-2.0
C#
80eec6c020d3f87dda8c6facaecd340acd23d351
Add caching key secrets
patchkit-net/patchkit-patcher-unity,patchkit-net/patchkit-patcher-unity,mohsansaleem/patchkit-patcher-unity,mohsansaleem/patchkit-patcher-unity,patchkit-net/patchkit-patcher-unity,patchkit-net/patchkit-patcher-unity
src/Assets/Scripts/Licensing/KeyLicenseValidator.cs
src/Assets/Scripts/Licensing/KeyLicenseValidator.cs
using System.Net; using PatchKit.Api; using UnityEngine; namespace PatchKit.Unity.Patcher.Licensing { public class KeyLicenseValidator : ILicenseValidator { private readonly KeysApiConnection _keysApiConnection; private readonly string _appSecret; public KeyLicenseValidator(string appSecret, KeysApiConnection keysApiConnection) { _appSecret = appSecret; _keysApiConnection = keysApiConnection; } private string GetAndDeleteCachedKeySecret(string key) { string keySecret = PlayerPrefs.GetString("PatchKit-" + key + "-KeySecret", null); PlayerPrefs.DeleteKey("PatchKit-" + key + "-KeySecret"); return keySecret } private void SaveCachedKeySecret(string key, string keySecret) { PlayerPrefs.SetString("PatchKit-" + key + "-KeySecret", keySecret); PlayerPrefs.Save(); } public string Validate(ILicense license) { if (license is KeyLicense) { var keyLicense = (KeyLicense) license; try { string keySecret = GetAndDeleteCachedKeySecret(keyLicense.Key); var licenseKey = _keysApiConnection.GetKeyInfo(keyLicense.Key, _appSecret, keySecret); SaveCachedKeySecret(keyLicense.Key, licenseKey.KeySecret); return licenseKey.KeySecret; } catch (WebException webException) { if (webException.Response is HttpWebResponse && (webException.Response as HttpWebResponse).StatusCode == HttpStatusCode.Forbidden) { return null; } } catch (ApiResponseException apiResponseException) { if (apiResponseException.StatusCode == 404) { return null; } throw; } } return null; } } }
using System.Net; using PatchKit.Api; namespace PatchKit.Unity.Patcher.Licensing { public class KeyLicenseValidator : ILicenseValidator { private readonly KeysApiConnection _keysApiConnection; private readonly string _appSecret; public KeyLicenseValidator(string appSecret, KeysApiConnection keysApiConnection) { _appSecret = appSecret; _keysApiConnection = keysApiConnection; } public string Validate(ILicense license) { if (license is KeyLicense) { var keyLicense = (KeyLicense) license; try { var licenseKey = _keysApiConnection.GetKeyInfo(keyLicense.Key, _appSecret); return licenseKey.KeySecret; } catch (WebException webException) { if (webException.Response is HttpWebResponse && (webException.Response as HttpWebResponse).StatusCode == HttpStatusCode.Forbidden) { return null; } } catch (ApiResponseException apiResponseException) { if (apiResponseException.StatusCode == 404) { return null; } throw; } } return null; } } }
mit
C#
7ac6b9011d9d0b5685de721d79097876c3283f86
Change doc comment
heejaechang/roslyn,MichalStrehovsky/roslyn,KirillOsenkov/roslyn,diryboy/roslyn,paulvanbrenk/roslyn,xasx/roslyn,KevinRansom/roslyn,lorcanmooney/roslyn,paulvanbrenk/roslyn,jkotas/roslyn,VSadov/roslyn,aelij/roslyn,tvand7093/roslyn,tmat/roslyn,mattscheffer/roslyn,mattscheffer/roslyn,stephentoub/roslyn,agocke/roslyn,orthoxerox/roslyn,tvand7093/roslyn,CaptainHayashi/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn,genlu/roslyn,cston/roslyn,AlekseyTs/roslyn,tmeschter/roslyn,AmadeusW/roslyn,OmarTawfik/roslyn,bkoelman/roslyn,Hosch250/roslyn,khyperia/roslyn,gafter/roslyn,mavasani/roslyn,mgoertz-msft/roslyn,orthoxerox/roslyn,Hosch250/roslyn,reaction1989/roslyn,dpoeschl/roslyn,nguerrera/roslyn,aelij/roslyn,srivatsn/roslyn,stephentoub/roslyn,jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,xasx/roslyn,xasx/roslyn,diryboy/roslyn,Giftednewt/roslyn,mmitche/roslyn,abock/roslyn,davkean/roslyn,jmarolf/roslyn,heejaechang/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,AdamSpeight2008/roslyn-AdamSpeight2008,tmeschter/roslyn,bkoelman/roslyn,shyamnamboodiripad/roslyn,tmeschter/roslyn,mmitche/roslyn,aelij/roslyn,DustinCampbell/roslyn,wvdd007/roslyn,orthoxerox/roslyn,mmitche/roslyn,OmarTawfik/roslyn,mavasani/roslyn,srivatsn/roslyn,tvand7093/roslyn,tannergooding/roslyn,jcouv/roslyn,mavasani/roslyn,gafter/roslyn,paulvanbrenk/roslyn,ErikSchierboom/roslyn,jasonmalinowski/roslyn,panopticoncentral/roslyn,jamesqo/roslyn,MattWindsor91/roslyn,khyperia/roslyn,pdelvo/roslyn,bartdesmet/roslyn,CyrusNajmabadi/roslyn,panopticoncentral/roslyn,dotnet/roslyn,khyperia/roslyn,cston/roslyn,dpoeschl/roslyn,weltkante/roslyn,jasonmalinowski/roslyn,jkotas/roslyn,KevinRansom/roslyn,davkean/roslyn,tmat/roslyn,MichalStrehovsky/roslyn,weltkante/roslyn,ErikSchierboom/roslyn,jamesqo/roslyn,MattWindsor91/roslyn,jkotas/roslyn,jcouv/roslyn,CaptainHayashi/roslyn,panopticoncentral/roslyn,tmat/roslyn,lorcanmooney/roslyn,reaction1989/roslyn,DustinCampbell/roslyn,shyamnamboodiripad/roslyn,lorcanmooney/roslyn,Hosch250/roslyn,pdelvo/roslyn,AlekseyTs/roslyn,gafter/roslyn,wvdd007/roslyn,sharwell/roslyn,swaroop-sridhar/roslyn,AmadeusW/roslyn,davkean/roslyn,AlekseyTs/roslyn,physhi/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,brettfo/roslyn,wvdd007/roslyn,tannergooding/roslyn,agocke/roslyn,physhi/roslyn,MichalStrehovsky/roslyn,swaroop-sridhar/roslyn,abock/roslyn,brettfo/roslyn,VSadov/roslyn,diryboy/roslyn,eriawan/roslyn,reaction1989/roslyn,eriawan/roslyn,jmarolf/roslyn,KirillOsenkov/roslyn,nguerrera/roslyn,stephentoub/roslyn,KevinRansom/roslyn,ErikSchierboom/roslyn,MattWindsor91/roslyn,jmarolf/roslyn,eriawan/roslyn,physhi/roslyn,AmadeusW/roslyn,weltkante/roslyn,dpoeschl/roslyn,dotnet/roslyn,Giftednewt/roslyn,srivatsn/roslyn,nguerrera/roslyn,DustinCampbell/roslyn,KirillOsenkov/roslyn,Giftednewt/roslyn,pdelvo/roslyn,OmarTawfik/roslyn,CyrusNajmabadi/roslyn,jcouv/roslyn,swaroop-sridhar/roslyn,sharwell/roslyn,genlu/roslyn,abock/roslyn,brettfo/roslyn,jamesqo/roslyn,dotnet/roslyn,heejaechang/roslyn,genlu/roslyn,agocke/roslyn,mgoertz-msft/roslyn,mgoertz-msft/roslyn,mattscheffer/roslyn,bkoelman/roslyn,cston/roslyn,VSadov/roslyn,tannergooding/roslyn,MattWindsor91/roslyn,CaptainHayashi/roslyn,sharwell/roslyn,bartdesmet/roslyn
src/Compilers/Core/Portable/Operations/IArgument.cs
src/Compilers/Core/Portable/Operations/IArgument.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. namespace Microsoft.CodeAnalysis.Semantics { /// <summary> /// Represents an argument in a method invocation. /// </summary> /// <remarks> /// This interface is reserved for implementation by its associated APIs. We reserve the right to /// change it in the future. /// </remarks> public interface IArgument : IOperation { /// <summary> /// Kind of argument. /// </summary> ArgumentKind ArgumentKind { get; } /// <summary> /// Parameter the argument matches. /// </summary> IParameterSymbol Parameter { get; } /// <summary> /// Value supplied for the argument. /// </summary> IOperation Value { get; } /// <summary> /// Information of the conversion applied to the argument value passing it into the target method. Applicable only to VB Reference arguments. /// </summary> Optional<CommonConversion> InConversion { get; } /// <summary> /// Information of the conversion applied to the argument value after the invocation. Applicable only to VB Reference arguments. /// </summary> Optional<CommonConversion> OutConversion { get; } } }
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. namespace Microsoft.CodeAnalysis.Semantics { /// <summary> /// Represents an argument in a method invocation. /// </summary> /// <remarks> /// This interface is reserved for implementation by its associated APIs. We reserve the right to /// change it in the future. /// </remarks> public interface IArgument : IOperation { /// <summary> /// Kind of argument. /// </summary> ArgumentKind ArgumentKind { get; } /// <summary> /// Parameter the argument matches. /// </summary> IParameterSymbol Parameter { get; } /// <summary> /// Value supplied for the argument. /// </summary> IOperation Value { get; } /// <summary> /// Conversion applied to the argument value passing it into the target method. Applicable only to VB Reference arguments. /// </summary> Optional<CommonConversion> InConversion { get; } /// <summary> /// Conversion applied to the argument value after the invocation. Applicable only to VB Reference arguments. /// </summary> Optional<CommonConversion> OutConversion { get; } } }
mit
C#