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
92128d4ef9594a9f3c653660cb6fa729eb61818f
Update svn properties.
zekizeki/agentservice,ft-/opensim-optimizations-wip-extras,QuillLittlefeather/opensim-1,TomDataworks/opensim,intari/OpenSimMirror,TomDataworks/opensim,RavenB/opensim,AlphaStaxLLC/taiga,cdbean/CySim,QuillLittlefeather/opensim-1,TechplexEngineer/Aurora-Sim,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,ft-/opensim-optimizations-wip-tests,ft-/opensim-optimizations-wip-tests,ft-/arribasim-dev-tests,N3X15/VoxelSim,ft-/opensim-optimizations-wip-tests,AlexRa/opensim-mods-Alex,BogusCurry/arribasim-dev,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,intari/OpenSimMirror,Michelle-Argus/ArribasimExtract,justinccdev/opensim,intari/OpenSimMirror,rryk/omp-server,N3X15/VoxelSim,AlexRa/opensim-mods-Alex,justinccdev/opensim,ft-/arribasim-dev-tests,RavenB/opensim,N3X15/VoxelSim,cdbean/CySim,M-O-S-E-S/opensim,OpenSimian/opensimulator,M-O-S-E-S/opensim,cdbean/CySim,ft-/arribasim-dev-tests,AlphaStaxLLC/taiga,N3X15/VoxelSim,OpenSimian/opensimulator,M-O-S-E-S/opensim,AlexRa/opensim-mods-Alex,rryk/omp-server,Michelle-Argus/ArribasimExtract,bravelittlescientist/opensim-performance,intari/OpenSimMirror,ft-/arribasim-dev-extras,justinccdev/opensim,TomDataworks/opensim,bravelittlescientist/opensim-performance,M-O-S-E-S/opensim,OpenSimian/opensimulator,OpenSimian/opensimulator,bravelittlescientist/opensim-performance,ft-/opensim-optimizations-wip-tests,BogusCurry/arribasim-dev,justinccdev/opensim,zekizeki/agentservice,M-O-S-E-S/opensim,ft-/arribasim-dev-extras,rryk/omp-server,allquixotic/opensim-autobackup,ft-/arribasim-dev-extras,zekizeki/agentservice,intari/OpenSimMirror,N3X15/VoxelSim,AlexRa/opensim-mods-Alex,rryk/omp-server,RavenB/opensim,QuillLittlefeather/opensim-1,justinccdev/opensim,zekizeki/agentservice,N3X15/VoxelSim,zekizeki/agentservice,bravelittlescientist/opensim-performance,TomDataworks/opensim,N3X15/VoxelSim,RavenB/opensim,AlphaStaxLLC/taiga,ft-/arribasim-dev-tests,ft-/opensim-optimizations-wip-extras,TomDataworks/opensim,ft-/opensim-optimizations-wip-tests,AlphaStaxLLC/taiga,ft-/opensim-optimizations-wip,Michelle-Argus/ArribasimExtract,N3X15/VoxelSim,TomDataworks/opensim,AlphaStaxLLC/taiga,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,RavenB/opensim,QuillLittlefeather/opensim-1,cdbean/CySim,TechplexEngineer/Aurora-Sim,TomDataworks/opensim,allquixotic/opensim-autobackup,Michelle-Argus/ArribasimExtract,ft-/opensim-optimizations-wip-extras,BogusCurry/arribasim-dev,rryk/omp-server,ft-/opensim-optimizations-wip-extras,TechplexEngineer/Aurora-Sim,bravelittlescientist/opensim-performance,ft-/arribasim-dev-extras,ft-/arribasim-dev-extras,bravelittlescientist/opensim-performance,ft-/arribasim-dev-tests,BogusCurry/arribasim-dev,AlexRa/opensim-mods-Alex,ft-/opensim-optimizations-wip-extras,ft-/arribasim-dev-extras,OpenSimian/opensimulator,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,M-O-S-E-S/opensim,QuillLittlefeather/opensim-1,justinccdev/opensim,OpenSimian/opensimulator,QuillLittlefeather/opensim-1,BogusCurry/arribasim-dev,ft-/opensim-optimizations-wip,cdbean/CySim,BogusCurry/arribasim-dev,ft-/opensim-optimizations-wip,OpenSimian/opensimulator,rryk/omp-server,QuillLittlefeather/opensim-1,AlexRa/opensim-mods-Alex,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,Michelle-Argus/ArribasimExtract,cdbean/CySim,RavenB/opensim,allquixotic/opensim-autobackup,allquixotic/opensim-autobackup,M-O-S-E-S/opensim,TechplexEngineer/Aurora-Sim,ft-/opensim-optimizations-wip,allquixotic/opensim-autobackup,ft-/arribasim-dev-tests,AlphaStaxLLC/taiga,AlphaStaxLLC/taiga,allquixotic/opensim-autobackup,Michelle-Argus/ArribasimExtract,RavenB/opensim,zekizeki/agentservice,EriHoss/OpenSim_0.8.2.0_Dev_LibLSLCC,AlphaStaxLLC/taiga,intari/OpenSimMirror
OpenSim/Framework/IClientAPI2.cs
OpenSim/Framework/IClientAPI2.cs
using System; namespace OpenSim.Framework { #region Args Classes public class ICA2_ConnectionArgs : EventArgs { } public class ICA2_DisconnectionArgs : EventArgs { public bool Forced; // Static Constructor // Allows us to recycle these classes later more easily from a pool. public static ICA2_DisconnectionArgs Create(bool forced) { ICA2_DisconnectionArgs tmp = new ICA2_DisconnectionArgs(); tmp.Forced = forced; return tmp; } } public class ICA2_PingArgs : EventArgs { } public class ICA2_AvatarAppearanceArgs : EventArgs { } public class ICA2_TerraformArgs : EventArgs { public double XMin; public double XMax; public double YMin; public double YMax; public Guid Action; public double Strength; // 0 .. 1 public double Radius; } #endregion public delegate void ICA2_OnTerraformDelegate(IClientAPI2 sender, ICA2_TerraformArgs e); public interface IClientAPI2 { // Connect / Disconnect void Connect(ICA2_ConnectionArgs e); void Disconnect(ICA2_DisconnectionArgs e); void Ping(ICA2_PingArgs e); void SendAvatarAppearance(ICA2_AvatarAppearanceArgs e); event ICA2_OnTerraformDelegate OnTerraform; } }
using System; namespace OpenSim.Framework { #region Args Classes public class ICA2_ConnectionArgs : EventArgs { } public class ICA2_DisconnectionArgs : EventArgs { public bool Forced; // Static Constructor // Allows us to recycle these classes later more easily from a pool. public static ICA2_DisconnectionArgs Create(bool forced) { ICA2_DisconnectionArgs tmp = new ICA2_DisconnectionArgs(); tmp.Forced = forced; return tmp; } } public class ICA2_PingArgs : EventArgs { } public class ICA2_AvatarAppearanceArgs : EventArgs { } public class ICA2_TerraformArgs : EventArgs { public double XMin; public double XMax; public double YMin; public double YMax; public Guid Action; public double Strength; // 0 .. 1 public double Radius; } #endregion public delegate void ICA2_OnTerraformDelegate(IClientAPI2 sender, ICA2_TerraformArgs e); public interface IClientAPI2 { // Connect / Disconnect void Connect(ICA2_ConnectionArgs e); void Disconnect(ICA2_DisconnectionArgs e); void Ping(ICA2_PingArgs e); void SendAvatarAppearance(ICA2_AvatarAppearanceArgs e); event ICA2_OnTerraformDelegate OnTerraform; } }
bsd-3-clause
C#
2b80c3b716e9b1ab79b82a598b373ab728b9b0a3
Add ChromeOptions to ChromeDriver
atata-framework/atata-sample-app-tests
src/Atata.SampleApp.AutoTests/AutoTest.cs
src/Atata.SampleApp.AutoTests/AutoTest.cs
using NUnit.Framework; using NUnit.Framework.Interfaces; using OpenQA.Selenium.Chrome; using OpenQA.Selenium.Remote; namespace Atata.SampleApp.AutoTests { public class AutoTest { [SetUp] public void SetUp() { var log = new LogManager(). Use(new NUnitTestContextLogConsumer()). Use(new NLogConsumer()). Use(new FileScreenshotConsumer(() => $@"Logs\{ATContext.BuildStart:yyyy_MM_dd HH_mm_ss}\{ATContext.Current.TestName}")); ATContext.SetUp( CreateChromeDriver, log, TestContext.CurrentContext.Test.Name, Config.Url); OnSetUp(); } private RemoteWebDriver CreateChromeDriver() { ChromeOptions options = new ChromeOptions(); options.AddArguments("disable-extensions", "no-sandbox", "start-maximized"); return new ChromeDriver(options); } protected virtual void OnSetUp() { } [TearDown] public void TearDown() { var testResult = TestContext.CurrentContext.Result; if (testResult.Outcome.Status == TestStatus.Failed) ATContext.Current.Log.Error(testResult.Message, testResult.StackTrace); ATContext.CleanUp(); } protected UsersPage Login() { return Go.To<SignInPage>(). Email.Set(Config.Account.Email). Password.Set(Config.Account.Password). SignIn(); } } }
using NUnit.Framework; using NUnit.Framework.Interfaces; using OpenQA.Selenium.Chrome; namespace Atata.SampleApp.AutoTests { public class AutoTest { [SetUp] public void SetUp() { var log = new LogManager(). Use(new NUnitTestContextLogConsumer()). Use(new NLogConsumer()). Use(new FileScreenshotConsumer(() => $@"Logs\{ATContext.BuildStart:yyyy_MM_dd HH_mm_ss}\{ATContext.Current.TestName}")); ATContext.SetUp( () => new ChromeDriver().Maximize(), log, TestContext.CurrentContext.Test.Name, Config.Url); OnSetUp(); } protected virtual void OnSetUp() { } [TearDown] public void TearDown() { var testResult = TestContext.CurrentContext.Result; if (testResult.Outcome.Status == TestStatus.Failed) ATContext.Current.Log.Error(testResult.Message, testResult.StackTrace); ATContext.CleanUp(); } protected UsersPage Login() { return Go.To<SignInPage>(). Email.Set(Config.Account.Email). Password.Set(Config.Account.Password). SignIn(); } } }
apache-2.0
C#
9c039ab8dd05514d0f13bb4c8d67e8d526b3c3a3
remove remaining reference to TestFramework
pharring/ApplicationInsights-dotnet,pharring/ApplicationInsights-dotnet,pharring/ApplicationInsights-dotnet,Microsoft/ApplicationInsights-dotnet
src/TelemetryChannels/ServerTelemetryChannel/Shared/AssemblyInfo.cs
src/TelemetryChannels/ServerTelemetryChannel/Shared/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyCopyright("Copyright © Microsoft. All Rights Reserved.")] [assembly: ComVisible(false)] [assembly: InternalsVisibleTo("Microsoft.ApplicationInsights.Core.Net40.Tests" + AssemblyInfo.PublicKey)] [assembly: InternalsVisibleTo("Microsoft.ApplicationInsights.Core.Net45.Tests" + AssemblyInfo.PublicKey)] [assembly: InternalsVisibleTo("Microsoft.ApplicationInsights.Core.Net46.Tests" + AssemblyInfo.PublicKey)] [assembly: InternalsVisibleTo("Microsoft.ApplicationInsights.TelemetryChannel.Net40.Tests" + AssemblyInfo.PublicKey)] [assembly: InternalsVisibleTo("Microsoft.ApplicationInsights.TelemetryChannel.Net45.Tests" + AssemblyInfo.PublicKey)] // Assembly dynamically generated by Moq in unit tests [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2" + AssemblyInfo.MoqPublicKey)] internal static class AssemblyInfo { // Public key; assemblies are delay signed or OSS signed. public const string PublicKey = ", PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9"; public const string MoqPublicKey = ", PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7"; }
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyCompany("Microsoft")] [assembly: AssemblyCopyright("Copyright © Microsoft. All Rights Reserved.")] [assembly: ComVisible(false)] [assembly: InternalsVisibleTo("Microsoft.ApplicationInsights.Core.Net40.Tests" + AssemblyInfo.PublicKey)] [assembly: InternalsVisibleTo("Microsoft.ApplicationInsights.Core.Net45.Tests" + AssemblyInfo.PublicKey)] [assembly: InternalsVisibleTo("Microsoft.ApplicationInsights.Core.Net46.Tests" + AssemblyInfo.PublicKey)] [assembly: InternalsVisibleTo("Microsoft.ApplicationInsights.TestFramework" + AssemblyInfo.PublicKey)] [assembly: InternalsVisibleTo("Microsoft.ApplicationInsights.TelemetryChannel.Net40.Tests" + AssemblyInfo.PublicKey)] [assembly: InternalsVisibleTo("Microsoft.ApplicationInsights.TelemetryChannel.Net45.Tests" + AssemblyInfo.PublicKey)] [assembly: InternalsVisibleTo("Microsoft.ApplicationInsights.TestFramework.Net40" + AssemblyInfo.PublicKey)] [assembly: InternalsVisibleTo("Microsoft.ApplicationInsights.TestFramework.Net45" + AssemblyInfo.PublicKey)] // Assembly dynamically generated by Moq in unit tests [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2" + AssemblyInfo.MoqPublicKey)] internal static class AssemblyInfo { // Public key; assemblies are delay signed or OSS signed. public const string PublicKey = ", PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9"; public const string MoqPublicKey = ", PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7"; }
mit
C#
e10cca83ed240fc75a7535fd2713455b939cbdf6
Reorganize using
linquize/ProtoBuf.MSBuildTask
ProtoBuf.MSBuildTask/ProtoGen.cs
ProtoBuf.MSBuildTask/ProtoGen.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Text; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; namespace ProtoBuf.MSBuildTask { public class ProtoGen : Task { public ITaskItem[] SourceCodeFiles { get; set; } public string OutputPath { get; set; } public string ProtoGenExecutable { get; set; } [Output] public ITaskItem[] GeneratedCodeFiles { get; set; } public override bool Execute() { List<ITaskItem> list = new List<ITaskItem>(); string output = Path.Combine(OutputPath, "ProtoBuf.g.i.cs"); StringBuilder sb = new StringBuilder(); foreach (var item in SourceCodeFiles) { sb.Append(@"-i:"""); sb.Append(item.ItemSpec); sb.Append(@""" "); } sb.Append(@"-o:"""); sb.Append(output); sb.Append(@""" "); Console.Error.WriteLine(ProtoGenExecutable + " " + sb.ToString()); var process = Process.Start(new ProcessStartInfo(ProtoGenExecutable, sb.ToString()) { CreateNoWindow = true, UseShellExecute = false }); process.WaitForExit(); list.Add(new TaskItem(output)); GeneratedCodeFiles = list.ToArray(); return true; } } }
using System.Diagnostics; using System.IO; using System.Text; using Microsoft.Build.Framework; using Microsoft.Build.Utilities; using System.Collections.Generic; using System; namespace ProtoBuf.MSBuildTask { public class ProtoGen : Task { public ITaskItem[] SourceCodeFiles { get; set; } public string OutputPath { get; set; } public string ProtoGenExecutable { get; set; } [Output] public ITaskItem[] GeneratedCodeFiles { get; set; } public override bool Execute() { List<ITaskItem> list = new List<ITaskItem>(); string output = Path.Combine(OutputPath, "ProtoBuf.g.i.cs"); StringBuilder sb = new StringBuilder(); foreach (var item in SourceCodeFiles) { sb.Append(@"-i:"""); sb.Append(item.ItemSpec); sb.Append(@""" "); } sb.Append(@"-o:"""); sb.Append(output); sb.Append(@""" "); Console.Error.WriteLine(ProtoGenExecutable + " " + sb.ToString()); var process = Process.Start(new ProcessStartInfo(ProtoGenExecutable, sb.ToString()) { CreateNoWindow = true, UseShellExecute = false }); process.WaitForExit(); list.Add(new TaskItem(output)); GeneratedCodeFiles = list.ToArray(); return true; } } }
mit
C#
370b0dfcd27c719b902f1a875066c8b04b39f98e
Remove obsolete code analysis suppressions
FakeItEasy/FakeItEasy,FakeItEasy/FakeItEasy,adamralph/FakeItEasy,blairconrad/FakeItEasy,thomaslevesque/FakeItEasy,thomaslevesque/FakeItEasy,blairconrad/FakeItEasy,adamralph/FakeItEasy
src/FakeItEasy/Properties/AssemblyInfo.cs
src/FakeItEasy/Properties/AssemblyInfo.cs
using System; using System.Diagnostics.CodeAnalysis; using System.Reflection; using System.Runtime.CompilerServices; [assembly: AssemblyProduct("FakeItEasy")] [assembly: AssemblyTitle("FakeItEasy")] [assembly: AssemblyDescription("The FakeItEasy dynamic fake framework.")] [assembly: CLSCompliant(true)] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] [assembly: InternalsVisibleTo("FakeItEasy.Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001002f50d82092713be482c885861c984334606da0f54c78738a3dd0862fb2dfc6080f0780132cc65d88f0f0c70af74e8a53430962395bfc1a36fab08b7a2549d387e805c13cc84acd884447ec8c4dcfb6216df720f0998380f9c906b5de8141798d64661f036d47274e6ecb76c9cde5f4cf2b521040601e44b3914fbeb9f39127f9")] [assembly: InternalsVisibleTo("FakeItEasy.IntegrationTests, PublicKey=00240000048000009400000006020000002400005253413100040000010001002f50d82092713be482c885861c984334606da0f54c78738a3dd0862fb2dfc6080f0780132cc65d88f0f0c70af74e8a53430962395bfc1a36fab08b7a2549d387e805c13cc84acd884447ec8c4dcfb6216df720f0998380f9c906b5de8141798d64661f036d47274e6ecb76c9cde5f4cf2b521040601e44b3914fbeb9f39127f9")] // Module level suppress messages. [module: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Justification = "Contains several internal types.", Scope = "namespace", Target = "FakeItEasy.Creation")] [module: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Justification = "Contains several internal types.", Scope = "namespace", Target = "FakeItEasy.Expressions")] [module: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "FakeItEasy.Creation.CastleDynamicProxy", Justification = "Should not be mixed with other types.")] [assembly: SuppressMessage("Microsoft.Usage", "CA2243:AttributeStringLiteralsShouldParseCorrectly", Justification = "AssemblyInformationalVersion uses SemVer.")]
using System; using System.Diagnostics.CodeAnalysis; using System.Reflection; using System.Runtime.CompilerServices; [assembly: AssemblyProduct("FakeItEasy")] [assembly: AssemblyTitle("FakeItEasy")] [assembly: AssemblyDescription("The FakeItEasy dynamic fake framework.")] [assembly: CLSCompliant(true)] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] [assembly: InternalsVisibleTo("FakeItEasy.Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001002f50d82092713be482c885861c984334606da0f54c78738a3dd0862fb2dfc6080f0780132cc65d88f0f0c70af74e8a53430962395bfc1a36fab08b7a2549d387e805c13cc84acd884447ec8c4dcfb6216df720f0998380f9c906b5de8141798d64661f036d47274e6ecb76c9cde5f4cf2b521040601e44b3914fbeb9f39127f9")] [assembly: InternalsVisibleTo("FakeItEasy.IntegrationTests, PublicKey=00240000048000009400000006020000002400005253413100040000010001002f50d82092713be482c885861c984334606da0f54c78738a3dd0862fb2dfc6080f0780132cc65d88f0f0c70af74e8a53430962395bfc1a36fab08b7a2549d387e805c13cc84acd884447ec8c4dcfb6216df720f0998380f9c906b5de8141798d64661f036d47274e6ecb76c9cde5f4cf2b521040601e44b3914fbeb9f39127f9")] // Module level suppress messages. [module: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Justification = "Contains several internal types.", Scope = "namespace", Target = "FakeItEasy.Creation")] [module: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Justification = "Contains several internal types.", Scope = "namespace", Target = "FakeItEasy.Expressions")] [module: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Justification = "These types are only used by VB and should not confuse other developers.", Scope = "namespace", Target = "FakeItEasy.VisualBasic")] [module: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Justification = "Is in a namespace of its own to allow for just using the extensions when they are explicitly requested.", Scope = "namespace", Target = "FakeItEasy.ExtensionSyntax")] [module: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "FakeItEasy.ExtensionSyntax.Full", Justification = "Is in a namespace of its own to allow for just using the extensions when they are explicitly requested.")] [module: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "FakeItEasy.Creation.CastleDynamicProxy", Justification = "Should not be mixed with other types.")] [assembly: SuppressMessage("Microsoft.Usage", "CA2243:AttributeStringLiteralsShouldParseCorrectly", Justification = "AssemblyInformationalVersion uses SemVer.")]
mit
C#
d7211ba7cc5eb12a5aeaf608d0b598b2bbe0abb5
Remove unused using statement
feliwir/openSage,feliwir/openSage
src/OpenSage.Game/Mathematics/ColorRgb.cs
src/OpenSage.Game/Mathematics/ColorRgb.cs
namespace OpenSage.Mathematics { public struct ColorRgb { public byte R; public byte G; public byte B; public ColorRgb(byte r, byte g, byte b) { R = r; G = g; B = b; } public static ColorRgb FromUInt32(uint rgb) { var r = (byte) (rgb >> 16 & 0xFF); var g = (byte) (rgb >> 8 & 0xFF); var b = (byte) (rgb & 0xFF); return new ColorRgb(r, g, b); } } }
using System; namespace OpenSage.Mathematics { public struct ColorRgb { public byte R; public byte G; public byte B; public ColorRgb(byte r, byte g, byte b) { R = r; G = g; B = b; } public static ColorRgb FromUInt32(uint rgb) { var r = (byte) (rgb >> 16 & 0xFF); var g = (byte) (rgb >> 8 & 0xFF); var b = (byte) (rgb & 0xFF); return new ColorRgb(r, g, b); } } }
mit
C#
852c5ace7b8a3f7aa9fb38c13d1cef2dd7471132
add validation to resource name param
takenet/blip-sdk-csharp
src/Take.Blip.Builder/Variables/BaseResourceVariableProvider.cs
src/Take.Blip.Builder/Variables/BaseResourceVariableProvider.cs
using Lime.Protocol; using Lime.Protocol.Network; using Lime.Protocol.Serialization; using System; using System.Collections.Generic; using System.Text; using System.Threading; using System.Threading.Tasks; using Take.Blip.Client; namespace Take.Blip.Builder.Variables { public class BaseResourceVariableProvider : IVariableProvider { private readonly ISender _sender; private readonly IDocumentSerializer _documentSerializer; protected readonly string _resourceName; public VariableSource Source => throw new NotImplementedException(); public BaseResourceVariableProvider(ISender sender, IDocumentSerializer documentSerializer, string resourceName) { _sender = sender; _documentSerializer = documentSerializer; _resourceName = resourceName ?? throw new ArgumentNullException(nameof(resourceName)); } public async Task<string> GetVariableAsync(string name, IContext context, CancellationToken cancellationToken) { try { var resourceCommandResult = await ExecuteGetResourceCommandAsync(name, cancellationToken); if (resourceCommandResult.Status != CommandStatus.Success) { return null; } if (!resourceCommandResult.Resource.GetMediaType().IsJson) { return resourceCommandResult.Resource.ToString(); } return _documentSerializer.Serialize(resourceCommandResult.Resource); } catch (LimeException ex) when (ex.Reason.Code == ReasonCodes.COMMAND_RESOURCE_NOT_FOUND) { return null; } } private async Task<Command> ExecuteGetResourceCommandAsync(string name, CancellationToken cancellationToken) { // We are sending the command directly here because the Extension requires us to know the type. var getResourceCommand = new Command() { Uri = new LimeUri($"/{_resourceName}/{Uri.EscapeDataString(name)}"), Method = CommandMethod.Get, }; var resourceCommandResult = await _sender.ProcessCommandAsync( getResourceCommand, cancellationToken); return resourceCommandResult; } } }
using Lime.Protocol; using Lime.Protocol.Network; using Lime.Protocol.Serialization; using System; using System.Collections.Generic; using System.Text; using System.Threading; using System.Threading.Tasks; using Take.Blip.Client; namespace Take.Blip.Builder.Variables { public class BaseResourceVariableProvider : IVariableProvider { private readonly ISender _sender; private readonly IDocumentSerializer _documentSerializer; protected readonly string _resourceName; public VariableSource Source => throw new NotImplementedException(); public BaseResourceVariableProvider(ISender sender, IDocumentSerializer documentSerializer, string resourceName) { _sender = sender; _documentSerializer = documentSerializer; _resourceName = resourceName; } public async Task<string> GetVariableAsync(string name, IContext context, CancellationToken cancellationToken) { try { var resourceCommandResult = await ExecuteGetResourceCommandAsync(name, cancellationToken); if (resourceCommandResult.Status != CommandStatus.Success) { return null; } if (!resourceCommandResult.Resource.GetMediaType().IsJson) { return resourceCommandResult.Resource.ToString(); } return _documentSerializer.Serialize(resourceCommandResult.Resource); } catch (LimeException ex) when (ex.Reason.Code == ReasonCodes.COMMAND_RESOURCE_NOT_FOUND) { return null; } } private async Task<Command> ExecuteGetResourceCommandAsync(string name, CancellationToken cancellationToken) { // We are sending the command directly here because the Extension requires us to know the type. var getResourceCommand = new Command() { Uri = new LimeUri($"/{_resourceName}/{Uri.EscapeDataString(name)}"), Method = CommandMethod.Get, }; var resourceCommandResult = await _sender.ProcessCommandAsync( getResourceCommand, cancellationToken); return resourceCommandResult; } } }
apache-2.0
C#
8ac566f7ffb39f200c6c7feef3542c26fc7f13f8
Make serializble
dotnet/roslyn,mavasani/roslyn,bartdesmet/roslyn,mavasani/roslyn,CyrusNajmabadi/roslyn,shyamnamboodiripad/roslyn,CyrusNajmabadi/roslyn,dotnet/roslyn,mavasani/roslyn,jasonmalinowski/roslyn,jasonmalinowski/roslyn,bartdesmet/roslyn,dotnet/roslyn,jasonmalinowski/roslyn,shyamnamboodiripad/roslyn,CyrusNajmabadi/roslyn,shyamnamboodiripad/roslyn,bartdesmet/roslyn
src/Workspaces/Core/Portable/TaskList/TaskListItemDescriptor.cs
src/Workspaces/Core/Portable/TaskList/TaskListItemDescriptor.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.Globalization; using System.Runtime.Serialization; using Microsoft.CodeAnalysis.PooledObjects; namespace Microsoft.CodeAnalysis.TaskList { /// <summary> /// Description of a TODO comment type to find in a user's comments. /// </summary> [DataContract] internal readonly struct TaskListItemDescriptor { [DataMember(Order = 0)] public string Text { get; } [DataMember(Order = 1)] public int Priority { get; } public TaskListItemDescriptor(string text, int priority) { Text = text; Priority = priority; } public static ImmutableArray<TaskListItemDescriptor> Parse(ImmutableArray<string> items) { using var _ = ArrayBuilder<TaskListItemDescriptor>.GetInstance(out var result); foreach (var item in items) { if (item.Split(':') is [var token, var priorityString] && !string.IsNullOrWhiteSpace(token) && int.TryParse(priorityString, NumberStyles.None, CultureInfo.InvariantCulture, out var priority)) { result.Add(new TaskListItemDescriptor(token, priority)); } } return result.ToImmutable(); } } }
// 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.Globalization; using System.Runtime.Serialization; using Microsoft.CodeAnalysis.PooledObjects; namespace Microsoft.CodeAnalysis.TaskList { /// <summary> /// Description of a TODO comment type to find in a user's comments. /// </summary> [DataContract] internal readonly struct TaskListItemDescriptor { public string Text { get; } public int Priority { get; } public TaskListItemDescriptor(string text, int priority) { Text = text; Priority = priority; } public static ImmutableArray<TaskListItemDescriptor> Parse(ImmutableArray<string> items) { using var _ = ArrayBuilder<TaskListItemDescriptor>.GetInstance(out var result); foreach (var item in items) { if (item.Split(':') is [var token, var priorityString] && !string.IsNullOrWhiteSpace(token) && int.TryParse(priorityString, NumberStyles.None, CultureInfo.InvariantCulture, out var priority)) { result.Add(new TaskListItemDescriptor(token, priority)); } } return result.ToImmutable(); } } }
mit
C#
1ba744fafd02abc8547a7fef42951741c94aaf8d
Change serverity to Warning (#2133)
sergey-shandar/autorest,amarzavery/AutoRest,veronicagg/autorest,sergey-shandar/autorest,Azure/autorest,Azure/autorest,ljhljh235/AutoRest,sergey-shandar/autorest,veronicagg/autorest,vishrutshah/autorest,ljhljh235/AutoRest,jianghaolu/AutoRest,veronicagg/autorest,veronicagg/autorest,lmazuel/autorest,vishrutshah/autorest,vishrutshah/autorest,vishrutshah/autorest,dsgouda/autorest,Azure/autorest,lmazuel/autorest,amarzavery/AutoRest,dsgouda/autorest,jhendrixMSFT/autorest,amarzavery/AutoRest,ljhljh235/AutoRest,sergey-shandar/autorest,ljhljh235/AutoRest,Azure/autorest,jianghaolu/AutoRest,dsgouda/autorest,olydis/autorest,brjohnstmsft/autorest,lmazuel/autorest,veronicagg/autorest,jhendrixMSFT/autorest,fearthecowboy/autorest,sergey-shandar/autorest,fearthecowboy/autorest,jianghaolu/AutoRest,lmazuel/autorest,dsgouda/autorest,sergey-shandar/autorest,ljhljh235/AutoRest,jianghaolu/AutoRest,vishrutshah/autorest,jhendrixMSFT/autorest,jianghaolu/AutoRest,ljhljh235/AutoRest,jhendrixMSFT/autorest,ljhljh235/AutoRest,vishrutshah/autorest,lmazuel/autorest,brjohnstmsft/autorest,sergey-shandar/autorest,jianghaolu/AutoRest,dsgouda/autorest,sergey-shandar/autorest,amarzavery/AutoRest,veronicagg/autorest,amarzavery/AutoRest,ljhljh235/AutoRest,veronicagg/autorest,jianghaolu/AutoRest,jianghaolu/AutoRest,dsgouda/autorest,lmazuel/autorest,dsgouda/autorest,dsgouda/autorest,amarzavery/AutoRest,vishrutshah/autorest,amarzavery/AutoRest,amarzavery/AutoRest,vishrutshah/autorest,veronicagg/autorest,lmazuel/autorest,olydis/autorest,amarzavery/AutoRest,vishrutshah/autorest,sergey-shandar/autorest,jianghaolu/AutoRest,lmazuel/autorest,lmazuel/autorest,veronicagg/autorest,dsgouda/autorest
src/modeler/AutoRest.Swagger/Validation/BodyParametersValidation.cs
src/modeler/AutoRest.Swagger/Validation/BodyParametersValidation.cs
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. using AutoRest.Swagger.Validation.Core; using AutoRest.Core.Properties; using AutoRest.Swagger.Model; using AutoRest.Core.Logging; using System; namespace AutoRest.Swagger.Validation { public class BodyParametersValidation : TypedRule<SwaggerParameter> { /// <summary> /// Id of the Rule. /// </summary> public override string Id => "M2063"; /// <summary> /// Violation category of the Rule. /// </summary> public override ValidationCategory ValidationCategory => ValidationCategory.SDKViolation; /// <summary> /// The template message for this Rule. /// </summary> /// <remarks> /// This may contain placeholders '{0}' for parameterized messages. /// </remarks> public override string MessageTemplate => Resources.BodyParametersNotValid; /// <summary> /// The severity of this message (ie, debug/info/warning/error/fatal, etc) /// </summary> public override Category Severity => Category.Warning; /// <summary> /// Validates if the 'body' parameter is named 'parameters'. /// </summary> /// <param name="swaggerParameter"></param> /// <returns></returns> public override bool IsValid(SwaggerParameter swaggerParameter) => (swaggerParameter.In != ParameterLocation.Body) || (swaggerParameter.Name.Equals("parameters", StringComparison.CurrentCultureIgnoreCase)); } }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. using AutoRest.Swagger.Validation.Core; using AutoRest.Core.Properties; using AutoRest.Swagger.Model; using AutoRest.Core.Logging; using System; namespace AutoRest.Swagger.Validation { public class BodyParametersValidation : TypedRule<SwaggerParameter> { /// <summary> /// Id of the Rule. /// </summary> public override string Id => "M2063"; /// <summary> /// Violation category of the Rule. /// </summary> public override ValidationCategory ValidationCategory => ValidationCategory.SDKViolation; /// <summary> /// The template message for this Rule. /// </summary> /// <remarks> /// This may contain placeholders '{0}' for parameterized messages. /// </remarks> public override string MessageTemplate => Resources.BodyParametersNotValid; /// <summary> /// The severity of this message (ie, debug/info/warning/error/fatal, etc) /// </summary> public override Category Severity => Category.Error; /// <summary> /// Validates if the 'body' parameter is named 'parameters'. /// </summary> /// <param name="swaggerParameter"></param> /// <returns></returns> public override bool IsValid(SwaggerParameter swaggerParameter) => (swaggerParameter.In != ParameterLocation.Body) || (swaggerParameter.Name.Equals("parameters", StringComparison.CurrentCultureIgnoreCase)); } }
mit
C#
645f20e8eea0bd26a6a1bdf4f86eab3364b8d603
Set default theme color on load
larsbrubaker/MatterControl,mmoening/MatterControl,mmoening/MatterControl,mmoening/MatterControl,jlewin/MatterControl,larsbrubaker/MatterControl,unlimitedbacon/MatterControl,jlewin/MatterControl,jlewin/MatterControl,larsbrubaker/MatterControl,jlewin/MatterControl,larsbrubaker/MatterControl,unlimitedbacon/MatterControl,unlimitedbacon/MatterControl,unlimitedbacon/MatterControl
MatterControlLib/ApplicationView/Themes/DirectoryTheme.cs
MatterControlLib/ApplicationView/Themes/DirectoryTheme.cs
/* Copyright (c) 2018, John Lewin All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. 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. 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. The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ using MatterHackers.Agg; namespace MatterHackers.MatterControl { using System.Collections.Generic; using System.IO; using System.Linq; using MatterHackers.Agg.Platform; using Newtonsoft.Json; public class SerializedTheme : IColorTheme { public string Name { get; set; } public Color DefaultColor { get; set; } public IEnumerable<string> ThemeNames { get; set; } public ThemeSet GetTheme(string mode, Color accentColor) { throw new System.NotImplementedException(); } } public class DirectoryTheme : IColorTheme { private string path; public DirectoryTheme() { } public DirectoryTheme(string directory) { var themeSetData = JsonConvert.DeserializeObject<SerializedTheme>( AggContext.StaticData.ReadAllText(Path.Combine(directory, "theme.json"))); path = directory; this.Name = Path.GetFileName(directory); this.ThemeNames = AggContext.StaticData.GetFiles(directory).Where(p => Path.GetFileName(p) != "theme.json").Select(p => Path.GetFileNameWithoutExtension(p)).ToArray(); this.DefaultColor = themeSetData.DefaultColor; } public string Name { get; } public Color DefaultColor { get; } public IEnumerable<string> ThemeNames { get; } public ThemeSet GetTheme(string mode, Color accentColor) { var themeset = JsonConvert.DeserializeObject<ThemeSet>( AggContext.StaticData.ReadAllText(Path.Combine(path, mode + ".json"))); themeset.SetAccentColor(accentColor); return themeset; } } }
/* Copyright (c) 2018, John Lewin All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. 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. 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. The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of the FreeBSD Project. */ using MatterHackers.Agg; namespace MatterHackers.MatterControl { using System.Collections.Generic; using System.IO; using System.Linq; using MatterHackers.Agg.Platform; using Newtonsoft.Json; public class SerializedTheme : IColorTheme { public string Name { get; set; } public Color DefaultColor { get; set; } public IEnumerable<string> ThemeNames { get; set; } public ThemeSet GetTheme(string mode, Color accentColor) { throw new System.NotImplementedException(); } } public class DirectoryTheme : IColorTheme { private string path; public DirectoryTheme() { } public DirectoryTheme(string directory) { var themeSetData = JsonConvert.DeserializeObject<SerializedTheme>( AggContext.StaticData.ReadAllText(Path.Combine(directory, "theme.json"))); path = directory; this.Name = Path.GetFileName(directory); this.ThemeNames = AggContext.StaticData.GetFiles(directory).Where(p => Path.GetFileName(p) != "theme.json").Select(p => Path.GetFileNameWithoutExtension(p)).ToArray(); this.DefaultColor = themeSetData.DefaultColor; } public string Name { get; } public Color DefaultColor { get; } public IEnumerable<string> ThemeNames { get; } public ThemeSet GetTheme(string mode, Color accentColor) { return JsonConvert.DeserializeObject<ThemeSet>( AggContext.StaticData.ReadAllText(Path.Combine(path, mode + ".json"))); } } }
bsd-2-clause
C#
612a7974e6bd2d2ba2cc38f0eef5a5f8d7b3cd4f
Clean code for ODataConnectedService
LaylaLiu/lab
ODataConnectedService/src/ODataConnectedServiceHandler.cs
ODataConnectedService/src/ODataConnectedServiceHandler.cs
using System; using System.Threading; using System.Threading.Tasks; using EnvDTE; using Microsoft.OData.ConnectedService.CodeGeneration; using Microsoft.OData.ConnectedService.Common; using Microsoft.VisualStudio.ConnectedServices; namespace Microsoft.OData.ConnectedService { [ConnectedServiceHandlerExport(Common.Constants.ProviderId, AppliesTo = "CSharp")] internal class ODataConnectedServiceHandler : ConnectedServiceHandler { public override async Task<AddServiceInstanceResult> AddServiceInstanceAsync(ConnectedServiceHandlerContext context, CancellationToken ct) { Project project = ProjectHelper.GetProjectFromHierarchy(context.ProjectHierarchy); ODataConnectedServiceInstance codeGenInstance = (ODataConnectedServiceInstance)context.ServiceInstance; var codeGenDescriptor = await GenerateCode(codeGenInstance.MetadataTempFilePath, codeGenInstance.EdmxVersion, context, project); return new AddServiceInstanceResult( context.ServiceInstance.Name, new Uri(codeGenDescriptor.ClientDocUri)); } private async Task<BaseCodeGenDescriptor> GenerateCode(string metadataUri, Version edmxVersion, ConnectedServiceHandlerContext context, Project project) { BaseCodeGenDescriptor codeGenDescriptor; if (edmxVersion == Common.Constants.EdmxVersion1 || edmxVersion == Common.Constants.EdmxVersion2 || edmxVersion == Common.Constants.EdmxVersion3) { codeGenDescriptor = new V3CodeGenDescriptor(metadataUri, context, project); } else if (edmxVersion == Common.Constants.EdmxVersion4) { codeGenDescriptor = new V4CodeGenDescriptor(metadataUri, context, project); } else { throw new Exception(string.Format("Not supported Edmx Version {0}", edmxVersion.ToString())); } await codeGenDescriptor.AddNugetPackages(); await codeGenDescriptor.AddGeneratedClientCode(); return codeGenDescriptor; } } }
using System; using System.Threading; using System.Threading.Tasks; using EnvDTE; using Microsoft.OData.ConnectedService.CodeGeneration; using Microsoft.OData.ConnectedService.Common; using Microsoft.VisualStudio.ConnectedServices; namespace Microsoft.OData.ConnectedService { [ConnectedServiceHandlerExport(Common.Constants.ProviderId, AppliesTo = "CSharp")] internal class ODataConnectedServiceHandler : ConnectedServiceHandler { public override async Task<AddServiceInstanceResult> AddServiceInstanceAsync(ConnectedServiceHandlerContext context, CancellationToken ct) { Project project = ProjectHelper.GetProjectFromHierarchy(context.ProjectHierarchy); ODataConnectedServiceInstance codeGenInstance = (ODataConnectedServiceInstance)context.ServiceInstance; var codeGenDescriptor = await GenerateCode(codeGenInstance.MetadataTempFilePath, codeGenInstance.EdmxVersion, context, project); return new AddServiceInstanceResult( context.ServiceInstance.Name, new Uri(codeGenDescriptor.ClientDocUri)); } public override async Task<UpdateServiceInstanceResult> UpdateServiceInstanceAsync(ConnectedServiceHandlerContext context, CancellationToken ct) { Project project = ProjectHelper.GetProjectFromHierarchy(context.ProjectHierarchy); ODataConnectedServiceInstance codeGenInstance = (ODataConnectedServiceInstance)context.ServiceInstance; var codeGenDescriptor = await GenerateCode(codeGenInstance.MetadataTempFilePath, codeGenInstance.EdmxVersion, context, project); return new UpdateServiceInstanceResult(); } private async Task<BaseCodeGenDescriptor> GenerateCode(string metadataUri, Version edmxVersion, ConnectedServiceHandlerContext context, Project project) { BaseCodeGenDescriptor codeGenDescriptor; if (edmxVersion == Common.Constants.EdmxVersion1 || edmxVersion == Common.Constants.EdmxVersion2 || edmxVersion == Common.Constants.EdmxVersion3) { codeGenDescriptor = new V3CodeGenDescriptor(metadataUri, context, project); } else if (edmxVersion == Common.Constants.EdmxVersion4) { codeGenDescriptor = new V4CodeGenDescriptor(metadataUri, context, project); } else { throw new Exception(string.Format("Not supported Edmx Version {0}", edmxVersion.ToString())); } await codeGenDescriptor.AddNugetPackages(); await codeGenDescriptor.AddGeneratedClientCode(); return codeGenDescriptor; } } }
mit
C#
e646275c6380fff7a5d41b8b8a3682262b170e0d
remove not implemented exception
ChristianKis/HackathonEpam2016,ChristianKis/HackathonEpam2016
SlbHackWeek2016/HackathonApi/Models/TeamBuilderForSure.cs
SlbHackWeek2016/HackathonApi/Models/TeamBuilderForSure.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web; using HackathonAPI.Models; namespace GuessChangeListAuthor.Models { public class TeamBuilderForSure : IRule { public void GenerateData(List<ChangeList> allChangeLists) { } public int Execute(string author, ChangeList cl) { if (author == "teamcitybuilder" && cl.Description == "pbmgr:") { return 999; } return 0; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Web; using HackathonAPI.Models; namespace GuessChangeListAuthor.Models { public class TeamBuilderForSure : IRule { public void GenerateData(List<ChangeList> allChangeLists) { throw new NotImplementedException(); } public int Execute(string author, ChangeList cl) { if (author == "teamcitybuilder" && cl.Description == "pbmgr:") { return 999; } return 0; } } }
mit
C#
1f971bc01a96d3736d1cf28724f3ac85ed833ef1
Fix code format.
dotnet-architecture/eShopOnContainers,dotnet-architecture/eShopOnContainers,albertodall/eShopOnContainers,productinfo/eShopOnContainers,andrelmp/eShopOnContainers,skynode/eShopOnContainers,skynode/eShopOnContainers,albertodall/eShopOnContainers,andrelmp/eShopOnContainers,albertodall/eShopOnContainers,andrelmp/eShopOnContainers,andrelmp/eShopOnContainers,productinfo/eShopOnContainers,productinfo/eShopOnContainers,andrelmp/eShopOnContainers,dotnet-architecture/eShopOnContainers,skynode/eShopOnContainers,productinfo/eShopOnContainers,productinfo/eShopOnContainers,albertodall/eShopOnContainers,andrelmp/eShopOnContainers,dotnet-architecture/eShopOnContainers,productinfo/eShopOnContainers,skynode/eShopOnContainers,albertodall/eShopOnContainers,skynode/eShopOnContainers,dotnet-architecture/eShopOnContainers
src/Services/Identity/Identity.API/Data/ConfigurationDbContextSeed.cs
src/Services/Identity/Identity.API/Data/ConfigurationDbContextSeed.cs
using IdentityServer4.EntityFramework.DbContexts; using IdentityServer4.EntityFramework.Mappers; using Microsoft.eShopOnContainers.Services.Identity.API.Configuration; using Microsoft.Extensions.Configuration; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.Services.Identity.API.Data { public class ConfigurationDbContextSeed { public async Task SeedAsync(ConfigurationDbContext context, IConfiguration configuration) { //callbacks urls from config: var clientUrls = new Dictionary<string, string> { {"Mvc", configuration.GetValue<string>("MvcClient")}, {"Spa", configuration.GetValue<string>("SpaClient")}, {"Xamarin", configuration.GetValue<string>("XamarinCallback")}, {"LocationsApi", configuration.GetValue<string>("LocationApiClient")}, {"MarketingApi", configuration.GetValue<string>("MarketingApiClient")}, {"BasketApi", configuration.GetValue<string>("BasketApiClient")}, {"OrderingApi", configuration.GetValue<string>("OrderingApiClient")} }; if (!context.Clients.Any()) { foreach (var client in Config.GetClients(clientUrls)) { await context.Clients.AddAsync(client.ToEntity()); } await context.SaveChangesAsync(); } if (!context.IdentityResources.Any()) { foreach (var resource in Config.GetResources()) { await context.IdentityResources.AddAsync(resource.ToEntity()); } await context.SaveChangesAsync(); } if (!context.ApiResources.Any()) { foreach (var api in Config.GetApis()) { await context.ApiResources.AddAsync(api.ToEntity()); } await context.SaveChangesAsync(); } } } }
using IdentityServer4.EntityFramework.DbContexts; using IdentityServer4.EntityFramework.Mappers; using Microsoft.eShopOnContainers.Services.Identity.API.Configuration; using Microsoft.Extensions.Configuration; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.Services.Identity.API.Data { public class ConfigurationDbContextSeed { public async Task SeedAsync(ConfigurationDbContext context,IConfiguration configuration) { //callbacks urls from config: var clientUrls = new Dictionary<string, string>(); clientUrls.Add("Mvc", configuration.GetValue<string>("MvcClient")); clientUrls.Add("Spa", configuration.GetValue<string>("SpaClient")); clientUrls.Add("Xamarin", configuration.GetValue<string>("XamarinCallback")); clientUrls.Add("LocationsApi", configuration.GetValue<string>("LocationApiClient")); clientUrls.Add("MarketingApi", configuration.GetValue<string>("MarketingApiClient")); clientUrls.Add("BasketApi", configuration.GetValue<string>("BasketApiClient")); clientUrls.Add("OrderingApi", configuration.GetValue<string>("OrderingApiClient")); if (!context.Clients.Any()) { foreach (var client in Config.GetClients(clientUrls)) { await context.Clients.AddAsync(client.ToEntity()); } await context.SaveChangesAsync(); } if (!context.IdentityResources.Any()) { foreach (var resource in Config.GetResources()) { await context.IdentityResources.AddAsync(resource.ToEntity()); } await context.SaveChangesAsync(); } if (!context.ApiResources.Any()) { foreach (var api in Config.GetApis()) { await context.ApiResources.AddAsync(api.ToEntity()); } await context.SaveChangesAsync(); } } } }
mit
C#
6e14f59679bb1a7fdc29011f50668acd2d13b762
prepare 1.0.1
emfmesquita/KabalistusTransformationTracker
KabalistusTransformationTracker/Properties/AssemblyInfo.cs
KabalistusTransformationTracker/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("IsaacTest")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("IsaacTest")] [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("bced1241-be36-4371-94c7-4bfa366539b2")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.1")] [assembly: AssemblyFileVersion("1.0.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("IsaacTest")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("IsaacTest")] [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("bced1241-be36-4371-94c7-4bfa366539b2")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0")] [assembly: AssemblyFileVersion("1.0.0")]
bsd-2-clause
C#
6124ebfb2fb2ebc75a3cbaa50256fa8dc4edf8c0
Update to Problem 1. Exchange If Greater
SimoPrG/CSharpPart1Homework
Conditional-Statements-Homework/ExchangeIfGreater/ExchangeIfGreater.cs
Conditional-Statements-Homework/ExchangeIfGreater/ExchangeIfGreater.cs
/*Problem 1. Exchange If Greater Write an if-statement that takes two double variables a and b and exchanges their values if the first one is greater than the second one. As a result print the values a and b, separated by a space. Examples: a b result 5 2 2 5 3 4 3 4 5.5 4.5 4.5 5.5 */ using System; using System.Globalization; using System.Threading; class ExchangeIfGreater { static void Main() { Console.Title = "Exchange If Greater"; //Changing the title of the console. Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US"); //Setting the culture to en-US Console.WriteLine("Please, enter two numbers 'a' and 'b'!"); Console.Write("a: "); double a = double.Parse(Console.ReadLine()); Console.Write("b: "); double b = double.Parse(Console.ReadLine()); if (a > b) { double temp = a; a = b; b = temp; } Console.WriteLine("\r\nresult\r\n{0} {1}", a, b); Console.ReadKey(); // Keeping the console opened. } }
/*Problem 1. Exchange If Greater Write an if-statement that takes two double variables a and b and exchanges their values if the first one is greater than the second one. As a result print the values a and b, separated by a space. Examples: a b result 5 2 2 5 3 4 3 4 5.5 4.5 4.5 5.5 */ using System; using System.Globalization; using System.Threading; class ExchangeIfGreater { static void Main() { Console.Title = "Exchange If Greater"; //Changing the title of the console. Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-US"); //Setting the culture to en-US Console.WriteLine("Please, enter two numbers 'a' and 'b'!"); Console.Write("a: "); double a = double.Parse(Console.ReadLine()); Console.Write("b: "); double b = double.Parse(Console.ReadLine()); if (a > b) { double temp = a; a = b; b = temp; } Console.WriteLine("\nresult\n{0} {1}", a, b); Console.ReadKey(); // Keeping the console opened. } }
mit
C#
7e8e116d580585848e25f4c2eee145e0ba6b5e56
Fix to CachedProvider.ClearCache method
modesttree/Zenject,modesttree/Zenject,modesttree/Zenject
UnityProject/Assets/Plugins/Zenject/Source/Providers/CachedProvider.cs
UnityProject/Assets/Plugins/Zenject/Source/Providers/CachedProvider.cs
using System; using System.Collections.Generic; using ModestTree; namespace Zenject { public class CachedProvider : IProvider { readonly IProvider _creator; List<object> _instances; #if !ZEN_MULTITHREADING bool _isCreatingInstance; #endif public CachedProvider(IProvider creator) { _creator = creator; } public int NumInstances { get { return _instances == null ? 0 : _instances.Count; } } // This method can be called if you want to clear the memory for an AsSingle instance, // See isssue https://github.com/modesttree/Zenject/issues/441 public void ClearCache() { _instances = null; } public Type GetInstanceType(InjectContext context) { return _creator.GetInstanceType(context); } public List<object> GetAllInstancesWithInjectSplit( InjectContext context, List<TypeValuePair> args, out Action injectAction) { Assert.IsNotNull(context); if (_instances != null) { injectAction = null; return _instances; } #if !ZEN_MULTITHREADING // This should only happen with constructor injection // Field or property injection should allow circular dependencies if (_isCreatingInstance) { throw Assert.CreateException( "Found circular dependency when creating type '{0}'. Object graph: {1}", _creator.GetInstanceType(context), context.GetObjectGraphString()); } _isCreatingInstance = true; #endif _instances = _creator.GetAllInstancesWithInjectSplit(context, args, out injectAction); Assert.IsNotNull(_instances); #if !ZEN_MULTITHREADING _isCreatingInstance = false; #endif return _instances; } } }
using System; using System.Collections.Generic; using ModestTree; namespace Zenject { public class CachedProvider : IProvider { readonly IProvider _creator; List<object> _instances; #if !ZEN_MULTITHREADING bool _isCreatingInstance; #endif public CachedProvider(IProvider creator) { _creator = creator; } public int NumInstances { get { return _instances == null ? 0 : _instances.Count; } } public void ClearCache() { _instances.Clear(); } public Type GetInstanceType(InjectContext context) { return _creator.GetInstanceType(context); } public List<object> GetAllInstancesWithInjectSplit( InjectContext context, List<TypeValuePair> args, out Action injectAction) { Assert.IsNotNull(context); if (_instances != null) { injectAction = null; return _instances; } #if !ZEN_MULTITHREADING // This should only happen with constructor injection // Field or property injection should allow circular dependencies if (_isCreatingInstance) { throw Assert.CreateException( "Found circular dependency when creating type '{0}'. Object graph: {1}", _creator.GetInstanceType(context), context.GetObjectGraphString()); } _isCreatingInstance = true; #endif _instances = _creator.GetAllInstancesWithInjectSplit(context, args, out injectAction); Assert.IsNotNull(_instances); #if !ZEN_MULTITHREADING _isCreatingInstance = false; #endif return _instances; } } }
mit
C#
fc1cfbb07f5977dec1f2d93e6ad379f894477472
Mark `DefaultMethodBodyReader.ReadMethodBody` as virtual Method.
Washi1337/AsmResolver,Washi1337/AsmResolver,Washi1337/AsmResolver,Washi1337/AsmResolver
src/AsmResolver.DotNet/Serialized/DefaultMethodBodyReader.cs
src/AsmResolver.DotNet/Serialized/DefaultMethodBodyReader.cs
using System; using AsmResolver.DotNet.Code; using AsmResolver.DotNet.Code.Cil; using AsmResolver.PE.DotNet.Cil; using AsmResolver.PE.DotNet.Metadata.Tables; using AsmResolver.PE.DotNet.Metadata.Tables.Rows; namespace AsmResolver.DotNet.Serialized { /// <summary> /// Provides a default implementation of a <see cref="IMethodBodyReader"/>, which reads CIL method bodies using the /// <see cref="CilRawMethodBody"/> class. /// </summary> public class DefaultMethodBodyReader : IMethodBodyReader { /// <inheritdoc /> public virtual MethodBody? ReadMethodBody(ModuleReaderContext context, MethodDefinition owner, in MethodDefinitionRow row) { try { if (row.Body.CanRead) { if (owner.IsIL) { var reader = row.Body.CreateReader(); var rawBody = CilRawMethodBody.FromReader(context, ref reader); return rawBody is not null ? CilMethodBody.FromRawMethodBody(context, owner, rawBody) : null; } else { context.NotSupported($"Body of method {owner.MetadataToken} is native and unbounded which is not supported."); // TODO: handle native method bodies. } } else if (row.Body.IsBounded && row.Body.GetSegment() is CilRawMethodBody rawMethodBody) { return CilMethodBody.FromRawMethodBody(context, owner, rawMethodBody); } } catch (Exception ex) { context.RegisterException(new BadImageFormatException($"Failed to parse the method body of {owner.MetadataToken}.", ex)); } return null; } } }
using System; using AsmResolver.DotNet.Code; using AsmResolver.DotNet.Code.Cil; using AsmResolver.PE.DotNet.Cil; using AsmResolver.PE.DotNet.Metadata.Tables; using AsmResolver.PE.DotNet.Metadata.Tables.Rows; namespace AsmResolver.DotNet.Serialized { /// <summary> /// Provides a default implementation of a <see cref="IMethodBodyReader"/>, which reads CIL method bodies using the /// <see cref="CilRawMethodBody"/> class. /// </summary> public class DefaultMethodBodyReader : IMethodBodyReader { /// <inheritdoc /> public MethodBody? ReadMethodBody(ModuleReaderContext context, MethodDefinition owner, in MethodDefinitionRow row) { try { if (row.Body.CanRead) { if (owner.IsIL) { var reader = row.Body.CreateReader(); var rawBody = CilRawMethodBody.FromReader(context, ref reader); return rawBody is not null ? CilMethodBody.FromRawMethodBody(context, owner, rawBody) : null; } else { context.NotSupported($"Body of method {owner.MetadataToken} is native and unbounded which is not supported."); // TODO: handle native method bodies. } } else if (row.Body.IsBounded && row.Body.GetSegment() is CilRawMethodBody rawMethodBody) { return CilMethodBody.FromRawMethodBody(context, owner, rawMethodBody); } } catch (Exception ex) { context.RegisterException(new BadImageFormatException($"Failed to parse the method body of {owner.MetadataToken}.", ex)); } return null; } } }
mit
C#
ee3e12267bbab7f3a822744867b6eb36d85173a8
Update AddWordArtWatermarkToWorksheet.cs
asposecells/Aspose_Cells_NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_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,aspose-cells/Aspose.Cells-for-.NET,aspose-cells/Aspose.Cells-for-.NET,maria-shahid-aspose/Aspose.Cells-for-.NET,asposecells/Aspose_Cells_NET,aspose-cells/Aspose.Cells-for-.NET
Examples/CSharp/Articles/AddWordArtWatermarkToWorksheet.cs
Examples/CSharp/Articles/AddWordArtWatermarkToWorksheet.cs
using System.IO; using Aspose.Cells; using Aspose.Cells.Drawing; namespace Aspose.Cells.Examples.Articles { public class AddWordArtWatermarkToWorksheet { 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); //Instantiate a new Workbook Workbook workbook = new Workbook(); //Get the first default sheet Worksheet sheet = workbook.Worksheets[0]; //Add Watermark Aspose.Cells.Drawing.Shape wordart = sheet.Shapes.AddTextEffect(MsoPresetTextEffect.TextEffect1, "CONFIDENTIAL", "Arial Black", 50, false, true , 18, 8, 1, 1, 130, 800); //Get the fill format of the word art MsoFillFormat wordArtFormat = wordart.FillFormat; //Set the color wordArtFormat.ForeColor = System.Drawing.Color.Red; //Set the transparency wordArtFormat.Transparency = 0.9; //Make the line invisible MsoLineFormat lineFormat = wordart.LineFormat; lineFormat.IsVisible = false; //Save the file workbook.Save(dataDir+ "Watermark_Test.out.xls"); //ExEnd:1 } } }
using System.IO; using Aspose.Cells; using Aspose.Cells.Drawing; namespace Aspose.Cells.Examples.Articles { public class AddWordArtWatermarkToWorksheet { 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); //Instantiate a new Workbook Workbook workbook = new Workbook(); //Get the first default sheet Worksheet sheet = workbook.Worksheets[0]; //Add Watermark Aspose.Cells.Drawing.Shape wordart = sheet.Shapes.AddTextEffect(MsoPresetTextEffect.TextEffect1, "CONFIDENTIAL", "Arial Black", 50, false, true , 18, 8, 1, 1, 130, 800); //Get the fill format of the word art MsoFillFormat wordArtFormat = wordart.FillFormat; //Set the color wordArtFormat.ForeColor = System.Drawing.Color.Red; //Set the transparency wordArtFormat.Transparency = 0.9; //Make the line invisible MsoLineFormat lineFormat = wordart.LineFormat; lineFormat.IsVisible = false; //Save the file workbook.Save(dataDir+ "Watermark_Test.out.xls"); } } }
mit
C#
701511cd85ca83bb9a015b96707af8ab8535893b
Fix a couple of potential race conditions in the ModelCacheManager
RvanDalen/Glass.Mapper,mikeedwards83/Glass.Mapper,pbustamante/Glass.Mapper,pbustamante/Glass.Mapper,RvanDalen/Glass.Mapper,RvanDalen/Glass.Mapper,mikeedwards83/Glass.Mapper,pbustamante/Glass.Mapper
Source/Glass.Mapper.Sc.Mvc/ModelCache/ModelCacheManager.cs
Source/Glass.Mapper.Sc.Mvc/ModelCache/ModelCacheManager.cs
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Web; namespace Glass.Mapper.Sc.ModelCache { public class ModelCacheManager : IModelCacheManager { public static FileSystemWatcher FileSystemWatcher { get; private set; } public static ConcurrentDictionary<string, Type> CachedTypes { get; private set; } public static ConcurrentDictionary<string, string> CachedKeys { get; private set; } static ModelCacheManager() { CachedKeys = new ConcurrentDictionary<string, string>(); CachedTypes = new ConcurrentDictionary<string, Type>(); FileSystemWatcher = new FileSystemWatcher(HttpContext.Current.Server.MapPath("/")) { Filter = "*.cshtml", IncludeSubdirectories = true }; FileSystemWatcher.Changed += FileSystemWatcher_Changed; FileSystemWatcher.Deleted += FileSystemWatcher_Changed; FileSystemWatcher.Renamed += FileSystemWatcher_Renamed; FileSystemWatcher.EnableRaisingEvents = true; } private static void FileSystemWatcher_Renamed(object sender, RenamedEventArgs e) { Type outType; CachedTypes.TryRemove(e.OldFullPath, out outType); } private static void FileSystemWatcher_Changed(object sender, FileSystemEventArgs e) { Type outType; CachedTypes.TryRemove(e.FullPath, out outType); } public virtual void Add(string path, Type modelType) { CachedTypes.TryAdd(path, modelType); } public virtual Type Get(string path) { Type retVal; return CachedTypes.TryGetValue(path, out retVal) ? retVal : null; } public string GetKey(string path) { return CachedKeys.GetOrAdd(path, key => HttpContext.Current.Server.MapPath(key)); } } }
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Web; namespace Glass.Mapper.Sc.ModelCache { public class ModelCacheManager : IModelCacheManager { public static FileSystemWatcher FileSystemWatcher { get; private set; } public static ConcurrentDictionary<string, Type> CachedTypes { get; private set; } public static ConcurrentDictionary<string, string> CachedKeys { get; private set; } static ModelCacheManager() { CachedKeys = new ConcurrentDictionary<string, string>(); CachedTypes = new ConcurrentDictionary<string, Type>(); FileSystemWatcher = new FileSystemWatcher(HttpContext.Current.Server.MapPath("/")) { Filter = "*.cshtml", IncludeSubdirectories = true }; FileSystemWatcher.Changed += FileSystemWatcher_Changed; FileSystemWatcher.Deleted += FileSystemWatcher_Changed; FileSystemWatcher.Renamed += FileSystemWatcher_Renamed; FileSystemWatcher.EnableRaisingEvents = true; } private static void FileSystemWatcher_Renamed(object sender, RenamedEventArgs e) { Type outType; CachedTypes.TryRemove(e.OldFullPath, out outType); } private static void FileSystemWatcher_Changed(object sender, FileSystemEventArgs e) { Type outType; CachedTypes.TryRemove(e.FullPath, out outType); } public virtual void Add(string path, Type modelType) { CachedTypes.TryAdd(path, modelType); } public virtual Type Get(string path) { return CachedTypes.ContainsKey(path) ? CachedTypes[path] : null; } public string GetKey(string path) { string realPath; if (CachedKeys.ContainsKey(path)) { realPath = CachedKeys[path]; } else { realPath = HttpContext.Current.Server.MapPath(path); CachedKeys.TryAdd(path, realPath); } return realPath; } } }
apache-2.0
C#
6d05eb6ab06f7369bdcf2e5a71c737cffd4b8357
Update ServiceKeys.cs
kphillpotts/IntroXamarinWithVS
app-imagesearch-cogs/ImageSearch/ImageSearch/Services/ServiceKeys.cs
app-imagesearch-cogs/ImageSearch/ImageSearch/Services/ServiceKeys.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ImageSearch.Services { public class GoogleServicesKeys { //Setup a custom search with Image enabled with a website of *: https://cse.google.com/cse/ public const string APIKey = "__ENTER YOUR KEY__"; public const string CX = "__ENTER YOUR CX__"; } public class CognitiveServicesKeys { //Setup a Emotion API key for Cognitive Services at: https://www.microsoft.com/cognitive-services/ public const string Emotion = ""; //Setup a Bing Search API key from: http://www.microsoft.com/cognitive-services public const string BingSearch = ""; } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ImageSearch.Services { public class GoogleServicesKeys { //Setup a custom search with Image enabled with a website of *: https://cse.google.com/cse/ public const string APIKey = "__ENTER YOUR KEY__"; public const string CX = "__ENTER YOUR CX__"; } public class CognitiveServicesKeys { //Setup a Emotion API key for Cognitive Services at: https://www.microsoft.com/cognitive-services/ public const string Emotion = "93b7df133d7149fdbeb5729b8586d293"; //Setup a Bing Search API key from: http://www.microsoft.com/cognitive-services public const string BingSearch = "8b2d651131aa4e39acd2f3cf850f1e9f"; } }
mit
C#
7d75efda09d6753e536af60a5f93173a08b58825
Add one phrase to privacy policy
Chess-Variants-Training/Chess-Variants-Training,Chess-Variants-Training/Chess-Variants-Training,Chess-Variants-Training/Chess-Variants-Training
src/ChessVariantsTraining/Views/Misc/PrivacyPolicy.cshtml
src/ChessVariantsTraining/Views/Misc/PrivacyPolicy.cshtml
@section Title{Privacy policy} @section Description{Privacy policy of Chess Variants Training} <h1>Privacy policy</h1> <p>This document states what information Chess Variants Training collects, and how it gets used.</p> <p>Your information will never be sold to, or shared with, third parties, unless necessary by law.</p> <h2>User-submitted information</h2> <p>This is the information you give when signing up and editing your profile. All information - except your email address - there is public and Chess Variants Training is not responsible for how this data is used. Your email address is only used to verify your account and contact you if necessary.</p> <h2>Technical information</h2> <p>Chess Variants Training stores your IP when you log in to the site, for security and moderation purposes. IP addresses from anonymous users are not stored. Your IP addresses are private and only visible to the administrators.</p> <h2>Cookies</h2> <p>Cookies are stored on your computer for authentication and security purposes. They are not used to track your behavior on the site.</p> <p>If you are an anonymous user, only session cookies will be stored. These cookies will expire at the end of your session, if you close the browser window. These cookies are not used to track your behavior.</p> <p>(For example, when playing Variant960 games as an anonymous user, we will store a session cookie. Its sole purpose is to identify "ownership" of a game and this is required to make the lobby and rematches work.)</p> <h2>ReCAPTCHA</h2> <p>When registering, Chess Variants Training uses Google's ReCAPTCHA service to verify that bots are not automatically registering on the site.</p> <h2>Other</h2> <p>If you have any questions or concerns regarding this policy, please contact us at <code>chessvariantstraining(at)gmail(dot)com</code></p> <p>The Chess Variants Training team can change this policy at their discretion. We will notify you about significant changes.</p>
@section Title{Privacy policy} @section Description{Privacy policy of Chess Variants Training} <h1>Privacy policy</h1> <p>This document states what information Chess Variants Training collects, and how it gets used.</p> <p>Your information will never be sold to, or shared with, third parties, unless necessary by law.</p> <h2>User-submitted information</h2> <p>This is the information you give when signing up and editing your profile. All information - except your email address - there is public and Chess Variants Training is not responsible for how this data is used. Your email address is only used to verify your account and contact you if necessary.</p> <h2>Technical information</h2> <p>Chess Variants Training stores your IP when you log in to the site, for security and moderation purposes. IP addresses from anonymous users are not stored. Your IP addresses are private and only visible to the administrators.</p> <h2>Cookies</h2> <p>Cookies are stored on your computer for authentication and security purposes. They are not used to track your behavior on the site.</p> <p>If you are an anonymous user, only session cookies will be stored. These cookies will expire at the end of your session, if you close the browser window. These cookies are not used to track your behavior.</p> <p>(For example, when playing Variant960 games as an anonymous user, we will store a session cookie. Its sole purpose is to identify "ownership" of a game and this is required to make the lobby and rematches work.)</p> <h2>ReCAPTCHA</h2> <p>When registering, Chess Variants Training uses Google's ReCAPTCHA service to verify that bots are not automatically registering on the site.</p> <h2>Other</h2> <p>If you have any questions or concerns regarding this policy, please contact us at <code>chessvariantstraining(at)gmail(dot)com</code></p> <p>The Chess Variants Training team can change this policy at their discretion.</p>
agpl-3.0
C#
45ab9fc3e899c70077f21d3a5b328fe97e973ad1
Allow downloading files from administrative mode
Sebazzz/IFS,Sebazzz/IFS,Sebazzz/IFS,Sebazzz/IFS
src/IFS.Web/Areas/Administration/Views/Files/Index.cshtml
src/IFS.Web/Areas/Administration/Views/Files/Index.cshtml
@using Humanizer @model FilesOverviewModel @{ ViewBag.Title = "Uploaded file overview"; } <h2>@ViewBag.Title</h2> @{ var sortedFiles = Model.Files.OrderBy(x => x.Metadata.OriginalFileName); } <table class="table table-striped"> <thead> <tr> <th>ID</th> <th>File name</th> <th>Uploaded on</th> <th>Expires</th> </tr> </thead> <tbody> @foreach (var file in sortedFiles) { <tr> <td><code>@file.Id</code></td> <td> <a asp-route="DownloadFile" asp-route-id="@file.Id">@file.Metadata.OriginalFileName</a> </td> <td> @file.Metadata.UploadedOn.Humanize() </td> <td> @file.Metadata.Expiration.Humanize() </td> </tr> } </tbody> </table>
@using Humanizer @model FilesOverviewModel @{ ViewBag.Title = "Uploaded file overview"; } <h2>@ViewBag.Title</h2> @{ var sortedFiles = Model.Files.OrderBy(x => x.Metadata.OriginalFileName); } <table class="table table-striped"> <thead> <tr> <th>ID</th> <th>File name</th> <th>Uploaded on</th> <th>Expires</th> </tr> </thead> <tbody> @foreach (var file in sortedFiles) { <tr> <td><code>@file.Id</code></td> <td>@file.Metadata.OriginalFileName</td> <td> @file.Metadata.UploadedOn.Humanize() </td> <td> @file.Metadata.Expiration.Humanize() </td> </tr> } </tbody> </table>
mit
C#
11a1587a42ddaf01a4e34bd927e222ba4ccedb36
Remove fields
mike-rowley/XamarinMediaManager,mike-rowley/XamarinMediaManager,martijn00/XamarinMediaManager,bubavanhalen/XamarinMediaManager,modplug/XamarinMediaManager,martijn00/XamarinMediaManager
MediaManager/Plugin.MediaManager.Abstractions/IMediaFile.cs
MediaManager/Plugin.MediaManager.Abstractions/IMediaFile.cs
using System; using System.ComponentModel; using Plugin.MediaManager.Abstractions; using Plugin.MediaManager.Abstractions.Implementations; namespace Plugin.MediaManager.Abstractions { /// <summary> /// Information about the mediafile /// </summary> /// <seealso cref="System.ComponentModel.INotifyPropertyChanged" /> public interface IMediaFile : INotifyPropertyChanged { /// <summary> /// A unique identifier for this media file /// </summary> Guid Id { get; set; } /// <summary> /// Indicator for player which type of file it should play /// </summary> MediaFileType Type { get; set; } /// <summary> /// Gets or sets the URL. /// </summary> /// <value> /// The URL. /// </value> string Url { get; set; } /// <summary> /// Gets or sets the metadata. /// </summary> /// <value> /// The metadata. /// </value> IMediaFileMetadata Metadata { get; set; } /// <summary> /// Gets or sets a value indicating whether [metadata extracted]. /// </summary> /// <value> /// <c>true</c> if [metadata extracted]; otherwise, <c>false</c>. /// </value> bool MetadataExtracted { get; set; } } }
using System; using System.ComponentModel; using Plugin.MediaManager.Abstractions; using Plugin.MediaManager.Abstractions.Implementations; namespace Plugin.MediaManager.Abstractions { /// <summary> /// Information about the mediafile /// </summary> /// <seealso cref="System.ComponentModel.INotifyPropertyChanged" /> public interface IMediaFile : INotifyPropertyChanged { /// <summary> /// A unique identifier for this media file /// </summary> Guid Id { get; set; } /// <summary> /// Indicator for player which type of file it should play /// </summary> MediaFileType Type { get; set; } /// <summary> /// Gets or sets the URL. /// </summary> /// <value> /// The URL. /// </value> string Url { get; set; } /// <summary> /// Gets or sets the metadata. /// </summary> /// <value> /// The metadata. /// </value> IMediaFileMetadata Metadata { get; set; } /// <summary> /// Gets or sets a value indicating whether [metadata extracted]. /// </summary> object Cover { get; set; } /// <summary> /// The performing artist if available /// </summary> string Artist { get; set; } /// <summary> /// The media title if available /// Defaults to filename /// </summary> string Title { get; set; } /// <value> /// <c>true</c> if [metadata extracted]; otherwise, <c>false</c>. /// </value> bool MetadataExtracted { get; set; } } }
mit
C#
5bb0515af5157d4cb61eee7a889921688a5e2ece
Call InitializeComponent, if no code-behind
canton7/Stylet,cH40z-Lord/Stylet,canton7/Stylet,cH40z-Lord/Stylet
MicroMVVM/ViewLocator.cs
MicroMVVM/ViewLocator.cs
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Windows; namespace MicroMVVM { public static class ViewLocator { public static UIElement LocateForModel(object model) { var modelName = model.GetType().FullName; var viewName = Regex.Replace(modelName, @"ViewModel", "View"); var viewType = Assembly.GetEntryAssembly().GetType(modelName); if (viewType == null) throw new Exception(String.Format("Unable to find a View with type {0}", viewName)); var instance = Activator.CreateInstance(viewType); if (!(instance is UIElement)) throw new Exception(String.Format("Managed to create a {0}, but it wasn't a UIElement", viewName)); var initializer = viewType.GetMethod("InitializeComponent", BindingFlags.Public | BindingFlags.Instance); if (initializer != null) initializer.Invoke(instance, null); return (UIElement)instance; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using System.Windows; namespace MicroMVVM { public static class ViewLocator { public static UIElement LocateForModel(object model) { var viewName = model.GetType().FullName; var modelName = Regex.Replace(viewName, @"ViewModel", "View"); var modelType = Assembly.GetEntryAssembly().GetType(modelName); if (modelType == null) throw new Exception(String.Format("Unable to find a View with type {0}", modelName)); var instance = Activator.CreateInstance(modelType); if (!(instance is UIElement)) throw new Exception(String.Format("Managed to create a {0}, but it wasn't a UIElement", modelName)); return (UIElement)instance; } } }
mit
C#
ce6c03f490051c9aac2ab48dbdc96a2732b42e9e
Add DPI property to Display.
roblillack/monoberry,roblillack/monoberry,roblillack/monoberry,roblillack/monoberry
libblackberry/screen/Display.cs
libblackberry/screen/Display.cs
using System; using System.Drawing; using System.Runtime.InteropServices; namespace BlackBerry.Screen { public class Display { [DllImport ("screen")] static extern int screen_get_display_property_iv (IntPtr handle, Property prop, out int val); [DllImport ("screen")] static extern int screen_get_display_property_iv (IntPtr handle, Property prop, [Out] int[] vals); [DllImport ("screen")] static extern int screen_set_display_property_iv (IntPtr handle, Property prop, ref int val); IntPtr handle; public Display (IntPtr hnd) { handle = hnd; } public Size Size { get { var rect = new int [2]; screen_get_display_property_iv (handle, Property.SCREEN_PROPERTY_SIZE, rect); return new Size (rect[0], rect[1]); } } public DisplayType Type { get { return (DisplayType)GetIntProperty (Property.SCREEN_PROPERTY_TYPE); } } public uint DPI { get { var physicalSize = new int [2]; if (screen_get_display_property_iv(handle, Property.SCREEN_PROPERTY_PHYSICAL_SIZE, physicalSize) != 0) { throw new Exception ("Unable to read physical display size."); } // Default value, according to bbutil.c if (physicalSize[0] == 0 || physicalSize[1] == 0) { return 170; } var pixels = Size; var dpmm = Math.Sqrt (Math.Pow (pixels.Width, 2.0) + Math.Pow (pixels.Height, 2.0)) / Math.Sqrt (Math.Pow (physicalSize [0], 2.0) + Math.Pow (physicalSize [1], 2.0)); return (uint)Math.Ceiling (dpmm / 25.4); } } int GetIntProperty (Property p) { int result; if (screen_get_display_property_iv (handle, p, out result) != 0) { throw new Exception ("Unable to read display property " + p); } return result; } void SetIntProperty (Property p, int val) { if (screen_set_display_property_iv (handle, p, ref val) != 0) { throw new Exception ("Unable to set display property " + p); } } } }
using System; using System.Drawing; using System.Runtime.InteropServices; namespace BlackBerry.Screen { public class Display { [DllImport ("screen")] static extern int screen_get_display_property_iv (IntPtr handle, Property prop, out int val); [DllImport ("screen")] static extern int screen_get_display_property_iv (IntPtr handle, Property prop, [Out] int[] vals); [DllImport ("screen")] static extern int screen_set_display_property_iv (IntPtr handle, Property prop, ref int val); IntPtr handle; public Display (IntPtr hnd) { handle = hnd; } public Size Size { get { var rect = new int [2]; screen_get_display_property_iv (handle, Property.SCREEN_PROPERTY_SIZE, rect); return new Size (rect[0], rect[1]); } } public DisplayType Type { get { return (DisplayType)GetIntProperty (Property.SCREEN_PROPERTY_TYPE); } } int GetIntProperty (Property p) { int result; if (screen_get_display_property_iv (handle, p, out result) != 0) { throw new Exception ("Unable to read display property " + p); } return result; } void SetIntProperty (Property p, int val) { if (screen_set_display_property_iv (handle, p, ref val) != 0) { throw new Exception ("Unable to set display property " + p); } } } }
mit
C#
37599b1ca38f3ac2d2f84aff77e6c2d260ff98ec
Add guards
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi.Fluent/ViewModels/Dialogs/EnterPasswordViewModel.cs
WalletWasabi.Fluent/ViewModels/Dialogs/EnterPasswordViewModel.cs
using System.Reactive.Linq; using System.Windows.Input; using ReactiveUI; using WalletWasabi.Gui.Validation; using WalletWasabi.Models; using WalletWasabi.Userfacing; namespace WalletWasabi.Fluent.ViewModels.Dialogs { public class EnterPasswordViewModel : DialogViewModelBase<string?> { private string? _confirmPassword; private string? _password; public EnterPasswordViewModel(NavigationStateViewModel navigationState, NavigationTarget navigationTarget, string subtitle) : base(navigationState, navigationTarget) { Subtitle = subtitle; // This means pressing continue will make the password empty string. // pressing cancel will return null. _password = ""; this.ValidateProperty(x => x.Password, ValidatePassword); this.ValidateProperty(x => x.ConfirmPassword, ValidateConfirmPassword); var backCommandCanExecute = this.WhenAnyValue(x => x.IsDialogOpen).ObserveOn(RxApp.MainThreadScheduler); var nextCommandCanExecute = this.WhenAnyValue( x => x.IsDialogOpen, x => x.Password, x => x.ConfirmPassword, (isDialogOpen, password, confirmPassword) => { // This will fire validations before return canExecute value. this.RaisePropertyChanged(nameof(Password)); this.RaisePropertyChanged(nameof(ConfirmPassword)); return isDialogOpen && ((string.IsNullOrEmpty(password) && string.IsNullOrEmpty(confirmPassword)) || (!string.IsNullOrEmpty(password) && !string.IsNullOrEmpty(confirmPassword) && !Validations.Any)); }) .ObserveOn(RxApp.MainThreadScheduler); var cancelCommandCanExecute = this.WhenAnyValue(x => x.IsDialogOpen).ObserveOn(RxApp.MainThreadScheduler); BackCommand = ReactiveCommand.Create(() => Close(), backCommandCanExecute); NextCommand = ReactiveCommand.Create(() => Close(Password), nextCommandCanExecute); CancelCommand = ReactiveCommand.Create(() => Close(), cancelCommandCanExecute); } public string? Password { get => _password; set => this.RaiseAndSetIfChanged(ref _password, value); } public string? ConfirmPassword { get => _confirmPassword; set => this.RaiseAndSetIfChanged(ref _confirmPassword, value); } public ICommand NextCommand { get; } public string Subtitle { get; } protected override void OnDialogClosed() { Password = ""; ConfirmPassword = ""; } private void ValidateConfirmPassword(IValidationErrors errors) { if (!string.IsNullOrEmpty(ConfirmPassword) && Password != ConfirmPassword) { errors.Add(ErrorSeverity.Error, PasswordHelper.MatchingMessage); } } private void ValidatePassword(IValidationErrors errors) { if (PasswordHelper.IsTrimable(Password, out _)) { errors.Add(ErrorSeverity.Error, PasswordHelper.WhitespaceMessage); } if (PasswordHelper.IsTooLong(Password, out _)) { errors.Add(ErrorSeverity.Error, PasswordHelper.PasswordTooLongMessage); } } } }
using System.Reactive.Linq; using System.Windows.Input; using ReactiveUI; using WalletWasabi.Gui.Validation; using WalletWasabi.Models; using WalletWasabi.Userfacing; namespace WalletWasabi.Fluent.ViewModels.Dialogs { public class EnterPasswordViewModel : DialogViewModelBase<string?> { private string? _confirmPassword; private string? _password; public EnterPasswordViewModel(NavigationStateViewModel navigationState, NavigationTarget navigationTarget, string subtitle) : base(navigationState, navigationTarget) { Subtitle = subtitle; // This means pressing continue will make the password empty string. // pressing cancel will return null. _password = ""; this.ValidateProperty(x => x.Password, ValidatePassword); this.ValidateProperty(x => x.ConfirmPassword, ValidateConfirmPassword); var backCommandCanExecute = this.WhenAnyValue(x => x.IsDialogOpen).ObserveOn(RxApp.MainThreadScheduler); var nextCommandCanExecute = this.WhenAnyValue( x => x.IsDialogOpen, x => x.Password, x => x.ConfirmPassword, (isDialogOpen, password, confirmPassword) => { // This will fire validations before return canExecute value. this.RaisePropertyChanged(nameof(Password)); this.RaisePropertyChanged(nameof(ConfirmPassword)); return isDialogOpen && ((string.IsNullOrEmpty(password) && string.IsNullOrEmpty(confirmPassword)) || (!string.IsNullOrEmpty(password) && !string.IsNullOrEmpty(confirmPassword) && !Validations.Any)); }) .ObserveOn(RxApp.MainThreadScheduler); var cancelCommandCanExecute = this.WhenAnyValue(x => x.IsDialogOpen).ObserveOn(RxApp.MainThreadScheduler); BackCommand = ReactiveCommand.Create(() => Close()); NextCommand = ReactiveCommand.Create(() => Close(Password), nextCommandCanExecute); CancelCommand = ReactiveCommand.Create(() => Close()); } public string? Password { get => _password; set => this.RaiseAndSetIfChanged(ref _password, value); } public string? ConfirmPassword { get => _confirmPassword; set => this.RaiseAndSetIfChanged(ref _confirmPassword, value); } public ICommand NextCommand { get; } public string Subtitle { get; } protected override void OnDialogClosed() { Password = ""; ConfirmPassword = ""; } private void ValidateConfirmPassword(IValidationErrors errors) { if (!string.IsNullOrEmpty(ConfirmPassword) && Password != ConfirmPassword) { errors.Add(ErrorSeverity.Error, PasswordHelper.MatchingMessage); } } private void ValidatePassword(IValidationErrors errors) { if (PasswordHelper.IsTrimable(Password, out _)) { errors.Add(ErrorSeverity.Error, PasswordHelper.WhitespaceMessage); } if (PasswordHelper.IsTooLong(Password, out _)) { errors.Add(ErrorSeverity.Error, PasswordHelper.PasswordTooLongMessage); } } } }
mit
C#
6b0b7e0b37a7d8c620627a58735a3b7b3e8ca769
Remove redundant finalizer
Excel-DNA/IntelliSense
Source/ExcelDna.IntelliSense/Util/RenewableDelayExecutor.cs
Source/ExcelDna.IntelliSense/Util/RenewableDelayExecutor.cs
using System; using System.Timers; namespace ExcelDna.IntelliSense.Util { /// <summary> /// Upon a signal, executes the specified action after the specified delay. /// If any other signal arrives during the waiting period, the delay interval begins anew. /// </summary> internal class RenewableDelayExecutor : IDisposable { private readonly Timer _timer; private readonly Action _action; private readonly int _debounceIntervalMilliseconds; public bool IsDisposed { get; private set; } public RenewableDelayExecutor(int debounceIntervalMilliseconds, Action action) { _action = action; _debounceIntervalMilliseconds = debounceIntervalMilliseconds; _timer = new Timer { AutoReset = false, Interval = _debounceIntervalMilliseconds, }; _timer.Elapsed += OnTimerElapsed; } private void OnTimerElapsed(object sender, ElapsedEventArgs e) { if (IsDisposed) { return; } _action(); } public void Signal() { _timer.Stop(); _timer.Start(); } private void Dispose(bool isDisposing) { IsDisposed = true; _timer.Elapsed -= OnTimerElapsed; _timer.Dispose(); } public void Dispose() => Dispose(true); } }
using System; using System.Timers; namespace ExcelDna.IntelliSense.Util { /// <summary> /// Upon a signal, executes the specified action after the specified delay. /// If any other signal arrives during the waiting period, the delay interval begins anew. /// </summary> internal class RenewableDelayExecutor : IDisposable { private readonly Timer _timer; private readonly Action _action; private readonly int _debounceIntervalMilliseconds; public bool IsDisposed { get; private set; } public RenewableDelayExecutor(int debounceIntervalMilliseconds, Action action) { _action = action; _debounceIntervalMilliseconds = debounceIntervalMilliseconds; _timer = new Timer { AutoReset = false, Interval = _debounceIntervalMilliseconds, }; _timer.Elapsed += OnTimerElapsed; } private void OnTimerElapsed(object sender, ElapsedEventArgs e) { if (IsDisposed) { return; } _action(); } public void Signal() { _timer.Stop(); _timer.Start(); } private void Dispose(bool isDisposing) { IsDisposed = true; _timer.Elapsed -= OnTimerElapsed; _timer.Dispose(); if (isDisposing) { GC.SuppressFinalize(this); } } public void Dispose() => Dispose(true); ~RenewableDelayExecutor() { Dispose(false); } } }
mit
C#
9766591ce322ec172f6aa583919d2f43818266f1
Update the version to 1.7
ladimolnar/BitcoinDatabaseGenerator
Sources/BitcoinDatabaseGenerator/Properties/AssemblyInfo.cs
Sources/BitcoinDatabaseGenerator/Properties/AssemblyInfo.cs
//----------------------------------------------------------------------- // <copyright file="AssemblyInfo.cs"> // Copyright © Ladislau Molnar. All rights reserved. // </copyright> //----------------------------------------------------------------------- using System; 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("BitcoinDatabaseGenerator")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BitcoinDatabaseGenerator")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: CLSCompliant(false)] // 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("372a7f52-b038-43aa-a42c-3ff0ecab1124")] // 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.7.0.0")] [assembly: AssemblyFileVersion("1.7.0.0")]
//----------------------------------------------------------------------- // <copyright file="AssemblyInfo.cs"> // Copyright © Ladislau Molnar. All rights reserved. // </copyright> //----------------------------------------------------------------------- using System; 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("BitcoinDatabaseGenerator")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("BitcoinDatabaseGenerator")] [assembly: AssemblyCopyright("Copyright © 2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: CLSCompliant(false)] // 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("372a7f52-b038-43aa-a42c-3ff0ecab1124")] // 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.6.0.0")] [assembly: AssemblyFileVersion("1.6.0.0")]
apache-2.0
C#
59cdd2de132c098e03f1b2ba7090074787936652
define a stereotype for the ApiWriter role
CityofSantaMonica/Orchard.ParkingData,RaghavAbboy/Orchard.ParkingData
Permissions.cs
Permissions.cs
using System.Collections.Generic; using Orchard.Environment.Extensions.Models; using Orchard.Security.Permissions; namespace CSM.ParkingData { public class Permissions : IPermissionProvider { public static readonly Permission ApiWriter = new Permission { Name = "ApiWriter", Description = "POST data to API endpoints", }; public virtual Feature Feature { get; set; } public IEnumerable<Permission> GetPermissions() { return new[] { ApiWriter }; } public IEnumerable<PermissionStereotype> GetDefaultStereotypes() { return new[] { new PermissionStereotype { Name = "Administrator", Permissions = new[] { ApiWriter } }, new PermissionStereotype { Name = "ApiWriter", Permissions = new[] { ApiWriter } } }; } } }
using System.Collections.Generic; using Orchard.Environment.Extensions.Models; using Orchard.Security.Permissions; namespace CSM.ParkingData { public class Permissions : IPermissionProvider { public static readonly Permission ApiWriter = new Permission { Name = "ApiWriter", Description = "POST data to API endpoints", }; public virtual Feature Feature { get; set; } public IEnumerable<Permission> GetPermissions() { return new[] { ApiWriter }; } public IEnumerable<PermissionStereotype> GetDefaultStereotypes() { return new[] { new PermissionStereotype { Name = "Administrator", Permissions = new[] { ApiWriter } } }; } } }
mit
C#
a99786d9c4a660b9096a6cff5aaf02e7bc71820c
Fix ICustomDrawOperation HitTest coordinate space.
jkoritzinsky/Avalonia,grokys/Perspex,SuperJMN/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,jkoritzinsky/Avalonia,Perspex/Perspex,jkoritzinsky/Perspex,jkoritzinsky/Avalonia,grokys/Perspex,SuperJMN/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,wieslawsoltes/Perspex,SuperJMN/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,Perspex/Perspex,wieslawsoltes/Perspex,SuperJMN/Avalonia,AvaloniaUI/Avalonia
src/Avalonia.Visuals/Rendering/SceneGraph/CustomDrawOperation.cs
src/Avalonia.Visuals/Rendering/SceneGraph/CustomDrawOperation.cs
using System; using Avalonia.Media; using Avalonia.Platform; namespace Avalonia.Rendering.SceneGraph { internal sealed class CustomDrawOperation : DrawOperation { public Matrix Transform { get; } public ICustomDrawOperation Custom { get; } public CustomDrawOperation(ICustomDrawOperation custom, Matrix transform) : base(custom.Bounds, transform) { Transform = transform; Custom = custom; } public override bool HitTest(Point p) { if (Transform.HasInverse) { return Custom.HitTest(p * Transform.Invert()); } return false; } public override void Render(IDrawingContextImpl context) { context.Transform = Transform; Custom.Render(context); } public override void Dispose() => Custom.Dispose(); public bool Equals(Matrix transform, ICustomDrawOperation custom) => Transform == transform && Custom?.Equals(custom) == true; } public interface ICustomDrawOperation : IDrawOperation, IEquatable<ICustomDrawOperation> { } }
using System; using Avalonia.Media; using Avalonia.Platform; namespace Avalonia.Rendering.SceneGraph { internal sealed class CustomDrawOperation : DrawOperation { public Matrix Transform { get; } public ICustomDrawOperation Custom { get; } public CustomDrawOperation(ICustomDrawOperation custom, Matrix transform) : base(custom.Bounds, transform) { Transform = transform; Custom = custom; } public override bool HitTest(Point p) { return Custom.HitTest(p * Transform); } public override void Render(IDrawingContextImpl context) { context.Transform = Transform; Custom.Render(context); } public override void Dispose() => Custom.Dispose(); public bool Equals(Matrix transform, ICustomDrawOperation custom) => Transform == transform && Custom?.Equals(custom) == true; } public interface ICustomDrawOperation : IDrawOperation, IEquatable<ICustomDrawOperation> { } }
mit
C#
6356180b6abd5a11ab32508ad3dcd2984c561aee
Remove unnecessary code and fix double nesting causing filtering to not work
peppy/osu,ppy/osu,NeoAdonis/osu,peppy/osu,ppy/osu,NeoAdonis/osu,peppy/osu,NeoAdonis/osu,ppy/osu
osu.Game/Overlays/Settings/Sections/Gameplay/AudioSettings.cs
osu.Game/Overlays/Settings/Sections/Gameplay/AudioSettings.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.Graphics; using osu.Framework.Localisation; using osu.Game.Configuration; using osu.Game.Localisation; namespace osu.Game.Overlays.Settings.Sections.Gameplay { public class AudioSettings : SettingsSubsection { protected override LocalisableString Header => GameplaySettingsStrings.AudioHeader; [BackgroundDependencyLoader] private void load(OsuConfigManager config, OsuConfigManager osuConfig) { Children = new Drawable[] { new SettingsSlider<float> { LabelText = AudioSettingsStrings.PositionalLevel, Keywords = new[] { @"positional", @"balance" }, Current = osuConfig.GetBindable<float>(OsuSetting.PositionalHitsoundsLevel), KeyboardStep = 0.01f, DisplayAsPercentage = true }, new SettingsCheckbox { LabelText = GameplaySettingsStrings.AlwaysPlayFirstComboBreak, Current = config.GetBindable<bool>(OsuSetting.AlwaysPlayFirstComboBreak) } }; } } }
// 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.Framework.Localisation; using osu.Game.Configuration; using osu.Game.Localisation; using osu.Framework.Graphics.Containers; namespace osu.Game.Overlays.Settings.Sections.Gameplay { public class AudioSettings : SettingsSubsection { protected override LocalisableString Header => GameplaySettingsStrings.AudioHeader; private Bindable<float> positionalHitsoundsLevel; private FillFlowContainer<SettingsSlider<float>> positionalHitsoundsSettings; [BackgroundDependencyLoader] private void load(OsuConfigManager config, OsuConfigManager osuConfig) { positionalHitsoundsLevel = osuConfig.GetBindable<float>(OsuSetting.PositionalHitsoundsLevel); Children = new Drawable[] { positionalHitsoundsSettings = new FillFlowContainer<SettingsSlider<float>> { Direction = FillDirection.Vertical, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Masking = true, Children = new[] { new SettingsSlider<float> { LabelText = AudioSettingsStrings.PositionalLevel, Current = positionalHitsoundsLevel, KeyboardStep = 0.01f, DisplayAsPercentage = true } } }, new SettingsCheckbox { LabelText = GameplaySettingsStrings.AlwaysPlayFirstComboBreak, Current = config.GetBindable<bool>(OsuSetting.AlwaysPlayFirstComboBreak) } }; } } }
mit
C#
edac0dc83b6d2dac5ebd7c37dd0cf2ac632933e9
Update ArkUnconfirmedTransactionRequest.cs
sharkdev-j/ark-net,kristjank/ark-net
ark-net/Messages/Transaction/ArkUnconfirmedTransactionRequest.cs
ark-net/Messages/Transaction/ArkUnconfirmedTransactionRequest.cs
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="ArkUnconfirmedTransactionRequest.cs" company="Ark"> // MIT License // // // // Copyright (c) 2017 Kristjan Košič // // // // Permission is hereby granted, free of charge, to any person obtaining a copy // // of this software and associated documentation files (the "Software"), to deal // // in the Software without restriction, including without limitation the rights // // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // // copies of the Software, and to permit persons to whom the Software is // // furnished to do so, subject to the following conditions: // // // // The above copyright notice and this permission notice shall be included in all // // copies or substantial portions of the Software. // // // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // // SOFTWARE. // </copyright> // -------------------------------------------------------------------------------------------------------------------- using ArkNet.Attributes; using ArkNet.Messages.BaseMessages; namespace ArkNet.Messages.Transaction { // References: // - TransactionService.cs /// <summary> /// Extrends the <see cref="ArkBaseRequest"/> type for unconfirmed transaction requests. /// </summary> public class ArkUnconfirmedTransactionRequest : ArkBaseRequest { #region Fields /// <summary> /// Query parameter. The transaction's sender public key as a hexadecimal string. /// </summary> /// /// <value>Gets/sets the value an <see cref="string"/>.</value> /// [ArkQueryParam(Name = "senderPublicKey")] public string SenderPublickey { get; set; } /// <summary> /// Query parameter. The address. /// </summary> /// /// <value>Gets/sets the value an <see cref="string"/>.</value> /// [ArkQueryParam(Name = "address")] public string Address { get; set; } #endregion } }
// -------------------------------------------------------------------------------------------------------------------- // <copyright file="ArkUnconfirmedTransactionRequest.cs" company="Ark Labs"> // MIT License // // // // Copyright (c) 2017 Kristjan Košič // // // // Permission is hereby granted, free of charge, to any person obtaining a copy // // of this software and associated documentation files (the "Software"), to deal // // in the Software without restriction, including without limitation the rights // // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // // copies of the Software, and to permit persons to whom the Software is // // furnished to do so, subject to the following conditions: // // // // The above copyright notice and this permission notice shall be included in all // // copies or substantial portions of the Software. // // // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // // SOFTWARE. // </copyright> // -------------------------------------------------------------------------------------------------------------------- using ArkNet.Attributes; using ArkNet.Messages.BaseMessages; namespace ArkNet.Messages.Transaction { // References: // - TransactionService.cs /// <summary> /// Extrends the <see cref="ArkBaseRequest"/> type for unconfirmed transaction requests. /// </summary> public class ArkUnconfirmedTransactionRequest : ArkBaseRequest { #region Fields /// <summary> /// Query parameter. The transaction's sender public key as a hexadecimal string. /// </summary> /// /// <value>Gets/sets the value an <see cref="string"/>.</value> /// [ArkQueryParam(Name = "senderPublicKey")] public string SenderPublickey { get; set; } /// <summary> /// Query parameter. The address. /// </summary> /// /// <value>Gets/sets the value an <see cref="string"/>.</value> /// [ArkQueryParam(Name = "address")] public string Address { get; set; } #endregion } }
mit
C#
02910e094f201be12b9a2f30d047b9c5d6d3cdb2
Remove unused parameter
BluewireTechnologies/cassette,andrewdavey/cassette,damiensawyer/cassette,andrewdavey/cassette,damiensawyer/cassette,andrewdavey/cassette,damiensawyer/cassette,honestegg/cassette,honestegg/cassette,BluewireTechnologies/cassette,honestegg/cassette
src/Cassette/HtmlTemplates/HtmlTemplateBundleDeserializer.cs
src/Cassette/HtmlTemplates/HtmlTemplateBundleDeserializer.cs
using System.Xml.Linq; namespace Cassette.HtmlTemplates { class HtmlTemplateBundleDeserializer : BundleDeserializer<HtmlTemplateBundle> { public HtmlTemplateBundleDeserializer(IUrlModifier urlModifier) : base(urlModifier) { } protected override HtmlTemplateBundle CreateBundle(XElement element) { return new HtmlTemplateBundle(GetPathAttribute()) { Renderer = CreateHtmlRenderer<HtmlTemplateBundle>() }; } } }
using System.Xml.Linq; using Cassette.IO; namespace Cassette.HtmlTemplates { class HtmlTemplateBundleDeserializer : BundleDeserializer<HtmlTemplateBundle> { public HtmlTemplateBundleDeserializer(IDirectory directory, IUrlModifier urlModifier) : base(urlModifier) { } protected override HtmlTemplateBundle CreateBundle(XElement element) { return new HtmlTemplateBundle(GetPathAttribute()) { Renderer = CreateHtmlRenderer<HtmlTemplateBundle>() }; } } }
mit
C#
5e8c636395117db228559425fccd57c7d85362b0
Test has wrong base class
amyzheng424/elasticsearch-net,UdiBen/elasticsearch-net,adam-mccoy/elasticsearch-net,geofeedia/elasticsearch-net,DavidSSL/elasticsearch-net,abibell/elasticsearch-net,DavidSSL/elasticsearch-net,faisal00813/elasticsearch-net,robertlyson/elasticsearch-net,elastic/elasticsearch-net,CSGOpenSource/elasticsearch-net,CSGOpenSource/elasticsearch-net,jonyadamit/elasticsearch-net,adam-mccoy/elasticsearch-net,amyzheng424/elasticsearch-net,azubanov/elasticsearch-net,LeoYao/elasticsearch-net,UdiBen/elasticsearch-net,SeanKilleen/elasticsearch-net,geofeedia/elasticsearch-net,ststeiger/elasticsearch-net,TheFireCookie/elasticsearch-net,TheFireCookie/elasticsearch-net,robertlyson/elasticsearch-net,amyzheng424/elasticsearch-net,gayancc/elasticsearch-net,robrich/elasticsearch-net,abibell/elasticsearch-net,junlapong/elasticsearch-net,ststeiger/elasticsearch-net,junlapong/elasticsearch-net,elastic/elasticsearch-net,jonyadamit/elasticsearch-net,azubanov/elasticsearch-net,tkirill/elasticsearch-net,abibell/elasticsearch-net,adam-mccoy/elasticsearch-net,CSGOpenSource/elasticsearch-net,RossLieberman/NEST,mac2000/elasticsearch-net,joehmchan/elasticsearch-net,LeoYao/elasticsearch-net,cstlaurent/elasticsearch-net,junlapong/elasticsearch-net,wawrzyn/elasticsearch-net,wawrzyn/elasticsearch-net,joehmchan/elasticsearch-net,KodrAus/elasticsearch-net,TheFireCookie/elasticsearch-net,geofeedia/elasticsearch-net,cstlaurent/elasticsearch-net,mac2000/elasticsearch-net,ststeiger/elasticsearch-net,starckgates/elasticsearch-net,robrich/elasticsearch-net,starckgates/elasticsearch-net,tkirill/elasticsearch-net,starckgates/elasticsearch-net,KodrAus/elasticsearch-net,faisal00813/elasticsearch-net,wawrzyn/elasticsearch-net,robertlyson/elasticsearch-net,RossLieberman/NEST,jonyadamit/elasticsearch-net,cstlaurent/elasticsearch-net,gayancc/elasticsearch-net,UdiBen/elasticsearch-net,tkirill/elasticsearch-net,robrich/elasticsearch-net,KodrAus/elasticsearch-net,LeoYao/elasticsearch-net,azubanov/elasticsearch-net,joehmchan/elasticsearch-net,SeanKilleen/elasticsearch-net,gayancc/elasticsearch-net,RossLieberman/NEST,faisal00813/elasticsearch-net,DavidSSL/elasticsearch-net,mac2000/elasticsearch-net,SeanKilleen/elasticsearch-net
src/Tests/Nest.Tests.Integration/Core/Bulk/BulkUpdateTests.cs
src/Tests/Nest.Tests.Integration/Core/Bulk/BulkUpdateTests.cs
using System.Linq; using FluentAssertions; using NUnit.Framework; using Nest.Tests.MockData.Domain; namespace Nest.Tests.Integration.Core.Bulk { [TestFixture] public class BulkUpdateTests : IntegrationTests { [Test] public void BulkUpdateObject() { //Lets first insert some documents with id range 5000-6000 var descriptor = new BulkDescriptor(); foreach (var i in Enumerable.Range(5000, 1000)) descriptor.Index<ElasticsearchProject>(op => op.Document(new ElasticsearchProject { Id = i })); var result = this.Client.Bulk(d=>descriptor); result.Should().NotBeNull(); result.IsValid.Should().BeTrue(); //Now lets update all of them giving them a name descriptor = new BulkDescriptor().Refresh(); foreach (var i in Enumerable.Range(5000, 1000)) { int id = i; descriptor.Update<ElasticsearchProject, object>(op => op .IdFrom(new ElasticsearchProject { Id = id }) .Doc(new { name = "SufixedName-" + id}) ); } result = this.Client.Bulk(d=>descriptor); result.Should().NotBeNull(); result.IsValid.Should().BeTrue(); result.Errors.Should().BeFalse(); result.Items.Count().Should().Be(1000); result.Items.All(i => i != null).Should().BeTrue(); var updatedObject = this.Client.Source<ElasticsearchProject>(i=>i.Id(5000)); Assert.NotNull(updatedObject); Assert.AreEqual(updatedObject.Name, "SufixedName-5000"); } } }
using System.Linq; using FluentAssertions; using NUnit.Framework; using Nest.Tests.MockData.Domain; namespace Nest.Tests.Integration.Core.Bulk { public class BulkUpdateTests : BulkTests { [Test] public void BulkUpdateObject() { //Lets first insert some documents with id range 5000-6000 var descriptor = new BulkDescriptor(); foreach (var i in Enumerable.Range(5000, 1000)) descriptor.Index<ElasticsearchProject>(op => op.Document(new ElasticsearchProject { Id = i })); var result = this.Client.Bulk(d=>descriptor); result.Should().NotBeNull(); result.IsValid.Should().BeTrue(); //Now lets update all of them giving them a name descriptor = new BulkDescriptor().Refresh(); foreach (var i in Enumerable.Range(5000, 1000)) { int id = i; descriptor.Update<ElasticsearchProject, object>(op => op .IdFrom(new ElasticsearchProject { Id = id }) .Doc(new { name = "SufixedName-" + id}) ); } result = this.Client.Bulk(d=>descriptor); result.Should().NotBeNull(); result.IsValid.Should().BeTrue(); result.Errors.Should().BeFalse(); result.Items.Count().Should().Be(1000); result.Items.All(i => i != null).Should().BeTrue(); var updatedObject = this.Client.Source<ElasticsearchProject>(i=>i.Id(5000)); Assert.NotNull(updatedObject); Assert.AreEqual(updatedObject.Name, "SufixedName-5000"); } } }
apache-2.0
C#
cf3e4d9b2cb9776f960dabf10546a44749c6c95b
Update PowerShellLoggerFactoryExtensions.cs
tiksn/TIKSN-Framework
TIKSN.Core/PowerShell/PowerShellLoggerFactoryExtensions.cs
TIKSN.Core/PowerShell/PowerShellLoggerFactoryExtensions.cs
using System; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; namespace TIKSN.PowerShell { public static class PowerShellLoggerFactoryExtensions { public static ILoggerFactory AddPowerShell(this ILoggerFactory factory, IServiceProvider serviceProvider) { factory.AddProvider(new PowerShellLoggerProvider( serviceProvider.GetRequiredService<ICurrentCommandProvider>(), serviceProvider.GetRequiredService<IOptions<PowerShellLoggerOptions>>())); return factory; } } }
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using System; namespace TIKSN.PowerShell { public static class PowerShellLoggerFactoryExtensions { public static ILoggerFactory AddPowerShell(this ILoggerFactory factory, IServiceProvider serviceProvider) { factory.AddProvider(new PowerShellLoggerProvider(serviceProvider.GetRequiredService<ICurrentCommandProvider>(), serviceProvider.GetRequiredService<IOptions<PowerShellLoggerOptions>>())); return factory; } } }
mit
C#
7252afbc7e8578247ff4f560ec8cc16f3bb19151
Bump version to 0.9.3
quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot
CactbotOverlay/Properties/AssemblyInfo.cs
CactbotOverlay/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("CactbotOverlay")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CactbotOverlay")] [assembly: AssemblyCopyright("Copyright 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("a7324717-0785-49ac-95e9-dc01bd7fbe7c")] // Version: // - Major Version // - Minor Version // - Build Number // - Revision // GitHub has only 3 version components, so Revision should always be 0. [assembly: AssemblyVersion("0.9.3.0")] [assembly: AssemblyFileVersion("0.9.3.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("CactbotOverlay")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CactbotOverlay")] [assembly: AssemblyCopyright("Copyright 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("a7324717-0785-49ac-95e9-dc01bd7fbe7c")] // Version: // - Major Version // - Minor Version // - Build Number // - Revision // GitHub has only 3 version components, so Revision should always be 0. [assembly: AssemblyVersion("0.9.2.0")] [assembly: AssemblyFileVersion("0.9.2.0")]
apache-2.0
C#
cc5310e89f18ae126ad2aa703c3b2d76eb6d6f91
Bump version to 0.8.0
quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot,quisquous/cactbot
CactbotOverlay/Properties/AssemblyInfo.cs
CactbotOverlay/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("CactbotOverlay")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CactbotOverlay")] [assembly: AssemblyCopyright("Copyright 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("a7324717-0785-49ac-95e9-dc01bd7fbe7c")] // Version: // - Major Version // - Minor Version // - Build Number // - Revision // GitHub has only 3 version components, so Revision should always be 0. [assembly: AssemblyVersion("0.8.0.0")] [assembly: AssemblyFileVersion("0.8.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; [assembly: AssemblyTitle("CactbotOverlay")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CactbotOverlay")] [assembly: AssemblyCopyright("Copyright 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("a7324717-0785-49ac-95e9-dc01bd7fbe7c")] // Version: // - Major Version // - Minor Version // - Build Number // - Revision // GitHub has only 3 version components, so Revision should always be 0. [assembly: AssemblyVersion("0.7.5.0")] [assembly: AssemblyFileVersion("0.7.5.0")]
apache-2.0
C#
49c21241944c6f5704154adf4c26efb45c4bed48
Fix when specified date is out of the calendar range. (#1918)
ButchersBoy/MaterialDesignInXamlToolkit,ButchersBoy/MaterialDesignInXamlToolkit,ButchersBoy/MaterialDesignInXamlToolkit
MaterialDesignThemes.Wpf/Converters/CalendarYearMonthConverter.cs
MaterialDesignThemes.Wpf/Converters/CalendarYearMonthConverter.cs
using System; using System.Globalization; using System.Windows.Data; using System.Windows.Markup; namespace MaterialDesignThemes.Wpf.Converters { public sealed class CalendarYearMonthConverter: IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { long ticks = long.MaxValue; foreach (var value in values) { if (value is DateTime dt) ticks = dt.Ticks; else if (value is XmlLanguage language) culture = language.GetSpecificCulture(); } if (ticks == long.MaxValue) return null; try { return new DateTime(ticks).ToString(CalendarFormatInfo.FromCultureInfo(culture).YearMonthPattern, culture); } catch (ArgumentOutOfRangeException) { return new DateTime(ticks).ToString("Y", CultureInfo.InvariantCulture); } } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }
using System; using System.Globalization; using System.Windows.Data; using System.Windows.Markup; namespace MaterialDesignThemes.Wpf.Converters { public sealed class CalendarYearMonthConverter: IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { long ticks = long.MaxValue; foreach (var value in values) { if (value is DateTime dt) ticks = dt.Ticks; else if (value is XmlLanguage language) culture = language.GetSpecificCulture(); } if (ticks == long.MaxValue) return null; return new DateTime(ticks).ToString(CalendarFormatInfo.FromCultureInfo(culture).YearMonthPattern, culture); } public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) { throw new NotImplementedException(); } } }
mit
C#
8cdf3a1b7e681e49b6215d9be26a783c0725ee9d
Update ILRS to include VoidStatement
brianjmiller/TinCan.NET,limey98/TinCan.NET,RusticiSoftware/TinCan.NET
TinCan/ILRS.cs
TinCan/ILRS.cs
/* Copyright 2014 Rustici Software Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ using System; using System.Collections.Generic; using TinCan.Documents; using TinCan.LRSResponses; namespace TinCan { public interface ILRS { AboutLRSResponse About(); StatementLRSResponse SaveStatement(Statement statement); StatementsResultLRSResponse SaveStatements(List<Statement> statements); StatementLRSResponse RetrieveStatement(Guid id); StatementLRSResponse RetrieveVoidedStatement(Guid id); StatementsResultLRSResponse QueryStatements(StatementsQuery query); StatementsResultLRSResponse MoreStatements(StatementsResult result); StatementLRSResponse VoidStatement(Guid id, Agent agent); ProfileKeysLRSResponse RetrieveStateIds(Activity activity, Agent agent, Nullable<Guid> registration = null); StateLRSResponse RetrieveState(String id, Activity activity, Agent agent, Nullable<Guid> registration = null); LRSResponse SaveState(StateDocument state); LRSResponse DeleteState(StateDocument state); LRSResponse ClearState(Activity activity, Agent agent, Nullable<Guid> registration = null); ProfileKeysLRSResponse RetrieveActivityProfileIds(Activity activity); ActivityProfileLRSResponse RetrieveActivityProfile(String id, Activity activity); LRSResponse SaveActivityProfile(ActivityProfileDocument profile); LRSResponse DeleteActivityProfile(ActivityProfileDocument profile); ProfileKeysLRSResponse RetrieveAgentProfileIds(Agent agent); AgentProfileLRSResponse RetrieveAgentProfile(String id, Agent agent); LRSResponse SaveAgentProfile(AgentProfileDocument profile); LRSResponse DeleteAgentProfile(AgentProfileDocument profile); } }
/* Copyright 2014 Rustici Software Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ using System; using System.Collections.Generic; using TinCan.Documents; using TinCan.LRSResponses; namespace TinCan { public interface ILRS { AboutLRSResponse About(); StatementLRSResponse SaveStatement(Statement statement); StatementsResultLRSResponse SaveStatements(List<Statement> statements); StatementLRSResponse RetrieveStatement(Guid id); StatementLRSResponse RetrieveVoidedStatement(Guid id); StatementsResultLRSResponse QueryStatements(StatementsQuery query); StatementsResultLRSResponse MoreStatements(StatementsResult result); ProfileKeysLRSResponse RetrieveStateIds(Activity activity, Agent agent, Nullable<Guid> registration = null); StateLRSResponse RetrieveState(String id, Activity activity, Agent agent, Nullable<Guid> registration = null); LRSResponse SaveState(StateDocument state); LRSResponse DeleteState(StateDocument state); LRSResponse ClearState(Activity activity, Agent agent, Nullable<Guid> registration = null); ProfileKeysLRSResponse RetrieveActivityProfileIds(Activity activity); ActivityProfileLRSResponse RetrieveActivityProfile(String id, Activity activity); LRSResponse SaveActivityProfile(ActivityProfileDocument profile); LRSResponse DeleteActivityProfile(ActivityProfileDocument profile); ProfileKeysLRSResponse RetrieveAgentProfileIds(Agent agent); AgentProfileLRSResponse RetrieveAgentProfile(String id, Agent agent); LRSResponse SaveAgentProfile(AgentProfileDocument profile); LRSResponse DeleteAgentProfile(AgentProfileDocument profile); } }
apache-2.0
C#
662f129a1b804c0d462440d5fb6240cb2d8fc637
Fix layout switcher tool menu path
spriest487/spacetrader-utils
Editor/AspectRatioLayoutSwitcherEditor.cs
Editor/AspectRatioLayoutSwitcherEditor.cs
using UnityEditor; using UnityEngine; namespace SpaceTrader.Util.EditorUtil { public static class AspectRatioLayoutSwitcherEditor { [MenuItem("Tools/SpaceTrader/Refresh All Layout Switchers")] private static void RefreshAllSwitchersInScene() { var switchers = Object.FindObjectsOfType<AspectRatioLayoutSwitcher>(); foreach (var switcher in switchers) { if (switcher.isActiveAndEnabled) { switcher.SendMessage("OnRectTransformDimensionsChange"); Debug.Log($"refreshed layout of {switcher.name}", switcher); } } } } }
using UnityEditor; using UnityEngine; namespace SpaceTrader.Util.EditorUtil { public static class AspectRatioLayoutSwitcherEditor { [MenuItem("SpaceTrader/Refresh All Layout Switchers")] private static void RefreshAllSwitchersInScene() { var switchers = Object.FindObjectsOfType<AspectRatioLayoutSwitcher>(); foreach (var switcher in switchers) { if (switcher.isActiveAndEnabled) { switcher.SendMessage("OnRectTransformDimensionsChange"); Debug.Log($"refreshed layout of {switcher.name}", switcher); } } } } }
mit
C#
1bf5ad810214e532c60a9ed5f33cbe584fa37a05
Update SuperReducedString.cs
shreeharshas/hackerrank,shreeharshas/hackerrank,shreeharshas/Algorithms,shreeharshas/Algorithms,shreeharshas/Algorithms,shreeharshas/Algorithms,shreeharshas/hackerrank,shreeharshas/Algorithms,shreeharshas/hackerrank
hackerrank/SuperReducedString.cs
hackerrank/SuperReducedString.cs
/*Interim version, to be updated*/ /*Based on hackerrank question at https://www.hackerrank.com/challenges/reduced-string */ using System; using System.Collections.Generic; using System.IO; class Solution { static void Main(String[] args) { string s = Console.ReadLine(); Console.WriteLine(new Solution().reduce(s)); } private string reduce(string s){ if(string.IsNullOrEmpty(s)) return("Empty String"); if(s.Length==1) return(s); if(s.Length==2) if(s[0]==s[1]) return("Empty String"); else return(s); for(int i=0;i<s.Length-1;i++){ if(s[i]==s[i+1]){ string s2 = s.Remove(i,1); return reduce(s2); } } return "Empty String"; } }
/*Interim version, to be updated*/ /*Based on hackerrank question at https://www.hackerrank.com/challenges/reduced-string */ using System; using System.Collections.Generic; using System.IO; class Solution { static void Main(String[] args) { string s = Console.ReadLine(); Console.WriteLine(reduce(s)); } private string reduce(string s){ if(string.IsNullOrEmpty(s)) return("Empty String"); if(s.Length==1) return(s); if(s.Length==2) if(s[0]==s[1]) return("Empty String"); else return(s); for(int i=0;i<s.Length-1;i++){ if(s[i]==s[i+1]){ string s2 = s.Remove(i,1); return reduce(s2); } } } }
mit
C#
353559810b7467984ba1d6df16c0dd98ab48e85a
Fix Unix build
shrah/corert,tijoytom/corert,shrah/corert,gregkalapos/corert,tijoytom/corert,gregkalapos/corert,gregkalapos/corert,krytarowski/corert,krytarowski/corert,yizhang82/corert,tijoytom/corert,shrah/corert,botaberg/corert,botaberg/corert,shrah/corert,tijoytom/corert,botaberg/corert,yizhang82/corert,yizhang82/corert,botaberg/corert,gregkalapos/corert,yizhang82/corert,krytarowski/corert,krytarowski/corert
src/System.Private.CoreLib/src/System/Threading/Timer.Unix.cs
src/System.Private.CoreLib/src/System/Threading/Timer.Unix.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 Microsoft.Win32.SafeHandles; using System.Runtime.InteropServices; namespace System.Threading { // // Unix-specific implementation of Timer // internal partial class TimerQueue { private void SetTimer(uint actualDuration) { // UNIXTODO: Timer throw new NotImplementedException(); } private void ReleaseTimer() { } private static int TickCount { get { return Environment.TickCount; } } } internal sealed partial class TimerQueueTimer { private void SignalNoCallbacksRunning() { SafeWaitHandle waitHandle = _notifyWhenNoCallbacksRunning.SafeWaitHandle; waitHandle.DangerousAddRef(); try { WaitSubsystem.SetEvent(waitHandle.DangerousGetHandle()); } finally { waitHandle.DangerousRelease(); } } } }
// 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. namespace System.Threading { // // Unix-specific implementation of Timer // internal partial class TimerQueue { private void SetTimer(uint actualDuration) { // UNIXTODO: Timer throw new NotImplementedException(); } private void ReleaseTimer() { } private static int TickCount { get { return Environment.TickCount; } } } internal sealed partial class TimerQueueTimer { private void SignalNoCallbacksRunning() { WaitSubsystem.SetEvent(_notifyWhenNoCallbacksRunning.SafeWaitHandle); } } }
mit
C#
ed827d514f42d2d774f9b592dfee85c962036b94
Add comments
UselessToucan/osu,ppy/osu,ZLima12/osu,smoogipoo/osu,UselessToucan/osu,johnneijzen/osu,peppy/osu,NeoAdonis/osu,smoogipoo/osu,UselessToucan/osu,ppy/osu,NeoAdonis/osu,2yangk23/osu,EVAST9919/osu,peppy/osu,2yangk23/osu,EVAST9919/osu,peppy/osu,peppy/osu-new,smoogipooo/osu,NeoAdonis/osu,smoogipoo/osu,ZLima12/osu,johnneijzen/osu,ppy/osu
osu.Game/Online/API/Requests/Responses/APIKudosuHistory.cs
osu.Game/Online/API/Requests/Responses/APIKudosuHistory.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using Humanizer; using Newtonsoft.Json; namespace osu.Game.Online.API.Requests.Responses { public class APIKudosuHistory { [JsonProperty("created_at")] public DateTimeOffset CreatedAt; [JsonProperty("amount")] private int amount { //We can receive negative values. However "action" is enough to build needed items set => Amount = Math.Abs(value); } public int Amount; [JsonProperty("post")] public ModdingPost Post; public class ModdingPost { [JsonProperty("url")] public string Url; [JsonProperty("title")] public string Title; } [JsonProperty("giver")] public KudosuGiver Giver; public class KudosuGiver { [JsonProperty("url")] public string Url; [JsonProperty("username")] public string Username; } [JsonProperty("action")] private string action { set { //We will receive something like "foo.bar" or just "foo" string parsed = value.Contains(".") ? value.Split('.')[0].Pascalize() + value.Split('.')[1].Pascalize() : value.Pascalize(); Action = (KudosuAction)Enum.Parse(typeof(KudosuAction), parsed); } } public KudosuAction Action; } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using Humanizer; using Newtonsoft.Json; namespace osu.Game.Online.API.Requests.Responses { public class APIKudosuHistory { [JsonProperty("created_at")] public DateTimeOffset CreatedAt; [JsonProperty("amount")] private int amount { set => Amount = Math.Abs(value); } public int Amount; [JsonProperty("post")] public ModdingPost Post; public class ModdingPost { [JsonProperty("url")] public string Url; [JsonProperty("title")] public string Title; } [JsonProperty("giver")] public KudosuGiver Giver; public class KudosuGiver { [JsonProperty("url")] public string Url; [JsonProperty("username")] public string Username; } [JsonProperty("action")] private string action { set { string parsed = value.Contains(".") ? value.Split('.')[0].Pascalize() + value.Split('.')[1].Pascalize() : value.Pascalize(); Action = (KudosuAction)Enum.Parse(typeof(KudosuAction), parsed); } } public KudosuAction Action; } }
mit
C#
576400d0221b4e13a11687e5db4377156a684e8e
Update #283 - Switch ADO message over to use ITimedMessage
dudzon/Glimpse,SusanaL/Glimpse,SusanaL/Glimpse,rho24/Glimpse,Glimpse/Glimpse,Glimpse/Glimpse,rho24/Glimpse,SusanaL/Glimpse,elkingtonmcb/Glimpse,elkingtonmcb/Glimpse,codevlabs/Glimpse,paynecrl97/Glimpse,flcdrg/Glimpse,rho24/Glimpse,codevlabs/Glimpse,dudzon/Glimpse,sorenhl/Glimpse,Glimpse/Glimpse,paynecrl97/Glimpse,dudzon/Glimpse,elkingtonmcb/Glimpse,sorenhl/Glimpse,flcdrg/Glimpse,gabrielweyer/Glimpse,gabrielweyer/Glimpse,rho24/Glimpse,codevlabs/Glimpse,paynecrl97/Glimpse,gabrielweyer/Glimpse,paynecrl97/Glimpse,sorenhl/Glimpse,flcdrg/Glimpse
source/Glimpse.Ado/Message/AdoMessage.cs
source/Glimpse.Ado/Message/AdoMessage.cs
using System; using System.Diagnostics; using System.Reflection; using Glimpse.Core.Message; namespace Glimpse.Ado.Message { public abstract class AdoMessage : ITimedMessage { protected AdoMessage(Guid connectionId) { Id = Guid.NewGuid(); ConnectionId = connectionId; StartTime = DateTime.Now; } public Guid Id { get; private set; } public Guid ConnectionId { get; set; } public TimeSpan Offset { get; set; } public TimeSpan Duration { get; set; } public DateTime StartTime { get; set; } } }
using System; using System.Diagnostics; using System.Reflection; using Glimpse.Core.Message; namespace Glimpse.Ado.Message { public abstract class AdoMessage : IMessage { protected AdoMessage(Guid connectionId) { Id = Guid.NewGuid(); ConnectionId = connectionId; StartTime = DateTime.Now; } public Guid Id { get; private set; } public Guid ConnectionId { get; set; } public DateTime StartTime { get; set; } } }
apache-2.0
C#
7f0ee6f608c36e66a9894c1013e3a7db68021e39
Make the test pass for PostgreSQL, using a bit of a hack
lnu/nhibernate-core,alobakov/nhibernate-core,fredericDelaporte/nhibernate-core,fredericDelaporte/nhibernate-core,RogerKratz/nhibernate-core,livioc/nhibernate-core,nkreipke/nhibernate-core,gliljas/nhibernate-core,RogerKratz/nhibernate-core,gliljas/nhibernate-core,lnu/nhibernate-core,hazzik/nhibernate-core,RogerKratz/nhibernate-core,gliljas/nhibernate-core,ManufacturingIntelligence/nhibernate-core,ngbrown/nhibernate-core,nkreipke/nhibernate-core,nhibernate/nhibernate-core,ngbrown/nhibernate-core,ManufacturingIntelligence/nhibernate-core,hazzik/nhibernate-core,alobakov/nhibernate-core,nhibernate/nhibernate-core,RogerKratz/nhibernate-core,fredericDelaporte/nhibernate-core,gliljas/nhibernate-core,nhibernate/nhibernate-core,nhibernate/nhibernate-core,lnu/nhibernate-core,livioc/nhibernate-core,fredericDelaporte/nhibernate-core,ManufacturingIntelligence/nhibernate-core,alobakov/nhibernate-core,ngbrown/nhibernate-core,livioc/nhibernate-core,nkreipke/nhibernate-core,hazzik/nhibernate-core,hazzik/nhibernate-core
src/NHibernate.Test/ExpressionTest/InsensitiveLikeExpressionFixture.cs
src/NHibernate.Test/ExpressionTest/InsensitiveLikeExpressionFixture.cs
using System; using System.Data; using System.Text; using NHibernate.Engine; using NExpression = NHibernate.Expression; using NHibernate.SqlCommand; using NHibernate.Type; using NHibernate.DomainModel; using NUnit.Framework; namespace NHibernate.Test.ExpressionTest { /// <summary> /// Summary description for InsensitiveLikeExpressionFixture. /// </summary> [TestFixture] public class InsensitiveLikeExpressionFixture : BaseExpressionFixture { [Test] public void InsentitiveLikeSqlStringTest() { ISession session = factory.OpenSession(); NExpression.Expression expression = NExpression.Expression.InsensitiveLike("Address", "12 Adress"); SqlString sqlString = expression.ToSqlString(factoryImpl, typeof(Simple), "simple_alias"); string expectedSql = "lower(simple_alias.address) like :simple_alias.address"; if ((factory as ISessionFactoryImplementor).Dialect is Dialect.PostgreSQLDialect) { expectedSql = "simple_alias.address ilike :simple_alias.address"; } Parameter[] expectedParams = new Parameter[1]; Parameter firstParam = new Parameter( "address", "simple_alias", new SqlTypes.StringSqlType() ); expectedParams[0] = firstParam; CompareSqlStrings(sqlString, expectedSql, expectedParams); session.Close(); } } }
using System; using System.Data; using System.Text; using NHibernate.Engine; using NExpression = NHibernate.Expression; using NHibernate.SqlCommand; using NHibernate.Type; using NHibernate.DomainModel; using NUnit.Framework; namespace NHibernate.Test.ExpressionTest { /// <summary> /// Summary description for InsensitiveLikeExpressionFixture. /// </summary> [TestFixture] public class InsensitiveLikeExpressionFixture : BaseExpressionFixture { [Test] public void InsentitiveLikeSqlStringTest() { ISession session = factory.OpenSession(); NExpression.Expression expression = NExpression.Expression.InsensitiveLike("Address", "12 Adress"); SqlString sqlString = expression.ToSqlString(factoryImpl, typeof(Simple), "simple_alias"); string expectedSql = "lower(simple_alias.address) like :simple_alias.address"; Parameter[] expectedParams = new Parameter[1]; Parameter firstParam = new Parameter( "address", "simple_alias", new SqlTypes.StringSqlType() ); expectedParams[0] = firstParam; CompareSqlStrings(sqlString, expectedSql, expectedParams); session.Close(); } } }
lgpl-2.1
C#
6bdcdec1b500093e8add11cfeee5f6de9900710a
Throw MultipleBeforeAttribute exception when multiple before attributes are decorated on same method/type.
lijunle/Nancy.AttributeRouting,lijunle/Nancy.AttributeRouting
Nancy.AttributeRouting/BeforeAttribute.cs
Nancy.AttributeRouting/BeforeAttribute.cs
namespace Nancy.AttributeRouting { using System; using System.Linq; using System.Reflection; using Nancy.AttributeRouting.Exceptions; using Nancy.TinyIoc; /// <summary> /// Before attribute provides a hook to execute before enter the view model execution. /// </summary> [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] public abstract class BeforeAttribute : Attribute { /// <summary> /// Process the custom code and determine whether continue on view model execution. /// </summary> /// <param name="container"> /// The Tiny IoC container. It provides <see cref="IUrlBuilder"/> and others to construct /// the response. /// </param> /// <param name="context"> /// The Nancy context. It provides user information and others to determine whether continue /// view model execution. /// </param> /// <returns> /// The response. If this is <c>null</c>, it will continue on view model execution, /// otherwise it returns the this value directly. /// </returns> public abstract Response Process(TinyIoCContainer container, NancyContext context); internal static Response GetResponse(MethodBase method, TinyIoCContainer container, NancyContext context) { var attr = GetAttribute(method); if (attr == null) { return null; } Response response = attr.Process(container, context); return response; } private static BeforeAttribute GetAttribute(MethodBase method) { var methodAttributes = method.GetCustomAttributes<BeforeAttribute>(inherit: false); if (methodAttributes.Count() > 1) { throw new MultipleBeforeAttributeException(method); } var attribute = methodAttributes.SingleOrDefault() ?? GetAttribute(method.DeclaringType); return attribute; } private static BeforeAttribute GetAttribute(Type type) { if (type == null || type == typeof(object)) { return null; } var typeAttributes = type.GetCustomAttributes<BeforeAttribute>(inherit: false); if (typeAttributes.Count() > 1) { throw new MultipleBeforeAttributeException(type); } var attribute = typeAttributes.SingleOrDefault() ?? GetAttribute(RouteInheritAttribute.GetAncestorType(type)); return attribute; } } }
namespace Nancy.AttributeRouting { using System; using System.Linq; using System.Reflection; using Nancy.TinyIoc; /// <summary> /// Before attribute provides a hook to execute before enter the view model execution. /// </summary> [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] public abstract class BeforeAttribute : Attribute { /// <summary> /// Process the custom code and determine whether continue on view model execution. /// </summary> /// <param name="container"> /// The Tiny IoC container. It provides <see cref="IUrlBuilder"/> and others to construct /// the response. /// </param> /// <param name="context"> /// The Nancy context. It provides user information and others to determine whether continue /// view model execution. /// </param> /// <returns> /// The response. If this is <c>null</c>, it will continue on view model execution, /// otherwise it returns the this value directly. /// </returns> public abstract Response Process(TinyIoCContainer container, NancyContext context); internal static Response GetResponse(MethodBase method, TinyIoCContainer container, NancyContext context) { var attr = GetAttribute(method); if (attr == null) { return null; } Response response = attr.Process(container, context); return response; } private static BeforeAttribute GetAttribute(MethodBase method) { var methodAttribute = method.GetCustomAttribute<BeforeAttribute>(inherit: false); var attribute = methodAttribute ?? GetAttribute(method.DeclaringType); return attribute; } private static BeforeAttribute GetAttribute(Type type) { if (type == null || type == typeof(object)) { return null; } var attrs = type.GetCustomAttributes<BeforeAttribute>(inherit: false); if (attrs.Any()) { // TODO handle multiple BeforeAttribute return attrs.First(); } var ancestorType = RouteInheritAttribute.GetAncestorType(type); return GetAttribute(ancestorType); } } }
mit
C#
31a15075ed6947e6f7998279d6daf59438304728
Rename missed parameter
AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia
src/Avalonia.Controls/Platform/Screen.cs
src/Avalonia.Controls/Platform/Screen.cs
namespace Avalonia.Platform { /// <summary> /// Represents a single display screen. /// </summary> public class Screen { /// <summary> /// Gets the pixel density of the screen. /// This is a scaling factor so multiply by 100 to get a percentage. /// </summary> /// <remarks> /// Both X and Y density are assumed uniform. /// </remarks> public double PixelDensity { get; } /// <summary> /// Gets the overall pixel-size of the screen. /// This generally is the raw pixel counts in both the X and Y direction. /// </summary> public PixelRect Bounds { get; } /// <summary> /// Gets the actual working-area pixel-size of the screen. /// This may be smaller to account for notches and other block-out areas. /// </summary> public PixelRect WorkingArea { get; } /// <summary> /// Gets a value indicating whether the screen is the primary one. /// </summary> public bool IsPrimary { get; } public Screen(double pixelDensity, PixelRect bounds, PixelRect workingArea, bool isPrimary) { this.PixelDensity = pixelDensity; this.Bounds = bounds; this.WorkingArea = workingArea; this.IsPrimary = isPrimary; } } }
namespace Avalonia.Platform { /// <summary> /// Represents a single display screen. /// </summary> public class Screen { /// <summary> /// Gets the pixel density of the screen. /// This is a scaling factor so multiply by 100 to get a percentage. /// </summary> /// <remarks> /// Both X and Y density are assumed uniform. /// </remarks> public double PixelDensity { get; } /// <summary> /// Gets the overall pixel-size of the screen. /// This generally is the raw pixel counts in both the X and Y direction. /// </summary> public PixelRect Bounds { get; } /// <summary> /// Gets the actual working-area pixel-size of the screen. /// This may be smaller to account for notches and other block-out areas. /// </summary> public PixelRect WorkingArea { get; } /// <summary> /// Gets a value indicating whether the screen is the primary one. /// </summary> public bool IsPrimary { get; } public Screen(double pixelDensity, PixelRect bounds, PixelRect workingArea, bool primary) { this.PixelDensity = pixelDensity; this.Bounds = bounds; this.WorkingArea = workingArea; this.IsPrimary = primary; } } }
mit
C#
15e19a2406fbddc80801d595407eaec6c7363670
Refactor BoundedMemory to use a Dictionary instead a byte array
rmterra/NesZord
src/NesZord.Core/Memory/BoundedMemory.cs
src/NesZord.Core/Memory/BoundedMemory.cs
using System; using System.Collections.Generic; namespace NesZord.Core.Memory { internal class BoundedMemory : IBoundedMemory { private const int LENGTH = 0x0800; private Dictionary<int, byte> data; public BoundedMemory(MemoryAddress firstAddress, MemoryAddress lastAddress) { this.FirstAddress = firstAddress ?? throw new ArgumentNullException(nameof(firstAddress)); this.LastAddress = lastAddress ?? throw new ArgumentNullException(nameof(lastAddress)); this.data = new Dictionary<int, byte>(); } public MemoryAddress FirstAddress { get; } public MemoryAddress LastAddress { get; } public void Write(MemoryAddress address, byte value) { if (address == null) { throw new ArgumentNullException(nameof(address)); } this.ThrowIfOutOfRange(address); this.data[address.FullAddress] = value; } public byte Read(MemoryAddress address) { if (address == null) { throw new ArgumentNullException(nameof(address)); } this.ThrowIfOutOfRange(address); return this.data.ContainsKey(address.FullAddress) ? this.data[address.FullAddress] : default(byte); } private void ThrowIfOutOfRange(MemoryAddress address) { if (address < this.FirstAddress) { throw new ArgumentOutOfRangeException(nameof(address)); } if (address > this.LastAddress) { throw new ArgumentOutOfRangeException(nameof(address)); } } } }
using System; namespace NesZord.Core.Memory { internal class BoundedMemory : IBoundedMemory { private const int LENGTH = 0x0800; private byte[] data; public BoundedMemory(MemoryAddress firstAddress, MemoryAddress lastAddress) { this.FirstAddress = firstAddress ?? throw new ArgumentNullException(nameof(firstAddress)); this.LastAddress = lastAddress ?? throw new ArgumentNullException(nameof(lastAddress)); this.data = new byte[LENGTH]; } public MemoryAddress FirstAddress { get; } public MemoryAddress LastAddress { get; } public void Write(MemoryAddress address, byte value) { if (address == null) { throw new ArgumentNullException(nameof(address)); } this.ThrowIfOutOfRange(address); this.data[address.FullAddress] = value; } public byte Read(MemoryAddress address) { if (address == null) { throw new ArgumentNullException(nameof(address)); } this.ThrowIfOutOfRange(address); return this.data[address.FullAddress]; } private void ThrowIfOutOfRange(MemoryAddress address) { if (address < this.FirstAddress) { throw new ArgumentOutOfRangeException(nameof(address)); } if (address > this.LastAddress) { throw new ArgumentOutOfRangeException(nameof(address)); } } } }
apache-2.0
C#
77bfcf9607c5de0bae5de51b5af741f1c9b6e2b3
add version comment
yasokada/unity-150908-udpTimeGraph
Assets/AppInfo.cs
Assets/AppInfo.cs
using UnityEngine; using System.Collections; /* * v0.4 2015/09/10 * - can handle set,yrange command */ namespace NS_appInfo // NS stands for NameSpace { public static class AppInfo { public const string Version = "v0.4"; public const string Name = "udpTimeGraph"; } }
using UnityEngine; using System.Collections; namespace NS_appInfo // NS stands for NameSpace { public static class AppInfo { public const string Version = "v0.4"; public const string Name = "udpTimeGraph"; } }
mit
C#
69d997124bd3aa66b26aedb4c29b318b7cfb7d12
update sample to use MetricsHttpListener
Recognos/Metrics.NET,DeonHeyns/Metrics.NET,Recognos/Metrics.NET,ntent-ad/Metrics.NET,Liwoj/Metrics.NET,MetaG8/Metrics.NET,DeonHeyns/Metrics.NET,Liwoj/Metrics.NET,cvent/Metrics.NET,mnadel/Metrics.NET,alhardy/Metrics.NET,mnadel/Metrics.NET,ntent-ad/Metrics.NET,alhardy/Metrics.NET,huoxudong125/Metrics.NET,etishor/Metrics.NET,MetaG8/Metrics.NET,etishor/Metrics.NET,cvent/Metrics.NET,MetaG8/Metrics.NET,huoxudong125/Metrics.NET
Samples/Metrics.SamplesConsole/Program.cs
Samples/Metrics.SamplesConsole/Program.cs
using System; using Metrics.Samples; using Metrics.Visualization; namespace Metrics.SamplesConsole { class Program { static void Main(string[] args) { Metric.MachineCounters.RegisterAll(); SampleMetrics.RunSomeRequests(); //Metric.Reports.PrintConsoleReport(TimeSpan.FromSeconds(1)); //var json = new RegistrySerializer().ValuesAsJson(Metric.Registry); //var x = JsonConvert.DeserializeObject<dynamic>(json); //Console.WriteLine(json); //Metric.Reports.StoreCSVReports(@"c:\temp\reports\", TimeSpan.FromSeconds(1)); //Metric.Reports.AppendToFile(@"C:\temp\reports\metrics.txt", TimeSpan.FromSeconds(1)); using (MetricsHttpListener http = new MetricsHttpListener("http://localhost:1234/")) { http.Start(); Console.WriteLine("done"); Console.ReadKey(); http.Stop(); } //Console.WriteLine("done"); //Console.ReadKey(); } } }
using System; using Metrics.Samples; namespace Metrics.SamplesConsole { class Program { static void Main(string[] args) { Metric.MachineCounters.RegisterAll(); SampleMetrics.RunSomeRequests(); Metric.Reports.PrintConsoleReport(TimeSpan.FromSeconds(1)); //Metric.Reports.StoreCSVReports(@"c:\temp\reports\", TimeSpan.FromSeconds(1)); //Metric.Reports.AppendToFile(@"C:\temp\reports\metrics.txt", TimeSpan.FromSeconds(1)); Console.WriteLine("done"); Console.ReadKey(); } } }
apache-2.0
C#
e01b5b224cafef1c8746871d9b1768d029c81f29
Add IncrementRecursionCounterThrow() which throws InfiniteRecursionException
jorik041/dnlib,Arthur2e5/dnlib,yck1509/dnlib,ZixiangBoy/dnlib,picrap/dnlib,ilkerhalil/dnlib,0xd4d/dnlib,modulexcite/dnlib,kiootic/dnlib
src/DotNet/RecursionCounter.cs
src/DotNet/RecursionCounter.cs
using System; namespace dot10.DotNet { [Serializable] class InfiniteRecursionException : Exception { /// <summary> /// Default constructor /// </summary> public InfiniteRecursionException() { } /// <summary> /// Constructor /// </summary> /// <param name="msg">Error message</param> public InfiniteRecursionException(string msg) : base(msg) { } /// <summary> /// Constructor /// </summary> /// <param name="msg">Error message</param> /// <param name="innerException">Other exception</param> public InfiniteRecursionException(string msg, Exception innerException) : base(msg, innerException) { } } struct RecursionCounter { /// <summary> /// Max recursion count. If this is reached, we won't continue, and will use a default value. /// </summary> public const int MAX_RECURSION_COUNT = 100; int counter; /// <summary> /// Gets the recursion counter /// </summary> public int Counter { get { return counter; } } /// <summary> /// Increments <see cref="counter"/> if it's not too high. <c>ALL</c> instance methods /// that can be called recursively must call this method and <see cref="DecrementRecursionCounter"/> /// (if this method returns <c>true</c>) /// </summary> /// <returns><c>true</c> if it was incremented and caller can continue, <c>false</c> if /// it was <c>not</c> incremented and the caller must return to its caller.</returns> public bool IncrementRecursionCounter() { if (counter >= MAX_RECURSION_COUNT) return false; counter++; return true; } /// <summary> /// Increments <see cref="counter"/> if it's not too high. <c>ALL</c> instance methods /// that can be called recursively must call this method and <see cref="DecrementRecursionCounter"/> /// (if this method returns <c>true</c>) /// </summary> /// <exception cref="InfiniteRecursionException"><see cref="IncrementRecursionCounterThrow"/> /// has been called too many times</exception> public void IncrementRecursionCounterThrow() { if (counter >= MAX_RECURSION_COUNT) throw new InfiniteRecursionException("Infinite recursion"); counter++; } /// <summary> /// Must be called before returning to caller if <see cref="IncrementRecursionCounter"/> /// returned <c>true</c> or if <see cref="IncrementRecursionCounterThrow"/> didn't throw an /// exception. /// </summary> public void DecrementRecursionCounter() { #if DEBUG if (counter <= 0) throw new InvalidOperationException("recursionCounter <= 0"); #endif counter--; } /// <inheritdoc/> public override string ToString() { return counter.ToString(); } } }
using System; namespace dot10.DotNet { struct RecursionCounter { /// <summary> /// Max recursion count. If this is reached, we won't continue, and will use a default value. /// </summary> public const int MAX_RECURSION_COUNT = 100; int counter; /// <summary> /// Gets the recursion counter /// </summary> public int Counter { get { return counter; } } /// <summary> /// Increments <see cref="counter"/> if it's not too high. <c>ALL</c> instance methods /// that can be called recursively must call this method and <see cref="DecrementRecursionCounter"/> /// (if this method returns <c>true</c>) /// </summary> /// <returns><c>true</c> if it was incremented and caller can continue, <c>false</c> if /// it was <c>not</c> incremented and the caller must return to its caller.</returns> public bool IncrementRecursionCounter() { if (counter >= MAX_RECURSION_COUNT) return false; counter++; return true; } /// <summary> /// Must be called before returning to caller if <see cref="IncrementRecursionCounter"/> /// returned <c>true</c> /// </summary> public void DecrementRecursionCounter() { #if DEBUG if (counter <= 0) throw new InvalidOperationException("recursionCounter <= 0"); #endif counter--; } /// <inheritdoc/> public override string ToString() { return counter.ToString(); } } }
mit
C#
5a7dbb2980fa66566bf3e9acdd06aa0ea8a9cee5
Reduce diff size: undo autoformat.
jamesmanning/RunProcessAsTask
src/DummyConsoleApp/Program.cs
src/DummyConsoleApp/Program.cs
using System; using System.Collections.Generic; using System.Linq; using System.Threading; namespace DummyConsoleApp { public class Program { static void Main(string[] args) { int exitCodeToReturn = int.Parse(args[0]); int millisecondsToSleep = int.Parse(args[1]); int linesOfStandardOutput = int.Parse(args[2]); int linesOfStandardError = int.Parse(args[3]); Thread.Sleep(millisecondsToSleep); for (int i = 0; i < linesOfStandardOutput; i++) { Console.WriteLine("Standard output line #{0}", i + 1); } for (int i = 0; i < linesOfStandardError; i++) { Console.Error.WriteLine("Standard error line #{0}", i + 1); } Environment.Exit(exitCodeToReturn); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading; namespace DummyConsoleApp { public class Program { static void Main(string[] args) { var exitCodeToReturn = int.Parse(args[0]); var millisecondsToSleep = int.Parse(args[1]); var linesOfStandardOutput = int.Parse(args[2]); var linesOfStandardError = int.Parse(args[3]); Thread.Sleep(millisecondsToSleep); for (var i = 0; i < linesOfStandardOutput; i++) Console.WriteLine("Standard output line #{0}", i + 1); for (var i = 0; i < linesOfStandardError; i++) Console.Error.WriteLine("Standard error line #{0}", i + 1); Environment.Exit(exitCodeToReturn); } } }
mit
C#
655768a47d04d50434b7bfaaa7dd7adf10d1c63f
Add TODO comment to IFindItemAttribute
YevgeniyShunevych/Atata,atata-framework/atata,YevgeniyShunevych/Atata,atata-framework/atata
src/Atata/Attributes/Behaviors/IFindItemAttribute.cs
src/Atata/Attributes/Behaviors/IFindItemAttribute.cs
namespace Atata { // TODO: Remove IFindItemAttribute. public interface IFindItemAttribute { IItemElementFindStrategy CreateStrategy(UIComponent component, UIComponentMetadata metadata); } }
namespace Atata { public interface IFindItemAttribute { IItemElementFindStrategy CreateStrategy(UIComponent component, UIComponentMetadata metadata); } }
apache-2.0
C#
57a004aeb3d76fff31a394c54b52c675f599e614
add UserMongoDB extension method
dotnetcore/CAP,ouraspnet/cap,dotnetcore/CAP,dotnetcore/CAP
src/DotNetCore.CAP.MongoDB/CAP.Options.Extensions.cs
src/DotNetCore.CAP.MongoDB/CAP.Options.Extensions.cs
// Copyright (c) .NET Core Community. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. using System; using DotNetCore.CAP; using DotNetCore.CAP.MongoDB; // ReSharper disable once CheckNamespace namespace Microsoft.Extensions.DependencyInjection { public static class CapOptionsExtensions { public static CapOptions UseMongoDB(this CapOptions options) { return options.UseMongoDB(x => { }); } public static CapOptions UseMongoDB(this CapOptions options, string connectionString) { return options.UseMongoDB(x => { x.DatabaseConnection = connectionString; }); } public static CapOptions UseMongoDB(this CapOptions options, Action<MongoDBOptions> configure) { if (configure == null) { throw new ArgumentNullException(nameof(configure)); } options.RegisterExtension(new MongoDBCapOptionsExtension(configure)); return options; } } }
// Copyright (c) .NET Core Community. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. using System; using DotNetCore.CAP; using DotNetCore.CAP.MongoDB; // ReSharper disable once CheckNamespace namespace Microsoft.Extensions.DependencyInjection { public static class CapOptionsExtensions { public static CapOptions UseMongoDB(this CapOptions options) { return options.UseMongoDB(x => { }); } public static CapOptions UseMongoDB(this CapOptions options, Action<MongoDBOptions> configure) { if (configure == null) { throw new ArgumentNullException(nameof(configure)); } options.RegisterExtension(new MongoDBCapOptionsExtension(configure)); return options; } } }
mit
C#
06818a4911844071bb1e4e979a42ac8d4a98075a
Update AssemblyInfo.cs
LANDIS-II-Foundation/Landis-Spatial-Modeling-Library
src/Landscapes/AssemblyInfo.cs
src/Landscapes/AssemblyInfo.cs
using System.Reflection; [assembly: AssemblyDescription("Landscape data for spatial modeling")]
using System.Reflection; [assembly: AssemblyDescription("Landscape data for spatial modeling")] [assembly: AssemblyCopyright("Copyright 2010-2012 Green Code LLC")]
apache-2.0
C#
8eb94d3a494ce8ae74a660fc02a93fc076a9a130
Switch over to using Regex extension
peterblazejewicz/Glimpse.Prototype,pranavkm/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,zanetdev/Glimpse.Prototype,Glimpse/Glimpse.Prototype,zanetdev/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,pranavkm/Glimpse.Prototype,pranavkm/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype,Glimpse/Glimpse.Prototype,Glimpse/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,mike-kaufman/Glimpse.Prototype,pranavkm/Glimpse.Prototype,zanetdev/Glimpse.Prototype,peterblazejewicz/Glimpse.Prototype
src/Glimpse.Agent.Web/GlimpseAgentWebOptionsSetup.cs
src/Glimpse.Agent.Web/GlimpseAgentWebOptionsSetup.cs
using System; using Glimpse.Agent.Web.Options; using Microsoft.Framework.OptionsModel; namespace Glimpse.Agent.Web { public class GlimpseAgentWebOptionsSetup : ConfigureOptions<GlimpseAgentWebOptions> { public GlimpseAgentWebOptionsSetup() : base(ConfigureGlimpseAgentWebOptions) { Order = -1000; } public static void ConfigureGlimpseAgentWebOptions(GlimpseAgentWebOptions options) { // Set up IgnoredUris options.IgnoredUris.AddUri("^/__browserLink/requestData"); options.IgnoredUris.AddUri("^/Glimpse"); options.IgnoredUris.AddUri("^/favicon.ico"); } } }
using System; using Glimpse.Agent.Web.Options; using Microsoft.Framework.OptionsModel; namespace Glimpse.Agent.Web { public class GlimpseAgentWebOptionsSetup : ConfigureOptions<GlimpseAgentWebOptions> { public GlimpseAgentWebOptionsSetup() : base(ConfigureGlimpseAgentWebOptions) { Order = -1000; } public static void ConfigureGlimpseAgentWebOptions(GlimpseAgentWebOptions options) { // Set up IgnoredUris options.IgnoredUris.Add("^/__browserLink/requestData"); options.IgnoredUris.Add("^/Glimpse"); options.IgnoredUris.Add("^/favicon.ico"); } } }
mit
C#
61354cf8f49c9260195f7c47bb7a251db0bdd815
Remove Test attribute from a method that is not a test
hazzik/nhibernate-core,hazzik/nhibernate-core,lnu/nhibernate-core,alobakov/nhibernate-core,nhibernate/nhibernate-core,alobakov/nhibernate-core,gliljas/nhibernate-core,gliljas/nhibernate-core,fredericDelaporte/nhibernate-core,nhibernate/nhibernate-core,hazzik/nhibernate-core,nkreipke/nhibernate-core,livioc/nhibernate-core,nhibernate/nhibernate-core,fredericDelaporte/nhibernate-core,gliljas/nhibernate-core,hazzik/nhibernate-core,fredericDelaporte/nhibernate-core,ManufacturingIntelligence/nhibernate-core,ngbrown/nhibernate-core,fredericDelaporte/nhibernate-core,alobakov/nhibernate-core,lnu/nhibernate-core,ngbrown/nhibernate-core,nkreipke/nhibernate-core,RogerKratz/nhibernate-core,nkreipke/nhibernate-core,ManufacturingIntelligence/nhibernate-core,RogerKratz/nhibernate-core,RogerKratz/nhibernate-core,gliljas/nhibernate-core,livioc/nhibernate-core,ManufacturingIntelligence/nhibernate-core,RogerKratz/nhibernate-core,livioc/nhibernate-core,nhibernate/nhibernate-core,ngbrown/nhibernate-core,lnu/nhibernate-core
src/NHibernate.Test/NHSpecificTest/NH1864/Fixture.cs
src/NHibernate.Test/NHSpecificTest/NH1864/Fixture.cs
using System; using NUnit.Framework; namespace NHibernate.Test.NHSpecificTest.NH1864 { [TestFixture] public class Fixture : BugTestCase { [Test] public void Bug() { Assert.DoesNotThrow(() => ExecuteQuery(s=> s.EnableFilter("validity").SetParameter("date", DateTime.Now))); } [Test] public void FilterOnOffOn() { Assert.DoesNotThrow(() => ExecuteQuery(s => s.EnableFilter("validity").SetParameter("date", DateTime.Now))); Assert.DoesNotThrow(() => ExecuteQuery(s => { })); Assert.DoesNotThrow(() => ExecuteQuery(s => s.EnableFilter("validity").SetParameter("date", DateTime.Now))); } [Test] public void FilterQueryTwice() { Assert.DoesNotThrow(() => ExecuteQuery(s => s.EnableFilter("validity").SetParameter("date", DateTime.Now))); Assert.DoesNotThrow(() => ExecuteQuery(s => s.EnableFilter("validity").SetParameter("date", DateTime.Now))); } private void ExecuteQuery(Action<ISession> sessionModifier) { using (ISession session = OpenSession()) { using (ITransaction tx = session.BeginTransaction()) { sessionModifier(session); session .CreateQuery(@"select cat from Invoice inv, Category cat where cat.ValidUntil = :now and inv.Foo = :foo") .SetInt32("foo", 42) .SetDateTime("now", DateTime.Now) .List(); tx.Commit(); } } } } }
using System; using NUnit.Framework; namespace NHibernate.Test.NHSpecificTest.NH1864 { [TestFixture] public class Fixture : BugTestCase { [Test] public void ExecuteQuery(Action<ISession> sessionModifier) { using (ISession session = OpenSession()) { using (ITransaction tx = session.BeginTransaction()) { sessionModifier(session); session.CreateQuery( @"select cat from Invoice inv, Category cat where cat.ValidUntil = :now and inv.Foo = :foo ") .SetInt32("foo", 42).SetDateTime("now", DateTime.Now).List(); tx.Commit(); } } } [Test] public void Bug() { Assert.DoesNotThrow(() => ExecuteQuery(s=> s.EnableFilter("validity").SetParameter("date", DateTime.Now))); } [Test] public void FilterOnOffOn() { Assert.DoesNotThrow(() => ExecuteQuery(s => s.EnableFilter("validity").SetParameter("date", DateTime.Now))); Assert.DoesNotThrow(() => ExecuteQuery(s => { })); Assert.DoesNotThrow(() => ExecuteQuery(s => s.EnableFilter("validity").SetParameter("date", DateTime.Now))); } [Test] public void FilterQueryTwice() { Assert.DoesNotThrow(() => ExecuteQuery(s => s.EnableFilter("validity").SetParameter("date", DateTime.Now))); Assert.DoesNotThrow(() => ExecuteQuery(s => s.EnableFilter("validity").SetParameter("date", DateTime.Now))); } } }
lgpl-2.1
C#
c2e6d15747764c11ba37edc56ddfb84107b2de7b
Fix serialisation of UserAccount model.
DimensionDataResearch/cloudcontrol-client-core
src/DD.CloudControl.Client/Models/Directory/UserAccount.cs
src/DD.CloudControl.Client/Models/Directory/UserAccount.cs
using System; using System.Collections.Generic; using System.Xml.Serialization; namespace DD.CloudControl.Client.Models.Directory { /// <summary> /// Represents information about a Cloud Control user account. /// </summary> [XmlRoot("Account", Namespace = XmlNamespaces.Directory)] public class UserAccount { /// <summary> /// Create a new <see cref="UserAccount"/>. /// </summary> public UserAccount() { } /// <summary> /// The user login name associated with the account. /// </summary> [XmlElement("userName")] public string UserName { get; set; } /// <summary> /// The full name of the user associated with the account. /// </summary> [XmlElement("fullName")] public string FullName { get; set; } /// <summary> /// The first name of the user associated with the account. /// </summary> [XmlElement("firstName")] public string FirstName { get; set; } /// <summary> /// The last name of the user associated with the account. /// </summary> [XmlElement("lastName")] public string LastName { get; set; } /// <summary> /// The e-mail address of the user associated with the account. /// </summary> [XmlElement("emailAddress")] public string EmailAddress { get; set; } /// <summary> /// The name of the department to which the account's user belongs. /// </summary> [XmlElement("department")] public string Department { get; set; } /// <summary> /// Custom field 1. /// </summary> [XmlElement("customDefined1")] public string CustomField1 { get; set; } /// <summary> /// Custom field 2. /// </summary> [XmlElement("customDefined2")] public string CustomField2 { get; set; } /// <summary> /// The Id of the organisation to which the account belongs. /// </summary> [XmlElement("orgId")] public Guid OrganizationId { get; set; } /// <summary> /// The user's password. /// </summary> [XmlElement("password")] public string Password { get; set; } /// <summary> /// Roles (if any) to which the account belongs. /// </summary> [XmlArray("roles")] [XmlArrayItem("role")] public List<Role> MemberOfRoles { get; set; } = new List<Role>(); } }
using System; using System.Collections.Generic; using System.Xml.Serialization; namespace DD.CloudControl.Client.Models.Directory { /// <summary> /// Represents information about a Cloud Control user account. /// </summary> [XmlRoot("Account", Namespace = XmlNamespaces.Directory)] public class UserAccount { /// <summary> /// Create a new <see cref="UserAccount"/>. /// </summary> public UserAccount() { } /// <summary> /// The user login name associated with the account. /// </summary> [XmlElement("userName")] public string UserName { get; set; } /// <summary> /// The full name of the user associated with the account. /// </summary> [XmlElement("fullName")] public string FullName { get; set; } /// <summary> /// The first name of the user associated with the account. /// </summary> [XmlElement("firstName")] public string FirstName { get; set; } /// <summary> /// The last name of the user associated with the account. /// </summary> [XmlElement("lastName")] public string LastName { get; set; } /// <summary> /// The e-mail address of the user associated with the account. /// </summary> [XmlElement("emailAddress")] public string EmailAddress { get; set; } /// <summary> /// The name of the department to which the account's user belongs. /// </summary> [XmlElement("department")] public string Department { get; set; } /// <summary> /// Custom field 1. /// </summary> [XmlElement("customDefined1")] public string CustomField1 { get; set; } /// <summary> /// Custom field 2. /// </summary> [XmlElement("customDefined2")] public string CustomField2 { get; set; } /// <summary> /// The Id of the organisation to which the account belongs. /// </summary> [XmlElement("orgId")] public Guid OrganizationId { get; set; } /// <summary> /// The user's password. /// </summary> [XmlElement("password")] public string Password { get; set; } /// <summary> /// Roles (if any) to which the account belongs. /// </summary> [XmlArray("roles")] [XmlArrayItem("role")] public List<Role> MemberOfRoles { get; } = new List<Role>(); } }
mit
C#
28e3ded2e9a581797d62be648168cebe5e6ab117
Fix the test on MySQL, should work now
RogerKratz/nhibernate-core,RogerKratz/nhibernate-core,lnu/nhibernate-core,gliljas/nhibernate-core,fredericDelaporte/nhibernate-core,livioc/nhibernate-core,alobakov/nhibernate-core,hazzik/nhibernate-core,ngbrown/nhibernate-core,nhibernate/nhibernate-core,nhibernate/nhibernate-core,ManufacturingIntelligence/nhibernate-core,alobakov/nhibernate-core,ngbrown/nhibernate-core,hazzik/nhibernate-core,fredericDelaporte/nhibernate-core,RogerKratz/nhibernate-core,livioc/nhibernate-core,hazzik/nhibernate-core,gliljas/nhibernate-core,nkreipke/nhibernate-core,ManufacturingIntelligence/nhibernate-core,RogerKratz/nhibernate-core,ngbrown/nhibernate-core,ManufacturingIntelligence/nhibernate-core,nkreipke/nhibernate-core,fredericDelaporte/nhibernate-core,lnu/nhibernate-core,nkreipke/nhibernate-core,fredericDelaporte/nhibernate-core,nhibernate/nhibernate-core,gliljas/nhibernate-core,nhibernate/nhibernate-core,alobakov/nhibernate-core,lnu/nhibernate-core,gliljas/nhibernate-core,livioc/nhibernate-core,hazzik/nhibernate-core
src/NHibernate.Test/ExpressionTest/NotExpressionFixture.cs
src/NHibernate.Test/ExpressionTest/NotExpressionFixture.cs
using System; using System.Data; using System.Text; using NHibernate.Engine; using NExpression = NHibernate.Expression; using NHibernate.SqlCommand; using NHibernate.Type; using NHibernate.DomainModel; using NUnit.Framework; namespace NHibernate.Test.ExpressionTest { /// <summary> /// Summary description for NotExpressionFixture. /// </summary> [TestFixture] public class NotExpressionFixture : BaseExpressionFixture { [Test] public void NotSqlStringTest() { ISession session = factory.OpenSession(); NExpression.ICriterion notExpression = NExpression.Expression.Not(NExpression.Expression.Eq("Address", "12 Adress")); SqlString sqlString = notExpression.ToSqlString(factoryImpl, typeof(Simple), "simple_alias", BaseExpressionFixture.EmptyAliasClasses ); string expectedSql = dialect is Dialect.MySQLDialect ? "not (simple_alias.address = :simple_alias.address)" : "not simple_alias.address = :simple_alias.address"; Parameter firstParam = new Parameter( "address", "simple_alias", new SqlTypes.StringSqlType() ); CompareSqlStrings(sqlString, expectedSql, new Parameter[] {firstParam}); session.Close(); } } }
using System; using System.Data; using System.Text; using NHibernate.Engine; using NExpression = NHibernate.Expression; using NHibernate.SqlCommand; using NHibernate.Type; using NHibernate.DomainModel; using NUnit.Framework; namespace NHibernate.Test.ExpressionTest { /// <summary> /// Summary description for NotExpressionFixture. /// </summary> [TestFixture] public class NotExpressionFixture : BaseExpressionFixture { [Test] public void NotSqlStringTest() { ISession session = factory.OpenSession(); NExpression.ICriterion notExpression = NExpression.Expression.Not(NExpression.Expression.Eq("Address", "12 Adress")); SqlString sqlString = notExpression.ToSqlString(factoryImpl, typeof(Simple), "simple_alias", BaseExpressionFixture.EmptyAliasClasses ); string expectedSql = dialect is Dialect.MySQLDialect ? "not(simple_alias.address = :simple_alias.address)" : "not simple_alias.address = :simple_alias.address"; Parameter firstParam = new Parameter( "address", "simple_alias", new SqlTypes.StringSqlType() ); CompareSqlStrings(sqlString, expectedSql, new Parameter[] {firstParam}); session.Close(); } } }
lgpl-2.1
C#
fe5aabcd77192fa94850befb4b9d05c4149e9374
Add TODO
OvidiuCaba/StatisticsRomania,OvidiuCaba/StatisticsRomania,OvidiuCaba/StatisticsRomania,OvidiuCaba/StatisticsRomania
src/StatisticsRomania/StatisticsRomania.iOS/AppDelegate.cs
src/StatisticsRomania/StatisticsRomania.iOS/AppDelegate.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using Foundation; using UIKit; using StatisticsRomania.Repository; // TODO: Add AdMob: https://xamarininsider.com/2019/04/10/monetising-your-xamarin-forms-app-with-admob/?utm_campaign=Weekly%2BXamarin&utm_medium=email&utm_source=Weekly_Xamarin_202 namespace StatisticsRomania.iOS { // The UIApplicationDelegate for the application. This class is responsible for launching the // User Interface of the application, as well as listening (and optionally responding) to // application events from iOS. [Register("AppDelegate")] public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate { // // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { global::Xamarin.Forms.Forms.Init(); DevExpress.Mobile.Forms.Init(); OxyPlot.Xamarin.Forms.Platform.iOS.PlotViewRenderer.Init(); var database = new Database { Path = GetPath() }; database.Initialize(); App.AsyncDb = database.AsyncDb; LoadApplication(new App()); return base.FinishedLaunching(app, options); } private static string GetPath() { string docFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal); string libFolder = Path.Combine(docFolder, "..", "Library", "Databases"); if (!Directory.Exists(libFolder)) { Directory.CreateDirectory(libFolder); } return Path.Combine(libFolder, App.SqliteFilename); } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using Foundation; using UIKit; using StatisticsRomania.Repository; namespace StatisticsRomania.iOS { // The UIApplicationDelegate for the application. This class is responsible for launching the // User Interface of the application, as well as listening (and optionally responding) to // application events from iOS. [Register("AppDelegate")] public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate { // // This method is invoked when the application has loaded and is ready to run. In this // method you should instantiate the window, load the UI into it and then make the window // visible. // // You have 17 seconds to return from this method, or iOS will terminate your application. // public override bool FinishedLaunching(UIApplication app, NSDictionary options) { global::Xamarin.Forms.Forms.Init(); DevExpress.Mobile.Forms.Init(); OxyPlot.Xamarin.Forms.Platform.iOS.PlotViewRenderer.Init(); var database = new Database { Path = GetPath() }; database.Initialize(); App.AsyncDb = database.AsyncDb; LoadApplication(new App()); return base.FinishedLaunching(app, options); } private static string GetPath() { string docFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal); string libFolder = Path.Combine(docFolder, "..", "Library", "Databases"); if (!Directory.Exists(libFolder)) { Directory.CreateDirectory(libFolder); } return Path.Combine(libFolder, App.SqliteFilename); } } }
mit
C#
4bc4f35ec96c8ed1e408414487f8cc5510e8444e
Switch Thomas Rayner over to IWorkAtMicrosoft
planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell,planetpowershell/planetpowershell
src/Firehose.Web/Authors/ThomasRayner.cs
src/Firehose.Web/Authors/ThomasRayner.cs
using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel.Syndication; using System.Web; using Firehose.Web.Infrastructure; namespace Firehose.Web.Authors { public class ThomasRayner : IWorkAtMicrosoft { public string FirstName => "Thomas"; public string LastName => "Rayner"; public string ShortBioOrTagLine => "Senior Security Systems Engineer @ Microsoft"; public string StateOrRegion => "Canada"; public string EmailAddress => "thmsrynr@outlook.com"; public string TwitterHandle => "MrThomasRayner"; public string GitHubHandle => "ThmsRynr"; public string GravatarHash => ""; public GeoPosition Position => new GeoPosition(53.5443890, -113.4909270); public Uri WebSite => new Uri("https://thomasrayner.ca"); public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://thomasrayner.ca/feed"); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel.Syndication; using System.Web; using Firehose.Web.Infrastructure; namespace Firehose.Web.Authors { public class ThomasRayner : IAmAMicrosoftMVP { public string FirstName => "Thomas"; public string LastName => "Rayner"; public string ShortBioOrTagLine => "Senior Security Systems Engineer @ Microsoft"; public string StateOrRegion => "Canada"; public string EmailAddress => "thmsrynr@outlook.com"; public string TwitterHandle => "MrThomasRayner"; public string GitHubHandle => "ThmsRynr"; public string GravatarHash => ""; public GeoPosition Position => new GeoPosition(53.5443890, -113.4909270); public Uri WebSite => new Uri("https://thomasrayner.ca"); public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://thomasrayner.ca/feed"); } } } }
mit
C#
61373a6199995b93ab8bb3648096ce2471d2a159
Modify test to catch all possible nullable values
ritterim/zendesk-ticket-exporter
test/ZendeskTicketExporter.Core.Tests/TicketRetrieverTests.cs
test/ZendeskTicketExporter.Core.Tests/TicketRetrieverTests.cs
using Moq; using System; using System.Threading.Tasks; using Xunit; namespace ZendeskTicketExporter.Core.Tests { public class TicketRetrieverTests { private static readonly DateTime Jan1_2014 = new DateTime(2014, 1, 1); private readonly IWait _wait; private readonly IZendeskApi _zendeskApi; private readonly Func<DateTime> _utcNowProvider; private readonly ITicketRetriever _sut; public TicketRetrieverTests() { _wait = Mock.Of<IWait>(); _zendeskApi = Mock.Of<IZendeskApi>(); _utcNowProvider = Mock.Of<Func<DateTime>>(); _sut = new TicketRetriever(_wait, _zendeskApi, _utcNowProvider); SetupDefaultMocks(); } private void SetupDefaultMocks() { Mock.Get(_utcNowProvider).Setup(x => x()).Returns(Jan1_2014); } [Fact] public async Task GetBatchAsync_calls_ZendeskApi_IncrementalTicketExport_using_marker() { await _sut.GetBatchAsync(marker: 123); Mock.Get(_zendeskApi).Verify( x => x.IncrementalTicketExport(123), Times.Once()); } [Fact] public async Task GetBatchAsync_does_not_wait_for_first_call() { await _sut.GetBatchAsync(marker: 123); Mock.Get(_wait).Verify( x => x.UntilAsync(It.IsAny<DateTime>(), /* now */ It.IsAny<Nullable<DateTime>>()), Times.Never()); } [Fact] public async Task GetBatchAsync_waits_correct_duration_for_second_call() { await _sut.GetBatchAsync(marker: 123); await _sut.GetBatchAsync(marker: 456); Mock.Get(_wait).Verify( x => x.UntilAsync(Jan1_2014.Add(Configuration.ZendeskRequiredCooloffBetweenIncrementalTicketExportResults), /* now */ null), Times.Once()); } } }
using Moq; using System; using System.Threading.Tasks; using Xunit; namespace ZendeskTicketExporter.Core.Tests { public class TicketRetrieverTests { private static readonly DateTime Jan1_2014 = new DateTime(2014, 1, 1); private readonly IWait _wait; private readonly IZendeskApi _zendeskApi; private readonly Func<DateTime> _utcNowProvider; private readonly ITicketRetriever _sut; public TicketRetrieverTests() { _wait = Mock.Of<IWait>(); _zendeskApi = Mock.Of<IZendeskApi>(); _utcNowProvider = Mock.Of<Func<DateTime>>(); _sut = new TicketRetriever(_wait, _zendeskApi, _utcNowProvider); SetupDefaultMocks(); } private void SetupDefaultMocks() { Mock.Get(_utcNowProvider).Setup(x => x()).Returns(Jan1_2014); } [Fact] public async Task GetBatchAsync_calls_ZendeskApi_IncrementalTicketExport_using_marker() { await _sut.GetBatchAsync(marker: 123); Mock.Get(_zendeskApi).Verify( x => x.IncrementalTicketExport(123), Times.Once()); } [Fact] public async Task GetBatchAsync_does_not_wait_for_first_call() { await _sut.GetBatchAsync(marker: 123); Mock.Get(_wait).Verify( x => x.UntilAsync(It.IsAny<DateTime>(), /* now */ null), Times.Never()); } [Fact] public async Task GetBatchAsync_waits_correct_duration_for_second_call() { await _sut.GetBatchAsync(marker: 123); await _sut.GetBatchAsync(marker: 456); Mock.Get(_wait).Verify( x => x.UntilAsync(Jan1_2014.Add(Configuration.ZendeskRequiredCooloffBetweenIncrementalTicketExportResults), /* now */ null), Times.Once()); } } }
mit
C#
bc85c8cb3cfa4f9b557043770fc7b786e176221e
Remove Log
ApplETS/ETSMobile-WindowsPlatforms,ApplETS/ETSMobile-WindowsPlatforms
Ets.Mobile/Ets.Mobile.Shared/Views/Pages/Account/LoginPage.cs
Ets.Mobile/Ets.Mobile.Shared/Views/Pages/Account/LoginPage.cs
using Ets.Mobile.ViewModel.Pages.Account; using ReactiveUI; using System; using System.Reactive.Linq; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; namespace Ets.Mobile.Pages.Account { public partial class LoginPage : IViewFor<LoginViewModel> { #region IViewFor<T> public LoginViewModel ViewModel { get { return (LoginViewModel)GetValue(ViewModelProperty); } set { SetValue(ViewModelProperty, value); } } public static readonly DependencyProperty ViewModelProperty = DependencyProperty.Register("ViewModel", typeof(LoginViewModel), typeof(LoginPage), new PropertyMetadata(null)); object IViewFor.ViewModel { get { return ViewModel; } set { ViewModel = (LoginViewModel)value; } } #endregion public LoginPage() { InitializeComponent(); Login.Events().Click.Subscribe(arg => { ErrorMessage.Visibility = Visibility.Collapsed; }); // Error Handling UserError.RegisterHandler(ue => { ErrorMessage.Text = ue.ErrorMessage; ErrorMessage.Visibility = Visibility.Visible; return Observable.Return(RecoveryOptionResult.CancelOperation); }); PartialInitialize(); } partial void PartialInitialize(); } }
using Ets.Mobile.ViewModel.Pages.Account; using ReactiveUI; using System; using System.Reactive.Linq; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; namespace Ets.Mobile.Pages.Account { public partial class LoginPage : IViewFor<LoginViewModel> { #region IViewFor<T> public LoginViewModel ViewModel { get { return (LoginViewModel)GetValue(ViewModelProperty); } set { SetValue(ViewModelProperty, value); } } public static readonly DependencyProperty ViewModelProperty = DependencyProperty.Register("ViewModel", typeof(LoginViewModel), typeof(LoginPage), new PropertyMetadata(null)); object IViewFor.ViewModel { get { return ViewModel; } set { ViewModel = (LoginViewModel)value; } } #endregion public LoginPage() { InitializeComponent(); Login.Events().Click.Subscribe(arg => { ErrorMessage.Visibility = Visibility.Collapsed; Logs.Text = string.Empty; }); // Error Handling UserError.RegisterHandler(ue => { ErrorMessage.Text = ue.ErrorMessage; ErrorMessage.Visibility = Visibility.Visible; return Observable.Return(RecoveryOptionResult.CancelOperation); }); PartialInitialize(); } partial void PartialInitialize(); } }
apache-2.0
C#
adc7d393da290bb7d6a420851fb63fd4004eaeaa
Apply readonly fields refactoring
eightlittlebits/elbsms
elbsms_core/Cartridge.cs
elbsms_core/Cartridge.cs
using System.IO; namespace elbsms_core { public class Cartridge { private readonly byte[] _romData; public static Cartridge LoadFromFile(string filename) { byte[] fileData = File.ReadAllBytes(filename); return new Cartridge(fileData); } private Cartridge(byte[] romData) { _romData = romData; } internal byte ReadByte(ushort address) { return _romData[address]; } internal void WriteByte(ushort address) { return;//throw new NotImplementedException(); } } }
using System.IO; namespace elbsms_core { public class Cartridge { private byte[] _romData; public static Cartridge LoadFromFile(string filename) { byte[] fileData = File.ReadAllBytes(filename); return new Cartridge(fileData); } private Cartridge(byte[] romData) { _romData = romData; } internal byte ReadByte(ushort address) { return _romData[address]; } internal void WriteByte(ushort address) { return;//throw new NotImplementedException(); } } }
mit
C#
6bdad4f9e4e643d93d6e0ff2c889a692704c4809
Work with Jeff's canvas modifications.
eightyeight/t3d-bones,eightyeight/t3d-bones
main.cs
main.cs
// Display a splash window immediately to improve app responsiveness before // engine is initialized and main window created displaySplashWindow("splash.bmp"); // Console does something. setLogMode(2); // Disable script trace. trace(false); //----------------------------------------------------------------------------- // Load up scripts to initialise subsystems. exec("sys/main.cs"); // The canvas needs to be initialized before any gui scripts are run since // some of the controls assume that the canvas exists at load time. createCanvas("T3Dbones"); // Start rendering and stuff. initRenderManager(); initLightingSystems("Basic Lighting"); // Start PostFX. If you use "Advanced Lighting" above, uncomment this. //initPostEffects(); // Start audio. sfxStartup(); // Provide stubs so we don't get console errors. If you actually want to use // any of these functions, be sure to remove the empty definition here. function onDatablockObjectReceived() {} function onGhostAlwaysObjectReceived() {} function onGhostAlwaysStarted() {} function updateTSShapeLoadProgress() {} //----------------------------------------------------------------------------- // Load console. exec("console/main.cs"); // Load up game code. exec("game/main.cs"); // Called when we connect to the local game. function GameConnection::onConnect(%client) { %client.transmitDataBlocks(0); } // Called when all datablocks from above have been transmitted. function GameConnection::onDataBlocksDone(%client) { closeSplashWindow(); Canvas.showWindow(); // Start sending ghosts to the client. %client.activateGhosting(); %client.onEnterGame(); } // Create a local game server and connect to it. new SimGroup(ServerGroup); new GameConnection(ServerConnection); // This calls GameConnection::onConnect. ServerConnection.connectLocal(); onStart(); //----------------------------------------------------------------------------- // Called when the engine is shutting down. function onExit() { // Clean up game objects and so on. onEnd(); // Delete server-side objects and datablocks. ServerGroup.delete(); deleteDataBlocks(); }
// Display a splash window immediately to improve app responsiveness before // engine is initialized and main window created displaySplashWindow("splash.bmp"); // Console does something. setLogMode(2); // Disable script trace. trace(false); //----------------------------------------------------------------------------- // Load up scripts to initialise subsystems. exec("sys/main.cs"); // The canvas needs to be initialized before any gui scripts are run since // some of the controls assume that the canvas exists at load time. createCanvas("T3Dbones"); // Start rendering and stuff. initRenderManager(); initLightingSystems("Basic Lighting"); // Start PostFX. If you use "Advanced Lighting" above, uncomment this. //initPostEffects(); // Start audio. sfxStartup(); // Provide stubs so we don't get console errors. If you actually want to use // any of these functions, be sure to remove the empty definition here. function onDatablockObjectReceived() {} function onGhostAlwaysObjectReceived() {} function onGhostAlwaysStarted() {} function updateTSShapeLoadProgress() {} //----------------------------------------------------------------------------- // Load console. exec("console/main.cs"); // Load up game code. exec("game/main.cs"); // Called when we connect to the local game. function GameConnection::onConnect(%client) { %client.transmitDataBlocks(0); } // Called when all datablocks from above have been transmitted. function GameConnection::onDataBlocksDone(%client) { // Start sending ghosts to the client. %client.activateGhosting(); %client.onEnterGame(); } // Create a local game server and connect to it. new SimGroup(ServerGroup); new GameConnection(ServerConnection); // This calls GameConnection::onConnect. ServerConnection.connectLocal(); onStart(); //----------------------------------------------------------------------------- // Called when the engine is shutting down. function onExit() { // Clean up game objects and so on. onEnd(); // Delete server-side objects and datablocks. ServerGroup.delete(); deleteDataBlocks(); }
mit
C#
e4edd6608b6061466e5bea3cefb9af5ebf7a35c8
Update description text
imulus/census,imulus/census
Src/Census/UmbracoObjectRelations/DataTypeToPropertyEditor.cs
Src/Census/UmbracoObjectRelations/DataTypeToPropertyEditor.cs
using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Web; using Census.Core; using Census.Core.Interfaces; using Census.UmbracoObject; using umbraco.cms.businesslogic.datatype; using umbraco.cms.businesslogic.web; using umbraco.interfaces; namespace Census.UmbracoObjectRelations { public class DataTypeToPropertyEditor : IRelation { public object From { get { return typeof(UmbracoObject.DataType); } } public object To { get { return typeof(UmbracoObject.PropertyEditor); } } public DataTable GetRelations(object id) { var dataType = DataTypeDefinition.GetDataTypeDefinition((int)id); if (dataType == null || dataType.DataType == null) return new DataTable(); // PropertyEditor DLL no longer exists var propertyEditorGuid = dataType.DataType.Id; var usages = DataTypeDefinition.GetAll().Where(d => d.DataType != null && d.DataType.Id == propertyEditorGuid); return PropertyEditor.ToDataTable(usages); } public string Description { get { return "The Property Editor (aka Render Control) used by this datatype, and a list of other DataTypes that use the same Property Editor"; } } } }
using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Web; using Census.Core; using Census.Core.Interfaces; using Census.UmbracoObject; using umbraco.cms.businesslogic.datatype; using umbraco.cms.businesslogic.web; using umbraco.interfaces; namespace Census.UmbracoObjectRelations { public class DataTypeToPropertyEditor : IRelation { public object From { get { return typeof(UmbracoObject.DataType); } } public object To { get { return typeof(UmbracoObject.PropertyEditor); } } public DataTable GetRelations(object id) { var dataType = DataTypeDefinition.GetDataTypeDefinition((int)id); if (dataType == null || dataType.DataType == null) return new DataTable(); // PropertyEditor DLL no longer exists var propertyEditorGuid = dataType.DataType.Id; var usages = DataTypeDefinition.GetAll().Where(d => d.DataType != null && d.DataType.Id == propertyEditorGuid); return PropertyEditor.ToDataTable(usages); } public string Description { get { return "Property Editors (aka Render Controls) used by this Datatype"; } } } }
mit
C#
b83634e4ca30fd02adfdfcc934e92729ee51583e
Fix potentially unblocking too early (due to `Running` state)
ppy/osu-framework,smoogipooo/osu-framework,ppy/osu-framework,peppy/osu-framework,peppy/osu-framework,peppy/osu-framework,ppy/osu-framework,smoogipooo/osu-framework
osu.Framework/Threading/GameThreadSynchronizationContext.cs
osu.Framework/Threading/GameThreadSynchronizationContext.cs
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Diagnostics; using System.Threading; #nullable enable namespace osu.Framework.Threading { /// <summary> /// A synchronisation context which posts all continuations to an isolated scheduler instance. /// </summary> /// <remarks> /// This implementation roughly follows the expectations set out for winforms/WPF as per /// https://docs.microsoft.com/en-us/archive/msdn-magazine/2011/february/msdn-magazine-parallel-computing-it-s-all-about-the-synchronizationcontext. /// - Calls to <see cref="Post"/> are guaranteed to run asynchronously. /// - Calls to <see cref="Send"/> will run inline when they can. /// - Order of execution is guaranteed (in our case, it is guaranteed over <see cref="Send"/> and <see cref="Post"/> calls alike). /// - To enforce the above, calling <see cref="Send"/> will flush any pending work until the newly queued item has been completed. /// </remarks> internal class GameThreadSynchronizationContext : SynchronizationContext { private readonly Scheduler scheduler; public int TotalTasksRun => scheduler.TotalTasksRun; public GameThreadSynchronizationContext(GameThread gameThread) { scheduler = new GameThreadScheduler(gameThread); } public override void Send(SendOrPostCallback callback, object? state) { var scheduledDelegate = scheduler.Add(() => callback(state)); Debug.Assert(scheduledDelegate != null); while (scheduledDelegate.State < ScheduledDelegate.RunState.Complete) { if (scheduler.IsMainThread) scheduler.Update(); else Thread.Sleep(1); } } public override void Post(SendOrPostCallback callback, object? state) => scheduler.Add(() => callback(state)); public void RunWork() => scheduler.Update(); } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Diagnostics; using System.Threading; #nullable enable namespace osu.Framework.Threading { /// <summary> /// A synchronisation context which posts all continuations to an isolated scheduler instance. /// </summary> /// <remarks> /// This implementation roughly follows the expectations set out for winforms/WPF as per /// https://docs.microsoft.com/en-us/archive/msdn-magazine/2011/february/msdn-magazine-parallel-computing-it-s-all-about-the-synchronizationcontext. /// - Calls to <see cref="Post"/> are guaranteed to run asynchronously. /// - Calls to <see cref="Send"/> will run inline when they can. /// - Order of execution is guaranteed (in our case, it is guaranteed over <see cref="Send"/> and <see cref="Post"/> calls alike). /// - To enforce the above, calling <see cref="Send"/> will flush any pending work until the newly queued item has been completed. /// </remarks> internal class GameThreadSynchronizationContext : SynchronizationContext { private readonly Scheduler scheduler; public int TotalTasksRun => scheduler.TotalTasksRun; public GameThreadSynchronizationContext(GameThread gameThread) { scheduler = new GameThreadScheduler(gameThread); } public override void Send(SendOrPostCallback callback, object? state) { var scheduledDelegate = scheduler.Add(() => callback(state)); Debug.Assert(scheduledDelegate != null); while (scheduledDelegate.State == ScheduledDelegate.RunState.Waiting) { if (scheduler.IsMainThread) scheduler.Update(); else Thread.Sleep(1); } } public override void Post(SendOrPostCallback callback, object? state) => scheduler.Add(() => callback(state)); public void RunWork() => scheduler.Update(); } }
mit
C#
3e7df3bf026b205d2922192e16567ebb05bdb02b
change heading font size
NeoAdonis/osu,peppy/osu,smoogipoo/osu,UselessToucan/osu,NeoAdonis/osu,peppy/osu-new,peppy/osu,ppy/osu,smoogipoo/osu,peppy/osu,ppy/osu,NeoAdonis/osu,smoogipoo/osu,smoogipooo/osu,UselessToucan/osu,ppy/osu,UselessToucan/osu
osu.Game/Graphics/Containers/Markdown/OsuMarkdownHeading.cs
osu.Game/Graphics/Containers/Markdown/OsuMarkdownHeading.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 Markdig.Syntax; using osu.Framework.Graphics.Containers.Markdown; namespace osu.Game.Graphics.Containers.Markdown { public class OsuMarkdownHeading : MarkdownHeading { public OsuMarkdownHeading(HeadingBlock headingBlock) : base(headingBlock) { } protected override float GetFontSizeByLevel(int level) { const float base_font_size = 14; switch (level) { case 1: return 30 / base_font_size; case 2: return 26 / base_font_size; case 3: return 20 / base_font_size; case 4: return 18 / base_font_size; case 5: return 16 / base_font_size; default: return 1; } } } }
// 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 Markdig.Syntax; using osu.Framework.Graphics.Containers.Markdown; namespace osu.Game.Graphics.Containers.Markdown { public class OsuMarkdownHeading : MarkdownHeading { public OsuMarkdownHeading(HeadingBlock headingBlock) : base(headingBlock) { } } }
mit
C#
e944deb2bb68129e641269330cfca34313a84c4f
Mark sub-header navigation link as 'last' so that the trailing vertical bar goes away.
walty8/trac,walty8/trac,walty8/trac,jun66j5/trac-ja,netjunki/trac-Pygit2,netjunki/trac-Pygit2,netjunki/trac-Pygit2,jun66j5/trac-ja,walty8/trac,jun66j5/trac-ja,jun66j5/trac-ja
templates/log.cs
templates/log.cs
<?cs include "header.cs"?> <?cs include "macros.cs"?> <div id="page-content"> <ul class="subheader-links"> <li class="last"><a href="<?cs var:log.items.0.file_href ?>">View Latest Revision</a></li> </ul> <div id="main"> <div id="main-content"> <h1 id="log-hdr" class="hide">Revision log for <?cs var:log.path ?></h1> <?cs call:browser_path_links(log.path, log) ?> <div id="browser-nav"> <ul class="menulist"><li class="last"><a href="<?cs var:log.items.0.file_href ?>">View Latest Revision</a></li></ul> <form id="browser-chgrev" action="<?cs var:log.items.0.file_href ?>" method="get"> <label for="rev">View rev:</label> <input type="text" id="rev" name="rev" value="<?cs var:log.items.0.rev ?>" size="4" /> <input type="submit" value="View"/> </form> <div class="tiny" style="clear: both">&nbsp;</div> </div> <table id="browser-list" cellspacing="0" cellpadding="0"> <tr class="browser-listhdr"> <th>Date</th> <th>Rev</th> <th>Chgset</th> <th>Author</th> <th>Log Message</th> </tr> <?cs each:item = log.items ?> <?cs if idx % #2 ?> <tr class="br-row-even"> <?cs else ?> <tr class="br-row-odd"> <?cs /if ?> <td class="br-date-col"><?cs var:item.date ?></td> <td class="br-rev-col"> <a class="block-link" href="<?cs var:item.file_href ?>"><?cs var:item.rev ?></a> </td> <td class="br-chg-col"> <a class="block-link" href="<?cs var:item.changeset_href ?>"><?cs var:item.rev ?></a> </td> <td class="br-author-col"> <?cs var:item.author ?> </td> <td class="br-summary-col"><?cs var:item.log ?></td> </tr> <?cs set:idx = idx + #1 ?> <?cs /each ?> </table> <div id="main-footer"> Download history in other formats: <br /> <a class="noline" href="?format=rss"><img src="<?cs var:htdocs_location ?>xml.png" alt="RSS Feed" style="vertical-align: bottom"/></a>&nbsp; <a href="?format=rss">(RSS 2.0)</a> <br /> </div> </div> </div> </div> <?cs include:"footer.cs"?>
<?cs include "header.cs"?> <?cs include "macros.cs"?> <div id="page-content"> <ul class="subheader-links"> <li><a href="<?cs var:log.items.0.file_href ?>">View Latest Revision</a></li> </ul> <div id="main"> <div id="main-content"> <h1 id="log-hdr" class="hide">Revision log for <?cs var:log.path ?></h1> <?cs call:browser_path_links(log.path, log) ?> <div id="browser-nav"> <ul class="menulist"><li class="last"><a href="<?cs var:log.items.0.file_href ?>">View Latest Revision</a></li></ul> <form id="browser-chgrev" action="<?cs var:log.items.0.file_href ?>" method="get"> <label for="rev">View rev:</label> <input type="text" id="rev" name="rev" value="<?cs var:log.items.0.rev ?>" size="4" /> <input type="submit" value="View"/> </form> <div class="tiny" style="clear: both">&nbsp;</div> </div> <table id="browser-list" cellspacing="0" cellpadding="0"> <tr class="browser-listhdr"> <th>Date</th> <th>Rev</th> <th>Chgset</th> <th>Author</th> <th>Log Message</th> </tr> <?cs each:item = log.items ?> <?cs if idx % #2 ?> <tr class="br-row-even"> <?cs else ?> <tr class="br-row-odd"> <?cs /if ?> <td class="br-date-col"><?cs var:item.date ?></td> <td class="br-rev-col"> <a class="block-link" href="<?cs var:item.file_href ?>"><?cs var:item.rev ?></a> </td> <td class="br-chg-col"> <a class="block-link" href="<?cs var:item.changeset_href ?>"><?cs var:item.rev ?></a> </td> <td class="br-author-col"> <?cs var:item.author ?> </td> <td class="br-summary-col"><?cs var:item.log ?></td> </tr> <?cs set:idx = idx + #1 ?> <?cs /each ?> </table> <div id="main-footer"> Download history in other formats: <br /> <a class="noline" href="?format=rss"><img src="<?cs var:htdocs_location ?>xml.png" alt="RSS Feed" style="vertical-align: bottom"/></a>&nbsp; <a href="?format=rss">(RSS 2.0)</a> <br /> </div> </div> </div> </div> <?cs include:"footer.cs"?>
bsd-3-clause
C#
31bfcb6b05262cad46fce35340932b742e1b88e6
Fix BindingValue comparison.
jkoritzinsky/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,wieslawsoltes/Perspex,SuperJMN/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,Perspex/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,grokys/Perspex,Perspex/Perspex,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,SuperJMN/Avalonia,grokys/Perspex,wieslawsoltes/Perspex,SuperJMN/Avalonia,jkoritzinsky/Perspex,AvaloniaUI/Avalonia
src/Avalonia.Controls/NativeMenuBar.cs
src/Avalonia.Controls/NativeMenuBar.cs
using System; using Avalonia.Controls.Primitives; using Avalonia.Interactivity; namespace Avalonia.Controls { public class NativeMenuBar : TemplatedControl { public static readonly AttachedProperty<bool> EnableMenuItemClickForwardingProperty = AvaloniaProperty.RegisterAttached<NativeMenuBar, MenuItem, Boolean>( "EnableMenuItemClickForwarding"); static NativeMenuBar() { EnableMenuItemClickForwardingProperty.Changed.Subscribe(args => { var item = (MenuItem)args.Sender; if (args.NewValue.GetValueOrDefault<bool>()) item.Click += OnMenuItemClick; else item.Click -= OnMenuItemClick; }); } public static void SetEnableMenuItemClickForwarding(MenuItem menuItem, bool enable) { menuItem.SetValue(EnableMenuItemClickForwardingProperty, enable); } private static void OnMenuItemClick(object sender, RoutedEventArgs e) { (((MenuItem)sender).DataContext as INativeMenuItemExporterEventsImplBridge)?.RaiseClicked(); } } }
using System; using Avalonia.Controls.Primitives; using Avalonia.Interactivity; using Avalonia.Styling; namespace Avalonia.Controls { public class NativeMenuBar : TemplatedControl { public static readonly AttachedProperty<bool> EnableMenuItemClickForwardingProperty = AvaloniaProperty.RegisterAttached<NativeMenuBar, MenuItem, Boolean>( "EnableMenuItemClickForwarding"); static NativeMenuBar() { EnableMenuItemClickForwardingProperty.Changed.Subscribe(args => { var item = (MenuItem)args.Sender; if (args.NewValue.Equals(true)) item.Click += OnMenuItemClick; else item.Click -= OnMenuItemClick; }); } public static void SetEnableMenuItemClickForwarding(MenuItem menuItem, bool enable) { menuItem.SetValue(EnableMenuItemClickForwardingProperty, enable); } private static void OnMenuItemClick(object sender, RoutedEventArgs e) { (((MenuItem)sender).DataContext as INativeMenuItemExporterEventsImplBridge)?.RaiseClicked(); } } }
mit
C#
1c82c382648f8a20216725e37d79d2c488cb647c
Add assemblywide cake namespace imports
vCipher/Cake.Hg
src/Cake.Hg/Properties/AssemblyInfo.cs
src/Cake.Hg/Properties/AssemblyInfo.cs
using Cake.Core.Annotations; 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("Cake.Hg")] [assembly: AssemblyDescription("Cake AddIn that extends Cake with Mercurial features")] [assembly: AssemblyCompany("vCipher")] [assembly: AssemblyProduct("Cake.Hg")] // 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("8E7F175A-9805-4FB2-8708-C358FF9F5CB2")] // 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.4.0")] [assembly: AssemblyFileVersion("0.0.4.0")] // Cake build configuration [assembly: CakeNamespaceImport("Mercurial")] [assembly: CakeNamespaceImport("Cake.Hg")] [assembly: CakeNamespaceImport("Cake.Hg.Aliases")] [assembly: CakeNamespaceImport("Cake.Hg.Versions")]
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("Cake.Hg")] [assembly: AssemblyDescription("Cake AddIn that extends Cake with Mercurial features")] [assembly: AssemblyCompany("vCipher")] [assembly: AssemblyProduct("Cake.Hg")] // 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("8E7F175A-9805-4FB2-8708-C358FF9F5CB2")] // 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.3.0")] [assembly: AssemblyFileVersion("0.0.3.0")]
mit
C#
6de7bdb7b9ed5901c6bbc6fe12550d33ac7adab4
fix set switching
isse-augsburg/ssharp,isse-augsburg/ssharp,isse-augsburg/ssharp,isse-augsburg/ssharp,maul-esel/ssharp,maul-esel/ssharp,maul-esel/ssharp,isse-augsburg/ssharp,maul-esel/ssharp
Source/SafetySharp/Analysis/Heuristics/SubsumptionHeuristic.cs
Source/SafetySharp/Analysis/Heuristics/SubsumptionHeuristic.cs
namespace SafetySharp.Analysis.Heuristics { using System.Collections.Generic; using Modeling; using Runtime; public class SubsumptionHeuristic : IFaultSetHeuristic { private Fault[] allFaults; private readonly HashSet<FaultSet> subsumedSets = new HashSet<FaultSet>(); private int successCounter; public SubsumptionHeuristic(ModelBase model) { allFaults = model.Faults; } public void Augment(List<FaultSet> setsToCheck) { // for each set, check the set of subsumed faults first for (int i = 0; i < setsToCheck.Count; ++i) { var subsumed = Fault.SubsumedFaults(setsToCheck[i], allFaults); if (!setsToCheck[i].Equals(subsumed) && !subsumedSets.Contains(subsumed)) { setsToCheck.Insert(i, subsumed); subsumedSets.Add(subsumed); i++; } } } public void Update(List<FaultSet> setsToCheck, FaultSet checkedSet, bool isSafe) { if (!subsumedSets.Contains(checkedSet)) return; int delta = isSafe ? 1 : -1; successCounter += delta; if (successCounter != 0) return; // if the subsumed sets are critical more often than they are not, // check the "normal" sets first. for (int i = 0; i < setsToCheck.Count; ++i) { var set = setsToCheck[i]; if (subsumedSets.Contains(set)) { setsToCheck[i] = setsToCheck[i - delta]; setsToCheck[i - delta] = set; if (!isSafe) // we just moved 'set' to position i+1 i++; // skip it, don't move it again } } } } }
namespace SafetySharp.Analysis.Heuristics { using System.Collections.Generic; using Modeling; using Runtime; public class SubsumptionHeuristic : IFaultSetHeuristic { private Fault[] allFaults; private readonly HashSet<FaultSet> subsumedSets = new HashSet<FaultSet>(); private int successCounter; public SubsumptionHeuristic(ModelBase model) { allFaults = model.Faults; } public void Augment(List<FaultSet> setsToCheck) { // for each set, check the set of subsumed faults first for (int i = 0; i < setsToCheck.Count; ++i) { var subsumed = Fault.SubsumedFaults(setsToCheck[i], allFaults); if (!setsToCheck[i].Equals(subsumed) && !subsumedSets.Contains(subsumed)) { setsToCheck.Insert(i, subsumed); subsumedSets.Add(subsumed); i++; } } } public void Update(List<FaultSet> setsToCheck, FaultSet checkedSet, bool isSafe) { if (!subsumedSets.Contains(checkedSet)) return; int delta = isSafe ? 1 : -1; successCounter += delta; if (successCounter != 0) return; // if the subsumed sets are critical more often than they are not, // check the "normal" sets first. for (int i = 0; i < setsToCheck.Count; ++i) { var set = setsToCheck[i]; if (subsumedSets.Contains(set)) { setsToCheck[i] = setsToCheck[i - delta]; setsToCheck[i - delta] = set; if (isSafe) i++; // don't move set again } } } } }
mit
C#
e0a6fb4e125c79300cc32bab0527b16a2bc5bc97
Mark ROM region for Glulx
DustinCampbell/ifvm
src/ifvm.glulx/GlulxMachine.cs
src/ifvm.glulx/GlulxMachine.cs
using System; using IFVM.Core; namespace IFVM.Glulx { public class GlulxMachine : Machine { public GlulxHeader Header { get; } public GlulxMachine(Memory memory) : base(memory) { this.Header = new GlulxHeader(memory); VerifyChecksum(memory, this.Header.Checksum); // Initial the memory should have a size equal to ExtStart. // We must expand it to EndMem. if (this.Header.ExtStart != memory.Size) { throw new InvalidOperationException($"Size expected to be {this.Header.ExtStart}"); } memory.Expand((int)this.Header.EndMem); memory.AddReadOnlyRegion(0, (int)this.Header.RamStart); } private static void VerifyChecksum(Memory memory, uint expectedValue) { var scanner = memory.CreateScanner(offset: 0); var checksum = 0u; while (scanner.CanReadNextDWord) { if (scanner.Offset == 0x20) { // Note: We don't include the checksum value from the header. scanner.SkipDWord(); } else { checksum += scanner.NextDWord(); } } if (checksum != expectedValue) { throw new InvalidOperationException("Checksum does not match."); } } } }
using System; using IFVM.Core; namespace IFVM.Glulx { public class GlulxMachine : Machine { public GlulxHeader Header { get; } public GlulxMachine(Memory memory) : base(memory) { this.Header = new GlulxHeader(memory); VerifyChecksum(memory, this.Header.Checksum); // Initial the memory should have a size equal to ExtStart. // We must expand it to EndMem. if (this.Header.ExtStart != memory.Size) { throw new InvalidOperationException($"Size expected to be {this.Header.ExtStart}"); } memory.Expand((int)this.Header.EndMem); } private static void VerifyChecksum(Memory memory, uint expectedValue) { var scanner = memory.CreateScanner(offset: 0); var checksum = 0u; while (scanner.CanReadNextDWord) { if (scanner.Offset == 0x20) { // Note: We don't include the checksum value from the header. scanner.SkipDWord(); } else { checksum += scanner.NextDWord(); } } if (checksum != expectedValue) { throw new InvalidOperationException("Checksum does not match."); } } } }
mit
C#
294aff18f86a1a83d23a1a5b366fe6db0a0bf1e2
Update ProjectContainer.IImageCache.cs
wieslawsoltes/Core2D,Core2D/Core2D,Core2D/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D,wieslawsoltes/Core2D
src/Core2D/ViewModels/Containers/ProjectContainer.IImageCache.cs
src/Core2D/ViewModels/Containers/ProjectContainer.IImageCache.cs
using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using Core2D.Renderer; namespace Core2D.Containers { public partial class ProjectContainer : BaseContainer, IImageCache { private readonly IDictionary<string, byte[]> _images = new Dictionary<string, byte[]>(); private IEnumerable<IImageKey> GetKeys() => _images.Select(i => new ImageKey() { Key = i.Key }).ToList(); [IgnoreDataMember] public IEnumerable<IImageKey> Keys => GetKeys(); public string AddImageFromFile(string path, byte[] bytes) { var name = System.IO.Path.GetFileName(path); var key = "Images\\" + name; if (_images.Keys.Contains(key)) { return key; } _images.Add(key, bytes); RaisePropertyChanged(nameof(Keys)); return key; } public void AddImage(string key, byte[] bytes) { if (_images.Keys.Contains(key)) { return; } _images.Add(key, bytes); RaisePropertyChanged(nameof(Keys)); } public byte[] GetImage(string key) { if (_images.TryGetValue(key, out byte[] bytes)) { return bytes; } else { return null; } } public void RemoveImage(string key) { _images.Remove(key); RaisePropertyChanged(nameof(Keys)); } public void PurgeUnusedImages(ICollection<string> used) { foreach (var kvp in _images.ToList()) { if (!used.Contains(kvp.Key)) { _images.Remove(kvp.Key); } } RaisePropertyChanged(nameof(Keys)); } } }
using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using Core2D.Renderer; namespace Core2D.Containers { [DataContract(IsReference = true)] public partial class ProjectContainer : BaseContainer, IImageCache { private readonly IDictionary<string, byte[]> _images = new Dictionary<string, byte[]>(); private IEnumerable<IImageKey> GetKeys() => _images.Select(i => new ImageKey() { Key = i.Key }).ToList(); [IgnoreDataMember] public IEnumerable<IImageKey> Keys => GetKeys(); public string AddImageFromFile(string path, byte[] bytes) { var name = System.IO.Path.GetFileName(path); var key = "Images\\" + name; if (_images.Keys.Contains(key)) { return key; } _images.Add(key, bytes); RaisePropertyChanged(nameof(Keys)); return key; } public void AddImage(string key, byte[] bytes) { if (_images.Keys.Contains(key)) { return; } _images.Add(key, bytes); RaisePropertyChanged(nameof(Keys)); } public byte[] GetImage(string key) { if (_images.TryGetValue(key, out byte[] bytes)) { return bytes; } else { return null; } } public void RemoveImage(string key) { _images.Remove(key); RaisePropertyChanged(nameof(Keys)); } public void PurgeUnusedImages(ICollection<string> used) { foreach (var kvp in _images.ToList()) { if (!used.Contains(kvp.Key)) { _images.Remove(kvp.Key); } } RaisePropertyChanged(nameof(Keys)); } } }
mit
C#
6516dac27181a9a44c7361caa56d435cc41e822e
Fix bug with LastWiki
Brijen/lastfm,realworld666/lastfm
src/IF.Lastfm.Core/Objects/LastWiki.cs
src/IF.Lastfm.Core/Objects/LastWiki.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json.Linq; namespace IF.Lastfm.Core.Objects { public class LastWiki : ILastfmObject { #region Properties public DateTime Published { get; set; } public string Summary { get; set; } public string Content { get; set; } public int YearFormed { get; set; } #endregion internal static LastWiki ParseJToken(JToken token) { var wiki = new LastWiki { Summary = token.Value<string>("summary").Trim(), Content = token.Value<string>("content").Trim(), YearFormed = token.Value<int>("yearformed") }; try { wiki.Published = token.Value<DateTime>("published"); } catch { } return wiki; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Newtonsoft.Json.Linq; namespace IF.Lastfm.Core.Objects { public class LastWiki : ILastfmObject { #region Properties public DateTime Published { get; set; } public string Summary { get; set; } public string Content { get; set; } public int YearFormed { get; set; } #endregion internal static LastWiki ParseJToken(JToken token) { return new LastWiki { Published = token.Value<DateTime>("published"), Summary = token.Value<string>("summary").Trim(), Content = token.Value<string>("content").Trim(), YearFormed = token.Value<int>("yearformed") }; } } }
mit
C#
9f1689251ad126db5ba2faa3b47f4d602423d9e8
Update AssemblyInfo.cs
BaamStudios/SharpAngie,BaamStudios/SharpAngie,BaamStudios/SharpAngie
BaamStudios.SharpAngieDemo/Properties/AssemblyInfo.cs
BaamStudios.SharpAngieDemo/Properties/AssemblyInfo.cs
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // 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("BaamStudios.SharpAngieDemo")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("BaamStudios")] [assembly: AssemblyProduct("BaamStudios.SharpAngieDemo")] [assembly: AssemblyCopyright("Copyright © BaamStudios 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // 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("BaamStudios.SharpAngieDemo")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("hannover re")] [assembly: AssemblyProduct("BaamStudios.SharpAngieDemo")] [assembly: AssemblyCopyright("Copyright © hannover re 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
9a4e14569bba51cefc427f4d76875066808c33e1
Remove the Copy to Output Directory file property
DartVS/DartVS,DartVS/DartVS,DartVS/DartVS,modulexcite/DartVS,modulexcite/DartVS,modulexcite/DartVS
DanTup.DartVS.Vsix/ProjectSystem/DartFileNodeProperties.cs
DanTup.DartVS.Vsix/ProjectSystem/DartFileNodeProperties.cs
namespace DanTup.DartVS.ProjectSystem { using System.ComponentModel; using System.Runtime.InteropServices; using Microsoft.VisualStudio.Project; using prjBuildAction = VSLangProj.prjBuildAction; [ComVisible(true)] public class DartFileNodeProperties : FileNodeProperties { public DartFileNodeProperties(DartFileNode node) : base(node) { } [Browsable(false)] public override prjBuildAction BuildAction { get { return base.BuildAction; } set { base.BuildAction = value; } } [Browsable(false)] public override CopyToOutputDirectoryBehavior CopyToOutputDirectory { get { return base.CopyToOutputDirectory; } set { base.CopyToOutputDirectory = value; } } } }
namespace DanTup.DartVS.ProjectSystem { using System.ComponentModel; using System.Runtime.InteropServices; using Microsoft.VisualStudio.Project; using prjBuildAction = VSLangProj.prjBuildAction; [ComVisible(true)] public class DartFileNodeProperties : FileNodeProperties { public DartFileNodeProperties(DartFileNode node) : base(node) { } [Browsable(false)] public override prjBuildAction BuildAction { get { return base.BuildAction; } set { base.BuildAction = value; } } public override CopyToOutputDirectoryBehavior CopyToOutputDirectory { get { return base.CopyToOutputDirectory; } set { if (Node.ItemNode.IsVirtual && value != CopyToOutputDirectoryBehavior.DoNotCopy) { Node.ItemNode = Node.ProjectManager.AddFileToMSBuild(Node.VirtualNodeName, ProjectFileConstants.Content, null); } base.CopyToOutputDirectory = value; } } } }
mit
C#
d2f5cd6f28096dc736ddc1276e2c33a81f1bc608
Update ITableService.cs
tamasflamich/nmemory
Main/Source/NMemory.Shared/Services/Contracts/ITableService.cs
Main/Source/NMemory.Shared/Services/Contracts/ITableService.cs
// ---------------------------------------------------------------------------------- // <copyright file="ITableService.cs" company="NMemory Team"> // Copyright (C) NMemory Team // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // </copyright> // ---------------------------------------------------------------------------------- namespace NMemory.Services.Contracts { using NMemory.Indexes; using NMemory.Modularity; using NMemory.Tables; public interface ITableService { Table<TEntity, TPrimaryKey> CreateTable<TEntity, TPrimaryKey>( IKeyInfo<TEntity, TPrimaryKey> primaryKey, IdentitySpecification<TEntity> identitySpecification, IDatabase database) where TEntity : class; Table<TEntity, TPrimaryKey> CreateTable<TEntity, TPrimaryKey>( IKeyInfo<TEntity, TPrimaryKey> primaryKey, IdentitySpecification<TEntity> identitySpecification, IDatabase database, object tableInfo) where TEntity : class; } }
// ---------------------------------------------------------------------------------- // <copyright file="ITableService.cs" company="NMemory Team"> // Copyright (C) NMemory Team // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // </copyright> // ---------------------------------------------------------------------------------- namespace NMemory.Services.Contracts { using NMemory.Indexes; using NMemory.Modularity; using NMemory.Tables; public interface ITableService { Table<TEntity, TPrimaryKey> CreateTable<TEntity, TPrimaryKey>( IKeyInfo<TEntity, TPrimaryKey> primaryKey, IdentitySpecification<TEntity> identitySpecification, IDatabase database) where TEntity : class; Table<TEntity, TPrimaryKey> CreateTable<TEntity, TPrimaryKey>( IKeyInfo<TEntity, TPrimaryKey> primaryKey, IdentitySpecification<TEntity> identitySpecification, IDatabase database, object tableInfo = null ) where TEntity : class; } }
mit
C#
89005b69c1216bd93a5a972d4c77704916fcee2d
Fix mutation
ASP-NET-MVC-Boilerplate/Templates,ASP-NET-MVC-Boilerplate/Templates
Source/GraphQLTemplate/Source/GraphQLTemplate/Schemas/MutationObject.cs
Source/GraphQLTemplate/Source/GraphQLTemplate/Schemas/MutationObject.cs
namespace GraphQLTemplate.Schemas { using GraphQLTemplate.Resolvers; using HotChocolate.Types; /// <summary> /// All mutations defined in the schema used to modify data. /// </summary> /// <example> /// This is an example mutation to create a new human. /// <c> /// mutation createHuman($humanInput: HumanInput!) { /// createHuman(humanInput: $humanInput) /// { /// id /// name /// dateOfBirth /// appearsIn /// } /// } /// This is an example JSON of the variables you also need to specify to create a new human: /// { /// "humanInput": { /// "name": "Muhammad Rehan Saeed", /// "homePlanet": "Earth", /// "dateOfBirth": "2000-01-01", /// "appearsIn": [ "NEWHOPE" ] /// } /// } /// </c> /// These can be customized by the client. /// </example> public class MutationObject : ObjectType<MutationResolvers> { protected override void Configure(IObjectTypeDescriptor<MutationResolvers> descriptor) { descriptor .Name("Mutation") .Description("The mutation type, represents all updates we can make to our data."); descriptor .Field(x => x.CreateHumanAsync(default!, default!)) .Description("Create a new human.") .Argument("humanInput", x => x.Description("The human you want to create.")); } } }
namespace GraphQLTemplate.Schemas { using GraphQLTemplate.Resolvers; using HotChocolate.Types; /// <summary> /// All mutations defined in the schema used to modify data. /// </summary> /// <example> /// This is an example mutation to create a new human. /// <c> /// mutation createHuman($human: HumanInput!) { /// createHuman(human: $human) /// { /// id /// name /// dateOfBirth /// appearsIn /// } /// } /// This is an example JSON of the variables you also need to specify to create a new human: /// { /// "human": { /// "name": "Muhammad Rehan Saeed", /// "homePlanet": "Earth", /// "dateOfBirth": "2000-01-01", /// "appearsIn": [ "NEWHOPE" ] /// } /// } /// </c> /// These can be customized by the client. /// </example> public class MutationObject : ObjectType<MutationResolvers> { protected override void Configure(IObjectTypeDescriptor<MutationResolvers> descriptor) { descriptor .Name("Mutation") .Description("The mutation type, represents all updates we can make to our data."); descriptor .Field(x => x.CreateHumanAsync(default!, default!)) .Description("Create a new human.") .Argument("human", x => x.Description("The human you want to create.")); } } }
mit
C#
97c583798a6f4aaa618db1b16087f0f81c3195e4
Update Address_Functions.cs
NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework,NakedObjectsGroup/NakedObjectsFramework
Test/AdventureWorksFunctionalModel/Person/Address_Functions.cs
Test/AdventureWorksFunctionalModel/Person/Address_Functions.cs
// Copyright Naked Objects Group Ltd, 45 Station Road, Henley on Thames, UK, RG9 1AT // 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.Collections.Generic; using System.Linq; using NakedFunctions; using AW.Types; using System; namespace AW.Functions { public static class Address_Functions { #region LifeCycle methods public static Address Updating(Address x, IContext context) => x with { ModifiedDate = context.Now() }; public static Address Persisting(Address x, IContext context) => x with { rowguid = context.NewGuid(), ModifiedDate = context.Now() }; //Any object or list returned by Persisted (or Updated), is not for display but to be persisted/updated //themselves (equivalent to second Tuple value returned from an Action). public static BusinessEntityAddress Persisted(Address x, IContext context) => throw new NotImplementedException(); //=> new BusinessEntityAddress() with { Address = x.AddressF, AddressTypeID = x.AddressTypeID, BusinessEntityID = x.AddressForID, rowguid = context.NewGuid(), ModifiedDate = context.Now() }; #endregion #region Property-associated functions public static string Validate(this Address a, CountryRegion countryRegion, StateProvince stateProvince, IQueryable<StateProvince> allProvinces) => StateProvincesForCountry(countryRegion, allProvinces).Contains(stateProvince) ? null : "Invalid region"; public static IList<StateProvince> ChoicesStateProvince(this Address a, CountryRegion countryRegion, IQueryable<StateProvince> allProvinces) => countryRegion != null ? StateProvincesForCountry(countryRegion, allProvinces) : new List<StateProvince>(); private static IList<StateProvince> StateProvincesForCountry(this CountryRegion country, IQueryable<StateProvince> provinces) => provinces.Where(p => p.CountryRegion.CountryRegionCode == country.CountryRegionCode).OrderBy(p => p.Name).ToList(); #endregion } }
// Copyright Naked Objects Group Ltd, 45 Station Road, Henley on Thames, UK, RG9 1AT // 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.Collections.Generic; using System.Linq; using NakedFunctions; using AW.Types; namespace AW.Functions { public static class Address_Functions { #region LifeCycle methods public static Address Updating(Address x, IContext context) => x with { ModifiedDate = context.Now() }; public static Address Persisting(Address x, IContext context) => x with { rowguid = context.NewGuid(), ModifiedDate = context.Now() }; //Any object or list returned by Persisted (or Updated), is not for display but to be persisted/updated //themselves (equivalent to second Tuple value returned from an Action). public static BusinessEntityAddress Persisted(Address x, IContext context) => new BusinessEntityAddress() with { AddressID = x.AddressForID, AddressTypeID = x.AddressTypeID, BusinessEntityID = x.AddressForID, rowguid = context.NewGuid(), ModifiedDate = context.Now() }; #endregion #region Property-associated functions public static string Validate(this Address a, CountryRegion countryRegion, StateProvince stateProvince, IQueryable<StateProvince> allProvinces) => StateProvincesForCountry(countryRegion, allProvinces).Contains(stateProvince) ? null : "Invalid region"; public static IList<StateProvince> ChoicesStateProvince(this Address a, CountryRegion countryRegion, IQueryable<StateProvince> allProvinces) => countryRegion != null ? StateProvincesForCountry(countryRegion, allProvinces) : new List<StateProvince>(); private static IList<StateProvince> StateProvincesForCountry(this CountryRegion country, IQueryable<StateProvince> provinces) => provinces.Where(p => p.CountryRegion.CountryRegionCode == country.CountryRegionCode).OrderBy(p => p.Name).ToList(); #endregion } }
apache-2.0
C#
d47fe0280355cdd768e5b837039650b0861dc13e
Order pages by title in dropdown
codevlabs/DirigoEdge,justincolangelo/EdgeInstallerTest,justincolangelo/EdgeInstallerTest,codevlabs/DirigoEdge,justincolangelo/EdgeInstallerTest,codevlabs/DirigoEdge,justincolangelo/EdgeInstallerTest,justincolangelo/EdgeInstallerTest,codevlabs/DirigoEdge,codevlabs/DirigoEdge
DirigoEdge/Areas/Admin/Models/ViewModels/RedirectViewModel.cs
DirigoEdge/Areas/Admin/Models/ViewModels/RedirectViewModel.cs
using System.Collections.Generic; using System.Linq; using DirigoEdgeCore.Data.Entities; using DirigoEdgeCore.Models; public class RedirectViewModel : DirigoBaseModel { public List<Redirect> Redirects; public List<string> Pages = new List<string>(); public RedirectViewModel() { BookmarkTitle = "Configure Redirects"; Redirects = Context.Redirects.ToList(); var pages = Context.ContentPages.Where(x => x.IsActive == true).OrderBy(x => x.Title).ToList(); foreach (var page in pages) { Pages.Add(NavigationUtils.GetGeneratedUrl(page)); } } }
using System.Collections.Generic; using System.Linq; using DirigoEdgeCore.Data.Entities; using DirigoEdgeCore.Models; public class RedirectViewModel : DirigoBaseModel { public List<Redirect> Redirects; public List<string> Pages = new List<string>(); public RedirectViewModel() { BookmarkTitle = "Configure Redirects"; Redirects = Context.Redirects.ToList(); var pages = Context.ContentPages.Where(x => x.IsActive == true).ToList(); foreach (var page in pages) { Pages.Add(NavigationUtils.GetGeneratedUrl(page)); } } }
mit
C#
dbea6d4ceed7504ff104683efcdf316d3c712d47
Remove unused using
peppy/osu,smoogipoo/osu,smoogipoo/osu,smoogipoo/osu,NeoAdonis/osu,UselessToucan/osu,NeoAdonis/osu,UselessToucan/osu,peppy/osu-new,smoogipooo/osu,NeoAdonis/osu,peppy/osu,peppy/osu,UselessToucan/osu,ppy/osu,ppy/osu,ppy/osu
osu.Game/Tests/Visual/Multiplayer/MultiplayerTestScene.cs
osu.Game/Tests/Visual/Multiplayer/MultiplayerTestScene.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 NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Online.Multiplayer; using osu.Game.Screens.OnlinePlay; using osu.Game.Screens.OnlinePlay.Lounge.Components; namespace osu.Game.Tests.Visual.Multiplayer { public abstract class MultiplayerTestScene : RoomTestScene { [Cached(typeof(StatefulMultiplayerClient))] public TestMultiplayerClient Client { get; } [Cached(typeof(IRoomManager))] public TestMultiplayerRoomManager RoomManager { get; } [Cached] public Bindable<FilterCriteria> Filter { get; } [Cached] public OngoingOperationTracker OngoingOperationTracker { get; } protected override Container<Drawable> Content => content; private readonly TestMultiplayerRoomContainer content; private readonly bool joinRoom; protected MultiplayerTestScene(bool joinRoom = true) { this.joinRoom = joinRoom; base.Content.Add(content = new TestMultiplayerRoomContainer { RelativeSizeAxes = Axes.Both }); Client = content.Client; RoomManager = content.RoomManager; Filter = content.Filter; OngoingOperationTracker = content.OngoingOperationTracker; } [SetUp] public new void Setup() => Schedule(() => { RoomManager.Schedule(() => RoomManager.PartRoom()); if (joinRoom) RoomManager.Schedule(() => RoomManager.CreateRoom(Room)); }); public override void SetUpSteps() { base.SetUpSteps(); if (joinRoom) AddUntilStep("wait for room join", () => Client.Room != null); } } }
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Testing; using osu.Game.Online.Multiplayer; using osu.Game.Screens.OnlinePlay; using osu.Game.Screens.OnlinePlay.Lounge.Components; namespace osu.Game.Tests.Visual.Multiplayer { public abstract class MultiplayerTestScene : RoomTestScene { [Cached(typeof(StatefulMultiplayerClient))] public TestMultiplayerClient Client { get; } [Cached(typeof(IRoomManager))] public TestMultiplayerRoomManager RoomManager { get; } [Cached] public Bindable<FilterCriteria> Filter { get; } [Cached] public OngoingOperationTracker OngoingOperationTracker { get; } protected override Container<Drawable> Content => content; private readonly TestMultiplayerRoomContainer content; private readonly bool joinRoom; protected MultiplayerTestScene(bool joinRoom = true) { this.joinRoom = joinRoom; base.Content.Add(content = new TestMultiplayerRoomContainer { RelativeSizeAxes = Axes.Both }); Client = content.Client; RoomManager = content.RoomManager; Filter = content.Filter; OngoingOperationTracker = content.OngoingOperationTracker; } [SetUp] public new void Setup() => Schedule(() => { RoomManager.Schedule(() => RoomManager.PartRoom()); if (joinRoom) RoomManager.Schedule(() => RoomManager.CreateRoom(Room)); }); public override void SetUpSteps() { base.SetUpSteps(); if (joinRoom) AddUntilStep("wait for room join", () => Client.Room != null); } } }
mit
C#
0d9abdc5db596c334a015431d9b603a5ff6cab98
disable voting on unauthorized user
army-of-two/when-its-done,army-of-two/when-its-done,army-of-two/when-its-done
WhenItsDone/Clients/WhenItsDone.WebFormsClient/Details.aspx.cs
WhenItsDone/Clients/WhenItsDone.WebFormsClient/Details.aspx.cs
using System; using WebFormsMvp; using WebFormsMvp.Web; using WhenItsDone.MVP.DetailsMVP; namespace WhenItsDone.WebFormsClient { [PresenterBinding(typeof(IDetailsPresenter))] public partial class Details : MvpPage<DetailsViewModel>, IDetailsView { public event EventHandler<DetailsGetDishDetailsEventArgs> OnGetDishDetails; public event EventHandler<DetailsRatingVoteEventArgs> OnLikeVote; public event EventHandler<DetailsRatingVoteEventArgs> OnDislikeVote; protected override void OnLoad(EventArgs e) { base.OnLoad(e); this.EnableVotingOnLoggedUser(); var itemid = this.Request.QueryString["itemid"]; var detailsGetDishDetailsEventArgs = new DetailsGetDishDetailsEventArgs(itemid); this.OnGetDishDetails?.Invoke(null, detailsGetDishDetailsEventArgs); } public void OnLikeLinkButtonClick(object sender, EventArgs e) { var detailsRatingVoteEventArgs = this.CreateDetailsRatingVoteEventArgs(); this.OnLikeVote?.Invoke(null, detailsRatingVoteEventArgs); } public void OnDislikeLinkButtonClick(object sender, EventArgs e) { var detailsRatingVoteEventArgs = this.CreateDetailsRatingVoteEventArgs(); this.OnDislikeVote?.Invoke(null, detailsRatingVoteEventArgs); } private DetailsRatingVoteEventArgs CreateDetailsRatingVoteEventArgs() { var dishId = this.DishIdHiddenField.Value; var detailsRatingVoteEventArgs = new DetailsRatingVoteEventArgs(dishId); return detailsRatingVoteEventArgs; } private void EnableVotingOnLoggedUser() { if (!this.Page.User.Identity.IsAuthenticated) { this.LikeLinkButton.Enabled = false; this.LikeLinkButton.CssClass += " disabled"; this.DislikeLinkButton.Enabled = false; this.DislikeLinkButton.CssClass += "disabled"; } } } }
using System; using WebFormsMvp; using WebFormsMvp.Web; using WhenItsDone.MVP.DetailsMVP; namespace WhenItsDone.WebFormsClient { [PresenterBinding(typeof(IDetailsPresenter))] public partial class Details : MvpPage<DetailsViewModel>, IDetailsView { public event EventHandler<DetailsGetDishDetailsEventArgs> OnGetDishDetails; public event EventHandler<DetailsRatingVoteEventArgs> OnLikeVote; public event EventHandler<DetailsRatingVoteEventArgs> OnDislikeVote; protected override void OnLoad(EventArgs e) { base.OnLoad(e); var itemid = this.Request.QueryString["itemid"]; var detailsGetDishDetailsEventArgs = new DetailsGetDishDetailsEventArgs(itemid); this.OnGetDishDetails?.Invoke(null, detailsGetDishDetailsEventArgs); } public void OnLikeLinkButtonClick(object sender, EventArgs e) { var detailsRatingVoteEventArgs = this.CreateDetailsRatingVoteEventArgs(); this.OnLikeVote?.Invoke(null, detailsRatingVoteEventArgs); } public void OnDislikeLinkButtonClick(object sender, EventArgs e) { var detailsRatingVoteEventArgs = this.CreateDetailsRatingVoteEventArgs(); this.OnDislikeVote?.Invoke(null, detailsRatingVoteEventArgs); } private DetailsRatingVoteEventArgs CreateDetailsRatingVoteEventArgs() { var dishId = this.DishIdHiddenField.Value; var detailsRatingVoteEventArgs = new DetailsRatingVoteEventArgs(dishId); return detailsRatingVoteEventArgs; } } }
mit
C#
da6db934b70498a1207749cc7be606bf4fc141a8
Remove unused MissingAuthID method.
sitofabi/duplicati,duplicati/duplicati,duplicati/duplicati,mnaiman/duplicati,sitofabi/duplicati,mnaiman/duplicati,mnaiman/duplicati,mnaiman/duplicati,sitofabi/duplicati,mnaiman/duplicati,sitofabi/duplicati,sitofabi/duplicati,duplicati/duplicati,duplicati/duplicati,duplicati/duplicati
Duplicati/Library/Backend/AmazonCloudDrive/Strings.cs
Duplicati/Library/Backend/AmazonCloudDrive/Strings.cs
// Copyright (C) 2015, The Duplicati Team // http://www.duplicati.com, info@duplicati.com // // This library is free software; you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as // published by the Free Software Foundation; either version 2.1 of the // License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA using Duplicati.Library.Localization.Short; namespace Duplicati.Library.Backend.Strings { internal static class AmzCD { public static string Description { get { return LC.L(@"This backend can read and write data to Amazon Cloud Drive. Supported format is ""amzcd://folder/subfolder""."); } } public static string AuthidShort { get { return LC.L(@"The authorization code"); } } public static string AuthidLong(string url) { return LC.L(@"The authorization token retrieved from {0}", url); } public static string DisplayName { get { return LC.L(@"Amazon Cloud Drive"); } } public static string LabelsShort { get { return LC.L(@"The labels to set"); } } public static string LabelsLong { get { return LC.L(@"Use this option to set labels on the files and folders created"); } } public static string MultipleEntries(string folder, string parent) { return LC.L(@"There is more than one item named ""{0}"" in the folder ""{1}""", folder, parent); } public static string DelayShort { get { return LC.L(@"The consistency delay"); } } public static string DelayLong { get { return LC.L(@"Amazon Cloud drive needs a small delay for results to stay consistent."); } } } }
// Copyright (C) 2015, The Duplicati Team // http://www.duplicati.com, info@duplicati.com // // This library is free software; you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as // published by the Free Software Foundation; either version 2.1 of the // License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA using Duplicati.Library.Localization.Short; namespace Duplicati.Library.Backend.Strings { internal static class AmzCD { public static string Description { get { return LC.L(@"This backend can read and write data to Amazon Cloud Drive. Supported format is ""amzcd://folder/subfolder""."); } } public static string AuthidShort { get { return LC.L(@"The authorization code"); } } public static string AuthidLong(string url) { return LC.L(@"The authorization token retrieved from {0}", url); } public static string DisplayName { get { return LC.L(@"Amazon Cloud Drive"); } } public static string MissingAuthID(string url) { return LC.L(@"You need an AuthID, you can get it from: {0}", url); } public static string LabelsShort { get { return LC.L(@"The labels to set"); } } public static string LabelsLong { get { return LC.L(@"Use this option to set labels on the files and folders created"); } } public static string MultipleEntries(string folder, string parent) { return LC.L(@"There is more than one item named ""{0}"" in the folder ""{1}""", folder, parent); } public static string DelayShort { get { return LC.L(@"The consistency delay"); } } public static string DelayLong { get { return LC.L(@"Amazon Cloud drive needs a small delay for results to stay consistent."); } } } }
lgpl-2.1
C#
7bb0cd588d82722a9a39002836aeaff30281c933
Allow IndexName to be serialized as an object key
elastic/elasticsearch-net,elastic/elasticsearch-net
src/Nest/CommonAbstractions/Infer/IndexName/IndexNameFormatter.cs
src/Nest/CommonAbstractions/Infer/IndexName/IndexNameFormatter.cs
using Utf8Json; namespace Nest { internal class IndexNameFormatter : IJsonFormatter<IndexName>, IObjectPropertyNameFormatter<IndexName> { public IndexName Deserialize(ref JsonReader reader, IJsonFormatterResolver formatterResolver) { if (reader.GetCurrentJsonToken() != JsonToken.String) return null; IndexName indexName = reader.ReadString(); return indexName; } public void Serialize(ref JsonWriter writer, IndexName value, IJsonFormatterResolver formatterResolver) { if (value == null) { writer.WriteNull(); return; } var settings = formatterResolver.GetConnectionSettings(); var indexName = settings.Inferrer.IndexName(value); writer.WriteString(indexName); } public void SerializeToPropertyName(ref JsonWriter writer, IndexName value, IJsonFormatterResolver formatterResolver) => Serialize(ref writer, value, formatterResolver); public IndexName DeserializeFromPropertyName(ref JsonReader reader, IJsonFormatterResolver formatterResolver) => Deserialize(ref reader, formatterResolver); } }
using Utf8Json; namespace Nest { internal class IndexNameFormatter : IJsonFormatter<IndexName> { public IndexName Deserialize(ref JsonReader reader, IJsonFormatterResolver formatterResolver) { if (reader.GetCurrentJsonToken() != JsonToken.String) return null; IndexName indexName = reader.ReadString(); return indexName; } public void Serialize(ref JsonWriter writer, IndexName value, IJsonFormatterResolver formatterResolver) { if (value == null) { writer.WriteNull(); return; } var settings = formatterResolver.GetConnectionSettings(); var indexName = settings.Inferrer.IndexName(value); writer.WriteString(indexName); } } }
apache-2.0
C#
bed732285ab07b1a92a7e2aeb637ff8829658b4f
Add a test case for the non-leaky constructor
JohanLarsson/Gu.Analyzers
Gu.Analyzers.Test/GU0051XmlSerializerNotCached/HappyPath.cs
Gu.Analyzers.Test/GU0051XmlSerializerNotCached/HappyPath.cs
namespace Gu.Analyzers.Test.GU0051XmlSerializerNotCached { using System.Threading.Tasks; using NUnit.Framework; internal class HappyPath : HappyPathVerifier<Analyzers.GU0051XmlSerializerNotCached> { [Test] public async Task NoCreationsOfTheSerializer() { var testCode = @" using System; using System.Collections.Generic; using System.Xml.Serialization; public class Foo { public Foo(int a, int b, int c, int d) { for(int i = 0; i < 100; ++i) { } } }"; await this.VerifyHappyPathAsync(testCode) .ConfigureAwait(false); } [Test] public async Task CachedXmlSerializer() { var testCode = @" using System; using System.Collections.Generic; using System.Xml.Serialization; public class Foo { private static XmlSerializer serializer = new XmlSerializer(typeof(Foo), new XmlRootAttribute(""rootNode"")); public Foo(int a, int b, int c, int d) { for(int i = 0; i < 100; ++i) { } } }"; await this.VerifyHappyPathAsync(testCode) .ConfigureAwait(false); } [TestCase(@"new XmlSerializer(typeof(Foo), ""rootNode"")")] [TestCase(@"new XmlSerializer(typeof(Foo))")] public async Task NonLeakyConstructor(string code) { var testCode = @" using System; using System.Collections.Generic; using System.Xml.Serialization; public class Foo { public Foo(int a, int b, int c, int d) { for(int i = 0; i < 100; ++i) { XmlSerializer serializer = default(XmlSerializer); } } }"; testCode = testCode.AssertReplace("default(XmlSerializer)", code); await this.VerifyHappyPathAsync(testCode) .ConfigureAwait(false); } } }
namespace Gu.Analyzers.Test.GU0051XmlSerializerNotCached { using System.Threading.Tasks; using NUnit.Framework; internal class HappyPath : HappyPathVerifier<Analyzers.GU0051XmlSerializerNotCached> { [Test] public async Task NoCreationsOfTheSerializer() { var testCode = @" using System; using System.Collections.Generic; using System.Xml.Serialization; public class Foo { public Foo(int a, int b, int c, int d) { for(int i = 0; i < 100; ++i) { } } }"; await this.VerifyHappyPathAsync(testCode) .ConfigureAwait(false); } [Test] public async Task CachedXmlSerializer() { var testCode = @" using System; using System.Collections.Generic; using System.Xml.Serialization; public class Foo { private static XmlSerializer serializer = new XmlSerializer(typeof(Foo), new XmlRootAttribute(""rootNode"")); public Foo(int a, int b, int c, int d) { for(int i = 0; i < 100; ++i) { } } }"; await this.VerifyHappyPathAsync(testCode) .ConfigureAwait(false); } } }
mit
C#
3ab47cef377042e4e472dbe6f3889eaa040a508b
Remove other_files message box from the region selector
OatmealDome/SplatoonUtilities
MusicRandomizer/MusicRandomizer/VersionRequestForm.cs
MusicRandomizer/MusicRandomizer/VersionRequestForm.cs
using System; using System.IO; using System.Windows.Forms; namespace MusicRandomizer { public partial class VersionRequestForm : Form { public SplatoonRegion chosenRegion; public VersionRequestForm() { InitializeComponent(); } private void VersionRequestForm_Load(object sender, EventArgs e) { } private void btnSave_Click(object sender, EventArgs e) { if (!radNorthAmerica.Checked && !radEurope.Checked && !radJapan.Checked) { MessageBox.Show("Please choose a region."); return; } if (radNorthAmerica.Checked) { chosenRegion = SplatoonRegion.NorthAmerica; } else if (radEurope.Checked) { chosenRegion = SplatoonRegion.Europe; } else { chosenRegion = SplatoonRegion.Japan; } this.Close(); } } }
using System; using System.IO; using System.Windows.Forms; namespace MusicRandomizer { public partial class VersionRequestForm : Form { public SplatoonRegion chosenRegion; public VersionRequestForm() { InitializeComponent(); } private void VersionRequestForm_Load(object sender, EventArgs e) { } private void btnSave_Click(object sender, EventArgs e) { if (!radNorthAmerica.Checked && !radEurope.Checked && !radJapan.Checked) { MessageBox.Show("Please choose a region."); return; } if (Directory.Exists("other_files")) { MessageBox.Show("The files inside other_files will be moved to a new folder called cafiine_root."); } if (radNorthAmerica.Checked) { chosenRegion = SplatoonRegion.NorthAmerica; } else if (radEurope.Checked) { chosenRegion = SplatoonRegion.Europe; } else { chosenRegion = SplatoonRegion.Japan; } this.Close(); } } }
mit
C#
1d580a06800b200a7069f6135cb3e255121adc4e
Rename BigEndian to IsBigEndian
terrafx/terrafx
sources/Audio/IAudioAdapter.cs
sources/Audio/IAudioAdapter.cs
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. using System; namespace TerraFX.Audio { /// <summary>An interface representing an audio adapter.</summary> public interface IAudioAdapter { /// <summary>The type of device this adapter represents.</summary> AudioDeviceType DeviceType { get; set; } /// <summary>The name of the adapter.</summary> string Name { get; set; } /// <summary>The sample rate the adapter operates at.</summary> int SampleRate { get; set; } /// <summary>The number of bits in each sample this adapter operates at.</summary> int BitDepth { get; set; } /// <summary>The number of channels this adapter operates at.</summary> int Channels { get; set; } /// <summary>The endianness of the adapter.</summary> /// <remarks> /// If the adapter operates in big endian mode (MSB first), this will be <code>true</code>. /// If it operates in little endian mode (LSB first), this will be <code>false</code>. /// </remarks> bool IsBigEndian { get; set; } } }
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information. using System; namespace TerraFX.Audio { /// <summary>An interface representing an audio adapter.</summary> public interface IAudioAdapter { /// <summary>The type of device this adapter represents.</summary> AudioDeviceType DeviceType { get; set; } /// <summary>The name of the adapter.</summary> string Name { get; set; } /// <summary>The sample rate the adapter operates at.</summary> int SampleRate { get; set; } /// <summary>The number of bits in each sample this adapter operates at.</summary> int BitDepth { get; set; } /// <summary>The number of channels this adapter operates at.</summary> int Channels { get; set; } /// <summary>The endianness of the adapter.</summary> /// <remarks> /// If the adapter operates in big endian mode (MSB first), this will be <code>true</code>. /// If it operates in little endian mode (LSB first), this will be <code>false</code>. /// </remarks> bool BigEndian { get; set; } } }
mit
C#
af39c8ed8df4d6a8d6239928e9c5402c198fe105
Update app version
omniSpectrum/omniBill
appCS/omniBill/Properties/AssemblyInfo.cs
appCS/omniBill/Properties/AssemblyInfo.cs
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // 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("omniBill")] [assembly: AssemblyDescription("Invoice system")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("omniSpectrum")] [assembly: AssemblyProduct("omniBill")] [assembly: AssemblyCopyright("Copyright © omniSpectrum 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // 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.8.0.*")] // LEFT 20 = printing (80) [assembly: AssemblyFileVersion("1.0.0.0")]
using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows; // 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("omniBill")] [assembly: AssemblyDescription("Invoice system")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("omniSpectrum")] [assembly: AssemblyProduct("omniBill")] [assembly: AssemblyCopyright("Copyright © omniSpectrum 2014")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] //In order to begin building localizable applications, set //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file //inside a <PropertyGroup>. For example, if you are using US english //in your source files, set the <UICulture> to en-US. Then uncomment //the NeutralResourceLanguage attribute below. Update the "en-US" in //the line below to match the UICulture setting in the project file. //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, // or application resource dictionaries) ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) )] // 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.6.5.*")] // LEFT 20 = printing (80) // 10 = invoice (70) // 5 = menu (65) [assembly: AssemblyFileVersion("1.0.0.0")]
epl-1.0
C#
1d0a4447f6ae20c5b2a21aef19ca1c3b71b95ad4
Fix doc string
MarinAtanasov/AppBrix,MarinAtanasov/AppBrix.NetCore
Modules/AppBrix.Web.Client/Configuration/WebClientConfig.cs
Modules/AppBrix.Web.Client/Configuration/WebClientConfig.cs
// Copyright (c) MarinAtanasov. All rights reserved. // Licensed under the MIT License (MIT). See License.txt in the project root for license information. // using AppBrix.Configuration; using System; namespace AppBrix.Web.Client.Configuration { /// <summary> /// Configures the web client. /// </summary> public sealed class WebClientConfig : IConfig { #region Construction /// <summary> /// Creates a new instance of <see cref="WebClientConfig"/> with default values for the properties. /// </summary> public WebClientConfig() { this.MaxConnectionsPerServer = 128; this.RequestTimeout = TimeSpan.FromMinutes(5); } #endregion #region Properties /// <summary> /// Gets or sets the maximum connections per server. /// </summary> public int MaxConnectionsPerServer { get; set; } /// <summary> /// Gets or sets the timeout used when making HTTP requests. /// </summary> public TimeSpan RequestTimeout { get; set; } #endregion } }
// Copyright (c) MarinAtanasov. All rights reserved. // Licensed under the MIT License (MIT). See License.txt in the project root for license information. // using AppBrix.Configuration; using System; namespace AppBrix.Web.Client.Configuration { /// <summary> /// Configures the web client. /// </summary> public sealed class WebClientConfig : IConfig { #region Construction /// <summary> /// Creates a new instance of <see cref="WebClientConfig"/> with default values for the properties. /// </summary> public WebClientConfig() { this.MaxConnectionsPerServer = 128; this.RequestTimeout = TimeSpan.FromMinutes(5); } #endregion #region Properties /// <summary> /// Gets or sets the timeout used when making HTTP requests. /// </summary> public int MaxConnectionsPerServer { get; set; } /// <summary> /// Gets or sets the timeout used when making HTTP requests. /// </summary> public TimeSpan RequestTimeout { get; set; } #endregion } }
mit
C#
6661135573bf484c45e20cd0422cb7979238059c
Allow category to be null in Azure SQL listener
MRCollective/AzureTraceListeners
SimpleAzureTraceListener/Listeners/AzureSqlTraceListener.cs
SimpleAzureTraceListener/Listeners/AzureSqlTraceListener.cs
using System; using System.Data; using System.Data.SqlClient; using SimpleAzureTraceListener.Listeners.Base; using SimpleAzureTraceListener.Models; namespace SimpleAzureTraceListener.Listeners { public class AzureSqlTraceListener : AzureTraceListener { private readonly string _tableName; private readonly SqlConnection _connection; public AzureSqlTraceListener(string applicationName, string sqlConnectionString, string tableName = "TraceLogs") { _tableName = tableName; ApplicationName = applicationName; _connection = new SqlConnection(sqlConnectionString); _connection.Open(); } protected override void SaveMessage(AzureTraceMessage azureTraceMessage) { using (var command = _connection.CreateCommand()) { command.CommandText = string.Format(@"INSERT INTO {0} (ApplicationName, Message, Category, Timestamp) VALUES (@applicationName, @message, @category, @timeStamp)", _tableName); command.Parameters.Add(new SqlParameter("applicationName", SqlDbType.NVarChar) { Value = azureTraceMessage.ApplicationName }); command.Parameters.Add(new SqlParameter("message", SqlDbType.NVarChar) { Value = azureTraceMessage.Message }); command.Parameters.Add(new SqlParameter("category", SqlDbType.NVarChar) { IsNullable = true, Value = azureTraceMessage.Category ?? (object) DBNull.Value }); command.Parameters.Add(new SqlParameter("timeStamp", SqlDbType.DateTime2) { Value = azureTraceMessage.Timestamp }); command.ExecuteNonQuery(); } } } }
using System.Data; using System.Data.SqlClient; using SimpleAzureTraceListener.Listeners.Base; using SimpleAzureTraceListener.Models; namespace SimpleAzureTraceListener.Listeners { public class AzureSqlTraceListener : AzureTraceListener { private readonly string _tableName; private readonly SqlConnection _connection; public AzureSqlTraceListener(string applicationName, string sqlConnectionString, string tableName = "TraceLogs") { _tableName = tableName; ApplicationName = applicationName; _connection = new SqlConnection(sqlConnectionString); _connection.Open(); } protected override void SaveMessage(AzureTraceMessage azureTraceMessage) { using (var command = _connection.CreateCommand()) { command.CommandText = string.Format(@"INSERT INTO {0} (ApplicationName, Message, Category, Timestamp) VALUES (@applicationName, @message, @category, @timeStamp)", _tableName); command.Parameters.Add(new SqlParameter("applicationName", SqlDbType.NVarChar) { Value = azureTraceMessage.ApplicationName }); command.Parameters.Add(new SqlParameter("message", SqlDbType.NVarChar) { Value = azureTraceMessage.Message }); command.Parameters.Add(new SqlParameter("category", SqlDbType.NVarChar) { Value = azureTraceMessage.Category }); command.Parameters.Add(new SqlParameter("timeStamp", SqlDbType.DateTime2) { Value = azureTraceMessage.Timestamp }); command.ExecuteNonQuery(); } } } }
mit
C#
3a2e79aa89fc1aa59b9233b3341ac6bb2df251de
check that the binding works and that the right values are used
jgraber/Blog_Snippets,jgraber/Blog_Snippets,jgraber/Blog_Snippets,jgraber/Blog_Snippets
SpecFlowExamples/Specification/CodeStyle/CodeSteps.cs
SpecFlowExamples/Specification/CodeStyle/CodeSteps.cs
namespace Specification.CodeStyle { using System; using TechTalk.SpecFlow; [Binding] public class CodeSteps { [Given(@"I navigate to (.*)")] public void GivenINavigateToHttpLocalhostPersonCreate(string url) { Console.WriteLine(url); } [Given(@"I enter (.*) into the input with an ID of (.*)")] public void GivenIEnterSherlockIntoTheInputWithAnIDOfFirstName(string name, string field) { Console.WriteLine(name); Console.WriteLine(field); } [When(@"I click the element with a CSS selector of (.*)")] public void WhenIClickTheElementWithACSSSelectorOf_Btn_Btn_Primary(string selector) { Console.WriteLine(selector); } [Then(@"the div with a ID of (.*) should contain the text (.*)")] public void ThenTheDivWithAIDOfAlertAlert_SuccessShouldContainTheTextSherlock(string p0, string p1) { Console.WriteLine(p0); Console.WriteLine(p1); } } }
namespace Specification.CodeStyle { using TechTalk.SpecFlow; [Binding] public class CodeSteps { [Given(@"I navigate to (.*)")] public void GivenINavigateToHttpLocalhostPersonCreate(int p0) { ScenarioContext.Current.Pending(); } [Given(@"I enter (.*) into the input with an ID of (.*)")] public void GivenIEnterSherlockIntoTheInputWithAnIDOfFirstName(string name, string field) { ScenarioContext.Current.Pending(); } [When(@"I click the element with a CSS selector of (.*)")] public void WhenIClickTheElementWithACSSSelectorOf_Btn_Btn_Primary(string selector) { ScenarioContext.Current.Pending(); } [Then(@"the div with a ID of (.*) should contain the text (.*)")] public void ThenTheDivWithAIDOfAlertAlert_SuccessShouldContainTheTextSherlock(string selector, string text) { ScenarioContext.Current.Pending(); } } }
apache-2.0
C#
9151118c5375897040fa65dfe38bff19add2257e
rename property
tmk907/UWPMusicPlayerExtensions
UWPMusicPlayerExtensions/AvailableExtensionsHelper.cs
UWPMusicPlayerExtensions/AvailableExtensionsHelper.cs
using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Threading.Tasks; using Windows.Web.Http; namespace UWPMusicPlayerExtensions { public class AvailableExtensionsHelper { public AvailableExtensionsHelper() { ExtensionsListUri = new Uri(@"https://raw.githubusercontent.com/tmk907/UWPMusicPlayerExtensions/extensions/AvailableExtensions.json"); } public Uri ExtensionsListUri { get; private set; } public async Task<List<AvailableExtension>> GetAvailableExtensions() { List<AvailableExtension> extensions = new List<AvailableExtension>(); using (HttpClient client = new HttpClient()) { try { var response = await client.GetStringAsync(ExtensionsListUri); extensions = JsonConvert.DeserializeObject<AvailableExtensions>(response).Extensions; } catch (Exception ex) { } } return extensions; } } }
using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Threading.Tasks; using Windows.Web.Http; namespace UWPMusicPlayerExtensions { public class AvailableExtensionsHelper { public AvailableExtensionsHelper() { uri = new Uri(@"https://raw.githubusercontent.com/tmk907/UWPMusicPlayerExtensions/extensions/AvailableExtensions.json"); } public Uri uri { get; private set; } public async Task<List<AvailableExtension>> GetAvailableExtensions() { List<AvailableExtension> extensions = new List<AvailableExtension>(); using (HttpClient client = new HttpClient()) { try { var response = await client.GetStringAsync(uri); extensions = JsonConvert.DeserializeObject<AvailableExtensions>(response).Extensions; } catch (Exception ex) { } } return extensions; } } }
mit
C#
c2d8426976f6ef436ac1f02429094cc81b5cfcc3
Fix possible NRE in Cards.GetFromName
HearthSim/HearthDb
HearthDb/Cards.cs
HearthDb/Cards.cs
#region using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; using System.Xml.Serialization; using HearthDb.Enums; #endregion namespace HearthDb { public static class Cards { public static readonly Dictionary<string, Card> All = new Dictionary<string, Card>(); public static readonly Dictionary<string, Card> Collectible = new Dictionary<string, Card>(); static Cards() { var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("HearthDb.CardDefs.xml"); if(stream == null) return; using(TextReader tr = new StreamReader(stream)) { var xml = new XmlSerializer(typeof(CardDefs.CardDefs)); var cardDefs = (CardDefs.CardDefs)xml.Deserialize(tr); foreach(var entity in cardDefs.Entites) { var card = new Card(entity); All.Add(entity.CardId, card); if(card.Collectible && (card.Type != CardType.HERO || card.Set != CardSet.CORE && card.Set != CardSet.HERO_SKINS)) Collectible.Add(entity.CardId, card); } } } public static Card GetFromName(string name, Locale lang, bool collectible = true) => (collectible ? Collectible : All).Values.FirstOrDefault(x => x.GetLocName(lang)?.Equals(name, StringComparison.InvariantCultureIgnoreCase) ?? false); public static Card GetFromDbfId(int dbfId, bool collectibe = true) => (collectibe ? Collectible : All).Values.FirstOrDefault(x => x.DbfId == dbfId); } }
#region using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; using System.Xml.Serialization; using HearthDb.Enums; #endregion namespace HearthDb { public static class Cards { public static readonly Dictionary<string, Card> All = new Dictionary<string, Card>(); public static readonly Dictionary<string, Card> Collectible = new Dictionary<string, Card>(); static Cards() { var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("HearthDb.CardDefs.xml"); if(stream == null) return; using(TextReader tr = new StreamReader(stream)) { var xml = new XmlSerializer(typeof(CardDefs.CardDefs)); var cardDefs = (CardDefs.CardDefs)xml.Deserialize(tr); foreach(var entity in cardDefs.Entites) { var card = new Card(entity); All.Add(entity.CardId, card); if(card.Collectible && (card.Type != CardType.HERO || card.Set != CardSet.CORE && card.Set != CardSet.HERO_SKINS)) Collectible.Add(entity.CardId, card); } } } public static Card GetFromName(string name, Locale lang, bool collectible = true) => (collectible ? Collectible : All).Values.FirstOrDefault(x => x.GetLocName(lang).Equals(name, StringComparison.InvariantCultureIgnoreCase)); public static Card GetFromDbfId(int dbfId, bool collectibe = true) => (collectibe ? Collectible : All).Values.FirstOrDefault(x => x.DbfId == dbfId); } }
mit
C#
a44f9c068bc09013a958e839c05d471c29f2474e
Add assembly description for CLI project
Ackara/Daterpillar
src/Daterpillar.CommandLine/Properties/AssemblyInfo.cs
src/Daterpillar.CommandLine/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("Daterpillar CLI")] [assembly: AssemblyDescription("A cross-platform database management tool.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Gigobyte")] [assembly: AssemblyProduct("Daterpillar.CommandLine")] [assembly: AssemblyCopyright("Copyright © Gigobyte 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("a24d43df-fee2-4565-817a-55c0e1de2407")] // 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.16244.24")] [assembly: AssemblyFileVersion("1.0.16244.24")] // CommandLine assembly attributes. [assembly: CommandLine.AssemblyLicense("This is free software. You may redistribute copies of it under the terms of", "the MIT License <https://github.com/Ackara/Daterpillar/blob/master/LICENSE>.")] [assembly: CommandLine.AssemblyUsage("Usage: Try one of the following commands.")]
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("Daterpillar.CommandLine")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Daterpillar.CommandLine")] [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("a24d43df-fee2-4565-817a-55c0e1de2407")] // 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.16237.14")] [assembly: AssemblyFileVersion("1.0.16237.14")]
mit
C#
06ba583297ba97d42bef8eb353217aa149c7bfe4
Bump version
MisinformedDNA/Elmah.AzureTableStorage,FreedomMercenary/Elmah.AzureTableStorage,LionLai/Elmah.AzureTableStorage
src/Elmah.AzureTableStorage/Properties/AssemblyInfo.cs
src/Elmah.AzureTableStorage/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("ELMAH on Azure Table Storage")] [assembly: AssemblyDescription("ELMAH with configuration for getting started quickly on Azure Table Storage as the error log.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Dan Friedman, Dragon Door Publications")] [assembly: AssemblyProduct("ELMAH on Azure Table Storage")] [assembly: AssemblyCopyright("Copyright © 2014. All rights reserved.")] [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("9bff690b-8426-4e8a-8a93-5a2055b1f410")] // 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.6.1.0")] [assembly: AssemblyFileVersion("0.6.1.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("ELMAH on Azure Table Storage")] [assembly: AssemblyDescription("ELMAH with configuration for getting started quickly on Azure Table Storage as the error log.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Dan Friedman, Dragon Door Publications")] [assembly: AssemblyProduct("ELMAH on Azure Table Storage")] [assembly: AssemblyCopyright("Copyright © 2014. All rights reserved.")] [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("9bff690b-8426-4e8a-8a93-5a2055b1f410")] // 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.6.0.0")] [assembly: AssemblyFileVersion("0.6.0.0")]
apache-2.0
C#
cc40344690be01e3329e86fe9fa80db6a1e631cc
Fix image loading.
Kryptos-FR/markdig.wpf,Kryptos-FR/markdig-wpf
src/Markdig.Wpf/Renderers/Wpf/Inlines/LinkInlineRenderer.cs
src/Markdig.Wpf/Renderers/Wpf/Inlines/LinkInlineRenderer.cs
// Copyright (c) 2016-2017 Nicolas Musset. All rights reserved. // This file is licensed under the MIT license. // See the LICENSE.md file in the project root for more information. using System; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Media.Imaging; using Markdig.Annotations; using Markdig.Syntax.Inlines; using Markdig.Wpf; namespace Markdig.Renderers.Wpf.Inlines { /// <summary> /// A WPF renderer for a <see cref="LinkInline"/>. /// </summary> /// <seealso cref="Markdig.Renderers.Wpf.WpfObjectRenderer{Markdig.Syntax.Inlines.LinkInline}" /> public class LinkInlineRenderer : WpfObjectRenderer<LinkInline> { /// <inheritdoc/> protected override void Write(WpfRenderer renderer, [NotNull] LinkInline link) { var url = link.GetDynamicUrl != null ? link.GetDynamicUrl() ?? link.Url : link.Url; if (!Uri.IsWellFormedUriString(url, UriKind.RelativeOrAbsolute)) { url = "#"; } if (link.IsImage) { var image = new Image { Source = new BitmapImage(new Uri(url)) }; image.SetResourceReference(Paragraph.StyleProperty, Styles.ImageStyleKey); renderer.Push(new InlineUIContainer(image)); renderer.Pop(); } else { var hyperlink = new Hyperlink { Command = Commands.Hyperlink, CommandParameter = url, NavigateUri = new Uri(url, UriKind.RelativeOrAbsolute), ToolTip = link.Title != string.Empty ? link.Title : null, }; renderer.Push(hyperlink); renderer.WriteChildren(link); renderer.Pop(); } } } }
// Copyright (c) 2016-2017 Nicolas Musset. All rights reserved. // This file is licensed under the MIT license. // See the LICENSE.md file in the project root for more information. using System; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Media.Imaging; using Markdig.Annotations; using Markdig.Syntax.Inlines; using Markdig.Wpf; namespace Markdig.Renderers.Wpf.Inlines { /// <summary> /// A WPF renderer for a <see cref="LinkInline"/>. /// </summary> /// <seealso cref="Markdig.Renderers.Wpf.WpfObjectRenderer{Markdig.Syntax.Inlines.LinkInline}" /> public class LinkInlineRenderer : WpfObjectRenderer<LinkInline> { /// <inheritdoc/> protected override void Write(WpfRenderer renderer, [NotNull] LinkInline link) { var url = link.GetDynamicUrl != null ? link.GetDynamicUrl() ?? link.Url : link.Url; if (!Uri.IsWellFormedUriString(url, UriKind.RelativeOrAbsolute)) { url = "#"; } if (link.IsImage) { var image = new Image { Source = new BitmapImage { UriSource = new Uri(url), } }; image.SetResourceReference(Paragraph.StyleProperty, Styles.ImageStyleKey); renderer.Push(new InlineUIContainer(image)); renderer.Pop(); } else { var hyperlink = new Hyperlink { Command = Commands.Hyperlink, CommandParameter = url, NavigateUri = new Uri(url, UriKind.RelativeOrAbsolute), ToolTip = link.Title != string.Empty ? link.Title : null, }; renderer.Push(hyperlink); renderer.WriteChildren(link); renderer.Pop(); } } } }
mit
C#
b8b0e5604a1fb0e432bd4fc895c1371f58ef3b80
add todo only
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
src/SFA.DAS.EAS.Api/Orchestrators/StatisticsOrchestrator.cs
src/SFA.DAS.EAS.Api/Orchestrators/StatisticsOrchestrator.cs
using System.Threading.Tasks; using MediatR; using SFA.DAS.EAS.Account.Api.Types; using SFA.DAS.EAS.Application.Queries.GetFinancialStatistics; using SFA.DAS.EmployerAccounts.Api.Client; namespace SFA.DAS.EAS.Account.Api.Orchestrators { public class StatisticsOrchestrator { private readonly IMediator _mediator; private readonly IEmployerAccountsApiClient _employerAccountsApiClient; //todo: need to set up IReadStoreMediator for this client. stick with it? public StatisticsOrchestrator(IMediator mediator, IEmployerAccountsApiClient employerAccountsApiClient) { _mediator = mediator; _employerAccountsApiClient = employerAccountsApiClient; } public virtual async Task<StatisticsViewModel> Get() { var getAccountStatisticsTask = _employerAccountsApiClient.GetStatistics(); var financialStatisticsQueryTask = _mediator.SendAsync(new GetFinancialStatisticsQuery()); var accountStatistics = await getAccountStatisticsTask; return new StatisticsViewModel { TotalAccounts = accountStatistics.TotalAccounts, TotalAgreements = accountStatistics.TotalAgreements, TotalLegalEntities = accountStatistics.TotalLegalEntities, TotalPayeSchemes = accountStatistics.TotalPayeSchemes, TotalPayments = (await financialStatisticsQueryTask).Statistics.TotalPayments }; } } }
using System.Threading.Tasks; using MediatR; using SFA.DAS.EAS.Account.Api.Types; using SFA.DAS.EAS.Application.Queries.GetFinancialStatistics; using SFA.DAS.EmployerAccounts.Api.Client; namespace SFA.DAS.EAS.Account.Api.Orchestrators { public class StatisticsOrchestrator { private readonly IMediator _mediator; private readonly IEmployerAccountsApiClient _employerAccountsApiClient; public StatisticsOrchestrator(IMediator mediator, IEmployerAccountsApiClient employerAccountsApiClient) { _mediator = mediator; _employerAccountsApiClient = employerAccountsApiClient; } public virtual async Task<StatisticsViewModel> Get() { var getAccountStatisticsTask = _employerAccountsApiClient.GetStatistics(); var financialStatisticsQueryTask = _mediator.SendAsync(new GetFinancialStatisticsQuery()); var accountStatistics = await getAccountStatisticsTask; return new StatisticsViewModel { TotalAccounts = accountStatistics.TotalAccounts, TotalAgreements = accountStatistics.TotalAgreements, TotalLegalEntities = accountStatistics.TotalLegalEntities, TotalPayeSchemes = accountStatistics.TotalPayeSchemes, TotalPayments = (await financialStatisticsQueryTask).Statistics.TotalPayments }; } } }
mit
C#
976b303af2bd1d174c9c246c4bcf4619910e5c30
implement EventLoopScheduler.
atsushieno/mono-reactive,paulcbetts/mono-reactive,jorik041/mono-reactive
System.Reactive/System.Reactive.Concurrency/EventLoopScheduler.cs
System.Reactive/System.Reactive.Concurrency/EventLoopScheduler.cs
using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using System.Reactive.Disposables; namespace System.Reactive.Concurrency { public sealed class EventLoopScheduler : IScheduler, IDisposable { public EventLoopScheduler () : this ((ts) => new Thread (ts)) { } public EventLoopScheduler (Func<ThreadStart, Thread> threadFactory) { if (threadFactory == null) throw new ArgumentNullException ("threadFactory"); thread_factory = threadFactory; } Func<ThreadStart, Thread> thread_factory; public void Dispose () { throw new NotImplementedException (); } public DateTimeOffset Now { get { return Scheduler.Now; } } public IDisposable Schedule<TState> (TState state, Func<IScheduler, TState, IDisposable> action) { return Schedule (state, Scheduler.Now, action); } public IDisposable Schedule<TState> (TState state, DateTimeOffset dueTime, Func<IScheduler, TState, IDisposable> action) { IDisposable dis = null; var th = thread_factory (() => { Thread.Sleep (Scheduler.Normalize (dueTime - Now)); dis = action (this, state); }); th.Start (); // The thread is not aborted even if it's at work (ThreadAbortException is not caught inside the action). // FIXME: this should *always* dispose "dis" instance that is returned by the action even after disposable of this instance (action starts regardless of this). return Disposable.Create (() => { if (dis != null) dis.Dispose (); }); } public IDisposable Schedule<TState> (TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action) { return Schedule (state, Scheduler.Now + dueTime, action); } } }
using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; namespace System.Reactive.Concurrency { public sealed class EventLoopScheduler : IScheduler, IDisposable { public EventLoopScheduler () : this ((ts) => new Thread (ts)) { } Thread th; public EventLoopScheduler (Func<ThreadStart, Thread> threadFactory) { if (threadFactory == null) throw new ArgumentNullException ("threadFactory"); thread_factory = threadFactory; } Func<ThreadStart, Thread> thread_factory; Thread thread; public void Dispose () { throw new NotImplementedException (); } public DateTimeOffset Now { get { return Scheduler.Now; } } public IDisposable Schedule<TState> (TState state, Func<IScheduler, TState, IDisposable> action) { return Schedule (state, Scheduler.Now, action); } public IDisposable Schedule<TState> (TState state, DateTimeOffset dueTime, Func<IScheduler, TState, IDisposable> action) { throw new NotImplementedException (); } public IDisposable Schedule<TState> (TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action) { return Schedule (state, Scheduler.Now + Scheduler.Normalize (dueTime), action); } } }
mit
C#
4d14244e00fce0941d2753fdb6853f3470eca304
Update style.css
troke12/troke12.github.com,troke12/troke12.github.com,troke12/troke12.github.com
style.cs
style.cs
/*====================================================*/ /* Copyright by Troke */ /*====================================================*/ body { background-color: #FFFF00; background: url(https://raw.githubusercontent.com/troke12/trokewebsite/master/images/The-Night-Sky-Wallpaper.jpg) top center no-repeat; background-size: cover; color: #000000; font-size: 13px; margin: 0; padding: 0; } p { font-size:13px; position:center; font-style:normal; font-family:Verdana; color: #FFFFFF; } .html-marquee { height:200px; width:400px; font-family:Verdana; font-size:14px; color:#FFFFFF; } #Logo { border-width: 0; position:absolute; left:498px; top:243px; width:336px; height:44px; z-index:1; } #menu { border: 0px #9370DB solid; background-color: transparent; position:absolute; left:498px; top:320px; width:336px; height:100px; text-align:center; z-index:3; } #menu ul { list-style-type: none; margin: 0; padding: 0; } #menu li { float: left; margin: 0; padding: 0px 0px 0px 0px; width: 33.33%; } #menu a { display: block; float: left; color: #FFFFFF; border: 0px #000000 solid; background-color: #6A5ACD; background-image: none; font-family: Verdana; font-size: 13px; font-weight: bold; font-style: normal; text-decoration: none; width: 84.26%; height: 30px; padding: 0px 8px 0px 5px; vertical-align: middle; line-height: 30px; text-align: center; -moz-box-shadow: 2px 1px 9px #000000; -webkit-box-shadow: 2px 1px 9px #000000; box-shadow: 2px 1px 9px #000000; } #menu li:hover a, #menu a:hover { color: #D3D3D3; background-color: #7B68EE; background-image: none; border: 0px #000000 solid; } #menu li.firstmain { padding-left: 0px; } #menu li.lastmain { padding-right: 0px; } #menu br { clear: both; font-size: 1px; height: 0; line-height: 0; }
/*====================================================*/ /* Copyright by Troke */ /*====================================================*/ body { background-color: #FFFF00; background: url(https://github.com/troke12/trokewebsite/blob/master/images/The-Night-Sky-Wallpaper.jpg?raw=true) top center no-repeat; background-size: cover; color: #000000; font-size: 13px; margin: 0; padding: 0; } p { font-size:13px; position:center; font-style:normal; font-family:Verdana; color: #FFFFFF; } .html-marquee { height:200px; width:400px; font-family:Verdana; font-size:14px; color:#FFFFFF; } #Logo { border-width: 0; position:absolute; left:498px; top:243px; width:336px; height:44px; z-index:1; } #menu { border: 0px #9370DB solid; background-color: transparent; position:absolute; left:498px; top:320px; width:336px; height:100px; text-align:center; z-index:3; } #menu ul { list-style-type: none; margin: 0; padding: 0; } #menu li { float: left; margin: 0; padding: 0px 0px 0px 0px; width: 33.33%; } #menu a { display: block; float: left; color: #FFFFFF; border: 0px #000000 solid; background-color: #6A5ACD; background-image: none; font-family: Verdana; font-size: 13px; font-weight: bold; font-style: normal; text-decoration: none; width: 84.26%; height: 30px; padding: 0px 8px 0px 5px; vertical-align: middle; line-height: 30px; text-align: center; -moz-box-shadow: 2px 1px 9px #000000; -webkit-box-shadow: 2px 1px 9px #000000; box-shadow: 2px 1px 9px #000000; } #menu li:hover a, #menu a:hover { color: #D3D3D3; background-color: #7B68EE; background-image: none; border: 0px #000000 solid; } #menu li.firstmain { padding-left: 0px; } #menu li.lastmain { padding-right: 0px; } #menu br { clear: both; font-size: 1px; height: 0; line-height: 0; }
mit
C#