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
0d80504321db98483ea72d06851c6bcfb5888c30
Improve readability
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi.Gui/Controls/QrEncoder/Masking/Pattern7.cs
WalletWasabi.Gui/Controls/QrEncoder/Masking/Pattern7.cs
using System; namespace Gma.QrCodeNet.Encoding.Masking { internal class Pattern7 : Pattern { public override bool this[int i, int j] { get { return (((i * j) % 3) + (((i + j) % 2) % 2)) == 0; } set { throw new NotSupportedException(); } } public override MaskPatternType MaskPatternType { get { return MaskPatternType.Type7; } } } }
using System; namespace Gma.QrCodeNet.Encoding.Masking { internal class Pattern7 : Pattern { public override bool this[int i, int j] { get { return ((((i * j) % 3) + (((i + j) % 2)) % 2)) == 0; } set { throw new NotSupportedException(); } } public override MaskPatternType MaskPatternType { get { return MaskPatternType.Type7; } } } }
mit
C#
90123d0bd494ce152e8a612855134b00b243c0ed
update assembly info
matrostik/SQLitePCL.pretty,bordoley/SQLitePCL.pretty
SQLitePCL.pretty.Orm/Properties/AssemblyInfo.cs
SQLitePCL.pretty.Orm/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; // Information about this assembly is defined by the following attributes. // Change them to the values specific to your project. [assembly: AssemblyTitle("SQLitePCL.pretty.Orm")] [assembly: AssemblyDescription("An ORM for SQLitePCL.pretty")] [assembly: AssemblyProduct("SQLitePCL.pretty")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyVersion("0.0.12")] [assembly: AssemblyFileVersion("0.0.12")] [assembly: InternalsVisibleTo("SQLitePCL.pretty.tests")]
using System.Reflection; using System.Runtime.CompilerServices; // Information about this assembly is defined by the following attributes. // Change them to the values specific to your project. [assembly: AssemblyTitle("SQLitePCL.pretty.Orm")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("")] [assembly: AssemblyCopyright("dave")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}". // The form "{Major}.{Minor}.*" will automatically update the build and revision, // and "{Major}.{Minor}.{Build}.*" will update just the revision. [assembly: AssemblyVersion("1.0.*")] // The following attributes are used to specify the signing key for the assembly, // if desired. See the Mono documentation for more information about signing. //[assembly: AssemblyDelaySign(false)] //[assembly: AssemblyKeyFile("")] [assembly: InternalsVisibleTo("SQLitePCL.pretty.tests")]
apache-2.0
C#
2016d8e56bb0dba1d05bc86a1220387f0e89dae7
Update AddingBordersToCells.cs
asposecells/Aspose_Cells_NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET
Examples/CSharp/Formatting/Borders/AddingBordersToCells.cs
Examples/CSharp/Formatting/Borders/AddingBordersToCells.cs
using System.IO; using Aspose.Cells; using System.Drawing; namespace Aspose.Cells.Examples.Formatting.Borders { public class AddingBordersToCells { public static void Main(string[] args) { //ExStart:1 // The path to the documents directory. string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // Create directory if it is not already present. bool IsExists = System.IO.Directory.Exists(dataDir); if (!IsExists) System.IO.Directory.CreateDirectory(dataDir); //Instantiating a Workbook object Workbook workbook = new Workbook(); //Obtaining the reference of the first (default) worksheet by passing its sheet index Worksheet worksheet = workbook.Worksheets[0]; //Accessing the "A1" cell from the worksheet Aspose.Cells.Cell cell = worksheet.Cells["A1"]; //Adding some value to the "A1" cell cell.PutValue("Visit Aspose!"); //Create a style object Style style = cell.GetStyle(); //Setting the line style of the top border style.Borders[BorderType.TopBorder].LineStyle = CellBorderType.Thick; //Setting the color of the top border style.Borders[BorderType.TopBorder].Color = Color.Black; //Setting the line style of the bottom border style.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Thick; //Setting the color of the bottom border style.Borders[BorderType.BottomBorder].Color = Color.Black; //Setting the line style of the left border style.Borders[BorderType.LeftBorder].LineStyle = CellBorderType.Thick; //Setting the color of the left border style.Borders[BorderType.LeftBorder].Color = Color.Black; //Setting the line style of the right border style.Borders[BorderType.RightBorder].LineStyle = CellBorderType.Thick; //Setting the color of the right border style.Borders[BorderType.RightBorder].Color = Color.Black; //Apply the border styles to the cell cell.SetStyle(style); //Saving the Excel file workbook.Save(dataDir + "book1.out.xls"); //ExEnd:1 } } }
using System.IO; using Aspose.Cells; using System.Drawing; namespace Aspose.Cells.Examples.Formatting.Borders { public class AddingBordersToCells { public static void Main(string[] args) { // The path to the documents directory. string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // Create directory if it is not already present. bool IsExists = System.IO.Directory.Exists(dataDir); if (!IsExists) System.IO.Directory.CreateDirectory(dataDir); //Instantiating a Workbook object Workbook workbook = new Workbook(); //Obtaining the reference of the first (default) worksheet by passing its sheet index Worksheet worksheet = workbook.Worksheets[0]; //Accessing the "A1" cell from the worksheet Aspose.Cells.Cell cell = worksheet.Cells["A1"]; //Adding some value to the "A1" cell cell.PutValue("Visit Aspose!"); //Create a style object Style style = cell.GetStyle(); //Setting the line style of the top border style.Borders[BorderType.TopBorder].LineStyle = CellBorderType.Thick; //Setting the color of the top border style.Borders[BorderType.TopBorder].Color = Color.Black; //Setting the line style of the bottom border style.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Thick; //Setting the color of the bottom border style.Borders[BorderType.BottomBorder].Color = Color.Black; //Setting the line style of the left border style.Borders[BorderType.LeftBorder].LineStyle = CellBorderType.Thick; //Setting the color of the left border style.Borders[BorderType.LeftBorder].Color = Color.Black; //Setting the line style of the right border style.Borders[BorderType.RightBorder].LineStyle = CellBorderType.Thick; //Setting the color of the right border style.Borders[BorderType.RightBorder].Color = Color.Black; //Apply the border styles to the cell cell.SetStyle(style); //Saving the Excel file workbook.Save(dataDir + "book1.out.xls"); } } }
mit
C#
d1cec7ada526069ded7298ee6995c0e647fec5af
Fix reference to ClientSeedSource
RonnChyran/snowflake,SnowflakePowered/snowflake,RonnChyran/snowflake,SnowflakePowered/snowflake,SnowflakePowered/snowflake,RonnChyran/snowflake
src/Snowflake.Support.Scraping.Primitives/ResultCuller.cs
src/Snowflake.Support.Scraping.Primitives/ResultCuller.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Snowflake.Extensibility; using Snowflake.Scraping; using Snowflake.Scraping.Extensibility; using Snowflake.Support.Scraping.Primitives.Utility; using F23.StringSimilarity; namespace Snowflake.Support.Scraping.Primitives { [Plugin("ScrapingPrimitives-Culler")] public class ResultCuller : Culler { public ResultCuller() : base(typeof(ResultCuller), "result") { this.Comparator = new Jaccard(3); } public Jaccard Comparator { get; } public override IEnumerable<ISeed> Filter(IEnumerable<ISeed> seedsToTrim, ISeedRootContext context) { var clientResult = seedsToTrim.FirstOrDefault(s => s.Source == IScrapeContext.ClientSeedSource); if (clientResult != null) { yield return clientResult; yield break; } var crc32Results = seedsToTrim.Where(s => context[s.Parent]?.Content.Type == "search_crc32"); var mostDetailedCrc32 = crc32Results.OrderByDescending(s => context.GetChildren(s).Count()).FirstOrDefault(); var mostDetailedTitle = (from seed in seedsToTrim let parent = context[seed.Parent] where parent?.Content.Type == "search_title" let title = context.GetChildren(seed).FirstOrDefault(s => s.Content.Type == "title") where title != null let r = title.Content.Value let distance = this.Comparator.Distance(r.NormalizeTitle(), parent?.Content.Value.NormalizeTitle()) orderby distance ascending, context.GetChildren(seed).Count() descending select seed).FirstOrDefault(); yield return (from seed in new[] {mostDetailedCrc32, mostDetailedTitle} orderby context.GetChildren(seed).Count() descending select seed).FirstOrDefault(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Snowflake.Extensibility; using Snowflake.Scraping; using Snowflake.Scraping.Extensibility; using Snowflake.Support.Scraping.Primitives.Utility; using F23.StringSimilarity; namespace Snowflake.Support.Scraping.Primitives { [Plugin("ScrapingPrimitives-Culler")] public class ResultCuller : Culler { public ResultCuller() : base(typeof(ResultCuller), "result") { this.Comparator = new Jaccard(3); } public Jaccard Comparator { get; } public override IEnumerable<ISeed> Filter(IEnumerable<ISeed> seedsToTrim, ISeedRootContext context) { var clientResult = seedsToTrim.FirstOrDefault(s => s.Source == GameScrapeContext.ClientSeedSource); if (clientResult != null) { yield return clientResult; yield break; } var crc32Results = seedsToTrim.Where(s => context[s.Parent]?.Content.Type == "search_crc32"); var mostDetailedCrc32 = crc32Results.OrderByDescending(s => context.GetChildren(s).Count()).FirstOrDefault(); var mostDetailedTitle = (from seed in seedsToTrim let parent = context[seed.Parent] where parent?.Content.Type == "search_title" let title = context.GetChildren(seed).FirstOrDefault(s => s.Content.Type == "title") where title != null let r = title.Content.Value let distance = this.Comparator.Distance(r.NormalizeTitle(), parent?.Content.Value.NormalizeTitle()) orderby distance ascending, context.GetChildren(seed).Count() descending select seed).FirstOrDefault(); yield return (from seed in new[] {mostDetailedCrc32, mostDetailedTitle} orderby context.GetChildren(seed).Count() descending select seed).FirstOrDefault(); } } }
mpl-2.0
C#
56d719aeb4749126781ac418bec58e71240cb964
create user
fgNv/GSDRequirementsCSharp,fgNv/GSDRequirementsCSharp,fgNv/GSDRequirementsCSharp
GSDRequirementsCSharp.Persistence/Commands/Users/SaveUserCommand/CreateUserCommandHandler.cs
GSDRequirementsCSharp.Persistence/Commands/Users/SaveUserCommand/CreateUserCommandHandler.cs
using GSDRequirementsCSharp.Infrastructure; using GSDRequirementsCSharp.Infrastructure.CQS; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace GSDRequirementsCSharp.Persistence.Commands.Users.SaveUserCommand { public class CreateUserCommandHandler : ICommandHandler<CreateUserCommand> { private readonly IRepository<User, Guid> _userRepository; private readonly IRepository<Contact, Guid> _contactRepository; public CreateUserCommandHandler(IRepository<User, Guid> userRepository, IRepository<Contact, Guid> contactRepository) { _userRepository = userRepository; _contactRepository = contactRepository; } public void Handle(CreateUserCommand command) { var user = new User(); user.id = command.Id; user.login = command.Login; user.password = command.Password; var contact = new Contact(); contact.email = command.Email; contact.id = command.Id; contact.mobilePhone = command.MobilePhone; contact.name = command.Name; contact.phone = command.Phone; user.Contact = contact; _contactRepository.Add(contact); _userRepository.Add(user); } } }
using GSDRequirementsCSharp.Infrastructure; using GSDRequirementsCSharp.Infrastructure.CQS; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace GSDRequirementsCSharp.Persistence.Commands.Users.SaveUserCommand { public class CreateUserCommandHandler : ICommandHandler<CreateUserCommand> { private readonly IRepository<User, Guid> _userRepository; private readonly IRepository<Contact, Guid> _contactRepository; public CreateUserCommandHandler(IRepository<User, Guid> userRepository, IRepository<Contact, Guid> contactRepository) { _userRepository = userRepository; _userRepository = userRepository; } public void Handle(CreateUserCommand command) { var _repository } } }
bsd-2-clause
C#
1ce20ab81d73d998621143fdbac4149630ab9f4b
Update S40 token
kienct89/Chat-API-NET,almone/Chat-API-NET,andrebires/Chat-API-NET,JulioImolesi/Chat-API-NET,ProducJeffer/Chat-API-NET,mgp25/Chat-API-NET,shekohex/Chat-API-NET,rvriens/Chat-API-NET,blachshma/Chat-API-NET,mgp25/Chat-API-NET,rvriens/Chat-API-NET,mgp25/Chat-API-NET,andrebires/Chat-API-NET,andrebires/Chat-API-NET,rvriens/Chat-API-NET
WhatsAppApi/Register/WaToken.cs
WhatsAppApi/Register/WaToken.cs
using System; using System.Collections.Generic; using System.Linq; using System.Security.Cryptography; using System.Text; namespace WhatsAppApi.Register { class WaToken { public static string GenerateToken(string number) { string token = "PdA2DJyKoUrwLw1Bg6EIhzh502dF9noR9uFCllGk1439921717185"+number; byte[] asciiBytes = ASCIIEncoding.ASCII.GetBytes(token); byte[] hashedBytes = MD5CryptoServiceProvider.Create().ComputeHash(asciiBytes); return BitConverter.ToString(hashedBytes).Replace("-", "").ToLower(); } private static List<byte> GetFilledList(byte item, int length) { List<byte> result = new List<byte>(); for (int i = 0; i < length; i++) { result.Add(item); } return result; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Security.Cryptography; using System.Text; namespace WhatsAppApi.Register { class WaToken { public static string GenerateToken(string number) { string token = "PdA2DJyKoUrwLw1Bg6EIhzh502dF9noR9uFCllGk1430860548912"+number; byte[] asciiBytes = ASCIIEncoding.ASCII.GetBytes(token); byte[] hashedBytes = MD5CryptoServiceProvider.Create().ComputeHash(asciiBytes); return BitConverter.ToString(hashedBytes).Replace("-", "").ToLower(); } private static List<byte> GetFilledList(byte item, int length) { List<byte> result = new List<byte>(); for (int i = 0; i < length; i++) { result.Add(item); } return result; } } }
mit
C#
f3b66ff6afa88b5a6033893482a7094ffc409099
Add comment
60071jimmy/UartOscilloscope,60071jimmy/UartOscilloscope
QueueDataGraphic/QueueDataGraphic/CSharpFiles/DataQueue.cs
QueueDataGraphic/QueueDataGraphic/CSharpFiles/DataQueue.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace QueueDataGraphic.CSharpFiles { // namespace start class DataQueue { } } // namespace end
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace QueueDataGraphic.CSharpFiles { class DataQueue { } }
apache-2.0
C#
2d8a59902e8786ad39ba926275a1117b0f36892c
fix typo.
sbellana/service-fabric-dotnet-getting-started,neaorin/service-fabric-dotnet-getting-started,Azure-Samples/service-fabric-dotnet-getting-started,Azure-Samples/service-fabric-dotnet-getting-started,neaorin/service-fabric-dotnet-getting-started,neaorin/service-fabric-dotnet-getting-started,Azure-Samples/service-fabric-dotnet-getting-started,sbellana/service-fabric-dotnet-getting-started,sbellana/service-fabric-dotnet-getting-started
Services/WordCount/WordCount.Service/ServiceEventSource.cs
Services/WordCount/WordCount.Service/ServiceEventSource.cs
// ------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See License.txt in the repo root for license information. // ------------------------------------------------------------ namespace WordCount.Service { using System; using System.Diagnostics.Tracing; [EventSource(Name = "MyCompany-WordCount-WordCount.Service")] internal sealed class ServiceEventSource : EventSource { public static ServiceEventSource Current = new ServiceEventSource(); [Event(1, Level = EventLevel.Verbose)] public void MessageEvent(string message) { if (this.IsEnabled()) { this.WriteEvent(1, message); } } [Event(2, Level = EventLevel.Informational, Message = "Service host {0} registered service type {1}")] public void ServiceTypeRegistered(int hostProcessId, string serviceType) { this.WriteEvent(2, hostProcessId, serviceType); } [NonEvent] public void ServiceHostInitializationFailed(Exception e) { this.ServiceHostInitializationFailed(e.ToString()); } [Event(3, Level = EventLevel.Error, Message = "Service host initialization failed")] private void ServiceHostInitializationFailed(string exception) { this.WriteEvent(3, exception); } [Event(4, Level = EventLevel.Informational, Message = "Constructed instance of type {0}")] public void ServiceInstanceConstructed(string serviceType) { this.WriteEvent(4, serviceType); } [Event(5, Level = EventLevel.Informational, Message = "RunAsync invoked in service of type {0}")] public void RunAsyncInvoked(string serviceType) { this.WriteEvent(5, serviceType); } [Event(6, Level = EventLevel.Informational, Message = "Create communication listener in service instance of type {0}")] public void CreateCommunicationListener(string serviceType) { this.WriteEvent(6, serviceType); } [Event(7, Level = EventLevel.Informational, Message = "{0} | # of Processed Words {1}, Remaining Queued Items: {2}: <{3}, {4}>")] public void RunAsyncStatus(Guid partitionId, long numberOfProcessedWords, long queueLength, string word, long count) { this.WriteEvent(7, partitionId, numberOfProcessedWords, queueLength, word, count); } } }
// ------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See License.txt in the repo root for license information. // ------------------------------------------------------------ namespace WordCount.Service { using System; using System.Diagnostics.Tracing; [EventSource(Name = "MyCompany-WordCount-WordCount.Service")] internal sealed class ServiceEventSource : EventSource { public static ServiceEventSource Current = new ServiceEventSource(); [Event(1, Level = EventLevel.Verbose)] public void MessageEvent(string message) { if (this.IsEnabled()) { this.WriteEvent(1, message); } } [Event(2, Level = EventLevel.Informational, Message = "Service host {0} registered service type {1}")] public void ServiceTypeRegistered(int hostProcessId, string serviceType) { this.WriteEvent(2, hostProcessId, serviceType); } [NonEvent] public void ServiceHostInitializationFailed(Exception e) { this.ServiceHostInitializationFailed(e.ToString()); } [Event(3, Level = EventLevel.Error, Message = "Service host initialization failed")] private void ServiceHostInitializationFailed(string exception) { this.WriteEvent(3, exception); } [Event(4, Level = EventLevel.Informational, Message = "Constructed instance of type {0}")] public void ServiceInstanceConstructed(string serviceType) { this.WriteEvent(4, serviceType); } [Event(5, Level = EventLevel.Informational, Message = "RunAsync invoked in service of type {0}")] public void RunAsyncInvoked(string serviceType) { this.WriteEvent(5, serviceType); } [Event(6, Level = EventLevel.Informational, Message = "Create communication listner in service instance of type {0}")] public void CreateCommunicationListener(string serviceType) { this.WriteEvent(6, serviceType); } [Event(7, Level = EventLevel.Informational, Message = "{0} | # of Processed Words {1}, Remaining Queued Items: {2}: <{3}, {4}>")] public void RunAsyncStatus(Guid partitionId, long numberOfProcessedWords, long queueLength, string word, long count) { this.WriteEvent(7, partitionId, numberOfProcessedWords, queueLength, word, count); } } }
mit
C#
659ed936af0d6ba919976651ad3c679a9d2fb9b8
Fix lighting
kennyvv/Alex,kennyvv/Alex,kennyvv/Alex,kennyvv/Alex
src/Alex/Utils/LightingUtils.cs
src/Alex/Utils/LightingUtils.cs
using Alex.ResourcePackLib.Json; using Microsoft.Xna.Framework; namespace Alex.Utils { public class LightingUtils { public static readonly Color LightColor = new Color(245, 245, 225); /// <summary> /// The default lighting information for rendering a block; /// i.e. when the lighting param to CreateUniformCube == null. /// </summary> public static readonly int[] DefaultLighting = new int[] { 15, 15, 15, 15, 15, 15 }; /// <summary> /// Maps a light level [0..15] to a brightness modifier for lighting. /// </summary> public static readonly float[] CubeBrightness = new float[] { 0.050f, 0.067f, 0.085f, 0.106f, // [ 0..3 ] 0.129f, 0.156f, 0.186f, 0.221f, // [ 4..7 ] 0.261f, 0.309f, 0.367f, 0.437f, // [ 8..11] 0.525f, 0.638f, 0.789f, 1.000f // [12..15] }; /// <summary> /// The per-face brightness modifier for lighting. /// </summary> public static readonly float[] FaceBrightness = new float[] { 0.6f, 0.6f, // North / South 0.8f, 0.8f, // East / West 1.0f, 0.5f // Top / Bottom }; public static Color AdjustColor(Color color, BlockFace face, int lighting, bool shade = true) { float brightness = 1f; if (shade) { switch (face) { case BlockFace.Down: brightness = FaceBrightness[5]; break; case BlockFace.Up: brightness = FaceBrightness[4]; break; case BlockFace.East: brightness = FaceBrightness[2]; break; case BlockFace.West: brightness = FaceBrightness[3]; break; case BlockFace.North: brightness = FaceBrightness[0]; break; case BlockFace.South: brightness = FaceBrightness[1]; break; case BlockFace.None: break; } } var light = LightColor.ToVector3() * CubeBrightness[lighting]; return new Color(brightness * (color.ToVector3() * light)); } } }
using Alex.ResourcePackLib.Json; using Microsoft.Xna.Framework; namespace Alex.Utils { public class LightingUtils { public static readonly Vector3 LightColor = new Vector3(245, 245, 225); /// <summary> /// The default lighting information for rendering a block; /// i.e. when the lighting param to CreateUniformCube == null. /// </summary> public static readonly int[] DefaultLighting = new int[] { 15, 15, 15, 15, 15, 15 }; /// <summary> /// Maps a light level [0..15] to a brightness modifier for lighting. /// </summary> public static readonly float[] CubeBrightness = new float[] { 0.050f, 0.067f, 0.085f, 0.106f, // [ 0..3 ] 0.129f, 0.156f, 0.186f, 0.221f, // [ 4..7 ] 0.261f, 0.309f, 0.367f, 0.437f, // [ 8..11] 0.525f, 0.638f, 0.789f, 1.000f // [12..15] }; /// <summary> /// The per-face brightness modifier for lighting. /// </summary> public static readonly float[] FaceBrightness = new float[] { 0.6f, 0.6f, // North / South 0.8f, 0.8f, // East / West 1.0f, 0.5f // Top / Bottom }; public static Color AdjustColor(Color color, BlockFace face, int lighting, bool shade = true) { float brightness = 1f; if (shade) { switch (face) { case BlockFace.Down: brightness = FaceBrightness[5]; break; case BlockFace.Up: brightness = FaceBrightness[4]; break; case BlockFace.East: brightness = FaceBrightness[2]; break; case BlockFace.West: brightness = FaceBrightness[3]; break; case BlockFace.North: brightness = FaceBrightness[0]; break; case BlockFace.South: brightness = FaceBrightness[1]; break; case BlockFace.None: break; } } var light = LightColor * CubeBrightness[lighting]; return new Color(brightness * (color.ToVector3() * light)); } } }
mpl-2.0
C#
52e34048a1024f5a16aa449528c7a5221294dd19
Switch to ImmutableArray to prevent accidental mutation
mavasani/roslyn,diryboy/roslyn,CyrusNajmabadi/roslyn,KevinRansom/roslyn,dotnet/roslyn,KevinRansom/roslyn,diryboy/roslyn,weltkante/roslyn,sharwell/roslyn,bartdesmet/roslyn,jasonmalinowski/roslyn,KevinRansom/roslyn,bartdesmet/roslyn,diryboy/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,weltkante/roslyn,weltkante/roslyn,shyamnamboodiripad/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,CyrusNajmabadi/roslyn,sharwell/roslyn,dotnet/roslyn,bartdesmet/roslyn,mavasani/roslyn,sharwell/roslyn,jasonmalinowski/roslyn,CyrusNajmabadi/roslyn,jasonmalinowski/roslyn
src/Workspaces/Core/Portable/LanguageServices/DeclaredSymbolFactoryService/ArityUtilities.cs
src/Workspaces/Core/Portable/LanguageServices/DeclaredSymbolFactoryService/ArityUtilities.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Immutable; using System.Diagnostics; using System.Globalization; namespace Microsoft.CodeAnalysis.LanguageServices { internal static class ArityUtilities { private const string GenericTypeNameManglingString = "`"; private static readonly ImmutableArray<string> s_aritySuffixesOneToNine = ImmutableArray.Create("`1", "`2", "`3", "`4", "`5", "`6", "`7", "`8", "`9"); public static string GetMetadataAritySuffix(int arity) { Debug.Assert(arity > 0); return (arity <= s_aritySuffixesOneToNine.Length) ? s_aritySuffixesOneToNine[arity - 1] : string.Concat(GenericTypeNameManglingString, arity.ToString(CultureInfo.InvariantCulture)); } } }
// 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. #nullable disable using System.Diagnostics; using System.Globalization; namespace Microsoft.CodeAnalysis.LanguageServices { internal static class ArityUtilities { private const string GenericTypeNameManglingString = "`"; private static readonly string[] s_aritySuffixesOneToNine = { "`1", "`2", "`3", "`4", "`5", "`6", "`7", "`8", "`9" }; public static string GetMetadataAritySuffix(int arity) { Debug.Assert(arity > 0); return (arity <= s_aritySuffixesOneToNine.Length) ? s_aritySuffixesOneToNine[arity - 1] : string.Concat(GenericTypeNameManglingString, arity.ToString(CultureInfo.InvariantCulture)); } } }
mit
C#
18a254c3fa955a6ddf241722272f3a021b9417a6
Enable all kernel tests again.
MyvarHD/Cosmos,tgiphil/Cosmos,CosmosOS/Cosmos,zdimension/Cosmos,trivalik/Cosmos,MetSystem/Cosmos,sgetaz/Cosmos,Cyber4/Cosmos,zhangwenquan/Cosmos,zdimension/Cosmos,tgiphil/Cosmos,fanoI/Cosmos,MyvarHD/Cosmos,zdimension/Cosmos,sgetaz/Cosmos,MetSystem/Cosmos,Cyber4/Cosmos,MyvarHD/Cosmos,MetSystem/Cosmos,tgiphil/Cosmos,CosmosOS/Cosmos,CosmosOS/Cosmos,jp2masa/Cosmos,sgetaz/Cosmos,fanoI/Cosmos,Cyber4/Cosmos,zarlo/Cosmos,MyvarHD/Cosmos,MetSystem/Cosmos,MetSystem/Cosmos,zdimension/Cosmos,trivalik/Cosmos,MyvarHD/Cosmos,zhangwenquan/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,jp2masa/Cosmos,zdimension/Cosmos,zhangwenquan/Cosmos,sgetaz/Cosmos,sgetaz/Cosmos,zarlo/Cosmos,zhangwenquan/Cosmos,trivalik/Cosmos,Cyber4/Cosmos,jp2masa/Cosmos,fanoI/Cosmos,zarlo/Cosmos,Cyber4/Cosmos,zhangwenquan/Cosmos
Tests/Cosmos.TestRunner.Core/DefaultEngineConfiguration.cs
Tests/Cosmos.TestRunner.Core/DefaultEngineConfiguration.cs
using System; namespace Cosmos.TestRunner.Core { public static class DefaultEngineConfiguration { public static void Apply(Engine engine) { if (engine == null) { throw new ArgumentNullException("engine"); } engine.AddKernel(typeof(Cosmos.Compiler.Tests.SimpleWriteLine.Kernel.Kernel).Assembly.Location); engine.AddKernel(typeof(SimpleStructsAndArraysTest.Kernel).Assembly.Location); engine.AddKernel(typeof(VGACompilerCrash.Kernel).Assembly.Location); // known bugs, therefor disabled for now: } } }
using System; namespace Cosmos.TestRunner.Core { public static class DefaultEngineConfiguration { public static void Apply(Engine engine) { if (engine == null) { throw new ArgumentNullException("engine"); } engine.AddKernel(typeof(Cosmos.Compiler.Tests.SimpleWriteLine.Kernel.Kernel).Assembly.Location); //engine.AddKernel(typeof(SimpleStructsAndArraysTest.Kernel).Assembly.Location); //engine.AddKernel(typeof(VGACompilerCrash.Kernel).Assembly.Location); // known bugs, therefor disabled for now: } } }
bsd-3-clause
C#
3c025b3b56fabe9db1eb9bac8e473d05c4bd6c42
Fix string.ToUpper/ToLower to use the computed result
tijoytom/coreclr,ramarag/coreclr,chrishaly/coreclr,botaberg/coreclr,lzcj4/coreclr,sagood/coreclr,apanda/coreclr,cshung/coreclr,vinnyrom/coreclr,naamunds/coreclr,misterzik/coreclr,jakesays/coreclr,ruben-ayrapetyan/coreclr,josteink/coreclr,cydhaselton/coreclr,shahid-pk/coreclr,Alcaro/coreclr,russellhadley/coreclr,tijoytom/coreclr,cshung/coreclr,Dmitry-Me/coreclr,krytarowski/coreclr,stormleoxia/coreclr,xoofx/coreclr,qiudesong/coreclr,xoofx/coreclr,serenabenny/coreclr,bartonjs/coreclr,pgavlin/coreclr,jamesqo/coreclr,chuck-mitchell/coreclr,xtypebee/coreclr,ramarag/coreclr,ktos/coreclr,mmitche/coreclr,orthoxerox/coreclr,sperling/coreclr,ktos/coreclr,ericeil/coreclr,LLITCHEV/coreclr,zmaruo/coreclr,sergey-raevskiy/coreclr,poizan42/coreclr,pgavlin/coreclr,chrishaly/coreclr,josteink/coreclr,yizhang82/coreclr,GuilhermeSa/coreclr,KrzysztofCwalina/coreclr,chuck-mitchell/coreclr,pgavlin/coreclr,perfectphase/coreclr,sagood/coreclr,gitchomik/coreclr,AlfredoMS/coreclr,wkchoy74/coreclr,dasMulli/coreclr,dpodder/coreclr,bjjones/coreclr,spoiledsport/coreclr,roncain/coreclr,cmckinsey/coreclr,MCGPPeters/coreclr,swgillespie/coreclr,ytechie/coreclr,zmaruo/coreclr,neurospeech/coreclr,roncain/coreclr,shana/coreclr,sejongoh/coreclr,chenxizhang/coreclr,cydhaselton/coreclr,perfectphase/coreclr,blackdwarf/coreclr,Sridhar-MS/coreclr,taylorjonl/coreclr,swgillespie/coreclr,Dmitry-Me/coreclr,geertdoornbos/coreclr,bartonjs/coreclr,rartemev/coreclr,benpye/coreclr,sperling/coreclr,AlexGhiondea/coreclr,libengu/coreclr,DickvdBrink/coreclr,richardlford/coreclr,yeaicc/coreclr,richardlford/coreclr,josteink/coreclr,bartonjs/coreclr,matthubin/coreclr,Godin/coreclr,fernando-rodriguez/coreclr,OryJuVog/coreclr,bartonjs/coreclr,ktos/coreclr,grokys/coreclr,SlavaRa/coreclr,martinwoodward/coreclr,jhendrixMSFT/coreclr,xtypebee/coreclr,mocsy/coreclr,mokchhya/coreclr,wtgodbe/coreclr,Godin/coreclr,bjjones/coreclr,alexperovich/coreclr,KrzysztofCwalina/coreclr,fieryorc/coreclr,perfectphase/coreclr,DasAllFolks/coreclr,orthoxerox/coreclr,dkorolev/coreclr,DickvdBrink/coreclr,mocsy/coreclr,bjjones/coreclr,naamunds/coreclr,sejongoh/coreclr,neurospeech/coreclr,chaos7theory/coreclr,botaberg/coreclr,apanda/coreclr,hanu412/coreclr,KrzysztofCwalina/coreclr,iamjasonp/coreclr,iamjasonp/coreclr,jakesays/coreclr,wateret/coreclr,SpotLabsNET/coreclr,shana/coreclr,mokchhya/coreclr,poizan42/coreclr,bartdesmet/coreclr,YongseopKim/coreclr,andschwa/coreclr,ganeshran/coreclr,xoofx/coreclr,sperling/coreclr,yizhang82/coreclr,Alcaro/coreclr,AlexGhiondea/coreclr,schellap/coreclr,mmitche/coreclr,sejongoh/coreclr,pgavlin/coreclr,sagood/coreclr,ramarag/coreclr,krk/coreclr,jakesays/coreclr,chenxizhang/coreclr,matthubin/coreclr,ZhichengZhu/coreclr,rartemev/coreclr,perfectphase/coreclr,YongseopKim/coreclr,ganeshran/coreclr,russellhadley/coreclr,hanu412/coreclr,mokchhya/coreclr,ramarag/coreclr,AlfredoMS/coreclr,stormleoxia/coreclr,SpotLabsNET/coreclr,Lucrecious/coreclr,gitchomik/coreclr,ramarag/coreclr,sagood/coreclr,mskvortsov/coreclr,cmckinsey/coreclr,Alcaro/coreclr,hanu412/coreclr,LLITCHEV/coreclr,wateret/coreclr,MCGPPeters/coreclr,david-mitchell/coreclr,martinwoodward/coreclr,ytechie/coreclr,swgillespie/coreclr,bjjones/coreclr,krk/coreclr,ZhichengZhu/coreclr,vinnyrom/coreclr,blackdwarf/coreclr,wtgodbe/coreclr,jamesqo/coreclr,ganeshran/coreclr,dpodder/coreclr,jhendrixMSFT/coreclr,James-Ko/coreclr,AlfredoMS/coreclr,ZhichengZhu/coreclr,serenabenny/coreclr,lzcj4/coreclr,krixalis/coreclr,russellhadley/coreclr,poizan42/coreclr,xtypebee/coreclr,manu-silicon/coreclr,manu-silicon/coreclr,schellap/coreclr,chrishaly/coreclr,richardlford/coreclr,tijoytom/coreclr,fieryorc/coreclr,Dmitry-Me/coreclr,misterzik/coreclr,kyulee1/coreclr,benpye/coreclr,sperling/coreclr,parjong/coreclr,Lucrecious/coreclr,blackdwarf/coreclr,JosephTremoulet/coreclr,bartdesmet/coreclr,sjsinju/coreclr,apanda/coreclr,jamesqo/coreclr,spoiledsport/coreclr,Dmitry-Me/coreclr,SpotLabsNET/coreclr,kyulee1/coreclr,hanu412/coreclr,mocsy/coreclr,chaos7theory/coreclr,sergey-raevskiy/coreclr,yeaicc/coreclr,lzcj4/coreclr,wateret/coreclr,fffej/coreclr,richardlford/coreclr,krixalis/coreclr,fffej/coreclr,ragmani/coreclr,kyulee1/coreclr,chaos7theory/coreclr,swgillespie/coreclr,cmckinsey/coreclr,fernando-rodriguez/coreclr,dkorolev/coreclr,Dmitry-Me/coreclr,mmitche/coreclr,Samana/coreclr,shahid-pk/coreclr,YongseopKim/coreclr,SpotLabsNET/coreclr,rartemev/coreclr,chaos7theory/coreclr,matthubin/coreclr,roncain/coreclr,stormleoxia/coreclr,naamunds/coreclr,bitcrazed/coreclr,misterzik/coreclr,qiudesong/coreclr,DasAllFolks/coreclr,pgavlin/coreclr,mokchhya/coreclr,dasMulli/coreclr,hseok-oh/coreclr,ragmani/coreclr,sergey-raevskiy/coreclr,bartdesmet/coreclr,shahid-pk/coreclr,alexperovich/coreclr,alexperovich/coreclr,ktos/coreclr,blackdwarf/coreclr,gkhanna79/coreclr,dkorolev/coreclr,fffej/coreclr,sejongoh/coreclr,DasAllFolks/coreclr,mskvortsov/coreclr,zmaruo/coreclr,stormleoxia/coreclr,vinnyrom/coreclr,poizan42/coreclr,kyulee1/coreclr,dkorolev/coreclr,LLITCHEV/coreclr,fernando-rodriguez/coreclr,david-mitchell/coreclr,wkchoy74/coreclr,schellap/coreclr,DasAllFolks/coreclr,zmaruo/coreclr,blackdwarf/coreclr,fernando-rodriguez/coreclr,ytechie/coreclr,dasMulli/coreclr,bitcrazed/coreclr,Alcaro/coreclr,shana/coreclr,ericeil/coreclr,Sridhar-MS/coreclr,schellap/coreclr,orthoxerox/coreclr,vinnyrom/coreclr,bitcrazed/coreclr,ericeil/coreclr,mokchhya/coreclr,wtgodbe/coreclr,ytechie/coreclr,LLITCHEV/coreclr,cydhaselton/coreclr,sejongoh/coreclr,andschwa/coreclr,bjjones/coreclr,josteink/coreclr,chaos7theory/coreclr,bitcrazed/coreclr,hseok-oh/coreclr,misterzik/coreclr,bartonjs/coreclr,bitcrazed/coreclr,ZhichengZhu/coreclr,hseok-oh/coreclr,blackdwarf/coreclr,chuck-mitchell/coreclr,jakesays/coreclr,James-Ko/coreclr,libengu/coreclr,cshung/coreclr,mskvortsov/coreclr,apanda/coreclr,misterzik/coreclr,benpye/coreclr,yizhang82/coreclr,taylorjonl/coreclr,rartemev/coreclr,hseok-oh/coreclr,dpodder/coreclr,tijoytom/coreclr,dasMulli/coreclr,Godin/coreclr,neurospeech/coreclr,orthoxerox/coreclr,pgavlin/coreclr,wkchoy74/coreclr,shahid-pk/coreclr,Djuffin/coreclr,Alcaro/coreclr,krk/coreclr,zmaruo/coreclr,JosephTremoulet/coreclr,bartdesmet/coreclr,shahid-pk/coreclr,ktos/coreclr,mokchhya/coreclr,libengu/coreclr,ruben-ayrapetyan/coreclr,Samana/coreclr,perfectphase/coreclr,jamesqo/coreclr,LLITCHEV/coreclr,jakesays/coreclr,benpye/coreclr,roncain/coreclr,mocsy/coreclr,qiudesong/coreclr,xoofx/coreclr,AlfredoMS/coreclr,xoofx/coreclr,david-mitchell/coreclr,mskvortsov/coreclr,yizhang82/coreclr,AlexGhiondea/coreclr,MCGPPeters/coreclr,taylorjonl/coreclr,grokys/coreclr,bitcrazed/coreclr,Lucrecious/coreclr,mocsy/coreclr,fffej/coreclr,spoiledsport/coreclr,chuck-mitchell/coreclr,krytarowski/coreclr,schellap/coreclr,botaberg/coreclr,ganeshran/coreclr,KrzysztofCwalina/coreclr,ruben-ayrapetyan/coreclr,sagood/coreclr,andschwa/coreclr,martinwoodward/coreclr,sjsinju/coreclr,ZhichengZhu/coreclr,gitchomik/coreclr,Godin/coreclr,manu-silicon/coreclr,stormleoxia/coreclr,James-Ko/coreclr,manu-silicon/coreclr,Djuffin/coreclr,ruben-ayrapetyan/coreclr,stormleoxia/coreclr,ZhichengZhu/coreclr,AlexGhiondea/coreclr,sagood/coreclr,apanda/coreclr,bartonjs/coreclr,Lucrecious/coreclr,fernando-rodriguez/coreclr,Lucrecious/coreclr,chrishaly/coreclr,KrzysztofCwalina/coreclr,ragmani/coreclr,Godin/coreclr,shana/coreclr,schellap/coreclr,manu-silicon/coreclr,fieryorc/coreclr,lzcj4/coreclr,krytarowski/coreclr,ytechie/coreclr,poizan42/coreclr,josteink/coreclr,Sridhar-MS/coreclr,Djuffin/coreclr,roncain/coreclr,poizan42/coreclr,JonHanna/coreclr,neurospeech/coreclr,chuck-mitchell/coreclr,blackdwarf/coreclr,dasMulli/coreclr,chenxizhang/coreclr,andschwa/coreclr,mocsy/coreclr,cydhaselton/coreclr,manu-silicon/coreclr,Samana/coreclr,Sridhar-MS/coreclr,gitchomik/coreclr,grokys/coreclr,ruben-ayrapetyan/coreclr,hanu412/coreclr,serenabenny/coreclr,naamunds/coreclr,roncain/coreclr,sjsinju/coreclr,cshung/coreclr,SlavaRa/coreclr,chaos7theory/coreclr,dasMulli/coreclr,cydhaselton/coreclr,dkorolev/coreclr,dkorolev/coreclr,taylorjonl/coreclr,KrzysztofCwalina/coreclr,chenxizhang/coreclr,chenxizhang/coreclr,chuck-mitchell/coreclr,alexperovich/coreclr,chrishaly/coreclr,JonHanna/coreclr,ericeil/coreclr,JonHanna/coreclr,krixalis/coreclr,ZhichengZhu/coreclr,LLITCHEV/coreclr,geertdoornbos/coreclr,libengu/coreclr,Godin/coreclr,dpodder/coreclr,orthoxerox/coreclr,kyulee1/coreclr,AlfredoMS/coreclr,serenabenny/coreclr,misterzik/coreclr,mmitche/coreclr,spoiledsport/coreclr,James-Ko/coreclr,sperling/coreclr,qiudesong/coreclr,ericeil/coreclr,geertdoornbos/coreclr,bartdesmet/coreclr,gitchomik/coreclr,wtgodbe/coreclr,vinnyrom/coreclr,jhendrixMSFT/coreclr,YongseopKim/coreclr,bjjones/coreclr,sejongoh/coreclr,zmaruo/coreclr,krk/coreclr,gkhanna79/coreclr,shahid-pk/coreclr,lzcj4/coreclr,Djuffin/coreclr,naamunds/coreclr,apanda/coreclr,yeaicc/coreclr,GuilhermeSa/coreclr,Djuffin/coreclr,naamunds/coreclr,JosephTremoulet/coreclr,xtypebee/coreclr,cmckinsey/coreclr,ramarag/coreclr,serenabenny/coreclr,MCGPPeters/coreclr,tijoytom/coreclr,naamunds/coreclr,fieryorc/coreclr,ericeil/coreclr,mokchhya/coreclr,Lucrecious/coreclr,libengu/coreclr,martinwoodward/coreclr,xtypebee/coreclr,JonHanna/coreclr,richardlford/coreclr,manu-silicon/coreclr,ruben-ayrapetyan/coreclr,swgillespie/coreclr,OryJuVog/coreclr,swgillespie/coreclr,krixalis/coreclr,Sridhar-MS/coreclr,Godin/coreclr,hanu412/coreclr,benpye/coreclr,DickvdBrink/coreclr,ganeshran/coreclr,YongseopKim/coreclr,wateret/coreclr,AlexGhiondea/coreclr,krytarowski/coreclr,hseok-oh/coreclr,chenxizhang/coreclr,mskvortsov/coreclr,iamjasonp/coreclr,jhendrixMSFT/coreclr,bartdesmet/coreclr,mskvortsov/coreclr,wateret/coreclr,yeaicc/coreclr,sjsinju/coreclr,andschwa/coreclr,gkhanna79/coreclr,xoofx/coreclr,YongseopKim/coreclr,SlavaRa/coreclr,grokys/coreclr,ragmani/coreclr,James-Ko/coreclr,alexperovich/coreclr,mmitche/coreclr,OryJuVog/coreclr,Dmitry-Me/coreclr,JosephTremoulet/coreclr,sergey-raevskiy/coreclr,rartemev/coreclr,neurospeech/coreclr,parjong/coreclr,jhendrixMSFT/coreclr,gkhanna79/coreclr,andschwa/coreclr,yeaicc/coreclr,parjong/coreclr,matthubin/coreclr,bartdesmet/coreclr,matthubin/coreclr,wateret/coreclr,wkchoy74/coreclr,ganeshran/coreclr,grokys/coreclr,andschwa/coreclr,Lucrecious/coreclr,lzcj4/coreclr,russellhadley/coreclr,david-mitchell/coreclr,parjong/coreclr,taylorjonl/coreclr,bartonjs/coreclr,parjong/coreclr,gkhanna79/coreclr,david-mitchell/coreclr,yizhang82/coreclr,cshung/coreclr,shana/coreclr,DasAllFolks/coreclr,martinwoodward/coreclr,shahid-pk/coreclr,botaberg/coreclr,MCGPPeters/coreclr,DasAllFolks/coreclr,qiudesong/coreclr,JonHanna/coreclr,geertdoornbos/coreclr,Samana/coreclr,Samana/coreclr,vinnyrom/coreclr,JonHanna/coreclr,geertdoornbos/coreclr,sperling/coreclr,taylorjonl/coreclr,wkchoy74/coreclr,cmckinsey/coreclr,LLITCHEV/coreclr,fffej/coreclr,iamjasonp/coreclr,AlexGhiondea/coreclr,chrishaly/coreclr,ragmani/coreclr,dasMulli/coreclr,sperling/coreclr,ramarag/coreclr,SlavaRa/coreclr,fernando-rodriguez/coreclr,krytarowski/coreclr,benpye/coreclr,benpye/coreclr,schellap/coreclr,yeaicc/coreclr,kyulee1/coreclr,botaberg/coreclr,KrzysztofCwalina/coreclr,fffej/coreclr,krk/coreclr,sergey-raevskiy/coreclr,josteink/coreclr,swgillespie/coreclr,ragmani/coreclr,wtgodbe/coreclr,wkchoy74/coreclr,yizhang82/coreclr,bitcrazed/coreclr,serenabenny/coreclr,MCGPPeters/coreclr,mocsy/coreclr,sergey-raevskiy/coreclr,SpotLabsNET/coreclr,geertdoornbos/coreclr,fieryorc/coreclr,orthoxerox/coreclr,cydhaselton/coreclr,richardlford/coreclr,JosephTremoulet/coreclr,matthubin/coreclr,krytarowski/coreclr,perfectphase/coreclr,jakesays/coreclr,neurospeech/coreclr,cmckinsey/coreclr,xtypebee/coreclr,alexperovich/coreclr,GuilhermeSa/coreclr,jhendrixMSFT/coreclr,dpodder/coreclr,James-Ko/coreclr,GuilhermeSa/coreclr,JosephTremoulet/coreclr,jamesqo/coreclr,Samana/coreclr,mmitche/coreclr,ktos/coreclr,grokys/coreclr,ktos/coreclr,sjsinju/coreclr,iamjasonp/coreclr,hseok-oh/coreclr,OryJuVog/coreclr,sejongoh/coreclr,SpotLabsNET/coreclr,Dmitry-Me/coreclr,shana/coreclr,OryJuVog/coreclr,ytechie/coreclr,OryJuVog/coreclr,rartemev/coreclr,qiudesong/coreclr,russellhadley/coreclr,DickvdBrink/coreclr,GuilhermeSa/coreclr,tijoytom/coreclr,chuck-mitchell/coreclr,krixalis/coreclr,gkhanna79/coreclr,SlavaRa/coreclr,cshung/coreclr,taylorjonl/coreclr,vinnyrom/coreclr,libengu/coreclr,wtgodbe/coreclr,krixalis/coreclr,dpodder/coreclr,iamjasonp/coreclr,jhendrixMSFT/coreclr,david-mitchell/coreclr,josteink/coreclr,geertdoornbos/coreclr,spoiledsport/coreclr,spoiledsport/coreclr,sjsinju/coreclr,DickvdBrink/coreclr,yeaicc/coreclr,DickvdBrink/coreclr,Alcaro/coreclr,krk/coreclr,martinwoodward/coreclr,russellhadley/coreclr,GuilhermeSa/coreclr,jamesqo/coreclr,roncain/coreclr,AlfredoMS/coreclr,botaberg/coreclr,stormleoxia/coreclr,SlavaRa/coreclr,gitchomik/coreclr,martinwoodward/coreclr,fieryorc/coreclr,Djuffin/coreclr,wkchoy74/coreclr,Sridhar-MS/coreclr,cmckinsey/coreclr,parjong/coreclr
src/mscorlib/corefx/System/Globalization/TextInfo.Unix.cs
src/mscorlib/corefx/System/Globalization/TextInfo.Unix.cs
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Diagnostics.Contracts; using System.Text; namespace System.Globalization { public partial class TextInfo { ////////////////////////////////////////////////////////////////////////// //// //// TextInfo Constructors //// //// Implements CultureInfo.TextInfo. //// ////////////////////////////////////////////////////////////////////////// internal unsafe TextInfo(CultureData cultureData) { // TODO: Implement this fully. } private unsafe string ChangeCase(string s, bool toUpper) { Contract.Assert(s != null); // TODO: Implement this fully. StringBuilder sb = new StringBuilder(s.Length); for (int i = 0; i < s.Length; i++) { sb.Append(ChangeCaseAscii(s[i], toUpper)); } return sb.ToString(); } private unsafe char ChangeCase(char c, bool toUpper) { // TODO: Implement this fully. return ChangeCaseAscii(c, toUpper); } // PAL Methods end here. internal static char ChangeCaseAscii(char c, bool toUpper = true) { if (toUpper && c >= 'a' && c <= 'z') { return (char)('A' + (c - 'a')); } else if (!toUpper && c >= 'A' && c <= 'Z') { return (char)('a' + (c - 'A')); } return c; } } }
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Diagnostics.Contracts; using System.Text; namespace System.Globalization { public partial class TextInfo { ////////////////////////////////////////////////////////////////////////// //// //// TextInfo Constructors //// //// Implements CultureInfo.TextInfo. //// ////////////////////////////////////////////////////////////////////////// internal unsafe TextInfo(CultureData cultureData) { // TODO: Implement this fully. } private unsafe string ChangeCase(string s, bool toUpper) { Contract.Assert(s != null); // TODO: Implement this fully. StringBuilder sb = new StringBuilder(s.Length); for (int i = 0; i < s.Length; i++) { sb.Append(ChangeCaseAscii(s[i], toUpper)); } return s.ToString(); } private unsafe char ChangeCase(char c, bool toUpper) { // TODO: Implement this fully. return ChangeCaseAscii(c, toUpper); } // PAL Methods end here. internal static char ChangeCaseAscii(char c, bool toUpper = true) { if (toUpper && c >= 'a' && c <= 'z') { return (char)('A' + (c - 'a')); } else if (!toUpper && c >= 'A' && c <= 'Z') { return (char)('a' + (c - 'A')); } return c; } } }
mit
C#
e91e377753bdd873b82defc2879d25ab4f8ad448
Fix wrong class hierarchy in Abstract class test cases
merbla/serilog,CaioProiete/serilog,merbla/serilog,serilog/serilog,serilog/serilog
test/Serilog.Tests/Support/ClassHierarchy.cs
test/Serilog.Tests/Support/ClassHierarchy.cs
namespace Serilog.Tests.Support { public abstract class DummyAbstractClass { } public class DummyConcreteClassWithDefaultConstructor : DummyAbstractClass { // ReSharper disable once UnusedParameter.Local public DummyConcreteClassWithDefaultConstructor(string param = "") { } } public class DummyConcreteClassWithoutDefaultConstructor : DummyAbstractClass { // ReSharper disable once UnusedParameter.Local public DummyConcreteClassWithoutDefaultConstructor(string param) { } } }
namespace Serilog.Tests.Support { public abstract class DummyAbstractClass { } public class DummyConcreteClassWithDefaultConstructor { // ReSharper disable once UnusedParameter.Local public DummyConcreteClassWithDefaultConstructor(string param = "") { } } public class DummyConcreteClassWithoutDefaultConstructor { // ReSharper disable once UnusedParameter.Local public DummyConcreteClassWithoutDefaultConstructor(string param) { } } }
apache-2.0
C#
2cd5ef9965a8761f0ebdb4cf2767cd579a22ecca
Update unit test
sonvister/Binance
test/Binance.Tests/WebSocket/TradesWebSocketClientTest.cs
test/Binance.Tests/WebSocket/TradesWebSocketClientTest.cs
using System; using Binance.Client; using Binance.WebSocket; using Xunit; namespace Binance.Tests.WebSocket { public class TradesWebSocketClientTest { [Fact] public void SubscribeThrows() { var client = new TradeWebSocketClient(); Assert.Throws<ArgumentNullException>("symbol", () => client.Subscribe(null)); } } }
using System; using Binance.Client; using Binance.WebSocket; using Xunit; namespace Binance.Tests.WebSocket { public class TradesWebSocketClientTest { [Fact] public void SubscribeThrows() { var client = new AggregateTradeWebSocketClient(); Assert.Throws<ArgumentNullException>("symbol", () => client.Subscribe(null)); } } }
mit
C#
db3d245f476c2c56e57d87522bba5e9ebc141e0c
Update WalletWasabi.Fluent/ViewModels/MainViewModel.cs
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
using NBitcoin; using ReactiveUI; using System.Reactive; using WalletWasabi.Gui.ViewModels; using WalletWasabi.Fluent.ViewModels.Dialog; using System; using Global = WalletWasabi.Gui.Global; namespace WalletWasabi.Fluent.ViewModels { public class MainViewModel : ViewModelBase, IScreen, IDialogHost { private Global _global; private StatusBarViewModel _statusBar; private string _title = "Wasabi Wallet"; private DialogViewModelBase? _currentDialog; private NavBarViewModel _navBar; public MainViewModel(Global global) { _global = global; Network = global.Network; StatusBar = new StatusBarViewModel(global.DataDir, global.Network, global.Config, global.HostedServices, global.BitcoinStore.SmartHeaderChain, global.Synchronizer, global.LegalDocuments); NavBar = new NavBarViewModel(this, Router, global.WalletManager, global.UiConfig); } public static MainViewModel Instance { get; internal set; } public RoutingState Router { get; } = new RoutingState(); public ReactiveCommand<Unit, IRoutableViewModel> GoNext { get; } public ReactiveCommand<Unit, Unit> GoBack => Router.NavigateBack; public Network Network { get; } public DialogViewModelBase? CurrentDialog { get => _currentDialog; set => this.RaiseAndSetIfChanged(ref _currentDialog, value); } public NavBarViewModel NavBar { get => _navBar; set => this.RaiseAndSetIfChanged(ref _navBar, value); } public StatusBarViewModel StatusBar { get => _statusBar; set => this.RaiseAndSetIfChanged(ref _statusBar, value); } public string Title { get => _title; internal set => this.RaiseAndSetIfChanged(ref _title, value); } public void Initialize() { // Temporary to keep things running without VM modifications. MainWindowViewModel.Instance = new MainWindowViewModel(_global.Network, _global.UiConfig, _global.WalletManager, null, null, false); StatusBar.Initialize(_global.Nodes.ConnectedNodes); if (Network != Network.Main) { Title += $" - {Network}"; } } } }
#nullable enable using NBitcoin; using ReactiveUI; using System.Reactive; using WalletWasabi.Gui.ViewModels; using WalletWasabi.Fluent.ViewModels.Dialog; using System; using Global = WalletWasabi.Gui.Global; namespace WalletWasabi.Fluent.ViewModels { public class MainViewModel : ViewModelBase, IScreen, IDialogHost { private Global _global; private StatusBarViewModel _statusBar; private string _title = "Wasabi Wallet"; private DialogViewModelBase? _currentDialog; private NavBarViewModel _navBar; public MainViewModel(Global global) { _global = global; Network = global.Network; StatusBar = new StatusBarViewModel(global.DataDir, global.Network, global.Config, global.HostedServices, global.BitcoinStore.SmartHeaderChain, global.Synchronizer, global.LegalDocuments); NavBar = new NavBarViewModel(this, Router, global.WalletManager, global.UiConfig); } public static MainViewModel Instance { get; internal set; } public RoutingState Router { get; } = new RoutingState(); public ReactiveCommand<Unit, IRoutableViewModel> GoNext { get; } public ReactiveCommand<Unit, Unit> GoBack => Router.NavigateBack; public Network Network { get; } public DialogViewModelBase? CurrentDialog { get => _currentDialog; set => this.RaiseAndSetIfChanged(ref _currentDialog, value); } public NavBarViewModel NavBar { get => _navBar; set => this.RaiseAndSetIfChanged(ref _navBar, value); } public StatusBarViewModel StatusBar { get => _statusBar; set => this.RaiseAndSetIfChanged(ref _statusBar, value); } public string Title { get => _title; internal set => this.RaiseAndSetIfChanged(ref _title, value); } public void Initialize() { // Temporary to keep things running without VM modifications. MainWindowViewModel.Instance = new MainWindowViewModel(_global.Network, _global.UiConfig, _global.WalletManager, null, null, false); StatusBar.Initialize(_global.Nodes.ConnectedNodes); if (Network != Network.Main) { Title += $" - {Network}"; } } } }
mit
C#
f82445ae3e4dc695bb26a78ed3b493f151748b18
Add expiration
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi.Gui/Helpers/NotificationHelpers.cs
WalletWasabi.Gui/Helpers/NotificationHelpers.cs
using Avalonia.Controls.Notifications; using ReactiveUI; using Splat; using System; using System.Reactive.Concurrency; namespace WalletWasabi.Gui.Helpers { public static class NotificationHelpers { public static INotificationManager GetNotificationManager() { return Locator.Current.GetService<INotificationManager>(); } public static void Success(string message, string title = "Success!") { RxApp.MainThreadScheduler .Schedule(() => GetNotificationManager() .Show(new Notification(title, message, NotificationType.Success, TimeSpan.FromSeconds(7)))); } public static void Information(string message, string title = "Info!") { RxApp.MainThreadScheduler .Schedule(() => GetNotificationManager() .Show(new Notification(title, message, NotificationType.Information, TimeSpan.FromSeconds(7)))); } public static void Warning(string message, string title = "Warning!") { RxApp.MainThreadScheduler .Schedule(() => GetNotificationManager() .Show(new Notification(title, message, NotificationType.Warning, TimeSpan.FromSeconds(7)))); } public static void Error(string message, string title = "Error!") { RxApp.MainThreadScheduler .Schedule(() => GetNotificationManager() .Show(new Notification(title, message, NotificationType.Error, TimeSpan.FromSeconds(7)))); } } }
using Avalonia.Controls.Notifications; using ReactiveUI; using Splat; using System.Reactive.Concurrency; namespace WalletWasabi.Gui.Helpers { public static class NotificationHelpers { public static INotificationManager GetNotificationManager() { return Locator.Current.GetService<INotificationManager>(); } public static void Success (string message, string title = "Success!") { RxApp.MainThreadScheduler .Schedule(() => GetNotificationManager() .Show(new Notification(title, message, NotificationType.Success))); } public static void Information (string message, string title = "Info!") { RxApp.MainThreadScheduler .Schedule(() => GetNotificationManager() .Show(new Notification(title, message, NotificationType.Information))); } public static void Warning (string message, string title = "Warning!") { RxApp.MainThreadScheduler .Schedule(() => GetNotificationManager() .Show(new Notification(title, message, NotificationType.Warning))); } public static void Error(string message, string title = "Error!") { RxApp.MainThreadScheduler .Schedule(() => GetNotificationManager() .Show(new Notification(title, message, NotificationType.Error))); } } }
mit
C#
0f9d0fee324581c0ef73d3b30c4a17a1a8bb799a
bump version
QuintSys/Five9ApiClient
src/Five9ApiClient/Five9ApiClient/Properties/AssemblyInfo.cs
src/Five9ApiClient/Five9ApiClient/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Quintsys.Five9ApiClient")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Quintero Systems, Inc.")] [assembly: AssemblyProduct("Quintsys.Five9ApiClient")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("0e06c791-5550-4c02-9125-bcfc605fb9fc")] [assembly: AssemblyVersion("1.0.1")]
using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("Quintsys.Five9ApiClient")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Quintero Systems, Inc.")] [assembly: AssemblyProduct("Quintsys.Five9ApiClient")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("0e06c791-5550-4c02-9125-bcfc605fb9fc")] [assembly: AssemblyVersion("1.0.0.0")]
mit
C#
d37afda980cfb6efa61015b62460669277424b64
Change string to int for mark
jacquesweidig/DBVRMONS,jacquesweidig/DBVRMONS
src/dotnetCloudantWebstarter/Models/ToDoItemModel.cs
src/dotnetCloudantWebstarter/Models/ToDoItemModel.cs
namespace CloudantDotNet.Models { public class ToDoItem { public string id { get; set; } public string rev { get; set; } public string text { get; set; } } public class VREntryItem { public string id { get; set; } public string rev { get; set; } public string caseName { get; set; } public int mark { get; set; } public string comment { get; set; } } }
namespace CloudantDotNet.Models { public class ToDoItem { public string id { get; set; } public string rev { get; set; } public string text { get; set; } } public class VREntryItem { public string id { get; set; } public string rev { get; set; } public string caseName { get; set; } public string mark { get; set; } public string comment { get; set; } } }
apache-2.0
C#
21a22a95e56c36ab21bfc878ec1647db739644f5
add SourceRelativePath.
hellosnow/docfx,superyyrrzz/docfx,hellosnow/docfx,superyyrrzz/docfx,pascalberger/docfx,dotnet/docfx,DuncanmaMSFT/docfx,928PJY/docfx,928PJY/docfx,superyyrrzz/docfx,LordZoltan/docfx,pascalberger/docfx,928PJY/docfx,LordZoltan/docfx,dotnet/docfx,hellosnow/docfx,LordZoltan/docfx,dotnet/docfx,LordZoltan/docfx,pascalberger/docfx,DuncanmaMSFT/docfx
src/Microsoft.DocAsCode.Build.Engine/TemplateManifestItem.cs
src/Microsoft.DocAsCode.Build.Engine/TemplateManifestItem.cs
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.DocAsCode.Build.Engine { using System.Collections.Generic; using Newtonsoft.Json; using YamlDotNet.Serialization; using Microsoft.DocAsCode.YamlSerialization; public class TemplateManifestItem { [YamlMember(Alias = "type")] [JsonProperty("type")] public string DocumentType { get; set; } [YamlMember(Alias = "original")] [JsonProperty("original")] public string OriginalFile { get; set; } [YamlMember(Alias = "sourceRelativePath")] [JsonProperty("source_relative_path")] public string SourceRelativePath { get; set; } [YamlMember(Alias = "output")] [JsonProperty("output")] public Dictionary<string, string> OutputFiles { get; set; } [YamlMember(Alias = "hashes")] [JsonProperty("hashes")] public Dictionary<string, string> Hashes { get; set; } [ExtensibleMember] [JsonExtensionData] public Dictionary<string, object> Metadata { get; set; } = new Dictionary<string, object>(); } }
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.DocAsCode.Build.Engine { using System.Collections.Generic; using Newtonsoft.Json; using YamlDotNet.Serialization; using Microsoft.DocAsCode.YamlSerialization; public class TemplateManifestItem { [YamlMember(Alias = "type")] [JsonProperty("type")] public string DocumentType { get; set; } [YamlMember(Alias = "original")] [JsonProperty("original")] public string OriginalFile { get; set; } [YamlMember(Alias = "output")] [JsonProperty("output")] public Dictionary<string, string> OutputFiles { get; set; } [YamlMember(Alias = "hashes")] [JsonProperty("hashes")] public Dictionary<string, string> Hashes { get; set; } [ExtensibleMember] [JsonExtensionData] public Dictionary<string, object> Metadata { get; set; } = new Dictionary<string, object>(); } }
mit
C#
8310c1542994fc3dd1f374e1448d8afd0f4fc8a4
Remove unused variable in UserRepository
Chess-Variants-Training/Chess-Variants-Training,Chess-Variants-Training/Chess-Variants-Training,Chess-Variants-Training/Chess-Variants-Training
src/AtomicChessPuzzles/DbRepositories/UserRepository.cs
src/AtomicChessPuzzles/DbRepositories/UserRepository.cs
using MongoDB.Driver; using AtomicChessPuzzles.Models; namespace AtomicChessPuzzles.DbRepositories { public class UserRepository : IUserRepository { MongoSettings settings; IMongoCollection<User> userCollection; public UserRepository() { settings = new MongoSettings(); } private void GetDatabase() { MongoClient client = new MongoClient(settings.MongoConnectionString); userCollection = client.GetDatabase(settings.Database).GetCollection<User>(settings.UserCollectionName); } public void Add(User user) { userCollection.InsertOne(user); } public void Update(User user) { userCollection.ReplaceOne(new ExpressionFilterDefinition<User>(x => x.ID == user.ID), user); } public void Delete(User user) { userCollection.DeleteOne(new ExpressionFilterDefinition<User>(x => x.ID == user.ID)); } } }
using MongoDB.Driver; using AtomicChessPuzzles.Models; namespace AtomicChessPuzzles.DbRepositories { public class UserRepository : IUserRepository { MongoSettings settings; IMongoDatabase database; IMongoCollection<User> userCollection; public UserRepository() { settings = new MongoSettings(); } private void GetDatabase() { MongoClient client = new MongoClient(settings.MongoConnectionString); userCollection = client.GetDatabase(settings.Database).GetCollection<User>(settings.UserCollectionName); } public void Add(User user) { userCollection.InsertOne(user); } public void Update(User user) { userCollection.ReplaceOne(new ExpressionFilterDefinition<User>(x => x.ID == user.ID), user); } public void Delete(User user) { userCollection.DeleteOne(new ExpressionFilterDefinition<User>(x => x.ID == user.ID)); } } }
agpl-3.0
C#
30a4b09d9fc859757ffecb08ce07c2c2cd8a3e9f
Fix CookieOptions.HttpOnly doc comment
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/Microsoft.AspNetCore.Http.Features/CookieOptions.cs
src/Microsoft.AspNetCore.Http.Features/CookieOptions.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; namespace Microsoft.AspNetCore.Http { /// <summary> /// Options used to create a new cookie. /// </summary> public class CookieOptions { /// <summary> /// Creates a default cookie with a path of '/'. /// </summary> public CookieOptions() { Path = "/"; } /// <summary> /// Gets or sets the domain to associate the cookie with. /// </summary> /// <returns>The domain to associate the cookie with.</returns> public string Domain { get; set; } /// <summary> /// Gets or sets the cookie path. /// </summary> /// <returns>The cookie path.</returns> public string Path { get; set; } /// <summary> /// Gets or sets the expiration date and time for the cookie. /// </summary> /// <returns>The expiration date and time for the cookie.</returns> public DateTimeOffset? Expires { get; set; } /// <summary> /// Gets or sets a value that indicates whether to transmit the cookie using Secure Sockets Layer (SSL)�that is, over HTTPS only. /// </summary> /// <returns>true to transmit the cookie only over an SSL connection (HTTPS); otherwise, false.</returns> public bool Secure { get; set; } /// <summary> /// Gets or sets a value that indicates whether a cookie is accessible by client-side script. /// </summary> /// <returns>true if a cookie must not be accessible by client-side script; otherwise, false.</returns> public bool HttpOnly { get; set; } } }
// 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; namespace Microsoft.AspNetCore.Http { /// <summary> /// Options used to create a new cookie. /// </summary> public class CookieOptions { /// <summary> /// Creates a default cookie with a path of '/'. /// </summary> public CookieOptions() { Path = "/"; } /// <summary> /// Gets or sets the domain to associate the cookie with. /// </summary> /// <returns>The domain to associate the cookie with.</returns> public string Domain { get; set; } /// <summary> /// Gets or sets the cookie path. /// </summary> /// <returns>The cookie path.</returns> public string Path { get; set; } /// <summary> /// Gets or sets the expiration date and time for the cookie. /// </summary> /// <returns>The expiration date and time for the cookie.</returns> public DateTimeOffset? Expires { get; set; } /// <summary> /// Gets or sets a value that indicates whether to transmit the cookie using Secure Sockets Layer (SSL)�that is, over HTTPS only. /// </summary> /// <returns>true to transmit the cookie only over an SSL connection (HTTPS); otherwise, false.</returns> public bool Secure { get; set; } /// <summary> /// Gets or sets a value that indicates whether a cookie is accessible by client-side script. /// </summary> /// <returns>true if a cookie is accessible by client-side script; otherwise, false.</returns> public bool HttpOnly { get; set; } } }
apache-2.0
C#
8b836a74f9a25f49469659c17efec7a25ec175cd
Fix StructureMap missing default convention for React.Config
KevM/Reactive.Config
src/Reactive.Config.StructureMap/ContainerExtensions.cs
src/Reactive.Config.StructureMap/ContainerExtensions.cs
using System; using StructureMap; namespace Reactive.Config.StructureMap { public static class ContainerExtensions { public static void ReactiveConfig(this ConfigurationExpression config, Action<IReactiveConfigRegistry> action) { config.Scan(s => { s.AssemblyContainingType<IConfigured>(); s.WithDefaultConventions(); }); config.For<IConfigurationResultStore>().Singleton().Use<ConfigurationResultStore>(); config.For<IKeyPathProvider>().Use<NamespaceKeyPathProvider>(); var configRegsitry = new ReactiveConfigRegsitry(config); action(configRegsitry); config.For<IConfigurationProvider>().Use<ConfigurationProvider>(); } } }
using System; using StructureMap; namespace Reactive.Config.StructureMap { public static class ContainerExtensions { public static void ReactiveConfig(this ConfigurationExpression config, Action<IReactiveConfigRegistry> action) { config.For<IKeyPathProvider>().Use<NamespaceKeyPathProvider>(); config.For<IConfigurationResultStore>().Singleton().Use<ConfigurationResultStore>(); var configRegsitry = new ReactiveConfigRegsitry(config); action(configRegsitry); config.For<IConfigurationProvider>().Use<ConfigurationProvider>(); } } }
mit
C#
f4dc19ec62d2f48e5d1296db82509ccbbd93ce36
Add `CardIssuing` and `JcbPayments` as capabilities on `Account`
stripe/stripe-dotnet
src/Stripe.net/Entities/Accounts/AccountCapabilities.cs
src/Stripe.net/Entities/Accounts/AccountCapabilities.cs
namespace Stripe { using System; using Newtonsoft.Json; public class AccountCapabilities : StripeEntity<AccountCapabilities> { /// <summary> /// The status of the BECS Direct Debit (AU) payments capability of the account, or whether /// the account can directly process BECS Direct Debit (AU) charges. /// </summary> [JsonProperty("au_becs_debit_payments")] public string AuBecsDebitPayments { get; set; } /// <summary> /// The status of the card issuing capability of the account, or whether you can use Issuing /// to distribute funds on cards. /// </summary> [JsonProperty("card_issuing")] public string CardIssuing { get; set; } /// <summary> /// The status of the card payments capability of the account, or whether the account can /// directly process credit and debit card charges. /// </summary> [JsonProperty("card_payments")] public string CardPayments { get; set; } /// <summary> /// The status of the JCB payments capability of the account, or whether the account (Japan /// only) can directly process JCB credit card charges in JPY currency. /// </summary> [JsonProperty("jcb_payments")] public string JcbPayments { get; set; } /// <summary> /// The status of the legacy payments capability of the account. /// </summary> [JsonProperty("legacy_payments")] public string LegacyPayments { get; set; } /// <summary> /// The status of the tax reporting 1099-K (US) capability of the account. /// </summary> [JsonProperty("tax_reporting_us_1099_k")] public string TaxReportingUs1099K { get; set; } /// <summary> /// The status of the tax reporting 1099-MISC (US) capability of the account. /// </summary> [JsonProperty("tax_reporting_us_1099_misc")] public string TaxReportingUs1099Misc { get; set; } /// <summary> /// The status of the transfers capability of the account, or whether your platform can /// transfer funds to the account. /// </summary> [JsonProperty("transfers")] public string Transfers { get; set; } } }
namespace Stripe { using System; using Newtonsoft.Json; public class AccountCapabilities : StripeEntity<AccountCapabilities> { /// <summary> /// The status of the BECS Direct Debit (AU) payments capability of the account, or whether /// the account can directly process BECS Direct Debit (AU) charges. /// </summary> [JsonProperty("au_becs_debit_payments")] public string AuBecsDebitPayments { get; set; } /// <summary> /// The status of the card payments capability of the account, or whether the account can /// directly process credit and debit card charges. /// </summary> [JsonProperty("card_payments")] public string CardPayments { get; set; } /// <summary> /// The status of the legacy payments capability of the account. /// </summary> [JsonProperty("legacy_payments")] public string LegacyPayments { get; set; } /// <summary> /// The status of the tax reporting 1099-K (US) capability of the account. /// </summary> [JsonProperty("tax_reporting_us_1099_k")] public string TaxReportingUs1099K { get; set; } /// <summary> /// The status of the tax reporting 1099-MISC (US) capability of the account. /// </summary> [JsonProperty("tax_reporting_us_1099_misc")] public string TaxReportingUs1099Misc { get; set; } /// <summary> /// The status of the transfers capability of the account, or whether your platform can /// transfer funds to the account. /// </summary> [JsonProperty("transfers")] public string Transfers { get; set; } } }
apache-2.0
C#
cf6d33f8433bd924409f3e0699b07225cc27847b
Update src/Umbraco.Core/Security/IBackOfficeSecurityFactory.cs
KevinJump/Umbraco-CMS,umbraco/Umbraco-CMS,dawoe/Umbraco-CMS,marcemarc/Umbraco-CMS,abryukhov/Umbraco-CMS,KevinJump/Umbraco-CMS,abjerner/Umbraco-CMS,robertjf/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,marcemarc/Umbraco-CMS,robertjf/Umbraco-CMS,marcemarc/Umbraco-CMS,arknu/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,KevinJump/Umbraco-CMS,abjerner/Umbraco-CMS,abjerner/Umbraco-CMS,arknu/Umbraco-CMS,robertjf/Umbraco-CMS,robertjf/Umbraco-CMS,KevinJump/Umbraco-CMS,umbraco/Umbraco-CMS,marcemarc/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,abryukhov/Umbraco-CMS,KevinJump/Umbraco-CMS,umbraco/Umbraco-CMS,marcemarc/Umbraco-CMS,dawoe/Umbraco-CMS,dawoe/Umbraco-CMS,dawoe/Umbraco-CMS,arknu/Umbraco-CMS,abryukhov/Umbraco-CMS,arknu/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS,dawoe/Umbraco-CMS,abryukhov/Umbraco-CMS,umbraco/Umbraco-CMS,robertjf/Umbraco-CMS,abjerner/Umbraco-CMS,JimBobSquarePants/Umbraco-CMS
src/Umbraco.Core/Security/IBackOfficeSecurityFactory.cs
src/Umbraco.Core/Security/IBackOfficeSecurityFactory.cs
namespace Umbraco.Cms.Core.Security { /// <summary> /// Creates and manages <see cref="IBackOfficeSecurity"/> instances. /// </summary> public interface IBackOfficeSecurityFactory { /// <summary> /// Ensures that a current <see cref="IBackOfficeSecurity"/> exists. /// </summary> void EnsureBackOfficeSecurity(); } }
namespace Umbraco.Core.Security { /// <summary> /// Creates and manages <see cref="IBackOfficeSecurity"/> instances. /// </summary> public interface IBackOfficeSecurityFactory { /// <summary> /// Ensures that a current <see cref="IBackOfficeSecurity"/> exists. /// </summary> void EnsureBackOfficeSecurity(); } }
mit
C#
90834686f9ed80f614430bbb714d4e48c6fe3d66
Update OrdinalImpl.cs
CosmosOS/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos,zarlo/Cosmos,CosmosOS/Cosmos,zarlo/Cosmos
source/Cosmos.Core_Plugs/System/Globalization/OrdinalImpl.cs
source/Cosmos.Core_Plugs/System/Globalization/OrdinalImpl.cs
using IL2CPU.API.Attribs; namespace Cosmos.Core_Plugs.System.Globalization { [Plug(TargetName = "System.Globalization.Ordinal, System.Private.CoreLib")] class OrdinalImpl { [PlugMethod(IsOptional =false, PlugRequired =true)] public static unsafe int CompareStringIgnoreCaseNonAscii(char* aStrA, int aLengthA, char* aStrB, int aLengthB) { if(aLengthA < aLengthB) { return -1; } else if(aLengthA > aLengthB) { return 1; } for (int i = 0; i < aLengthA; i++) { if(aStrA[i] < aStrB[i]) { return -1; } else if(aStrA[i] < aStrB[i]) { return 1; } } return 0; } } }
using IL2CPU.API.Attribs; namespace Cosmos.Core_Plugs.System.Globalization { class OrdinalImpl { [PlugMethod(IsOptional =false, PlugRequired =true)] public static unsafe int CompareStringIgnoreCaseNonAscii(char* aStrA, int aLengthA, char* aStrB, int aLengthB) { if(aLengthA < aLengthB) { return -1; } else if(aLengthA > aLengthB) { return 1; } for (int i = 0; i < aLengthA; i++) { if(aStrA[i] < aStrB[i]) { return -1; } else if(aStrA[i] < aStrB[i]) { return 1; } } return 0; } } }
bsd-3-clause
C#
aec88d1b82b6920adaa59ea4a667f8fe9e435449
Update FindByInnerXPathStrategy
YevgeniyShunevych/Atata,YevgeniyShunevych/Atata,atata-framework/atata,atata-framework/atata
src/Atata/ScopeSearch/Strategies/FindByInnerXPathStrategy.cs
src/Atata/ScopeSearch/Strategies/FindByInnerXPathStrategy.cs
using System.Linq; namespace Atata { public class FindByInnerXPathStrategy : XPathComponentScopeLocateStrategy { protected override string Build(ComponentScopeXPathBuilder builder, ComponentScopeLocateOptions options) { string[] conditions = options.Terms.Length > 1 ? options.Terms.Select(x => $"({x})").ToArray() : options.Terms; return builder.WrapWithIndex(x => x.Descendant.ComponentXPath.Where(y => y.JoinOr(conditions))); } } }
namespace Atata { public class FindByInnerXPathStrategy : XPathComponentScopeLocateStrategy { protected override string Build(ComponentScopeXPathBuilder builder, ComponentScopeLocateOptions options) { return builder.WrapWithIndex(x => x.Descendant.ComponentXPath.Where(y => y.JoinOr(options.Terms))); } } }
apache-2.0
C#
f39092540e766f17d14719f97945d84858dff1e6
Support computing navigation bar items for source generated files
jasonmalinowski/roslyn,sharwell/roslyn,mavasani/roslyn,KevinRansom/roslyn,shyamnamboodiripad/roslyn,eriawan/roslyn,mavasani/roslyn,AmadeusW/roslyn,diryboy/roslyn,shyamnamboodiripad/roslyn,jasonmalinowski/roslyn,physhi/roslyn,diryboy/roslyn,weltkante/roslyn,eriawan/roslyn,CyrusNajmabadi/roslyn,wvdd007/roslyn,KevinRansom/roslyn,wvdd007/roslyn,dotnet/roslyn,dotnet/roslyn,AmadeusW/roslyn,bartdesmet/roslyn,diryboy/roslyn,dotnet/roslyn,mavasani/roslyn,weltkante/roslyn,CyrusNajmabadi/roslyn,sharwell/roslyn,CyrusNajmabadi/roslyn,KevinRansom/roslyn,AmadeusW/roslyn,wvdd007/roslyn,physhi/roslyn,physhi/roslyn,eriawan/roslyn,weltkante/roslyn,jasonmalinowski/roslyn,bartdesmet/roslyn,sharwell/roslyn,bartdesmet/roslyn,shyamnamboodiripad/roslyn
src/Workspaces/Remote/ServiceHub/Services/NavigationBar/RemoteNavigationBarItemService.cs
src/Workspaces/Remote/ServiceHub/Services/NavigationBar/RemoteNavigationBarItemService.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.NavigationBar; using Microsoft.CodeAnalysis.Shared.Extensions; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.Remote { internal sealed class RemoteNavigationBarItemService : BrokeredServiceBase, IRemoteNavigationBarItemService { internal sealed class Factory : FactoryBase<IRemoteNavigationBarItemService> { protected override IRemoteNavigationBarItemService CreateService(in ServiceConstructionArguments arguments) => new RemoteNavigationBarItemService(arguments); } public RemoteNavigationBarItemService(in ServiceConstructionArguments arguments) : base(arguments) { } public ValueTask<ImmutableArray<SerializableNavigationBarItem>> GetItemsAsync( PinnedSolutionInfo solutionInfo, DocumentId documentId, bool supportsCodeGeneration, CancellationToken cancellationToken) { return RunServiceAsync(async cancellationToken => { var solution = await GetSolutionAsync(solutionInfo, cancellationToken).ConfigureAwait(false); var document = await solution.GetDocumentAsync(documentId, includeSourceGenerated: true, cancellationToken).ConfigureAwait(false); Contract.ThrowIfNull(document); var navigationBarService = document.GetRequiredLanguageService<INavigationBarItemService>(); var result = await navigationBarService.GetItemsAsync(document, supportsCodeGeneration, cancellationToken).ConfigureAwait(false); return SerializableNavigationBarItem.Dehydrate(result); }, cancellationToken); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.NavigationBar; using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.Remote { internal sealed class RemoteNavigationBarItemService : BrokeredServiceBase, IRemoteNavigationBarItemService { internal sealed class Factory : FactoryBase<IRemoteNavigationBarItemService> { protected override IRemoteNavigationBarItemService CreateService(in ServiceConstructionArguments arguments) => new RemoteNavigationBarItemService(arguments); } public RemoteNavigationBarItemService(in ServiceConstructionArguments arguments) : base(arguments) { } public ValueTask<ImmutableArray<SerializableNavigationBarItem>> GetItemsAsync( PinnedSolutionInfo solutionInfo, DocumentId documentId, bool supportsCodeGeneration, CancellationToken cancellationToken) { return RunServiceAsync(async cancellationToken => { var solution = await GetSolutionAsync(solutionInfo, cancellationToken).ConfigureAwait(false); var document = solution.GetRequiredDocument(documentId); var navigationBarService = document.GetRequiredLanguageService<INavigationBarItemService>(); var result = await navigationBarService.GetItemsAsync(document, supportsCodeGeneration, cancellationToken).ConfigureAwait(false); return SerializableNavigationBarItem.Dehydrate(result); }, cancellationToken); } } }
mit
C#
d41a3065bd11bed66f4fe786fb1b58f37c4a13c2
Update class name to reflect additional test
FabioNascimento/fluentmigrator,lcharlebois/fluentmigrator,stsrki/fluentmigrator,lcharlebois/fluentmigrator,fluentmigrator/fluentmigrator,amroel/fluentmigrator,itn3000/fluentmigrator,schambers/fluentmigrator,eloekset/fluentmigrator,fluentmigrator/fluentmigrator,FabioNascimento/fluentmigrator,itn3000/fluentmigrator,igitur/fluentmigrator,spaccabit/fluentmigrator,stsrki/fluentmigrator,spaccabit/fluentmigrator,amroel/fluentmigrator,eloekset/fluentmigrator,igitur/fluentmigrator,schambers/fluentmigrator
src/FluentMigrator.Tests/Unit/AutoReversingMigrationTests.cs
src/FluentMigrator.Tests/Unit/AutoReversingMigrationTests.cs
using NUnit.Framework; using FluentMigrator.Infrastructure; namespace FluentMigrator.Tests.Unit { using System.Collections.ObjectModel; using System.Linq; using FluentMigrator.Expressions; using Moq; [TestFixture] public class AutoReversingMigrationTests { private Mock<IMigrationContext> context; [SetUp] public void SetUp() { context = new Mock<IMigrationContext>(); context.SetupAllProperties(); } [Test] public void CreateTableUpAutoReversingMigrationGivesDeleteTableDown() { var autoReversibleMigration = new TestAutoReversingMigration(); context.Object.Expressions = new Collection<IMigrationExpression>(); autoReversibleMigration.GetDownExpressions(context.Object); Assert.True(context.Object.Expressions.Any(me => me is DeleteTableExpression && ((DeleteTableExpression)me).TableName == "Foo")); } [Test] public void DownMigrationsAreInReverseOrderOfUpMigrations() { var autoReversibleMigration = new TestAutoReversingMigration(); context.Object.Expressions = new Collection<IMigrationExpression>(); autoReversibleMigration.GetDownExpressions(context.Object); Assert.IsAssignableFrom(typeof(RenameTableExpression), context.Object.Expressions.ToList()[0]); Assert.IsAssignableFrom(typeof(DeleteTableExpression), context.Object.Expressions.ToList()[1]); } } internal class TestAutoReversingMigration : AutoReversingMigration { public override void Up() { Create.Table("Foo"); Rename.Table("Foo").InSchema("FooSchema").To("Bar"); } } }
using NUnit.Framework; using FluentMigrator.Infrastructure; namespace FluentMigrator.Tests.Unit { using System.Collections.ObjectModel; using System.Linq; using FluentMigrator.Expressions; using Moq; [TestFixture] public class AutoReversingMigrationTests { private Mock<IMigrationContext> context; [SetUp] public void SetUp() { context = new Mock<IMigrationContext>(); context.SetupAllProperties(); } [Test] public void CreateTableUpAutoReversingMigrationGivesDeleteTableDown() { var autoReversibleMigration = new TestAutoReversingMigrationCreateTable(); context.Object.Expressions = new Collection<IMigrationExpression>(); autoReversibleMigration.GetDownExpressions(context.Object); Assert.True(context.Object.Expressions.Any(me => me is DeleteTableExpression && ((DeleteTableExpression)me).TableName == "Foo")); } [Test] public void DownMigrationsAreInReverseOrderOfUpMigrations() { var autoReversibleMigration = new TestAutoReversingMigrationCreateTable(); context.Object.Expressions = new Collection<IMigrationExpression>(); autoReversibleMigration.GetDownExpressions(context.Object); Assert.IsAssignableFrom(typeof(RenameTableExpression), context.Object.Expressions.ToList()[0]); Assert.IsAssignableFrom(typeof(DeleteTableExpression), context.Object.Expressions.ToList()[1]); } } internal class TestAutoReversingMigrationCreateTable : AutoReversingMigration { public override void Up() { Create.Table("Foo"); Rename.Table("Foo").InSchema("FooSchema").To("Bar"); } } }
apache-2.0
C#
66468264b5b923dbcbff230dd34ad5ca26b46164
add log to sql
bit-foundation/bit-framework,bit-foundation/bit-framework,bit-foundation/bit-framework,bit-foundation/bit-framework
src/Server/Bit.Owin/Implementations/SqlServerJsonLogStore.cs
src/Server/Bit.Owin/Implementations/SqlServerJsonLogStore.cs
using Bit.Core.Contracts; using Bit.Core.Models; using System.Data.SqlClient; using System.Threading.Tasks; namespace Bit.Owin.Implementations { public class SqlServerJsonLogStore : ILogStore { public virtual AppEnvironment ActiveAppEnvironment { get; set; } public virtual IDateTimeProvider DateTimeProvider { get; set; } public virtual IContentFormatter Formatter { get; set; } public void SaveLog(LogEntry logEntry) { using (SqlConnection connection = new SqlConnection(ActiveAppEnvironment.GetConfig<string>("AppConnectionstring"))) { using (SqlCommand command = connection.CreateCommand()) { command.CommandText = @"INSERT INTO [dbo].[Logs] ([Contents]) VALUES (@contents)"; command.Parameters.AddWithValue("@contents", Formatter.Serialize(logEntry)); connection.Open(); command.ExecuteNonQuery(); } } } public virtual async Task SaveLogAsync(LogEntry logEntry) { using (SqlConnection connection = new SqlConnection(ActiveAppEnvironment.GetConfig<string>("AppConnectionstring"))) { using (SqlCommand command = connection.CreateCommand()) { command.CommandText = @"INSERT INTO [dbo].[Logs] ([Contents]) VALUES (@contents)"; command.Parameters.AddWithValue("@contents", Formatter.Serialize(logEntry)); await connection.OpenAsync(); await command.ExecuteNonQueryAsync(); } } } } }
using Bit.Core.Contracts; using Bit.Core.Models; using System.Data.SqlClient; using System.Threading.Tasks; namespace Flawingo.DataAccess.Implementations { public class SqlServerJsonLogStore : ILogStore { public virtual AppEnvironment ActiveAppEnvironment { get; set; } public virtual IDateTimeProvider DateTimeProvider { get; set; } public virtual IContentFormatter Formatter { get; set; } public void SaveLog(LogEntry logEntry) { using (SqlConnection connection = new SqlConnection(ActiveAppEnvironment.GetConfig<string>("AppConnectionstring"))) { using (SqlCommand command = connection.CreateCommand()) { command.CommandText = @"INSERT INTO [flawingo].[Logs] ([Contents]) VALUES (@contents)"; command.Parameters.AddWithValue("@contents", Formatter.Serialize(logEntry)); connection.Open(); command.ExecuteNonQuery(); } } } public virtual async Task SaveLogAsync(LogEntry logEntry) { using (SqlConnection connection = new SqlConnection(ActiveAppEnvironment.GetConfig<string>("AppConnectionstring"))) { using (SqlCommand command = connection.CreateCommand()) { command.CommandText = @"INSERT INTO [flawingo].[Logs] ([Contents]) VALUES (@contents)"; command.Parameters.AddWithValue("@contents", Formatter.Serialize(logEntry)); await connection.OpenAsync(); await command.ExecuteNonQueryAsync(); } } } } }
mit
C#
5ae85306af476d07b21d624cf24923d5d0185937
update docs and add Recommendation
UgurAldanmaz/NLog,UgurAldanmaz/NLog,BrutalCode/NLog,snakefoot/NLog,luigiberrettini/NLog,luigiberrettini/NLog,NLog/NLog,304NotModified/NLog,sean-gilliam/NLog,BrutalCode/NLog,nazim9214/NLog,nazim9214/NLog
src/NLog/Config/AppDomainFixedOutputAttribute.cs
src/NLog/Config/AppDomainFixedOutputAttribute.cs
// // Copyright (c) 2004-2017 Jaroslaw Kowalski <jaak@jkowalski.net>, Kim Christensen, Julian Verdurmen // // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // * Neither the name of Jaroslaw Kowalski nor the names of its // contributors may be used to endorse or promote products derived from this // software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF // THE POSSIBILITY OF SUCH DAMAGE. // namespace NLog.Config { using System; /// <summary> /// Identifies that the output of layout or layout render does not change for the lifetime of the current appdomain. /// </summary> /// <remarks> /// A layout(renderer) could be converted to a literal when: /// - The layout and all layout properies are SimpleLayout or [AppDomainFixedOutput] /// /// Recommendation: Apply this attribute to a layout or layout-renderer which have the result only changes by properties of type Layout. /// </remarks> [AttributeUsage(AttributeTargets.Class)] public sealed class AppDomainFixedOutputAttribute : Attribute { } }
// // Copyright (c) 2004-2017 Jaroslaw Kowalski <jaak@jkowalski.net>, Kim Christensen, Julian Verdurmen // // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions // are met: // // * Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // * Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation // and/or other materials provided with the distribution. // // * Neither the name of Jaroslaw Kowalski nor the names of its // contributors may be used to endorse or promote products derived from this // software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF // THE POSSIBILITY OF SUCH DAMAGE. // namespace NLog.Config { using System; /// <summary> /// Identifies that the output of layout or layout render does not change for the lifetime of the current appdomain. /// </summary> [AttributeUsage(AttributeTargets.Class)] public sealed class AppDomainFixedOutputAttribute : Attribute { } }
bsd-3-clause
C#
9c8b4d66cb9a9fb8f4d51cd382a2ec295314822f
add missing paid filter to invoices list
stripe/stripe-dotnet,richardlawley/stripe.net
src/Stripe.net/Services/Invoices/StripeInvoiceListOptions.cs
src/Stripe.net/Services/Invoices/StripeInvoiceListOptions.cs
using Newtonsoft.Json; namespace Stripe { public class StripeInvoiceListOptions : StripeListOptions { /// <summary> /// The billing mode of the invoice to retrieve. One of <see cref="StripeBilling" />. /// </summary> [JsonProperty("billing")] public StripeBilling? Billing { get; set; } [JsonProperty("customer")] public string CustomerId { get; set; } [JsonProperty("date")] public StripeDateFilter Date { get; set; } /// <summary> /// A filter on the list based on the object due_date field. /// </summary> [JsonProperty("due_date")] public StripeDateFilter DueDate { get; set; } /// <summary> /// A filter on the list based on the object paid field. /// </summary> [JsonProperty("paid")] public bool Paid { get; set; } [JsonProperty("subscription")] public string SubscriptionId { get; set; } } }
using Newtonsoft.Json; namespace Stripe { public class StripeInvoiceListOptions : StripeListOptions { /// <summary> /// The billing mode of the invoice to retrieve. One of <see cref="StripeBilling" />. /// </summary> [JsonProperty("billing")] public StripeBilling? Billing { get; set; } [JsonProperty("customer")] public string CustomerId { get; set; } [JsonProperty("date")] public StripeDateFilter Date { get; set; } /// <summary> /// A filter on the list based on the object due_date field. /// </summary> [JsonProperty("due_date")] public StripeDateFilter DueDate { get; set; } [JsonProperty("subscription")] public string SubscriptionId { get; set; } } }
apache-2.0
C#
3eaefb93e6f3cf307691a55f313a7f0b9228567c
fix spelling mistake
ZA-PT/Obsidian,ZA-PT/Obsidian,ZA-PT/Obsidian,ZA-PT/Obsidian
src/Obsidian.Application/AccountAPIClaimTypes.cs
src/Obsidian.Application/AccountAPIClaimTypes.cs
using System; using System.Collections.Generic; using System.Text; namespace Obsidian.Application { public class AccountAPIClaimTypes { private const string _prefix = "http://schema.za-pt.org/Obsidian/AccountAPI/"; public const string Profile = _prefix + "UserProfile"; } }
using System; using System.Collections.Generic; using System.Text; namespace Obsidian.Application { public class AccountAPIClaimTypes { private const string _prefix = "http://schema.za-pt.org/Obsidian/AccountAPI/"; public const string Profile = _prefix + "UserPrfile"; } }
apache-2.0
C#
91ca622825acfec0a74e0e564df6f5719cb6ed07
add POST method in ohaeVehicleController.cs
tlaothong/echecker,tlaothong/echecker,tlaothong/echecker,tlaothong/echecker
ECheckerSource/ApiApp/Controllers/ohaeVehicleController.cs
ECheckerSource/ApiApp/Controllers/ohaeVehicleController.cs
using ApiApp.Models; using MongoDB.Bson; using MongoDB.Driver; using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; namespace ApiApp.Controllers { public class ohaeVehicleController : ApiController { /// <summary> /// List vehicles by email. /// </summary> /// <param name="email">username email</param> /// <returns>vehicles</returns> // GET api/vehicles/aaa@aaa.com public IEnumerable<ohaeVehicle> Get(string email) { var client = new MongoDB.Driver.MongoClient("mongodb://MongoLab-4o:UMOcc359jl3WoTatREpo9qAAEGFL87uwoUWVyfusDUk-@ds056288.mongolab.com:56288/MongoLab-4o"); var database = client.GetDatabase("MongoLab-4o"); var collection = database.GetCollection<ohaeVehicle>("test.ohaevehicle"); var document = collection.Find(x => x.Email == email).ToList(); return document; } /// <summary> /// Post a new vehicle. /// </summary> /// <param name="vehicle">The new vehicle.</param> // POST api/values public void Post(ohaeVehicle vehicle) { var client = new MongoDB.Driver.MongoClient("mongodb://MongoLab-4o:UMOcc359jl3WoTatREpo9qAAEGFL87uwoUWVyfusDUk-@ds056288.mongolab.com:56288/MongoLab-4o"); var database = client.GetDatabase("MongoLab-4o"); var collection = database.GetCollection<ohaeVehicle>("test.ohaevehicle"); collection.InsertOne(vehicle); } /// <summary> /// Update the modified value. /// </summary> /// <param name="email">The ref id.</param> /// <param name="value">The new value to be updated.</param> // PUT api/vehicles/aaa@aaa.com public void Put(string email, [FromBody]string value) { var client = new MongoDB.Driver.MongoClient("mongodb://MongoLab-4o:UMOcc359jl3WoTatREpo9qAAEGFL87uwoUWVyfusDUk-@ds056288.mongolab.com:56288/MongoLab-4o"); var database = client.GetDatabase("MongoLab-4o"); var collection = database.GetCollection<ohaeVehicle>("test.ohaevehicle"); var update = Builders<ohaeVehicle>.Update.Set("Province", value); //var documents = collection.Find(x => x.Email == email).ToList(); collection.UpdateMany(x => x.Email == email, update); } } }
using ApiApp.Models; using MongoDB.Bson; using MongoDB.Driver; using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.Http; using System.Web.Http; namespace ApiApp.Controllers { public class ohaeVehicleController : ApiController { /// <summary> /// List values by email. /// </summary> /// <param name="email">username email</param> /// <returns>vehicles</returns> // GET api/vehicles/aaa@aaa.com public IEnumerable<ohaeVehicle> Get(string email) { var client = new MongoDB.Driver.MongoClient("mongodb://MongoLab-4o:UMOcc359jl3WoTatREpo9qAAEGFL87uwoUWVyfusDUk-@ds056288.mongolab.com:56288/MongoLab-4o"); var database = client.GetDatabase("MongoLab-4o"); var collection = database.GetCollection<ohaeVehicle>("test.ohaevehicle"); var document = collection.Find(x => x.Email == email).ToList(); return document; } /// <summary> /// Update the modified value. /// </summary> /// <param name="email">The ref id.</param> /// <param name="value">The new value to be updated.</param> // PUT api/vehicles/aaa@aaa.com public void Put(string email, [FromBody]string value) { var client = new MongoDB.Driver.MongoClient("mongodb://MongoLab-4o:UMOcc359jl3WoTatREpo9qAAEGFL87uwoUWVyfusDUk-@ds056288.mongolab.com:56288/MongoLab-4o"); var database = client.GetDatabase("MongoLab-4o"); var collection = database.GetCollection<ohaeVehicle>("test.ohaevehicle"); var update = Builders<ohaeVehicle>.Update.Set("Province", value); //var documents = collection.Find(x => x.Email == email).ToList(); collection.UpdateMany(x=>x.Email == email, update); } } }
mit
C#
0c38cbe7369ad01ce21640717a71e87c9a78336f
Bump v1.0.14
karronoli/tiny-sato
TinySato/Properties/AssemblyInfo.cs
TinySato/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 // アセンブリに関連付けられている情報を変更するには、 // これらの属性値を変更してください。 [assembly: AssemblyTitle("TinySato")] [assembly: AssemblyDescription("You can construct and send SBPL packet to Sato printer. Sato printer is needed to be recognized by windows driver.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TinySato")] [assembly: AssemblyCopyright("Copyright 2016 karronoli")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから // 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 // その型の ComVisible 属性を true に設定してください。 [assembly: ComVisible(false)] // このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります [assembly: Guid("f56213db-fa1f-42da-b930-b642a56ee840")] // アセンブリのバージョン情報は次の 4 つの値で構成されています: // // メジャー バージョン // マイナー バージョン // ビルド番号 // Revision // // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を // 既定値にすることができます: [assembly: AssemblyVersion("1.0.14")] [assembly: AssemblyFileVersion("1.0.14")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 // アセンブリに関連付けられている情報を変更するには、 // これらの属性値を変更してください。 [assembly: AssemblyTitle("TinySato")] [assembly: AssemblyDescription("You can construct and send SBPL packet to Sato printer. Sato printer is needed to be recognized by windows driver.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TinySato")] [assembly: AssemblyCopyright("Copyright 2016 karronoli")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから // 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 // その型の ComVisible 属性を true に設定してください。 [assembly: ComVisible(false)] // このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります [assembly: Guid("f56213db-fa1f-42da-b930-b642a56ee840")] // アセンブリのバージョン情報は次の 4 つの値で構成されています: // // メジャー バージョン // マイナー バージョン // ビルド番号 // Revision // // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を // 既定値にすることができます: [assembly: AssemblyVersion("1.0.13.24009")] [assembly: AssemblyFileVersion("1.0.13")]
apache-2.0
C#
5cae15cf73b317e0bc7a5c75a7e60d8eafdb020f
Update UnityARCameraSettingsProfileInspector.cs
killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,DDReaper/MixedRealityToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity
Assets/MixedRealityToolkit.Staging/UnityAR/Editor/UnityARCameraSettingsProfileInspector.cs
Assets/MixedRealityToolkit.Staging/UnityAR/Editor/UnityARCameraSettingsProfileInspector.cs
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using Microsoft.MixedReality.Toolkit.Editor; using Microsoft.MixedReality.Toolkit.Utilities.Editor; using System.Linq; using UnityEditor; namespace Microsoft.MixedReality.Toolkit.Experimental.UnityAR { [CustomEditor(typeof(UnityARCameraSettingsProfile))] public class UnityARCameraSettingsProfileInspector : BaseMixedRealityToolkitConfigurationProfileInspector { private const string ProfileTitle = "Unity AR Foundation Camera Settings"; private const string ProfileDescription = ""; // Tracking settings private SerializedProperty poseSource; private SerializedProperty trackingType; private SerializedProperty updateType; protected override void OnEnable() { base.OnEnable(); // Tracking settings poseSource = serializedObject.FindProperty("poseSource"); trackingType = serializedObject.FindProperty("trackingType"); updateType = serializedObject.FindProperty("updateType"); } public override void OnInspectorGUI() { RenderProfileHeader(ProfileTitle, ProfileDescription, target); using (new GUIEnabledWrapper(!IsProfileLock((BaseMixedRealityProfile)target))) { serializedObject.Update(); EditorGUILayout.Space(); EditorGUILayout.LabelField("Tracking Settings", EditorStyles.boldLabel); EditorGUILayout.PropertyField(poseSource); EditorGUILayout.PropertyField(trackingType); EditorGUILayout.PropertyField(updateType); serializedObject.ApplyModifiedProperties(); } } protected override bool IsProfileInActiveInstance() { var profile = target as BaseMixedRealityProfile; return MixedRealityToolkit.IsInitialized && profile != null && MixedRealityToolkit.Instance.HasActiveProfile && MixedRealityToolkit.Instance.ActiveProfile.CameraProfile != null && MixedRealityToolkit.Instance.ActiveProfile.CameraProfile.SettingsConfigurations != null && MixedRealityToolkit.Instance.ActiveProfile.CameraProfile.SettingsConfigurations.Any(s => s.SettingsProfile == profile); } } }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using Microsoft.MixedReality.Toolkit.Editor; using Microsoft.MixedReality.Toolkit.Utilities.Editor; using System.Linq; using UnityEditor; namespace Microsoft.MixedReality.Toolkit.Experimental.UnityAR { [CustomEditor(typeof(UnityARCameraSettingsProfile))] public class UnityARCameraSettingsProfileInspector : BaseMixedRealityToolkitConfigurationProfileInspector { private const string ProfileTitle = "Unity AR Foundation Camera Settings"; private const string ProfileDescription = ""; // Tracking settings private SerializedProperty poseSource; private SerializedProperty trackingType; private SerializedProperty updateType; protected override void OnEnable() { base.OnEnable(); // Tracking settings poseSource = serializedObject.FindProperty("poseSource"); trackingType = serializedObject.FindProperty("trackingType"); updateType = serializedObject.FindProperty("updateType"); } public override void OnInspectorGUI() { RenderProfileHeader(ProfileTitle, ProfileDescription, target, true, BackProfileType.SpatialAwareness); using (new GUIEnabledWrapper(!IsProfileLock((BaseMixedRealityProfile)target))) { serializedObject.Update(); EditorGUILayout.Space(); EditorGUILayout.LabelField("Tracking Settings", EditorStyles.boldLabel); EditorGUILayout.PropertyField(poseSource); EditorGUILayout.PropertyField(trackingType); EditorGUILayout.PropertyField(updateType); serializedObject.ApplyModifiedProperties(); } } protected override bool IsProfileInActiveInstance() { var profile = target as BaseMixedRealityProfile; return MixedRealityToolkit.IsInitialized && profile != null && MixedRealityToolkit.Instance.HasActiveProfile && MixedRealityToolkit.Instance.ActiveProfile.CameraProfile != null && MixedRealityToolkit.Instance.ActiveProfile.CameraProfile.SettingsConfigurations != null && MixedRealityToolkit.Instance.ActiveProfile.CameraProfile.SettingsConfigurations.Any(s => s.SettingsProfile == profile); } } }
mit
C#
b45354ce97c5944bce29cfc35294f9e10ceae70d
Add missing header
johnneijzen/osu,smoogipoo/osu,smoogipoo/osu,smoogipooo/osu,johnneijzen/osu,UselessToucan/osu,peppy/osu-new,ppy/osu,EVAST9919/osu,UselessToucan/osu,peppy/osu,naoey/osu,peppy/osu,DrabWeb/osu,smoogipoo/osu,UselessToucan/osu,DrabWeb/osu,NeoAdonis/osu,2yangk23/osu,NeoAdonis/osu,ppy/osu,2yangk23/osu,ZLima12/osu,EVAST9919/osu,DrabWeb/osu,ZLima12/osu,naoey/osu,ppy/osu,NeoAdonis/osu,peppy/osu,naoey/osu
osu.Game/Online/API/Requests/Responses/APIUserMostPlayedBeatmap.cs
osu.Game/Online/API/Requests/Responses/APIUserMostPlayedBeatmap.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 Newtonsoft.Json; using osu.Game.Beatmaps; using osu.Game.Rulesets; namespace osu.Game.Online.API.Requests.Responses { public class APIUserMostPlayedBeatmap { [JsonProperty("beatmap_id")] public int BeatmapID; [JsonProperty("count")] public int PlayCount; [JsonProperty] private BeatmapInfo beatmap; [JsonProperty] private APIBeatmapSet beatmapSet; public BeatmapInfo GetBeatmapInfo(RulesetStore rulesets) { BeatmapSetInfo setInfo = beatmapSet.ToBeatmapSet(rulesets); beatmap.BeatmapSet = setInfo; beatmap.OnlineBeatmapSetID = setInfo.OnlineBeatmapSetID; beatmap.Metadata = setInfo.Metadata; return beatmap; } } }
using Newtonsoft.Json; using osu.Game.Beatmaps; using osu.Game.Rulesets; namespace osu.Game.Online.API.Requests.Responses { public class APIUserMostPlayedBeatmap { [JsonProperty("beatmap_id")] public int BeatmapID; [JsonProperty("count")] public int PlayCount; [JsonProperty] private BeatmapInfo beatmap; [JsonProperty] private APIBeatmapSet beatmapSet; public BeatmapInfo GetBeatmapInfo(RulesetStore rulesets) { BeatmapSetInfo setInfo = beatmapSet.ToBeatmapSet(rulesets); beatmap.BeatmapSet = setInfo; beatmap.OnlineBeatmapSetID = setInfo.OnlineBeatmapSetID; beatmap.Metadata = setInfo.Metadata; return beatmap; } } }
mit
C#
f2eda57b84343959ca766e54b128e2285fd7535b
Add some flags work on 0x60 0x0A Damage Packet
HelloKitty/Booma.Proxy
src/Booma.Proxy.Packets.BlockServer/Commands/Command60/Sub60ObjectDamageRecievedCommand.cs
src/Booma.Proxy.Packets.BlockServer/Commands/Command60/Sub60ObjectDamageRecievedCommand.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using FreecraftCore.Serializer; namespace Booma.Proxy { //TODO: Finish reverse engineering what each flag means. [Flags] public enum DamageFlag2 : byte { Unknown2 = 2, NormalCreatureDeath = 10, NormalCreatureDeath2 = 11, //Sent sometimes when the creature dies? Maybe for playing no animation? NormalCreatureDeath3 = 14 } [Flags] public enum DamageFlag3 : byte { Unknown9 = 9, Unknown11 = 11, } //https://sylverant.net/wiki/index.php/Packet_0x60#Subcommand_0x0A [WireDataContract] [SubCommand60(SubCommand60OperationCode.ObjectDamageHit)] public sealed class Sub60ObjectDamageRecievedCommand : BaseSubCommand60, IMessageContextIdentifiable { /// <inheritdoc /> public byte Identifier => ObjectIdentifier.Identifier; //Most likely a creature, but could be other things. [WireMember(1)] public MapObjectIdentifier ObjectIdentifier { get; } //Why is this sent twice? Maybe when creatures deal damage to other creatures?? //This version is missing the objecttype/floor [WireMember(2)] private short ObjectIdentifier2 { get; } /// <summary> /// Usually the new health deficiet of the object/creature. /// </summary> [WireMember(3)] private ushort TotalDamageTaken { get; } /// <summary> /// Unknown, seems to always be 0. /// </summary> [WireMember(4)] private byte UnknownFlag1 { get; } [WireMember(5)] private DamageFlag2 UnknownFlag2 { get; } [WireMember(6)] private DamageFlag3 UnknownFlag3 { get; } [WireMember(7)] private byte UnknownFlag4 { get; } /// <inheritdoc /> public Sub60ObjectDamageRecievedCommand(MapObjectIdentifier objectIdentifier, ushort totalDamageTaken, byte[] flags) : this() { ObjectIdentifier = objectIdentifier; ObjectIdentifier2 = objectIdentifier.Identifier; //TODO: We are actually sending extra things we shouldn't here, we may need to change it TotalDamageTaken = totalDamageTaken; //TODO: Legacy reason UnknownFlag1 = flags[0]; UnknownFlag2 = (DamageFlag2)flags[1]; UnknownFlag3 = (DamageFlag3)flags[2]; UnknownFlag4 = flags[3]; } /// <summary> /// Serializer ctor. /// </summary> private Sub60ObjectDamageRecievedCommand() { CommandSize = 0x0C / 4; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using FreecraftCore.Serializer; namespace Booma.Proxy { //https://sylverant.net/wiki/index.php/Packet_0x60#Subcommand_0x0A [WireDataContract] [SubCommand60(SubCommand60OperationCode.ObjectDamageHit)] public sealed class Sub60ObjectDamageRecievedCommand : BaseSubCommand60, IMessageContextIdentifiable { /// <inheritdoc /> public byte Identifier => ObjectIdentifier.Identifier; //Most likely a creature, but could be other things. [WireMember(1)] public MapObjectIdentifier ObjectIdentifier { get; } //Why is this sent twice? Maybe when creatures deal damage to other creatures?? //This version is missing the objecttype/floor [WireMember(2)] private short ObjectIdentifier2 { get; } /// <summary> /// Usually the new health deficiet of the object/creature. /// </summary> [WireMember(3)] private ushort TotalDamageTaken { get; } /// <summary> /// Unknown flags. /// </summary> [WireMember(4)] private uint Flags { get; } /// <inheritdoc /> public Sub60ObjectDamageRecievedCommand(MapObjectIdentifier objectIdentifier, ushort totalDamageTaken, uint flags) : this() { ObjectIdentifier = objectIdentifier; ObjectIdentifier2 = objectIdentifier.Identifier; //TODO: We are actually sending extra things we shouldn't here, we may need to change it TotalDamageTaken = totalDamageTaken; Flags = flags; } /// <summary> /// Serializer ctor. /// </summary> private Sub60ObjectDamageRecievedCommand() { CommandSize = 0x0C / 4; } } }
agpl-3.0
C#
0c5aec81ec615af63ef684a96019aa33d6f6fb8b
Initialize fuse delay and sky quality default value
komakallio/komahub,komakallio/komahub,komakallio/komahub,komakallio/komahub
software/KomaHub/KomaHub/DataTypes.cs
software/KomaHub/KomaHub/DataTypes.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace KomaHub { public class KomahubFactorySettings { public int FirmwareVersion; public int SerialNumber; public int fuseDelay = 100; public float sqmOffset = 21.0f; public bool featureTempProbe; public bool featureSkyQuality; public bool featureAmbientPTH; public bool featureSkyTemperature; } public class KomahubStatus { public bool[] relayIsOpen = new bool[6]; public bool[] fuseIsBlown = new bool[6]; public byte[] pwmDuty = new byte[6]; public float inputVoltage; public float[] outputCurrent = new float[6]; public float temperature; public float humidity; public float pressure; public float externalTemperature; public float skyTemperature; public float skyTemperatureAmbient; public float skyQuality; } public class KomahubOutput { public enum OutputType { OFF = 0, DC = 1, PWM = 2, PWM_PID_HEAT = 3, PWM_PID_COOL = 4, PWM_FAST = 5 } public OutputType type = OutputType.OFF; public String name = ""; public float fuseCurrent = 0.0f; public override bool Equals(object obj) { if (obj == null || GetType() != obj.GetType()) { return false; } KomahubOutput other = (KomahubOutput)obj; return type.Equals(other.type) && name.Equals(other.name) && fuseCurrent == other.fuseCurrent; } public override int GetHashCode() { return type.GetHashCode() + name.GetHashCode() + fuseCurrent.GetHashCode(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace KomaHub { public class KomahubFactorySettings { public int FirmwareVersion; public int SerialNumber; public int fuseDelay; public float sqmOffset; public bool featureTempProbe; public bool featureSkyQuality; public bool featureAmbientPTH; public bool featureSkyTemperature; } public class KomahubStatus { public bool[] relayIsOpen = new bool[6]; public bool[] fuseIsBlown = new bool[6]; public byte[] pwmDuty = new byte[6]; public float inputVoltage; public float[] outputCurrent = new float[6]; public float temperature; public float humidity; public float pressure; public float externalTemperature; public float skyTemperature; public float skyTemperatureAmbient; public float skyQuality; } public class KomahubOutput { public enum OutputType { OFF = 0, DC = 1, PWM = 2, PWM_PID_HEAT = 3, PWM_PID_COOL = 4, PWM_FAST = 5 } public OutputType type = OutputType.OFF; public String name = ""; public float fuseCurrent = 0.0f; public override bool Equals(object obj) { if (obj == null || GetType() != obj.GetType()) { return false; } KomahubOutput other = (KomahubOutput)obj; return type.Equals(other.type) && name.Equals(other.name) && fuseCurrent == other.fuseCurrent; } public override int GetHashCode() { return type.GetHashCode() + name.GetHashCode() + fuseCurrent.GetHashCode(); } } }
mit
C#
9cf91d4b706a91fb0cc0e479484297f00d7ddaf5
Update Assets/MRTK/SDK/Features/Utilities/ConstraintUtils.cs
killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity,killerantz/HoloToolkit-Unity
Assets/MRTK/SDK/Features/Utilities/ConstraintUtils.cs
Assets/MRTK/SDK/Features/Utilities/ConstraintUtils.cs
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using UnityEngine; using System.Collections.Generic; using Microsoft.MixedReality.Toolkit.UI; namespace Microsoft.MixedReality.Toolkit.Utilities { /// <summary> /// Utilities for the management of constraints. /// </summary> internal static class ConstraintUtils { /// <summary> /// Adds a constraint to the specified already-sorted list of constraints, maintaining /// execution priority order. SortedSet is not used, as equal priorities /// break duplicate-checking with SortedSet, as well as SortedSet not being /// able to handle runtime-changing exec priorities. /// </summary> /// <param name="constraintList">Sorted list of existing priorites</param> /// <param name="constraint">Constraint to add</param> /// <param name="comparer">ConstraintExecOrderComparer for comparing two constraint priorities</param> internal static void AddWithPriority(ref List<TransformConstraint> constraintList, TransformConstraint constraint, ConstraintExecOrderComparer comparer) { if (constraintList.Contains(constraint)) { return; } if(constraintList.Count == 0 || comparer.Compare(constraintList[constraintList.Count-1], constraint) < 0) { constraintList.Add(constraint); return; } else if(comparer.Compare(constraintList[0], constraint) > 0) { constraintList.Insert(0, constraint); return; } else { int idx = constraintList.BinarySearch(constraint, comparer); if(idx < 0) { // idx will be the two's complement of the index of the // next element that is "larger" than the given constraint. idx = ~idx; } constraintList.Insert(idx, constraint); } } } }
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. using UnityEngine; using System.Collections.Generic; using Microsoft.MixedReality.Toolkit.UI; namespace Microsoft.MixedReality.Toolkit.Utilities { /// <summary> /// Utilities for the management of constraints. /// </summary> internal static class ConstraintUtils { /// <summary> /// Adds a constraint to the specified already-sorted list of constraints, maintaining /// execution priority order. SortedSet is not used, as equal priorities /// break duplicate-checking with SortedSet, as well as SortedSet not being /// able to handle runtime-changing exec priorities. /// </summary> /// <param name="constraintList">Sorted list of existing priorites</param> /// <param name="constraint">Constraint to add</param> /// <param name="comparer">ConstraintExecOrderComparer for comparing two constraint priorities</param> internal static void AddWithPriority(ref List<TransformConstraint> constraintList, TransformConstraint constraint, ConstraintExecOrderComparer comparer) { if(constraintList.Contains(constraint)) { return; } if(constraintList.Count == 0 || comparer.Compare(constraintList[constraintList.Count-1], constraint) < 0) { constraintList.Add(constraint); return; } else if(comparer.Compare(constraintList[0], constraint) > 0) { constraintList.Insert(0, constraint); return; } else { int idx = constraintList.BinarySearch(constraint, comparer); if(idx < 0) { // idx will be the two's complement of the index of the // next element that is "larger" than the given constraint. idx = ~idx; } constraintList.Insert(idx, constraint); } } } }
mit
C#
bd1c7ea0392d065c551ef7a352dd11e648afcb78
Update ResizingMode.cs
chsword/ResizingServer
source/ResizingClient/ResizingMode.cs
source/ResizingClient/ResizingMode.cs
namespace ResizingClient { public enum ResizingMode { Crop=1, Max=2, Pad=3 } }
namespace ResizingClient { public enum ResizingMode { Crop=1, Max=2,Pad=3 } }
apache-2.0
C#
a402c938db9a447a170688c9a57066108b613ce7
Remove empty regions.
jongleur1983/ClosedXML,igitur/ClosedXML,ClosedXML/ClosedXML,b0bi79/ClosedXML,JavierJJJ/ClosedXML
ClosedXML_Examples/Misc/WorkbookProtection.cs
ClosedXML_Examples/Misc/WorkbookProtection.cs
using System; using ClosedXML.Excel; namespace ClosedXML_Examples.Misc { public class WorkbookProtection : IXLExample { #region Methods // Public public void Create(String filePath) { using (var wb = new XLWorkbook()) { var ws = wb.Worksheets.Add("Workbook Protection"); wb.Protect(true, false, "Abc@123"); wb.SaveAs(filePath); } } #endregion } }
using System; using ClosedXML.Excel; namespace ClosedXML_Examples.Misc { public class WorkbookProtection : IXLExample { #region Variables // Public // Private #endregion #region Properties // Public // Private // Override #endregion #region Events // Public // Private // Override #endregion #region Methods // Public public void Create(String filePath) { using (var wb = new XLWorkbook()) { var ws = wb.Worksheets.Add("Workbook Protection"); wb.Protect(true, false, "Abc@123"); wb.SaveAs(filePath); } } // Private // Override #endregion } }
mit
C#
c65a651acab976871d6ee5923c0bc870017a0b49
Comment Database tables creation at DataAccessModule.cs
B1naryStudio/Azimuth,B1naryStudio/Azimuth
DataAccess/Infrastructure/DataAccessModule.cs
DataAccess/Infrastructure/DataAccessModule.cs
using System.Reflection; using Azimuth.DataAccess.Entities; using Azimuth.DataAccess.Repositories; using NHibernate; using NHibernate.Cfg; using NHibernate.Tool.hbm2ddl; using Ninject.Extensions.Factory; using Ninject.Modules; namespace Azimuth.DataAccess.Infrastructure { public class DataAccessModule : NinjectModule { public override void Load() { Bind<IRepositoryFactory>().ToFactory(); Bind<IUnitOfWork>().To<UnitOfWork>(); Bind<ISessionFactory>().ToMethod(ctx => { var cfg = new Configuration(); cfg.Configure(); cfg.AddAssembly(Assembly.GetExecutingAssembly()); //var schemaExport = new SchemaExport(cfg); //schemaExport.Create(false, true); return cfg.BuildSessionFactory(); }); Bind<IRepository<User>, BaseRepository<User>>().To<UserRepository>(); } } public interface IRepositoryFactory { IRepository<T> Resolve<T>(ISession session) where T : IEntity; } }
using System.Reflection; using Azimuth.DataAccess.Entities; using Azimuth.DataAccess.Repositories; using NHibernate; using NHibernate.Cfg; using NHibernate.Tool.hbm2ddl; using Ninject.Extensions.Factory; using Ninject.Modules; namespace Azimuth.DataAccess.Infrastructure { public class DataAccessModule : NinjectModule { public override void Load() { Bind<IRepositoryFactory>().ToFactory(); Bind<IUnitOfWork>().To<UnitOfWork>(); Bind<ISessionFactory>().ToMethod(ctx => { var cfg = new Configuration(); cfg.Configure(); cfg.AddAssembly(Assembly.GetExecutingAssembly()); var schemaExport = new SchemaExport(cfg); schemaExport.Create(false, true); return cfg.BuildSessionFactory(); }); Bind<IRepository<User>, BaseRepository<User>>().To<UserRepository>(); } } public interface IRepositoryFactory { IRepository<T> Resolve<T>(ISession session) where T : IEntity; } }
mit
C#
a37ffd1b4c726d22ee6a16df715a81b4614ec367
prepare for release
yamamoWorks/azure-activedirectory-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet,makhdumi/azure-activedirectory-library-for-dotnet,bjartebore/azure-activedirectory-library-for-dotnet,AzureAD/microsoft-authentication-library-for-dotnet,LucVK/azure-activedirectory-library-for-dotnet,AndyZhao/azure-activedirectory-library-for-dotnet,AzureAD/azure-activedirectory-library-for-dotnet
src/ADAL.Common/CommonAssemblyInfo.cs
src/ADAL.Common/CommonAssemblyInfo.cs
//---------------------------------------------------------------------- // Copyright (c) Microsoft Open Technologies, Inc. // All Rights Reserved // Apache License 2.0 // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. //---------------------------------------------------------------------- using System; using System.Reflection; [assembly: AssemblyProduct("Active Directory Authentication Library")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: AssemblyCompany("Microsoft Open Technologies")] [assembly: AssemblyCopyright("Copyright (c) Microsoft Open Technologies. All rights reserved.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyVersion("2.18.0.0")] // Keep major and minor versions in AssemblyFileVersion in sync with AssemblyVersion. // Build and revision numbers are replaced on build machine for official builds. [assembly: AssemblyFileVersion("2.18.00000.0000")] // On official build, attribute AssemblyInformationalVersionAttribute is added as well // with its value equal to the hash of the last commit to the git branch. // e.g.: [assembly: AssemblyInformationalVersionAttribute("4392c9835a38c27516fc0cd7bad7bccdcaeab161")] // Assembly marked as compliant. [assembly: CLSCompliant(true)]
//---------------------------------------------------------------------- // Copyright (c) Microsoft Open Technologies, Inc. // All Rights Reserved // Apache License 2.0 // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. //---------------------------------------------------------------------- using System; using System.Reflection; [assembly: AssemblyProduct("Active Directory Authentication Library")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCulture("")] [assembly: AssemblyCompany("Microsoft Open Technologies")] [assembly: AssemblyCopyright("Copyright (c) Microsoft Open Technologies. All rights reserved.")] [assembly: AssemblyTrademark("")] [assembly: AssemblyVersion("2.17.0.0")] // Keep major and minor versions in AssemblyFileVersion in sync with AssemblyVersion. // Build and revision numbers are replaced on build machine for official builds. [assembly: AssemblyFileVersion("2.17.00000.0000")] // On official build, attribute AssemblyInformationalVersionAttribute is added as well // with its value equal to the hash of the last commit to the git branch. // e.g.: [assembly: AssemblyInformationalVersionAttribute("4392c9835a38c27516fc0cd7bad7bccdcaeab161")] // Assembly marked as compliant. [assembly: CLSCompliant(true)]
mit
C#
a5e03696eed22800e819424ec4e12ebf1e112d66
Update DefaultTokenManager.cs
WestDiscGolf/Fitbit.NET,aarondcoleman/Fitbit.NET,AlexGhiondea/Fitbit.NET,amammay/Fitbit.NET,AlexGhiondea/Fitbit.NET,WestDiscGolf/Fitbit.NET,aarondcoleman/Fitbit.NET,AlexGhiondea/Fitbit.NET,amammay/Fitbit.NET,WestDiscGolf/Fitbit.NET,amammay/Fitbit.NET,aarondcoleman/Fitbit.NET
Fitbit.Portable/OAuth2/DefaultTokenManager.cs
Fitbit.Portable/OAuth2/DefaultTokenManager.cs
namespace Fitbit.Api.Portable.OAuth2 { using System.Collections.Generic; using System.Net.Http; using System.Threading.Tasks; internal class DefaultTokenManager : ITokenManager { private static string FitbitOauthPostUrl => "https://api.fitbit.com/oauth2/token"; public async Task<OAuth2AccessToken> RefreshTokenAsync(FitbitClient client) { string postUrl = FitbitOauthPostUrl; var content = new FormUrlEncodedContent(new[] { new KeyValuePair<string, string>("grant_type", "refresh_token"), new KeyValuePair<string, string>("refresh_token", client.AccessToken.RefreshToken), }); HttpClient httpClient; if (client.HttpClient == null) { httpClient = new HttpClient(); } else { httpClient = client.HttpClient; } var clientIdConcatSecret = OAuth2Helper.Base64Encode(client.AppCredentials.ClientId + ":" + client.AppCredentials.ClientSecret); httpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", clientIdConcatSecret); HttpResponseMessage response = await httpClient.PostAsync(postUrl, content); string responseString = await response.Content.ReadAsStringAsync(); return OAuth2Helper.ParseAccessTokenResponse(responseString); } } }
namespace Fitbit.Api.Portable.OAuth2 { using System.Collections.Generic; using System.Net.Http; using System.Threading.Tasks; internal class DefaultTokenManager : ITokenManager { private static string FitbitOauthPostUrl => "https://api.fitbit.com/oauth2/token"; public async Task<OAuth2AccessToken> RefreshTokenAsync(FitbitClient client) { string postUrl = FitbitOauthPostUrl; var content = new FormUrlEncodedContent(new[] { new KeyValuePair<string, string>("grant_type", "refresh_token"), new KeyValuePair<string, string>("refresh_token", client.AccessToken.RefreshToken), }); var httpClient = new HttpClient(); var clientIdConcatSecret = OAuth2Helper.Base64Encode(client.AppCredentials.ClientId + ":" + client.AppCredentials.ClientSecret); httpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", clientIdConcatSecret); HttpResponseMessage response = await httpClient.PostAsync(postUrl, content); string responseString = await response.Content.ReadAsStringAsync(); return OAuth2Helper.ParseAccessTokenResponse(responseString); } } }
mit
C#
a43f006c16141d1ef5fbb73010ea3fdf204250bc
Bump version.
mios-fi/mios.payment
core/Properties/AssemblyInfo.cs
core/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("Mios.Payment")] [assembly: AssemblyDescription("A library for generating and verifying payment details for various online payment providers")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Mios Ltd")] [assembly: AssemblyProduct("Mios.Payment")] [assembly: AssemblyCopyright("Copyright © 2012")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("90888035-e560-4ab7-bcc5-c88aee09f29b")] // 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.0")] [assembly: AssemblyFileVersion("1.1.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("Mios.Payment")] [assembly: AssemblyDescription("A library for generating and verifying payment details for various online payment providers")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Mios Ltd")] [assembly: AssemblyProduct("Mios.Payment")] [assembly: AssemblyCopyright("Copyright © 2012")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("90888035-e560-4ab7-bcc5-c88aee09f29b")] // 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.16.0")] [assembly: AssemblyFileVersion("1.0.16.0")]
bsd-2-clause
C#
6dbccd34e00b4c8a7df557c038b2c9be01be3fbe
work done on menu slider
oussamabonnor1/Catcheep
Documents/Unity3D/Catcheep/Assets/Scripts/startMenuManager.cs
Documents/Unity3D/Catcheep/Assets/Scripts/startMenuManager.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; public class startMenuManager : MonoBehaviour { public GameObject ScrollBarGameObject; private Scrollbar ScrollBar; private Vector2 startPosition; private Vector2 endPosition; private Vector2 edgeOfScreen; private bool goingRightDirection; private float scrollAmount; // Use this for initialization void Start() { if (ScrollBarGameObject == null) ScrollBarGameObject = GameObject.Find("Scrollbar"); startPosition = new Vector2(0, 0); endPosition = new Vector2(0, 0); edgeOfScreen = new Vector2(Screen.width, Screen.height); ScrollBar = ScrollBarGameObject.GetComponent<Scrollbar>(); //basicaly this is true cause we always scroll right first goingRightDirection = true; scrollAmount = 0f; } // Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) startPosition = Input.mousePosition; if (Input.GetMouseButtonUp(0)) endPosition = Input.mousePosition; if (!Input.GetMouseButton(0)) { scrollAmount = Vector2.Distance(startPosition, endPosition); if (scrollAmount > edgeOfScreen.x / 6) { //if start is bigger than end that means the scroll is to the right //(cnt use scroll amount cause it s a positive distance) if (startPosition.x - endPosition.x > 0) { goingRightDirection = true; } else { goingRightDirection = false; } } if (ScrollBar.value > 0 && ScrollBar.value < 0.3) { ScrollBar.value = Mathf.Lerp(ScrollBar.value, 0, 0.05f); } else { if (ScrollBar.value < 1) { ScrollBar.value = Mathf.Lerp(ScrollBar.value, 1, 0.05f); } } } if (ScrollBar.value > 1 || ScrollBar.value < 0) { print("error: " + ScrollBar.value); } } public void farm() { SceneManager.LoadScene("Farm"); } public void snow() { SceneManager.LoadScene("snow"); } public void quit() { Application.Quit(); } }
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; public class startMenuManager : MonoBehaviour { public GameObject ScrollRect; // Use this for initialization void Start () { if( ScrollRect == null) ScrollRect = GameObject.Find("Scrollbar"); } // Update is called once per frame void Update () { if (Input.GetMouseButton(0)) { if (ScrollRect.GetComponent<Scrollbar>().value > 0 && ScrollRect.GetComponent<Scrollbar>().value < 0.4) { ScrollRect.GetComponent<Scrollbar>().value = Mathf.Lerp(ScrollRect.GetComponent<Scrollbar>().value, 0, 0.05f); } else{ if (ScrollRect.GetComponent<Scrollbar>().value < 1) { ScrollRect.GetComponent<Scrollbar>().value = Mathf.Lerp(ScrollRect.GetComponent<Scrollbar>().value, 1, 0.05f); } } } if (ScrollRect.GetComponent<Scrollbar>().value > 1 || ScrollRect.GetComponent<Scrollbar>().value < 0) { print("error: " + ScrollRect.GetComponent<Scrollbar>().value); } } public void farm() { SceneManager.LoadScene("Farm"); } public void snow() { SceneManager.LoadScene("snow"); } public void quit() { Application.Quit(); } }
mit
C#
d5eb5d0f5168ff67b77c50952160d5f1ad089a02
fix comment on IServer
jennings/Turbocharged.Beanstalk
src/Turbocharged.Beanstalk/IServer.cs
src/Turbocharged.Beanstalk/IServer.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Turbocharged.Beanstalk { /// <summary> /// Provides methods useful for inspecting the status of a Beanstalk /// server. /// </summary> public interface IServer { /// <summary> /// The configuration used to create this Beanstalk server. /// </summary> ConnectionConfiguration Configuration { get; } /// <summary> /// Retrieves the list of tubes on the server. /// </summary> Task<List<string>> ListTubesAsync(); /// <summary> /// Delays new jobs from being reserved from a tube for the specified duration. /// </summary> Task<bool> PauseTubeAsync(string tube, TimeSpan duration); /// <summary> /// Retrieves statistics about the connected server. /// </summary> Task<Statistics> ServerStatisticsAsync(); /// <summary> /// Returns statistics about a specified job. /// </summary> Task<JobStatistics> JobStatisticsAsync(int id); /// <summary> /// Retrieves statistics about the specified tube. /// </summary> Task<TubeStatistics> TubeStatisticsAsync(string tube); } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Turbocharged.Beanstalk { /// <summary> /// Provides methods useful for inserting jobs into Beanstalk. /// </summary> public interface IServer { /// <summary> /// The configuration used to create this Beanstalk server. /// </summary> ConnectionConfiguration Configuration { get; } /// <summary> /// Retrieves the list of tubes on the server. /// </summary> Task<List<string>> ListTubesAsync(); /// <summary> /// Delays new jobs from being reserved from a tube for the specified duration. /// </summary> Task<bool> PauseTubeAsync(string tube, TimeSpan duration); /// <summary> /// Retrieves statistics about the connected server. /// </summary> Task<Statistics> ServerStatisticsAsync(); /// <summary> /// Returns statistics about a specified job. /// </summary> Task<JobStatistics> JobStatisticsAsync(int id); /// <summary> /// Retrieves statistics about the specified tube. /// </summary> Task<TubeStatistics> TubeStatisticsAsync(string tube); } }
mit
C#
14260e1e875a7f539ace2eeed39d16d856035de0
Add tracking bug links
DamianEdwards/RazorPagesSample,DamianEdwards/RazorPagesSample
RazorPagesSample/Customers/SeparatePageModels/Index.cshtml.cs
RazorPagesSample/Customers/SeparatePageModels/Index.cshtml.cs
using System; using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.EntityFrameworkCore; namespace RazorPages.Customers { public class CustomersPageModel : PageModel { private readonly AppDbContext _db; public CustomersPageModel(AppDbContext db) { _db = db; } public async Task OnGetAsync() { Message = TempData[nameof(Message)]?.ToString(); Customers = await _db.Customers.AsNoTracking().ToListAsync(); } public async Task<IActionResult> OnPostDeleteAsync(int id) { var customer = await _db.Customers.FindAsync(id); if (customer != null) { _db.Customers.Remove(customer); await _db.SaveChangesAsync(); } TempData[nameof(Message)] = $"Customer {id} deleted successfully"; //Message = $"Customer {id} deleted successfully"; // Tracking issues: // https://github.com/aspnet/Mvc/issues/5953 // https://github.com/aspnet/Mvc/issues/5956 // https://github.com/aspnet/Mvc/issues/5955 return Redirect("~/customers/separatepagemodels/"); } // HACK: Dummy to provide meta-data for helpers, better way to do this? public Customer Customer { get; } public IList<Customer> Customers { get; private set; } // BUG: TempData attribute doesn't appear to be working yet // Tracking issue: https://github.com/aspnet/Mvc/issues/5954 [TempData] public string Message { get; set; } public bool ShowMessage => !string.IsNullOrEmpty(Message); } }
 using System; using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.EntityFrameworkCore; namespace RazorPages.Customers { public class CustomersPageModel : PageModel { private readonly AppDbContext _db; public CustomersPageModel(AppDbContext db) { _db = db; } public async Task OnGetAsync() { Message = TempData[nameof(Message)]?.ToString(); Customers = await _db.Customers.AsNoTracking().ToListAsync(); } public async Task<IActionResult> OnPostDeleteAsync(int id) { var customer = await _db.Customers.FindAsync(id); if (customer != null) { _db.Customers.Remove(customer); await _db.SaveChangesAsync(); } TempData[nameof(Message)] = $"Customer {id} deleted successfully"; //Message = $"Customer {id} deleted successfully"; // IDEA: Have a convneience method for redirecting to yourself, e.g. Reload(), RedirectToSelf() // IDEA: Need overloads of Redirect that take route name/arguments to redirect to manually routed pages // IDEA: What can we do to make redirecting to other pages easier, without having to use URL? // e.g. RedirectToPage(pagePath: "Customers/SeparatePageModels/Index.cshtml", routeArgs, new { routeArg = 1 }) // IDEA: Trailing slash is important when redirecting/navigating to default document, we should automate somehow return Redirect("~/customers/separatepagemodels/"); } // HACK: Dummy to provide meta-data for helpers, better way to do this? public Customer Customer { get; } public IList<Customer> Customers { get; private set; } // BUG: TempData attribute doesn't appear to be working // IDEA: Allow specifying the key for TempData so that it can be easily mirrored across multiple PageModels, // e.g. when setting the message from the Edit page before redirecting back to the Index list. [TempData] public string Message { get; set; } public bool ShowMessage => !string.IsNullOrEmpty(Message); } }
mit
C#
8c116d40f72c669e8975fdaef2dfb9f7792aa8f0
fix bug
100poisha/MaybeFailure,100poisha/MaybeFailure
Source/Maybe/Maybe/Maybe/Maybe.DictionaryExtension.cs
Source/Maybe/Maybe/Maybe/Maybe.DictionaryExtension.cs
using System.Collections.Generic; namespace System { public static partial class Maybe { public static Option<TValue> MaybeGetValue<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key) { return Maybe.GetValue(dictionary, key); } public static Option<TValue> GetValue<TKey, TValue>(IDictionary<TKey, TValue> dictionary, TKey key) { if (dictionary == null) throw new ArgumentNullException("dictionary"); TValue value; if (dictionary.TryGetValue(key, out value)) { if (value != null) { return Option.Some(value); } } return Option.None<TValue>(); } } }
using System.Collections.Generic; namespace System { public static partial class Maybe { public static Option<TValue> MaybeGetValue<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key) { return Maybe.GetValue(dictionary, key); } public static Option<TValue> GetValue<TKey, TValue>(IDictionary<TKey, TValue> dictionary, TKey key) { if (dictionary == null) throw new ArgumentNullException("dictionary"); TValue value; if (dictionary.TryGetValue(key, out value)) { return Option.Some(value); } return Option.None<TValue>(); } } }
mit
C#
1094d88fd05c0ec2c8041a0cc6e3d3e275374fee
Change RedisSubscriberConnection externally owned in Autofac registration
appharbor/ConsolR,jrusbatch/compilify,vendettamit/compilify,appharbor/ConsolR,vendettamit/compilify,jrusbatch/compilify
Web/Infrastructure/DependencyInjection/RedisModule.cs
Web/Infrastructure/DependencyInjection/RedisModule.cs
using Autofac; using BookSleeve; using Compilify.Web.Services; namespace Compilify.Web.Infrastructure.DependencyInjection { public class RedisModule : Module { protected override void Load(ContainerBuilder builder) { builder.Register(x => RedisConnectionGateway.Current) .SingleInstance() .AsSelf(); builder.Register(x => x.Resolve<RedisConnectionGateway>().GetConnection()) .ExternallyOwned() .AsSelf(); builder.Register(x => x.Resolve<RedisConnection>().GetOpenSubscriberChannel()) .ExternallyOwned() .AsSelf(); } } }
using Autofac; using BookSleeve; using Compilify.Web.Services; namespace Compilify.Web.Infrastructure.DependencyInjection { public class RedisModule : Module { protected override void Load(ContainerBuilder builder) { builder.Register(x => RedisConnectionGateway.Current) .SingleInstance() .AsSelf(); builder.Register(x => x.Resolve<RedisConnectionGateway>().GetConnection()) .ExternallyOwned() .AsSelf(); builder.Register(x => x.Resolve<RedisConnection>().GetOpenSubscriberChannel()) .SingleInstance() .AsSelf(); } } }
mit
C#
fe5314ea98bfe0c05d04ea55609190a8a2a0e4f0
Remove old comment
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/Microsoft.Net.Http.Server/NativeInterop/ComNetOS.cs
src/Microsoft.Net.Http.Server/NativeInterop/ComNetOS.cs
// Copyright (c) Microsoft Open Technologies, Inc. // All Rights Reserved // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING // WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF // TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR // NON-INFRINGEMENT. // See the Apache 2 License for the specific language governing // permissions and limitations under the License. // ----------------------------------------------------------------------- // <copyright file="ComNetOS.cs" company="Microsoft"> // Copyright (c) Microsoft Corporation. All rights reserved. // </copyright> // ----------------------------------------------------------------------- using System; using Microsoft.Extensions.Internal; namespace Microsoft.Net.Http.Server { internal static class ComNetOS { // Minimum support for Windows 7 is assumed. internal static readonly bool IsWin8orLater; static ComNetOS() { var win8Version = new Version(6, 2); #if NETSTANDARD1_3 IsWin8orLater = (new Version(RuntimeEnvironment.OperatingSystemVersion) >= win8Version); #else IsWin8orLater = (Environment.OSVersion.Version >= win8Version); #endif } } }
// Copyright (c) Microsoft Open Technologies, Inc. // All Rights Reserved // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR // CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING // WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF // TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR // NON-INFRINGEMENT. // See the Apache 2 License for the specific language governing // permissions and limitations under the License. // ----------------------------------------------------------------------- // <copyright file="ComNetOS.cs" company="Microsoft"> // Copyright (c) Microsoft Corporation. All rights reserved. // </copyright> // ----------------------------------------------------------------------- using System; using Microsoft.Extensions.Internal; namespace Microsoft.Net.Http.Server { internal static class ComNetOS { // Minimum support for Windows 7 is assumed. internal static readonly bool IsWin8orLater; static ComNetOS() { var win8Version = new Version(6, 2); #if NETSTANDARD1_3 // TODO: SkipIOCPCallbackOnSuccess doesn't work on Win7. Need a way to detect Win7 vs 8+. IsWin8orLater = (new Version(RuntimeEnvironment.OperatingSystemVersion) >= win8Version); #else IsWin8orLater = (Environment.OSVersion.Version >= win8Version); #endif } } }
apache-2.0
C#
0e93b5f21fff938634751c8c99e3095496800466
Optimize heading HtmlRenderer
christophano/markdig,lunet-io/markdig
src/Textamina.Markdig/Renderers/Html/HeadingRenderer.cs
src/Textamina.Markdig/Renderers/Html/HeadingRenderer.cs
// Copyright (c) Alexandre Mutel. All rights reserved. // This file is licensed under the BSD-Clause 2 license. // See the license.txt file in the project root for more information. using System.Globalization; using Textamina.Markdig.Syntax; namespace Textamina.Markdig.Renderers.Html { /// <summary> /// An HTML renderer for a <see cref="HeadingBlock"/>. /// </summary> /// <seealso cref="Textamina.Markdig.Renderers.Html.HtmlObjectRenderer{Textamina.Markdig.Syntax.HeadingBlock}" /> public class HeadingRenderer : HtmlObjectRenderer<HeadingBlock> { private static readonly string[] HeadingTexts = { "h1", "h2", "h3", "h4", "h5", "h6", }; protected override void Write(HtmlRenderer renderer, HeadingBlock obj) { var headingText = obj.Level > 0 && obj.Level <= 6 ? HeadingTexts[obj.Level - 1] : "<h" + obj.Level.ToString(CultureInfo.InvariantCulture); renderer.Write("<").Write(headingText).WriteAttributes(obj).Write(">"); renderer.WriteLeafInline(obj); renderer.Write("</").Write(headingText).WriteLine(">"); } } }
// Copyright (c) Alexandre Mutel. All rights reserved. // This file is licensed under the BSD-Clause 2 license. // See the license.txt file in the project root for more information. using System.Globalization; using Textamina.Markdig.Syntax; namespace Textamina.Markdig.Renderers.Html { /// <summary> /// An HTML renderer for a <see cref="HeadingBlock"/>. /// </summary> /// <seealso cref="Textamina.Markdig.Renderers.Html.HtmlObjectRenderer{Textamina.Markdig.Syntax.HeadingBlock}" /> public class HeadingRenderer : HtmlObjectRenderer<HeadingBlock> { protected override void Write(HtmlRenderer renderer, HeadingBlock obj) { var heading = obj.Level.ToString(CultureInfo.InvariantCulture); renderer.Write("<h").Write(heading).WriteAttributes(obj).Write(">"); renderer.WriteLeafInline(obj); renderer.Write("</h").Write(heading).WriteLine(">"); } } }
bsd-2-clause
C#
3df08ccae5d200c4204eed7997e127999b5dd6ef
remove newline
Voxelgon/Voxelgon,Voxelgon/Voxelgon
Assets/Plugins/Voxelgon/Spacecraft/ShipManager.cs
Assets/Plugins/Voxelgon/Spacecraft/ShipManager.cs
using UnityEngine; using System; using System.Collections; using System.Collections.Generic; using Voxelgon; [RequireComponent (typeof (Rigidbody))] public class ShipManager : MonoBehaviour { public float portTransCutoff = 5; //Setup Variables for gathering Ports public enum Direction{ YawLeft, YawRight, TransLeft, TransRight, TransForw, TransBack } //dictionary of ports public Dictionary<Direction, List<GameObject> > portGroups = new Dictionary<Direction, List<GameObject> > (); public void SetupPorts(){ portGroups.Add( Direction.YawLeft, new List<GameObject>() ); portGroups.Add( Direction.YawRight, new List<GameObject>() ); portGroups.Add( Direction.TransLeft, new List<GameObject>() ); portGroups.Add( Direction.TransRight, new List<GameObject>() ); portGroups.Add( Direction.TransForw, new List<GameObject>() ); portGroups.Add( Direction.TransBack, new List<GameObject>() ); Vector3 origin = transform.rigidbody.centerOfMass; Debug.Log(origin); Component[] PortScripts = gameObject.GetComponentsInChildren(typeof(RCSport)); foreach(Component i in PortScripts) { float angle = Voxelgon.Math.RelativeAngle(origin, i.transform); //Debug.Log(angle); if(angle > portTransCutoff){ portGroups[Direction.YawLeft].Add(i.gameObject); //Debug.Log("This port is for turning Left!"); } else if(angle < (-1 * portTransCutoff)){ portGroups[Direction.YawRight].Add(i.gameObject); //Debug.Log("This port is for turning right!"); } } } //Startup Script public void Start() { SetupPorts(); } }
using UnityEngine; using System; using System.Collections; using System.Collections.Generic; using Voxelgon; [RequireComponent (typeof (Rigidbody))] public class ShipManager : MonoBehaviour { public float portTransCutoff = 5; //Setup Variables for gathering Ports public enum Direction{ YawLeft, YawRight, TransLeft, TransRight, TransForw, TransBack } //dictionary of ports public Dictionary<Direction, List<GameObject> > portGroups = new Dictionary<Direction, List<GameObject> > (); public void SetupPorts(){ portGroups.Add( Direction.YawLeft, new List<GameObject>() ); portGroups.Add( Direction.YawRight, new List<GameObject>() ); portGroups.Add( Direction.TransLeft, new List<GameObject>() ); portGroups.Add( Direction.TransRight, new List<GameObject>() ); portGroups.Add( Direction.TransForw, new List<GameObject>() ); portGroups.Add( Direction.TransBack, new List<GameObject>() ); Vector3 origin = transform.rigidbody.centerOfMass; Debug.Log(origin); Component[] PortScripts = gameObject.GetComponentsInChildren(typeof(RCSport)); foreach(Component i in PortScripts) { float angle = Voxelgon.Math.RelativeAngle(origin, i.transform); //Debug.Log(angle); if(angle > portTransCutoff){ portGroups[Direction.YawLeft].Add(i.gameObject); //Debug.Log("This port is for turning Left!"); } else if(angle < (-1 * portTransCutoff)){ portGroups[Direction.YawRight].Add(i.gameObject); //Debug.Log("This port is for turning right!"); } } } //Startup Script public void Start() { SetupPorts(); } }
apache-2.0
C#
52806d4337e6f044668020818484d44abfce0e74
Remove an unused field
adrianbanks/BroadbandSpeedStats,adrianbanks/BroadbandSpeedStats,adrianbanks/BroadbandSpeedStats,adrianbanks/BroadbandSpeedStats
NetgearRouter.Tests/Devices/DevicesParserTests.cs
NetgearRouter.Tests/Devices/DevicesParserTests.cs
using System.Linq; using BroadbandStats.NetgearRouter.Devices; using NUnit.Framework; using Shouldly; namespace NetgearRouter.Tests.Devices { [TestFixture] public sealed class DevicesParserTests { [TestCase(null)] [TestCase("")] [TestCase(" ")] public void ParsingShouldFailOnInvalidInput(string devicesInformation) { var parser = new DevicesParser(new DeviceParser()); var devices = parser.Parse(devicesInformation); devices.Count().ShouldBe(0); } [TestCase("3@")] [TestCase("3@device1")] [TestCase("3@device1@device2")] public void ParsingShouldFailWhenGivenIncompleteInformation(string devicesInformation) { var parser = new DevicesParser(new DeviceParser()); var devices = parser.Parse(devicesInformation); devices.Count().ShouldBe(0); } [TestCase("0@@", 0)] [TestCase("1@device1@", 1)] [TestCase("2@device1@device2@", 2)] [TestCase("3@device1@device2@device3@", 3)] public void ParsingShouldReturnTheCorrectNumberOfDevices(string devicesInformation, int expectedNumberOfDevices) { var parser = new DevicesParser(new DeviceParser()); var devices = parser.Parse(devicesInformation); devices.Count().ShouldBe(expectedNumberOfDevices); } } }
using System.Linq; using BroadbandStats.NetgearRouter.Devices; using NUnit.Framework; using Shouldly; namespace NetgearRouter.Tests.Devices { [TestFixture] public sealed class DevicesParserTests { [TestCase(null)] [TestCase("")] [TestCase(" ")] public void ParsingShouldFailOnInvalidInput(string devicesInformation) { var parser = new DevicesParser(new DeviceParser()); var devices = parser.Parse(devicesInformation); devices.Count().ShouldBe(0); } [TestCase("3@")] [TestCase("3@device1")] [TestCase("3@device1@device2")] public void ParsingShouldFailWhenGivenIncompleteInformation(string devicesInformation) { var parser = new DevicesParser(new DeviceParser()); var devices = parser.Parse(devicesInformation); devices.Count().ShouldBe(0); } [TestCase("0@@", 0)] [TestCase("1@device1@", 1)] [TestCase("2@device1@device2@", 2)] [TestCase("3@device1@device2@device3@", 3)] public void ParsingShouldReturnTheCorrectNumberOfDevices(string devicesInformation, int expectedNumberOfDevices) { var parser = new DevicesParser(new DeviceParser()); var devices = parser.Parse(devicesInformation); devices.Count().ShouldBe(expectedNumberOfDevices); } private const string ExampleInformation = "4@1;192.168.1.2;ANDROID-device;00:00:00:00:00:00;wireless@2;192.168.1.3;BOBS-IPHONE;12:34:56:78:90:AB;wireless@3;192.168.1.4;IPAD;BA:09:87:65:43:21;wireless@4;192.168.1.5;LAPTOP;FF:FF:FF:FF:FF:FF;wireless@"; } }
mit
C#
49766fcf63d82c0e2b14c125b405265ead695f8a
Fix ignored id when reading views
bwatts/Totem,bwatts/Totem
Source/Totem.Runtime/Timeline/ViewDbOperations.cs
Source/Totem.Runtime/Timeline/ViewDbOperations.cs
using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using Totem.Runtime.Map.Timeline; namespace Totem.Runtime.Timeline { /// <summary> /// Extends <see cref="IViewDb"/> with core operations /// </summary> [EditorBrowsable(EditorBrowsableState.Never)] public static class ViewDbOperations { public static View Read(this IViewDb viewDb, Type viewType, Id id, bool strict = true) { return viewDb.Read(viewType, id, strict); } public static TView Read<TView>(this IViewDb viewDb, Id id, bool strict = true) where TView : View { return (TView) viewDb.Read(typeof(TView), id, strict); } public static View Read(this IViewDb viewDb, ViewType viewType, Id id, bool strict = true) { return viewDb.Read(viewType, id, strict); } public static View Read(this IViewDb viewDb, Type viewType, bool strict = true) { return viewDb.Read(viewType, Id.Unassigned, strict); } public static TView Read<TView>(this IViewDb viewDb, bool strict = true) where TView : View { return viewDb.Read<TView>(Id.Unassigned, strict); } public static View Read(this IViewDb viewDb, ViewType viewType, bool strict = true) { return viewDb.Read(viewType, Id.Unassigned, strict); } // // JSON // public static string ReadJson(this IViewDb viewDb, Type viewType, Id id, bool strict = true) { return viewDb.ReadJson(viewType, id, strict); } public static string ReadJson<TView>(this IViewDb viewDb, Id id, bool strict = true) where TView : View { return viewDb.ReadJson(typeof(TView), id, strict); } public static string ReadJson(this IViewDb viewDb, ViewType viewType, Id id, bool strict = true) { return viewDb.ReadJson(viewType, id, strict); } public static string ReadJson(this IViewDb viewDb, Type viewType, bool strict = true) { return viewDb.ReadJson(viewType, Id.Unassigned, strict); } public static string ReadJson<TView>(this IViewDb viewDb, bool strict = true) where TView : View { return viewDb.ReadJson<TView>(Id.Unassigned, strict); } public static string ReadJson(this IViewDb viewDb, ViewType viewType, bool strict = true) { return viewDb.ReadJson(viewType, Id.Unassigned, strict); } } }
using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using Totem.Runtime.Map.Timeline; namespace Totem.Runtime.Timeline { /// <summary> /// Extends <see cref="IViewDb"/> with core operations /// </summary> [EditorBrowsable(EditorBrowsableState.Never)] public static class ViewDbOperations { public static View Read(this IViewDb viewDb, Type viewType, Id id, bool strict = true) { return viewDb.Read(viewType, id, strict); } public static TView Read<TView>(this IViewDb viewDb, Id id, bool strict = true) where TView : View { return (TView) viewDb.Read(typeof(TView), id, strict); } public static View Read(this IViewDb viewDb, ViewType viewType, Id id, bool strict = true) { return viewDb.Read(viewType, Id.Unassigned, strict); } public static View Read(this IViewDb viewDb, Type viewType, bool strict = true) { return viewDb.Read(viewType, Id.Unassigned, strict); } public static TView Read<TView>(this IViewDb viewDb, bool strict = true) where TView : View { return viewDb.Read<TView>(Id.Unassigned, strict); } public static View Read(this IViewDb viewDb, ViewType viewType, bool strict = true) { return viewDb.Read(viewType, Id.Unassigned, strict); } // // JSON // public static string ReadJson(this IViewDb viewDb, Type viewType, Id id, bool strict = true) { return viewDb.ReadJson(viewType, id, strict); } public static string ReadJson<TView>(this IViewDb viewDb, Id id, bool strict = true) where TView : View { return viewDb.ReadJson(typeof(TView), id, strict); } public static string ReadJson(this IViewDb viewDb, ViewType viewType, Id id, bool strict = true) { return viewDb.ReadJson(viewType, id, strict); } public static string ReadJson(this IViewDb viewDb, Type viewType, bool strict = true) { return viewDb.ReadJson(viewType, Id.Unassigned, strict); } public static string ReadJson<TView>(this IViewDb viewDb, bool strict = true) where TView : View { return viewDb.ReadJson<TView>(Id.Unassigned, strict); } public static string ReadJson(this IViewDb viewDb, ViewType viewType, bool strict = true) { return viewDb.ReadJson(viewType, Id.Unassigned, strict); } } }
mit
C#
45d406f98e77c0547e76170fd3b64eee9ed81c4d
Add integer matrices, WIP
ajlopez/TensorSharp
Src/TensorSharp/Operations/AddIntegerOperation.cs
Src/TensorSharp/Operations/AddIntegerOperation.cs
namespace TensorSharp.Operations { using System; using System.Collections.Generic; using System.Linq; using System.Text; public class AddIntegerOperation : INode<int> { private INode<int> left; private INode<int> right; private int rank; private int[] shape; public AddIntegerOperation(INode<int> left, INode<int> right) { this.left = left; this.right = right; this.rank = left.Rank; this.shape = left.Shape; } public int Rank { get { return this.rank; } } public int[] Shape { get { return this.shape; } } public int GetValue(params int[] coordinates) { throw new NotImplementedException(); } public INode<int> Evaluate() { if (this.left.Rank == 1) { int[] newvalues = new int[this.left.Shape[0]]; int l = newvalues.Length; for (int k = 0; k < l; k++) newvalues[k] = this.left.GetValue(k) + this.right.GetValue(k); return new Vector<int>(newvalues); } if (this.left.Rank == 1) { int l = this.left.Shape[0]; int m = this.left.Shape[1]; int[][] newvalues = new int[l][]; for (int k = 0; k < l; k++) { newvalues[k] = new int[m]; for (int j = 0; j < m; j++) newvalues[k][j] = this.left.GetValue(k, j) + this.right.GetValue(k, j); } return new Matrix<int>(newvalues); } if (this.left.Rank == 0) return new SingleValue<int>(this.left.GetValue() + this.right.GetValue()); return null; } } }
namespace TensorSharp.Operations { using System; using System.Collections.Generic; using System.Linq; using System.Text; public class AddIntegerOperation : INode<int> { private INode<int> left; private INode<int> right; private int rank; private int[] shape; public AddIntegerOperation(INode<int> left, INode<int> right) { this.left = left; this.right = right; this.rank = left.Rank; this.shape = left.Shape; } public int Rank { get { return this.rank; } } public int[] Shape { get { return this.shape; } } public int GetValue(params int[] coordinates) { throw new NotImplementedException(); } public INode<int> Evaluate() { if (this.left.Rank == 1) { int[] newvalues = new int[this.left.Shape[0]]; int l = newvalues.Length; for (int k = 0; k < l; k++) newvalues[k] = this.left.GetValue(k) + this.right.GetValue(k); return new Vector<int>(newvalues); } if (this.left.Rank == 0) return new SingleValue<int>(this.left.GetValue() + this.right.GetValue()); return null; } } }
mit
C#
db515fe3d591eca4277ce2c46a689a3a18f2b483
Fix Uap TFM to include Aot
ChadNedzlek/buildtools,MattGal/buildtools,ChadNedzlek/buildtools,stephentoub/buildtools,AlexGhiondea/buildtools,nguerrera/buildtools,MattGal/buildtools,crummel/dotnet_buildtools,weshaggard/buildtools,nguerrera/buildtools,ericstj/buildtools,JeremyKuhne/buildtools,joperezr/buildtools,ericstj/buildtools,tarekgh/buildtools,alexperovich/buildtools,mmitche/buildtools,chcosta/buildtools,JeremyKuhne/buildtools,ChadNedzlek/buildtools,mmitche/buildtools,dotnet/buildtools,karajas/buildtools,tarekgh/buildtools,joperezr/buildtools,AlexGhiondea/buildtools,weshaggard/buildtools,karajas/buildtools,AlexGhiondea/buildtools,alexperovich/buildtools,ericstj/buildtools,AlexGhiondea/buildtools,dotnet/buildtools,crummel/dotnet_buildtools,crummel/dotnet_buildtools,MattGal/buildtools,mmitche/buildtools,mmitche/buildtools,MattGal/buildtools,MattGal/buildtools,alexperovich/buildtools,joperezr/buildtools,chcosta/buildtools,stephentoub/buildtools,dotnet/buildtools,crummel/dotnet_buildtools,joperezr/buildtools,tarekgh/buildtools,ericstj/buildtools,chcosta/buildtools,dotnet/buildtools,tarekgh/buildtools,weshaggard/buildtools,ChadNedzlek/buildtools,alexperovich/buildtools,karajas/buildtools,joperezr/buildtools,nguerrera/buildtools,chcosta/buildtools,stephentoub/buildtools,nguerrera/buildtools,alexperovich/buildtools,karajas/buildtools,JeremyKuhne/buildtools,tarekgh/buildtools,stephentoub/buildtools,mmitche/buildtools,JeremyKuhne/buildtools,weshaggard/buildtools
src/xunit.netcore.extensions/TargetFrameworkMonikers.cs
src/xunit.netcore.extensions/TargetFrameworkMonikers.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; namespace Xunit { [Flags] public enum TargetFrameworkMonikers { Net45 = 0x1, Net451 = 0x2, Net452 = 0x4, Net46 = 0x8, Net461 = 0x10, Net462 = 0x20, Net463 = 0x40, Netcore50 = 0x80, Netcore50aot = 0x100, Netcoreapp1_0 = 0x200, Netcoreapp1_1 = 0x400, NetFramework = 0x800, Netcoreapp = 0x1000, Uap = UapAot | 0x2000, UapAot = 0x4000, NetcoreCoreRT = 0x8000 } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System; namespace Xunit { [Flags] public enum TargetFrameworkMonikers { Net45 = 0x1, Net451 = 0x2, Net452 = 0x4, Net46 = 0x8, Net461 = 0x10, Net462 = 0x20, Net463 = 0x40, Netcore50 = 0x80, Netcore50aot = 0x100, Netcoreapp1_0 = 0x200, Netcoreapp1_1 = 0x400, NetFramework = 0x800, Netcoreapp = 0x1000, Uap = 0x2000, UapAot = 0x4000, NetcoreCoreRT = 0x8000 } }
mit
C#
7fe8c4e04189a821cbeb6f17e7a9747776816691
Support params usage as input for tests
martincostello/adventofcode,martincostello/adventofcode,martincostello/adventofcode,martincostello/adventofcode
tests/AdventOfCode.Tests/Puzzles/PuzzleTestHelpers.cs
tests/AdventOfCode.Tests/Puzzles/PuzzleTestHelpers.cs
// Copyright (c) Martin Costello, 2015. All rights reserved. // Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information. namespace MartinCostello.AdventOfCode.Puzzles { using Xunit; /// <summary> /// A class containing methods for helping to test puzzles. This class cannot be inherited. /// </summary> internal static class PuzzleTestHelpers { /// <summary> /// Solves the specified puzzle type. /// </summary> /// <typeparam name="T">The type of the puzzle to solve.</typeparam> /// <returns> /// The solved puzzle of the type specified by <typeparamref name="T"/>. /// </returns> internal static T SolvePuzzle<T>() where T : IPuzzle, new() { return SolvePuzzle<T>(new string[0]); } /// <summary> /// Solves the specified puzzle type with the specified arguments. /// </summary> /// <typeparam name="T">The type of the puzzle to solve.</typeparam> /// <param name="args">The arguments to pass to the puzzle.</param> /// <returns> /// The solved puzzle of the type specified by <typeparamref name="T"/>. /// </returns> internal static T SolvePuzzle<T>(params string[] args) where T : IPuzzle, new() { // Arrange T puzzle = new T(); // Act int result = puzzle.Solve(args); // Assert Assert.Equal(0, result); return puzzle; } } }
// Copyright (c) Martin Costello, 2015. All rights reserved. // Licensed under the Apache 2.0 license. See the LICENSE file in the project root for full license information. namespace MartinCostello.AdventOfCode.Puzzles { using Xunit; /// <summary> /// A class containing methods for helping to test puzzles. This class cannot be inherited. /// </summary> internal static class PuzzleTestHelpers { /// <summary> /// Solves the specified puzzle type. /// </summary> /// <typeparam name="T">The type of the puzzle to solve.</typeparam> /// <returns> /// The solved puzzle of the type specified by <typeparamref name="T"/>. /// </returns> internal static T SolvePuzzle<T>() where T : IPuzzle, new() { return SolvePuzzle<T>(new string[0]); } /// <summary> /// Solves the specified puzzle type with the specified arguments. /// </summary> /// <typeparam name="T">The type of the puzzle to solve.</typeparam> /// <param name="args">The arguments to pass to the puzzle.</param> /// <returns> /// The solved puzzle of the type specified by <typeparamref name="T"/>. /// </returns> internal static T SolvePuzzle<T>(string[] args) where T : IPuzzle, new() { // Arrange T puzzle = new T(); // Act int result = puzzle.Solve(args); // Assert Assert.Equal(0, result); return puzzle; } } }
apache-2.0
C#
8c5800a94cb6ea52251539c809d476365b3277d0
Update Index.cshtml.cs
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Pages/Index.cshtml.cs
src/ProjectTemplates/Web.ProjectTemplates/content/RazorPagesWeb-CSharp/Pages/Index.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 Microsoft.Extensions.Logging; namespace Company.WebApplication1.Pages { public class IndexModel : PageModel { private readonly ILogger<IndexModel> logger; public IndexModel(ILogger<IndexModel> _logger) { logger = _logger; } public void OnGet() { } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.Extensions.Logging; namespace Company.WebApplication1.Pages { public class IndexModel : PageModel { private readonly ILogger<IndexModel> logger; public ErrorModel(ILogger<IndexModel> _logger) { logger = _logger; } public void OnGet() { } } }
apache-2.0
C#
133321228f9d20aa70ee7ba0073c3fe10926c5c9
Add IServiceResolver
AspectCore/Abstractions,AspectCore/AspectCore-Framework,AspectCore/Lite,AspectCore/AspectCore-Framework
src/IoC/src/AspectCore.Extensions.IoC/ServiceDefinition.cs
src/IoC/src/AspectCore.Extensions.IoC/ServiceDefinition.cs
using System; using System.Collections.Generic; using System.Text; namespace AspectCore.Extensions.IoC { public abstract class ServiceDefinition { } }
using System; using System.Collections.Generic; using System.Text; namespace AspectCore.Extensions.IoC { public class ServiceDefinition { } }
mit
C#
9611a30c37d8f9c782f46efebac2f4a5efdff7aa
Test Commit for Slack Integration
benthroop/Frankenweapon
Assets/Scripts/AIController.cs
Assets/Scripts/AIController.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; public class AIController : MonoBehaviour { public UnityEngine.AI.NavMeshAgent agent { get; private set; } // the navmesh agent required for the path finding public Transform target; // target to aim for public Transform head; private void Start() { // get the components on the object we need ( should not be null due to require component so no need to check ) //testing agent = GetComponentInChildren<UnityEngine.AI.NavMeshAgent>(); agent.updateRotation = false; agent.updatePosition = true; } private void Update() { if (target != null) { agent.SetDestination(target.position); } head.LookAt(target); } public void SetTarget(Transform target) { this.target = target; } }
using System.Collections; using System.Collections.Generic; using UnityEngine; public class AIController : MonoBehaviour { public UnityEngine.AI.NavMeshAgent agent { get; private set; } // the navmesh agent required for the path finding public Transform target; // target to aim for public Transform head; private void Start() { // get the components on the object we need ( should not be null due to require component so no need to check ) agent = GetComponentInChildren<UnityEngine.AI.NavMeshAgent>(); agent.updateRotation = false; agent.updatePosition = true; } private void Update() { if (target != null) { agent.SetDestination(target.position); } head.LookAt(target); } public void SetTarget(Transform target) { this.target = target; } }
mit
C#
b2374c9d7cd4da8e48fb6e6312ebae0e6a20bcc1
Tackle with damage immunity
Carveca/ProjectBurningSteel
Assets/Scripts/EnergyScript.cs
Assets/Scripts/EnergyScript.cs
using UnityEngine; using System.Collections; public class EnergyScript : MonoBehaviour { public float maxEnergy = 100.0f; public float currentEnergy; public float boostCostModifier = 5.0f; public float boostRechargeModifier = 20.0f; public float attritionModifier = 10.0f; public float immunitDuration; private float immunityTimer = 0.0f; void Start() { currentEnergy = maxEnergy; } void Update() { if(immunityTimer > 0.0f) { immunityTimer -= Time.deltaTime; } if (currentEnergy < 0.0f) { EnergyDeath(); } } void OnCollisionEnter(Collision other) { if (other.gameObject.tag == "Player" || other.gameObject.tag == "Wall") { if(immunityTimer <= 0.0f) { currentEnergy -= attritionModifier; } } } void OnCollisionStay(Collision other) { if (other.gameObject.tag == "Player" || other.gameObject.tag == "Wall") { if (immunityTimer <= 0.0f) { currentEnergy -= attritionModifier * Time.deltaTime; } } } public void BoostCost() { currentEnergy -= Time.deltaTime * boostCostModifier; } public void Recharge() { currentEnergy += Time.deltaTime * boostRechargeModifier; } public void AttritionDamage() { currentEnergy -= Time.deltaTime * attritionModifier; } public void Immunity() { if(immunityTimer <= 0.0f) { immunityTimer = 0.5f; } } void EnergyDeath() { GetComponent<PlayerRespawnScript>().Respawn(); } }
using UnityEngine; using System.Collections; public class EnergyScript : MonoBehaviour { public float maxEnergy = 100.0f; public float currentEnergy; public float boostCostModifier = 5.0f; public float boostRechargeModifier = 20.0f; public float attritionModifier = 10.0f; void Start() { currentEnergy = maxEnergy; } void Update() { if (currentEnergy < 0.0f) { EnergyDeath(); } } void OnCollisionEnter(Collision other) { if (other.gameObject.tag == "Player" || other.gameObject.tag == "Wall") { currentEnergy -= attritionModifier; } } void OnCollisionStay(Collision other) { if (other.gameObject.tag == "Player" || other.gameObject.tag == "Wall") { currentEnergy -= Time.deltaTime * attritionModifier; } } public void BoostCost() { currentEnergy -= Time.deltaTime * boostCostModifier; } public void Recharge() { currentEnergy += Time.deltaTime * boostRechargeModifier; } public void AttritionDamage() { currentEnergy -= Time.deltaTime * attritionModifier; } void EnergyDeath() { GetComponent<PlayerRespawnScript>().Respawn(); } }
apache-2.0
C#
bbc860a24afaeb66681351ba8633832d17677dde
Fix issue with checking header value
pekkah/tanka,pekkah/tanka,pekkah/tanka
src/Web/Infrastructure/AppHarborCompatibilityExtensions.cs
src/Web/Infrastructure/AppHarborCompatibilityExtensions.cs
namespace Tanka.Web.Infrastructure { using System; using System.Linq; using global::Nancy; using global::Nancy.Responses; public static class AppHarborCompatibilityExtensions { public static void RequiresHttpsOrXProto(this INancyModule module, bool redirect = true) { module.Before.AddItemToEndOfPipeline(RequiresHttpsOrXForwardedProto(redirect)); } private static Func<NancyContext, Response> RequiresHttpsOrXForwardedProto(bool redirect) { return ctx => { Response response = null; Request request = ctx.Request; if (!IsSecure(request)) { if (redirect && request.Method.Equals("GET", StringComparison.OrdinalIgnoreCase)) { Url redirectUrl = request.Url.Clone(); redirectUrl.Scheme = "https"; redirectUrl.Port = 443; response = new RedirectResponse(redirectUrl.ToString()); } else { response = new Response {StatusCode = HttpStatusCode.Forbidden}; } } return response; }; } private static bool IsSecure(Request request) { if (request.Headers.Keys.Contains("X-Forwarded-Proto")) { var scheme = request.Headers["X-Forwarded-Proto"].FirstOrDefault(); if (!string.IsNullOrWhiteSpace(scheme) && scheme == "https") return true; } return request.Url.IsSecure; } } }
namespace Tanka.Web.Infrastructure { using System; using System.Linq; using global::Nancy; using global::Nancy.Responses; public static class AppHarborCompatibilityExtensions { public static void RequiresHttpsOrXProto(this INancyModule module, bool redirect = true) { module.Before.AddItemToEndOfPipeline(RequiresHttpsOrXForwardedProto(redirect)); } private static Func<NancyContext, Response> RequiresHttpsOrXForwardedProto(bool redirect) { return ctx => { Response response = null; Request request = ctx.Request; string scheme = request.Headers["X-Forwarded-Proto"].SingleOrDefault(); if (!IsSecure(scheme, request.Url)) { if (redirect && request.Method.Equals("GET", StringComparison.OrdinalIgnoreCase)) { Url redirectUrl = request.Url.Clone(); redirectUrl.Scheme = "https"; redirectUrl.Port = 443; response = new RedirectResponse(redirectUrl.ToString()); } else { response = new Response {StatusCode = HttpStatusCode.Forbidden}; } } return response; }; } private static bool IsSecure(string scheme, Url url) { if (scheme == "https") return true; return url.IsSecure; } } }
mit
C#
784d6db0554393973975387fab8fa97bed492de2
Fix an issue with assembly binding which prevents the tests from running by removing the AssemblyCulture.
timmkrause/AspNet.Identity.OracleProvider
src/AspNet.Identity.OracleProvider/Properties/AssemblyInfo.cs
src/AspNet.Identity.OracleProvider/Properties/AssemblyInfo.cs
// Copyright (c) Timm Krause. All rights reserved. See LICENSE file in the project root for license information. using System.Diagnostics.CodeAnalysis; using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("AspNet.Identity.OracleProvider")] [assembly: AssemblyDescription("ASP.NET Identity provider for Oracle databases.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("AspNet.Identity.OracleProvider")] [assembly: AssemblyCopyright("Copyright © Timm Krause 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("051142e2-9936-4eb4-9a92-83a1d1ad63f6")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0-alpha1")] [assembly: SuppressMessage("Microsoft.Design", "CA1014:MarkAssembliesWithClsCompliant", Justification = "Needless.")]
// Copyright (c) Timm Krause. All rights reserved. See LICENSE file in the project root for license information. using System.Diagnostics.CodeAnalysis; using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("AspNet.Identity.OracleProvider")] [assembly: AssemblyDescription("ASP.NET Identity provider for Oracle databases.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("AspNet.Identity.OracleProvider")] [assembly: AssemblyCopyright("Copyright © Timm Krause 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("en-US")] [assembly: ComVisible(false)] [assembly: Guid("051142e2-9936-4eb4-9a92-83a1d1ad63f6")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0-alpha1")] [assembly: SuppressMessage("Microsoft.Design", "CA1014:MarkAssembliesWithClsCompliant", Justification = "Needless.")]
mit
C#
20fc4272a093b75ff80cb93910637442e47cb15a
Update model project to minor version 11
galtrold/propeller.mvc,galtrold/propeller.mvc,galtrold/propeller.mvc,galtrold/propeller.mvc,galtrold/propeller.mvc
src/Framework/PropellerMvcModel/Properties/AssemblyInfo.cs
src/Framework/PropellerMvcModel/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("Propeller.Mvc.Model")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Propeller.Mvc.Model")] [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("479a5641-1614-4d2a-aeab-afa79884e207")] // 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.11")] [assembly: AssemblyFileVersion("1.1.0.11")]
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("Propeller.Mvc.Model")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Propeller.Mvc.Model")] [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("479a5641-1614-4d2a-aeab-afa79884e207")] // 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.10")] [assembly: AssemblyFileVersion("1.1.0.10")]
mit
C#
29aa9005379ee9256c77f3a0ef04d33d3c7290db
Bump version to 1.0.1
HangfireIO/Hangfire.Dashboard.Authorization
Hangfire.Dashboard.Authorization/Properties/AssemblyInfo.cs
Hangfire.Dashboard.Authorization/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("Hangfire.Dashboard.Authorization")] [assembly: AssemblyDescription("Some authorization filters for Hangfire's Dashboard.")] [assembly: AssemblyProduct("Hangfire")] [assembly: AssemblyCopyright("Copyright © 2014 Sergey Odinokov")] // 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("34dd541a-5bdb-402f-8ec0-9aac8e3331ae")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyVersion("1.0.1")] [assembly: AssemblyFileVersion("1.0.0.0")]
using System.Reflection; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Hangfire.Dashboard.Authorization")] [assembly: AssemblyDescription("Some authorization filters for Hangfire's Dashboard.")] [assembly: AssemblyProduct("Hangfire")] [assembly: AssemblyCopyright("Copyright © 2014 Sergey Odinokov")] // 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("34dd541a-5bdb-402f-8ec0-9aac8e3331ae")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyVersion("1.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
748d64ad030a235c3cf080058a2fe4414cd08b42
Add placeholder version numbers to AssemblyInfo. Appveyor cannot patch without them.
DogusTeknoloji/BatMap
BatMap/Properties/AssemblyInfo.cs
BatMap/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("BatMap - Convention-based fast mapper")] [assembly: AssemblyDescription("BatMap - The Mapper we deserve, not the one we need. Opininated (yet another) mapper, mainly to convert between EF Entities and DTOs.")] #if DEBUG [assembly: AssemblyConfiguration("Debug")] #else [assembly: AssemblyConfiguration("Release")] #endif [assembly: AssemblyCompany("Doğuş Teknoloji")] [assembly: AssemblyProduct("BatMap: convention-based, fast object mapper")] [assembly: AssemblyCopyright("Copyright (c) 2017")] [assembly: AssemblyTrademark("BatMap")] [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)] [assembly: AssemblyVersion("1")] [assembly: AssemblyFileVersion("1")]
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("BatMap - Convention-based fast mapper")] [assembly: AssemblyDescription("BatMap - The Mapper we deserve, not the one we need. Opininated (yet another) mapper, mainly to convert between EF Entities and DTOs.")] #if DEBUG [assembly: AssemblyConfiguration("Debug")] #else [assembly: AssemblyConfiguration("Release")] #endif [assembly: AssemblyCompany("Doğuş Teknoloji")] [assembly: AssemblyProduct("BatMap: convention-based, fast object mapper")] [assembly: AssemblyCopyright("Copyright (c) 2017")] [assembly: AssemblyTrademark("BatMap")] [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)]
mit
C#
eaaef0c763200e01da0cf7de39ed74862704ffc6
fix off by one
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi.Gui/Controls/LockScreen/LockScreenViewModel.cs
WalletWasabi.Gui/Controls/LockScreen/LockScreenViewModel.cs
using System; using ReactiveUI; using System.Reactive.Disposables; using WalletWasabi.Helpers; using System.Reactive.Linq; using WalletWasabi.Gui.ViewModels; namespace WalletWasabi.Gui.Controls.LockScreen { public class LockScreenViewModel : ViewModelBase { private CompositeDisposable Disposables { get; } public Global Global { get; } public LockScreenViewModel(Global global) { Global = Guard.NotNull(nameof(Global), global); Disposables = new CompositeDisposable(); } private ILockScreenViewModel _activeLockScreen; public ILockScreenViewModel ActiveLockScreen { get => _activeLockScreen; set => this.RaiseAndSetIfChanged(ref _activeLockScreen, value); } private ObservableAsPropertyHelper<string> _pinHash; public string PinHash => _pinHash?.Value ?? default; private bool _isLocked; public bool IsLocked { get => _isLocked; set => this.RaiseAndSetIfChanged(ref _isLocked, value); } public void Initialize() { Global.UiConfig .WhenAnyValue(x => x.LockScreenActive) .ObserveOn(RxApp.MainThreadScheduler) .BindTo(this, y => y.IsLocked) .DisposeWith(Disposables); this.WhenAnyValue(x => x.IsLocked) .ObserveOn(RxApp.MainThreadScheduler) .BindTo(Global.UiConfig, y => y.LockScreenActive) .DisposeWith(Disposables); _pinHash = Global.UiConfig .WhenAnyValue(x => x.LockScreenPinHash) .ObserveOn(RxApp.MainThreadScheduler) .Do(x => CheckLockScreenType(x)) .ToProperty(this, x => x.PinHash); } private void CheckLockScreenType(string currentHash) { ActiveLockScreen?.Dispose(); if (currentHash.Length != 0) { ActiveLockScreen = new PinLockScreenViewModel(this); } else { ActiveLockScreen = new SlideLockScreenViewModel(this); } } } }
using System; using ReactiveUI; using System.Reactive.Disposables; using WalletWasabi.Helpers; using System.Reactive.Linq; using WalletWasabi.Gui.ViewModels; namespace WalletWasabi.Gui.Controls.LockScreen { public class LockScreenViewModel : ViewModelBase { private CompositeDisposable Disposables { get; } public Global Global { get; } public LockScreenViewModel(Global global) { Global = Guard.NotNull(nameof(Global), global); Disposables = new CompositeDisposable(); } private ILockScreenViewModel _activeLockScreen; public ILockScreenViewModel ActiveLockScreen { get => _activeLockScreen; set => this.RaiseAndSetIfChanged(ref _activeLockScreen, value); } private ObservableAsPropertyHelper<string> _pinHash; public string PinHash => _pinHash?.Value ?? default; private bool _isLocked; public bool IsLocked { get => _isLocked; set => this.RaiseAndSetIfChanged(ref _isLocked, value); } public void Initialize() { Global.UiConfig .WhenAnyValue(x => x.LockScreenActive) .ObserveOn(RxApp.MainThreadScheduler) .BindTo(this, y => y.IsLocked) .DisposeWith(Disposables); this.WhenAnyValue(x => x.IsLocked) .ObserveOn(RxApp.MainThreadScheduler) .BindTo(Global.UiConfig, y => y.LockScreenActive) .DisposeWith(Disposables); _pinHash = Global.UiConfig .WhenAnyValue(x => x.LockScreenPinHash) .ObserveOn(RxApp.MainThreadScheduler) .Do(x => CheckLockScreenType(x)) .ToProperty(this, x => x.PinHash); } private void CheckLockScreenType(string currentHash) { ActiveLockScreen?.Dispose(); if (currentHash.Length == 0) { ActiveLockScreen = new PinLockScreenViewModel(this); } else { ActiveLockScreen = new SlideLockScreenViewModel(this); } } } }
mit
C#
69ca17cb264d0b8eb93b3a63ed01fb935c99a3f4
Update OpenIddictCustomizer to inherit from RelationalModelCustomizer instead of ModelCustomizer
openiddict/openiddict-core,openiddict/openiddict-core,openiddict/openiddict-core,openiddict/openiddict-core,openiddict/core,openiddict/openiddict-core,openiddict/core
src/OpenIddict.EntityFrameworkCore/OpenIddictCustomizer.cs
src/OpenIddict.EntityFrameworkCore/OpenIddictCustomizer.cs
/* * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) * See https://github.com/openiddict/openiddict-core for more information concerning * the license and the contributors participating to this project. */ using System; using JetBrains.Annotations; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.Extensions.DependencyInjection; using OpenIddict.Models; namespace OpenIddict.EntityFrameworkCore { /// <summary> /// Represents a model customizer able to register the entity sets /// required by the OpenIddict stack in an Entity Framework context. /// </summary> public class OpenIddictCustomizer<TApplication, TAuthorization, TScope, TToken, TKey> : RelationalModelCustomizer where TApplication : OpenIddictApplication<TKey, TAuthorization, TToken>, new() where TAuthorization : OpenIddictAuthorization<TKey, TApplication, TToken>, new() where TScope : OpenIddictScope<TKey>, new() where TToken : OpenIddictToken<TKey, TApplication, TAuthorization>, new() where TKey : IEquatable<TKey> { public OpenIddictCustomizer([NotNull] ModelCustomizerDependencies dependencies) : base(dependencies) { } public override void Customize([NotNull] ModelBuilder builder, [NotNull] DbContext context) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } if (context == null) { throw new ArgumentNullException(nameof(context)); } // Register the OpenIddict entity sets. builder.UseOpenIddict<TApplication, TAuthorization, TScope, TToken, TKey>(); base.Customize(builder, context); } } }
/* * Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0) * See https://github.com/openiddict/openiddict-core for more information concerning * the license and the contributors participating to this project. */ using System; using JetBrains.Annotations; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.Extensions.DependencyInjection; using OpenIddict.Models; namespace OpenIddict.EntityFrameworkCore { /// <summary> /// Represents a model customizer able to register the entity sets /// required by the OpenIddict stack in an Entity Framework context. /// </summary> public class OpenIddictCustomizer<TApplication, TAuthorization, TScope, TToken, TKey> : ModelCustomizer where TApplication : OpenIddictApplication<TKey, TAuthorization, TToken>, new() where TAuthorization : OpenIddictAuthorization<TKey, TApplication, TToken>, new() where TScope : OpenIddictScope<TKey>, new() where TToken : OpenIddictToken<TKey, TApplication, TAuthorization>, new() where TKey : IEquatable<TKey> { public OpenIddictCustomizer([NotNull] ModelCustomizerDependencies dependencies) : base(dependencies) { } public override void Customize([NotNull] ModelBuilder builder, [NotNull] DbContext context) { if (builder == null) { throw new ArgumentNullException(nameof(builder)); } if (context == null) { throw new ArgumentNullException(nameof(context)); } // Register the OpenIddict entity sets. builder.UseOpenIddict<TApplication, TAuthorization, TScope, TToken, TKey>(); base.Customize(builder, context); } } }
apache-2.0
C#
7a50974800017f0a3ea08b89ad8fcc0ea18e1512
Make FileModel internal.
maraf/WebCamImageCollector
src/WebCamImageCollector.Background/Capturing/FileModel.cs
src/WebCamImageCollector.Background/Capturing/FileModel.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Windows.Storage.Streams; namespace WebCamImageCollector.Capturing { internal sealed class FileModel { public IInputStream Content { get; private set; } public long Size { get; private set; } public DateTime CreatedAt { get; private set; } public FileModel(IInputStream content, long size, DateTime createdAt) { Content = content; Size = size; CreatedAt = createdAt; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Windows.Storage.Streams; namespace WebCamImageCollector.Capturing { public sealed class FileModel { public IInputStream Content { get; private set; } public long Size { get; private set; } public DateTime CreatedAt { get; private set; } public FileModel(IInputStream content, long size, DateTime createdAt) { Content = content; Size = size; CreatedAt = createdAt; } } }
apache-2.0
C#
59f53559d01ac211276a17f1e96d848f4166b6c1
Fix null exception
Serasvatie/Parakeet
Parakeet/Parakeet/View/ResultWindow/ResultWindow.xaml.cs
Parakeet/Parakeet/View/ResultWindow/ResultWindow.xaml.cs
using Manager; using Parakeet.ViewModel.ResultWindow; using System; using System.Collections.Generic; using System.Linq; using System.Windows; namespace Parakeet.View.ResultWindow { /// <summary> /// Logique d'interaction pour ResultWindow.xaml /// </summary> public partial class ResultWindow : Window { private ResultWindowViewModel ResultViewModel; public ResultWindow(object result) { InitializeComponent(); if (result is List<DocDistModel>) ResultViewModel = new ResultWindowViewModel(result as List<DocDistResultModel>); else Close(); this.DocDist.DataContext = ResultViewModel; } } }
using Manager; using Parakeet.ViewModel.ResultWindow; using System; using System.Collections.Generic; using System.Linq; using System.Windows; namespace Parakeet.View.ResultWindow { /// <summary> /// Logique d'interaction pour ResultWindow.xaml /// </summary> public partial class ResultWindow : Window { private ResultWindowViewModel ResultViewModel; public ResultWindow(object result) { InitializeComponent(); ResultViewModel = new ResultWindowViewModel(result as List<DocDistResultModel>); this.DocDist.DataContext = ResultViewModel; } } }
mit
C#
bd64b17c53f8c6e21c7ba072283af36bd800eea6
Bump version
InEngine-NET/InEngine.NET,InEngine-NET/InEngine.NET,InEngine-NET/InEngine.NET
configuration/SharedAssemblyInfo.cs
configuration/SharedAssemblyInfo.cs
using System.Reflection; // Assembly Info that is shared across the product [assembly: AssemblyProduct("InEngine.NET")] [assembly: AssemblyVersion("2.0.2.*")] [assembly: AssemblyInformationalVersion("2.0.2")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Ethan Hann")] [assembly: AssemblyCopyright("Copyright © Ethan Hann 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyDescription("")]
using System.Reflection; // Assembly Info that is shared across the product [assembly: AssemblyProduct("InEngine.NET")] [assembly: AssemblyVersion("2.0.1.*")] [assembly: AssemblyInformationalVersion("2.0.1")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Ethan Hann")] [assembly: AssemblyCopyright("Copyright © Ethan Hann 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: AssemblyDescription("")]
mit
C#
bcbd0e096165cd7d1cf3ad871e43b9fc1a79e3e6
Revert ctor param
ppy/osu,peppy/osu,smoogipoo/osu,peppy/osu,peppy/osu,smoogipoo/osu,smoogipoo/osu,peppy/osu-new,NeoAdonis/osu,NeoAdonis/osu,ppy/osu,NeoAdonis/osu,ppy/osu,smoogipooo/osu
osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyApproachCircle.cs
osu.Game.Rulesets.Osu/Skinning/Legacy/LegacyApproachCircle.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.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Skinning; using osuTK; using osuTK.Graphics; namespace osu.Game.Rulesets.Osu.Skinning.Legacy { public class LegacyApproachCircle : SkinnableSprite { private readonly IBindable<Color4> accentColour = new Bindable<Color4>(); [Resolved] private DrawableHitObject drawableObject { get; set; } public LegacyApproachCircle() : base("Gameplay/osu/approachcircle") { } [BackgroundDependencyLoader] private void load() { accentColour.BindTo(drawableObject.AccentColour); } protected override void LoadComplete() { base.LoadComplete(); accentColour.BindValueChanged(colour => Colour = LegacyColourCompatibility.DisallowZeroAlpha(colour.NewValue), true); } protected override Drawable CreateDefault(ISkinComponent component) { var drawable = base.CreateDefault(component); // account for the sprite being used for the default approach circle being taken from stable, // when hitcircles have 5px padding on each size. this should be removed if we update the sprite. drawable.Scale = new Vector2(128 / 118f); return drawable; } } }
// 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.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Skinning; using osuTK; using osuTK.Graphics; namespace osu.Game.Rulesets.Osu.Skinning.Legacy { public class LegacyApproachCircle : SkinnableSprite { private readonly IBindable<Color4> accentColour = new Bindable<Color4>(); [Resolved] private DrawableHitObject drawableObject { get; set; } public LegacyApproachCircle() : base("approachcircle") { } [BackgroundDependencyLoader] private void load() { accentColour.BindTo(drawableObject.AccentColour); } protected override void LoadComplete() { base.LoadComplete(); accentColour.BindValueChanged(colour => Colour = LegacyColourCompatibility.DisallowZeroAlpha(colour.NewValue), true); } protected override Drawable CreateDefault(ISkinComponent component) { var drawable = base.CreateDefault(component); // account for the sprite being used for the default approach circle being taken from stable, // when hitcircles have 5px padding on each size. this should be removed if we update the sprite. drawable.Scale = new Vector2(128 / 118f); return drawable; } } }
mit
C#
4ea890e229f29aa67eaef340f8d16d993548c4fb
Update RelativeRectComparer.cs
wieslawsoltes/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,kekekeks/Perspex,jkoritzinsky/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,MrDaedra/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,Perspex/Perspex,SuperJMN/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,wieslawsoltes/Perspex,susloparovdenis/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,wieslawsoltes/Perspex,punker76/Perspex,grokys/Perspex,SuperJMN/Avalonia,OronDF343/Avalonia,susloparovdenis/Perspex,jkoritzinsky/Avalonia,akrisiun/Perspex,OronDF343/Avalonia,kekekeks/Perspex,susloparovdenis/Avalonia,wieslawsoltes/Perspex,MrDaedra/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,jazzay/Perspex,jkoritzinsky/Avalonia,Perspex/Perspex,SuperJMN/Avalonia,susloparovdenis/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia
tests/Perspex.SceneGraph.UnitTests/RelativeRectComparer.cs
tests/Perspex.SceneGraph.UnitTests/RelativeRectComparer.cs
// Copyright (c) The Perspex Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; using System.Collections.Generic; namespace Perspex.SceneGraph.UnitTests { public class RelativeRectComparer : IEqualityComparer<RelativeRect> { public bool Equals(RelativeRect a, RelativeRect b) { return a.Unit == b.Unit && Math.Round(a.Rect.X, 3) == Math.Round(b.Rect.X, 3) && Math.Round(a.Rect.Y, 3) == Math.Round(b.Rect.Y, 3) && Math.Round(a.Rect.Width, 3) == Math.Round(b.Rect.Width, 3) && Math.Round(a.Rect.Height, 3) == Math.Round(b.Rect.Height, 3); } public int GetHashCode(RelativeRect obj) { throw new NotImplementedException(); } } }
// Copyright (c) The Perspex Project. All rights reserved. // Licensed under the MIT license. See licence.md file in the project root for full license information. using System; using System.Collections.Generic; namespace Perspex.SceneGraph.UnitTests { public class RelativeRectComparer : IEqualityComparer<RelativeRect> { public bool Equals(RelativeRect a, RelativeRect b) { return a.Unit == b.Unit && Math.Round(a.Rect.X, 3) == Math.Round(b.Rect.X, 3) && Math.Round(a.Rect.Y, 3) == Math.Round(b.Rect.Y, 3) && Math.Round(a.Rect.Width, 3) == Math.Round(b.Rect.Width, 3) && Math.Round(a.Rect.Height, 3) == Math.Round(b.Rect.Height, 3); } public int GetHashCode(Rect obj) { throw new NotImplementedException(); } } }
mit
C#
495cb3a3bde1a9101c3a6c721c4f1e73bf96be90
Add missing using
wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,Core2D/Core2D
src/Core2D.Avalonia/Dock/Handlers/DropHelper.cs
src/Core2D.Avalonia/Dock/Handlers/DropHelper.cs
// Copyright (c) Wiesław Šoltés. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using Avalonia; using Avalonia.Controls; using Avalonia.Controls.PanAndZoom; using Avalonia.Input; using Avalonia.VisualTree; namespace Core2D.Avalonia.Dock.Handlers { public static class DropHelper { public static Point FixInvalidPosition(IControl control, Point point) { var matrix = control?.RenderTransform?.Value; return matrix != null ? MatrixHelper.TransformPoint(matrix.Value.Invert(), point) : point; } public static Point GetPosition(object sender, DragEventArgs e) { var relativeTo = e.Source as IControl; var point = e.GetPosition(relativeTo); return FixInvalidPosition(relativeTo, point); } public static Point GetPositionScreen(object sender, DragEventArgs e) { var relativeTo = e.Source as IControl; var point = e.GetPosition(relativeTo); var visual = relativeTo as IVisual; var screenPoint = visual.PointToScreen(point); return FixInvalidPosition(relativeTo, screenPoint); } } }
// Copyright (c) Wiesław Šoltés. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using Avalonia; using Avalonia.Controls; using Avalonia.Controls.PanAndZoom; using Avalonia.Input; namespace Core2D.Avalonia.Dock.Handlers { public static class DropHelper { public static Point FixInvalidPosition(IControl control, Point point) { var matrix = control?.RenderTransform?.Value; return matrix != null ? MatrixHelper.TransformPoint(matrix.Value.Invert(), point) : point; } public static Point GetPosition(object sender, DragEventArgs e) { var relativeTo = e.Source as IControl; var point = e.GetPosition(relativeTo); return FixInvalidPosition(relativeTo, point); } public static Point GetPositionScreen(object sender, DragEventArgs e) { var relativeTo = e.Source as IControl; var point = e.GetPosition(relativeTo); var visual = relativeTo as IVisual; var screenPoint = visual.PointToScreen(point); return FixInvalidPosition(relativeTo, screenPoint); } } }
mit
C#
cf77dbf081a07275e2f7e1b985291ea058737113
Use `RegexOptions.ECMAScript`
mariomka/regex-benchmark,mariomka/regex-benchmark,mariomka/regex-benchmark,mariomka/regex-benchmark,mariomka/regex-benchmark,mariomka/regex-benchmark,mariomka/regex-benchmark,mariomka/regex-benchmark,mariomka/regex-benchmark,mariomka/regex-benchmark,mariomka/regex-benchmark,mariomka/regex-benchmark,mariomka/regex-benchmark
csharp/Benchmark.cs
csharp/Benchmark.cs
using System; using System.IO; using System.Text.RegularExpressions; using System.Diagnostics; class Benchmark { static void Main(string[] args) { if (args.Length != 1) { Console.WriteLine("Usage: benchmark <filename>"); Environment.Exit(1); } StreamReader reader = new System.IO.StreamReader(args[0]); string data = reader.ReadToEnd(); // Email Benchmark.Measure(data, @"[\w\.+-]+@[\w\.-]+\.[\w\.-]+"); // URI Benchmark.Measure(data, @"[\w]+://[^/\s?#]+[^\s?#]+(?:\?[^\s#]*)?(?:#[^\s]*)?"); // IP Benchmark.Measure(data, @"(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9])"); } static void Measure(string data, string pattern) { Stopwatch stopwatch = Stopwatch.StartNew(); MatchCollection matches = Regex.Matches(data, pattern, RegexOptions.Compiled | RegexOptions.ECMAScript); int count = matches.Count; stopwatch.Stop(); Console.WriteLine(stopwatch.Elapsed.TotalMilliseconds.ToString("G", System.Globalization.CultureInfo.InvariantCulture) + " - " + count); } }
using System; using System.IO; using System.Text.RegularExpressions; using System.Diagnostics; class Benchmark { static void Main(string[] args) { if (args.Length != 1) { Console.WriteLine("Usage: benchmark <filename>"); Environment.Exit(1); } StreamReader reader = new System.IO.StreamReader(args[0]); string data = reader.ReadToEnd(); // Email Benchmark.Measure(data, @"[\w\.+-]+@[\w\.-]+\.[\w\.-]+"); // URI Benchmark.Measure(data, @"[\w]+://[^/\s?#]+[^\s?#]+(?:\?[^\s#]*)?(?:#[^\s]*)?"); // IP Benchmark.Measure(data, @"(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9])"); } static void Measure(string data, string pattern) { Stopwatch stopwatch = Stopwatch.StartNew(); MatchCollection matches = Regex.Matches(data, pattern, RegexOptions.Compiled); int count = matches.Count; stopwatch.Stop(); Console.WriteLine(stopwatch.Elapsed.TotalMilliseconds.ToString("G", System.Globalization.CultureInfo.InvariantCulture) + " - " + count); } }
mit
C#
2381e83d50851042b6eb416c006fdaea87ab8ddb
update version vue
sjoerd222888/MVVM.CEF.Glue,NeutroniumCore/Neutronium,sjoerd222888/MVVM.CEF.Glue,sjoerd222888/MVVM.CEF.Glue,David-Desmaisons/Neutronium,David-Desmaisons/Neutronium,NeutroniumCore/Neutronium,David-Desmaisons/Neutronium,NeutroniumCore/Neutronium
JavascriptFramework/Vue/VueVersions.cs
JavascriptFramework/Vue/VueVersions.cs
using Neutronium.Core.Infra; namespace Neutronium.JavascriptFramework.Vue { internal class VueVersions : IVueVersion { public string FrameworkName { get; } public string Name { get; } public string VueVersion { get; } internal static VueVersions Vue1 { get; } = new VueVersions("vue.js 1.0.25", "VueInjector", "vue1"); internal static VueVersions Vue2 { get; } = new VueVersions("vue.js 2.0.3", "VueInjectorV2", "vue2"); public ResourceReader GetVueResource() { return new ResourceReader($"scripts.{VueVersion}", this); } private VueVersions(string frameworkName, string name, string version) { FrameworkName = frameworkName; Name = name; VueVersion = version; } } }
using Neutronium.Core.Infra; namespace Neutronium.JavascriptFramework.Vue { internal class VueVersions : IVueVersion { public string FrameworkName { get; } public string Name { get; } public string VueVersion { get; } internal static VueVersions Vue1 { get; } = new VueVersions("vue.js 1.0.25", "VueInjector", "vue1"); internal static VueVersions Vue2 { get; } = new VueVersions("vue.js 2.0.1", "VueInjectorV2", "vue2"); public ResourceReader GetVueResource() { return new ResourceReader($"scripts.{VueVersion}", this); } private VueVersions(string frameworkName, string name, string version) { FrameworkName = frameworkName; Name = name; VueVersion = version; } } }
mit
C#
2f28c3b217e6da1d93f81b03a40ea2e1f86bc8a0
Make CodeAction registration as lightweight
bbarry/roslyn,orthoxerox/roslyn,panopticoncentral/roslyn,TyOverby/roslyn,KevinRansom/roslyn,davkean/roslyn,swaroop-sridhar/roslyn,OmarTawfik/roslyn,a-ctor/roslyn,bbarry/roslyn,srivatsn/roslyn,AArnott/roslyn,CaptainHayashi/roslyn,balajikris/roslyn,VSadov/roslyn,wvdd007/roslyn,cston/roslyn,diryboy/roslyn,mattscheffer/roslyn,nguerrera/roslyn,srivatsn/roslyn,mavasani/roslyn,genlu/roslyn,AArnott/roslyn,kelltrick/roslyn,CaptainHayashi/roslyn,jasonmalinowski/roslyn,mmitche/roslyn,eriawan/roslyn,akrisiun/roslyn,mattwar/roslyn,eriawan/roslyn,weltkante/roslyn,lorcanmooney/roslyn,KirillOsenkov/roslyn,jamesqo/roslyn,Hosch250/roslyn,mmitche/roslyn,agocke/roslyn,abock/roslyn,KevinH-MS/roslyn,jmarolf/roslyn,shyamnamboodiripad/roslyn,khyperia/roslyn,abock/roslyn,Giftednewt/roslyn,DustinCampbell/roslyn,sharwell/roslyn,ljw1004/roslyn,MattWindsor91/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,CyrusNajmabadi/roslyn,balajikris/roslyn,Pvlerick/roslyn,natidea/roslyn,tmeschter/roslyn,tvand7093/roslyn,AlekseyTs/roslyn,amcasey/roslyn,wvdd007/roslyn,zooba/roslyn,stephentoub/roslyn,tannergooding/roslyn,kelltrick/roslyn,AArnott/roslyn,mgoertz-msft/roslyn,panopticoncentral/roslyn,jeffanders/roslyn,mavasani/roslyn,jmarolf/roslyn,jasonmalinowski/roslyn,OmarTawfik/roslyn,natidea/roslyn,bartdesmet/roslyn,jhendrixMSFT/roslyn,jasonmalinowski/roslyn,dotnet/roslyn,pdelvo/roslyn,Hosch250/roslyn,nguerrera/roslyn,DustinCampbell/roslyn,robinsedlaczek/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,xoofx/roslyn,jhendrixMSFT/roslyn,KevinH-MS/roslyn,robinsedlaczek/roslyn,zooba/roslyn,bkoelman/roslyn,CyrusNajmabadi/roslyn,jamesqo/roslyn,yeaicc/roslyn,bkoelman/roslyn,AmadeusW/roslyn,MattWindsor91/roslyn,vslsnap/roslyn,paulvanbrenk/roslyn,jamesqo/roslyn,davkean/roslyn,jkotas/roslyn,AnthonyDGreen/roslyn,MichalStrehovsky/roslyn,paulvanbrenk/roslyn,lorcanmooney/roslyn,aelij/roslyn,jhendrixMSFT/roslyn,aelij/roslyn,AlekseyTs/roslyn,MichalStrehovsky/roslyn,KevinRansom/roslyn,MattWindsor91/roslyn,tannergooding/roslyn,ljw1004/roslyn,genlu/roslyn,swaroop-sridhar/roslyn,Pvlerick/roslyn,ErikSchierboom/roslyn,cston/roslyn,amcasey/roslyn,diryboy/roslyn,eriawan/roslyn,Hosch250/roslyn,mgoertz-msft/roslyn,nguerrera/roslyn,mgoertz-msft/roslyn,akrisiun/roslyn,diryboy/roslyn,swaroop-sridhar/roslyn,ljw1004/roslyn,AmadeusW/roslyn,dotnet/roslyn,genlu/roslyn,physhi/roslyn,kelltrick/roslyn,Pvlerick/roslyn,tmat/roslyn,tmeschter/roslyn,reaction1989/roslyn,heejaechang/roslyn,robinsedlaczek/roslyn,stephentoub/roslyn,MichalStrehovsky/roslyn,pdelvo/roslyn,panopticoncentral/roslyn,VSadov/roslyn,mavasani/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,khyperia/roslyn,jkotas/roslyn,jcouv/roslyn,bbarry/roslyn,tmeschter/roslyn,gafter/roslyn,stephentoub/roslyn,bartdesmet/roslyn,jeffanders/roslyn,MattWindsor91/roslyn,tmat/roslyn,physhi/roslyn,KirillOsenkov/roslyn,brettfo/roslyn,mmitche/roslyn,tvand7093/roslyn,brettfo/roslyn,gafter/roslyn,reaction1989/roslyn,orthoxerox/roslyn,mattwar/roslyn,ErikSchierboom/roslyn,brettfo/roslyn,CaptainHayashi/roslyn,drognanar/roslyn,a-ctor/roslyn,amcasey/roslyn,AnthonyDGreen/roslyn,heejaechang/roslyn,vslsnap/roslyn,KevinRansom/roslyn,dotnet/roslyn,drognanar/roslyn,jmarolf/roslyn,mattwar/roslyn,aelij/roslyn,mattscheffer/roslyn,xasx/roslyn,wvdd007/roslyn,gafter/roslyn,Giftednewt/roslyn,jkotas/roslyn,cston/roslyn,sharwell/roslyn,mattscheffer/roslyn,tannergooding/roslyn,abock/roslyn,a-ctor/roslyn,AnthonyDGreen/roslyn,reaction1989/roslyn,shyamnamboodiripad/roslyn,davkean/roslyn,lorcanmooney/roslyn,OmarTawfik/roslyn,TyOverby/roslyn,weltkante/roslyn,tmat/roslyn,jcouv/roslyn,jeffanders/roslyn,sharwell/roslyn,srivatsn/roslyn,vslsnap/roslyn,weltkante/roslyn,agocke/roslyn,agocke/roslyn,orthoxerox/roslyn,akrisiun/roslyn,DustinCampbell/roslyn,xasx/roslyn,yeaicc/roslyn,dpoeschl/roslyn,natidea/roslyn,balajikris/roslyn,drognanar/roslyn,yeaicc/roslyn,KevinH-MS/roslyn,TyOverby/roslyn,ErikSchierboom/roslyn,dpoeschl/roslyn,khyperia/roslyn,heejaechang/roslyn,CyrusNajmabadi/roslyn,VSadov/roslyn,jcouv/roslyn,physhi/roslyn,Giftednewt/roslyn,xoofx/roslyn,tvand7093/roslyn,AmadeusW/roslyn,AlekseyTs/roslyn,bartdesmet/roslyn,bkoelman/roslyn,xoofx/roslyn,dpoeschl/roslyn,KirillOsenkov/roslyn,paulvanbrenk/roslyn,pdelvo/roslyn,shyamnamboodiripad/roslyn,zooba/roslyn,xasx/roslyn
src/Features/Core/Portable/CodeFixes/PreferFrameworkType/PreferFrameworkTypeCodeFixProvider.cs
src/Features/Core/Portable/CodeFixes/PreferFrameworkType/PreferFrameworkTypeCodeFixProvider.cs
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Immutable; using System.Composition; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CodeFixes.PreferFrameworkType { [ExportCodeFixProvider(LanguageNames.CSharp, LanguageNames.VisualBasic, Name = PredefinedCodeFixProviderNames.PreferFrameworkType), Shared] internal class PreferFrameworkTypeCodeFixProvider : CodeFixProvider { public sealed override ImmutableArray<string> FixableDiagnosticIds => ImmutableArray.Create( IDEDiagnosticIds.PreferFrameworkTypeInDeclarationsDiagnosticId, IDEDiagnosticIds.PreferFrameworkTypeInMemberAccessDiagnosticId); public override FixAllProvider GetFixAllProvider() => BatchFixAllProvider.Instance; public override Task RegisterCodeFixesAsync(CodeFixContext context) { var codeAction = new CodeAction.DocumentChangeAction( title: FeaturesResources.Use_framework_type, createChangedDocument: c => CreateChangedDocumentAsync(context.Document, context.Span, c), equivalenceKey: FeaturesResources.Use_framework_type); context.RegisterCodeFix(codeAction, context.Diagnostics); return SpecializedTasks.EmptyTask; } private async Task<Document> CreateChangedDocumentAsync(Document document, TextSpan span, CancellationToken cancellationToken) { var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var node = root.FindNode(span, findInsideTrivia: true, getInnermostNodeForTie: true); var semanticModel = await document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false); var generator = document.GetLanguageService<SyntaxGenerator>(); var replacementNode = GetReplacementSyntax(node, generator, semanticModel, cancellationToken); return await document.ReplaceNodeAsync(node, replacementNode, cancellationToken).ConfigureAwait(false); } private SyntaxNode GetReplacementSyntax(SyntaxNode node, SyntaxGenerator generator, SemanticModel semanticModel, CancellationToken cancellationToken) { var typeSymbol = (ITypeSymbol)semanticModel.GetSymbolInfo(node, cancellationToken).Symbol; return generator.TypeExpression(typeSymbol).WithTriviaFrom(node); } } }
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Immutable; using System.Composition; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.CodeFixes.PreferFrameworkType { [ExportCodeFixProvider(LanguageNames.CSharp, LanguageNames.VisualBasic, Name = PredefinedCodeFixProviderNames.PreferFrameworkType), Shared] internal class PreferFrameworkTypeCodeFixProvider : CodeFixProvider { public sealed override ImmutableArray<string> FixableDiagnosticIds => ImmutableArray.Create( IDEDiagnosticIds.PreferFrameworkTypeInDeclarationsDiagnosticId, IDEDiagnosticIds.PreferFrameworkTypeInMemberAccessDiagnosticId); public override FixAllProvider GetFixAllProvider() => BatchFixAllProvider.Instance; public override async Task RegisterCodeFixesAsync(CodeFixContext context) { var document = context.Document; var span = context.Span; var cancellationToken = context.CancellationToken; var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var node = root.FindNode(span, findInsideTrivia: true, getInnermostNodeForTie: true); var semanticModel = await context.Document.GetSemanticModelAsync(cancellationToken).ConfigureAwait(false); var generator = document.GetLanguageService<SyntaxGenerator>(); var codeAction = new CodeAction.DocumentChangeAction( title: FeaturesResources.Use_framework_type, createChangedDocument: c => CreateChangedDocument(document, node, generator, semanticModel, c), equivalenceKey: FeaturesResources.Use_framework_type); context.RegisterCodeFix(codeAction, context.Diagnostics); } private Task<Document> CreateChangedDocument(Document document, SyntaxNode node, SyntaxGenerator generator, SemanticModel semanticModel, CancellationToken cancellationToken) { var replacementNode = GetReplacementSyntax(node, generator, semanticModel, cancellationToken); return document.ReplaceNodeAsync(node, replacementNode, cancellationToken); } private SyntaxNode GetReplacementSyntax(SyntaxNode node, SyntaxGenerator generator, SemanticModel semanticModel, CancellationToken cancellationToken) { var typeSymbol = (ITypeSymbol)semanticModel.GetSymbolInfo(node, cancellationToken).Symbol; return generator.TypeExpression(typeSymbol).WithTriviaFrom(node); } } }
mit
C#
f1b337ad32de86c2e4cbb0140bc19685e803bc4f
Bump library version to 0.1
smaeul/7DaysToolbox
SDTD.Config/Properties/AssemblyInfo.cs
SDTD.Config/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("SDTD.Config")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SDTD.Config")] [assembly: AssemblyCopyright("Copyright © Samuel Holland 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("a59a9cf0-e5e2-42d7-b8f2-65ee6f56bc53")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.1.*")] [assembly: AssemblyFileVersion("0.1.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("SDTD.Config")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("SDTD.Config")] [assembly: AssemblyCopyright("Copyright © Samuel Holland 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("a59a9cf0-e5e2-42d7-b8f2-65ee6f56bc53")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("0.0.0.0")] [assembly: AssemblyFileVersion("0.0.0.0")]
mit
C#
bf2bd0970e6ec93ba0d21b3c6b00b9682e0106de
Update AdUnitBundle.cs
tiksn/TIKSN-Framework
TIKSN.Core/Advertising/AdUnitBundle.cs
TIKSN.Core/Advertising/AdUnitBundle.cs
using System; namespace TIKSN.Advertising { public class AdUnitBundle { public AdUnitBundle(AdUnit designTime, AdUnit production) { this.DesignTime = designTime ?? throw new ArgumentNullException(nameof(designTime)); this.Production = production ?? throw new ArgumentNullException(nameof(production)); if (!designTime.IsTest) { throw new ArgumentException($"Value of {nameof(designTime)}.{nameof(designTime.IsTest)} must be true.", nameof(designTime)); } if (production.IsTest) { throw new ArgumentException($"Value of {nameof(production)}.{nameof(production.IsTest)} must be false.", nameof(production)); } } public AdUnit DesignTime { get; } public AdUnit Production { get; } } }
using System; namespace TIKSN.Advertising { public class AdUnitBundle { public AdUnitBundle(AdUnit designTime, AdUnit production) { DesignTime = designTime ?? throw new ArgumentNullException(nameof(designTime)); Production = production ?? throw new ArgumentNullException(nameof(production)); if (!designTime.IsTest) { throw new ArgumentException($"Value of {nameof(designTime)}.{nameof(designTime.IsTest)} must be true.", nameof(designTime)); } if (production.IsTest) { throw new ArgumentException($"Value of {nameof(production)}.{nameof(production.IsTest)} must be false.", nameof(production)); } } public AdUnit DesignTime { get; } public AdUnit Production { get; } } }
mit
C#
1842dc1ef1b73d00cdb30c7153d2ac2c3bef3fc0
rename S_WHISPER.PlayerId -> GameId
Foglio1024/Tera-custom-cooldowns,Foglio1024/Tera-custom-cooldowns
TeraPacketParser/Messages/S_WHISPER.cs
TeraPacketParser/Messages/S_WHISPER.cs
 namespace TeraPacketParser.Messages { public class S_WHISPER : ParsedMessage { public ulong GameId { get; private set; } public string Author { get; private set; } public string Recipient { get; private set; } public string Message { get; private set; } public S_WHISPER(TeraMessageReader reader) : base(reader) { reader.Skip(6); GameId = reader.ReadUInt64(); reader.Skip(3); Author = reader.ReadTeraString(); Recipient = reader.ReadTeraString(); Message = reader.ReadTeraString(); } } }
 namespace TeraPacketParser.Messages { public class S_WHISPER : ParsedMessage { public ulong PlayerId { get; private set; } public string Author { get; private set; } public string Recipient { get; private set; } public string Message { get; private set; } public S_WHISPER(TeraMessageReader reader) : base(reader) { reader.Skip(6); PlayerId = reader.ReadUInt64(); reader.Skip(3); Author = reader.ReadTeraString(); Recipient = reader.ReadTeraString(); Message = reader.ReadTeraString(); } } }
mit
C#
2d19f3e11890a042da0e8d558d28c67e6d8ee7d8
modify enumerator test to use existed GetEnumerator to solve the issue.
AxeDotNet/AxePractice.CSharpViaTest
src/CSharpViaTest.Collections/10_SkippedEnumeratorPractice.cs
src/CSharpViaTest.Collections/10_SkippedEnumeratorPractice.cs
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using Xunit; namespace CSharpViaTest.Collections { public class SkippedEnumeratorPractice { class SkippedEnumerable<T> : IEnumerable<T> { readonly ICollection<T> collection; public SkippedEnumerable(ICollection<T> collection) { this.collection = collection ?? throw new ArgumentNullException(nameof(collection)); } public IEnumerator<T> GetEnumerator() { return new SkippedEnumerator<T>(collection); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } } class SkippedEnumerator<T> : IEnumerator<T> { public SkippedEnumerator(IEnumerable<T> collection) { throw new NotImplementedException(); } public bool MoveNext() { throw new NotImplementedException(); } public void Reset() { throw new NotImplementedException(); } public T Current => throw new NotImplementedException(); object IEnumerator.Current => Current; public void Dispose() { throw new NotImplementedException(); } } [Fact] public void should_visit_elements_in_reversed_order() { int[] sequence = {1, 2, 3, 4, 5, 6}; int[] resolved = new SkippedEnumerable<int>(sequence).ToArray(); Assert.Equal(new [] {2, 4, 6}, resolved); } } }
using System; using System.Collections; using System.Collections.Generic; using System.Linq; using Xunit; namespace CSharpViaTest.Collections { public class SkippedEnumeratorPractice { class SkippedEnumerable<T> : IEnumerable<T> { readonly ICollection<T> collection; public SkippedEnumerable(ICollection<T> collection) { this.collection = collection ?? throw new ArgumentNullException(nameof(collection)); } public IEnumerator<T> GetEnumerator() { return new SkippedEnumerator<T>(collection); } IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } } class SkippedEnumerator<T> : IEnumerator<T> { readonly ICollection<T> collection; public SkippedEnumerator(ICollection<T> collection) { this.collection = collection; } public bool MoveNext() { throw new NotImplementedException(); } public void Reset() { throw new NotImplementedException(); } public T Current => throw new NotImplementedException(); object IEnumerator.Current => Current; public void Dispose() { throw new NotImplementedException(); } } [Fact] public void should_visit_elements_in_reversed_order() { int[] sequence = {1, 2, 3, 4, 5, 6}; int[] resolved = new SkippedEnumerable<int>(sequence).ToArray(); Assert.Equal(new [] {2, 4, 6}, resolved); } } }
mit
C#
880bbf697f33ce8bb6379fe2eea8d847b44fd686
Add ILinkable to UserLinkViewModel
leotsarev/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net
src/JoinRpg.WebPortal.Models/UserProfile/UserLinkViewModel.cs
src/JoinRpg.WebPortal.Models/UserProfile/UserLinkViewModel.cs
using System; using JoinRpg.DataModel; using JoinRpg.Domain; using JoinRpg.Services.Interfaces; namespace JoinRpg.Web.Models.UserProfile { public record UserLinkViewModel( int UserId, string DisplayName) : ILinkable { public UserLinkViewModel(User user) : this(user.UserId, user.GetDisplayName().Trim()) { } public Uri GetUri(IUriService uriService) => uriService.GetUri(this); LinkType ILinkable.LinkType => LinkType.ResultUser; string ILinkable.Identification => UserId.ToString(); int? ILinkable.ProjectId => null; public static UserLinkViewModel? FromOptional(User? user) => user is null ? null : new UserLinkViewModel(user); } }
using JoinRpg.DataModel; using JoinRpg.Domain; namespace JoinRpg.Web.Models.UserProfile { public record UserLinkViewModel( int UserId, string DisplayName) { public UserLinkViewModel(User user) : this(user.UserId, user.GetDisplayName().Trim()) { } public static UserLinkViewModel? FromOptional(User user) => user is null ? null : new UserLinkViewModel(user); } }
mit
C#
244ef6df54703a085a8d6345c737e13ba28a786b
Store and reuse health status for health checks (#36102)
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
src/Middleware/HealthChecks/src/HealthCheckResponseWriters.cs
src/Middleware/HealthChecks/src/HealthCheckResponseWriters.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Text; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Diagnostics.HealthChecks; namespace Microsoft.AspNetCore.Diagnostics.HealthChecks { internal static class HealthCheckResponseWriters { private static readonly byte[] DegradedBytes = Encoding.UTF8.GetBytes(HealthStatus.Degraded.ToString()); private static readonly byte[] HealthyBytes = Encoding.UTF8.GetBytes(HealthStatus.Healthy.ToString()); private static readonly byte[] UnhealthyBytes = Encoding.UTF8.GetBytes(HealthStatus.Unhealthy.ToString()); public static Task WriteMinimalPlaintext(HttpContext httpContext, HealthReport result) { httpContext.Response.ContentType = "text/plain"; return result.Status switch { HealthStatus.Degraded => httpContext.Response.Body.WriteAsync(DegradedBytes.AsMemory()).AsTask(), HealthStatus.Healthy => httpContext.Response.Body.WriteAsync(HealthyBytes.AsMemory()).AsTask(), HealthStatus.Unhealthy => httpContext.Response.Body.WriteAsync(UnhealthyBytes.AsMemory()).AsTask(), _ => httpContext.Response.WriteAsync(result.Status.ToString()) }; } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Threading.Tasks; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Diagnostics.HealthChecks; namespace Microsoft.AspNetCore.Diagnostics.HealthChecks { internal static class HealthCheckResponseWriters { public static Task WriteMinimalPlaintext(HttpContext httpContext, HealthReport result) { httpContext.Response.ContentType = "text/plain"; return httpContext.Response.WriteAsync(result.Status.ToString()); } } }
apache-2.0
C#
33d04df1b959fbab9e01af47d5f22a5d9d1d374a
Refactor stream name definition
PKI-InVivo/reactive-domain
src/ReactiveDomain.Foundation/EventStore/StreamNameBuilder.cs
src/ReactiveDomain.Foundation/EventStore/StreamNameBuilder.cs
using System; namespace ReactiveDomain.Foundation.EventStore { /// <summary> /// Class responsible for generating standard stream names which follow a specific formating: [lowercaseprefix].[camelCaseName]-[id] /// </summary> public class StreamNameBuilder { private readonly string _prefix; /// <summary> /// StreamNameBuilder constructor. Throw if prefix is null or empty. /// Use this only to generate stream name with prefix, otherwise use StreamNameBuilder() /// </summary> /// <param name="prefix"></param> public StreamNameBuilder(string prefix) { // no prefix is OK but must be explicit if (string.IsNullOrWhiteSpace(prefix)) throw new ArgumentException("Provide with prefix or use default constructor instead.", nameof(prefix)); _prefix = prefix; } /// <summary> /// StreamNameBuilder constructor. Use this to generate stream name without specific prefix /// </summary> public StreamNameBuilder() {} /// <summary> /// Generate a standard stream name /// </summary> /// <param name="type"></param> /// <param name="id"></param> /// <returns></returns> public string Generate(Type type, Guid id) { string prefix = string.IsNullOrWhiteSpace(_prefix) ? string.Empty : $"{_prefix.ToLowerInvariant()}."; return $"{prefix}{type.GetEventStreamNameByAggregatedId(id)}"; } } }
using System; namespace ReactiveDomain.Foundation.EventStore { /// <summary> /// Class responsible for generating standard stream names which follow a specific formating: [lowercaseprefix].[camelCaseName]-[id] /// </summary> public class StreamNameBuilder { private readonly string _prefix; /// <summary> /// StreamNameBuilder constructor. Throw if prefix is null or empty. /// Use this only to generate stream name with prefix, otherwise use StreamNameBuilder() /// </summary> /// <param name="prefix"></param> public StreamNameBuilder(string prefix) { // no prefix is OK but must be explicit if (string.IsNullOrWhiteSpace(prefix)) throw new ArgumentException("Provide with prefix or use default constructor instead.", nameof(prefix)); _prefix = prefix; } /// <summary> /// StreamNameBuilder constructor. Use this to generate stream name without specific prefix /// </summary> public StreamNameBuilder() {} /// <summary> /// Generate a standard stream name /// </summary> /// <param name="type"></param> /// <param name="id"></param> /// <returns></returns> public string Generate(Type type, Guid id) { string prefix = string.IsNullOrWhiteSpace(_prefix) ? string.Empty : $"{_prefix.ToLowerInvariant()}."; return $"{prefix}{char.ToLowerInvariant(type.Name[0])}{type.Name.Substring(1)}-{id:N}"; } } }
mit
C#
1f111297c04720c10be10a7df53aed46faf0e0d9
Update Program.cs
natintosh/Numerical-Methods
NumericalMethods/LUDecomposition/LUDecomposition/Program.cs
NumericalMethods/LUDecomposition/LUDecomposition/Program.cs
using System; namespace LUDecomposition { class MainClass:NumericalMethods { public static void Main() { Double[,] matrix = { { 25, 5, 1, 106.8 }, { 64, 8, 1, 177.2 }, { 144, 12, 1, 292.2 } }; Decompostion decomposition = new Decompostion(matrix); decomposition.Decompose(); Double[,] upperMatrix = decomposition.GetUpperMatrix(); Double[,] lowerMatrix = decomposition.GetLowerMatrix(); ForwBackSubstitution forwBackSubstitution = new ForwBackSubstitution(upperMatrix, lowerMatrix); forwBackSubstitution.Substitute(); } } }
using System; namespace LUDecomposition { class MainClass:NumericalMethods { public static void Main() { Double[,] linearEquation = { { 25, 5, 1, 106.8 }, { 64, 8, 1, 177.2 }, { 144, 12, 1, 292.2 } }; Decompostion decomposition = new Decompostion(matrix); decomposition.Decompose(); Double[,] upperMatrix = decomposition.GetUpperMatrix(); Double[,] lowerMatrix = decomposition.GetLowerMatrix(); ForwBackSubstitution forwBackSubstitution = new ForwBackSubstitution(upperMatrix, lowerMatrix); forwBackSubstitution.Substitute(); } } }
mit
C#
942c5de889cd21bd79b27ccb33fff95a8998ef05
remove an incorrect line
projectkudu/SiteExtensionGallery,mtian/SiteExtensionGallery,grenade/NuGetGallery_download-count-patch,skbkontur/NuGetGallery,grenade/NuGetGallery_download-count-patch,skbkontur/NuGetGallery,ScottShingler/NuGetGallery,projectkudu/SiteExtensionGallery,mtian/SiteExtensionGallery,projectkudu/SiteExtensionGallery,ScottShingler/NuGetGallery,mtian/SiteExtensionGallery,skbkontur/NuGetGallery,grenade/NuGetGallery_download-count-patch,ScottShingler/NuGetGallery
tests/NuGetGallery.FunctionalTests/LinksTests/LinksTests.cs
tests/NuGetGallery.FunctionalTests/LinksTests/LinksTests.cs
using FluentLinkChecker; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.WebTesting; using NuGetGallery.FunctionTests.Helpers; using System; using System.Collections.Specialized; using System.IO; using System.Net; using System.Text; using System.Web.UI; namespace NuGetGallery.FunctionalTests.LinksTests { /// <summary> /// This Class tests all of the links on each parent page, /// to make sure that there are no broken links on the gallery pages. /// </summary> [TestClass] public class LinksTests { [TestMethod] public void TestHomePageLinks() { TestLinksOnWebPagesUsingFluentLinkChecker(UrlHelper.BaseUrl); } [TestMethod] public void TestPackagesPageLinks() { TestLinksOnWebPagesUsingFluentLinkChecker(UrlHelper.PackagesPageUrl); } [TestMethod] public void TestPackageDetailsPageLinks() { TestLinksOnWebPagesUsingFluentLinkChecker(UrlHelper.GetPackagePageUrl("EntityFramework")); } [TestMethod] public void TestStatisticsPageLinks() { TestLinksOnWebPagesUsingFluentLinkChecker(UrlHelper.StatsPageUrl); } #region Helper Methods public bool TestLinksOnWebPagesUsingFluentLinkChecker(string uri) { var result = LinkCheck .On(src => src.Url(new Uri(uri)) .Relative()) .AsBot(bot => bot.Bing()) .Start(); foreach (var link in result) { Console.WriteLine("Tested Url: {0}, Status Code: {1}", link.Url, link.StatusCode); if (link.StatusCode != HttpStatusCode.OK) { return false; } } // All status codes returned are OK return true; } #endregion } }
using FluentLinkChecker; using Microsoft.VisualStudio.TestTools.UnitTesting; using Microsoft.VisualStudio.TestTools.WebTesting; using NuGetGallery.FunctionTests.Helpers; using System; using System.Collections.Specialized; using System.IO; using System.Net; using System.Text; using System.Web.UI; namespace NuGetGallery.FunctionalTests.LinksTests { /// <summary> /// This Class tests all of the links on each parent page, /// to make sure that there are no broken links on the gallery pages. /// </summary> [TestClass] public class LinksTests { [TestMethod] public void TestHomePageLinks() { TestLinksOnWebPagesUsingFluentLinkChecker(UrlHelper.BaseUrl); } [TestMethod] public void TestPackagesPageLinks() { TestLinksOnWebPagesUsingFluentLinkChecker(UrlHelper.PackagesPageUrl); } [TestMethod] public void TestPackageDetailsPageLinks() { TestLinksOnWebPagesUsingFluentLinkChecker(UrlHelper.GetPackagePageUrl("EntityFramework")); } [TestMethod] public void TestStatisticsPageLinks() { WebTestRequest logonPostRequest = AssertAndValidationHelper.GetLogonGetRequest(); TestLinksOnWebPagesUsingFluentLinkChecker(UrlHelper.StatsPageUrl); } #region Helper Methods public bool TestLinksOnWebPagesUsingFluentLinkChecker(string uri) { var result = LinkCheck .On(src => src.Url(new Uri(uri)) .Relative()) .AsBot(bot => bot.Bing()) .Start(); foreach (var link in result) { Console.WriteLine("Tested Url: {0}, Status Code: {1}", link.Url, link.StatusCode); if (link.StatusCode != HttpStatusCode.OK) { return false; } } // All status codes returned are OK return true; } #endregion } }
apache-2.0
C#
675d50e8bd29db9164a4c0c87f51b1d33168150b
Return correct keys
toddams/RazorLight,toddams/RazorLight
samples/RazorLight.Samples/EntityFrameworkRazorLightProject.cs
samples/RazorLight.Samples/EntityFrameworkRazorLightProject.cs
using RazorLight.Razor; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; namespace Samples.EntityFrameworkProject { public class EntityFrameworkRazorLightProject : RazorLightProject { private readonly AppDbContext dbContext; public EntityFrameworkRazorLightProject(AppDbContext context) { dbContext = context; } public override async Task<RazorLightProjectItem> GetItemAsync(string templateKey) { // We expect id to be an integer, as in this sample we have ints as keys in database. // But you can use GUID, as an example and parse it here int templateId = int.Parse(templateKey); TemplateEntity template = await dbContext.Templates.FindAsync(templateId); var projectItem = new EntityFrameworkRazorProjectItem(templateKey, template?.Content); return projectItem; } public override Task<IEnumerable<RazorLightProjectItem>> GetImportsAsync(string templateKey) { return Task.FromResult(Enumerable.Empty<RazorLightProjectItem>()); } public override async Task<IEnumerable<string>> GetKnownKeysAsync() { var ids = await dbContext.Templates.Select(x => x.Id).ToListAsync(); return ids.Select(x => x.ToString()); } } }
using RazorLight.Razor; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; namespace Samples.EntityFrameworkProject { public class EntityFrameworkRazorLightProject : RazorLightProject { private readonly AppDbContext dbContext; public EntityFrameworkRazorLightProject(AppDbContext context) { dbContext = context; } public override async Task<RazorLightProjectItem> GetItemAsync(string templateKey) { // We expect id to be an integer, as in this sample we have ints as keys in database. // But you can use GUID, as an example and parse it here int templateId = int.Parse(templateKey); TemplateEntity template = await dbContext.Templates.FindAsync(templateId); var projectItem = new EntityFrameworkRazorProjectItem(templateKey, template?.Content); return projectItem; } public override Task<IEnumerable<RazorLightProjectItem>> GetImportsAsync(string templateKey) { return Task.FromResult(Enumerable.Empty<RazorLightProjectItem>()); } public override async Task<IEnumerable<string>> GetKnownKeysAsync() { var ids = await dbContext.Templates.ToListAsync(); return ids.Select(x => x.ToString()); } } }
apache-2.0
C#
f5de2d6d2fe9fffd9709a6cbeb90bfa87996e096
Fix link to evaluation
mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander,mattgwagner/Battery-Commander
Battery-Commander.Web/Views/Reports/EvaluationUpdated.cshtml
Battery-Commander.Web/Views/Reports/EvaluationUpdated.cshtml
@model BatteryCommander.Web.Models.Evaluation <h1>@Model.Ratee</h1> <table border="1"> <tbody> <tr> <td>Soldier</td> <td>@Model.Ratee</td> </tr> <tr> <td>Rater</td> <td>@Model.Rater</td> </tr> <tr> <td>SR Rater</td> <td>@Model.SeniorRater</td> </tr> <tr> <td>Last Message</td> <td>@Model.LastEvent.Message</td> </tr> <tr> <td>Author</td> <td>@Model.LastEvent.Author</td> </tr> <tr> <td>Timestamp</td> <td>@Model.LastEvent.TimestampHumanized</td> </tr> <tr> <td>Link</td> <td><a href="https://bc.redleg.app/Evaluations/Details/@Model.Id">Evaluation</a></td> </tr> </tbody> </table> <hr /> <a href="https://bc.redleg.app/Evaluations">Evaluation Tracker</a>
@model BatteryCommander.Web.Models.Evaluation <h1>@Model.Ratee</h1> <table border="1"> <tbody> <tr> <td>Soldier</td> <td>@Model.Ratee</td> </tr> <tr> <td>Rater</td> <td>@Model.Rater</td> </tr> <tr> <td>SR Rater</td> <td>@Model.SeniorRater</td> </tr> <tr> <td>Last Message</td> <td>@Model.LastEvent.Message</td> </tr> <tr> <td>Author</td> <td>@Model.LastEvent.Author</td> </tr> <tr> <td>Timestamp</td> <td>@Model.LastEvent.TimestampHumanized</td> </tr> <tr> <td>Link</td> <td><a href="https://bc.redleg.app/Evaluations/@Model.Id">Evaluation</a></td> </tr> </tbody> </table> <hr /> <a href="https://bc.redleg.app/Evaluations">Evaluation Tracker</a>
mit
C#
10ed7680022ecee1c9e4ea9357c497d564d4e597
Test for TanhGrad
migueldeicaza/TensorFlowSharp,migueldeicaza/TensorFlowSharp,migueldeicaza/TensorFlowSharp
tests/TensorFlowSharp.Tests.CSharp/MathTests.cs
tests/TensorFlowSharp.Tests.CSharp/MathTests.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using TensorFlow; using Xunit; namespace TensorFlowSharp.Tests.CSharp { public class MathTests { [Fact] public void Should_CalculateTanhGrad_Correctly () { using (TFGraph graph = new TFGraph ()) using (TFSession session = new TFSession (graph)) { TFOutput x = graph.Const (new TFTensor (0.7)); TFOutput y = graph.Tanh (x); TFOutput dy = graph.Const (new TFTensor (new [] { 1.0 })); TFOutput grad = graph.TanhGrad (y, dy); TFTensor [] result = session.Run (new TFOutput [] { }, new TFTensor [] { }, new [] { grad }); double value = (double)result [0].GetValue (); Assert.Equal (0.634739589982459, value, 15); } } private static IEnumerable<object []> reduceMeanData () { // Example from https://www.tensorflow.org/api_docs/python/tf/reduce_mean // # 'x' is [[1., 1.] // # [2., 2.]] // tf.reduce_mean (x) ==> 1.5 // tf.reduce_mean (x, 0) ==> [1.5, 1.5] // tf.reduce_mean (x, 1) ==> [1., 2.] var x = new double [,] { { 1, 1 }, { 2, 2 } }; yield return new object [] { x, null, 1.5 }; yield return new object [] { x, 0, new double [] { 1.5, 1.5 } }; yield return new object [] { x, 1, new double [] { 1, 2 } }; } [Theory] [MemberData (nameof (reduceMeanData))] public void Should_ReduceMean (double [,] input, int? axis, object expected) { using (var graph = new TFGraph ()) using (var session = new TFSession (graph)) { var tinput = graph.Placeholder (TFDataType.Double, new TFShape (2, 2)); TFTensor [] result; if (axis != null) { var taxis = graph.Const (axis.Value); TFOutput y = graph.ReduceMean (tinput, taxis); result = session.Run (new [] { tinput, taxis }, new TFTensor [] { input, axis }, new [] { y }); double [] actual = (double [])result [0].GetValue (); TestUtils.MatrixEqual (expected, actual, precision: 8); } else { TFOutput y = graph.ReduceMean (tinput, axis: null); result = session.Run (new [] { tinput }, new TFTensor [] { input }, new [] { y }); double actual = (double)result [0].GetValue (); TestUtils.MatrixEqual (expected, actual, precision: 8); } } } } }
using System.Collections.Generic; using TensorFlow; using Xunit; namespace TensorFlowSharp.Tests.CSharp { public class MathTests { private static IEnumerable<object []> reduceMeanData () { // Example from https://www.tensorflow.org/api_docs/python/tf/reduce_mean // # 'x' is [[1., 1.] // # [2., 2.]] // tf.reduce_mean (x) ==> 1.5 // tf.reduce_mean (x, 0) ==> [1.5, 1.5] // tf.reduce_mean (x, 1) ==> [1., 2.] var x = new double [,] { { 1, 1 }, { 2, 2 } }; yield return new object [] { x, null, 1.5 }; yield return new object [] { x, 0, new double [] { 1.5, 1.5 } }; yield return new object [] { x, 1, new double [] { 1, 2 } }; } [Theory] [MemberData (nameof (reduceMeanData))] public void Should_ReduceMean (double [,] input, int? axis, object expected) { using (var graph = new TFGraph ()) using (var session = new TFSession (graph)) { var tinput = graph.Placeholder (TFDataType.Double, new TFShape (2, 2)); TFTensor [] result; if (axis != null) { var taxis = graph.Const (axis.Value); TFOutput y = graph.ReduceMean (tinput, taxis); result = session.Run (new [] { tinput, taxis }, new TFTensor [] { input, axis }, new [] { y }); double [] actual = (double [])result [0].GetValue (); TestUtils.MatrixEqual (expected, actual, precision: 8); } else { TFOutput y = graph.ReduceMean (tinput, axis: null); result = session.Run (new [] { tinput }, new TFTensor [] { input }, new [] { y }); double actual = (double)result [0].GetValue (); TestUtils.MatrixEqual (expected, actual, precision: 8); } } } } }
mit
C#
eadef53e68cd1612f8bb0b0a6d7260f5631ad07f
Add more annotations
ppy/osu,NeoAdonis/osu,NeoAdonis/osu,UselessToucan/osu,ppy/osu,UselessToucan/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,smoogipoo/osu,ppy/osu,smoogipooo/osu,peppy/osu-new,peppy/osu,peppy/osu,UselessToucan/osu,smoogipoo/osu
osu.Game/Online/Multiplayer/MultiplayerScoresAround.cs
osu.Game/Online/Multiplayer/MultiplayerScoresAround.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 JetBrains.Annotations; using Newtonsoft.Json; namespace osu.Game.Online.Multiplayer { /// <summary> /// An object which stores scores higher and lower than the user's score. /// </summary> public class MultiplayerScoresAround { /// <summary> /// Scores sorted "higher" than the user's score, depending on the sorting order. /// </summary> [JsonProperty("higher")] [CanBeNull] public MultiplayerScores Higher { get; set; } /// <summary> /// Scores sorted "lower" than the user's score, depending on the sorting order. /// </summary> [JsonProperty("lower")] [CanBeNull] public MultiplayerScores Lower { 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 Newtonsoft.Json; namespace osu.Game.Online.Multiplayer { /// <summary> /// An object which stores scores higher and lower than the user's score. /// </summary> public class MultiplayerScoresAround { /// <summary> /// Scores sorted "higher" than the user's score, depending on the sorting order. /// </summary> [JsonProperty("higher")] public MultiplayerScores Higher { get; set; } /// <summary> /// Scores sorted "lower" than the user's score, depending on the sorting order. /// </summary> [JsonProperty("lower")] public MultiplayerScores Lower { get; set; } } }
mit
C#
e4529ad5381acca1bc962aa051e6093994ddc19a
Fix PopIn/Out being run before a VisibilityContainer is added to the scene graph
ppy/osu-framework,EVAST9919/osu-framework,smoogipooo/osu-framework,ZLima12/osu-framework,ZLima12/osu-framework,peppy/osu-framework,EVAST9919/osu-framework,peppy/osu-framework,peppy/osu-framework,DrabWeb/osu-framework,DrabWeb/osu-framework,Tom94/osu-framework,EVAST9919/osu-framework,Tom94/osu-framework,smoogipooo/osu-framework,default0/osu-framework,Nabile-Rahmani/osu-framework,EVAST9919/osu-framework,DrabWeb/osu-framework,ppy/osu-framework,Nabile-Rahmani/osu-framework,ppy/osu-framework,default0/osu-framework
osu.Framework/Graphics/Containers/VisibilityContainer.cs
osu.Framework/Graphics/Containers/VisibilityContainer.cs
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System; namespace osu.Framework.Graphics.Containers { /// <summary> /// A container which adds a basic visibility state. /// </summary> public abstract class VisibilityContainer : Container, IStateful<Visibility> { protected override void LoadComplete() { if (state == Visibility.Hidden) { // do this without triggering the StateChanged event, since hidden is a default. PopOut(); FinishTransforms(true); } else updateState(); base.LoadComplete(); } private Visibility state; public Visibility State { get { return state; } set { if (value == state) return; state = value; if (!IsLoaded) return; updateState(); } } private void updateState() { switch (state) { case Visibility.Hidden: PopOut(); break; case Visibility.Visible: PopIn(); break; } StateChanged?.Invoke(this, state); } public override void Hide() => State = Visibility.Hidden; public override void Show() => State = Visibility.Visible; public override bool HandleInput => State == Visibility.Visible; public event Action<VisibilityContainer, Visibility> StateChanged; protected abstract void PopIn(); protected abstract void PopOut(); public void ToggleVisibility() => State = State == Visibility.Visible ? Visibility.Hidden : Visibility.Visible; } }
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE using System; namespace osu.Framework.Graphics.Containers { /// <summary> /// A container which adds a basic visibility state. /// </summary> public abstract class VisibilityContainer : Container, IStateful<Visibility> { protected override void LoadComplete() { if (state == Visibility.Hidden) { PopOut(); FinishTransforms(true); } base.LoadComplete(); } private Visibility state; public Visibility State { get { return state; } set { if (value == state) return; state = value; switch (value) { case Visibility.Hidden: PopOut(); break; case Visibility.Visible: PopIn(); break; } StateChanged?.Invoke(this, state); } } public override void Hide() => State = Visibility.Hidden; public override void Show() => State = Visibility.Visible; public override bool HandleInput => State == Visibility.Visible; public event Action<VisibilityContainer, Visibility> StateChanged; protected abstract void PopIn(); protected abstract void PopOut(); public void ToggleVisibility() => State = State == Visibility.Visible ? Visibility.Hidden : Visibility.Visible; } }
mit
C#
9ed47b9f07d070dc5a405af3699c39e52924ebb8
Fix multithreading issue in MockedConsole (#34)
mgrosperrin/commandlineparser
tests/MGR.CommandLineParser.IntegrationTests/MockedConsole.cs
tests/MGR.CommandLineParser.IntegrationTests/MockedConsole.cs
using System; using System.Text; namespace MGR.CommandLineParser.IntegrationTests { internal class MockedConsole : IConsole { [ThreadStatic] private static MockedConsole _currentConsole = new MockedConsole(); public static MockedConsole CurrentConsole => _currentConsole = _currentConsole ?? new MockedConsole(); private readonly StringBuilder _console = new StringBuilder(); public void Reset() { _console.Clear(); } public void Write(string format, params object[] args) { _console.AppendFormat(format, args); } public void WriteLine() { _console.AppendLine(); } public void WriteLine(string value) { _console.AppendLine(value); } public void WriteLine(string format, params object[] args) { _console.AppendFormat(format, args); } public void WriteError(string value) { _console.AppendLine(value); } public void WriteError(string format, params object[] args) { _console.AppendFormat(format, args); } public void WriteWarning(string value) { _console.AppendLine(value); } public void WriteWarning(string format, params object[] args) { _console.AppendFormat(format, args); } public void PrintJustified(int startIndex, string value) { _console.AppendLine(new string(' ', startIndex) + value); } } }
using System; using System.Text; namespace MGR.CommandLineParser.IntegrationTests { internal class MockedConsole : IConsole { [ThreadStatic] private static readonly MockedConsole _currentConsole = new MockedConsole(); public static MockedConsole CurrentConsole => _currentConsole; private readonly StringBuilder _console = new StringBuilder(); public void Reset() { _console.Clear(); } public void Write(string format, params object[] args) { _console.AppendFormat(format, args); } public void WriteLine() { _console.AppendLine(); } public void WriteLine(string value) { _console.AppendLine(value); } public void WriteLine(string format, params object[] args) { _console.AppendFormat(format, args); } public void WriteError(string value) { _console.AppendLine(value); } public void WriteError(string format, params object[] args) { _console.AppendFormat(format, args); } public void WriteWarning(string value) { _console.AppendLine(value); } public void WriteWarning(string format, params object[] args) { _console.AppendFormat(format, args); } public void PrintJustified(int startIndex, string value) { _console.AppendLine(new string(' ', startIndex) + value); } } }
mit
C#
75a226b126a84abf56c655f76a9193c3c70358ac
make test less coupled
gregsochanik/SevenDigital.Api.Wrapper,mattgray/SevenDigital.Api.Wrapper,bnathyuw/SevenDigital.Api.Wrapper,danbadge/SevenDigital.Api.Wrapper,minkaotic/SevenDigital.Api.Wrapper,AnthonySteele/SevenDigital.Api.Wrapper,danhaller/SevenDigital.Api.Wrapper,bettiolo/SevenDigital.Api.Wrapper,luiseduardohdbackup/SevenDigital.Api.Wrapper,knocte/SevenDigital.Api.Wrapper,raoulmillais/SevenDigital.Api.Wrapper,emashliles/SevenDigital.Api.Wrapper,actionshrimp/SevenDigital.Api.Wrapper
src/SevenDigital.Api.Wrapper.Integration.Tests/EndpointTests/ArtistEndpoint/ArtistDetailsTests.cs
src/SevenDigital.Api.Wrapper.Integration.Tests/EndpointTests/ArtistEndpoint/ArtistDetailsTests.cs
using System.Threading; using NUnit.Framework; using SevenDigital.Api.Schema.ArtistEndpoint; namespace SevenDigital.Api.Wrapper.Integration.Tests.EndpointTests.ArtistEndpoint { [TestFixture] public class ArtistDetailsTests { [Test] public void Can_hit_endpoint_with_fluent_interface() { var artist = Api<Artist> .Get .WithArtistId(1) .Please(); Assert.That(artist, Is.Not.Null); Assert.That(artist.Name, Is.EqualTo("Keane")); Assert.That(artist.SortName, Is.EqualTo("Keane")); Assert.That(artist.Url, Is.StringStarting("http://www.7digital.com/artists/keane/")); Assert.That(artist.Image, Is.EqualTo("http://cdn.7static.com/static/img/artistimages/00/000/000/0000000001_150.jpg")); } [Test] public void Can_hit_endpoint_with_fluent_async_api() { Artist artist = null; var reset = new AutoResetEvent(false); Api<Artist> .Get .WithArtistId(1) .PleaseAsync(payload => { artist = payload; reset.Set(); }); reset.WaitOne(1000 * 60); Assert.That(artist, Is.Not.Null); Assert.That(artist.Name, Is.EqualTo("Keane")); Assert.That(artist.SortName, Is.EqualTo("Keane")); Assert.That(artist.Url, Is.StringStarting("http://www.7digital.com/artists/keane/")); Assert.That(artist.Image, Is.EqualTo("http://cdn.7static.com/static/img/artistimages/00/000/000/0000000001_150.jpg")); } } }
using System.Threading; using NUnit.Framework; using SevenDigital.Api.Schema.ArtistEndpoint; namespace SevenDigital.Api.Wrapper.Integration.Tests.EndpointTests.ArtistEndpoint { [TestFixture] public class ArtistDetailsTests { [Test] public void Can_hit_endpoint_with_fluent_interface() { var artist = Api<Artist> .Get .WithArtistId(1) .Please(); Assert.That(artist, Is.Not.Null); Assert.That(artist.Name, Is.EqualTo("Keane")); Assert.That(artist.SortName, Is.EqualTo("Keane")); Assert.That(artist.Url, Is.EqualTo("http://www.7digital.com/artists/keane/?partner=1401")); Assert.That(artist.Image, Is.EqualTo("http://cdn.7static.com/static/img/artistimages/00/000/000/0000000001_150.jpg")); } [Test] public void Can_hit_endpoint_with_fluent_async_api() { Artist artist = null; var reset = new AutoResetEvent(false); Api<Artist> .Get .WithArtistId(1) .PleaseAsync(payload => { artist = payload; reset.Set(); }); reset.WaitOne(1000 * 60); Assert.That(artist, Is.Not.Null); Assert.That(artist.Name, Is.EqualTo("Keane")); Assert.That(artist.SortName, Is.EqualTo("Keane")); Assert.That(artist.Url, Is.EqualTo("http://www.7digital.com/artists/keane/?partner=1401")); Assert.That(artist.Image, Is.EqualTo("http://cdn.7static.com/static/img/artistimages/00/000/000/0000000001_150.jpg")); } } }
mit
C#
5f67135c6139e08bbf860053048cc9dd66a8a8fb
Change load event of UI component to from Awake to Start
patchkit-net/patchkit-integration-unity
src/Assets/Plugins/PatchKit/Scripts/UI/UIApiComponent.cs
src/Assets/Plugins/PatchKit/Scripts/UI/UIApiComponent.cs
using System.Collections; using PatchKit.Api; using UnityEngine; namespace PatchKit.Unity.UI { public abstract class UIApiComponent : MonoBehaviour { private Coroutine _loadCoroutine; private bool _isDirty; private ApiConnection _apiConnection; public bool LoadOnStart = true; protected ApiConnection ApiConnection { get { return _apiConnection; } } [ContextMenu("Reload")] public void SetDirty() { _isDirty = true; } protected abstract IEnumerator LoadCoroutine(); private void Load() { try { if (_loadCoroutine != null) { StopCoroutine(_loadCoroutine); } _loadCoroutine = StartCoroutine(LoadCoroutine()); } finally { _isDirty = false; } } protected virtual void Awake() { _apiConnection = new ApiConnection(Settings.GetApiConnectionSettings()); } protected virtual void Start() { if (LoadOnStart) { Load(); } } protected virtual void Update() { if (_isDirty) { Load(); } } } }
using System.Collections; using PatchKit.Api; using UnityEngine; namespace PatchKit.Unity.UI { public abstract class UIApiComponent : MonoBehaviour { private Coroutine _loadCoroutine; private bool _isDirty; private ApiConnection _apiConnection; public bool LoadOnAwake = true; protected ApiConnection ApiConnection { get { return _apiConnection; } } [ContextMenu("Reload")] public void SetDirty() { _isDirty = true; } protected abstract IEnumerator LoadCoroutine(); private void Load() { try { if (_loadCoroutine != null) { StopCoroutine(_loadCoroutine); } _loadCoroutine = StartCoroutine(LoadCoroutine()); } finally { _isDirty = false; } } protected virtual void Awake() { _apiConnection = new ApiConnection(Settings.GetApiConnectionSettings()); if (LoadOnAwake) { Load(); } } protected virtual void Update() { if (_isDirty) { Load(); } } } }
mit
C#
f6376e23cd13ce165d1012bf41bb3cf1569e9520
test a custom create operator
deftom/fitsharp,deftom/fitsharp,deftom/fitsharp
source/fitSharpTest/NUnit/Fit/CellProcessorBaseTest.cs
source/fitSharpTest/NUnit/Fit/CellProcessorBaseTest.cs
// Copyright © 2010 Syterra Software Inc. All rights reserved. // The use and distribution terms for this software are covered by the Common Public License 1.0 (http://opensource.org/licenses/cpl.php) // which can be found in the file license.txt at the root of this distribution. By using this software in any fashion, you are agreeing // to be bound by the terms of this license. You must not remove this notice, or any other, from this software. using fitSharp.Fit.Engine; using fitSharp.Fit.Model; using fitSharp.Fit.Operators; using fitSharp.Machine.Engine; using fitSharp.Machine.Model; using fitSharp.Samples.Fit; using NUnit.Framework; namespace fitSharp.Test.NUnit.Fit { [TestFixture] public class CellProcessorBaseTest { [Test] public void CachesParsedValue() { var cell = new CellTreeLeaf("<<symbol"); var processor = Builder.CellProcessor(); processor.Get<Symbols>().Save("symbol", "value"); TypedValue result = processor.Parse(typeof (string), TypedValue.Void, cell); Assert.AreEqual("value", result.GetValue<string>()); Assert.AreEqual(" value", cell.Value.GetAttribute(CellAttribute.InformationSuffix)); processor.Parse(typeof (string), TypedValue.Void, cell); Assert.AreEqual(" value", cell.Value.GetAttribute(CellAttribute.InformationSuffix)); Assert.AreEqual("value", result.GetValue<string>()); } [Test] public void WrapsValue() { var processor = Builder.CellProcessor(); var result = processor.Operate<WrapOperator>(new TypedValue("hi")); Assert.AreEqual("hi", result.ValueString); } [Test] public void UsesCreateOperator() { var processor = Builder.CellProcessor(); processor.AddOperator(new TestCreateOperator()); var result = processor.Create("testname"); Assert.AreEqual("mytestname", result.GetValueAs<string>()); } class TestCreateOperator: CellOperator, CreateOperator<Cell> { public bool CanCreate(NameMatcher memberName, Tree<Cell> parameters) { return memberName.Matches("testname"); } public TypedValue Create(NameMatcher memberName, Tree<Cell> parameters) { return new TypedValue("mytestname"); } } } }
// Copyright © 2010 Syterra Software Inc. All rights reserved. // The use and distribution terms for this software are covered by the Common Public License 1.0 (http://opensource.org/licenses/cpl.php) // which can be found in the file license.txt at the root of this distribution. By using this software in any fashion, you are agreeing // to be bound by the terms of this license. You must not remove this notice, or any other, from this software. using fitSharp.Fit.Engine; using fitSharp.Fit.Model; using fitSharp.Machine.Engine; using fitSharp.Machine.Model; using fitSharp.Samples.Fit; using NUnit.Framework; namespace fitSharp.Test.NUnit.Fit { [TestFixture] public class CellProcessorBaseTest { [Test] public void CachesParsedValue() { var cell = new CellTreeLeaf("<<symbol"); var processor = Builder.CellProcessor(); processor.Get<Symbols>().Save("symbol", "value"); TypedValue result = processor.Parse(typeof (string), TypedValue.Void, cell); Assert.AreEqual("value", result.GetValue<string>()); Assert.AreEqual(" value", cell.Value.GetAttribute(CellAttribute.InformationSuffix)); processor.Parse(typeof (string), TypedValue.Void, cell); Assert.AreEqual(" value", cell.Value.GetAttribute(CellAttribute.InformationSuffix)); Assert.AreEqual("value", result.GetValue<string>()); } [Test] public void WrapsValue() { var processor = Builder.CellProcessor(); var result = processor.Operate<WrapOperator>(new TypedValue("hi")); Assert.AreEqual("hi", result.ValueString); } } }
epl-1.0
C#
c726049f2378c906a6f64695bb9abc90693dce25
Fix worker filename
henrikstengaard/hstwb-installer,henrikstengaard/hstwb-installer,henrikstengaard/hstwb-installer,henrikstengaard/hstwb-installer,henrikstengaard/hstwb-installer,henrikstengaard/hstwb-installer
src/HstWbInstaller.Imager.GuiApp/Helpers/WorkerHelper.cs
src/HstWbInstaller.Imager.GuiApp/Helpers/WorkerHelper.cs
namespace HstWbInstaller.Imager.GuiApp.Helpers { using System; using System.IO; using System.Linq; public static class WorkerHelper { public static string GetExecutingFile() { return Environment.GetCommandLineArgs().FirstOrDefault(); } public static string GetWorkerFileName(string executingFile) { return Path.GetExtension(executingFile) switch { ".dll" => string.Concat(Path.GetFileNameWithoutExtension(executingFile), OperatingSystem.IsWindows() ? ".exe" : string.Empty), _ => Path.GetFileName(executingFile) }; } } }
namespace HstWbInstaller.Imager.GuiApp.Helpers { using System; using System.IO; using System.Linq; public static class WorkerHelper { public static string GetExecutingFile() { return Environment.GetCommandLineArgs().FirstOrDefault(); } public static string GetWorkerFileName(string executingFile) { if (!OperatingSystem.IsWindows()) { return Path.GetFileName(executingFile); } return Path.GetExtension(executingFile) switch { ".dll" => $"{Path.GetFileNameWithoutExtension(executingFile)}.exe", _ => Path.GetFileName(executingFile) }; } } }
mit
C#
74b01fdf80837bea191787406bb055735506fe49
fix typo (#2770)
open-telemetry/opentelemetry-dotnet,open-telemetry/opentelemetry-dotnet,open-telemetry/opentelemetry-dotnet
src/OpenTelemetry.Api/Metrics/MeterProviderBuilder.cs
src/OpenTelemetry.Api/Metrics/MeterProviderBuilder.cs
// <copyright file="MeterProviderBuilder.cs" company="OpenTelemetry Authors"> // Copyright The OpenTelemetry Authors // // 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. // </copyright> using System; namespace OpenTelemetry.Metrics { /// <summary> /// MeterProviderBuilder base class. /// </summary> public abstract class MeterProviderBuilder { /// <summary> /// Initializes a new instance of the <see cref="MeterProviderBuilder"/> class. /// </summary> protected MeterProviderBuilder() { } /// <summary> /// Adds instrumentation to the provider. /// </summary> /// <typeparam name="TInstrumentation">Type of instrumentation class.</typeparam> /// <param name="instrumentationFactory">Function that builds instrumentation.</param> /// <returns>Returns <see cref="MeterProviderBuilder"/> for chaining.</returns> public abstract MeterProviderBuilder AddInstrumentation<TInstrumentation>( Func<TInstrumentation> instrumentationFactory) where TInstrumentation : class; /// <summary> /// Adds given Meter names to the list of subscribed meters. /// </summary> /// <param name="names">Meter names.</param> /// <returns>Returns <see cref="MeterProviderBuilder"/> for chaining.</returns> public abstract MeterProviderBuilder AddMeter(params string[] names); } }
// <copyright file="MeterProviderBuilder.cs" company="OpenTelemetry Authors"> // Copyright The OpenTelemetry Authors // // 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. // </copyright> using System; namespace OpenTelemetry.Metrics { /// <summary> /// TracerProviderBuilder base class. /// </summary> public abstract class MeterProviderBuilder { /// <summary> /// Initializes a new instance of the <see cref="MeterProviderBuilder"/> class. /// </summary> protected MeterProviderBuilder() { } /// <summary> /// Adds instrumentation to the provider. /// </summary> /// <typeparam name="TInstrumentation">Type of instrumentation class.</typeparam> /// <param name="instrumentationFactory">Function that builds instrumentation.</param> /// <returns>Returns <see cref="MeterProviderBuilder"/> for chaining.</returns> public abstract MeterProviderBuilder AddInstrumentation<TInstrumentation>( Func<TInstrumentation> instrumentationFactory) where TInstrumentation : class; /// <summary> /// Adds given Meter names to the list of subscribed meters. /// </summary> /// <param name="names">Meter names.</param> /// <returns>Returns <see cref="MeterProviderBuilder"/> for chaining.</returns> public abstract MeterProviderBuilder AddMeter(params string[] names); } }
apache-2.0
C#
41b0cc82116e90b58c427734d7be5d86e9f23d8b
Remove singleton from sample
haderach75/Webjobs.Extensions.NetCore.Eventstore
src/Webjobs.Extensions.Eventstore.Sample/Functions.cs
src/Webjobs.Extensions.Eventstore.Sample/Functions.cs
using System; using System.Collections.Generic; using EventStore.ClientAPI; using Microsoft.Azure.WebJobs; using Webjobs.Extensions.NetCore.Eventstore; using Webjobs.Extensions.NetCore.Eventstore.Impl; namespace Webjobs.Extensions.Eventstore.Sample { public class Functions { private readonly IEventPublisher<ResolvedEvent> _eventPublisher; private const string WebJobDisabledSetting = "WebJobDisabled"; public Functions(IEventPublisher<ResolvedEvent> eventPublisher) { _eventPublisher = eventPublisher; } [Disable(WebJobDisabledSetting)] public void ProcessQueueMessage([EventTrigger(BatchSize = 10, TimeOutInMilliSeconds = 20)] IObservable<ResolvedEvent> events) { events.Subscribe(e => _eventPublisher.Publish(e)); } [Disable(WebJobDisabledSetting)] public void LiveProcessingStarted([LiveProcessingStarted] LiveProcessingStartedContext context) { Console.WriteLine("Live started triggered, event stream is now live"); } } }
using System; using System.Collections.Generic; using EventStore.ClientAPI; using Microsoft.Azure.WebJobs; using Webjobs.Extensions.NetCore.Eventstore; using Webjobs.Extensions.NetCore.Eventstore.Impl; namespace Webjobs.Extensions.Eventstore.Sample { public class Functions { private readonly IEventPublisher<ResolvedEvent> _eventPublisher; private const string WebJobDisabledSetting = "WebJobDisabled"; public Functions(IEventPublisher<ResolvedEvent> eventPublisher) { _eventPublisher = eventPublisher; } [Disable(WebJobDisabledSetting)] [Singleton(Mode = SingletonMode.Listener)] public void ProcessQueueMessage([EventTrigger(BatchSize = 10, TimeOutInMilliSeconds = 20)] IObservable<ResolvedEvent> events) { events.Subscribe(e => _eventPublisher.Publish(e)); } [Disable(WebJobDisabledSetting)] public void LiveProcessingStarted([LiveProcessingStarted] LiveProcessingStartedContext context) { Console.WriteLine("Live started triggered, event stream is now live"); } } }
mit
C#
2b1e44894bae29e5038b1b2ed826a897ac04c5dc
Fix a bug leading to the printing of the same unmute time for all muted users.
Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW
MitternachtWeb/Areas/Moderation/Controllers/MutesController.cs
MitternachtWeb/Areas/Moderation/Controllers/MutesController.cs
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Mitternacht.Modules.Administration.Services; using Mitternacht.Services; using MitternachtWeb.Areas.Moderation.Models; using MitternachtWeb.Exceptions; using System; using System.Linq; using System.Threading.Tasks; namespace MitternachtWeb.Areas.Moderation.Controllers { [Authorize] [Area("Moderation")] public class MutesController : GuildModerationController { private readonly DbService _db; private readonly MuteService _muteService; public MutesController(DbService db, MuteService ms) { _db = db; _muteService = ms; } public IActionResult Index() { using var uow = _db.UnitOfWork; var gc = uow.GuildConfigs.For(GuildId, set => set.Include(g => g.MutedUsers).Include(g => g.UnmuteTimers)); var mutedUsers = gc.MutedUsers; var unmuteTimers = gc.UnmuteTimers; var mutes = mutedUsers.Select(mu => mu.UserId).Concat(unmuteTimers.Select(ut => ut.UserId)).Select(userId => new Mute{UserId = userId, Muted = mutedUsers.Any(mu => mu.UserId == userId), UnmuteAt = unmuteTimers.Any() ? (DateTime?)unmuteTimers.Where(ut => ut.UserId == userId).Min(ut => ut.UnmuteAt) : null}).ToList(); return View(mutes); } public async Task<IActionResult> Delete(ulong id) { if(!PermissionWriteMutes) throw new NoPermissionsException(); var user = Guild.GetUser(id); if(user != null) { await _muteService.UnmuteUser(user); } else { using var uow = _db.UnitOfWork; var gc = uow.GuildConfigs.For(GuildId, set => set.Include(g => g.MutedUsers).Include(g => g.UnmuteTimers)); gc.MutedUsers.RemoveWhere(mu => mu.UserId == id); gc.UnmuteTimers.RemoveWhere(ut => ut.UserId == id); await uow.CompleteAsync(); _muteService.StopUnmuteTimer(GuildId, id); } return RedirectToAction("Index"); } } }
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using Mitternacht.Modules.Administration.Services; using Mitternacht.Services; using MitternachtWeb.Areas.Moderation.Models; using MitternachtWeb.Exceptions; using System; using System.Linq; using System.Threading.Tasks; namespace MitternachtWeb.Areas.Moderation.Controllers { [Authorize] [Area("Moderation")] public class MutesController : GuildModerationController { private readonly DbService _db; private readonly MuteService _muteService; public MutesController(DbService db, MuteService ms) { _db = db; _muteService = ms; } public IActionResult Index() { using var uow = _db.UnitOfWork; var gc = uow.GuildConfigs.For(GuildId, set => set.Include(g => g.MutedUsers).Include(g => g.UnmuteTimers)); var mutedUsers = gc.MutedUsers; var unmuteTimers = gc.UnmuteTimers; var mutes = mutedUsers.Select(mu => mu.UserId).Concat(unmuteTimers.Select(ut => ut.UserId)).Select(userId => new Mute{UserId = userId, Muted = mutedUsers.Any(mu => mu.UserId == userId), UnmuteAt = unmuteTimers.Any() ? (DateTime?)unmuteTimers.Min(ut => ut.UnmuteAt) : null}).ToList(); return View(mutes); } public async Task<IActionResult> Delete(ulong id) { if(!PermissionWriteMutes) throw new NoPermissionsException(); var user = Guild.GetUser(id); if(user != null) { await _muteService.UnmuteUser(user); } else { using var uow = _db.UnitOfWork; var gc = uow.GuildConfigs.For(GuildId, set => set.Include(g => g.MutedUsers).Include(g => g.UnmuteTimers)); gc.MutedUsers.RemoveWhere(mu => mu.UserId == id); gc.UnmuteTimers.RemoveWhere(ut => ut.UserId == id); await uow.CompleteAsync(); _muteService.StopUnmuteTimer(GuildId, id); } return RedirectToAction("Index"); } } }
mit
C#