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
b4f443f49f2779842f6df46a71cf42e1dbd78d3c
Update AssemblyInfo.cs
healthwise/Org.Healthwise.NewRelic.RabbitMQ
Properties/AssemblyInfo.cs
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("org.healthwise.newrelic.rabbitmq")] [assembly: AssemblyDescription("RabbitMQ New Relic Plugin")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Healthwise, Inc.")] [assembly: AssemblyProduct("org.healthwise.newrelic.rabbitmq")] [assembly: AssemblyCopyright("Copyright © Healthwise, Inc. 2017")] [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("7b074541-3b16-41c0-9321-fb607da1c404")] // 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.5.0.0")] [assembly: AssemblyFileVersion("0.5.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("org.healthwise.newrelic.rabbitmq")] [assembly: AssemblyDescription("RabbitMQ New Relic Plugin")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Healthwise, Inc.")] [assembly: AssemblyProduct("org.healthwise.newrelic.rabbitmq")] [assembly: AssemblyCopyright("Copyright © Healthwise, Inc. 2017")] [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("7b074541-3b16-41c0-9321-fb607da1c404")] // 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.4.0.0")] [assembly: AssemblyFileVersion("0.4.0.0")]
mit
C#
801694938db30c432004ed6909af2fbdf0a7dd8d
Update AssemblyNames
gOOvaUY/Goova.Plexo.Models,gOOvaUY/Plexo.Models
Properties/AssemblyInfo.cs
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("Goova.Plexo.Models")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Goova.Plexo.Models")] [assembly: AssemblyCopyright("Copyright © 2017 gOOva")] [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("0fdddba6-b05f-4c41-b5eb-18f91e34e160")] // 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.*")]
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("Goova.ElSwitch.Models")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Goova.ElSwitch.Models")] [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("0fdddba6-b05f-4c41-b5eb-18f91e34e160")] // 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")]
agpl-3.0
C#
05c1473076f3f6c8f8638bf0d93eecaba781bf66
fix disabling final confirmation word.
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi.Fluent/Behaviors/FocusNextItemBehavior.cs
WalletWasabi.Fluent/Behaviors/FocusNextItemBehavior.cs
using Avalonia; using Avalonia.Controls; using Avalonia.LogicalTree; using ReactiveUI; using System; using System.Reactive.Disposables; using System.Reactive.Linq; namespace WalletWasabi.Fluent.Behaviors { internal class FocusNextItemBehavior : DisposingBehavior<Control> { public static readonly StyledProperty<bool> IsFocusedProperty = AvaloniaProperty.Register<FocusNextItemBehavior, bool>(nameof(IsFocused), true); public bool IsFocused { get => GetValue(IsFocusedProperty); set => SetValue(IsFocusedProperty, value); } protected override void OnAttached(CompositeDisposable disposables) { this.WhenAnyValue(x => x.IsFocused) .Where(x => x == false) .Subscribe( _ => { var parentControl = AssociatedObject.FindLogicalAncestorOfType<ItemsControl>(); if (parentControl is { }) { foreach (var item in parentControl.GetLogicalChildren()) { var nextToFocus = item.FindLogicalDescendantOfType<TextBox>(); if (nextToFocus.IsEnabled) { nextToFocus.Focus(); return; } } parentControl.Focus(); } }) .DisposeWith(disposables); } } }
using Avalonia; using Avalonia.Controls; using Avalonia.LogicalTree; using Avalonia.VisualTree; using ReactiveUI; using System; using System.Reactive.Disposables; using System.Reactive.Linq; namespace WalletWasabi.Fluent.Behaviors { internal class FocusNextItemBehavior : DisposingBehavior<Control> { public static readonly StyledProperty<bool> IsFocusedProperty = AvaloniaProperty.Register<FocusNextItemBehavior, bool>(nameof(IsFocused), true); public bool IsFocused { get => GetValue(IsFocusedProperty); set => SetValue(IsFocusedProperty, value); } protected override void OnAttached(CompositeDisposable disposables) { this.WhenAnyValue(x => x.IsFocused) .Where(x => x == false) .Subscribe( _ => { var parentControl = AssociatedObject.FindAncestorOfType<ItemsControl>(); if (parentControl is { }) { foreach (var item in parentControl.GetLogicalChildren()) { var nextToFocus = item.FindLogicalDescendantOfType<TextBox>(); if (nextToFocus.IsEnabled) { nextToFocus.Focus(); return; } } AssociatedObject?.Focus(); } }) .DisposeWith(disposables); } } }
mit
C#
506d1e01ba13510f8242466e9a39b56d97ec8237
Increment version.
jyuch/ReflectionToStringBuilder
src/ReflectionToStringBuilder/Properties/AssemblyInfo.cs
src/ReflectionToStringBuilder/Properties/AssemblyInfo.cs
using System; using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("ReflectionToStringBuilder")] [assembly: AssemblyDescription("ReflectionでToStringするアレ")] [assembly: AssemblyCompany("jyuch")] [assembly: AssemblyProduct("ReflectionToStringBuilder")] [assembly: AssemblyCopyright("Copyright (c) 2015-2016 jyuch")] [assembly: ComVisible(false)] [assembly: CLSCompliant(true)] [assembly: Guid("7e1cb969-5d63-4c0f-89ec-a1d0604eba75")] [assembly: AssemblyVersion("1.4.0.0")] [assembly: AssemblyFileVersion("1.4.0.0")]
using System; using System.Reflection; using System.Runtime.InteropServices; [assembly: AssemblyTitle("ReflectionToStringBuilder")] [assembly: AssemblyDescription("ReflectionでToStringするアレ")] [assembly: AssemblyCompany("jyuch")] [assembly: AssemblyProduct("ReflectionToStringBuilder")] [assembly: AssemblyCopyright("Copyright (c) 2015 jyuch")] [assembly: ComVisible(false)] [assembly: CLSCompliant(true)] [assembly: Guid("7e1cb969-5d63-4c0f-89ec-a1d0604eba75")] [assembly: AssemblyVersion("1.3.0.0")] [assembly: AssemblyFileVersion("1.3.0.0")]
mit
C#
4f404c180e3eceabbb0121d69ebd6b1e51e93b22
修复读取字节组出错的bug。
RabbitTeam/WeiXinSDK
Rabbit.WeiXin/SDK/Rabbit.WeiXin/Utility/Extensions/StreamExtensions.cs
Rabbit.WeiXin/SDK/Rabbit.WeiXin/Utility/Extensions/StreamExtensions.cs
using System; using System.Collections.Generic; using System.IO; namespace Rabbit.WeiXin.Utility.Extensions { /// <summary> /// 流扩展方法。 /// </summary> internal static class StreamExtensions { /// <summary> /// 将流读取成字节组。 /// </summary> /// <param name="stream">流。</param> /// <returns>字节组。</returns> public static byte[] ReadBytes(this Stream stream) { if (!stream.NotNull("stream").CanRead) throw new NotSupportedException(stream + "不支持读取。"); Action trySeekBegin = () => { if (!stream.CanSeek) return; stream.Seek(0, SeekOrigin.Begin); }; trySeekBegin(); var list = new List<byte>(stream.CanSeek ? (stream.Length > int.MaxValue ? int.MaxValue : (int)stream.Length) : 300); int b; while ((b = stream.ReadByte()) != -1) list.Add((byte)b); trySeekBegin(); return list.ToArray(); } } }
using System; using System.Collections.Generic; using System.IO; namespace Rabbit.WeiXin.Utility.Extensions { /// <summary> /// 流扩展方法。 /// </summary> internal static class StreamExtensions { /// <summary> /// 将流读取成字节组。 /// </summary> /// <param name="stream">流。</param> /// <returns>字节组。</returns> public static byte[] ReadBytes(this Stream stream) { if (!stream.NotNull("stream").CanRead) throw new NotSupportedException(stream + "不支持读取。"); Action trySeekBegin = () => { if (!stream.CanSeek) return; stream.Seek(0, SeekOrigin.Begin); }; trySeekBegin(); var list = new List<byte>(stream.Length > int.MaxValue ? int.MaxValue : (int)stream.Length); int b; while ((b = stream.ReadByte()) != -1) list.Add((byte)b); trySeekBegin(); return list.ToArray(); } } }
apache-2.0
C#
c627cd0dee7d4f169a8f7bdd89994a5e389203c4
Revert to fixed versioning scheme used by build
serilog-trace-listener/SerilogTraceListener
assets/CommonAssemblyInfo.cs
assets/CommonAssemblyInfo.cs
using System.Reflection; // These "special" version numbers are found and replaced at build time. [assembly: AssemblyVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.1.1.1")] [assembly: AssemblyInformationalVersion("1.0.0")]
using System.Reflection; [assembly: AssemblyVersion("2.0.0.0")] [assembly: AssemblyFileVersion("2.1.0.0")] [assembly: AssemblyInformationalVersion("2.1.0")]
apache-2.0
C#
f2d6071b60b96162eaacbd687aa834a1d1c2c4aa
Update Callback
gOOvaUY/Goova.Plexo.Models,gOOvaUY/Plexo.Models
ICallback.cs
ICallback.cs
using System.ServiceModel; using System.ServiceModel.Web; using System.Threading.Tasks; namespace Goova.Plexo { [ServiceContract] public interface ICallback { [OperationContract] [WebInvoke(UriTemplate = "Instrument", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, Method = "POST")] Task<ClientResponse> Instrument(IntrumentCallback instrument); } }
using System.Threading.Tasks; namespace Goova.Plexo { public interface ICallback { Task<ClientResponse> Instrument(IntrumentCallback instrument); } }
agpl-3.0
C#
68692b46e4113e6bc010dff3e661bcee98788ae3
make private
LayoutFarm/PixelFarm
a_mini/projects/PixelFarm/TypeMirror/SimpleReflectionHelper.cs
a_mini/projects/PixelFarm/TypeMirror/SimpleReflectionHelper.cs
//MIT,2016, WinterDev using System; using System.Collections.Generic; using System.Text; using System.Reflection; namespace TypeMirror { /// <summary> /// very base reflection helper /// </summary> static class SimpleReflectionHelper { public static Dictionary<string, T> GetEnumFields<T>() { Dictionary<string, T> results = new Dictionary<string, T>(); Type typeOfSample = typeof(T); FieldInfo[] allFields = typeOfSample.GetFields( BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public); int j = allFields.Length; for (int i = 0; i < j; ++i) { FieldInfo f = allFields[i]; object value = f.GetValue(null); if (value is T) { results.Add(f.Name, (T)value); } } return results; } public static List<T> GetEnumValues<T>() { List<T> values = new List<T>(); Type typeOfSample = typeof(T); FieldInfo[] allFields = typeOfSample.GetFields( BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public); int j = allFields.Length; for (int i = 0; i < j; ++i) { FieldInfo f = allFields[i]; object value = f.GetValue(null); if (value is T) { values.Add((T)value); } } return values; } } }
//MIT,2016, WinterDev using System; using System.Collections.Generic; using System.Text; using System.Reflection; namespace TypeMirror { /// <summary> /// very base reflection helper /// </summary> public static class SimpleReflectionHelper { public static Dictionary<string, T> GetEnumFields<T>() { Dictionary<string, T> results = new Dictionary<string, T>(); Type typeOfSample = typeof(T); FieldInfo[] allFields = typeOfSample.GetFields( BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public); int j = allFields.Length; for (int i = 0; i < j; ++i) { FieldInfo f = allFields[i]; object value = f.GetValue(null); if (value is T) { results.Add(f.Name, (T)value); } } return results; } public static List<T> GetEnumValues<T>() { List<T> values = new List<T>(); Type typeOfSample = typeof(T); FieldInfo[] allFields = typeOfSample.GetFields( BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public); int j = allFields.Length; for (int i = 0; i < j; ++i) { FieldInfo f = allFields[i]; object value = f.GetValue(null); if (value is T) { values.Add((T)value); } } return values; } } }
bsd-2-clause
C#
5976e11abb46010314de6fb1eaee78dcb53c7b06
Allow passing port number to test setup
JasperFx/jasper,JasperFx/jasper,JasperFx/jasper
src/Jasper.Testing/Transports/Tcp/LightweightTcpTransportCompliance.cs
src/Jasper.Testing/Transports/Tcp/LightweightTcpTransportCompliance.cs
using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Net.NetworkInformation; using System.Net.Sockets; using Jasper.Util; using TestingSupport.Compliance; using Xunit; namespace Jasper.Testing.Transports.Tcp { public class Sender : JasperOptions { public Sender(int portNumber) { Endpoints.ListenForMessagesFrom($"tcp://localhost:{portNumber}/incoming".ToUri()); } public Sender() : this(2389) { } } public class Receiver : JasperOptions { public Receiver(int portNumber) { Endpoints.ListenForMessagesFrom($"tcp://localhost:{portNumber}/incoming".ToUri()); } public Receiver() : this(2388) { } } public class PortFinder { private static readonly IPEndPoint DefaultLoopbackEndpoint = new IPEndPoint(IPAddress.Loopback, port: 0); public static int GetAvailablePort() { using var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); socket.Bind(DefaultLoopbackEndpoint); var port = ((IPEndPoint)socket.LocalEndPoint).Port; return port; } } [Collection("compliance")] public class LightweightTcpTransportCompliance : SendingCompliance { public LightweightTcpTransportCompliance() : base($"tcp://localhost:{PortFinder.GetAvailablePort()}/incoming".ToUri()) { SenderIs(new Sender(PortFinder.GetAvailablePort())); ReceiverIs(new Receiver(theOutboundAddress.Port)); } } }
using Jasper.Util; using TestingSupport.Compliance; using Xunit; namespace Jasper.Testing.Transports.Tcp { public class Sender : JasperOptions { public Sender() { Endpoints.ListenForMessagesFrom($"tcp://localhost:2289/incoming".ToUri()); } } public class Receiver : JasperOptions { public Receiver() { Endpoints.ListenForMessagesFrom($"tcp://localhost:2288/incoming".ToUri()); } } [Collection("compliance")] public class LightweightTcpTransportCompliance : SendingCompliance { public LightweightTcpTransportCompliance() : base($"tcp://localhost:2288/incoming".ToUri()) { SenderIs<Sender>(); ReceiverIs<Receiver>(); } } }
mit
C#
597d73274b920d68f9ec741832cc241d9af9630c
Fix for Fast on .NET 5.0.
ExRam/ExRam.Gremlinq
src/ExRam.Gremlinq.Core/Extensions/ImmutableDictionaryExtensions.cs
src/ExRam.Gremlinq.Core/Extensions/ImmutableDictionaryExtensions.cs
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.Immutable; using System.Reflection; using System.Linq; namespace ExRam.Gremlinq.Core { public static class ImmutableDictionaryExtensions { private static readonly ConcurrentDictionary<object, object> FastDictionaries = new(); internal static IImmutableDictionary<MemberInfo, MemberMetadata> ConfigureNames(this IImmutableDictionary<MemberInfo, MemberMetadata> metadata, Func<MemberInfo, Key, Key> transformation) { return metadata .SetItems(metadata .Select(kvp => new KeyValuePair<MemberInfo, MemberMetadata>( kvp.Key, new MemberMetadata( transformation(kvp.Key, kvp.Value.Key), kvp.Value.SerializationBehaviour)))); } internal static IReadOnlyDictionary<TKey, TValue> Fast<TKey, TValue>(this IImmutableDictionary<TKey, TValue> dict) where TKey : notnull { return (IReadOnlyDictionary<TKey, TValue>)FastDictionaries .GetOrAdd( dict, closureDict => ((IImmutableDictionary<TKey, TValue>)closureDict).ToDictionary(x => x.Key, x => x.Value)); } public static IImmutableDictionary<MemberInfo, MemberMetadata> UseCamelCaseNames(this IImmutableDictionary<MemberInfo, MemberMetadata> names) { return names.ConfigureNames((_, key) => key.RawKey is string name ? name.ToCamelCase() : key); } public static IImmutableDictionary<MemberInfo, MemberMetadata> UseLowerCaseNames(this IImmutableDictionary<MemberInfo, MemberMetadata> names) { return names.ConfigureNames((_, key) => key.RawKey is string name ? name.ToLower() : key); } } }
using System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.Immutable; using System.Reflection; using System.Linq; namespace ExRam.Gremlinq.Core { public static class ImmutableDictionaryExtensions { private static readonly ConcurrentDictionary<object, object> FastDictionaries = new(); internal static IImmutableDictionary<MemberInfo, MemberMetadata> ConfigureNames(this IImmutableDictionary<MemberInfo, MemberMetadata> metadata, Func<MemberInfo, Key, Key> transformation) { return metadata .SetItems(metadata .Select(kvp => new KeyValuePair<MemberInfo, MemberMetadata>( kvp.Key, new MemberMetadata( transformation(kvp.Key, kvp.Value.Key), kvp.Value.SerializationBehaviour)))); } internal static IReadOnlyDictionary<TKey, TValue> Fast<TKey, TValue>(this IImmutableDictionary<TKey, TValue> dict) { return (IReadOnlyDictionary<TKey, TValue>)FastDictionaries .GetOrAdd( dict, closureDict => ((IImmutableDictionary<TKey, TValue>)closureDict).ToDictionary(x => x.Key, x => x.Value)); } public static IImmutableDictionary<MemberInfo, MemberMetadata> UseCamelCaseNames(this IImmutableDictionary<MemberInfo, MemberMetadata> names) { return names.ConfigureNames((_, key) => key.RawKey is string name ? name.ToCamelCase() : key); } public static IImmutableDictionary<MemberInfo, MemberMetadata> UseLowerCaseNames(this IImmutableDictionary<MemberInfo, MemberMetadata> names) { return names.ConfigureNames((_, key) => key.RawKey is string name ? name.ToLower() : key); } } }
mit
C#
5e9f734ed3651d265408ed0a02b2cf1fd4d8fbe5
add fallback log. (#2177)
dotnet/docfx,pascalberger/docfx,dotnet/docfx,pascalberger/docfx,superyyrrzz/docfx,dotnet/docfx,superyyrrzz/docfx,superyyrrzz/docfx,pascalberger/docfx
src/Microsoft.DocAsCode.Common/FileAbstractLayer/FallbackFileReader.cs
src/Microsoft.DocAsCode.Common/FileAbstractLayer/FallbackFileReader.cs
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.DocAsCode.Common { using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; internal sealed class FallbackFileReader : IFileReader { public FallbackFileReader(ImmutableArray<IFileReader> readers) { Readers = readers.ToImmutableArray(); } public ImmutableArray<IFileReader> Readers { get; } #region IFileReader Members public PathMapping? FindFile(RelativePath file) { bool isFallback = false; foreach (var pm in from r in Readers select r.FindFile(file)) { if (pm != null) { if (isFallback) { Logger.LogVerbose($"Load file from fallback: {pm.Value.PhysicalPath}.", file: file); } return pm; } isFallback = true; } return null; } public IEnumerable<RelativePath> EnumerateFiles() => (from r in Readers from f in r.EnumerateFiles() select f).Distinct(); public IEnumerable<string> GetExpectedPhysicalPath(RelativePath file) => from r in Readers from f in r.GetExpectedPhysicalPath(file) select f; #endregion } }
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.DocAsCode.Common { using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; internal sealed class FallbackFileReader : IFileReader { public FallbackFileReader(ImmutableArray<IFileReader> readers) { Readers = readers.ToImmutableArray(); } public ImmutableArray<IFileReader> Readers { get; } #region IFileReader Members public PathMapping? FindFile(RelativePath file) => (from r in Readers select r.FindFile(file) into pm where pm != null select pm).FirstOrDefault(); public IEnumerable<RelativePath> EnumerateFiles() => (from r in Readers from f in r.EnumerateFiles() select f).Distinct(); public IEnumerable<string> GetExpectedPhysicalPath(RelativePath file) => from r in Readers from f in r.GetExpectedPhysicalPath(file) select f; #endregion } }
mit
C#
291b871862adb735f2463b02ee678ddfaaf8f817
Add Untyped Getter for EngineScriptComponent
HelloKitty/Testity,HelloKitty/Testity
src/Testity.EngineComponents.Unity3D/Scripting/ITestityBehaviour.cs
src/Testity.EngineComponents.Unity3D/Scripting/ITestityBehaviour.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Testity.EngineComponents; namespace Testity.EngineComponents.Unity3D { public interface ITestityBehaviour<out TScriptComponentType> : ITestityBehaviour where TScriptComponentType : EngineScriptComponent { TScriptComponentType ScriptComponent { get; } } public interface ITestityBehaviour { void Initialize(); object GetUntypedScriptComponent { get; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Testity.EngineComponents; namespace Testity.EngineComponents.Unity3D { public interface ITestityBehaviour<out TScriptComponentType> : ITestityBehaviour where TScriptComponentType : EngineScriptComponent { TScriptComponentType ScriptComponent { get; } } public interface ITestityBehaviour { void Initialize(); } }
mit
C#
5c1e4bd22f46403a4ee8c23a7cc16d2978eafb59
Fix thread safety issue in TransactionManager. The depth should be per-thread.
ysdiong/Sharp-Architecture-Contrib,barser/Sharp-Architecture-Contrib,sharparchitecture/Sharp-Architecture-Contrib
src/SharpArchContrib.Data/NHibernate/TransactionManagerBase.cs
src/SharpArchContrib.Data/NHibernate/TransactionManagerBase.cs
using System; using System.Threading; using log4net; namespace SharpArchContrib.Data.NHibernate { [Serializable] public abstract class TransactionManagerBase : ITransactionManager { private static readonly ILog logger = LogManager.GetLogger(typeof(TransactionManagerBase)); [ThreadStatic] private static int transactionDepth; #region ITransactionManager Members public int TransactionDepth { get { return transactionDepth; } } public virtual object PushTransaction(string factoryKey, object transactionState) { Interlocked.Increment(ref transactionDepth); Log(string.Format("Push Transaction to Depth {0}", transactionDepth)); return transactionState; } public abstract bool TransactionIsActive(string factoryKey); public virtual object PopTransaction(string factoryKey, object transactionState) { Interlocked.Decrement(ref transactionDepth); Log(string.Format("Pop Transaction to Depth {0}", transactionDepth)); return transactionState; } public abstract object RollbackTransaction(string factoryKey, object transactionState); public abstract object CommitTransaction(string factoryKey, object transactionState); public abstract string Name { get; } #endregion protected void Log(string message) { logger.Debug(string.Format("{0}: {1}", Name, message)); } } }
using System; using System.Threading; using log4net; namespace SharpArchContrib.Data.NHibernate { [Serializable] public abstract class TransactionManagerBase : ITransactionManager { private static readonly ILog logger = LogManager.GetLogger(typeof(TransactionManagerBase)); private static int transactionDepth; #region ITransactionManager Members public int TransactionDepth { get { return transactionDepth; } } public virtual object PushTransaction(string factoryKey, object transactionState) { Interlocked.Increment(ref transactionDepth); Log(string.Format("Push Transaction to Depth {0}", transactionDepth)); return transactionState; } public abstract bool TransactionIsActive(string factoryKey); public virtual object PopTransaction(string factoryKey, object transactionState) { Interlocked.Decrement(ref transactionDepth); Log(string.Format("Pop Transaction to Depth {0}", transactionDepth)); return transactionState; } public abstract object RollbackTransaction(string factoryKey, object transactionState); public abstract object CommitTransaction(string factoryKey, object transactionState); public abstract string Name { get; } #endregion protected void Log(string message) { logger.Debug(string.Format("{0}: {1}", Name, message)); } } }
bsd-3-clause
C#
a63709754748e5eac6d95d25fb295f20fa05dadd
fix plain text log parsing
RPCS3/discord-bot
CompatBot/EventHandlers/LogParsing/ArchiveHandlers/PlainText.cs
CompatBot/EventHandlers/LogParsing/ArchiveHandlers/PlainText.cs
using System; using System.IO; using System.IO.Pipelines; using System.Text; using System.Threading; using System.Threading.Tasks; namespace CompatBot.EventHandlers.LogParsing.ArchiveHandlers { internal sealed class PlainTextHandler: IArchiveHandler { public long LogSize { get; private set; } public long SourcePosition { get; private set; } public (bool result, string? reason) CanHandle(string fileName, int fileSize, ReadOnlySpan<byte> header) { LogSize = fileSize; if (fileName.Contains("tty.log", StringComparison.InvariantCultureIgnoreCase)) return (false, null); if (header.Length > 10 && Encoding.UTF8.GetString(header.Slice(0, 30)).Contains("RPCS3 v")) return (true, null); return (false, null); } public async Task FillPipeAsync(Stream sourceStream, PipeWriter writer, CancellationToken cancellationToken) { try { int read; FlushResult flushed; do { var memory = writer.GetMemory(Config.MinimumBufferSize); read = await sourceStream.ReadAsync(memory, cancellationToken); writer.Advance(read); flushed = await writer.FlushAsync(cancellationToken).ConfigureAwait(false); } while (read > 0 && !(flushed.IsCompleted || flushed.IsCanceled || cancellationToken.IsCancellationRequested)); } catch (Exception e) { Config.Log.Error(e, "Error filling the log pipe"); await writer.CompleteAsync(e); return; } await writer.CompleteAsync(); } } }
using System; using System.IO; using System.IO.Pipelines; using System.Text; using System.Threading; using System.Threading.Tasks; namespace CompatBot.EventHandlers.LogParsing.ArchiveHandlers { internal sealed class PlainTextHandler: IArchiveHandler { public long LogSize { get; private set; } public long SourcePosition { get; private set; } public (bool result, string? reason) CanHandle(string fileName, int fileSize, ReadOnlySpan<byte> header) { LogSize = fileSize; if (fileName.Contains("tty.log", StringComparison.InvariantCultureIgnoreCase)) return (false, null); if (header.Length > 10 && Encoding.UTF8.GetString(header.Slice(0, 30)).Contains("RPCS3 v")) return (true, null); return (false, null); } public async Task FillPipeAsync(Stream sourceStream, PipeWriter writer, CancellationToken cancellationToken) { try { int read; FlushResult flushed; do { var memory = writer.GetMemory(Config.MinimumBufferSize); read = await sourceStream.ReadAsync(memory, cancellationToken); writer.Advance(read); SourcePosition = sourceStream.Position; flushed = await writer.FlushAsync(cancellationToken).ConfigureAwait(false); } while (read > 0 && !(flushed.IsCompleted || flushed.IsCanceled || cancellationToken.IsCancellationRequested)); } catch (Exception e) { Config.Log.Error(e, "Error filling the log pipe"); await writer.CompleteAsync(e); return; } await writer.CompleteAsync(); } } }
lgpl-2.1
C#
ae53b063d5d33bd98d296f87ec7e0e7f4e0c5eb9
Refactor and add ExecuteScalar to SQLite wrapper
jazd/Business,jazd/Business,jazd/Business
CSharp/Core.SQLite/Command.cs
CSharp/Core.SQLite/Command.cs
using Microsoft.Data.Sqlite; using System.Collections.Generic; namespace Business.Core.SQLite { public class Command : ICommand { IReader Reader { get; set; } public SqliteConnection SQLiteConnection { get; set; } public SqliteCommand SQLiteCommand { get; set; } public SqliteDataReader SQLiteReader { get; set; } public List<Parameter> Parameters { get; set; } public Command() { SQLiteCommand = new SqliteCommand(); Parameters = new List<Parameter>(); } public string CommandText { get { return SQLiteCommand?.CommandText; } set { SQLiteCommand.CommandText = value; } } public IReader ExecuteReader() { MakeReady(); SQLiteReader = SQLiteCommand.ExecuteReader(); Reader = new Reader() { SQLiteReader = SQLiteReader }; return Reader; } public object ExecuteScalar() { MakeReady(); return SQLiteCommand.ExecuteScalar(); } private void MakeReady() { SQLiteCommand.Connection = SQLiteConnection; foreach (var parameter in Parameters) { SQLiteCommand.Parameters.Add(new SqliteParameter(parameter.Name, parameter.Value)); } } } }
using Microsoft.Data.Sqlite; using System.Collections.Generic; namespace Business.Core.SQLite { public class Command : ICommand { IReader Reader { get; set; } public SqliteConnection SQLiteConnection { get; set; } public SqliteCommand SQLiteCommand { get; set; } public SqliteDataReader SQLiteReader { get; set; } public List<Parameter> Parameters { get; set; } public Command() { SQLiteCommand = new SqliteCommand(); Parameters = new List<Parameter>(); } public string CommandText { get { return SQLiteCommand?.CommandText; } set { SQLiteCommand.CommandText = value; } } public IReader ExecuteReader() { SQLiteCommand.Connection = SQLiteConnection; foreach(var parameter in Parameters) { SQLiteCommand.Parameters.Add(new SqliteParameter(parameter.Name, parameter.Value)); } SQLiteReader = SQLiteCommand.ExecuteReader(); Reader = new Reader() { SQLiteReader = SQLiteReader }; return Reader; } public object ExecuteScalar() { throw new System.NotImplementedException(); } } }
mit
C#
9f8ad9f833f5057150297c455fee597dc6bc7db1
Fix menu background storyboard stopping after track reload
NeoAdonis/osu,ppy/osu,ppy/osu,peppy/osu,ppy/osu,NeoAdonis/osu,NeoAdonis/osu,peppy/osu,peppy/osu
osu.Game/Graphics/Backgrounds/BeatmapBackgroundWithStoryboard.cs
osu.Game/Graphics/Backgrounds/BeatmapBackgroundWithStoryboard.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. #nullable enable using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Overlays; using osu.Game.Storyboards.Drawables; namespace osu.Game.Graphics.Backgrounds { public class BeatmapBackgroundWithStoryboard : BeatmapBackground { private InterpolatingFramedClock storyboardClock = null!; [Resolved(CanBeNull = true)] private MusicController? musicController { get; set; } public BeatmapBackgroundWithStoryboard(WorkingBeatmap beatmap, string fallbackTextureName = "Backgrounds/bg1") : base(beatmap, fallbackTextureName) { } [BackgroundDependencyLoader] private void load() { if (!Beatmap.Storyboard.HasDrawable) return; if (Beatmap.Storyboard.ReplacesBackground) Sprite.Alpha = 0; LoadComponentAsync(new AudioContainer { RelativeSizeAxes = Axes.Both, Volume = { Value = 0 }, Child = new DrawableStoryboard(Beatmap.Storyboard) { Clock = storyboardClock = new InterpolatingFramedClock(Beatmap.Track) } }, AddInternal); } protected override void LoadComplete() { base.LoadComplete(); if (musicController != null) musicController.TrackChanged += onTrackChanged; } private void onTrackChanged(WorkingBeatmap newBeatmap, TrackChangeDirection _) { if (newBeatmap != Beatmap) return; // `MusicController` will sometimes reload the track, even when the working beatmap technically hasn't changed. // ensure that the storyboard's clock is always using the latest track instance. storyboardClock.ChangeSource(newBeatmap.Track); storyboardClock.ProcessFrame(); } protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); if (musicController != null) musicController.TrackChanged -= onTrackChanged; } } }
// 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.Graphics.Containers; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Storyboards.Drawables; namespace osu.Game.Graphics.Backgrounds { public class BeatmapBackgroundWithStoryboard : BeatmapBackground { public BeatmapBackgroundWithStoryboard(WorkingBeatmap beatmap, string fallbackTextureName = "Backgrounds/bg1") : base(beatmap, fallbackTextureName) { } [BackgroundDependencyLoader] private void load() { if (!Beatmap.Storyboard.HasDrawable) return; if (Beatmap.Storyboard.ReplacesBackground) Sprite.Alpha = 0; LoadComponentAsync(new AudioContainer { RelativeSizeAxes = Axes.Both, Volume = { Value = 0 }, Child = new DrawableStoryboard(Beatmap.Storyboard) { Clock = new InterpolatingFramedClock(Beatmap.Track) } }, AddInternal); } } }
mit
C#
f7b6feb51254bda5424ba8d65ede9b32bf0708e5
increase timeout for intermittently failing test
JoeMighty/shouldly
src/Shouldly.Tests/ShouldNotThrow/FuncOfTaskOfTWithTimeoutScenario.cs
src/Shouldly.Tests/ShouldNotThrow/FuncOfTaskOfTWithTimeoutScenario.cs
using System; using System.Threading; using System.Threading.Tasks; using Xunit; namespace Shouldly.Tests.ShouldNotThrow { public class FuncOfTaskOfTWithTimeoutScenario { [Fact] public void ShouldThrowAWobbly() { var task = Task.Run(async () => { await Task.Delay(TimeSpan.FromSeconds(5)); return "foo"; }); var ex = Should.Throw<ShouldCompleteInException>(() => task.ShouldNotThrow(TimeSpan.FromSeconds(0.5), "Some additional context")); ex.Message.ShouldContainWithoutWhitespace(ChuckedAWobblyErrorMessage); } string ChuckedAWobblyErrorMessage => @"Task should complete in 00:00:00.5000000 but did not Additional Info: Some additional context"; [Fact] public void ShouldPass() { var task = Task.Factory.StartNew(() => "foo", CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default); var result = task.ShouldNotThrow(TimeSpan.FromSeconds(2.0)); result.ShouldBe("foo"); } } }
using System; using System.Threading; using System.Threading.Tasks; using Xunit; namespace Shouldly.Tests.ShouldNotThrow { public class FuncOfTaskOfTWithTimeoutScenario { [Fact] public void ShouldThrowAWobbly() { var task = Task.Run(async () => { await Task.Delay(TimeSpan.FromSeconds(5)); return "foo"; }); var ex = Should.Throw<ShouldCompleteInException>(() => task.ShouldNotThrow(TimeSpan.FromSeconds(0.5), "Some additional context")); ex.Message.ShouldContainWithoutWhitespace(ChuckedAWobblyErrorMessage); } string ChuckedAWobblyErrorMessage => @"Task should complete in 00:00:00.5000000 but did not Additional Info: Some additional context"; [Fact] public void ShouldPass() { var task = Task.Factory.StartNew(() => "foo", CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default); var result = task.ShouldNotThrow(TimeSpan.FromSeconds(0.5)); result.ShouldBe("foo"); } } }
bsd-3-clause
C#
07b6475172bc051b0e545413a5b41bcfd227fbe0
Change Namespace
muhammedikinci/FuzzyCore
FuzzyCore/Pattern/Command.cs
FuzzyCore/Pattern/Command.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using FuzzyCore.Server.Data; namespace FuzzyCore.Server { public abstract class Command { protected JsonCommand Comm { get; set; } public Command(JsonCommand comm) { this.Comm = comm; } public abstract void Execute(); } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using fuzzyControl.Server.Data; namespace fuzzyControl.Server { public abstract class Command { protected JsonCommand Comm { get; set; } public Command(JsonCommand comm) { this.Comm = comm; } public abstract void Execute(); } }
mit
C#
21248d1eae92386ba949e01ab79767a4125daf1c
Update MonoCached.cs
dimmpixeye/Unity3dTools
Runtime/LibMono/MonoCached.cs
Runtime/LibMono/MonoCached.cs
/*=============================================================== Product: Battlecruiser Developer: Dimitry Pixeye - pixeye@hbrew.store Company: Homebrew - http://hbrew.store Date: 24/06/2017 20:56 ================================================================*/ #if ODIN_INSPECTOR using Sirenix.OdinInspector; #endif using UnityEngine; namespace Pixeye.Actors { public abstract class MonoCached : MonoBehaviour, IRequireStarter { void Awake() { if (!Starter.initialized || Toolbox.changingScene) return; Setup(); } void OnEnable() { if (!Starter.initialized || Toolbox.changingScene) return; HandleEnable(); } void OnDisable() { HandleDisable(); } public void Launch() { Setup(); HandleEnable(); } protected virtual void HandleEnable() { } protected virtual void HandleDisable() { } protected virtual void Setup() { } } }
/*=============================================================== Product: Battlecruiser Developer: Dimitry Pixeye - pixeye@hbrew.store Company: Homebrew - http://hbrew.store Date: 24/06/2017 20:56 ================================================================*/ #if ODIN_INSPECTOR using Sirenix.OdinInspector; #endif using UnityEngine; namespace Pixeye.Actors { public abstract class MonoCached : MonoBehaviour, IRequireStarter { void Awake() { if (Starter.initialized == false) return; Setup(); } void OnEnable() { if (Starter.initialized == false) return; HandleEnable(); } void OnDisable() { HandleDisable(); } public void Launch() { Setup(); OnEnable(); } protected virtual void HandleEnable() { } protected virtual void HandleDisable() { } protected virtual void Setup() { } } }
mit
C#
66deaf0b3fb935027730cf470cf6a331e69f2cee
Make test of @page/@model whitespace
aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore,aspnet/AspNetCore
test/WebSites/RazorPagesWebSite/HelloWorldWithPageModelHandler.cshtml
test/WebSites/RazorPagesWebSite/HelloWorldWithPageModelHandler.cshtml
@page @model RazorPagesWebSite.HelloWorldWithPageModelHandler Hello, @Model.Message! @using (Html.BeginForm()) { @Html.AntiForgeryToken() }
@page @model RazorPagesWebSite.HelloWorldWithPageModelHandler Hello, @Model.Message! @using (Html.BeginForm()) { @Html.AntiForgeryToken() }
apache-2.0
C#
5bfd610407c0d5db88e30fa946ab960a6512f1a6
add back --version-suffix
livarcocc/cli-1,EdwardBlair/cli,ravimeda/cli,blackdwarf/cli,ravimeda/cli,harshjain2/cli,svick/cli,dasMulli/cli,Faizan2304/cli,blackdwarf/cli,svick/cli,Faizan2304/cli,svick/cli,harshjain2/cli,dasMulli/cli,ravimeda/cli,harshjain2/cli,blackdwarf/cli,dasMulli/cli,Faizan2304/cli,EdwardBlair/cli,livarcocc/cli-1,livarcocc/cli-1,johnbeisner/cli,EdwardBlair/cli,johnbeisner/cli,johnbeisner/cli,blackdwarf/cli
src/dotnet/commands/dotnet-publish/PublishCommandParser.cs
src/dotnet/commands/dotnet-publish/PublishCommandParser.cs
// Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Linq; using Microsoft.DotNet.Cli.CommandLine; using LocalizableStrings = Microsoft.DotNet.Tools.Publish.LocalizableStrings; namespace Microsoft.DotNet.Cli { internal static class PublishCommandParser { public static Command Publish() => Create.Command( "publish", LocalizableStrings.AppFullName, Accept.ZeroOrMoreArguments(), CommonOptions.HelpOption(), CommonOptions.FrameworkOption(), CommonOptions.RuntimeOption(), Create.Option( "-o|--output", LocalizableStrings.OutputOptionDescription, Accept.ExactlyOneArgument() .With(name: LocalizableStrings.OutputOption) .ForwardAs(o => $"/p:PublishDir={o.Arguments.Single()}")), CommonOptions.ConfigurationOption(), CommonOptions.VersionSuffixOption(), Create.Option( "--filter", LocalizableStrings.FilterProjOptionDescription, Accept.ExactlyOneArgument() .With(name: LocalizableStrings.FilterProjOption) .ForwardAs(o => $"/p:FilterProjectFiles={o.Arguments.Single()}")), CommonOptions.VerbosityOption()); } }
// Copyright (c) .NET Foundation and contributors. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.Linq; using Microsoft.DotNet.Cli.CommandLine; using LocalizableStrings = Microsoft.DotNet.Tools.Publish.LocalizableStrings; namespace Microsoft.DotNet.Cli { internal static class PublishCommandParser { public static Command Publish() => Create.Command( "publish", LocalizableStrings.AppFullName, Accept.ZeroOrMoreArguments(), CommonOptions.HelpOption(), CommonOptions.FrameworkOption(), CommonOptions.RuntimeOption(), Create.Option( "-o|--output", LocalizableStrings.OutputOptionDescription, Accept.ExactlyOneArgument() .With(name: LocalizableStrings.OutputOption) .ForwardAs(o => $"/p:PublishDir={o.Arguments.Single()}")), CommonOptions.ConfigurationOption(), Create.Option( "--filter", LocalizableStrings.FilterProjOptionDescription, Accept.ExactlyOneArgument() .With(name: LocalizableStrings.FilterProjOption) .ForwardAs(o => $"/p:FilterProjectFiles={o.Arguments.Single()}")), CommonOptions.VerbosityOption()); } }
mit
C#
95eeefe641b654c864261c590096e01901287344
Fix crash while applying expressions setting.
stakira/OpenUtau,stakira/OpenUtau
OpenUtau.Core/Ustx/UTrack.cs
OpenUtau.Core/Ustx/UTrack.cs
using System; using Newtonsoft.Json; using Serilog; namespace OpenUtau.Core.Ustx { [JsonObject(MemberSerialization.OptIn)] public class UTrack { [JsonProperty] public string singer; [JsonProperty] public string phonemizer; private USinger singer_; public USinger Singer { get => singer_; set { if (singer_ != value) { singer_ = value; Phonemizer.SetSinger(value); } } } public Phonemizer Phonemizer { get; set; } = new DefaultPhonemizer(); public string PhonemizerTag => Phonemizer.Tag; public string SingerName => Singer != null ? Singer.DisplayName : "[No Singer]"; public int TrackNo { set; get; } public int DisplayTrackNo => TrackNo + 1; public bool Mute { set; get; } public bool Solo { set; get; } public double Volume { set; get; } public double Pan { set; get; } public void BeforeSave() { singer = Singer?.Id; phonemizer = Phonemizer.GetType().FullName; } public void AfterLoad(UProject project) { try { var type = Type.GetType(phonemizer); if (Phonemizer == null || type != Phonemizer.GetType()) { Phonemizer = Activator.CreateInstance(type) as Phonemizer; } } catch (Exception e) { Log.Error(e, $"Failed to load phonemizer {phonemizer}"); } if (Phonemizer == null) { Phonemizer = new DefaultPhonemizer(); } if (Singer == null && !string.IsNullOrEmpty(singer)) { Singer = DocManager.Inst.GetSinger(singer); Phonemizer.SetSinger(Singer); } TrackNo = project.tracks.IndexOf(this); } } }
using System; using Newtonsoft.Json; using Serilog; namespace OpenUtau.Core.Ustx { [JsonObject(MemberSerialization.OptIn)] public class UTrack { [JsonProperty] public string singer; [JsonProperty] public string phonemizer; private USinger singer_; public USinger Singer { get => singer_; set { if (singer_ != value) { singer_ = value; Phonemizer.SetSinger(value); } } } public Phonemizer Phonemizer { get; set; } = new DefaultPhonemizer(); public string PhonemizerTag => Phonemizer.Tag; public string SingerName => Singer != null ? Singer.DisplayName : "[No Singer]"; public int TrackNo { set; get; } public int DisplayTrackNo => TrackNo + 1; public bool Mute { set; get; } public bool Solo { set; get; } public double Volume { set; get; } public double Pan { set; get; } public void BeforeSave() { singer = Singer?.Id; phonemizer = Phonemizer.GetType().FullName; } public void AfterLoad(UProject project) { try { var type = Type.GetType(phonemizer); Phonemizer = Activator.CreateInstance(type) as Phonemizer; } catch (Exception e) { Log.Error(e, $"Failed to load phonemizer {phonemizer}"); } if (Phonemizer == null) { Phonemizer = new DefaultPhonemizer(); } if (Singer == null && !string.IsNullOrEmpty(singer)) { Singer = DocManager.Inst.GetSinger(singer); } TrackNo = project.tracks.IndexOf(this); } } }
mit
C#
a88c96ae3e430a0fa1dd1787e2554ae2ce11d997
Fix typo in UTrack.cs
stakira/OpenUtau,stakira/OpenUtau
OpenUtau/Core/USTx/UTrack.cs
OpenUtau/Core/USTx/UTrack.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace OpenUtau.Core.USTx { public class UTrack { public string Name = "New Track"; public string Comment = string.Empty; public USinger Singer; public string SingerName { get { if (Singer != null) return Singer.DisplayName; else return "[No Singer]"; } } public int TrackNo { set; get; } public int DisplayTrackNo { get { return TrackNo + 1; } } public bool Mute { set; get; } public bool Solo { set; get; } public double Volume { set; get; } public double Pan { set; get; } public UTrack() { } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace OpenUtau.Core.USTx { public class UTrack { public string Name = "New Track"; public string Comment = string.Empty; public USinger Singer; public string SingerName { get { if (Singer != null) return Singer.DisplayName; else return "[No Signer]"; } } public int TrackNo { set; get; } public int DisplayTrackNo { get { return TrackNo + 1; } } public bool Mute { set; get; } public bool Solo { set; get; } public double Volume { set; get; } public double Pan { set; get; } public UTrack() { } } }
mit
C#
2c149f99b6887a271d550bf0eeff3619af7bb913
Add IDisposable.AddTo(Component)
zhutaorun/UniRx,ppcuni/UniRx,ataihei/UniRx,TORISOUP/UniRx,juggernate/UniRx,zillakot/UniRx,endo0407/UniRx,juggernate/UniRx,zillakot/UniRx,cruwel/UniRx,OrangeCube/UniRx,InvertGames/UniRx,juggernate/UniRx,zhutaorun/UniRx,neuecc/UniRx,zhutaorun/UniRx,ufcpp/UniRx,zillakot/UniRx,ic-sys/UniRx,ic-sys/UniRx,OC-Leon/UniRx,saruiwa/UniRx,kimsama/UniRx,cruwel/UniRx,cruwel/UniRx,ic-sys/UniRx,m-ishikawa/UniRx
Assets/UniRx/Scripts/UnityEngineBridge/LifetimeDisposableExtensions.cs
Assets/UniRx/Scripts/UnityEngineBridge/LifetimeDisposableExtensions.cs
using System; using System.Collections.Generic; using UniRx.Triggers; using UnityEngine; namespace UniRx { public static partial class DisposableExtensions { /// <summary>Dispose self on target gameObject has been destroyed. Return value is self disposable.</summary> public static IDisposable AddTo(this IDisposable disposable, GameObject gameObject) { if (gameObject == null) { disposable.Dispose(); return disposable; } var trigger = gameObject.GetComponent<ObservableDestroyTrigger>(); if (trigger == null) { trigger = gameObject.AddComponent<ObservableDestroyTrigger>(); } trigger.OnDestroyAsObservable().Subscribe(_ => disposable.Dispose()); return disposable; } /// <summary>Dispose self on target gameObject has been destroyed. Return value is self disposable.</summary> public static IDisposable AddTo(this IDisposable disposable, Component gameObjectComponent) { if (gameObjectComponent == null) { disposable.Dispose(); return disposable; } return AddTo(disposable, gameObjectComponent.gameObject); } /// <summary> /// <para>Add disposable(self) to CompositeDisposable(or other ICollection) and Dispose self on target gameObject has been destroyed.</para> /// <para>Return value is self disposable.</para> /// </summary> public static IDisposable AddTo(this IDisposable disposable, ICollection<IDisposable> container, GameObject gameObject) { return disposable.AddTo(container).AddTo(gameObject); } /// <summary> /// <para>Add disposable(self) to CompositeDisposable(or other ICollection) and Dispose self on target gameObject has been destroyed.</para> /// <para>Return value is self disposable.</para> /// </summary> public static IDisposable AddTo(this IDisposable disposable, ICollection<IDisposable> container, Component gameObjectComponent) { return disposable.AddTo(container).AddTo(gameObjectComponent); } } }
using System; using System.Collections.Generic; using UniRx.Triggers; using UnityEngine; namespace UniRx { public static partial class DisposableExtensions { /// <summary>Dispose self on target gameObject has been destroyed. Return value is self disposable.</summary> public static IDisposable AddTo(this IDisposable disposable, GameObject gameObject) { var trigger = gameObject.GetComponent<ObservableDestroyTrigger>(); if (trigger == null) { trigger = gameObject.AddComponent<ObservableDestroyTrigger>(); } trigger.OnDestroyAsObservable().Subscribe(_ => disposable.Dispose()); return disposable; } /// <summary> /// <para>Add disposable(self) to CompositeDisposable(or other ICollection) and Dispose self on target gameObject has been destroyed.</para> /// <para>Return value is self disposable.</para> /// </summary> public static IDisposable AddTo(this IDisposable disposable, ICollection<IDisposable> container, GameObject gameObject) { return disposable.AddTo(container).AddTo(gameObject); } } }
mit
C#
be7ebf99f1ddb371b5c453ff3af09a070fb70866
Fix assembly files selection.
averrunci/Carna
Source/Carna.Runner/Runner/Configuration/CarnaRunnerConfiguration.cs
Source/Carna.Runner/Runner/Configuration/CarnaRunnerConfiguration.cs
// Copyright (C) 2017 Fievus // // This software may be modified and distributed under the terms // of the MIT license. See the LICENSE file for details. using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Runtime.Serialization; namespace Carna.Runner.Configuration { /// <summary> /// Represents the configuration of CarnaRunner. /// </summary> [DataContract] public class CarnaRunnerConfiguration { /// <summary> /// Gets or sets assembly names. /// </summary> [DataMember(Name = "assemblies")] public IList<string> AssemblyFiles { get; set; } /// <summary> /// Gets or sets assemblies in which fixtures exist. /// </summary> public IList<Assembly> Assemblies { get; set; } /// <summary> /// Gets the configuration of a filter. /// </summary> [DataMember(Name = "filter")] public CarnaFilterConfiguration Filter { get; set; } /// <summary> /// Gets the configuration of a finder. /// </summary> [DataMember(Name = "finder")] public CarnaConfiguration Finder { get; set; } /// <summary> /// Gets the configuration of a builder. /// </summary> [DataMember(Name = "builder")] public CarnaConfiguration Builder { get; set; } /// <summary> /// Gets the configuration of a step runner factory. /// </summary> [DataMember(Name = "stepRunnerFactory")] public CarnaConfiguration StepRunnerFactory { get; set; } /// <summary> /// Gets the configuration of reporters. /// </summary> [DataMember(Name = "reporters")] public IList<CarnaReporterConfiguration> Reporters { get; set; } = new List<CarnaReporterConfiguration>(); /// <summary> /// Gets a value that indicates whether to run a fixture in parallel. /// </summary> [DataMember(Name = "parallel")] public bool Parallel { get; set; } = true; /// <summary> /// Ensures the configuration of CarnaRunner with the specified <see cref="IAssemblyLoader"/>. /// </summary> /// <param name="loader">The loader of an assembly.</param> /// <returns>The instance of the <see cref="CarnaRunnerConfiguration"/>.</returns> public CarnaRunnerConfiguration Ensure(IAssemblyLoader loader) { loader.IfPresent(_ => Assemblies = AssemblyFiles?.Select(loader.Load).ToList()); Filter?.Ensure(); return this; } } }
// Copyright (C) 2017 Fievus // // This software may be modified and distributed under the terms // of the MIT license. See the LICENSE file for details. using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Runtime.Serialization; namespace Carna.Runner.Configuration { /// <summary> /// Represents the configuration of CarnaRunner. /// </summary> [DataContract] public class CarnaRunnerConfiguration { /// <summary> /// Gets or sets assembly names. /// </summary> [DataMember(Name = "assemblies")] public IList<string> AssemblyFiles { get; set; } /// <summary> /// Gets or sets assemblies in which fixtures exist. /// </summary> public IList<Assembly> Assemblies { get; set; } /// <summary> /// Gets the configuration of a filter. /// </summary> [DataMember(Name = "filter")] public CarnaFilterConfiguration Filter { get; set; } /// <summary> /// Gets the configuration of a finder. /// </summary> [DataMember(Name = "finder")] public CarnaConfiguration Finder { get; set; } /// <summary> /// Gets the configuration of a builder. /// </summary> [DataMember(Name = "builder")] public CarnaConfiguration Builder { get; set; } /// <summary> /// Gets the configuration of a step runner factory. /// </summary> [DataMember(Name = "stepRunnerFactory")] public CarnaConfiguration StepRunnerFactory { get; set; } /// <summary> /// Gets the configuration of reporters. /// </summary> [DataMember(Name = "reporters")] public IList<CarnaReporterConfiguration> Reporters { get; set; } = new List<CarnaReporterConfiguration>(); /// <summary> /// Gets a value that indicates whether to run a fixture in parallel. /// </summary> [DataMember(Name = "parallel")] public bool Parallel { get; set; } = true; /// <summary> /// Ensures the configuration of CarnaRunner with the specified <see cref="IAssemblyLoader"/>. /// </summary> /// <param name="loader">The loader of an assembly.</param> /// <returns>The instance of the <see cref="CarnaRunnerConfiguration"/>.</returns> public CarnaRunnerConfiguration Ensure(IAssemblyLoader loader) { loader.IfPresent(_ => Assemblies = AssemblyFiles.Select(loader.Load).ToList()); Filter?.Ensure(); return this; } } }
mit
C#
135b5f274e3d96a4f58e2854546b35af6c2e9f41
Use clickable class for links in dashboard header.
tpkelly/voting-application,JDawes-ScottLogic/voting-application,tpkelly/voting-application,Generic-Voting-Application/voting-application,stevenhillcox/voting-application,JDawes-ScottLogic/voting-application,tpkelly/voting-application,stevenhillcox/voting-application,JDawes-ScottLogic/voting-application,Generic-Voting-Application/voting-application,Generic-Voting-Application/voting-application,stevenhillcox/voting-application
VotingApplication/VotingApplication.Web/Views/Dashboard/Index.cshtml
VotingApplication/VotingApplication.Web/Views/Dashboard/Index.cshtml
<!DOCTYPE html> <html ng-app="GVA.Creation" ng-controller="CreatePageController"> <head> <title>Vote On</title> @Styles.Render("~/Bundles/StyleLib") @Styles.Render("~/Bundles/CreateStyle") <meta name="viewport" content="initial-scale=1"> </head> <body> <div class="center-panel"> <header> <div class="pull-left" id="logo"> <a href="/"><img src="/Images/Logo.png" /></a> </div> <div class="pull-right" id="signin-header"> <span> <span ng-if="!account"><span class="clickable" ng-click="openLoginDialog()">Sign In</span> | <span class="clickable" ng-click="openRegisterDialog()">Register</span></span> <span ng-if="account">{{account.email}}</span> <i class="glyphicon glyphicon-user"></i> <i ng-show="account" class="glyphicon glyphicon-chevron-down" ng-click="toggleAccountControls=!toggleAccountControls"></i> </span> <div class="pull-right account-control-box" ng-show="toggleAccountControls && account"> <div><a href="javascript:;">My Account</a></div> <div><a href="javascript:;" ng-click="toggleAccountControls=false;signOut()">Sign Out</a></div> </div> </div> </header> <div class="body-content"> <div ng-view></div> </div> <footer><a href="mailto:generic.voting@gmail.com">Email Us</a> | © 2015 – Scott Logic Ltd</footer> </div> @Scripts.Render("~/Bundles/ScriptLib") @Scripts.Render("~/Bundles/Script") </body> </html>
<!DOCTYPE html> <html ng-app="GVA.Creation" ng-controller="CreatePageController"> <head> <title>Vote On</title> @Styles.Render("~/Bundles/StyleLib") @Styles.Render("~/Bundles/CreateStyle") <meta name="viewport" content="initial-scale=1"> </head> <body> <div class="center-panel"> <header> <div class="pull-left" id="logo"> <a href="/"><img src="/Images/Logo.png" /></a> </div> <div class="pull-right" id="signin-header"> <span> <span ng-if="!account"><a href="javascript:;" ng-click="openLoginDialog()">Sign In</a> | <a href="javascript:;" ng-click="openRegisterDialog()">Register</a></span> <span ng-if="account">{{account.email}}</span> <i class="glyphicon glyphicon-user"></i> <i ng-show="account" class="glyphicon glyphicon-chevron-down" ng-click="toggleAccountControls=!toggleAccountControls"></i> </span> <div class="pull-right account-control-box" ng-show="toggleAccountControls && account"> <div><a href="javascript:;">My Account</a></div> <div><a href="javascript:;" ng-click="toggleAccountControls=false;signOut()">Sign Out</a></div> </div> </div> </header> <div class="body-content"> <div ng-view></div> </div> <footer><a href="mailto:generic.voting@gmail.com">Email Us</a> | © 2015 – Scott Logic Ltd</footer> </div> @Scripts.Render("~/Bundles/ScriptLib") @Scripts.Render("~/Bundles/Script") </body> </html>
apache-2.0
C#
83282ebcb8f27bdb05c81059511c4254923b0d2d
fix #1397 action keywords should not be set to empty string
Wox-launcher/Wox,Wox-launcher/Wox,qianlifeng/Wox,qianlifeng/Wox,lances101/Wox,lances101/Wox,qianlifeng/Wox
Wox/ActionKeywords.xaml.cs
Wox/ActionKeywords.xaml.cs
using System.Windows; using Wox.Core.Plugin; using Wox.Core.Resource; using Wox.Infrastructure.Exception; using Wox.Infrastructure.UserSettings; using Wox.Plugin; namespace Wox { public partial class ActionKeywords : Window { private PluginPair _plugin; private Settings _settings; private readonly Internationalization _translater = InternationalizationManager.Instance; public ActionKeywords(string pluginId, Settings settings) { InitializeComponent(); _plugin = PluginManager.GetPluginForId(pluginId); _settings = settings; if (_plugin == null) { MessageBox.Show(_translater.GetTranslation("cannotFindSpecifiedPlugin")); Close(); } } private void ActionKeyword_OnLoaded(object sender, RoutedEventArgs e) { tbOldActionKeyword.Text = string.Join(Query.ActionKeywordSeperater, _plugin.Metadata.ActionKeywords.ToArray()); tbAction.Focus(); } private void BtnCancel_OnClick(object sender, RoutedEventArgs e) { Close(); } private void btnDone_OnClick(object sender, RoutedEventArgs _) { var oldActionKeyword = _plugin.Metadata.ActionKeywords[0]; var newActionKeyword = tbAction.Text.Trim(); newActionKeyword = newActionKeyword.Length > 0 ? newActionKeyword : "*"; if (!PluginManager.ActionKeywordRegistered(newActionKeyword)) { var id = _plugin.Metadata.ID; PluginManager.ReplaceActionKeyword(id, oldActionKeyword, newActionKeyword); MessageBox.Show(_translater.GetTranslation("succeed")); Close(); } else { string msg = _translater.GetTranslation("newActionKeywordsHasBeenAssigned"); MessageBox.Show(msg); } } } }
using System.Windows; using Wox.Core.Plugin; using Wox.Core.Resource; using Wox.Infrastructure.Exception; using Wox.Infrastructure.UserSettings; using Wox.Plugin; namespace Wox { public partial class ActionKeywords : Window { private PluginPair _plugin; private Settings _settings; private readonly Internationalization _translater = InternationalizationManager.Instance; public ActionKeywords(string pluginId, Settings settings) { InitializeComponent(); _plugin = PluginManager.GetPluginForId(pluginId); _settings = settings; if (_plugin == null) { MessageBox.Show(_translater.GetTranslation("cannotFindSpecifiedPlugin")); Close(); } } private void ActionKeyword_OnLoaded(object sender, RoutedEventArgs e) { tbOldActionKeyword.Text = string.Join(Query.ActionKeywordSeperater, _plugin.Metadata.ActionKeywords.ToArray()); tbAction.Focus(); } private void BtnCancel_OnClick(object sender, RoutedEventArgs e) { Close(); } private void btnDone_OnClick(object sender, RoutedEventArgs _) { var oldActionKeyword = _plugin.Metadata.ActionKeywords[0]; var newActionKeyword = tbAction.Text.Trim(); if (!PluginManager.ActionKeywordRegistered(newActionKeyword)) { var id = _plugin.Metadata.ID; PluginManager.ReplaceActionKeyword(id, oldActionKeyword, newActionKeyword); MessageBox.Show(_translater.GetTranslation("succeed")); Close(); } else { string msg = _translater.GetTranslation("newActionKeywordsHasBeenAssigned"); MessageBox.Show(msg); } } } }
mit
C#
87cafb476f33a7b1ea2acdad5bfaee2f528c9312
Remove registry entries on uninstall + refactor
refactorsaurusrex/ExcelLaunchPad
ExcelLaunchPad/Rawr.LaunchPad.Installer/RegistryEditor.cs
ExcelLaunchPad/Rawr.LaunchPad.Installer/RegistryEditor.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Win32; namespace Rawr.LaunchPad.Installer { public class RegistryEditor { readonly List<string> keyNames = new List<string> { "Excel.CSV", "Excel.Sheet.8", "Excel.Macrosheet", "Excel.SheetBinaryMacroEnabled.12", "Excel.Addin", "Excel.AddInMacroEnabled", "Excel.SheetMacroEnabled.12", "Excel.Sheet.12", "Excel.Template.8", }; public void AddEntries(string targetPath) { foreach (var name in keyNames.Take(1)) { using (var registryKey = Registry.ClassesRoot.OpenSubKey(name, true)) using (var shell = registryKey?.CreateSubKey("shell")) using (var newWindow = shell?.CreateSubKey("Open in new window")) using (var command = newWindow?.CreateSubKey("command")) { if (command == null) throw new InvalidOperationException($"Unable to set key for '{name}'. Command subkey returned as null. This is likely a permissions issue."); command.SetValue(null, $"{targetPath} -f \"%1\""); } } } public void RemoveEntries() { foreach (var name in keyNames.Take(1)) { using (var registryKey = Registry.ClassesRoot.OpenSubKey(name, true)) using (var shell = registryKey?.OpenSubKey("shell", true)) { if (shell == null) continue; try { // Assumption: the key simply doesn't exist shell.DeleteSubKey("Open in new window"); } catch (Exception e) { Console.WriteLine(e); } } } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Microsoft.Win32; namespace Rawr.LaunchPad.Installer { public class RegistryEditor { readonly string targetPath; readonly List<string> keyNames = new List<string> { "Excel.CSV", "Excel.Sheet.8", "Excel.Macrosheet", "Excel.SheetBinaryMacroEnabled.12", "Excel.Addin", "Excel.AddInMacroEnabled", "Excel.SheetMacroEnabled.12", "Excel.Sheet.12", "Excel.Template.8", }; public RegistryEditor(string targetPath) { this.targetPath = targetPath; } public void AddEntries() { foreach (var name in keyNames) { using (var registryKey = Registry.ClassesRoot.OpenSubKey(name, true)) { var shell = registryKey.CreateSubKey("shell"); var newWindow = shell.CreateSubKey("Open in new window"); var command = newWindow.CreateSubKey("command"); command.SetValue(null, $"{targetPath} -f \"%1\""); } } } } }
mit
C#
029d53b7c2f95fe5269980782e7a5344fa50b200
Fix return statement of RegisterDoor.cs
fomalsd/unitystation,fomalsd/unitystation,krille90/unitystation,fomalsd/unitystation,Necromunger/unitystation,fomalsd/unitystation,Necromunger/unitystation,Necromunger/unitystation,fomalsd/unitystation,krille90/unitystation,fomalsd/unitystation,fomalsd/unitystation,Necromunger/unitystation,krille90/unitystation,Necromunger/unitystation,Necromunger/unitystation
UnityProject/Assets/Scripts/Tilemaps/Behaviours/Objects/RegisterDoor.cs
UnityProject/Assets/Scripts/Tilemaps/Behaviours/Objects/RegisterDoor.cs
using UnityEngine; [ExecuteInEditMode] public class RegisterDoor : RegisterTile { private SubsystemManager subsystemManager; public bool OneDirectionRestricted; private void Awake() { subsystemManager = GetComponentInParent<SubsystemManager>(); } [SerializeField] private bool isClosed = true; public bool IsClosed { get { return isClosed; } set { if (isClosed != value) { isClosed = value; subsystemManager.UpdateAt(Position); } } } public override bool IsPassableTo( Vector3Int to ) { if (isClosed && OneDirectionRestricted) { // OneDirectionRestricted is hardcoded to only be from the negative y position Vector3Int v = Vector3Int.RoundToInt(transform.localRotation * Vector3.down); // Returns false if player is bumping from the correct and restricted direction return !(to - Position).y.Equals(v.y); } return !isClosed; } public override bool IsPassable( Vector3Int from ) { // Entering and leaving is the same check return IsPassableTo( from ); } public override bool IsPassable() { return !isClosed; } public override bool IsAtmosPassable() { return !isClosed; } }
using UnityEngine; [ExecuteInEditMode] public class RegisterDoor : RegisterTile { private SubsystemManager subsystemManager; public bool OneDirectionRestricted; private void Awake() { subsystemManager = GetComponentInParent<SubsystemManager>(); } [SerializeField] private bool isClosed = true; public bool IsClosed { get { return isClosed; } set { if (isClosed != value) { isClosed = value; subsystemManager.UpdateAt(Position); } } } public override bool IsPassableTo( Vector3Int to ) { if (isClosed && OneDirectionRestricted) { Vector3Int v = Vector3Int.RoundToInt(transform.localRotation * Vector3.down); return !(to - Position).Equals(v); } return !isClosed; } public override bool IsPassable( Vector3Int from ) { // Entering and leaving is the same check return IsPassableTo( from ); } public override bool IsPassable() { return !isClosed; } public override bool IsAtmosPassable() { return !isClosed; } }
agpl-3.0
C#
d2503d6cfcc0ca0a013a63243933f8f3468f489e
make FileSystemServices in Database seeder async
zmira/abremir.AllMyBricks
abremir.AllMyBricks.DatabaseSeeder/Implementations/FileSystemService.cs
abremir.AllMyBricks.DatabaseSeeder/Implementations/FileSystemService.cs
using abremir.AllMyBricks.Device.Interfaces; using System.IO; using System.Threading.Tasks; namespace abremir.AllMyBricks.DatabaseSeeder.Implementations { public class FileSystemService : IFileSystemService { public string ThumbnailCacheFolder => string.Empty; private const string DataFolder = "data"; public bool ClearThumbnailCache() { return true; } public void EnsureLocalDataFolder() { var localDataFolder = GetLocalPathToFile(null); if (!Directory.Exists(localDataFolder)) { Directory.CreateDirectory(localDataFolder); } } public string GetLocalPathToFile(string filename, string subfolder = null) { return Path.Combine(Directory.GetCurrentDirectory(), DataFolder, string.IsNullOrWhiteSpace(subfolder?.Trim()) ? string.Empty : subfolder.Trim(), (filename ?? string.Empty).Trim()); } public string GetThumbnailFolder(string theme, string subtheme) { return string.Empty; } public Task SaveThumbnailToCache(string theme, string subtheme, string filename, byte[] thumbnail) { return null; } } }
using abremir.AllMyBricks.Device.Interfaces; using System.IO; namespace abremir.AllMyBricks.DatabaseSeeder.Implementations { public class FileSystemService : IFileSystemService { public string ThumbnailCacheFolder => string.Empty; private const string DataFolder = "data"; public bool ClearThumbnailCache() { return true; } public void EnsureLocalDataFolder() { var localDataFolder = GetLocalPathToFile(null); if (!Directory.Exists(localDataFolder)) { Directory.CreateDirectory(localDataFolder); } } public string GetLocalPathToFile(string filename, string subfolder = null) { return Path.Combine(Directory.GetCurrentDirectory(), DataFolder, string.IsNullOrWhiteSpace(subfolder?.Trim()) ? string.Empty : subfolder.Trim(), (filename ?? string.Empty).Trim()); } public string GetThumbnailFolder(string theme, string subtheme) { return string.Empty; } public void SaveThumbnailToCache(string theme, string subtheme, string filename, byte[] thumbnail) { } } }
mit
C#
ce1f1368d64419f1854a06bb134825387adf742a
Update implementation of FakePropertyValidator.cs
MichalJankowskii/FluentValidation.Validators.UnitTestExtension
src/FluentValidation.Validators.UnitTestExtension.Tests/Helpers/Fakes/FakePropertyValidator.cs
src/FluentValidation.Validators.UnitTestExtension.Tests/Helpers/Fakes/FakePropertyValidator.cs
#region License // MIT License // // Copyright(c) 2016 Michał Jankowski (http://www.jankowskimichal.pl) // // 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. // // The latest version of this file can be found at https://github.com/MichalJankowskii/FluentValidation.Validators.UnitTestExtension #endregion namespace FluentValidation.Validators.UnitTestExtension.Tests.Helpers.Fakes { using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Resources; using Results; public class FakePropertyValidator : IPropertyValidator { public IEnumerable<ValidationFailure> Validate(PropertyValidatorContext context) { throw new NotImplementedException(); } public Task<IEnumerable<ValidationFailure>> ValidateAsync(PropertyValidatorContext context, CancellationToken cancellation) { throw new NotImplementedException(); } public bool IsAsync { get; } public ICollection<Func<object, object, object>> CustomMessageFormatArguments { get; } public Func<PropertyValidatorContext, object> CustomStateProvider { get; set; } public IStringSource ErrorMessageSource { get; set; } public IStringSource ErrorCodeSource { get; set; } public Severity Severity { get; set; } } }
#region License // MIT License // // Copyright(c) 2016 Michał Jankowski (http://www.jankowskimichal.pl) // // 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. // // The latest version of this file can be found at https://github.com/MichalJankowskii/FluentValidation.Validators.UnitTestExtension #endregion namespace FluentValidation.Validators.UnitTestExtension.Tests.Helpers.Fakes { using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Resources; using Results; public class FakePropertyValidator : IPropertyValidator { public IEnumerable<ValidationFailure> Validate(PropertyValidatorContext context) { throw new NotImplementedException(); } public Task<IEnumerable<ValidationFailure>> ValidateAsync(PropertyValidatorContext context, CancellationToken cancellation) { throw new NotImplementedException(); } public bool IsAsync { get; } public ICollection<Func<object, object, object>> CustomMessageFormatArguments { get; } public Func<object, object> CustomStateProvider { get; set; } public IStringSource ErrorMessageSource { get; set; } public IStringSource ErrorCodeSource { get; set; } public Severity Severity { get; set; } } }
mit
C#
5e8447c919f2215f6b125305f240e6f25ebaabc6
Add [Serializable] attribute
dnm240/NSubstitute,dnm240/NSubstitute,dnm240/NSubstitute,dnm240/NSubstitute,dnm240/NSubstitute
Source/NSubstitute/Exceptions/MissingSequenceNumberException.cs
Source/NSubstitute/Exceptions/MissingSequenceNumberException.cs
using System.Runtime.Serialization; namespace NSubstitute.Exceptions { [Serializable] public class MissingSequenceNumberException : SubstituteException { public MissingSequenceNumberException() { } protected MissingSequenceNumberException(SerializationInfo info, StreamingContext context) : base(info, context) { } } }
using System.Runtime.Serialization; namespace NSubstitute.Exceptions { public class MissingSequenceNumberException : SubstituteException { public MissingSequenceNumberException() { } protected MissingSequenceNumberException(SerializationInfo info, StreamingContext context) : base(info, context) { } } }
bsd-3-clause
C#
1e91d3d8621ab242248e4cbee18aaff1a3331099
remove debug code.
wieslawsoltes/Perspex,AvaloniaUI/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,akrisiun/Perspex,SuperJMN/Avalonia,jkoritzinsky/Perspex,SuperJMN/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,SuperJMN/Avalonia,AvaloniaUI/Avalonia,wieslawsoltes/Perspex,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,AvaloniaUI/Avalonia,jkoritzinsky/Avalonia,SuperJMN/Avalonia,SuperJMN/Avalonia,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,Perspex/Perspex,jkoritzinsky/Avalonia,SuperJMN/Avalonia,wieslawsoltes/Perspex,jkoritzinsky/Avalonia,wieslawsoltes/Perspex,grokys/Perspex,Perspex/Perspex,AvaloniaUI/Avalonia,grokys/Perspex
samples/ControlCatalog/MainWindow.xaml.cs
samples/ControlCatalog/MainWindow.xaml.cs
using Avalonia; using Avalonia.Controls; using Avalonia.Controls.Notifications; using Avalonia.Controls.Primitives; using Avalonia.Markup.Xaml; using Avalonia.Threading; using ControlCatalog.ViewModels; using System; using System.Collections.Generic; using System.Threading.Tasks; namespace ControlCatalog { public class MainWindow : Window { private WindowNotificationManager _notificationArea; public MainWindow() { this.InitializeComponent(); this.AttachDevTools(); //Renderer.DrawFps = true; //Renderer.DrawDirtyRects = Renderer.DrawFps = true; _notificationArea = new WindowNotificationManager(this) { Position = NotificationPosition.TopRight, MaxItems = 3 }; DataContext = new MainWindowViewModel(_notificationArea); } private void InitializeComponent() { // TODO: iOS does not support dynamically loading assemblies // so we must refer to this resource DLL statically. For // now I am doing that here. But we need a better solution!! var theme = new Avalonia.Themes.Default.DefaultTheme(); theme.TryGetResource("Button", out _); AvaloniaXamlLoader.Load(this); } } }
using Avalonia; using Avalonia.Controls; using Avalonia.Controls.Notifications; using Avalonia.Controls.Primitives; using Avalonia.Markup.Xaml; using Avalonia.Threading; using ControlCatalog.ViewModels; using System; using System.Collections.Generic; using System.Threading.Tasks; namespace ControlCatalog { public class MainWindow : Window { private WindowNotificationManager _notificationArea; public MainWindow() { this.InitializeComponent(); this.AttachDevTools(); //Renderer.DrawFps = true; //Renderer.DrawDirtyRects = Renderer.DrawFps = true; _notificationArea = new WindowNotificationManager(this) { Position = NotificationPosition.TopRight, MaxItems = 3 }; DataContext = new MainWindowViewModel(_notificationArea); Dispatcher.UIThread.Post(() => { new OpenFileDialog() { Filters = new List<FileDialogFilter> { new FileDialogFilter {Name = "All files", Extensions = {"*"}}, new FileDialogFilter {Name = "Image files", Extensions = {"jpg", "png", "gif"}} }, Directory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop), Title = "My dialog", InitialFileName = "config.local.json", AllowMultiple = true }.ShowAsync(this); }); } private void InitializeComponent() { // TODO: iOS does not support dynamically loading assemblies // so we must refer to this resource DLL statically. For // now I am doing that here. But we need a better solution!! var theme = new Avalonia.Themes.Default.DefaultTheme(); theme.TryGetResource("Button", out _); AvaloniaXamlLoader.Load(this); } } }
mit
C#
f725785aad0318e1386cd8260ea0fe899343561c
Use latest NuGet during build
Abc-Arbitrage/Zebus
build/build.cake
build/build.cake
#tool "nuget:?package=NUnit.ConsoleRunner" #tool "nuget:?package=NuGet.CommandLine" ////////////////////////////////////////////////////////////////////// // ARGUMENTS ////////////////////////////////////////////////////////////////////// var target = Argument("target", "Default"); var paths = new { src = MakeAbsolute(Directory("./../src")).FullPath, solution = MakeAbsolute(File("./../src/Abc.Zebus.sln")).FullPath, props = MakeAbsolute(File("./../src/Directory.Build.props")).FullPath, nugetOutput = MakeAbsolute(Directory("./../output/nuget")).FullPath, }; ////////////////////////////////////////////////////////////////////// // TASKS ////////////////////////////////////////////////////////////////////// Task("Clean").Does(() => { CleanDirectories(GetDirectories(paths.src + "/**/bin/Release")); CleanDirectory(paths.nugetOutput); }); Task("Restore-NuGet-Packages").Does(() => NuGetRestore(paths.solution)); Task("MSBuild").Does(() => MSBuild(paths.solution, settings => settings .WithTarget("Rebuild") .SetConfiguration("Release") .SetVerbosity(Verbosity.Minimal) )); Task("Run-Unit-Tests").Does(() => { var testProjects = GetFiles("./../src/Abc.Zebus*.Tests/*.csproj"); foreach (var testProject in testProjects) { Information($"Testing: {testProject}"); DotNetCoreTest(testProject.FullPath, new DotNetCoreTestSettings { Configuration = "Release", NoBuild = true }); } }); Task("Nuget-Pack").Does(() => MSBuild(paths.solution, settings => settings .WithTarget("Pack") .SetConfiguration("Release") .SetPlatformTarget(PlatformTarget.MSIL) .SetVerbosity(Verbosity.Minimal) .WithProperty("PackageOutputPath", paths.nugetOutput) )); ////////////////////////////////////////////////////////////////////// // TASK TARGETS ////////////////////////////////////////////////////////////////////// Task("Build") .IsDependentOn("Clean") .IsDependentOn("Restore-NuGet-Packages") .IsDependentOn("MSBuild"); Task("Test") .IsDependentOn("Build") .IsDependentOn("Run-Unit-Tests"); Task("Nuget") .IsDependentOn("Build") .IsDependentOn("Test") .IsDependentOn("Nuget-Pack") .Does(() => { Information(" Nuget package is now ready at location: {0}.", paths.nugetOutput); Warning(" Please remember to create and push a tag based on the currently built version."); Information(" You can do so by copying/pasting the following commands:"); Information(" git tag v{0}", XmlPeek(paths.props, @"/Project/PropertyGroup/PackageVersion/text()")); Information(" git push origin --tags"); }); Task("AppVeyor") .IsDependentOn("Build") .IsDependentOn("Test") .IsDependentOn("Nuget-Pack"); ////////////////////////////////////////////////////////////////////// // EXECUTION ////////////////////////////////////////////////////////////////////// RunTarget(target);
#tool "nuget:?package=NUnit.ConsoleRunner" ////////////////////////////////////////////////////////////////////// // ARGUMENTS ////////////////////////////////////////////////////////////////////// var target = Argument("target", "Default"); var paths = new { src = MakeAbsolute(Directory("./../src")).FullPath, solution = MakeAbsolute(File("./../src/Abc.Zebus.sln")).FullPath, props = MakeAbsolute(File("./../src/Directory.Build.props")).FullPath, nugetOutput = MakeAbsolute(Directory("./../output/nuget")).FullPath, }; ////////////////////////////////////////////////////////////////////// // TASKS ////////////////////////////////////////////////////////////////////// Task("Clean").Does(() => { CleanDirectories(GetDirectories(paths.src + "/**/bin/Release")); CleanDirectory(paths.nugetOutput); }); Task("Restore-NuGet-Packages").Does(() => NuGetRestore(paths.solution)); Task("MSBuild").Does(() => MSBuild(paths.solution, settings => settings .WithTarget("Rebuild") .SetConfiguration("Release") .SetVerbosity(Verbosity.Minimal) )); Task("Run-Unit-Tests").Does(() => { var testProjects = GetFiles("./../src/Abc.Zebus*.Tests/*.csproj"); foreach (var testProject in testProjects) { Information($"Testing: {testProject}"); DotNetCoreTest(testProject.FullPath, new DotNetCoreTestSettings { Configuration = "Release", NoBuild = true }); } }); Task("Nuget-Pack").Does(() => MSBuild(paths.solution, settings => settings .WithTarget("Pack") .SetConfiguration("Release") .SetPlatformTarget(PlatformTarget.MSIL) .SetVerbosity(Verbosity.Minimal) .WithProperty("PackageOutputPath", paths.nugetOutput) )); ////////////////////////////////////////////////////////////////////// // TASK TARGETS ////////////////////////////////////////////////////////////////////// Task("Build") .IsDependentOn("Clean") .IsDependentOn("Restore-NuGet-Packages") .IsDependentOn("MSBuild"); Task("Test") .IsDependentOn("Build") .IsDependentOn("Run-Unit-Tests"); Task("Nuget") .IsDependentOn("Build") .IsDependentOn("Test") .IsDependentOn("Nuget-Pack") .Does(() => { Information(" Nuget package is now ready at location: {0}.", paths.nugetOutput); Warning(" Please remember to create and push a tag based on the currently built version."); Information(" You can do so by copying/pasting the following commands:"); Information(" git tag v{0}", XmlPeek(paths.props, @"/Project/PropertyGroup/PackageVersion/text()")); Information(" git push origin --tags"); }); Task("AppVeyor") .IsDependentOn("Build") .IsDependentOn("Test") .IsDependentOn("Nuget-Pack"); ////////////////////////////////////////////////////////////////////// // EXECUTION ////////////////////////////////////////////////////////////////////// RunTarget(target);
mit
C#
d7405bd8a27675577a824c057950ac62e7c402ec
Add proper obsolete attribute.
stephentoub/roslyn,nguerrera/roslyn,genlu/roslyn,dotnet/roslyn,sharwell/roslyn,gafter/roslyn,AlekseyTs/roslyn,AmadeusW/roslyn,KevinRansom/roslyn,panopticoncentral/roslyn,brettfo/roslyn,aelij/roslyn,gafter/roslyn,wvdd007/roslyn,agocke/roslyn,ErikSchierboom/roslyn,brettfo/roslyn,agocke/roslyn,mavasani/roslyn,eriawan/roslyn,panopticoncentral/roslyn,sharwell/roslyn,physhi/roslyn,ErikSchierboom/roslyn,jmarolf/roslyn,physhi/roslyn,diryboy/roslyn,reaction1989/roslyn,genlu/roslyn,KirillOsenkov/roslyn,heejaechang/roslyn,mgoertz-msft/roslyn,aelij/roslyn,genlu/roslyn,mgoertz-msft/roslyn,jmarolf/roslyn,CyrusNajmabadi/roslyn,KirillOsenkov/roslyn,bartdesmet/roslyn,KevinRansom/roslyn,sharwell/roslyn,davkean/roslyn,mavasani/roslyn,shyamnamboodiripad/roslyn,dotnet/roslyn,dotnet/roslyn,wvdd007/roslyn,heejaechang/roslyn,shyamnamboodiripad/roslyn,AlekseyTs/roslyn,agocke/roslyn,abock/roslyn,reaction1989/roslyn,heejaechang/roslyn,weltkante/roslyn,weltkante/roslyn,weltkante/roslyn,CyrusNajmabadi/roslyn,tmat/roslyn,gafter/roslyn,eriawan/roslyn,mgoertz-msft/roslyn,jasonmalinowski/roslyn,diryboy/roslyn,tmat/roslyn,AmadeusW/roslyn,AmadeusW/roslyn,nguerrera/roslyn,bartdesmet/roslyn,KevinRansom/roslyn,wvdd007/roslyn,davkean/roslyn,shyamnamboodiripad/roslyn,abock/roslyn,eriawan/roslyn,AlekseyTs/roslyn,jmarolf/roslyn,jasonmalinowski/roslyn,aelij/roslyn,stephentoub/roslyn,tannergooding/roslyn,KirillOsenkov/roslyn,jasonmalinowski/roslyn,davkean/roslyn,ErikSchierboom/roslyn,brettfo/roslyn,bartdesmet/roslyn,panopticoncentral/roslyn,diryboy/roslyn,tmat/roslyn,mavasani/roslyn,reaction1989/roslyn,nguerrera/roslyn,CyrusNajmabadi/roslyn,stephentoub/roslyn,physhi/roslyn,abock/roslyn,tannergooding/roslyn,tannergooding/roslyn
src/Tools/ExternalAccess/LiveShare/LocalForwarders/Formatting/CSharpRemoteIndentationService.cs
src/Tools/ExternalAccess/LiveShare/LocalForwarders/Formatting/CSharpRemoteIndentationService.cs
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Editor; using System.Composition; using System; namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare { [ExportLanguageServiceFactory(typeof(ISynchronousIndentationService), StringConstants.CSharpLspLanguageName), Shared] [Obsolete] internal class CSharpLspIndentationServiceFactory : ILanguageServiceFactory { public ILanguageService CreateLanguageService(HostLanguageServices languageServices) { return languageServices.GetOriginalLanguageService<ISynchronousIndentationService>(); } } }
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Editor; using System.Composition; namespace Microsoft.CodeAnalysis.ExternalAccess.LiveShare { [ExportLanguageServiceFactory(typeof(ISynchronousIndentationService), StringConstants.CSharpLspLanguageName), Shared] internal class CSharpLspIndentationServiceFactory : ILanguageServiceFactory { public ILanguageService CreateLanguageService(HostLanguageServices languageServices) { return languageServices.GetOriginalLanguageService<ISynchronousIndentationService>(); } } }
mit
C#
81ad0a9c904656f7385ce2b9af72b1619f2827e1
validate command compiles all the handlers too. Closes GH-351
JasperFx/jasper,JasperFx/jasper,JasperFx/jasper
src/Jasper.CommandLine/ValidateCommand.cs
src/Jasper.CommandLine/ValidateCommand.cs
using System; using Jasper.Messaging.Model; using Lamar.Codegen; using Lamar.Compilation; using Oakton; namespace Jasper.CommandLine { [Description("Validate the configuration and environment for this Jasper application")] public class ValidateCommand : OaktonCommand<JasperInput> { public override bool Execute(JasperInput input) { Console.WriteLine("Bootstrapping the system and running all checks..."); using (var runtime = input.BuildRuntime()) { Console.WriteLine("Generating code for all the message handlers, this might take a bit..."); Console.WriteLine(); Console.WriteLine(); var rules = runtime.Get<GenerationRules>(); var generatedAssembly = new GeneratedAssembly(rules); var handlers = runtime.Get<HandlerGraph>(); foreach (var handler in handlers.Chains) { handler.AssembleType(generatedAssembly); } } ConsoleWriter.Write(ConsoleColor.Green, "All systems good!"); return true; } } }
using System; using Oakton; namespace Jasper.CommandLine { [Description("Validate the configuration and environment for this Jasper application")] public class ValidateCommand : OaktonCommand<JasperInput> { public override bool Execute(JasperInput input) { Console.WriteLine("Bootstrapping the system and running all checks..."); using (var runtime = input.BuildRuntime()) { // nothing really to do } ConsoleWriter.Write(ConsoleColor.Green, "All systems good!"); return true; } } }
mit
C#
94e135bd4609961cceea51d6127a350aba0cfa2a
Add Digital Stamp
janssenr/MyParcelApi.Net
src/MyParcelApi.Net/Models/PackageType.cs
src/MyParcelApi.Net/Models/PackageType.cs
namespace MyParcelApi.Net.Models { public enum PackageType { Package = 1, MailboxPackage = 2, Letter = 3, DigitalStamp = 4 } }
namespace MyParcelApi.Net.Models { public enum PackageType { Package = 1, MailboxPackage = 2, Letter = 3 } }
mit
C#
ecd942d389748380e970648da49d3cc635aca737
Correct class visibility of StringOfJSON
limey98/TinCan.NET,RusticiSoftware/TinCan.NET,brianjmiller/TinCan.NET,nagyistoce/TinCan.NET
TinCan/json/StringOfJSON.cs
TinCan/json/StringOfJSON.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 Newtonsoft.Json.Linq; namespace TinCan.json { public class StringOfJSON { private string source; public StringOfJSON(string json) { source = json; } public JObject toJObject() { if (source == null) { return null; } return JObject.Parse(source); } public override string ToString() { return this.source; } } }
/* 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 Newtonsoft.Json.Linq; namespace TinCan.json { class StringOfJSON { private string source; public StringOfJSON(string json) { source = json; } public JObject toJObject() { if (source == null) { return null; } return JObject.Parse(source); } public override string ToString() { return this.source; } } }
apache-2.0
C#
c0f9fde3de898849f07f52ca4b66a1a8942989e8
change solving methods
pashchuk/Numerical-methods,pashchuk/Numerical-methods
CSharp/lab1/Program.cs
CSharp/lab1/Program.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Security; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace lab1 { class Program { public static void Main(string[] args) { var gaus = new SquaresMethod("input.txt"); } public class SquaresMethod { public double[,] Matrix { get; private set; } public string Path { get; private set; } public SquaresMethod(int size, double fillValue = 1.0) { Matrix = new double[size, size]; for (var i = 0; i < size; i++) for (var j = 0; j < size; j++) Matrix[i, j] = fillValue; } public SquaresMethod(string path) { try { var lines = File.ReadAllLines(path) .Select(x => x.Split(' ')) .Select(x => x.Select(double.Parse).ToArray()) .ToArray(); var size = lines.Length; Matrix = new double[size, size]; for(var i = 0; i < size; i++) for (var j = 0; j < size; j++) Matrix[i, j] = lines[i][j]; Path = Environment.CurrentDirectory + "\\" + path; } catch (FileNotFoundException ex) { MessageBox.Show(ex.Message, "File not found", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Security; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace lab1 { class Program { public static void Main(string[] args) { var gaus = new Gaus("input.txt"); } public class Gaus { public double[,] Matrix { get; private set; } public string Path { get; private set; } public Gaus(int size, double fillValue = 1.0) { Matrix = new double[size, size]; for (var i = 0; i < size; i++) for (var j = 0; j < size; j++) Matrix[i, j] = fillValue; } public Gaus(string path) { try { var lines = File.ReadAllLines(path) .Select(x => x.Split(' ')) .Select(x => x.Select(double.Parse).ToArray()) .ToArray(); var size = lines.Length; Matrix = new double[size, size]; for(var i = 0; i < size; i++) for (var j = 0; j < size; j++) Matrix[i, j] = lines[i][j]; Path = Environment.CurrentDirectory + "\\" + path; } catch (FileNotFoundException ex) { MessageBox.Show(ex.Message, "File not found", MessageBoxButtons.OK, MessageBoxIcon.Error); } } public void SolveGaus() { } } } }
mit
C#
b5286743cb3d3dfd1b6b4aed0ce8a00d1868e692
Increment version
R-Smith/vmPing
vmPing/Properties/AssemblyInfo.cs
vmPing/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("vmPing")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("vmPing")] [assembly: AssemblyCopyright("Copyright © 2021 Ryan Smith")] [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.3.8.0")] [assembly: AssemblyFileVersion("1.3.8.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("vmPing")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("vmPing")] [assembly: AssemblyCopyright("Copyright © 2020 Ryan Smith")] [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.3.4.0")] [assembly: AssemblyFileVersion("1.3.4.0")]
mit
C#
66ef0f04ac9e86fdc554f0c8fbc01695e7b4ac25
Remove test code
mike-ward/Markdown-Edit,punker76/Markdown-Edit,jokamjohn/Markdown-Edit,Pulgafree/Markdown-Edit,chris84948/Markdown-Edit,dsuess/Markdown-Edit,Tdue21/Markdown-Edit
src/MarkdownEdit/App.xaml.cs
src/MarkdownEdit/App.xaml.cs
using System.IO; using System.Windows; using MarkdownEdit.Properties; namespace MarkdownEdit { public partial class App { private FileSystemWatcher _userSettingsWatcher; public static UserSettings UserSettings { get; private set; } private void OnStartup(object sender, StartupEventArgs ea) { InitializeSettings(); } private void InitializeSettings() { if (Settings.Default.UpgradeSettings) { Settings.Default.Upgrade(); Settings.Default.UpgradeSettings = false; Settings.Default.Save(); } UserSettings = UserSettings.Load(); _userSettingsWatcher = new FileSystemWatcher { Path = UserSettings.SettingsFolder, Filter = Path.GetFileName(UserSettings.SettingsFile), NotifyFilter = NotifyFilters.LastWrite }; _userSettingsWatcher.Changed += (s, e) => UserSettings.Update(); _userSettingsWatcher.EnableRaisingEvents = true; } private void ApplicationExit(object sender, ExitEventArgs e) { Settings.Default.Save(); } } }
using System.IO; using System.Windows; using MarkdownEdit.Properties; namespace MarkdownEdit { public partial class App { private FileSystemWatcher _userSettingsWatcher; public static UserSettings UserSettings { get; private set; } private void OnStartup(object sender, StartupEventArgs ea) { InitializeSettings(); new RemoteManager(); } private void InitializeSettings() { if (Settings.Default.UpgradeSettings) { Settings.Default.Upgrade(); Settings.Default.UpgradeSettings = false; Settings.Default.Save(); } UserSettings = UserSettings.Load(); _userSettingsWatcher = new FileSystemWatcher { Path = UserSettings.SettingsFolder, Filter = Path.GetFileName(UserSettings.SettingsFile), NotifyFilter = NotifyFilters.LastWrite }; _userSettingsWatcher.Changed += (s, e) => UserSettings.Update(); _userSettingsWatcher.EnableRaisingEvents = true; } private void ApplicationExit(object sender, ExitEventArgs e) { Settings.Default.Save(); } } }
mit
C#
4450303c7c3187f0b30bf5e9d2a7183cff3635a1
Remove Obsolete tag from RequestBody constructor.
restsharp/RestSharp
src/RestSharp/RequestBody.cs
src/RestSharp/RequestBody.cs
// Copyright © 2009-2020 John Sheehan, Andrew Young, Alexey Zimarev and RestSharp community // // 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; namespace RestSharp { public class RequestBody { public string ContentType { get; } public string Name { get; } public object Value { get; } public RequestBody(string contentType, string name, object value) { ContentType = contentType; Name = name; Value = value; } } }
// Copyright © 2009-2020 John Sheehan, Andrew Young, Alexey Zimarev and RestSharp community // // 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; namespace RestSharp { public class RequestBody { public string ContentType { get; } public string Name { get; } public object Value { get; } [Obsolete("The RestBody constructor will be internal in future versions")] public RequestBody(string contentType, string name, object value) { ContentType = contentType; Name = name; Value = value; } } }
apache-2.0
C#
c845575325624793d565da0226a3077ecb86e1e7
Support providing exception messages for Guard.NotNull()
devtyr/gullap
DevTyr.Gullap/Guard.cs
DevTyr.Gullap/Guard.cs
using System; namespace DevTyr.Gullap { public static class Guard { public static void NotNull (object obj, string argumentName, string message = null) { if (obj == null) throw new ArgumentNullException(argumentName, message); } public static void NotNullOrEmpty (string obj, string argumentName) { NotNull (obj, argumentName); if (string.IsNullOrWhiteSpace(obj)) throw new ArgumentException(argumentName); } } }
using System; namespace DevTyr.Gullap { public static class Guard { public static void NotNull (object obj, string argumentName) { if (obj == null) throw new ArgumentNullException(argumentName); } public static void NotNullOrEmpty (string obj, string argumentName) { NotNull (obj, argumentName); if (string.IsNullOrWhiteSpace(obj)) throw new ArgumentException(argumentName); } } }
mit
C#
98810675247135d25d02f3db40efb788d17d0dde
fix bug link
pixel-stuff/ludum-dare-36
Assets/Script/Constelation/Link.cs
Assets/Script/Constelation/Link.cs
using UnityEngine; using System.Collections; public class Link : MonoBehaviour { public ConstelationStar targetStar; public ConstelationStar sourceStar; public ParticleSystem destruct; public ParticleSystem reussite; public ParticleSystem activate; // Use this for initialization public void Init () { this.transform.position = new Vector3((targetStar.transform.position.x + sourceStar.transform.position.x)/2f, (targetStar.transform.position.y + sourceStar.transform.position.y)/2f, (targetStar.transform.position.z + sourceStar.transform.position.z)/2f); Vector3 vector = targetStar.transform.position - sourceStar.transform.position; float size = vector.magnitude; UnityEditor.SerializedObject so = new UnityEditor.SerializedObject(activate); so.FindProperty("ShapeModule.boxX").floatValue = size; so.ApplyModifiedProperties (); so = new UnityEditor.SerializedObject(reussite); so.FindProperty("ShapeModule.boxX").floatValue = size; so.ApplyModifiedProperties (); so = new UnityEditor.SerializedObject(destruct); so.FindProperty("ShapeModule.boxX").floatValue = size; so.ApplyModifiedProperties (); float alpha = Vector3.Angle (vector, new Vector3 (1, 0, 0)); alpha = (vector.y < 0) ? -alpha : alpha; this.transform.Rotate (new Vector3(0,0,alpha)); } public void Destruct() { Debug.Log ("DESTRUCT"); destruct.Play (); activate.Stop (); StartCoroutine(DestructIn (4f)); } public void Reussite() { Debug.Log ("Reussite"); reussite.Play (); activate.Stop (); StartCoroutine(DestructIn (4f)); } IEnumerator DestructIn( float aTime) { for (float t = 0.0f; t < 1.0f; t += Time.deltaTime / aTime) { yield return null; } Debug.Log ("DESTROY"); Destroy (this.gameObject); } // Update is called once per frame void Update () { } }
using UnityEngine; using System.Collections; public class Link : MonoBehaviour { public ConstelationStar targetStar; public ConstelationStar sourceStar; public ParticleSystem destruct; public ParticleSystem reussite; public ParticleSystem activate; // Use this for initialization public void Init () { this.transform.position = new Vector3((targetStar.transform.position.x + sourceStar.transform.position.x)/2f, (targetStar.transform.position.y + sourceStar.transform.position.y)/2f, (targetStar.transform.position.z + sourceStar.transform.position.z)/2f); Vector3 vector = targetStar.transform.position - sourceStar.transform.position; float size = vector.magnitude; UnityEditor.SerializedObject so = new UnityEditor.SerializedObject(activate); so.FindProperty("ShapeModule.boxX").floatValue = size; so.ApplyModifiedProperties (); so = new UnityEditor.SerializedObject(reussite); so.FindProperty("ShapeModule.boxX").floatValue = size; so.ApplyModifiedProperties (); so = new UnityEditor.SerializedObject(destruct); so.FindProperty("ShapeModule.boxX").floatValue = size; so.ApplyModifiedProperties (); float alpha = Vector3.Angle (vector, new Vector3 (1, 0, 0)); this.transform.Rotate (new Vector3(0,0,alpha)); } public void Destruct() { Debug.Log ("DESTRUCT"); destruct.Play (); activate.Stop (); StartCoroutine(DestructIn (4f)); } public void Reussite() { Debug.Log ("Reussite"); reussite.Play (); activate.Stop (); StartCoroutine(DestructIn (4f)); } IEnumerator DestructIn( float aTime) { for (float t = 0.0f; t < 1.0f; t += Time.deltaTime / aTime) { yield return null; } Debug.Log ("DESTROY"); Destroy (this.gameObject); } // Update is called once per frame void Update () { } }
mit
C#
f2153077e01319f614753685f5b2eb3968df0fbb
Make introspection deserializer tool work
tmds/Tmds.DBus
IntrospectionSchema.cs
IntrospectionSchema.cs
// Copyright 2006 Alp Toker <alp@atoker.com> // This software is made available under the MIT License // See COPYING for details using System; using System.Xml.Serialization; using System.Collections.Generic; namespace Schemas { [XmlRootAttribute(IsNullable=true)] public class Member { [XmlAttributeAttribute("name")] public string Name; } [XmlRootAttribute("node", IsNullable=true)] public class Node { [XmlAttributeAttribute("name")] public string Name; [XmlElementAttribute("interface", Type=typeof(@Interface))] public Interface[] Interfaces; [XmlElementAttribute("node", Type=typeof(Node))] public Node[] Nodes; } [XmlRootAttribute("interface", IsNullable=true)] public class @Interface { [XmlAttributeAttribute("name")] public string Name; /* [XmlElementAttribute("method", Type=typeof(Method))] [XmlElementAttribute("signal", Type=typeof(Signal))] [XmlElementAttribute("property", Type=typeof(Property))] //[XmlElementAttribute("annotation", Type=typeof(Annotation))] //public Member[] Members; */ [XmlElementAttribute("method", Type=typeof(Method))] public Method[] Methods; [XmlElementAttribute("signal", Type=typeof(Signal))] public Signal[] Signals; [XmlElementAttribute("property", Type=typeof(Property))] public Property[] Properties; } [XmlRootAttribute(IsNullable=true)] public class Method : Member { /* [XmlElementAttribute("arg", Type=typeof(Argument))] [XmlElementAttribute("annotation", Type=typeof(Annotation))] public object[] Items; */ //[System.ComponentModel.DefaultValue(new Argument[0])] [XmlElementAttribute("arg", Type=typeof(Argument))] //public List<Argument> Arguments; public Argument[] Arguments; } [XmlRootAttribute(IsNullable=true)] public class Argument { [XmlAttributeAttribute("name")] public string Name = String.Empty; [XmlAttributeAttribute("type")] public string Type; [System.ComponentModel.DefaultValue(ArgDirection.@in)] [XmlAttributeAttribute("direction")] public ArgDirection Direction = ArgDirection.@in; } public enum ArgDirection { @in, @out, } [XmlRootAttribute(IsNullable=true)] public class Annotation { [XmlAttributeAttribute("name")] public string Name = String.Empty; [XmlAttributeAttribute("value")] public string Value = String.Empty; } [XmlRootAttribute("signal", IsNullable=true)] public class Signal : Method { } [XmlRootAttribute(IsNullable=true)] public class Property : Member { [XmlAttributeAttribute("type")] public string Type = String.Empty; [XmlAttributeAttribute("access")] public propertyAccess Access; [XmlElementAttribute("annotation")] public Annotation[] Annotations; } public enum propertyAccess { read, write, readwrite, } }
// Copyright 2006 Alp Toker <alp@atoker.com> // This software is made available under the MIT License // See COPYING for details using System.Xml.Serialization; using System.Collections.Generic; namespace Schemas { [XmlRootAttribute(IsNullable=true)] public class Member { [XmlAttributeAttribute("name")] public string Name; } /* public class Node { [XmlAttributeAttribute("name")] public string Name; [XmlElementAttribute("node", Type=typeof(Node))] [XmlElementAttribute("interface", Type=typeof(@Interface))] public object[] Items; } */ [XmlRootAttribute("interface", IsNullable=true)] public class @Interface { [XmlAttributeAttribute("name")] public string Name; [XmlElementAttribute("method", Type=typeof(Method))] [XmlElementAttribute("signal", Type=typeof(Signal))] [XmlElementAttribute("property", Type=typeof(Property))] [XmlElementAttribute("annotation", Type=typeof(Annotation))] public object[] Items; } [XmlRootAttribute(IsNullable=true)] public class Method : Member { /* [XmlElementAttribute("arg", Type=typeof(Argument))] [XmlElementAttribute("annotation", Type=typeof(Annotation))] public object[] Items; */ [XmlElementAttribute("arg", Type=typeof(Argument))] public List<Argument> Arguments; //public Argument[] Arguments; } [XmlRootAttribute(IsNullable=true)] public class Argument { [XmlAttributeAttribute("name")] public string Name; [XmlAttributeAttribute("type")] public string Type; [System.ComponentModel.DefaultValue(ArgDirection.@in)] [XmlAttributeAttribute("direction")] public ArgDirection Direction = ArgDirection.@in; } public enum ArgDirection { @in, @out, } [XmlRootAttribute(IsNullable=true)] public class Annotation { [XmlAttributeAttribute("name")] public string Name; [XmlAttributeAttribute("value")] public string Value; } [XmlRootAttribute("signal", IsNullable=true)] public class Signal : Member { [XmlElementAttribute("arg", Type=typeof(Argument))] [XmlElementAttribute("annotation", Type=typeof(Annotation))] public object[] Items; } [XmlRootAttribute(IsNullable=true)] public class Property : Member { [XmlAttributeAttribute("type")] public string Type; [XmlAttributeAttribute("access")] public propertyAccess Access; [XmlElementAttribute("annotation")] public Annotation[] Annotation; } public enum propertyAccess { read, write, readwrite, } }
mit
C#
a62becf560d55faf6155e2c586fd542b62f877d9
Add MathUtility.NormalizeRadians
SaberSnail/GoldenAnvil.Utility
GoldenAnvil.Utility/MathUtility.cs
GoldenAnvil.Utility/MathUtility.cs
using System; using System.Collections.Generic; namespace GoldenAnvil.Utility { public static class MathUtility { public const double Sin30 = 0.5; public const double Sin60 = 0.8660254038; public const double Cos30 = 0.8660254038; public const double Cos60 = 0.5; public static double DegreesToRadians(double degrees) => degrees * Math.PI / 180.0; public static double Clamp(double value, double min, double max) => Math.Max(Math.Min(value, max), min); public static IReadOnlyList<double> SolveQuadratic(double a, double b, double c) { var values = new List<double>(); var discriminant = (b * b) - (4 * a * c); if (discriminant == 0.0) { values.Add(-b / (2 * a)); } else if (discriminant > 0) { var sqrtOfDiscriminant = Math.Sqrt(discriminant); values.Add((-b + sqrtOfDiscriminant) / (2 * a)); values.Add((-b - sqrtOfDiscriminant) / (2 * a)); } return values; } public static double NormalizeRadians(double angle) { var result = angle % (2.0 * Math.PI); if (result < 0.0) result += 2.0 * Math.PI; return result; } } }
using System; using System.Collections.Generic; namespace GoldenAnvil.Utility { public static class MathUtility { public const double Sin30 = 0.5; public const double Sin60 = 0.8660254038; public const double Cos30 = 0.8660254038; public const double Cos60 = 0.5; public static double DegreesToRadians(double degrees) => degrees * Math.PI / 180.0; public static double Clamp(double value, double min, double max) => Math.Max(Math.Min(value, max), min); public static IReadOnlyList<double> SolveQuadratic(double a, double b, double c) { var values = new List<double>(); var discriminant = (b * b) - (4 * a * c); if (discriminant == 0.0) { values.Add(-b / (2 * a)); } else if (discriminant > 0) { var sqrtOfDiscriminant = Math.Sqrt(discriminant); values.Add((-b + sqrtOfDiscriminant) / (2 * a)); values.Add((-b - sqrtOfDiscriminant) / (2 * a)); } return values; } } }
mit
C#
030bc4d1a58d3d8fdad425816c5300759b83429e
Remove <br> from select in checkin
joinrpg/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net,leotsarev/joinrpg-net,joinrpg/joinrpg-net,joinrpg/joinrpg-net,leotsarev/joinrpg-net
Joinrpg/Views/CheckIn/Index.cshtml
Joinrpg/Views/CheckIn/Index.cshtml
@model JoinRpg.Web.Models.CheckIn.CheckInIndexViewModel @{ ViewBag.Title = "Регистрация"; } <h2>Регистрация</h2> @using (Html.BeginForm()) { @Html.HiddenFor(model => model.ProjectId) @Html.AntiForgeryToken() @Html.SearchableDropdownFor(model => model.ClaimId, Model.Claims.Select( claim => new ImprovedSelectListItem() { Value = claim.ClaimId.ToString(), Text = claim.CharacterName, ExtraSearch = claim.OtherNicks, Subtext = claim.NickName + " (" + claim.Fullname + " )" })) <input type="submit" class="btn btn-success" value="Зарегистрировать"/> } <hr/> @Html.ActionLink("Статистика по регистрации", "Stat", new {Model.ProjectId})
@model JoinRpg.Web.Models.CheckIn.CheckInIndexViewModel @{ ViewBag.Title = "Регистрация"; } <h2>Регистрация</h2> @using (Html.BeginForm()) { @Html.HiddenFor(model => model.ProjectId) @Html.AntiForgeryToken() @Html.SearchableDropdownFor(model => model.ClaimId, Model.Claims.Select( claim => new ImprovedSelectListItem() { Value = claim.ClaimId.ToString(), Text = claim.CharacterName, ExtraSearch = claim.OtherNicks, Subtext = "<br />" + claim.NickName + " (" + claim.Fullname + " )" })) <input type="submit" class="btn btn-success" value="Зарегистрировать"/> } <hr/> @Html.ActionLink("Статистика по регистрации", "Stat", new {Model.ProjectId})
mit
C#
1f3b4fd4f03748ed5ddf78feba8e5339ff3d3966
Fix for regression with pvc-packages/pvc-project.json
modulexcite/pvc,pvcbuild/pvc
Pvc.CLI/Commands/InstallCommand.cs
Pvc.CLI/Commands/InstallCommand.cs
using Common.Logging; using Newtonsoft.Json.Linq; using NuGet; using PvcCore; using ScriptCs.Hosting.Package; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; namespace Pvc.CLI.Commands { public class InstallCommand : CommandBase { internal override bool IsTopLevel { get { return true; } } internal override string[] Names { get { return new[] { "install" }; } } internal override string Description { get { return "Install a plugin or NuGet package"; } } internal override void Execute(string[] args, Dictionary<string, string> flags) { var logger = new Common.Logging.Simple.ConsoleOutLogger("install", LogLevel.Debug, false, false, false, ""); var console = new ScriptCs.Hosting.ScriptConsole(); var services = new PvcScriptServicesBuilder(console, logger); var initServices = new ScriptCs.Hosting.InitializationServices(logger); var installationProvider = services.InitializationServices.GetInstallationProvider(); installationProvider.Initialize(); var packageInstaller = services.InitializationServices.GetPackageInstaller(); var packageAssemblyResolver = services.InitializationServices.GetPackageAssemblyResolver(); if (args.Length > 1) { var packageName = args[1]; var packageVersion = ""; if (flags.ContainsKey("version")) packageVersion = flags["version"]; var packageRef = new ScriptCs.PackageReference(packageName, VersionUtility.ParseFrameworkName("net45"), packageVersion); packageInstaller.InstallPackages(new[] { packageRef }, true); } else { var packages = packageAssemblyResolver.GetPackages(Directory.GetCurrentDirectory()); packageInstaller.InstallPackages(packages); } packageAssemblyResolver.SavePackages(); } } }
using Common.Logging; using Newtonsoft.Json.Linq; using NuGet; using PvcCore; using ScriptCs.Hosting.Package; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; namespace Pvc.CLI.Commands { public class InstallCommand : CommandBase { internal override bool IsTopLevel { get { return true; } } internal override string[] Names { get { return new[] { "install" }; } } internal override string Description { get { return "Install a plugin or NuGet package"; } } internal override void Execute(string[] args, Dictionary<string, string> flags) { var logger = new Common.Logging.Simple.ConsoleOutLogger("install", LogLevel.Debug, false, false, false, ""); var console = new ScriptCs.Hosting.ScriptConsole(); var services = new ScriptCs.Hosting.ScriptServicesBuilder(console, logger); var initServices = new ScriptCs.Hosting.InitializationServices(logger); var installationProvider = services.InitializationServices.GetInstallationProvider(); installationProvider.Initialize(); var packageInstaller = services.InitializationServices.GetPackageInstaller(); var packageAssemblyResolver = services.InitializationServices.GetPackageAssemblyResolver(); if (args.Length > 1) { var packageName = args[1]; var packageVersion = ""; if (flags.ContainsKey("version")) packageVersion = flags["version"]; var packageRef = new ScriptCs.PackageReference(packageName, VersionUtility.ParseFrameworkName("net45"), packageVersion); packageInstaller.InstallPackages(new[] { packageRef }, true); } else { var packages = packageAssemblyResolver.GetPackages(Directory.GetCurrentDirectory()); packageInstaller.InstallPackages(packages); } } } }
mit
C#
4e98695f60396972403a95daf5ded32bf7e21c43
Remove unnecessary space in copyright
dragonbanshee/SteamChatBot,Steam-Chat-Bot/SteamChatBot,Steam-Chat-Bot/steam-chat-bot-net
SteamChatBot/Properties/AssemblyInfo.cs
SteamChatBot/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("SteamChatBot")] [assembly: AssemblyDescription("A simplified interface for a Steam chat bot.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Steam-Chat-Bot")] [assembly: AssemblyProduct("SteamChatBot")] [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)] //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.0.1.0")] [assembly: AssemblyFileVersion("0.0.1.0")] [assembly: NeutralResourcesLanguage("en-US")]
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("SteamChatBot")] [assembly: AssemblyDescription("A simplified interface for a Steam chat bot.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Steam-Chat-Bot")] [assembly: AssemblyProduct("SteamChatBot")] [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)] //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.0.1.0")] [assembly: AssemblyFileVersion("0.0.1.0")] [assembly: NeutralResourcesLanguage("en-US")]
mit
C#
ac4897d52a34c03cee48a4c50b20d0a938d3bd18
Update ECSRect.cs
sebas77/Svelto-ECS,sebas77/Svelto.ECS
Svelto.ECS/Common/Components/ECSRect.cs
Svelto.ECS/Common/Components/ECSRect.cs
#if UNITY_5 || UNITY_5_3_OR_NEWER using UnityEngine; namespace Svelto.ECS.Components { public struct ECSRect { public float x, y, width, height; public ECSRect(Rect imageUvRect) { x = imageUvRect.x; y = imageUvRect.y; width = imageUvRect.width; height = imageUvRect.height; } } } #endif
#if UNITY_5 || UNITY_5_3_OR_NEWER using UnityEngine; namespace Svelto.ECS.Components { public struct ECSRect { public float x, y, width, height; public ECSRect(Rect imageUvRect) { x = imageUvRect.x; y = imageUvRect.y; width = imageUvRect.width; height = imageUvRect.height; } } }
mit
C#
7152294631c37a09b43049a4a97d16962c3e1a5f
Update Index.cshtml
ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab,ucdavis/Anlab
Anlab.Mvc/Views/Home/Index.cshtml
Anlab.Mvc/Views/Home/Index.cshtml
@{ ViewData["Title"] = "Home Page"; } <div class="col-8"> <h2 style="color: green">We are currently open with normal business hours in order to support on-going essential agricultural research. Please feel free to email us before shipping samples if there is any concern about a future closure.</h2> <p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p> <p>Analytical Laboratory clients are University of California academics, other educational institutions, government agencies, and research-based businesses. </p> <p>In addition to analytical services, the Laboratory provides project assistance in the areas of analytical, agricultural and environmental chemistry. The Laboratory has an educational role, providing training to students and researchers in the operation of a number of analytical methods and instruments.</p> <p>Please Note: Dirk Holstege has recently retired as Laboratory Director of the UC Davis Analytical Laboratory. We thank him for his nearly twenty years of service as Director of the Analytical Lab and his thirty-two years of service as a UC Davis employee. We wish him all the best in his retirement.<br/> <br/> Traci Francis, Laboratory Supervisor, is serving as Interim Director. </p> </div> <div class="col-4"> <address> <p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br> Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br> Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br> Email: <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a></p> </address> </div>
@{ ViewData["Title"] = "Home Page"; } <div class="col-8"> <h2 style="color: blue">In order to provide testing for on-going essential agricultural research the Analytical Lab will be re-opening on Monday March 30th with normal business hours. Please feel free to email us before shipping samples if there is any concern about a future closure.</h2> <p class="lead">The UC Davis Analytical Laboratory is a core support facility of the UC Davis College of Agriculture and Environmental Sciences.</p> <p>Analytical Laboratory clients are University of California academics, other educational institutions, government agencies, and research-based businesses. </p> <p>In addition to analytical services, the Laboratory provides project assistance in the areas of analytical, agricultural and environmental chemistry. The Laboratory has an educational role, providing training to students and researchers in the operation of a number of analytical methods and instruments.</p> <p>Please Note: Dirk Holstege has recently retired as Laboratory Director of the UC Davis Analytical Laboratory. We thank him for his nearly twenty years of service as Director of the Analytical Lab and his thirty-two years of service as a UC Davis employee. We wish him all the best in his retirement.<br/> <br/> Traci Francis, Laboratory Supervisor, is serving as Interim Director. </p> </div> <div class="col-4"> <address> <p>UC Davis Analytical Lab<br> University of California Davis, California <br> 95616-5270 <br> Phone: <span style="white-space: nowrap">(530) 752-0147</span> <br> Fax: <span style="white-space: nowrap">(530) 752-9892</span> <br> Email: <a href="mailto:anlab@ucdavis.edu">anlab@ucdavis.edu</a></p> </address> </div>
mit
C#
c009b9fde63efbb523ac087ce7cfd71c0fc3534a
update multi state demo
pangweiwei/slua,pangweiwei/slua,soulgame/slua,soulgame/slua,Roland0511/slua,pangweiwei/slua,Roland0511/slua,soulgame/slua,soulgame/slua,soulgame/slua,Roland0511/slua,pangweiwei/slua,Roland0511/slua,soulgame/slua,Roland0511/slua,pangweiwei/slua,Roland0511/slua
Assets/Slua/example/MultiState.cs
Assets/Slua/example/MultiState.cs
using System.Collections; using System.Collections.Generic; using UnityEngine; using SLua; public class MultiState : MonoBehaviour { LuaSvr svr; LuaState[] ls=new LuaState[10]; // Use this for initialization void Start () { svr = new LuaSvr (); svr.init (null, complete); } void complete() { // create 10 lua state for (int n = 0; n < 10; n++) { ls[n] = new LuaState (); ls[n].doString (string.Format ("print('this is #{0} lua state')", n)); } } // Update is called once per frame void Update () { } void OnDestroy() { for (int n = 0; n < 10; n++) { ls [n].Dispose (); } } }
using System.Collections; using System.Collections.Generic; using UnityEngine; using SLua; public class MultiState : MonoBehaviour { LuaSvr svr; LuaState[] ls=new LuaState[10]; // Use this for initialization void Start () { svr = new LuaSvr (); svr.init (null, complete); } void complete() { } // Update is called once per frame void Update () { // create 10 lua state for (int n = 0; n < 2; n++) { ls[n] = new LuaState (); ls[n].doString (string.Format ("print('this is #{0} lua state')", n)); ls [n].Dispose (); } } void OnDestroy() { // for (int n = 0; n < 10; n++) { // ls [n].Dispose (); // } } }
mit
C#
25ed3eeaaa19a583b8778fb80e63aed6513ef957
Fix CF
nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet,nopara73/HiddenWallet
WalletWasabi/Wallets/PasswordFinder.cs
WalletWasabi/Wallets/PasswordFinder.cs
using NBitcoin; using System; using System.Collections.Generic; using System.Linq; using System.Security; namespace WalletWasabi.Wallets { public static class PasswordFinder { public static readonly Dictionary<string, string> Charsets = new Dictionary<string, string> { ["en"] = "abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", ["es"] = "aábcdeéfghiíjkmnñoópqrstuúüvwxyzAÁBCDEÉFGHIÍJKLMNNOÓPQRSTUÚÜVWXYZ", ["pt"] = "aáàâābcçdeéêfghiíjkmnoóôōpqrstuúvwxyzAÁÀÂĀBCÇDEÉÊFGHIÍJKMNOÓÔŌPQRSTUÚVWXYZ", ["it"] = "abcdefghimnopqrstuvxyzABCDEFGHILMNOPQRSTUVXYZ", ["fr"] = "aâàbcçdæeéèëœfghiîïjkmnoôpqrstuùüvwxyÿzAÂÀBCÇDÆEÉÈËŒFGHIÎÏJKMNOÔPQRSTUÙÜVWXYŸZ", }; public static string? Find(Wallet wallet, string language, bool useNumbers, bool useSymbols, string likelyPassword, Action<int> reportPercentage) { BitcoinEncryptedSecretNoEC encryptedSecret = wallet.KeyManager.EncryptedSecret; var charset = Charsets[language] + (useNumbers ? "0123456789" : "") + (useSymbols ? "|!¡@$¿?_-\"#$/%&()´+*=[]{},;:.^`<>" : ""); var found = false; var lastpwd = ""; var attempts = 0; var maxNumberAttempts = likelyPassword.Length * charset.Length; foreach (var pwd in GeneratePasswords(likelyPassword, charset.ToArray())) { lastpwd = pwd; try { encryptedSecret.GetKey(pwd); found = true; break; } catch (SecurityException) { } attempts++; var percentage = (int)((float)attempts / maxNumberAttempts * 100); reportPercentage.Invoke(percentage); } return found ? lastpwd : null; } private static IEnumerable<string> GeneratePasswords(string password, char[] charset) { var pwChar = password.ToCharArray(); for (var i = 0; i < pwChar.Length; i++) { var original = pwChar[i]; foreach (var c in charset) { pwChar[i] = c; yield return new string(pwChar); } pwChar[i] = original; } } } }
using NBitcoin; using System; using System.Collections.Generic; using System.Linq; using System.Security; namespace WalletWasabi.Wallets { public static class PasswordFinder { public static readonly Dictionary<string, string> Charsets = new Dictionary<string, string> { ["en"] = "abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", ["es"] = "aábcdeéfghiíjkmnñoópqrstuúüvwxyzAÁBCDEÉFGHIÍJKLMNNOÓPQRSTUÚÜVWXYZ", ["pt"] = "aáàâābcçdeéêfghiíjkmnoóôōpqrstuúvwxyzAÁÀÂĀBCÇDEÉÊFGHIÍJKMNOÓÔŌPQRSTUÚVWXYZ", ["it"] = "abcdefghimnopqrstuvxyzABCDEFGHILMNOPQRSTUVXYZ", ["fr"] = "aâàbcçdæeéèëœfghiîïjkmnoôpqrstuùüvwxyÿzAÂÀBCÇDÆEÉÈËŒFGHIÎÏJKMNOÔPQRSTUÙÜVWXYŸZ", }; public static string? Find(Wallet wallet, string language, bool useNumbers, bool useSymbols, string likelyPassword, Action<int> reportPercentage) { BitcoinEncryptedSecretNoEC encryptedSecret = wallet.KeyManager.EncryptedSecret; var charset = Charsets[language] + (useNumbers ? "0123456789" : "") + (useSymbols ? "|!¡@$¿?_-\"#$/%&()´+*=[]{},;:.^`<>" : ""); var found = false; var lastpwd = ""; var attempts = 0; var maxNumberAttempts = likelyPassword.Length * charset.Length; foreach (var pwd in GeneratePasswords(likelyPassword, charset.ToArray())) { lastpwd = pwd; try { encryptedSecret.GetKey(pwd); found = true; break; } catch (SecurityException) { } var percentage = (int)((float)++attempts / maxNumberAttempts * 100); reportPercentage.Invoke(percentage); } return found ? lastpwd : null; } private static IEnumerable<string> GeneratePasswords(string password, char[] charset) { var pwChar = password.ToCharArray(); for (var i = 0; i < pwChar.Length; i++) { var original = pwChar[i]; foreach (var c in charset) { pwChar[i] = c; yield return new string(pwChar); } pwChar[i] = original; } } } }
mit
C#
e158523df64670af32b0806aaed48909db58ba80
Update code
sakapon/Samples-2016,sakapon/Samples-2016
WinrtSample/SensorUwp/MainPage.xaml.cs
WinrtSample/SensorUwp/MainPage.xaml.cs
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using Windows.Devices.Sensors; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.UI.Core; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; // 空白ページのアイテム テンプレートについては、http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409 を参照してください namespace SensorUwp { /// <summary> /// それ自体で使用できる空白ページまたはフレーム内に移動できる空白ページ。 /// </summary> public sealed partial class MainPage : Page { public MainPage() { this.InitializeComponent(); Loaded += MainPage_Loaded; } void MainPage_Loaded(object sender, RoutedEventArgs _e) { var lightSensor = LightSensor.GetDefault(); lightSensor.ReportInterval = 500; Action<LightSensorReading> notifyLight = r => LightText.Text = $"Light: {r.IlluminanceInLux} lx"; notifyLight(lightSensor.GetCurrentReading()); lightSensor.ReadingChanged += (o, e) => RunOnUIAsync(() => notifyLight(e.Reading)); var compass = Compass.GetDefault(); compass.ReportInterval = 500; Action<CompassReading> notifyCompass = r => CompassText.Text = $"Compass: {r.HeadingMagneticNorth:N3} °"; notifyCompass(compass.GetCurrentReading()); compass.ReadingChanged += (o, e) => RunOnUIAsync(() => notifyCompass(e.Reading)); } async void RunOnUIAsync(DispatchedHandler action) => await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, action); } }
using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.InteropServices.WindowsRuntime; using Windows.Devices.Sensors; using Windows.Foundation; using Windows.Foundation.Collections; using Windows.UI.Core; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Data; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Navigation; // 空白ページのアイテム テンプレートについては、http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409 を参照してください namespace SensorUwp { /// <summary> /// それ自体で使用できる空白ページまたはフレーム内に移動できる空白ページ。 /// </summary> public sealed partial class MainPage : Page { public MainPage() { this.InitializeComponent(); Loaded += MainPage_Loaded; } void MainPage_Loaded(object sender, RoutedEventArgs _e) { var lightSensor = LightSensor.GetDefault(); lightSensor.ReportInterval = 500; Action<LightSensorReading> notifyLight = r => LightText.Text = $"Light: {r.IlluminanceInLux} lx"; notifyLight(lightSensor.GetCurrentReading()); lightSensor.ReadingChanged += (o, e) => RunOnUIAsync(() => notifyLight(e.Reading)); var compass = Compass.GetDefault(); compass.ReportInterval = 500; Action<CompassReading> notifyCompass = r => CompassText.Text = $"Compass: {r.HeadingMagneticNorth:N3} °"; notifyCompass(compass.GetCurrentReading()); compass.ReadingChanged += (o, e) => RunOnUIAsync(() => notifyCompass(e.Reading)); } void RunOnUIAsync(DispatchedHandler action) => Dispatcher.RunAsync(CoreDispatcherPriority.Normal, action); } }
mit
C#
64fe82d48dfacc118d57603ed1282e4656cde6b8
Switch to static usings
BillWagner/TourOfCSharp6
TourOfCSharp6/Point.cs
TourOfCSharp6/Point.cs
using System.Math; namespace TourOfCSharp6 { public class Point { public double X { get; set; } public double Y { get; set; } public double Distance => Sqrt(X * X + Y * Y); } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace TourOfCSharp6 { public class Point { public double X { get; set; } public double Y { get; set; } public double Distance => Math.Sqrt(X * X + Y * Y); } }
mit
C#
6755b16c816066ad32879d17530c95519f15308f
Implement few constructors and constants in Rect/IntRect.
rokups/Urho3D,rokups/Urho3D,rokups/Urho3D,rokups/Urho3D,rokups/Urho3D,rokups/Urho3D
Urho3DNet/Math/Rect.cs
Urho3DNet/Math/Rect.cs
using System; using System.Runtime.InteropServices; namespace Urho3D { [StructLayout(LayoutKind.Sequential)] public struct Rect { /// Minimum vector. Vector2 min_; /// Maximum vector. Vector2 max_; public Rect(float minX, float minY, float maxX, float maxY) { min_ = new Vector2(minX, minY); max_ = new Vector2(maxX, maxY); } public static readonly Rect FULL = new Rect(-1.0f, -1.0f, 1.0f, 1.0f); public static readonly Rect POSITIVE = new Rect(0.0f, 0.0f, 1.0f, 1.0f); public static readonly Rect ZERO = new Rect(0.0f, 0.0f, 0.0f, 0.0f); } [StructLayout(LayoutKind.Sequential)] public struct IntRect { /// Left coordinate. int left_; /// Top coordinate. int top_; /// Right coordinate. int right_; /// Bottom coordinate. int bottom_; public IntRect(int left, int top, int right, int bottom) { left_ = left; top_ = top; right_ = right; bottom_ = bottom; } public static readonly IntRect ZERO = new IntRect(0, 0, 0, 0); } }
using System; using System.Runtime.InteropServices; namespace Urho3D { [StructLayout(LayoutKind.Sequential)] public struct Rect { /// Minimum vector. Vector2 min_; /// Maximum vector. Vector2 max_; } [StructLayout(LayoutKind.Sequential)] public struct IntRect { /// Left coordinate. int left_; /// Top coordinate. int top_; /// Right coordinate. int right_; /// Bottom coordinate. int bottom_; } }
mit
C#
66b585a7053aaead1211fbcbc31c11ca97ac2c82
Make HsvSession property internal, so it can be accessed from other HFM classes
agardiner/hfmcmd,agardiner/hfmcmd,agardiner/hfmcmd
src/hfm/Session.cs
src/hfm/Session.cs
using System; using log4net; using HSVSESSIONLib; using HSVCALCULATELib; using Command; namespace HFM { public class Session { // Reference to class logger protected static readonly ILog _log = LogManager.GetLogger( System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // Reference to HFM HsvSession object internal readonly HsvSession HsvSession; private Calculate _calculate; public Session(HsvSession session) { HsvSession = session; } [Factory] public Calculate Calculate { get { if(_calculate == null) { _calculate = new Calculate((HsvCalculate)HsvSession.Calculate); } return _calculate; } } } }
using System; using log4net; using HSVSESSIONLib; using HSVCALCULATELib; using Command; namespace HFM { public class Session { // Reference to class logger protected static readonly ILog _log = LogManager.GetLogger( System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // Reference to HFM HsvSession object protected readonly HsvSession _session; private Calculate _calculate; public Session(HsvSession session) { _session = session; } [Factory] public Calculate Calculate { get { if(_calculate == null) { _calculate = new Calculate((HsvCalculate)_session.Calculate); } return _calculate; } } } }
bsd-2-clause
C#
12e0591979a045657c101815c64a51f474f41cdf
Add test to check that Unicode languages work (testing Chinese).
jcheng31/DarkSkyApi,jcheng31/ForecastPCL
ForecastPCL.Test/LanguageTests.cs
ForecastPCL.Test/LanguageTests.cs
namespace ForecastPCL.Test { using System; using System.Configuration; using ForecastIOPortable; using NUnit.Framework; [TestFixture] public class LanguageTests { // These coordinates came from the Forecast API documentation, // and should return forecasts with all blocks. private const double AlcatrazLatitude = 37.8267; private const double AlcatrazLongitude = -122.423; private const double MumbaiLatitude = 18.975; private const double MumbaiLongitude = 72.825833; /// <summary> /// API key to be used for testing. This should be specified in the /// test project's app.config file. /// </summary> private string apiKey; /// <summary> /// Sets up all tests by retrieving the API key from app.config. /// </summary> [TestFixtureSetUp] public void SetUp() { this.apiKey = ConfigurationManager.AppSettings["ApiKey"]; } [Test] public void AllLanguagesHaveValues() { foreach (Language language in Enum.GetValues(typeof(Language))) { Assert.That(() => language.ToValue(), Throws.Nothing); } } [Test] public async void UnicodeLanguageIsSupported() { var client = new ForecastApi(this.apiKey); var result = await client.GetWeatherDataAsync(AlcatrazLatitude, AlcatrazLongitude, Unit.Auto, Language.Chinese); Assert.That(result, Is.Not.Null); } } }
namespace ForecastPCL.Test { using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using ForecastIOPortable; using NUnit.Framework; [TestFixture] public class LanguageTests { [Test] public void AllLanguagesHaveValues() { foreach (Language language in Enum.GetValues(typeof(Language))) { Assert.That(() => language.ToValue(), Throws.Nothing); } } } }
mit
C#
c86b93be0d5dafe75537150271be57b3a5850751
Fix typo.
JohanLarsson/Gu.Reactive
Gu.Reactive.Benchmarks/Program.cs
Gu.Reactive.Benchmarks/Program.cs
namespace Gu.Reactive.Benchmarks { using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.IO; using BenchmarkDotNet.Reports; using BenchmarkDotNet.Running; [SuppressMessage("ReSharper", "UnusedMember.Local")] [SuppressMessage("ReSharper", "UnusedParameter.Local")] public class Program { //// ReSharper disable PossibleNullReferenceException private static readonly string DestinationDirectory = Path.Combine(new DirectoryInfo(Directory.GetCurrentDirectory()).Parent.Parent.FullName, "Benchmarks"); //// ReSharper restore PossibleNullReferenceException public static void Main() { foreach (var summary in RunAll()) { CopyResult(summary.Title); } } private static IEnumerable<Summary> RunAll() { var switcher = new BenchmarkSwitcher(typeof(Program).Assembly); var summaries = switcher.Run(new[] { "*" }); return summaries; } private static IEnumerable<Summary> RunSingle<T>() { var summaries = new[] { BenchmarkRunner.Run<T>() }; return summaries; } private static void CopyResult(string name) { #if DEBUG #else var sourceFileName = Path.Combine(Directory.GetCurrentDirectory(), "BenchmarkDotNet.Artifacts", "results", name + "-report-github.md"); Directory.CreateDirectory(DestinationDirectory); var destinationFileName = Path.Combine(DestinationDirectory, name + ".md"); File.Copy(sourceFileName, destinationFileName, overwrite: true); #endif } } }
namespace Gu.Reactive.Benchmarks { using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.IO; using BenchmarkDotNet.Reports; using BenchmarkDotNet.Running; [SuppressMessage("ReSharper", "UnusedMember.Local")] [SuppressMessage("ReSharper", "UnusedParameter.Local")] public class Program { //// ReSharper disable PossibleNullReferenceException private static readonly string DesinationDirectory = Path.Combine(new DirectoryInfo(Directory.GetCurrentDirectory()).Parent.Parent.FullName, "Benchmarks"); //// ReSharper restore PossibleNullReferenceException public static void Main() { foreach (var summary in RunAll()) { CopyResult(summary.Title); } } private static IEnumerable<Summary> RunAll() { var switcher = new BenchmarkSwitcher(typeof(Program).Assembly); var summaries = switcher.Run(new[] { "*" }); return summaries; } private static IEnumerable<Summary> RunSingle<T>() { var summaries = new[] { BenchmarkRunner.Run<T>() }; return summaries; } private static void CopyResult(string name) { #if DEBUG #else var sourceFileName = Path.Combine(Directory.GetCurrentDirectory(), "BenchmarkDotNet.Artifacts", "results", name + "-report-github.md"); Directory.CreateDirectory(DesinationDirectory); var destinationFileName = Path.Combine(DesinationDirectory, name + ".md"); File.Copy(sourceFileName, destinationFileName, overwrite: true); #endif } } }
mit
C#
4c91bf684841ef4f8e67e03b9ae2d739f0e5260a
update version number
BlueSquid1/P2PNET,CrazySquid1/P2PNET
P2PNET/Properties/AssemblyInfo.cs
P2PNET/Properties/AssemblyInfo.cs
using System.Resources; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("P2PNET")] [assembly: AssemblyDescription("Peer-To-Peer network library")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Clinton Page")] [assembly: AssemblyProduct("P2PNET")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.5.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
using System.Resources; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("P2PNET")] [assembly: AssemblyDescription("Peer-To-Peer network library")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Clinton Page")] [assembly: AssemblyProduct("P2PNET")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] [assembly: NeutralResourcesLanguage("en")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.4.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]
mit
C#
280e34b253f5edbfedbcc3139c3c579516d554de
Implement Enabled flag to be able to run sorts separately
MSayfullin/Basics
Basics.Algorithms.Tests/SortingPerformanceTests.cs
Basics.Algorithms.Tests/SortingPerformanceTests.cs
using System; using System.Diagnostics; using System.Linq; using Basics.Algorithms.Sorts; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Basics.Algorithms.Tests { [TestClass] public class SortingPerformanceTests { private const int size = 1000000; private class SortInfo { public string Name { get; set; } public Action<int[]> Act { get; set; } public bool Enabled { get; set; } } [TestMethod] public void SortingPerformanceTest() { var stopwatch = new Stopwatch(); var sortedArray = new int[size]; for (int i = 0; i < size; i++) { sortedArray[i] = i; } var sorts = new SortInfo[] { new SortInfo { Name = "Selection Sort", Act = array => Selection.Sort(array), Enabled = false }, new SortInfo { Name = "Insertion Sort", Act = array => Insertion.Sort(array), Enabled = false }, new SortInfo { Name = "Shell Sort", Act = array => Shell.Sort(array), Enabled = false }, new SortInfo { Name = "Mergesort", Act = array => Merge.Sort(array), Enabled = true }, new SortInfo { Name = "Quicksort", Act = array => Quick.Sort(array), Enabled = true } }; foreach (var sort in sorts.Where(s => s.Enabled)) { sortedArray.Shuffle(); stopwatch.Restart(); sort.Act(sortedArray); stopwatch.Stop(); Console.WriteLine("{0}:\t{1}", sort.Name, stopwatch.ElapsedTicks); } } } }
using System; using System.Diagnostics; using Basics.Algorithms.Sorts; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace Basics.Algorithms.Tests { [TestClass] public class SortingPerformanceTests { private const int size = 10000; private class SortInfo { public string Name { get; set; } public Action<int[]> Act { get; set; } } [TestMethod] public void SortingPerformanceTest() { var stopwatch = new Stopwatch(); var sortedArray = new int[size]; for (int i = 0; i < size; i++) { sortedArray[i] = i; } var sorts = new SortInfo[] { new SortInfo { Name = "Selection Sort", Act = array => Selection.Sort(array) }, new SortInfo { Name = "Insertion Sort", Act = array => Insertion.Sort(array) }, new SortInfo { Name = "Shell Sort", Act = array => Shell.Sort(array) }, new SortInfo { Name = "Mergesort", Act = array => Merge.Sort(array) }, new SortInfo { Name = "Quicksort", Act = array => Quick.Sort(array) } }; foreach (var sort in sorts) { sortedArray.Shuffle(); stopwatch.Restart(); sort.Act(sortedArray); stopwatch.Stop(); Console.WriteLine("{0}:\t{1}", sort.Name, stopwatch.ElapsedTicks); } } } }
mit
C#
fcf37ab8e16aad5dda94834a029534b393cd0242
Add continue time entry on recent list view click.
ZhangLeiCharles/mobile,eatskolnikov/mobile,masterrr/mobile,eatskolnikov/mobile,peeedge/mobile,peeedge/mobile,masterrr/mobile,eatskolnikov/mobile,ZhangLeiCharles/mobile
Joey/UI/Fragments/RecentTimeEntriesListFragment.cs
Joey/UI/Fragments/RecentTimeEntriesListFragment.cs
using System; using System.Linq; using Android.App; using Android.OS; using Android.Views; using Android.Widget; using Toggl.Joey.UI.Adapters; namespace Toggl.Joey.UI.Fragments { public class RecentTimeEntriesListFragment : ListFragment { public override void OnViewCreated (View view, Bundle savedInstanceState) { base.OnViewCreated (view, savedInstanceState); ListAdapter = new RecentTimeEntriesAdapter (); } public override void OnListItemClick (ListView l, View v, int position, long id) { var adapter = l.Adapter as RecentTimeEntriesAdapter; if (adapter == null) return; var model = adapter.GetModel (position); if (model == null) return; model.Continue (); } } }
using System; using System.Linq; using Android.App; using Android.OS; using Android.Views; using Toggl.Joey.UI.Adapters; namespace Toggl.Joey.UI.Fragments { public class RecentTimeEntriesListFragment : ListFragment { public override void OnViewCreated (View view, Bundle savedInstanceState) { base.OnViewCreated (view, savedInstanceState); ListAdapter = new RecentTimeEntriesAdapter (); } } }
bsd-3-clause
C#
b4cf47e7595aafa4d4f5813ed0ac0f786d47b356
Replace tabs
jinhyuki/MagTiles,jinhyuki/MagTiles,jinhyuki/MagTiles
Source/MagTiles/MagTiles.Build.cs
Source/MagTiles/MagTiles.Build.cs
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved. namespace UnrealBuildTool.Rules { public class MagTiles : ModuleRules { public MagTiles(ReadOnlyTargetRules Target) : base(Target) { PublicIncludePaths.AddRange( new string[] { // ... add public include paths required here ... } ); PrivateIncludePaths.AddRange( new string[] { "Developer/MagTiles/Private", // ... add other private include paths required here ... } ); PublicDependencyModuleNames.AddRange( new string[] { "Core", "CoreUObject", // Core includes "ShaderCore", "RenderCore", "RHI", "RuntimeMeshComponent", // For RMC "Engine" // For things like actor component } ); PrivateDependencyModuleNames.AddRange( new string[] { // ... add private dependencies that you statically link with here ... } ); DynamicallyLoadedModuleNames.AddRange( new string[] { // ... add any modules that your module loads dynamically here ... } ); } } }
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved. namespace UnrealBuildTool.Rules { public class MagTiles : ModuleRules { public MagTiles(ReadOnlyTargetRules Target) : base(Target) { PublicIncludePaths.AddRange( new string[] { // ... add public include paths required here ... } ); PrivateIncludePaths.AddRange( new string[] { "Developer/MagTiles/Private", // ... add other private include paths required here ... } ); PublicDependencyModuleNames.AddRange( new string[] { "Core", "CoreUObject", // Core includes "ShaderCore", "RenderCore", "RHI", "RuntimeMeshComponent", // For RMC "Engine" // For things like actor component } ); PrivateDependencyModuleNames.AddRange( new string[] { // ... add private dependencies that you statically link with here ... } ); DynamicallyLoadedModuleNames.AddRange( new string[] { // ... add any modules that your module loads dynamically here ... } ); } } }
mit
C#
f345ff4ac394b1a6a8833d3509c0e7fec640dc30
Fix MockDataProcessor
plainerman/TicTacTube
TicTacTubeCoreTest/Processors/MockDataProcessor.cs
TicTacTubeCoreTest/Processors/MockDataProcessor.cs
using TicTacTubeCore.Processors.Definitions; using TicTacTubeCore.Sources.Files; namespace TicTacTubeCoreTest.Processors { public class MockDataProcessor : BaseDataProcessor { public int ExecutionCount { get; protected set; } public override IFileSource Execute(IFileSource fileSoure) { ExecutionCount++; return fileSoure; } public void ResetExecutionCount() => ExecutionCount = 0; } }
using TicTacTubeCore.Processors.Definitions; using TicTacTubeCore.Sources.Files; namespace TicTacTubeCoreTest.Processors { public class MockDataProcessor : BaseDataProcessor { public int ExecutionCount { get; protected set; } public override IFileSource Execute(IFileSource fileSoure) => fileSoure; public void ResetExecutionCount() => ExecutionCount = 0; } }
mit
C#
89804c2fb5f8deae667e7da084776e12314cf6a6
Update version
RainwayApp/warden
Warden/Properties/AssemblyInfo.cs
Warden/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("Warden")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Rainway, Inc.")] [assembly: AssemblyProduct("Warden")] [assembly: AssemblyCopyright("Copyright © 2017")] [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("69bd1ac4-362a-41d0-8e84-a76064d90b4b")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.4.0.0")] [assembly: AssemblyFileVersion("1.4.0.0")]
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Warden")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Rainway, Inc.")] [assembly: AssemblyProduct("Warden")] [assembly: AssemblyCopyright("Copyright © 2017")] [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("69bd1ac4-362a-41d0-8e84-a76064d90b4b")] // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.3.0.0")] [assembly: AssemblyFileVersion("1.3.0.0")]
apache-2.0
C#
037485289b79281c9c3c5b626b1eb27f0b383541
Add IsFilterActive; remove unneeded parameters to filter (pass it on ctor)
neitsa/PrepareLanding,neitsa/PrepareLanding
src/Filters/ITileFilter.cs
src/Filters/ITileFilter.cs
using System; using System.Collections.Generic; namespace PrepareLanding.Filters { public enum FilterHeaviness { Light = 0, Medium = 1, Heavy = 2 } public interface ITileFilter { string SubjectThingDef { get; } string RunningDescription { get; } string AttachedProperty { get; } Action<List<int>> FilterAction { get; } FilterHeaviness Heaviness { get; } List<int> FilteredTiles { get; } void Filter(List<int> inputList); bool IsFilterActive { get; } } }
using System; using System.Collections.Generic; namespace PrepareLanding.Filters { public enum FilterHeaviness { Light = 0, Medium = 1, Heavy = 2 } public interface ITileFilter { string SubjectThingDef { get; } string RunningDescription { get; } string AttachedProperty { get; } Action<PrepareLandingUserData, List<int>> FilterAction { get; } FilterHeaviness Heaviness { get; } List<int> FilteredTiles { get; } void Filter(PrepareLandingUserData userData, List<int> inputList); } }
mit
C#
a7720b7fca4e5163b1a62da0efca79c2a8757de9
Remove unused field.
orthoxerox/roslyn,xoofx/roslyn,stephentoub/roslyn,OmarTawfik/roslyn,MichalStrehovsky/roslyn,nguerrera/roslyn,zooba/roslyn,heejaechang/roslyn,KirillOsenkov/roslyn,pdelvo/roslyn,OmarTawfik/roslyn,brettfo/roslyn,eriawan/roslyn,akrisiun/roslyn,srivatsn/roslyn,ErikSchierboom/roslyn,weltkante/roslyn,AArnott/roslyn,orthoxerox/roslyn,jmarolf/roslyn,brettfo/roslyn,reaction1989/roslyn,drognanar/roslyn,aelij/roslyn,MattWindsor91/roslyn,KevinRansom/roslyn,khyperia/roslyn,lorcanmooney/roslyn,bartdesmet/roslyn,swaroop-sridhar/roslyn,MichalStrehovsky/roslyn,diryboy/roslyn,swaroop-sridhar/roslyn,tmeschter/roslyn,eriawan/roslyn,AnthonyDGreen/roslyn,bbarry/roslyn,abock/roslyn,genlu/roslyn,drognanar/roslyn,dotnet/roslyn,diryboy/roslyn,pdelvo/roslyn,davkean/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,AlekseyTs/roslyn,cston/roslyn,stephentoub/roslyn,heejaechang/roslyn,kelltrick/roslyn,jamesqo/roslyn,VSadov/roslyn,CaptainHayashi/roslyn,jeffanders/roslyn,jkotas/roslyn,yeaicc/roslyn,AnthonyDGreen/roslyn,aelij/roslyn,mattwar/roslyn,Giftednewt/roslyn,AArnott/roslyn,abock/roslyn,davkean/roslyn,bkoelman/roslyn,jamesqo/roslyn,khyperia/roslyn,jmarolf/roslyn,mattscheffer/roslyn,jcouv/roslyn,AmadeusW/roslyn,physhi/roslyn,bbarry/roslyn,mavasani/roslyn,lorcanmooney/roslyn,gafter/roslyn,MichalStrehovsky/roslyn,AmadeusW/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,mgoertz-msft/roslyn,ErikSchierboom/roslyn,yeaicc/roslyn,akrisiun/roslyn,AnthonyDGreen/roslyn,dpoeschl/roslyn,AdamSpeight2008/roslyn-AdamSpeight2008,xoofx/roslyn,CyrusNajmabadi/roslyn,gafter/roslyn,TyOverby/roslyn,MattWindsor91/roslyn,eriawan/roslyn,KevinH-MS/roslyn,physhi/roslyn,Giftednewt/roslyn,DustinCampbell/roslyn,amcasey/roslyn,xasx/roslyn,brettfo/roslyn,panopticoncentral/roslyn,srivatsn/roslyn,kelltrick/roslyn,vslsnap/roslyn,KevinRansom/roslyn,shyamnamboodiripad/roslyn,tvand7093/roslyn,kelltrick/roslyn,paulvanbrenk/roslyn,tmat/roslyn,MattWindsor91/roslyn,TyOverby/roslyn,Hosch250/roslyn,AmadeusW/roslyn,genlu/roslyn,Giftednewt/roslyn,KevinH-MS/roslyn,a-ctor/roslyn,AArnott/roslyn,CaptainHayashi/roslyn,agocke/roslyn,swaroop-sridhar/roslyn,VSadov/roslyn,mgoertz-msft/roslyn,tvand7093/roslyn,KevinH-MS/roslyn,AlekseyTs/roslyn,bkoelman/roslyn,robinsedlaczek/roslyn,genlu/roslyn,vslsnap/roslyn,sharwell/roslyn,mattscheffer/roslyn,OmarTawfik/roslyn,CyrusNajmabadi/roslyn,paulvanbrenk/roslyn,xasx/roslyn,bkoelman/roslyn,KirillOsenkov/roslyn,dpoeschl/roslyn,mmitche/roslyn,mattwar/roslyn,orthoxerox/roslyn,aelij/roslyn,tmat/roslyn,paulvanbrenk/roslyn,sharwell/roslyn,KirillOsenkov/roslyn,Hosch250/roslyn,mmitche/roslyn,MattWindsor91/roslyn,bbarry/roslyn,diryboy/roslyn,a-ctor/roslyn,CyrusNajmabadi/roslyn,jmarolf/roslyn,jasonmalinowski/roslyn,tmat/roslyn,physhi/roslyn,agocke/roslyn,lorcanmooney/roslyn,wvdd007/roslyn,zooba/roslyn,jcouv/roslyn,zooba/roslyn,tvand7093/roslyn,robinsedlaczek/roslyn,nguerrera/roslyn,srivatsn/roslyn,panopticoncentral/roslyn,vslsnap/roslyn,wvdd007/roslyn,KevinRansom/roslyn,DustinCampbell/roslyn,mattwar/roslyn,ErikSchierboom/roslyn,davkean/roslyn,panopticoncentral/roslyn,xoofx/roslyn,VSadov/roslyn,mattscheffer/roslyn,tmeschter/roslyn,shyamnamboodiripad/roslyn,gafter/roslyn,agocke/roslyn,weltkante/roslyn,amcasey/roslyn,CaptainHayashi/roslyn,abock/roslyn,Hosch250/roslyn,jamesqo/roslyn,tmeschter/roslyn,mavasani/roslyn,jkotas/roslyn,dotnet/roslyn,mgoertz-msft/roslyn,cston/roslyn,jeffanders/roslyn,dotnet/roslyn,bartdesmet/roslyn,sharwell/roslyn,yeaicc/roslyn,tannergooding/roslyn,pdelvo/roslyn,cston/roslyn,mmitche/roslyn,amcasey/roslyn,jkotas/roslyn,drognanar/roslyn,wvdd007/roslyn,jeffanders/roslyn,bartdesmet/roslyn,akrisiun/roslyn,heejaechang/roslyn,mavasani/roslyn,tannergooding/roslyn,a-ctor/roslyn,xasx/roslyn,reaction1989/roslyn,tannergooding/roslyn,weltkante/roslyn,shyamnamboodiripad/roslyn,nguerrera/roslyn,khyperia/roslyn,jasonmalinowski/roslyn,robinsedlaczek/roslyn,stephentoub/roslyn,AlekseyTs/roslyn,reaction1989/roslyn,DustinCampbell/roslyn,TyOverby/roslyn,jcouv/roslyn,dpoeschl/roslyn,jasonmalinowski/roslyn
src/EditorFeatures/Core/Implementation/Suggestions/CodeFixSuggestedAction.cs
src/EditorFeatures/Core/Implementation/Suggestions/CodeFixSuggestedAction.cs
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; using System.Collections.Immutable; using System.Globalization; using System.Linq; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editor.Host; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.VisualStudio.Language.Intellisense; using Microsoft.VisualStudio.Text; namespace Microsoft.CodeAnalysis.Editor.Implementation.Suggestions { /// <summary> /// Represents light bulb menu item for code fixes. /// </summary> internal sealed class CodeFixSuggestedAction : SuggestedActionWithPreview, ISuggestedActionWithFlavors, ITelemetryDiagnosticID<string> { private readonly CodeFix _fix; private readonly SuggestedActionSet _fixAllSuggestedActionSet; public CodeFixSuggestedAction( Workspace workspace, ITextBuffer subjectBuffer, ICodeActionEditHandlerService editHandler, IWaitIndicator waitIndicator, CodeFix fix, CodeAction action, object provider, SuggestedActionSet fixAllSuggestedActionSet, IAsynchronousOperationListener operationListener) : base(workspace, subjectBuffer, editHandler, waitIndicator, action, provider, operationListener) { _fix = fix; _fixAllSuggestedActionSet = fixAllSuggestedActionSet; } protected override SuggestedActionSet GetAdditionalActionSet() => _fixAllSuggestedActionSet; public string GetDiagnosticID() { var diagnostic = _fix.PrimaryDiagnostic; // we log diagnostic id as it is if it is from us if (diagnostic.Descriptor.CustomTags.Any(t => t == WellKnownDiagnosticTags.Telemetry)) { return diagnostic.Id; } // if it is from third party, we use hashcode return diagnostic.GetHashCode().ToString(CultureInfo.InvariantCulture); } protected override DiagnosticData GetDiagnostic() { return _fix.GetPrimaryDiagnosticData(); } } }
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Collections.Generic; using System.Collections.Immutable; using System.Globalization; using System.Linq; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editor.Host; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.VisualStudio.Language.Intellisense; using Microsoft.VisualStudio.Text; namespace Microsoft.CodeAnalysis.Editor.Implementation.Suggestions { /// <summary> /// Represents light bulb menu item for code fixes. /// </summary> internal sealed class CodeFixSuggestedAction : SuggestedActionWithPreview, ISuggestedActionWithFlavors, ITelemetryDiagnosticID<string> { private readonly CodeFix _fix; private readonly SuggestedActionSet _fixAllSuggestedActionSet; private ImmutableArray<SuggestedActionSet> _actionSets; public CodeFixSuggestedAction( Workspace workspace, ITextBuffer subjectBuffer, ICodeActionEditHandlerService editHandler, IWaitIndicator waitIndicator, CodeFix fix, CodeAction action, object provider, SuggestedActionSet fixAllSuggestedActionSet, IAsynchronousOperationListener operationListener) : base(workspace, subjectBuffer, editHandler, waitIndicator, action, provider, operationListener) { _fix = fix; _fixAllSuggestedActionSet = fixAllSuggestedActionSet; } protected override SuggestedActionSet GetAdditionalActionSet() => _fixAllSuggestedActionSet; public string GetDiagnosticID() { var diagnostic = _fix.PrimaryDiagnostic; // we log diagnostic id as it is if it is from us if (diagnostic.Descriptor.CustomTags.Any(t => t == WellKnownDiagnosticTags.Telemetry)) { return diagnostic.Id; } // if it is from third party, we use hashcode return diagnostic.GetHashCode().ToString(CultureInfo.InvariantCulture); } protected override DiagnosticData GetDiagnostic() { return _fix.GetPrimaryDiagnosticData(); } } }
apache-2.0
C#
5d81873d4885e3e161baca8dc34dc1a10ae1fd52
Make sure that GitSwitchBranchesTask is treated as critical.
github-for-unity/Unity,github-for-unity/Unity,mpOzelot/Unity,mpOzelot/Unity,github-for-unity/Unity
src/GitHub.Unity/Assets/Plugins/GitHub/Editor/Tasks/GitSwitchBranchesTask.cs
src/GitHub.Unity/Assets/Plugins/GitHub/Editor/Tasks/GitSwitchBranchesTask.cs
using UnityEngine; using UnityEditor; using System; using System.IO; using System.Text; namespace GitHub.Unity { class GitSwitchBranchesTask : GitTask { const string SwitchConfirmedMessage = "Switched to branch '{0}'"; public static void Schedule(string branch, Action onSuccess, Action onFailure = null) { Tasks.Add(new GitSwitchBranchesTask(branch, onSuccess, onFailure)); } string branch; Action onSuccess, onFailure; StringWriter output = new StringWriter(), error = new StringWriter(); public override bool Blocking { get { return true; } } public override TaskQueueSetting Queued { get { return TaskQueueSetting.QueueSingle; } } public override bool Critical { get { return true; } } public override bool Cached { get { return false; } } public override string Label { get { return "git checkout"; } } protected override string ProcessArguments { get { return string.Format("checkout {0}", branch); } } protected override TextWriter OutputBuffer { get { return output; } } protected override TextWriter ErrorBuffer { get { return error; } } GitSwitchBranchesTask(string branch, Action onSuccess, Action onFailure = null) { this.branch = branch; this.onSuccess = onSuccess; this.onFailure = onFailure; } protected override void OnProcessOutputUpdate() { if (Done) { // Handle failure / success StringBuilder buffer = error.GetStringBuilder(); if (buffer.Length > 0) { string message = buffer.ToString().Trim(); if (!message.Equals(string.Format(SwitchConfirmedMessage, branch))) { Tasks.ReportFailure(FailureSeverity.Critical, this, message); if (onFailure != null) { Tasks.ScheduleMainThread(onFailure); } return; } } if (onSuccess != null) { Tasks.ScheduleMainThread(onSuccess); } } } } }
using UnityEngine; using UnityEditor; using System; using System.IO; using System.Text; namespace GitHub.Unity { class GitSwitchBranchesTask : GitTask { const string SwitchConfirmedMessage = "Switched to branch '{0}'"; public static void Schedule(string branch, Action onSuccess, Action onFailure = null) { Tasks.Add(new GitSwitchBranchesTask(branch, onSuccess, onFailure)); } string branch; Action onSuccess, onFailure; StringWriter output = new StringWriter(), error = new StringWriter(); public override bool Blocking { get { return true; } } public override TaskQueueSetting Queued { get { return TaskQueueSetting.QueueSingle; } } public override bool Critical { get { return false; } } public override bool Cached { get { return false; } } public override string Label { get { return "git checkout"; } } protected override string ProcessArguments { get { return string.Format("checkout {0}", branch); } } protected override TextWriter OutputBuffer { get { return output; } } protected override TextWriter ErrorBuffer { get { return error; } } GitSwitchBranchesTask(string branch, Action onSuccess, Action onFailure = null) { this.branch = branch; this.onSuccess = onSuccess; this.onFailure = onFailure; } protected override void OnProcessOutputUpdate() { if (Done) { // Handle failure / success StringBuilder buffer = error.GetStringBuilder(); if (buffer.Length > 0) { string message = buffer.ToString().Trim(); if (!message.Equals(string.Format(SwitchConfirmedMessage, branch))) { Tasks.ReportFailure(FailureSeverity.Critical, this, message); if (onFailure != null) { Tasks.ScheduleMainThread(onFailure); } return; } } if (onSuccess != null) { Tasks.ScheduleMainThread(onSuccess); } } } } }
mit
C#
feb3ab14884ced340181375a5f39bf74f274501c
Fix CurrencyRepository#TryAddCurrencyValue.
Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW,Midnight-Myth/Mitternacht-NEW
src/MitternachtBot/Services/Database/Repositories/Impl/CurrencyRepository.cs
src/MitternachtBot/Services/Database/Repositories/Impl/CurrencyRepository.cs
using System.Linq; using Microsoft.EntityFrameworkCore; using Mitternacht.Services.Database.Models; namespace Mitternacht.Services.Database.Repositories.Impl { public class CurrencyRepository : Repository<Currency>, ICurrencyRepository { public CurrencyRepository(DbContext context) : base(context) { } public Currency GetOrCreate(ulong userId) { var currency = _set.FirstOrDefault(c => c.UserId == userId); if(currency == null) { _set.Add(currency = new Currency() { UserId = userId, Amount = 0, }); } return currency; } public IQueryable<Currency> GetTopRichest(int count, int skip = 0) => _set.AsQueryable().OrderByDescending(c => c.Amount).Skip(skip).Take(count); public long GetUserCurrencyValue(ulong userId) => GetOrCreate(userId).Amount; public bool TryAddCurrencyValue(ulong userId, long change) { var currency = GetOrCreate(userId); var canApplyChange = change != 0 && (change > 0 || currency.Amount + change >= 0); currency.Amount += canApplyChange ? change : 0; return canApplyChange; } } }
using System.Linq; using Microsoft.EntityFrameworkCore; using Mitternacht.Services.Database.Models; namespace Mitternacht.Services.Database.Repositories.Impl { public class CurrencyRepository : Repository<Currency>, ICurrencyRepository { public CurrencyRepository(DbContext context) : base(context) { } public Currency GetOrCreate(ulong userId) { var currency = _set.FirstOrDefault(c => c.UserId == userId); if(currency == null) { _set.Add(currency = new Currency() { UserId = userId, Amount = 0, }); } return currency; } public IQueryable<Currency> GetTopRichest(int count, int skip = 0) => _set.AsQueryable().OrderByDescending(c => c.Amount).Skip(skip).Take(count); public long GetUserCurrencyValue(ulong userId) => GetOrCreate(userId).Amount; public bool TryAddCurrencyValue(ulong userId, long change) { var currency = GetOrCreate(userId); var canApplyChange = change != 0 || change > 0 || currency.Amount + change >= 0; currency.Amount += canApplyChange ? change : 0; return canApplyChange; } } }
mit
C#
b68198c987754b8d1b6a20654b4855f67ffbb701
Change test code to repro issue in old code and prove new code doesn't crash
loekd/ServiceFabric.PubSubActors
tests/SoCreate.ServiceFabric.PubSub.Tests/GivenDefaultBrokerEventsManager.cs
tests/SoCreate.ServiceFabric.PubSub.Tests/GivenDefaultBrokerEventsManager.cs
using Microsoft.ServiceFabric.Actors; using Microsoft.VisualStudio.TestTools.UnitTesting; using SoCreate.ServiceFabric.PubSub.Events; using SoCreate.ServiceFabric.PubSub.State; using System; using System.Threading; using System.Threading.Tasks; namespace SoCreate.ServiceFabric.PubSub.Tests { [TestClass] public class GivenDefaultBrokerEventsManager { [TestMethod] public void WhenInsertingConcurrently_ThenAllCallbacksAreMadeCorrectly() { bool hasCrashed = false; var manager = new DefaultBrokerEventsManager(); ManualResetEvent mr = new ManualResetEvent(false); ManualResetEvent mr2 = new ManualResetEvent(false); manager.Subscribed += (s, e, t) => { mr.WaitOne(); return Task.CompletedTask; }; const int attempts = 2000; for (int i = 0; i < attempts; i++) { ThreadPool.QueueUserWorkItem(async j => { var actorReference = new ActorReference { ActorId = ActorId.CreateRandom() }; try { await manager.OnSubscribedAsync("Key" + (int) j % 5, new ActorReferenceWrapper(actorReference), "MessageType"); } catch (NullReferenceException) { hasCrashed = true; } catch (IndexOutOfRangeException) { hasCrashed = true; } finally { if ((int)j == attempts - 1) { mr2.Set(); } } }, i); } mr.Set(); Assert.IsTrue(mr2.WaitOne(TimeSpan.FromSeconds(10)), "Failed to run within time limits."); Assert.IsFalse(hasCrashed, "Should not crash."); } } }
using Microsoft.ServiceFabric.Actors; using Microsoft.VisualStudio.TestTools.UnitTesting; using SoCreate.ServiceFabric.PubSub.Events; using SoCreate.ServiceFabric.PubSub.State; using System.Collections.Generic; using System.Threading.Tasks; namespace SoCreate.ServiceFabric.PubSub.Tests { [TestClass] public class GivenDefaultBrokerEventsManager { [TestMethod] public async Task WhenInsertingConcurrently_ThenAllCallbacksAreMadeCorrectly() { int callCount = 0; var manager = new DefaultBrokerEventsManager(); manager.Subscribed += (s, e, t) => { lock (manager) { callCount++; } return Task.CompletedTask; }; const int attempts = 20; var tasks = new List<Task>(attempts); for (int i = 0; i < attempts; i++) { var actorReference = new ActorReference{ ActorId = ActorId.CreateRandom() }; tasks.Add(manager.OnSubscribedAsync("Key", new ActorReferenceWrapper(actorReference), "MessageType")); } await Task.WhenAll(tasks); Assert.AreEqual(attempts, callCount); } } }
mit
C#
d4f780c02beb4a48a523922b84902fdc4d685cf8
Build and publish nuget package
peteraritchie/Rock.Core,RockFramework/Rock.Core
Rock.Core/Properties/AssemblyInfo.cs
Rock.Core/Properties/AssemblyInfo.cs
using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Rock.Core")] [assembly: AssemblyDescription("Core classes and interfaces for Rock Framework.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Quicken Loans")] [assembly: AssemblyProduct("Rock.Core")] [assembly: AssemblyCopyright("Copyright © Quicken Loans 2014-2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("6fb79d22-8ea3-4cb0-a704-8608d679cb95")] // 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.9.0.0")] [assembly: AssemblyFileVersion("0.9.10")] [assembly: AssemblyInformationalVersion("0.9.10")] [assembly: InternalsVisibleTo("Rock.Core.UnitTests")]
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("Rock.Core")] [assembly: AssemblyDescription("Core classes and interfaces for Rock Framework.")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Quicken Loans")] [assembly: AssemblyProduct("Rock.Core")] [assembly: AssemblyCopyright("Copyright © Quicken Loans 2014-2015")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("6fb79d22-8ea3-4cb0-a704-8608d679cb95")] // 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.9.0.0")] [assembly: AssemblyFileVersion("0.9.9")] [assembly: AssemblyInformationalVersion("0.9.9")] [assembly: InternalsVisibleTo("Rock.Core.UnitTests")]
mit
C#
530d260eb6dda22b0130c51c759b137ac76826b9
clean up EventContext when it is put in the pool.
fairygui/FairyGUI-unity
Source/Scripts/Event/EventContext.cs
Source/Scripts/Event/EventContext.cs
using System.Collections.Generic; namespace FairyGUI { /// <summary> /// /// </summary> public class EventContext { /// <summary> /// /// </summary> public EventDispatcher sender { get; internal set; } /// <summary> /// / /// </summary> public object initiator { get; internal set; } /// <summary> /// / /// </summary> public InputEvent inputEvent { get; internal set; } /// <summary> /// /// </summary> public string type; /// <summary> /// /// </summary> public object data; internal bool _defaultPrevented; internal bool _stopsPropagation; internal bool _touchCapture; internal List<EventBridge> callChain = new List<EventBridge>(); /// <summary> /// /// </summary> public void StopPropagation() { _stopsPropagation = true; } /// <summary> /// /// </summary> public void PreventDefault() { _defaultPrevented = true; } /// <summary> /// /// </summary> public void CaptureTouch() { _touchCapture = true; } /// <summary> /// /// </summary> public bool isDefaultPrevented { get { return _defaultPrevented; } } static Stack<EventContext> pool = new Stack<EventContext>(); internal static EventContext Get() { if (pool.Count > 0) { EventContext context = pool.Pop(); context._stopsPropagation = false; context._defaultPrevented = false; context._touchCapture = false; return context; } else return new EventContext(); } internal static void Return(EventContext value) { value.sender = null; value.initiator = null; value.data = null; value.inputEvent = null; pool.Push(value); } } }
using System.Collections.Generic; namespace FairyGUI { /// <summary> /// /// </summary> public class EventContext { /// <summary> /// /// </summary> public EventDispatcher sender { get; internal set; } /// <summary> /// / /// </summary> public object initiator { get; internal set; } /// <summary> /// / /// </summary> public InputEvent inputEvent { get; internal set; } /// <summary> /// /// </summary> public string type; /// <summary> /// /// </summary> public object data; internal bool _defaultPrevented; internal bool _stopsPropagation; internal bool _touchCapture; internal List<EventBridge> callChain = new List<EventBridge>(); /// <summary> /// /// </summary> public void StopPropagation() { _stopsPropagation = true; } /// <summary> /// /// </summary> public void PreventDefault() { _defaultPrevented = true; } /// <summary> /// /// </summary> public void CaptureTouch() { _touchCapture = true; } /// <summary> /// /// </summary> public bool isDefaultPrevented { get { return _defaultPrevented; } } static Stack<EventContext> pool = new Stack<EventContext>(); internal static EventContext Get() { if (pool.Count > 0) { EventContext context = pool.Pop(); context._stopsPropagation = false; context._defaultPrevented = false; context._touchCapture = false; return context; } else return new EventContext(); } internal static void Return(EventContext value) { pool.Push(value); } } }
mit
C#
373eb26cdd6a36b759904983c3a40bda5afb17a8
add page name to template
moonwa/moonlit,moonwa/moonlit,moonwa/moonlit
src/Moonlit.Mvc/Templates/Template.cs
src/Moonlit.Mvc/Templates/Template.cs
using System.Collections.Generic; using System.Web.Mvc; namespace Moonlit.Mvc.Templates { public abstract class Template { public string Title { get; set; } public string Description { get; set; } public abstract string ViewName { get; } public string PageName { get; set; } public ISite Site { get; set; } public virtual void OnReadyRender(ControllerContext context) { } } public interface ISite { string Title { get; } string CopyRight { get; } } }
using System.Collections.Generic; using System.Web.Mvc; namespace Moonlit.Mvc.Templates { public abstract class Template { public string Title { get; set; } public string Description { get; set; } public abstract string ViewName { get; } public ISite Site { get; set; } public virtual void OnReadyRender(ControllerContext context) { } } public interface ISite { string Title { get; } string CopyRight { get; } } }
mit
C#
f7d4e70f884174fe5b5c53b0ef1e81185f8da9ab
Add description for all QueueArguments
northspb/RawRabbit,pardahlman/RawRabbit
src/RawRabbit/Common/QueueArgument.cs
src/RawRabbit/Common/QueueArgument.cs
namespace RawRabbit.Common { public class QueueArgument { /// <summary> /// Indicates that the queue is a priority queue that honours the <br /> /// priority property of a recieved message. /// </summary> public static readonly string MaxPriority = "x-max-priority"; /// <summary> /// Sets what exchange that will be used as a dead letter exchange. <br/> /// More information: https://www.rabbitmq.com/dlx.html /// </summary> public static readonly string DeadLetterExchange = "x-dead-letter-exchange"; /// <summary> /// Sets the Time To Live (TTL) in milliseconds for messages in the queue. /// </summary> public static readonly string MessageTtl = "x-message-ttl"; /// <summary> /// Set QueueMode for a queue. Valid modes are "default" and "layz".<br /> /// The messages for a lazy queue is held on disc and only loaded to /// RAM when requested by consumer. /// </summary> public static readonly string QueueMode = "x-queue-mode"; } }
namespace RawRabbit.Common { public class QueueArgument { public static readonly string MaxPriority = "x-max-priority"; public static readonly string DeadLetterExchange = "x-dead-letter-exchange"; public static readonly string MessageTtl = "x-message-ttl"; /// <summary> /// Set QueueMode for a queue. Valid modes are "default" and "layz".<br /> /// The messages for a lazy queue is held on disc and only loaded to /// RAM when requested by consumer. /// </summary> public static readonly string QueueMode = "x-queue-mode"; } }
mit
C#
0442870a9308625057e684a7d1796f6f14903516
Update PlatformCompositionRootSetupBase.cs
tiksn/TIKSN-Framework
TIKSN.Framework.Platform/DependencyInjection/PlatformCompositionRootSetupBase.cs
TIKSN.Framework.Platform/DependencyInjection/PlatformCompositionRootSetupBase.cs
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; namespace TIKSN.DependencyInjection { public abstract class PlatformCompositionRootSetupBase : CompositionRootSetupBase { protected PlatformCompositionRootSetupBase(IConfigurationRoot configurationRoot) : base(configurationRoot) { } protected override void ConfigureServices(IServiceCollection services) => services.AddFrameworkPlatform(); } }
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; namespace TIKSN.DependencyInjection { public abstract class PlatformCompositionRootSetupBase : CompositionRootSetupBase { protected PlatformCompositionRootSetupBase(IConfigurationRoot configurationRoot) : base(configurationRoot) { } protected override void ConfigureServices(IServiceCollection services) { services.AddFrameworkPlatform(); } } }
mit
C#
e4c8b291524dc7c7e40ce691a7486870211df82e
add logoutrequesttest
peterwurzinger/SamlOida
test/SamlOida.Test/MessageHandler/MessageFactory/LogoutRequestFactoryTests.cs
test/SamlOida.Test/MessageHandler/MessageFactory/LogoutRequestFactoryTests.cs
using SamlOida.MessageHandler.MessageFactory; using SamlOida.Model; using System; using System.Collections.Generic; using System.Text; using System.Xml; using Xunit; namespace SamlOida.Test.MessageHandler.MessageFactory { public class LogoutRequestFactoryTests { private readonly LogoutRequestFactory _logoutRequestFactory; public LogoutRequestFactoryTests() { _logoutRequestFactory = new LogoutRequestFactory(); } [Fact] public void ShouldCreateMessage() { var options = new SamlOptions(); options.SignOutgoingMessages = false; var authnRequestMessage = new SamlLogoutRequestMessage(); authnRequestMessage.NameId = "test"; var xmlDocument = _logoutRequestFactory.CreateMessage(options, authnRequestMessage); XmlNamespaceManager mgr = new XmlNamespaceManager(xmlDocument.NameTable); mgr.AddNamespace("samlp", "urn:oasis:names:tc:SAML:2.0:protocol"); mgr.AddNamespace("saml", "urn:oasis:names:tc:SAML:2.0:assertion"); var logoutResponseNode = xmlDocument.SelectSingleNode("/samlp:LogoutRequest", mgr); var issuerNode = xmlDocument.SelectSingleNode("/samlp:LogoutRequest/saml:Issuer", mgr); var nameIDNode = xmlDocument.SelectSingleNode("/samlp:LogoutRequest/saml:NameID", mgr); var sessionIndexNode = xmlDocument.SelectSingleNode("/samlp:LogoutRequest/samlp:SessionIndex", mgr); Assert.NotNull(logoutResponseNode); Assert.NotNull(issuerNode); Assert.NotNull(nameIDNode); Assert.NotNull(sessionIndexNode); Assert.Equal("", logoutResponseNode.Attributes["Destination"].Value); Assert.Equal("2.0", logoutResponseNode.Attributes["Version"].Value); Assert.Equal("test", nameIDNode.InnerText); } } }
using SamlOida.MessageHandler.MessageFactory; using SamlOida.Model; using System; using System.Collections.Generic; using System.Text; using System.Xml; using Xunit; namespace SamlOida.Test.MessageHandler.MessageFactory { public class LogoutRequestFactoryTests { private readonly LogoutRequestFactory _logoutRequestFactory; public LogoutRequestFactoryTests() { _logoutRequestFactory = new LogoutRequestFactory(); } /* TODO [Fact] public void ShouldCreateMessage() { var options = new SamlOptions(); options.SignOutgoingMessages = false; var authnRequestMessage = new SamlLogoutRequestMessage(); authnRequestMessage.NameId = "test"; var xmlDocument = _logoutRequestFactory.CreateMessage(options, authnRequestMessage); // TODO // COPY PASTE FROM AuthnRequestFactory XmlNamespaceManager mgr = new XmlNamespaceManager(xmlDocument.NameTable); mgr.AddNamespjace("samlp", "urn:oasis:names:tc:SAML:2.0:protocol"); mgr.AddNamespace("saml", "urn:oasis:names:tc:SAML:2.0:assertion"); var authnRequestNode = xmlDocument.SelectSingleNode("/samlp:AuthnRequest", mgr); var issuerNode = xmlDocument.SelectSingleNode("/samlp:AuthnRequest/saml:Issuer", mgr); Assert.NotNull(authnRequestNode); Assert.NotNull(issuerNode); Assert.Equal("test", authnRequestNode.Attributes["AssertionConsumerServiceURL"].Value); Assert.Equal("", authnRequestNode.Attributes["Destination"].Value); Assert.Equal("2.0", authnRequestNode.Attributes["Version"].Value); } */ } }
mit
C#
7926e9d64579c47654a83b8ab6d5fa24abc235f5
Fix bug with clearing ids
eescardo/CardsAndSymbols
CardsAndSymbols/ImageCache.cs
CardsAndSymbols/ImageCache.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Media; using System.Windows.Media.Imaging; using Svg; namespace CardsAndSymbols { public class ImageCache { private Dictionary<string, string> idToFileName = new Dictionary<string, string>(); private Dictionary<string, ImageSource> fileNameToImage = new Dictionary<string, ImageSource>(); private int nextId = 0; public ImageCache() { } public string AssignNewId(string fileName) { string id = (nextId++).ToString(); this.idToFileName.Add(id, fileName); return id; } public string GetFileName(string fileId) { return this.idToFileName[fileId]; } public ImageSource GetImage(string fileId) { var fileName = this.GetFileName(fileId); ImageSource imageSource; if (this.fileNameToImage.TryGetValue(fileName, out imageSource)) { return imageSource; } if (fileName.EndsWith(".svg")) { var doc = SvgDocument.Open(fileName); doc.Width = (int)((doc.Width / (double)doc.Height) * 512); doc.Height = 512; imageSource = doc.Draw().ToImage(); } else { imageSource = new BitmapImage(new Uri(fileName)); } this.fileNameToImage.Add(fileName, imageSource); return imageSource; } public void Clear(ImageCacheFlags flags) { if (flags.HasFlag(ImageCacheFlags.ClearIds)) { this.idToFileName.Clear(); this.nextId = 0; } if (flags.HasFlag(ImageCacheFlags.ClearFiles)) { this.fileNameToImage.Clear(); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Media; using System.Windows.Media.Imaging; using Svg; namespace CardsAndSymbols { public class ImageCache { private Dictionary<string, string> idToFileName = new Dictionary<string, string>(); private Dictionary<string, ImageSource> fileNameToImage = new Dictionary<string, ImageSource>(); private int nextId = 0; public ImageCache() { } public string AssignNewId(string fileName) { string id = (nextId++).ToString(); this.idToFileName.Add(id, fileName); return id; } public string GetFileName(string fileId) { return this.idToFileName[fileId]; } public ImageSource GetImage(string fileId) { var fileName = this.GetFileName(fileId); ImageSource imageSource; if (this.fileNameToImage.TryGetValue(fileName, out imageSource)) { return imageSource; } if (fileName.EndsWith(".svg")) { var doc = SvgDocument.Open(fileName); doc.Width = (int)((doc.Width / (double)doc.Height) * 512); doc.Height = 512; imageSource = doc.Draw().ToImage(); } else { imageSource = new BitmapImage(new Uri(fileName)); } this.fileNameToImage.Add(fileName, imageSource); return imageSource; } public void Clear(ImageCacheFlags flags) { if (flags.HasFlag(ImageCacheFlags.ClearIds)) { this.idToFileName.Clear(); } if (flags.HasFlag(ImageCacheFlags.ClearFiles)) { this.fileNameToImage.Clear(); } } } }
mit
C#
087d2016acfdc3324815fd6852dac1c47079fdd7
Implement SettingsPanelViewModel
Schlechtwetterfront/snipp
ViewModels/SettingsPanelViewModel.cs
ViewModels/SettingsPanelViewModel.cs
using System; using System.ComponentModel; namespace clipman.ViewModels { class SettingsPanelViewModel : INotifyPropertyChanged { private Settings.Settings settings; public Settings.Settings Settings { get { return settings; } private set { settings = value; RaisePropertyChanged("Settings"); } } public SettingsPanelViewModel(Settings.Settings settings) { this.Settings = settings; } public event PropertyChangedEventHandler PropertyChanged; public void RaisePropertyChanged(string property) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(property)); } } }
using System; namespace clipman.ViewModels { class SettingsPanelViewModel { } }
apache-2.0
C#
1e03c7dae8a32353173bdb8bc68803d6e9e6148a
Update documentation
whampson/bft-spec,whampson/cascara
Src/WHampson.Cascara/TypeUtils.cs
Src/WHampson.Cascara/TypeUtils.cs
#region License /* Copyright (c) 2017 Wes Hampson * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #endregion using System; namespace WHampson.Cascara { /// <summary> /// Convenience class for miscellaneous tasks related to data types. /// </summary> internal static class TypeUtils { /// <summary> /// Checks whether a given type can be assigned to some generic type. /// </summary> /// <remarks> /// Adapted from code found at https://stackoverflow.com/questions/74616#1075059 /// </remarks> /// <param name="givenType"> /// The type to check whether it can be assigned to /// <paramref name="genericType"/>. /// </param> /// <param name="genericType"> /// The generic type. /// </param> /// <returns> /// <code>True</code> if the <paramref name="givenType"/> can be assigned to /// the <paramref name="genericType"/>, /// <code>False</code> otherwise. /// </returns> public static bool IsAssignableToGenericType(Type givenType, Type genericType) { Type[] interfaceTypes = givenType.GetInterfaces(); foreach (Type type in interfaceTypes) { if (type.IsGenericType && type.GetGenericTypeDefinition() == genericType) { return true; } } if (givenType.IsGenericType && givenType.GetGenericTypeDefinition() == genericType) { return true; } Type baseType = givenType.BaseType; if (baseType == null) { return false; } return IsAssignableToGenericType(baseType, genericType); } } }
#region License /* Copyright (c) 2017 Wes Hampson * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #endregion using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace WHampson.Cascara { internal static class TypeUtils { // Checks whether the given type stems from a generic type. // Taken from https://stackoverflow.com/questions/74616#1075059 public static bool IsAssignableToGenericType(Type givenType, Type genericType) { Type[] interfaceTypes = givenType.GetInterfaces(); foreach (Type typ in interfaceTypes) { if (typ.IsGenericType && typ.GetGenericTypeDefinition() == genericType) { return true; } } if (givenType.IsGenericType && givenType.GetGenericTypeDefinition() == genericType) { return true; } Type baseType = givenType.BaseType; if (baseType == null) { return false; } return IsAssignableToGenericType(baseType, genericType); } } }
mit
C#
65ea3d35cea04013fc84ee6bdf05e37f9234fe93
add auto re-connect
rit-sse/holo-desk,rit-sse/holo-desk,rit-sse/holo-desk,rit-sse/holo-desk
MouseStreamNet.cs
MouseStreamNet.cs
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Net.Sockets; using System.Text; using System.Threading.Tasks; namespace Microsoft.Samples.Kinect.DepthBasics { class MouseStreamNet { private TcpClient client = null; private StreamWriter netStream = null; private bool enabled; private DateTime lastConnectAttempted; private string address; private int port; public MouseStreamNet(bool enable = true, string address = "129.21.207.17", int port = 1313) { this.enabled = enable; if (this.enabled) { this.address = address; this.port = port; try { connect(); } catch (SocketException se) { this.enabled = false; Console.WriteLine("failed to connect to mouse"); Console.WriteLine(se.Message); } } } public void DataReceived (object sender, DataReceivedEventArgs args) { Console.WriteLine(args.Data); if (!this.enabled) return; try { this.netStream.WriteLine(args.Data); this.netStream.Flush(); } catch (Exception e) { Console.Error.WriteLine(e.Message); if ((DateTime.Now - lastConnectAttempted).Seconds > 3) { try { Console.WriteLine("Attempting to reconnect"); connect(); } catch (SocketException) { Console.WriteLine("Reconnect failed"); } } } } private void connect() { if (!this.enabled) return; this.lastConnectAttempted = DateTime.Now; this.client = new TcpClient(); client.ReceiveTimeout = 100; this.client.Connect(address, port); NetworkStream ns = this.client.GetStream(); this.netStream = new StreamWriter(ns); } } }
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Net.Sockets; using System.Text; using System.Threading.Tasks; namespace Microsoft.Samples.Kinect.DepthBasics { class MouseStreamNet { private TcpClient client = null; private StreamWriter netStream = null; private bool enabled; public MouseStreamNet(bool enable = true, string address = "129.21.207.17", int port = 1313) { this.enabled = enable; if (this.enabled) { try { this.client = new TcpClient(address, port); } catch (SocketException se) { this.enabled = false; Console.WriteLine("failed to connect to mouse"); Console.WriteLine(se.Message); return; } NetworkStream ns = this.client.GetStream(); this.netStream = new StreamWriter(ns); } } public void DataReceived (object sender, DataReceivedEventArgs args) { Console.WriteLine(args.Data); if (!this.enabled) return; try { this.netStream.WriteLine(args.Data); this.netStream.Flush(); } catch (Exception e) { Console.Error.WriteLine(e.Message); } } } }
mit
C#
28f306eb82fa8b6db81364caf2a1fa9a4ef0c473
Add WSH testbench terminal
LibertyLocked/RestRPC,LibertyLocked/RestRPC,LibertyLocked/RestRPC,LibertyLocked/RestRPC
WebScriptHook.Terminal/Program.cs
WebScriptHook.Terminal/Program.cs
using System; using System.Threading; using WebScriptHook.Framework; using WebScriptHook.Framework.BuiltinPlugins; using WebScriptHook.Terminal.Plugins; namespace WebScriptHook.Terminal { class Program { static WebScriptHookComponent wshComponent; static void Main(string[] args) { string componentName = "testbench"; //Guid.NewGuid().ToString(); wshComponent = new WebScriptHookComponent(componentName, new RemoteSettings("ws", "localhost", "25555", "/componentws")); // Register custom plugins wshComponent.PluginManager.RegisterPlugin(new Echo()); wshComponent.PluginManager.RegisterPlugin(new PluginList()); wshComponent.PluginManager.RegisterPlugin(new PrintToScreen()); // Start WSH component wshComponent.Start(); // Print all registered plugins Console.WriteLine("Registered plugins on \"" + wshComponent.Name + "\":"); var pluginIDs = wshComponent.PluginManager.PluginIDs; foreach (var pluginID in pluginIDs) { Console.WriteLine(pluginID); } // TODO: Use a timer instead of Sleep while (true) { wshComponent.Update(); Thread.Sleep(20); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using WebScriptHook.Framework; namespace WebScriptHook.Terminal { class Program { static WebScriptHookComponent wshComponent; static void Main(string[] args) { string componentName = Guid.NewGuid().ToString(); wshComponent = new WebScriptHookComponent(componentName, new RemoteSettings("localhost", "25555", "/pushws")); } } }
mit
C#
48e53a76b0e5e02d9a2b18a8a34ae3ee8e99c728
Fix incorrect line endings
johnneijzen/osu,smoogipoo/osu,NeoAdonis/osu,peppy/osu,UselessToucan/osu,peppy/osu,DrabWeb/osu,smoogipoo/osu,naoey/osu,smoogipoo/osu,ZLima12/osu,johnneijzen/osu,2yangk23/osu,2yangk23/osu,ZLima12/osu,EVAST9919/osu,Nabile-Rahmani/osu,ppy/osu,naoey/osu,EVAST9919/osu,DrabWeb/osu,UselessToucan/osu,peppy/osu,smoogipooo/osu,peppy/osu-new,DrabWeb/osu,ppy/osu,Frontear/osuKyzer,naoey/osu,ppy/osu,UselessToucan/osu,NeoAdonis/osu,NeoAdonis/osu
osu.Game/Configuration/RandomSelectAlgorithm.cs
osu.Game/Configuration/RandomSelectAlgorithm.cs
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.ComponentModel; namespace osu.Game.Configuration { public enum RandomSelectAlgorithm { [Description("Never repeat")] RandomPermutation, [Description("Random")] Random } }
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.ComponentModel; namespace osu.Game.Configuration { public enum RandomSelectAlgorithm { [Description("Never repeat")] RandomPermutation, [Description("Random")] Random } }
mit
C#
c2219046c6f7c823337494157010fac59d154c03
Remove redundant generic specification
Baggykiin/pass-winmenu
pass-winmenu/src/Hotkeys/HotkeyRegistrars.UI.cs
pass-winmenu/src/Hotkeys/HotkeyRegistrars.UI.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Input; using System.Windows; namespace PassWinmenu.Hotkeys { // Implementation for the UI element hotkey registrar. // // See main file: // /src/Hotkeys/HotkeyRegistrars.cs public static partial class HotkeyRegistrars { /// <summary> /// A registrar for registering hotkeys for UI elements. /// </summary> public sealed class UI { // Simple utility class for adapting a [UIElement] into the // [IKeyEventSource] required by the generic registrar. private sealed class Adaptor<T> : IKeyEventSource where T : UIElement { public static Adaptor<T> Create(T element) { return new Adaptor<T>(element); } private readonly T _element; private Adaptor(T element) => _element = element; event KeyEventHandler IKeyEventSource.KeyDown { add => _element.KeyDown += value; remove => _element.KeyDown -= value; } event KeyEventHandler IKeyEventSource.KeyUp { add => _element.KeyUp += value; remove => _element.KeyUp -= value; } } /// <summary> /// Retrieves a hotkey registrar for a particular UI element, /// creating one if one does not already exist. /// </summary> /// <typeparam name="TElem"> /// The type of <see cref="UIElement"/> for which to create a /// registrar. /// </typeparam> /// <param name="element"> /// The particular <see cref="UIElement"/> for which to create /// a registrar. /// </param> /// <returns> /// A registrar for the specified UI element. /// </returns> public static IHotkeyRegistrar For<TElem>(TElem element) where TElem : UIElement { return KeyEventSource.Create(element, Adaptor<TElem>.Create); } } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Input; using System.Windows; namespace PassWinmenu.Hotkeys { // Implementation for the UI element hotkey registrar. // // See main file: // /src/Hotkeys/HotkeyRegistrars.cs public static partial class HotkeyRegistrars { /// <summary> /// A registrar for registering hotkeys for UI elements. /// </summary> public sealed class UI { // Simple utility class for adapting a [UIElement] into the // [IKeyEventSource] required by the generic registrar. private sealed class Adaptor<T> : IKeyEventSource where T : UIElement { public static Adaptor<T> Create<T>(T element) where T : UIElement { return new Adaptor<T>(element); } private readonly T _element; private Adaptor(T element) => _element = element; event KeyEventHandler IKeyEventSource.KeyDown { add => _element.KeyDown += value; remove => _element.KeyDown -= value; } event KeyEventHandler IKeyEventSource.KeyUp { add => _element.KeyUp += value; remove => _element.KeyUp -= value; } } /// <summary> /// Retrieves a hotkey registrar for a particular UI element, /// creating one if one does not already exist. /// </summary> /// <typeparam name="TElem"> /// The type of <see cref="UIElement"/> for which to create a /// registrar. /// </typeparam> /// <param name="element"> /// The particular <see cref="UIElement"/> for which to create /// a registrar. /// </param> /// <returns> /// A registrar for the specified UI element. /// </returns> public static IHotkeyRegistrar For<TElem>(TElem element) where TElem : UIElement { return KeyEventSource.Create(element, Adaptor<TElem>.Create); } } } }
mit
C#
7a439231ae042f99e6d62c25cfb851e5c8ea2920
Update to subclass BusinessRuleAsync
MarimerLLC/csla,JasonBock/csla,rockfordlhotka/csla,rockfordlhotka/csla,rockfordlhotka/csla,JasonBock/csla,MarimerLLC/csla,MarimerLLC/csla,JasonBock/csla
Samples/ProjectTracker/ProjectTracker.BusinessLibrary.Netstandard/ValidRole.cs
Samples/ProjectTracker/ProjectTracker.BusinessLibrary.Netstandard/ValidRole.cs
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Csla.Rules; namespace ProjectTracker.Library { /// <summary> /// Ensure the Role property value exists /// in RoleList /// </summary> public class ValidRole : BusinessRuleAsync { public ValidRole(Csla.Core.IPropertyInfo primaryProperty) : base(primaryProperty) { InputProperties = new List<Csla.Core.IPropertyInfo> { primaryProperty }; } protected override async Task ExecuteAsync(IRuleContext context) { int role = (int)context.InputPropertyValues[PrimaryProperty]; var roles = await RoleList.CacheListAsync(); if (!roles.ContainsKey(role)) context.AddErrorResult("Role must be in RoleList"); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using Csla.Rules; namespace ProjectTracker.Library { /// <summary> /// Ensure the Role property value exists /// in RoleList /// </summary> public class ValidRole : BusinessRule { public ValidRole(Csla.Core.IPropertyInfo primaryProperty) : base(primaryProperty) { IsAsync = true; InputProperties = new System.Collections.Generic.List<Csla.Core.IPropertyInfo> { primaryProperty }; } protected override async void Execute(IRuleContext context) { int role = (int)context.InputPropertyValues[PrimaryProperty]; var roles = await RoleList.CacheListAsync(); if (!roles.ContainsKey(role)) context.AddErrorResult("Role must be in RoleList"); context.Complete(); } } }
mit
C#
bc034f3368a664792d7a6c3d436be54a53d1c76a
debug brackets
DMagic1/Orbital-Science,Kerbas-ad-astra/Orbital-Science
Source/DMUtils.cs
Source/DMUtils.cs
#region license /* DMagic Orbital Science - DMUtils * Static utilities class for various methods * * Copyright (c) 2014, David Grandy <david.grandy@gmail.com> * 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. * * 3. Neither the name of the copyright holder nor the names of its contributors may be used * to endorse or promote products derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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. * */ #endregion using System; using System.Collections.Generic; using System.Linq; using UnityEngine; namespace DMagic { static class DMUtils { internal static System.Random rand; internal static Dictionary<string, DMcontractScience> availableScience = new Dictionary<string, DMcontractScience>(); internal static float science, reward, forward, penalty; internal static List<string> storyList = new List<string>(); internal static void Logging(string s, params object[] stringObjects) { s = string.Format(s, stringObjects); string finalLog = string.Format("[DM] {0}", s); Debug.Log(finalLog); } #region Debug Logging internal static void DebugLog(string s, params object[] stringObjects) { #if DEBUG s = string.Format(s, stringObjects); string finalLog = string.Format("[DM] {0}", s); Debug.Log(finalLog); #endif } #endregion } }
#region license /* DMagic Orbital Science - DMUtils * Static utilities class for various methods * * Copyright (c) 2014, David Grandy <david.grandy@gmail.com> * 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. * * 3. Neither the name of the copyright holder nor the names of its contributors may be used * to endorse or promote products derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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. * */ #endregion using System; using System.Collections.Generic; using System.Linq; using System.Text; using UnityEngine; namespace DMagic { static class DMUtils { internal static System.Random rand; internal static Dictionary<string, DMcontractScience> availableScience = new Dictionary<string, DMcontractScience>(); internal static float science, reward, forward, penalty; internal static List<string> storyList = new List<string>(); internal static void Logging(string s, params object[] stringObjects) { s = string.Format(s, stringObjects); string finalLog = string.Format("[DM] {0}", s); Debug.Log(finalLog); } #region Debug Logging #if DEBUG internal static void DebugLog(string s, params object[] stringObjects) { s = string.Format(s, stringObjects); string finalLog = string.Format("[DM] {0}", s); Debug.Log(finalLog); } #endif #endregion } }
bsd-3-clause
C#
6c937842b8d3631b2365fd078651d796aa7e1e7a
Delete unused code.
mysql-net/MySqlConnector,gitsno/MySqlConnector,mysql-net/MySqlConnector,gitsno/MySqlConnector
src/MySql.Data/Serialization/SerializationUtility.cs
src/MySql.Data/Serialization/SerializationUtility.cs
namespace MySql.Data.Serialization { internal static class SerializationUtility { public static uint ReadUInt32(byte[] buffer, int offset, int count) { uint value = 0; for (int i = 0; i < count; i++) value |= ((uint) buffer[offset + i]) << (8 * i); return value; } public static void WriteUInt32(uint value, byte[] buffer, int offset, int count) { for (int i = 0; i < count; i++) { buffer[offset + i] = (byte) (value & 0xFF); value >>= 8; } } } }
using System.IO; using System.Threading; using System.Threading.Tasks; namespace MySql.Data.Serialization { internal static class SerializationUtility { public static async Task<int> ReadAvailableAsync(this Stream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken) { int totalBytesRead = 0; while (count > 0) { int bytesRead = await stream.ReadAsync(buffer, offset, count, cancellationToken).ConfigureAwait(false); if (bytesRead == 0) break; totalBytesRead += bytesRead; offset += bytesRead; count -= bytesRead; } return totalBytesRead; } public static async Task ReadExactlyAsync(this Stream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken) { var bytesRead = await stream.ReadAvailableAsync(buffer, offset, count, cancellationToken).ConfigureAwait(false); if (bytesRead != count) throw new EndOfStreamException(); } public static uint ReadUInt32(byte[] buffer, int offset, int count) { uint value = 0; for (int i = 0; i < count; i++) value |= ((uint) buffer[offset + i]) << (8 * i); return value; } public static void WriteUInt32(uint value, byte[] buffer, int offset, int count) { for (int i = 0; i < count; i++) { buffer[offset + i] = (byte) (value & 0xFF); value >>= 8; } } } }
mit
C#
6d90ba7b7231bab8b44830501ba14bfb5e73a904
Make TabGroupExtension thread safe (#3051)
dotnet/docfx,dotnet/docfx,superyyrrzz/docfx,dotnet/docfx,superyyrrzz/docfx,superyyrrzz/docfx
src/Microsoft.DocAsCode.MarkdigEngine.Extensions/TabGroup/TabGroupExtension.cs
src/Microsoft.DocAsCode.MarkdigEngine.Extensions/TabGroup/TabGroupExtension.cs
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.DocAsCode.MarkdigEngine.Extensions { using Markdig; using Markdig.Renderers; public class TabGroupExtension : IMarkdownExtension { private readonly MarkdownContext _context; public TabGroupExtension(MarkdownContext context) { _context = context; } public void Setup(MarkdownPipelineBuilder pipeline) { pipeline.DocumentProcessed += document => { var tabGroupAggregator = new TabGroupAggregator(); var aggregateVisitor = new MarkdownDocumentAggregatorVisitor(tabGroupAggregator); var tagGroupIdRewriter = new TabGroupIdRewriter(); var tagGroupIdVisitor = new MarkdownDocumentVisitor(tagGroupIdRewriter); var activeAndVisibleRewriter = new ActiveAndVisibleRewriter(_context); var activeAndVisibleVisitor = new MarkdownDocumentVisitor(activeAndVisibleRewriter); aggregateVisitor.Visit(document); tagGroupIdVisitor.Visit(document); activeAndVisibleVisitor.Visit(document); }; } public void Setup(MarkdownPipeline pipeline, IMarkdownRenderer renderer) { if (renderer is HtmlRenderer htmlRenderer) { if (!htmlRenderer.ObjectRenderers.Contains<HtmlTabGroupBlockRenderer>()) { htmlRenderer.ObjectRenderers.Add(new HtmlTabGroupBlockRenderer()); } if (!htmlRenderer.ObjectRenderers.Contains<HtmlTabTitleBlockRenderer>()) { htmlRenderer.ObjectRenderers.Add(new HtmlTabTitleBlockRenderer()); } if (!htmlRenderer.ObjectRenderers.Contains<HtmlTabContentBlockRenderer>()) { htmlRenderer.ObjectRenderers.Add(new HtmlTabContentBlockRenderer()); } } } } }
// Copyright (c) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. namespace Microsoft.DocAsCode.MarkdigEngine.Extensions { using Markdig; using Markdig.Renderers; public class TabGroupExtension : IMarkdownExtension { private readonly MarkdownContext _context; public TabGroupExtension(MarkdownContext context) { _context = context; } public void Setup(MarkdownPipelineBuilder pipeline) { var tabGroupAggregator = new TabGroupAggregator(); var aggregateVisitor = new MarkdownDocumentAggregatorVisitor(tabGroupAggregator); var tagGroupIdRewriter = new TabGroupIdRewriter(); var tagGroupIdVisitor = new MarkdownDocumentVisitor(tagGroupIdRewriter); var activeAndVisibleRewriter = new ActiveAndVisibleRewriter(_context); var activeAndVisibleVisitor = new MarkdownDocumentVisitor(activeAndVisibleRewriter); pipeline.DocumentProcessed += document => { aggregateVisitor.Visit(document); tagGroupIdVisitor.Visit(document); activeAndVisibleVisitor.Visit(document); }; } public void Setup(MarkdownPipeline pipeline, IMarkdownRenderer renderer) { if (renderer is HtmlRenderer htmlRenderer) { if (!htmlRenderer.ObjectRenderers.Contains<HtmlTabGroupBlockRenderer>()) { htmlRenderer.ObjectRenderers.Add(new HtmlTabGroupBlockRenderer()); } if (!htmlRenderer.ObjectRenderers.Contains<HtmlTabTitleBlockRenderer>()) { htmlRenderer.ObjectRenderers.Add(new HtmlTabTitleBlockRenderer()); } if (!htmlRenderer.ObjectRenderers.Contains<HtmlTabContentBlockRenderer>()) { htmlRenderer.ObjectRenderers.Add(new HtmlTabContentBlockRenderer()); } } } } }
mit
C#
754c3a51fa4ecda63b9f4712820a0663e7b9980f
Format adjustment after while loop was removed
SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice,SkillsFundingAgency/das-employerapprenticeshipsservice
src/SFA.DAS.LevyAggregationProvider.Worker/Providers/LevyAggregationManager.cs
src/SFA.DAS.LevyAggregationProvider.Worker/Providers/LevyAggregationManager.cs
using System; using System.Threading.Tasks; using MediatR; using NLog; using SFA.DAS.EmployerApprenticeshipsService.Application.Commands.CreateLevyAggregation; using SFA.DAS.EmployerApprenticeshipsService.Application.Messages; using SFA.DAS.EmployerApprenticeshipsService.Application.Queries.GetLevyDeclaration; using SFA.DAS.EmployerApprenticeshipsService.Domain.Attributes; using SFA.DAS.Messaging; namespace SFA.DAS.LevyAggregationProvider.Worker.Providers { public class LevyAggregationManager { [QueueName] public string refresh_employer_levy { get; set; } private readonly IPollingMessageReceiver _pollingMessageReceiver; private readonly IMediator _mediator; private readonly ILogger _logger; public LevyAggregationManager(IPollingMessageReceiver pollingMessageReceiver, IMediator mediator, ILogger logger) { if (pollingMessageReceiver == null) throw new ArgumentNullException(nameof(pollingMessageReceiver)); if (mediator == null) throw new ArgumentNullException(nameof(mediator)); _pollingMessageReceiver = pollingMessageReceiver; _mediator = mediator; _logger = logger; } public async Task Process() { var message = await _pollingMessageReceiver.ReceiveAsAsync<EmployerRefreshLevyQueueMessage>(); if (message?.Content == null || message.Content.AccountId == 0) return; _logger.Info($"Processing LevyAggregation for Account: {message.Content.AccountId}"); var response = await _mediator.SendAsync(new GetLevyDeclarationRequest { AccountId = message.Content.AccountId }); var aggregator = new LevyAggregator(); var destinationData = aggregator.BuildAggregate(response.Data); if (destinationData != null) await _mediator.SendAsync(new CreateLevyAggregationCommand { Data = destinationData }); await message.CompleteAsync(); } } }
using System; using System.Threading.Tasks; using MediatR; using NLog; using SFA.DAS.EmployerApprenticeshipsService.Application.Commands.CreateLevyAggregation; using SFA.DAS.EmployerApprenticeshipsService.Application.Messages; using SFA.DAS.EmployerApprenticeshipsService.Application.Queries.GetLevyDeclaration; using SFA.DAS.EmployerApprenticeshipsService.Domain.Attributes; using SFA.DAS.Messaging; namespace SFA.DAS.LevyAggregationProvider.Worker.Providers { public class LevyAggregationManager { [QueueName] public string refresh_employer_levy { get; set; } private readonly IPollingMessageReceiver _pollingMessageReceiver; private readonly IMediator _mediator; private readonly ILogger _logger; public LevyAggregationManager(IPollingMessageReceiver pollingMessageReceiver, IMediator mediator, ILogger logger) { if (pollingMessageReceiver == null) throw new ArgumentNullException(nameof(pollingMessageReceiver)); if (mediator == null) throw new ArgumentNullException(nameof(mediator)); _pollingMessageReceiver = pollingMessageReceiver; _mediator = mediator; _logger = logger; } public async Task Process() { var message = await _pollingMessageReceiver.ReceiveAsAsync<EmployerRefreshLevyQueueMessage>(); if (message?.Content == null || message.Content.AccountId == 0) return; _logger.Info($"Processing LevyAggregation for Account: {message.Content.AccountId}"); var response = await _mediator.SendAsync(new GetLevyDeclarationRequest { AccountId = message.Content.AccountId }); var aggregator = new LevyAggregator(); var destinationData = aggregator.BuildAggregate(response.Data); if (destinationData != null) await _mediator.SendAsync(new CreateLevyAggregationCommand { Data = destinationData }); await message.CompleteAsync(); } } }
mit
C#
d18c55abb5893345da8cf59b7c6f48d42c85aaf4
删除信息。
yoyocms/YoYoCms.AbpProjectTemplate,yoyocms/YoYoCms.AbpProjectTemplate,yoyocms/YoYoCms.AbpProjectTemplate
src/YoYoCms.AbpProjectTemplate.Application/AbpProjectTemplateAppServiceBase.cs
src/YoYoCms.AbpProjectTemplate.Application/AbpProjectTemplateAppServiceBase.cs
using System; using System.Threading.Tasks; using Abp.Application.Services; using Abp.IdentityFramework; using Abp.MultiTenancy; using Abp.Runtime.Session; using Microsoft.AspNet.Identity; using YoYoCms.AbpProjectTemplate.AppExtensions.AbpSessions; using YoYoCms.AbpProjectTemplate.Authorization.Users; using YoYoCms.AbpProjectTemplate.MultiTenancy; namespace YoYoCms.AbpProjectTemplate { /// <summary> /// All application services in this application is derived from this class. /// We can add common application service methods here. /// </summary> public abstract class AbpProjectTemplateAppServiceBase : ApplicationService { public TenantManager TenantManager { get; set; } public UserManager UserManager { get; set; } public new IAbpSessionExtensions AbpSession { get; set; } protected AbpProjectTemplateAppServiceBase() { LocalizationSourceName = AbpProjectTemplateConsts.LocalizationSourceName; } protected virtual async Task<User> GetCurrentUserAsync() { var user = await UserManager.FindByIdAsync(AbpSession.GetUserId()); if (user == null) { throw new ApplicationException("There is no current user!"); } return user; } protected virtual User GetCurrentUser() { var user = UserManager.FindById(AbpSession.GetUserId()); if (user == null) { throw new ApplicationException("There is no current user!"); } return user; } protected virtual Task<Tenant> GetCurrentTenantAsync() { using (CurrentUnitOfWork.SetTenantId(null)) { return TenantManager.GetByIdAsync(AbpSession.GetTenantId()); } } protected virtual Tenant GetCurrentTenant() { using (CurrentUnitOfWork.SetTenantId(null)) { return TenantManager.GetById(AbpSession.GetTenantId()); } } protected virtual void CheckErrors(IdentityResult identityResult) { identityResult.CheckErrors(LocalizationManager); } } }
using System; using System.Threading.Tasks; using Abp.Application.Services; using Abp.Domain.Repositories; using Abp.IdentityFramework; using Abp.MultiTenancy; using Abp.Runtime.Session; using Microsoft.AspNet.Identity; using YoYoCms.AbpProjectTemplate.AppExtensions.AbpSessions; using YoYoCms.AbpProjectTemplate.Authorization.Users; using YoYoCms.AbpProjectTemplate.MultiTenancy; namespace YoYoCms.AbpProjectTemplate { /// <summary> /// All application services in this application is derived from this class. /// We can add common application service methods here. /// </summary> public abstract class AbpProjectTemplateAppServiceBase : ApplicationService { public TenantManager TenantManager { get; set; } public UserManager UserManager { get; set; } public new IAbpSessionExtensions AbpSession { get; set; } private IRepository<User,long> _useRepository; protected AbpProjectTemplateAppServiceBase(IRepository<User, long> useRepository) { _useRepository = useRepository; LocalizationSourceName = AbpProjectTemplateConsts.LocalizationSourceName; } protected virtual async Task<User> GetCurrentUserAsync() { var user = await _useRepository.GetAsync(AbpSession.GetUserId()); if (user == null) { throw new ApplicationException("There is no current user!"); } return user; } protected virtual User GetCurrentUser() { var user = _useRepository.Get(AbpSession.GetUserId()); if (user == null) { throw new ApplicationException("There is no current user!"); } return user; } protected virtual Task<Tenant> GetCurrentTenantAsync() { using (CurrentUnitOfWork.SetTenantId(null)) { return TenantManager.GetByIdAsync(AbpSession.GetTenantId()); } } protected virtual Tenant GetCurrentTenant() { using (CurrentUnitOfWork.SetTenantId(null)) { return TenantManager.GetById(AbpSession.GetTenantId()); } } protected virtual void CheckErrors(IdentityResult identityResult) { identityResult.CheckErrors(LocalizationManager); } } }
apache-2.0
C#
adf814fb506be9ef4d3c72dcdf77e9deff943959
Use Cast instead of Map.
FacilityApi/FacilityCSharp
src/Facility.Core/Http/HttpContentSerializer.cs
src/Facility.Core/Http/HttpContentSerializer.cs
using System; using System.Net.Http; using System.Threading; using System.Threading.Tasks; namespace Facility.Core.Http { /// <summary> /// Serializes and deserializes DTOs for HTTP requests and responses. /// </summary> public abstract class HttpContentSerializer { /// <summary> /// The default media type for the serializer. /// </summary> public string DefaultMediaType => DefaultMediaTypeCore; /// <summary> /// Determines if the specified media type is supported. /// </summary> public bool IsSupportedMediaType(string mediaType) => IsSupportedMediaTypeCore(mediaType); /// <summary> /// Creates HTTP content for the specified DTO. /// </summary> public HttpContent CreateHttpContent(object content, string? mediaType = null) { if (mediaType != null && !IsSupportedMediaType(mediaType)) throw new ArgumentException($"Unsupported media type '{mediaType}'."); return CreateHttpContentCore(content, mediaType); } /// <summary> /// Reads a DTO from the specified HTTP content. /// </summary> public async Task<ServiceResult<T>> ReadHttpContentAsync<T>(HttpContent? content, CancellationToken cancellationToken = default) where T : ServiceDto { return (await ReadHttpContentAsync(typeof(T), content, cancellationToken).ConfigureAwait(false)).Cast<T>(); } /// <summary> /// Reads a DTO from the specified HTTP content. /// </summary> public async Task<ServiceResult<object>> ReadHttpContentAsync(Type dtoType, HttpContent? content, CancellationToken cancellationToken = default) { var contentType = content?.Headers.ContentType; if (contentType == null) return ServiceResult.Failure(HttpServiceErrors.CreateMissingContentType()); string mediaType = contentType.MediaType; if (!IsSupportedMediaType(mediaType)) return ServiceResult.Failure(HttpServiceErrors.CreateUnsupportedContentType(mediaType)); return await ReadHttpContentAsyncCore(dtoType, content!, cancellationToken).ConfigureAwait(false); } /// <summary> /// The media type for requests. /// </summary> protected abstract string DefaultMediaTypeCore { get; } /// <summary> /// Determines if the specified media type is supported. /// </summary> protected abstract bool IsSupportedMediaTypeCore(string mediaType); /// <summary> /// Creates HTTP content for the specified DTO. /// </summary> protected abstract HttpContent CreateHttpContentCore(object content, string? mediaType); /// <summary> /// Reads a DTO from the specified HTTP content. /// </summary> protected abstract Task<ServiceResult<object>> ReadHttpContentAsyncCore(Type dtoType, HttpContent content, CancellationToken cancellationToken); } }
using System; using System.Net.Http; using System.Threading; using System.Threading.Tasks; namespace Facility.Core.Http { /// <summary> /// Serializes and deserializes DTOs for HTTP requests and responses. /// </summary> public abstract class HttpContentSerializer { /// <summary> /// The default media type for the serializer. /// </summary> public string DefaultMediaType => DefaultMediaTypeCore; /// <summary> /// Determines if the specified media type is supported. /// </summary> public bool IsSupportedMediaType(string mediaType) => IsSupportedMediaTypeCore(mediaType); /// <summary> /// Creates HTTP content for the specified DTO. /// </summary> public HttpContent CreateHttpContent(object content, string? mediaType = null) { if (mediaType != null && !IsSupportedMediaType(mediaType)) throw new ArgumentException($"Unsupported media type '{mediaType}'."); return CreateHttpContentCore(content, mediaType); } /// <summary> /// Reads a DTO from the specified HTTP content. /// </summary> public async Task<ServiceResult<T>> ReadHttpContentAsync<T>(HttpContent? content, CancellationToken cancellationToken = default) where T : ServiceDto { return (await ReadHttpContentAsync(typeof(T), content, cancellationToken).ConfigureAwait(false)).Map(x => (T) x); } /// <summary> /// Reads a DTO from the specified HTTP content. /// </summary> public async Task<ServiceResult<object>> ReadHttpContentAsync(Type dtoType, HttpContent? content, CancellationToken cancellationToken = default) { var contentType = content?.Headers.ContentType; if (contentType == null) return ServiceResult.Failure(HttpServiceErrors.CreateMissingContentType()); string mediaType = contentType.MediaType; if (!IsSupportedMediaType(mediaType)) return ServiceResult.Failure(HttpServiceErrors.CreateUnsupportedContentType(mediaType)); return await ReadHttpContentAsyncCore(dtoType, content!, cancellationToken).ConfigureAwait(false); } /// <summary> /// The media type for requests. /// </summary> protected abstract string DefaultMediaTypeCore { get; } /// <summary> /// Determines if the specified media type is supported. /// </summary> protected abstract bool IsSupportedMediaTypeCore(string mediaType); /// <summary> /// Creates HTTP content for the specified DTO. /// </summary> protected abstract HttpContent CreateHttpContentCore(object content, string? mediaType); /// <summary> /// Reads a DTO from the specified HTTP content. /// </summary> protected abstract Task<ServiceResult<object>> ReadHttpContentAsyncCore(Type dtoType, HttpContent content, CancellationToken cancellationToken); } }
mit
C#
f12c7d794f3a380995f6ebd9a0da2a1fc613a0a3
Update src/FluentNHibernate/Cfg/Db/DB2Configuration.cs
oceanho/fluent-nhibernate,owerkop/fluent-nhibernate,lingxyd/fluent-nhibernate,bogdan7/nhibernate,narnau/fluent-nhibernate,hzhgis/ss,bogdan7/nhibernate,HermanSchoenfeld/fluent-nhibernate,bogdan7/nhibernate,HermanSchoenfeld/fluent-nhibernate,hzhgis/ss,owerkop/fluent-nhibernate,lingxyd/fluent-nhibernate,hzhgis/ss,oceanho/fluent-nhibernate,narnau/fluent-nhibernate
src/FluentNHibernate/Cfg/Db/DB2Configuration.cs
src/FluentNHibernate/Cfg/Db/DB2Configuration.cs
using NHibernate.Dialect; using NHibernate.Driver; namespace FluentNHibernate.Cfg.Db { public class DB2Configuration : PersistenceConfiguration<DB2Configuration, DB2ConnectionStringBuilder> { protected DB2Configuration() { Driver<DB2Driver>(); } public static DB2Configuration Standard { get { return new DB2Configuration().Dialect<DB2Dialect>(); } } public static DB2Configuration Informix1150 { get { return new DB2Configuration().Dialect<InformixDialect1000>(); } } } }
using NHibernate.Dialect; using NHibernate.Driver; namespace FluentNHibernate.Cfg.Db { public class DB2Configuration : PersistenceConfiguration<DB2Configuration, DB2ConnectionStringBuilder> { protected DB2Configuration() { Driver<DB2Driver>(); } public static DB2Configuration Standard { get { return new DB2Configuration().Dialect<DB2Dialect>(); } } } }
bsd-3-clause
C#
dd653c1edbdc7b702386629b81a3f92802dd75c2
Fix being unable to open a project created on Windows.
mrward/monodevelop-dnx-addin
src/MonoDevelop.Dnx/MonoDevelop.Dnx/XProject.cs
src/MonoDevelop.Dnx/MonoDevelop.Dnx/XProject.cs
// // XProject.cs // // Author: // Matt Ward <matt.ward@xamarin.com> // // Copyright (c) 2015 Xamarin Inc. (http://xamarin.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // using System; using MonoDevelop.Projects; using MonoDevelop.Core; using MonoDevelop.Core.Assemblies; namespace MonoDevelop.Dnx { public class XProject : DotNetProject { public XProject () { UseMSBuildEngine = false; Initialize (this); } protected override void OnInitialize () { base.OnInitialize (); SupportsRoslyn = true; StockIcon = "md-csharp-project"; } protected override DotNetCompilerParameters OnCreateCompilationParameters (DotNetProjectConfiguration config, ConfigurationKind kind) { return new DnxConfigurationParameters (); } protected override ClrVersion[] OnGetSupportedClrVersions () { return new ClrVersion[] { ClrVersion.Net_4_5 }; } public void SetDefaultNamespace (FilePath fileName) { DefaultNamespace = GetDefaultNamespace (fileName); } protected override bool OnSupportsFramework (TargetFramework framework) { if (IsSupportedClientProfile (framework)) { return true; } return base.OnSupportsFramework (framework); } /// <summary> /// If .NET Core MSBuild targets are installed on the machine then /// they set the TargetFrameworkProfile to be Client and the /// TargetFramework class indicates the ClrVersion is 4.0 even though the /// framework version 4.5. .NET 4.0 is not supported by .NET Core which /// the XProject indicates in the OnGetSupportedClrVersions method. /// This causes the project to fail to load. So here an explicit /// check for a Client profile and if it is .NET 4.5 or higher the /// XProject indicates that it is supported. /// </summary> /// <returns>The supported client profile.</returns> /// <param name="framework">Framework.</param> bool IsSupportedClientProfile (TargetFramework framework) { if (framework.Id.Profile == "Client" && framework.Id.Identifier == ".NETFramework") { Version version = null; if (System.Version.TryParse (framework.Id.Version, out version)) { return version.Major >= 4 && version.Minor >= 5; } } return false; } } }
// // XProject.cs // // Author: // Matt Ward <matt.ward@xamarin.com> // // Copyright (c) 2015 Xamarin Inc. (http://xamarin.com) // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. // using System; using MonoDevelop.Projects; using MonoDevelop.Core; namespace MonoDevelop.Dnx { public class XProject : DotNetProject { public XProject () { UseMSBuildEngine = false; Initialize (this); } protected override void OnInitialize () { base.OnInitialize (); SupportsRoslyn = true; StockIcon = "md-csharp-project"; } protected override DotNetCompilerParameters OnCreateCompilationParameters (DotNetProjectConfiguration config, ConfigurationKind kind) { return new DnxConfigurationParameters (); } protected override ClrVersion[] OnGetSupportedClrVersions () { return new ClrVersion[] { ClrVersion.Net_4_5 }; } public void SetDefaultNamespace (FilePath fileName) { DefaultNamespace = GetDefaultNamespace (fileName); } } }
mit
C#
5d0628f1079426c50ec5681924207d4b2e939685
Make class public and all methods virtual so that it can be used as a base class for interceptors.
alobakov/nhibernate-core,gliljas/nhibernate-core,hazzik/nhibernate-core,ngbrown/nhibernate-core,fredericDelaporte/nhibernate-core,RogerKratz/nhibernate-core,nhibernate/nhibernate-core,RogerKratz/nhibernate-core,ManufacturingIntelligence/nhibernate-core,nkreipke/nhibernate-core,ngbrown/nhibernate-core,lnu/nhibernate-core,hazzik/nhibernate-core,RogerKratz/nhibernate-core,livioc/nhibernate-core,nkreipke/nhibernate-core,lnu/nhibernate-core,alobakov/nhibernate-core,hazzik/nhibernate-core,nhibernate/nhibernate-core,gliljas/nhibernate-core,hazzik/nhibernate-core,RogerKratz/nhibernate-core,gliljas/nhibernate-core,lnu/nhibernate-core,nkreipke/nhibernate-core,livioc/nhibernate-core,ManufacturingIntelligence/nhibernate-core,nhibernate/nhibernate-core,fredericDelaporte/nhibernate-core,fredericDelaporte/nhibernate-core,gliljas/nhibernate-core,ManufacturingIntelligence/nhibernate-core,nhibernate/nhibernate-core,fredericDelaporte/nhibernate-core,alobakov/nhibernate-core,livioc/nhibernate-core,ngbrown/nhibernate-core
src/NHibernate/Cfg/EmptyInterceptor.cs
src/NHibernate/Cfg/EmptyInterceptor.cs
using System; using System.Collections; using NHibernate.Type; namespace NHibernate.Cfg { [Serializable] public class EmptyInterceptor : IInterceptor { public virtual void OnDelete( object entity, object id, object[ ] state, string[ ] propertyNames, IType[ ] types ) { } public virtual bool OnFlushDirty( object entity, object id, object[ ] currentState, object[ ] previousState, string[ ] propertyNames, IType[ ] types ) { return false; } public virtual bool OnLoad( object entity, object id, object[ ] state, string[ ] propertyNames, IType[ ] types ) { return false; } public virtual bool OnSave( object entity, object id, object[ ] state, string[ ] propertyNames, IType[ ] types ) { return false; } public virtual void PostFlush( ICollection entities ) { } public virtual void PreFlush( ICollection entitites ) { } public virtual object IsUnsaved( object entity ) { return null; } public virtual object Instantiate( System.Type clazz, object id ) { return null; } public virtual int[] FindDirty( object entity, object id, object[] currentState, object[] previousState, string[] propertyNames, IType[] types ) { return null; } } }
using System; using System.Collections; using NHibernate.Type; namespace NHibernate.Cfg { [Serializable] internal class EmptyInterceptor : IInterceptor { public EmptyInterceptor() { } public void OnDelete( object entity, object id, object[ ] state, string[ ] propertyNames, IType[ ] types ) { } public bool OnFlushDirty( object entity, object id, object[ ] currentState, object[ ] previousState, string[ ] propertyNames, IType[ ] types ) { return false; } public bool OnLoad( object entity, object id, object[ ] state, string[ ] propertyNames, IType[ ] types ) { return false; } public bool OnSave( object entity, object id, object[ ] state, string[ ] propertyNames, IType[ ] types ) { return false; } public void OnPostFlush( object entity, object id, object[ ] currentState, string[ ] propertyNames, IType[ ] types ) { } public void PostFlush( ICollection entities ) { } public void PreFlush( ICollection entitites ) { } public object IsUnsaved( object entity ) { return null; } public object Instantiate( System.Type clazz, object id ) { return null; } public int[ ] FindDirty( object entity, object id, object[ ] currentState, object[ ] previousState, string[ ] propertyNames, IType[ ] types ) { return null; } } }
lgpl-2.1
C#
f9c8200b2b6f4ca140f99a336eb8ff86706f9f24
Fix for resend confirmation button
tpkelly/voting-application,JDawes-ScottLogic/voting-application,tpkelly/voting-application,Generic-Voting-Application/voting-application,JDawes-ScottLogic/voting-application,Generic-Voting-Application/voting-application,stevenhillcox/voting-application,tpkelly/voting-application,JDawes-ScottLogic/voting-application,stevenhillcox/voting-application,stevenhillcox/voting-application,Generic-Voting-Application/voting-application
VotingApplication/VotingApplication.Web/Views/Routes/ConfirmRegistration.cshtml
VotingApplication/VotingApplication.Web/Views/Routes/ConfirmRegistration.cshtml
<div ng-app="GVA.Manage" ng-controller="ConfirmRegistrationController"> <div class="manage-area centered"> <h2> Thank you for registering! </h2> <p class="text-centered"> You should receive an Email confirmation shortly. </p> <p class="text-centered"> If not, ensure you check any spam filters you may have running. </p> <div class="flexbox"> <button class="centered active-btn" ng-click="resendConfirmation()">Resend Confirmation Email</button> </div> </div> </div>
<div ng-app="GVA.Manage" ng-controller="ConfirmRegistrationController"> <div class="manage-area centered"> <h2> Thank you for registering! </h2> <p class="text-centered"> You should receive an Email confirmation shortly. </p> <p class="text-centered"> If not, ensure you check any spam filters you may have running. </p> <div class="flexbox"> <button class="centered active-btn" ng-click="resendConfirmation()">Resend Confirmation Email"</button> </div> </div> </div>
apache-2.0
C#
b060564c51100a182339fa3da96f98b7477cf784
Simplify GlobalKeywordRecommender
dotnet/roslyn,dotnet/roslyn,dotnet/roslyn
src/Features/CSharp/Portable/Completion/KeywordRecommenders/GlobalKeywordRecommender.cs
src/Features/CSharp/Portable/Completion/KeywordRecommenders/GlobalKeywordRecommender.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.Threading; using Microsoft.CodeAnalysis.CSharp.Extensions; using Microsoft.CodeAnalysis.CSharp.Extensions.ContextQuery; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.CSharp.Completion.KeywordRecommenders { internal class GlobalKeywordRecommender : AbstractSyntacticSingleKeywordRecommender { public GlobalKeywordRecommender() : base(SyntaxKind.GlobalKeyword) { } protected override bool IsValidContext(int position, CSharpSyntaxContext context, CancellationToken cancellationToken) { var syntaxTree = context.SyntaxTree; if (syntaxTree.IsMemberDeclarationContext(position, context.LeftToken)) { var token = context.TargetToken; if (token.GetAncestor<EnumDeclarationSyntax>() == null) { return true; } } return context.IsTypeContext || UsingKeywordRecommender.IsUsingDirectiveContext(context, forGlobalKeyword: true, cancellationToken) || context.IsAnyExpressionContext || syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || syntaxTree.IsAfterKeyword(position, SyntaxKind.RefKeyword, cancellationToken) || syntaxTree.IsAfterKeyword(position, SyntaxKind.ReadOnlyKeyword, cancellationToken) || syntaxTree.IsUsingAliasContext(position, cancellationToken); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. using System.Threading; using Microsoft.CodeAnalysis.CSharp.Extensions; using Microsoft.CodeAnalysis.CSharp.Extensions.ContextQuery; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.CSharp.Completion.KeywordRecommenders { internal class GlobalKeywordRecommender : AbstractSyntacticSingleKeywordRecommender { public GlobalKeywordRecommender() : base(SyntaxKind.GlobalKeyword) { } protected override bool IsValidContext(int position, CSharpSyntaxContext context, CancellationToken cancellationToken) { var syntaxTree = context.SyntaxTree; if (syntaxTree.IsMemberDeclarationContext(position, context.LeftToken)) { var token = context.TargetToken; if (token.GetAncestor<EnumDeclarationSyntax>() == null) { return true; } } return context.IsStatementContext || context.IsGlobalStatementContext || context.IsTypeContext || UsingKeywordRecommender.IsUsingDirectiveContext(context, forGlobalKeyword: true, cancellationToken) || context.IsAnyExpressionContext || context.IsObjectCreationTypeContext || context.IsIsOrAsTypeContext || context.IsFunctionPointerTypeArgumentContext || syntaxTree.IsAfterKeyword(position, SyntaxKind.ConstKeyword, cancellationToken) || syntaxTree.IsAfterKeyword(position, SyntaxKind.RefKeyword, cancellationToken) || syntaxTree.IsAfterKeyword(position, SyntaxKind.ReadOnlyKeyword, cancellationToken) || syntaxTree.IsUsingAliasContext(position, cancellationToken); } } }
mit
C#
3eecbc1b4c06acd69348fd49a4fdb32aee54719e
Add default AppConfigCommand constructor
appharbor/appharbor-cli
src/AppHarbor/Commands/AddConfigCommand.cs
src/AppHarbor/Commands/AddConfigCommand.cs
using System; namespace AppHarbor.Commands { public class AddConfigCommand : ICommand { public AddConfigCommand() { } public void Execute(string[] arguments) { throw new NotImplementedException(); } } }
using System; namespace AppHarbor.Commands { public class AddConfigCommand : ICommand { public void Execute(string[] arguments) { throw new NotImplementedException(); } } }
mit
C#
f92469309de4ecc7566ead387639f62ef3ff5ba0
Update feed and gravatar (#108)
stvansolano/planetxamarin,MabroukENG/planetxamarin,stvansolano/planetxamarin,beraybentesen/planetxamarin,beraybentesen/planetxamarin,planetxamarin/planetxamarin,beraybentesen/planetxamarin,planetxamarin/planetxamarin,stvansolano/planetxamarin,MabroukENG/planetxamarin,MabroukENG/planetxamarin,planetxamarin/planetxamarin,planetxamarin/planetxamarin
src/Firehose.Web/Authors/TheXamarinShow.cs
src/Firehose.Web/Authors/TheXamarinShow.cs
using Firehose.Web.Infrastructure; using System; using System.Collections.Generic; namespace Firehose.Web.Authors { public class TheXamarinShow : IAmACommunityMember { public string FirstName => "The Xamarin"; public string LastName => "Show"; public string StateOrRegion => "Channel 9"; public string EmailAddress => ""; public string ShortBioOrTagLine => "Weekly Developer Show for Xamarin Developers"; public Uri WebSite => new Uri("http://xamarinshow.com"); public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://s.ch9.ms/Shows/XamarinShow/feed"); } } public string TwitterHandle => "thexamarinshow"; public string GravatarHash => "7a0c7da0279b4e90439e780fa01924e0"; } }
using Firehose.Web.Infrastructure; using System; using System.Collections.Generic; namespace Firehose.Web.Authors { public class TheXamarinShow : IAmACommunityMember { public string FirstName => "The Xamarin"; public string LastName => "Show"; public string StateOrRegion => "Channel 9"; public string EmailAddress => "planet@xamarin.com"; public string ShortBioOrTagLine => "Weekly Developer Show"; public Uri WebSite => new Uri("http://xamarinshow.com"); public IEnumerable<Uri> FeedUris { get { yield return new Uri("https://channel9.msdn.com/Shows/XamarinShow/RSS"); } } public string TwitterHandle => "thexamarinshow"; public string GravatarHash => "5db2c9a87693f1fd71f18df1e049b975"; } }
mit
C#
88e809d8afe3f67992bfa81bcec93966eeaac960
Fix conversion of GitHubActionsTrigger (#410)
nuke-build/nuke,nuke-build/nuke,nuke-build/nuke,nuke-build/nuke
source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsConfiguration.cs
source/Nuke.Common/CI/GitHubActions/Configuration/GitHubActionsConfiguration.cs
// Copyright 2019 Maintainers of NUKE. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using System.Linq; using Nuke.Common.Tooling; using Nuke.Common.Utilities; using Nuke.Common.Utilities.Collections; namespace Nuke.Common.CI.GitHubActions.Configuration { public class GitHubActionsConfiguration : ConfigurationEntity { public string Name { get; set; } public GitHubActionsTrigger[] ShortTriggers { get; set; } public GitHubActionsDetailedTrigger[] DetailedTriggers { get; set; } public GitHubActionsJob[] Jobs { get; set; } public override void Write(CustomFileWriter writer) { writer.WriteLine($"name: {Name}"); writer.WriteLine(); if (ShortTriggers.Length > 0) writer.WriteLine($"on: [{ShortTriggers.Select(x => x.GetValue().ToLowerInvariant()).JoinComma()}]"); else { writer.WriteLine("on:"); using (writer.Indent()) { DetailedTriggers.ForEach(x => x.Write(writer)); } } writer.WriteLine(); writer.WriteLine("jobs:"); using (writer.Indent()) { Jobs.ForEach(x => x.Write(writer)); } } } }
// Copyright 2019 Maintainers of NUKE. // Distributed under the MIT License. // https://github.com/nuke-build/nuke/blob/master/LICENSE using System; using System.Linq; using Nuke.Common.Utilities; using Nuke.Common.Utilities.Collections; namespace Nuke.Common.CI.GitHubActions.Configuration { public class GitHubActionsConfiguration : ConfigurationEntity { public string Name { get; set; } public GitHubActionsTrigger[] ShortTriggers { get; set; } public GitHubActionsDetailedTrigger[] DetailedTriggers { get; set; } public GitHubActionsJob[] Jobs { get; set; } public override void Write(CustomFileWriter writer) { writer.WriteLine($"name: {Name}"); writer.WriteLine(); if (ShortTriggers.Length > 0) writer.WriteLine($"on: [{ShortTriggers.Select(x => x.ToString().ToLowerInvariant()).JoinComma()}]"); else { writer.WriteLine("on:"); using (writer.Indent()) { DetailedTriggers.ForEach(x => x.Write(writer)); } } writer.WriteLine(); writer.WriteLine("jobs:"); using (writer.Indent()) { Jobs.ForEach(x => x.Write(writer)); } } } }
mit
C#
44bacd0ba6ab6108f611f65e27a318d4859b4253
Fix path check
AlexanderSher/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,AlexanderSher/RTVS,karthiknadig/RTVS,MikhailArkhipov/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,AlexanderSher/RTVS,MikhailArkhipov/RTVS,MikhailArkhipov/RTVS,karthiknadig/RTVS,karthiknadig/RTVS,karthiknadig/RTVS
src/R/Components/Impl/PackageManager/Implementation/View/PackageDetails.xaml.cs
src/R/Components/Impl/PackageManager/Implementation/View/PackageDetails.xaml.cs
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using System; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Windows; using System.Windows.Controls; using System.Windows.Navigation; using Microsoft.Common.Core; using Microsoft.R.Components.PackageManager.ViewModel; namespace Microsoft.R.Components.PackageManager.Implementation.View { /// <summary> /// Interaction logic for PackageDetails.xaml /// </summary> public partial class PackageDetails : UserControl { private IRPackageViewModel Model => DataContext as IRPackageViewModel; public PackageDetails() { InitializeComponent(); } private void ButtonInstall_Click(object sender, RoutedEventArgs e) { Model?.InstallAsync().DoNotWait(); } private void ButtonUninstall_Click(object sender, RoutedEventArgs e) { Model?.UninstallAsync().DoNotWait(); } private void ButtonUpdate_Click(object sender, RoutedEventArgs e) { Model?.UpdateAsync().DoNotWait(); } private void RepositoryUri_RequestNavigate(object sender, RequestNavigateEventArgs e) { Process.Start(e.Uri.AbsoluteUri); } private void LibraryPath_RequestNavigate(object sender, RequestNavigateEventArgs e) { var path = e.Uri.ToString().Replace('/', '\\'); if (Directory.Exists(path)) { try { Process.Start(path); } catch (Win32Exception) { } } } private void Urls_RequestNavigate(object sender, RequestNavigateEventArgs e) { Process.Start(e.Uri.AbsoluteUri); } } }
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See LICENSE in the project root for license information. using System; using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Windows; using System.Windows.Controls; using System.Windows.Navigation; using Microsoft.Common.Core; using Microsoft.R.Components.PackageManager.ViewModel; namespace Microsoft.R.Components.PackageManager.Implementation.View { /// <summary> /// Interaction logic for PackageDetails.xaml /// </summary> public partial class PackageDetails : UserControl { private IRPackageViewModel Model => DataContext as IRPackageViewModel; public PackageDetails() { InitializeComponent(); } private void ButtonInstall_Click(object sender, RoutedEventArgs e) { Model?.InstallAsync().DoNotWait(); } private void ButtonUninstall_Click(object sender, RoutedEventArgs e) { Model?.UninstallAsync().DoNotWait(); } private void ButtonUpdate_Click(object sender, RoutedEventArgs e) { Model?.UpdateAsync().DoNotWait(); } private void RepositoryUri_RequestNavigate(object sender, RequestNavigateEventArgs e) { Process.Start(e.Uri.AbsoluteUri); } private void LibraryPath_RequestNavigate(object sender, RequestNavigateEventArgs e) { var path = e.Uri.ToString().Replace('/', '\\'); if (File.Exists(path)) { try { Process.Start(path); } catch (Win32Exception) { } } } private void Urls_RequestNavigate(object sender, RequestNavigateEventArgs e) { Process.Start(e.Uri.AbsoluteUri); } } }
mit
C#
c75f9741b3d3961600642d3ec6321b298fca44be
remove unneccessary usings from Constants
LukeWinikates/dotnet-toolbox,dotnet-toolbox/dotnet-toolbox,LukeWinikates/dotnet-toolbox,dotnet-toolbox/dotnet-toolbox,dotnet-toolbox/dotnet-toolbox,LukeWinikates/dotnet-toolbox,LukeWinikates/dotnet-toolbox,dotnet-toolbox/dotnet-toolbox
src/dotnet-toolbox.common/Constants.cs
src/dotnet-toolbox.common/Constants.cs
namespace dotnet_toolbox.common { public static class Constants { public static class Redis { public static readonly string PackageCrawlerJobQueueName = "PackageCrawlerJob"; public static readonly int PACKAGES_DB = 1; } } }
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; namespace dotnet_toolbox.common { public static class Constants { public static class Redis { public static readonly string PackageCrawlerJobQueueName = "PackageCrawlerJob"; public static readonly int PACKAGES_DB = 1; } } }
mit
C#